@edifice.io/client 2.5.5-develop-b2school.20260109115404 → 2.5.5-develop-b2school.20260109162050
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.cjs +1 -1
- package/dist/index.js +152 -133
- package/dist/share/Service.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var T=Object.defineProperty;var P=(u,e,t)=>e in u?T(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t;var n=(u,e,t)=>P(u,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const axios=require("axios"),utilities=require("@edifice.io/utilities"),ERROR_CODE={SUCCESS:"0000",UNKNOWN:"0010",NOT_INITIALIZED:"0020",NOT_SUPPORTED:"0030",APP_NOT_FOUND:"0040",AGENT_NOT_FOUND:"0050",TRANSPORT_ERROR:"0060",TIME_OUT:"0070",MALFORMED_DATA:"0080",NOT_LOGGED_IN:"0090"},APP$4={ADMIN:"admin",ARCHIVE:"archive",AUTH:"auth",CAS:"cas",COMMUNICATION:"communication",CONVERSATION:"conversation",DIRECTORY:"directory",USERBOOK:"userbook",INFRA:"infra",PORTAL:"portal",TIMELINE:"timeline",WORKSPACE:"workspace",EXPLORER:"explorer",HOMEWORKS:"homeworks",VIDEO:"video",MINDMAP:"mindmap",SCRAPBOOK:"scrapbook",COLLABORATIVEWALL:"collaborativewall",WIKI:"wiki",TIMELINEGENERATOR:"timelinegenerator",COLLABORATIVEEDITOR:"collaborativeeditor"},USER_PREFS={APPS:"apps",WIDGETS:"widgets",LANGUAGE:"language",AUTH_CONNECTOR_ACCESSED:"authenticatedConnectorsAccessed",CURSUS:"cursus",INFOTIP:"infotip",RGPD_COOKIES:"rgpdCookies"},b=class b{constructor(e){n(this,"name");n(this,"listeners",new Set);this.name=e}static getChannel(e){let t=b.channels.get(e);return t||(t=new b(e),b.channels.set(e,t)),t}listen(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}publish(e){for(const t of Array.from(this.listeners))try{t(e)}catch(s){console.error("[SimpleChannel] publish failed",s)}}close(){this.listeners.clear(),b.channels.delete(this.name)}};n(b,"channels",new Map);let SimpleChannel=b;class Subscription{constructor(e,t){n(this,"revoke");this._channel=e,this.revoke=this.setReceiver(s=>t==null?void 0:t(s))}setReceiver(e){if(!this._channel)return()=>{};const t=this._channel.listen(e);return()=>{t(),this._channel=void 0}}}class Subject{constructor(){n(this,"publishChannels",new Map)}getChannelName(e){return"Subject:"+e}getPublishChannel(e){const t=this.getChannelName(e);let s=this.publishChannels.get(t);return s||(s=this.newChannel(e),this.publishChannels.set(t,s)),s}newChannel(e){const t=this.getChannelName(e);return SimpleChannel.getChannel(t)}publish(e,t){typeof e=="string"&&this.getPublishChannel(e).publish(t)}subscribe(e,t){if(typeof e=="string"){const s=this.newChannel(e);return new Subscription(s,t)}else return new Subscription}}const ASYNC_DATA_NAME={SESSION_READY:"sessionReady",LANG_READY:"langReady",SKIN_READY:"skinReady",OVERRIDE_READY:"overrideReady",APPCONF_READY:"appConfReady"};class Promisified{constructor(){n(this,"_resolution");n(this,"_rejection");n(this,"_promise",new Promise((e,t)=>{this._resolution=e,this._rejection=t}))}get promise(){return this._promise}resolve(e){this._resolution&&this._resolution(e)}reject(e){this._rejection&&this._rejection(e)}}class NotifyFramework{constructor(){n(this,"promises",{});n(this,"subject",new Subject)}asyncData(e){return typeof this.promises[e]>"u"&&(this.promises[e]=new Promisified),this.promises[e]}onSessionReady(){return this.asyncData(ASYNC_DATA_NAME.SESSION_READY)}onLangReady(){return this.asyncData(ASYNC_DATA_NAME.LANG_READY)}onSkinReady(){return this.asyncData(ASYNC_DATA_NAME.SKIN_READY)}onOverridesReady(){return this.asyncData(ASYNC_DATA_NAME.OVERRIDE_READY)}onAppConfReady(){return this.asyncData(ASYNC_DATA_NAME.APPCONF_READY)}promisify(){return new Promisified}events(){return this.subject}}const notify=new NotifyFramework,loadedScripts$1={};class Http{constructor(e){n(this,"axios");n(this,"_latestResponse");this.axios=axios.create(e)}setCdn(e){e&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=e,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const t=arguments[1];return t.startsWith("/infra/public")&&(arguments[1]=e+t),/^\/([^\/]*)\/public/.test(t)&&(arguments[1]=e+t),t.startsWith("/assets")&&(arguments[1]=e+t),t=="/conf/public"&&(arguments[1]=t),t.startsWith("http")&&(arguments[1]=t),this.baseOpen.apply(this,arguments)})}toAxiosConfig(e){if(e){const t=Object.assign({},this.axios.defaults);return e.headers&&(t.headers&&(t.headers=Object.assign({},this.axios.defaults.headers)),Object.assign(t.headers,e.headers)),e.responseType&&(t.responseType=e.responseType),e.queryParams&&(t.params=Object.assign({},e.queryParams)),t}else return this.axios.defaults}toCdnUrl(e){const t=ConfigurationFrameworkFactory.instance().Platform.cdnDomain;if((t==null?void 0:t.length)>0&&e!=="/conf/public"){const s=""+e;(s.startsWith("/infra/public")||s.startsWith("/assets")||/^\/([^\/]*)\/public/.test(s))&&(e=t+s)}return e}mapAxiosError(e,t){return e.response?this._latestResponse=e.response:e.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN},!t||t.disableNotifications,this._latestResponse}mapAxiosResponse(e,t){return this._latestResponse=e,e.data}get latestResponse(){return this._latestResponse}isResponseError(){return this.latestResponse.status<200||this.latestResponse.status>=300}get(e,t){return this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t)).then(s=>this.mapAxiosResponse(s,t)).catch(s=>this.mapAxiosError(s,t))}post(e,t,s){return this.axios.post(e,t,this.toAxiosConfig(s)).then(r=>this.mapAxiosResponse(r,s)).catch(r=>this.mapAxiosError(r,s))}postFile(e,t,s){const r=this.toAxiosConfig(s);return r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"],this.axios.post(e,t,r).then(i=>this.mapAxiosResponse(i,s)).catch(i=>this.mapAxiosError(i,s))}postJson(e,t,s){const r=this.toAxiosConfig();return r.headers&&(r.headers["Content-Type"]="application/json"),this.axios.post(e,t,this.toAxiosConfig(s)).then(i=>this.mapAxiosResponse(i,s)).catch(i=>this.mapAxiosError(i,s))}put(e,t,s){return this.axios.put(e,t,this.toAxiosConfig(s)).then(r=>this.mapAxiosResponse(r,s)).catch(r=>this.mapAxiosError(r,s))}putJson(e,t,s){const r=this.toAxiosConfig(s);return r.headers&&(r.headers["Content-Type"]="application/json"),this.axios.put(e,t,r).then(i=>this.mapAxiosResponse(i,s)).catch(i=>this.mapAxiosError(i,s))}delete(e,t){return this.axios.delete(e,this.toAxiosConfig(t)).then(s=>this.mapAxiosResponse(s,t)).catch(s=>this.mapAxiosError(s,t))}deleteJson(e,t){return this.axios.delete(e,{data:t}).then(s=>this.mapAxiosResponse(s)).catch(s=>this.mapAxiosError(s))}getScript(e,t,s){const r=s??"exports",i=this.toAxiosConfig(t);return i.headers&&(i.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),i).then(o=>this.mapAxiosResponse(o,t)).then(o=>{try{const a=`"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;return Function(a)()}catch{return o}}).catch(o=>{throw this.mapAxiosError(o,t),o})}loadScript(e,t){return loadedScripts$1[e]?Promise.resolve():this.getScript(e,t).then(s=>{loadedScripts$1[e]=!0})}}class TransportFramework{constructor(){n(this,"_http",new Http)}get http(){return this._http}newHttpInstance(e){return new Http(e)}}const transport=new TransportFramework;class ConfigurationFrameworkFactory{static instance(){return configure}}const http$2=transport.http;class Session{constructor(){n(this,"_me",null);n(this,"_currentLanguage","");n(this,"_notLoggedIn",!0);n(this,"_description");n(this,"_profile")}get currentLanguage(){return this._currentLanguage}get notLoggedIn(){return this._notLoggedIn}get description(){return this._description}get avatarUrl(){let e=this.description.photo;return(!e||e==="no-avatar.jpg"||e==="no-avatar.svg")&&(e=ConfigurationFrameworkFactory.instance().Platform.theme.basePath+"/img/illustrations/no-avatar.svg"),e}get user(){return this._me}get currentApp(){return configure.Platform.apps.currentApp}async initialize(){return http$2.get("/auth/oauth2/userinfo").then(e=>{if(http$2.isResponseError()||typeof e=="string")throw ERROR_CODE.NOT_LOGGED_IN;return this.setCurrentModel(e),this._notLoggedIn?this.loadDefaultLanguage():this.loadUserLanguage()}).then(e=>(this.setCurrentLanguage(e),this.loadDescription())).then(()=>this.getUserProfile()).then(()=>{notify.onSessionReady().resolve(this._me)}).catch(e=>{if(e===ERROR_CODE.NOT_LOGGED_IN)return Promise.resolve();notify.onSessionReady().reject(e)})}setCurrentModel(e){this._me=e,this._notLoggedIn=!(e&&e.sessionMetadata&&e.sessionMetadata.userId)}hasWorkflow(e){var t;return e===void 0||((t=this._me)==null?void 0:t.authorizedActions.findIndex(s=>s.name===e))!==-1}hasRight(e,t){if(t==="owner")return e.owner&&e.owner.userId===this._me.userId;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;return i&&o}get latestQuotaAndUsage(){return http$2.get(`/workspace/quota/user/${this._me.userId}`).then(e=>(this._description&&(this._description.quota=e.quota,this._description.storage=e.storage),e)).catch(()=>({quota:0,storage:0}))}setCurrentLanguage(e){this._currentLanguage=e,notify.onLangReady().resolve(e)}loadDefaultLanguage(){return http$2.get("/locale").then(e=>e.locale).catch(()=>this._currentLanguage)}loadDescription(){return Promise.all([http$2.get("/userbook/api/person",{requestName:"refreshAvatar"}),http$2.get("/directory/userbook/"+this._me.userId)]).then(e=>(e[0].status==="ok"&&e[0].result&&e[0].result.length>0?this._description=e[0].result[0]:this._description={},this._description.type&&!this._description.profiles&&(this._description.profiles=this._description.type),Object.assign(this._description,e[1]),this._description))}get profile(){return this._profile}getUserProfile(){return http$2.get("/userbook/api/person").then(e=>e.result).then(e=>this._profile=e[0].type)}loadUserLanguage(){return http$2.get("/userbook/preference/language").then(e=>{try{return JSON.parse(e.preference)["default-domain"]}catch{return this.loadDefaultLanguage()}}).catch(()=>this.loadDefaultLanguage())}getEmailValidationInfos(){return http$2.get("/directory/user/mailstate")}checkEmail(e){return http$2.put("/directory/user/mailstate",{email:e})}tryEmailValidation(e){return http$2.post("/directory/user/mailstate",{key:e})}getMobileValidationInfos(){return http$2.get("/directory/user/mobilestate")}checkMobile(e){return http$2.put("/directory/user/mobilestate",{mobile:e})}tryMobileValidation(e){return http$2.post("/directory/user/mobilestate",{key:e})}getMfaInfos(){return http$2.get("/auth/user/mfa/code")}tryMfaCode(e){return http$2.post("/auth/user/mfa/code",{key:e})}}class SessionFramework{constructor(){n(this,"session",new Session)}initialize(){return this.session.initialize()}login(e,t,s,r){const i=new FormData;return i.append("email",e),i.append("password",t),typeof s<"u"&&i.append("rememberMe",""+s),typeof r<"u"&&i.append("secureLocation",""+r),transport.http.post("/auth/login",i,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(transport.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return transport.http.get("/auth/logout").finally(()=>{})}}const session=new SessionFramework;class Theme{constructor(){n(this,"_conf");n(this,"_loaded");n(this,"skinName","");n(this,"themeName","");n(this,"skin","raw");n(this,"themeUrl","/assets/themes/raw/default/");n(this,"templateOverrides",{});n(this,"portalTemplate","/assets/themes/raw/portal.html");n(this,"basePath","");n(this,"logoutCallback","");n(this,"skins",[]);n(this,"is1D",!1);n(this,"is2D",!1);n(this,"_onSkinReady",notify.onSkinReady());n(this,"_onOverrideReady",notify.onOverridesReady())}initialize(e){return notify.onSessionReady().promise.then(()=>this.load(e))}get version(){return configure.Platform.deploymentTag}get cdnDomain(){return configure.Platform.cdnDomain}async onFullyReady(){return await this._loaded,this}onSkinReady(){return this._onSkinReady.promise}onOverrideReady(){return this._onOverrideReady.promise}async getConf(e){return this._conf=this._conf??await transport.http.getScript("/assets/theme-conf.js",{queryParams:{v:e??this.version}},"exports.conf"),this._conf}load(e){return e=e??this.version,this._loaded||(this._loaded=(session.session.notLoggedIn?this.loadDisconnected(e):this.loadConnected(e)).then(async()=>{var s,r;const t=await this.listSkins();this.is1D=((s=t.find(i=>i.child===this.skin))==null?void 0:s.parent)==="panda",this.is2D=((r=t.find(i=>i.child===this.skin))==null?void 0:r.parent)==="theme-open-ent"})),this._loaded}loadDisconnected(e){return new Promise((t,s)=>{transport.http.get("/skin",{queryParams:{v:this.version}}).then(r=>{this.skin=r.skin,this.themeUrl=`${this.cdnDomain}/assets/themes/${r.skin}/skins/default/`,this.basePath=this.themeUrl+"../../",this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${r.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(i=>{this.templateOverrides=i,this._onOverrideReady.resolve(i),t()}).catch(i=>{if(transport.http.latestResponse.status===404)t();else throw i})}).catch(r=>{this._onSkinReady.reject(r),this._onOverrideReady.reject(r),s()})})}loadConnected(e){return new Promise((t,s)=>{this.loadDefaultTheme(e).then(()=>{this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${this.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(r=>{this.templateOverrides=r,this._onOverrideReady.resolve(r),t()}).catch(r=>{if(transport.http.latestResponse.status===404)t(),this._onSkinReady.reject(r),this._onOverrideReady.reject(r);else throw r})})})}async loadDefaultTheme(e){return session.session.notLoggedIn?Promise.reject():transport.http.get("/theme",{queryParams:{_:e}}).then(t=>{this.skinName=t.skinName,this.themeName=t.themeName,this.themeUrl=t.skin,this.basePath=`${this.cdnDomain}${this.themeUrl}../../`,this.skin=this.themeUrl.split("/assets/themes/")[1].split("/")[0],this.portalTemplate=`${this.cdnDomain}/assets/themes/${this.skin}/portal.html`,this.logoutCallback=t.logoutCallback})}listThemes(){return transport.http.get("/themes")}async setDefaultTheme(e){await transport.http.get("/userbook/api/edit-userbook-info?prop=theme-"+this.skin+"&value="+e._id),await this.loadDefaultTheme(this.version)}listSkins(){return this.skins.length>0?Promise.resolve(this.skins):this.getConf().then(e=>{const t=e.overriding.find(s=>s.child===this.skin);return t!=null&&t.group?this.skins=this.skins.concat(e.overriding.filter(s=>s.group===t.group)):this.skins=this.skins.concat(e.overriding),this.skins})}async getHelpPath(){const t=(await this.listSkins()).find(s=>s.child===this.skin);return(t==null?void 0:t.help)??"/help"}}const bundle$1={},promises$1={},defaultDiacriticsRemovalMap$1=[{base:"A",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},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class Idiom{translate(e,t){e=e??"";let s=bundle$1[e]===void 0?e:bundle$1[e];if(t&&typeof t=="object")for(const r in t)typeof t[r]<"u"&&(s=s.replace(new RegExp("\\${"+r+"}","g"),""+t[r]));return s}addBundlePromise(e){return this.loadBundlePromise(session.session.currentLanguage,e)}addBundle(e,t){this.loadBundle(session.session.currentLanguage,e,t)}loadBundlePromise(e,t){return this.loadBundle(e,t),promises$1[t]}loadBundle(e,t,s){const r=promises$1[t];if(r)s&&r.then(s).catch(s);else{const i=new Promisified;promises$1[t]=i.promise;const o={};e&&(o["Accept-Language"]=e),transport.http.get(t,{headers:o}).then(a=>{Object.assign(bundle$1,a),typeof s=="function"&&s(),i.resolve()}).catch(a=>{typeof s=="function"&&s(),i.reject()})}}addTranslations(e,t){notify.onLangReady().promise.then(s=>{this.loadBundle(s,e+"/"+s+".json",t)})}addAllTranslations(e){return e&&e.length>0?notify.onLangReady().promise.then(t=>Promise.all(e.map(s=>this.loadBundlePromise(t,s+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(const t in e)typeof bundle$1[t]!="string"&&(bundle$1[t]=e[t])}removeAccents(e){for(let t=0;t<defaultDiacriticsRemovalMap$1.length;t++)e=e.replace(defaultDiacriticsRemovalMap$1[t].letters,defaultDiacriticsRemovalMap$1[t].base);return e}}class UserPreferences{constructor(){n(this,"data",{})}get(e){return this.data[e]}load(e,t){return transport.http.get("/userbook/preference/"+e).then(s=>{try{return JSON.parse(s.preference)}catch{return t??{}}}).then(s=>(this.data[e]=s??{},s))}update(e,t){return t!==void 0&&(this.data[e]=t),this}save(e){return transport.http.putJson("/userbook/preference/"+e,this.data[e])}}class User{constructor(){n(this,"_me",null);n(this,"_keepOpenOnLogout",!1);n(this,"_preferences",new UserPreferences);n(this,"_bookmarkedApps",[])}get keepOpenOnLogout(){return this._keepOpenOnLogout}get preferences(){return this._preferences}get bookmarkedApps(){return this._bookmarkedApps}initialize(e){return this.loadPublicConf(),notify.onSessionReady().promise.then(t=>{t&&this.setCurrentModel(t)})}setCurrentModel(e){this._me=e,this._preferences=new UserPreferences,this.loadBookmarks()}loadPublicConf(){return transport.http.get("/conf/public").then(e=>(this._keepOpenOnLogout=(e==null?void 0:e.keepOpenOnLogout)||!1,e))}async loadBookmarks(){await transport.http.get("/userbook/preference/apps").then(e=>{e.preference||(e.preference=null);const t=JSON.parse(e.preference);let s;if(t&&t.length&&typeof t.concat=="function"){this._bookmarkedApps=t,s={bookmarks:t.map(o=>o.name),applications:[]},transport.http.putJson("/userbook/preference/apps",s);return}else s=t;s||(s={bookmarks:[],applications:[]});let r=!0;const i=[];s.bookmarks.forEach((o,a)=>{const c=this._me.apps.find(l=>l.name===o);if(c){const l=Object.assign({},c);this._bookmarkedApps.push(l)}else i.push(o),r=!1}),i.forEach(o=>{const a=s.bookmarks.indexOf(o);a!==-1&&s.bookmarks.splice(a,1)}),r||transport.http.putJson("/userbook/preference/apps",s)})}loadAppPrefs(e){return this.preferences.load(e,{})}saveAppPrefs(e){return this.preferences.save(e)}loadLanguage(){return this.preferences.load("language",{"default-domain":session.session.currentLanguage}).then(e=>e["default-domain"])}saveLanguage(e){return this.preferences.update("language",{"default-domain":e}).save("language")}}const http$1=transport==null?void 0:transport.http;class AppConf{constructor(){n(this,"_publicConf",{});n(this,"_currentApp");n(this,"_appConf",{})}get currentApp(){return this._currentApp??null}setCurrentApp(e){return this._currentApp=e,this}async initialize(e,t=!1){t||this.setCurrentApp(e),await Promise.all([this.getPublicConf(e),this.loadI18n(e)])}async getPublicConf(e){return this._publicConf[e]||(this._publicConf[e]=await http$1.get(`/${e}/conf/public`,{queryParams:{_:configure.Platform.deploymentTag}})),this._publicConf[e]}async getWebAppConf(e){let t;return this._appConf[e]||(await http$1.get("/applications-list")).apps.forEach(r=>{if(r!=null&&r.prefix){const i=r.prefix.replace("/","");this._appConf[i]=r}else r!=null&&r.name&&r.name.toLowerCase()==e&&(t=r)}),this._appConf[e]??t}async loadI18n(e){return await notify.onLangReady().promise,configure.Platform.idiom.addBundlePromise(`/${e}/i18n`)}}class Analytics{constructor(){n(this,"_status","void");n(this,"_params")}get status(){return this._status}xiti(){return this.parametersWithCheck("xiti",!1)}parameters(e){return this.parametersWithCheck(e,!0)}async parametersWithCheck(e,t){return this.initialize().promise.then(s=>!t||s.type===e||s.type==="multiple"?s[e]:void 0)}initialize(){return this._params||(this._params=notify.promisify(),this._status="pending",Promise.all([transport.http.get("/analyticsConf"),transport.http.get("/xiti/config")]).then(async e=>{var t;if(!e||!e[0]||!e[0].type)throw ERROR_CODE.MALFORMED_DATA;e[1]&&e[1].active&&(e[0].xiti=await this.initializeXiti(e[1])),(t=this._params)==null||t.resolve(e[0]),this._status="ready"}).catch(e=>{var t;throw this._status="failed",(t=this._params)==null||t.reject(),e})),this._params}async initializeXiti(e){if(!e.structureMap||!configure.Platform.apps.currentApp)return;const t=await notify.onSessionReady().promise,s=session.session.description;let r;for(const l of t.structures){const h=e.structureMap[l];if(h&&h.collectiviteId&&h.UAI){r=h;break}}if(!r||!r.active)return;const i=await configure.Platform.apps.getPublicConf(configure.Platform.apps.currentApp);if(!i)return;const o=i.xiti;if(!o||!o.LIBELLE_SERVICE||!r.UAI)return;function a(l){let h="";for(let p=0;p<l.length;p++)h+=l.charCodeAt(p);return h}const c={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:o.LIBELLE_SERVICE,TYPE:o.OUTIL?"TIERS":"NATIF",OUTIL:o.OUTIL?o.OUTIL:"",STRUCT_ID:r.collectiviteId,STRUCT_UAI:r.UAI,PROJET:r.projetId?r.projetId:e.ID_PROJET,EXPLOITANT:e.ID_EXPLOITANT,PLATFORME:r.plateformeId?r.plateformeId:e.ID_PLATEFORME,ID_PERSO:a(t.userId),PROFILE:s.profiles&&s.profiles.length>0?c[s.profiles[0]]??"":""}}}class ConfigurationFramework{constructor(){n(this,"Platform",{deploymentTag:"",cdnDomain:"",apps:new AppConf,theme:new Theme,analytics:new Analytics,idiom:new Idiom,listLanguages:()=>transport.http.get("/languages")});n(this,"School",{});n(this,"User",new User)}async initialize(e,t){if(!e){const r=l=>(l<10?"0":"")+l.toFixed(0),i=new Date,o=i.getFullYear(),a=i.getMonth()+1,c=i.getDate();e=`${o}${r(a)}${r(c)}`}const s=e;this.Platform.deploymentTag=e,typeof t=="string"&&t.length>0&&(this.Platform.cdnDomain=t),transport.http.setCdn(this.Platform.cdnDomain),await Promise.all([this.Platform.theme.initialize(s),notify.onSessionReady().promise.then(r=>this.Platform.idiom.addBundlePromise("/i18n")),this.User.initialize(s)])}}const configure=new ConfigurationFramework,http=transport==null?void 0:transport.http;var v;const me=(v=session==null?void 0:session.session)==null?void 0:v.user;class Notification{constructor(e){n(this,"_id");n(this,"model");e.reported=e.reporters&&e.reporters.length>0,this._id=e._id,this.model=e}isUnread(){var e;return((e=this.model.recipients)==null?void 0:e.find(t=>t.userId===me.userId))!==void 0}delete(){return http.delete("/timeline/"+this._id)}discard(){return http.put("/timeline/"+this._id)}report(){return http.put("/timeline/"+this._id+"/report")}}class TimelineApp{constructor(){n(this,"_notifications",[]);n(this,"_notificationTypes",[]);n(this,"_flashMessages",[]);n(this,"_pageNumber",0);n(this,"_lastPage",!1);n(this,"_loading",!1);n(this,"showMine",!1)}get notifications(){return this._notifications}get isLoading(){return this._loading}get page(){return this._pageNumber}get hasMorePage(){return!this._lastPage}get notificationTypes(){return this._notificationTypes}get selectedNotificationTypes(){return this.preferences.type=this.preferences.type||[],this.preferences.type}get preferences(){return configure.User.preferences.get(APP$4.TIMELINE)}get flashMessages(){return this._flashMessages}savePreferences(){return configure.User.saveAppPrefs(APP$4.TIMELINE)}resetPagination(){this._pageNumber=0,this._lastPage=!1,this._loading=!1}initialize(){return Promise.all([configure.User.loadAppPrefs(APP$4.TIMELINE),transport.http.get("/timeline/types")]).then(e=>{this._notificationTypes=e[1]})}loadNotifications(e){if(this._loading||this._lastPage)return Promise.resolve();e&&(this._pageNumber++,this._lastPage=!1);const t=this.selectedNotificationTypes;if(t.length===0)return this._lastPage=!0,Promise.resolve();const s={page:this.page,mine:1};return this.showMine||delete s.mine,this._loading=!0,transport.http.get(`/timeline/lastNotifications?type=${t.join("&type=")}`,{queryParams:s}).then(r=>{if(this._loading=!1,r.status==="ok")if(r.number&&r.results){const i=r.results.filter(o=>this._notifications.findIndex(a=>a._id===o._id)===-1).map(o=>new Notification(o));this._notifications=this._notifications.concat(i),this._pageNumber++}else this._lastPage=!0}).catch(r=>{this._loading=!1})}loadFlashMessages(){return transport.http.get("/timeline/flashmsg/listuser").then(e=>{this._flashMessages=e})}markAsRead(e){return transport.http.put("/timeline/flashmsg/"+e.id+"/markasread")}}class ITimelineFactory{static createInstance(){return new TimelineApp}}const ReactionTypes=["REACTION_1","REACTION_2","REACTION_3","REACTION_4"];class NotifyFrameworkFactory{static instance(){return notify}}const LAYER_NAME={WIDGETS:"widgets",EXPLORER:"explorer",TRANSPORT:"transport",WEB_DATA:"webDataPipeline"},EVENT_NAME={USERPREF_CHANGED:"userprefChanged",SEARCH_RESULTED:"searchResulted",ERROR_OCCURED:"error",DATA_TRACKED:"track"};class ServiceRegistry extends Map{register({application:e,resourceType:t},s){this.set(`${e}:main`,s),this.set(`${e}:${t}`,s)}findService(e,t){return this.lookupService(e,t)}findMainService({application:e},t){return this.lookupService({application:e,resourceType:"main"},t)}isRegistered({application:e,resourceType:t}){return this.get(`${e}:${t}`)!==void 0}lookupService({application:e,resourceType:t},s){const r=this.get(`${e}:${t}`);if(r===void 0)throw`Service not found: ${e}:${t}`;return r(s)}}const m=class m{constructor(e){n(this,"checkHttpResponse",e=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return e});this.context=e}get http(){return this.context.http()}async copy(e){const t=await this.http.post("/archive/duplicate",{application:e.application,resourceId:e.resourceId});return this.checkHttpResponse(t)}async publish(e){const t=new FormData;return t.append("title",e.title),t.append("cover",e.cover),t.append("coverName",e.cover.name),t.append("coverType",e.cover.type),t.append("teacherAvatar",e.teacherAvatar),t.append("teacherAvatarName",e.teacherAvatar.name||`teacherAvatar_${e.userId}`),t.append("teacherAvatarType",e.teacherAvatar.type),t.append("language",e.language),e.activityType.forEach(i=>{t.append("activityType[]",i)}),e.subjectArea.forEach(i=>{t.append("subjectArea[]",i)}),e.age.forEach(i=>{t.append("age[]",i.toString())}),t.append("description",e.description),e.keyWords.split(",").forEach(i=>{t.append("keyWords[]",i.trim())}),t.append("licence",e.licence),t.append("pdfUri",`${window.location.origin}${this.getPrintUrl(e.resourceEntId)}`),t.append("application",e.application?e.application:""),t.append("resourceId",e.resourceId),t.append("teacherSchool",e.userStructureName),await this.http.post("/appregistry/library/resource",t,{headers:{"Content-Type":"multipart/form-data"}})}async createContext(e){const t=await this.http.get("/explorer/context",{queryParams:this.toQueryParams(e)});return this.checkHttpResponse(t)}async searchContext(e){const t=await this.http.get("/explorer/resources",{queryParams:this.toQueryParams(e)});return this.checkHttpResponse(t)}async searchResource(e){const t=await this.http.get(`/explorer/resources/${e.id}`,{queryParams:this.getResourceParams(e)});return this.checkHttpResponse(t)}async createFolder(e){const t=await this.http.post("/explorer/folders",this.createFolderToBodyParams(e));return this.checkHttpResponse(t)}async updateFolder(e){const t=await this.http.put(`/explorer/folders/${e.folderId}`,this.createFolderToBodyParams(e));return this.checkHttpResponse(t)}async moveToFolder(e,t=!1){e.resourceIds=t?await this.mapAssetIdToIds({application:e.application,assetIds:e.resourceIds}):e.resourceIds;const s=await this.http.post(`/explorer/folders/${e.folderId}/move`,this.moveToBodyParams(e));return this.checkHttpResponse(s)}async listSubfolders(e){const t=await this.http.get(`/explorer/folders/${e}`);return this.checkHttpResponse(t)}async deleteAll(e,t=!1){e.resourceIds=t?await this.mapAssetIdToIds({application:e.application,assetIds:e.resourceIds}):e.resourceIds;const s=await this.http.deleteJson("/explorer",e);return this.checkHttpResponse(s)}async trashAll({resourceType:e,...t},s=!1){t.resourceIds=s?await this.mapAssetIdToIds({application:t.application,assetIds:t.resourceIds}):t.resourceIds;const r=await this.http.putJson("/explorer/trash",t);return this.checkHttpResponse(r)}async restoreAll({resourceType:e,...t},s=!1){t.resourceIds=s?await this.mapAssetIdToIds({application:t.application,assetIds:t.resourceIds}):t.resourceIds;const r=await this.http.putJson("/explorer/restore",t);return this.checkHttpResponse(r)}async mapAssetIdToIds({application:e,assetIds:t}){const s=await this.searchContext({application:e,pagination:{startIdx:0,pageSize:t.length+1},types:[],filters:{},asset_id:t});return t.map(r=>{const i=s.resources.find(o=>o.assetId===r);if(i===void 0)throw"explorer.assetid.notfound";return i.id})}async getThumbnailPath(e){if(typeof e>"u")return e;if(typeof e=="string")if(e.startsWith("blob:")){const t=await fetch(e).then(r=>r.blob());return`/workspace/document/${(await this.context.workspace().saveFile(t,{visibility:"protected",application:this.getApplication()}))._id}`}else return e;else return`/workspace/document/${(await this.context.workspace().saveFile(e,{visibility:"protected",application:this.getApplication()}))._id}`}toQueryParams(e){const t={application:e.application,start_idx:e.pagination.startIdx,page_size:e.pagination.pageSize,trashed:e.trashed};if(e.types.length>0&&(t.resource_type=e.types[0]),e.orders&&Object.entries(e.orders).length){const[[s,r]]=Object.entries(e.orders);t.order_by=`${s}:${r}`}return e.filters&&Object.assign(t,e.filters),typeof e.search=="string"&&(t.search=e.search),typeof e.asset_id<"u"&&(t.asset_id=[...e.asset_id]),typeof e.id<"u"&&(t.id=e.id),t}getResourceParams(e){return{application:e.application}}createFolderToBodyParams(e){return{application:e.application,resourceType:e.type,parentId:e.parentId,name:e.name}}moveToBodyParams(e){return{application:e.application,resourceType:this.getResourceType(),resourceIds:e.resourceIds,folderIds:e.folderIds}}};n(m,"registry",new ServiceRegistry),n(m,"register",m.registry.register.bind(m.registry)),n(m,"findService",m.registry.findService.bind(m.registry)),n(m,"findMainService",m.registry.findMainService.bind(m.registry)),n(m,"isRegistered",m.registry.isRegistered.bind(m.registry));let ResourceService=m;const APP$3="scrapbook",RESOURCE$3="scrapbook";class ScrapbookResourceService extends ResourceService{create(e){throw new Error("Method not implemented.")}async update(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.put(`/scrapbook/${e.entId}`,{trashed:e.trashed?1:0,title:e.name,icon:t,subTitle:e.description});return this.checkHttpResponse(s),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE$3}getApplication(){return APP$3}getFormUrl(e){return e?`/scrapbook?folderid=${e}#/create-scrapbook/`:"/scrapbook#/create-scrapbook/"}getViewUrl(e){return`/scrapbook#/view-scrapbook/${e}`}getPrintUrl(e){return`/scrapbook/print#/print-scrapbook/${e}`}getEditUrl(e){return`/scrapbook#/edit-scrapbook/${e}`}getExportUrl(e){return`/scrapbook/exportHtml/${e}`}}ResourceService.register({application:RESOURCE$3,resourceType:RESOURCE$3},u=>new ScrapbookResourceService(u));const APP$2="homeworks",RESOURCE$2="homeworks";class HomeworksResourceService extends ResourceService{async create(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.post("/homeworks",{title:e.name,thumbnail:t,description:e.description,repeats:e.repeats,folder:e.folder});return this.checkHttpResponse(s),{thumbnail:t,entId:s._id}}async update(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.put(`/homeworks/${e.entId}`,{title:e.name,thumbnail:t,description:e.description,repeats:e.repeats});return this.checkHttpResponse(s),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE$2}getApplication(){return APP$2}getFormUrl(e){return e?`/homeworks?folderid=${e}#/create-homeworks/`:"/homeworks#/create-homeworks/"}getViewUrl(e){return`/homeworks#/view-homeworks/${e}`}getPrintUrl(e){return`/homeworks/print#/print-homeworks/${e}`}getEditUrl(e){return`/homeworks#/edit-homeworks/${e}`}getExportUrl(){throw new Error("Export not implemented.")}}ResourceService.register({application:RESOURCE$2,resourceType:RESOURCE$2},u=>new HomeworksResourceService(u));const APP$1="timelinegenerator",RESOURCE$1="timelinegenerator";class TimelineGeneratorResourceService extends ResourceService{async create(e){const t=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",s=await this.http.post("/timelinegenerator/timelines",{headline:e.name,text:e.description,icon:t,type:"default",folder:e.folder});return this.checkHttpResponse(s),s}async update(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.put(`/timelinegenerator/timeline/${e.entId}`,{headline:e.name,text:e.description,icon:t,trashed:!!e.trashed,_id:e.entId,type:"default"});return this.checkHttpResponse(s),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE$1}getApplication(){return APP$1}getFormUrl(){throw new Error("Method not implemented.")}getViewUrl(e){return`/timelinegenerator#/view/${e}`}getPrintUrl(e){return`/timelinegenerator/print#/print/${e}`}getEditUrl(){throw new Error("Method not implemented.")}getExportUrl(){throw new Error("Method not implemented.")}}ResourceService.register({application:RESOURCE$1,resourceType:RESOURCE$1},u=>new TimelineGeneratorResourceService(u));const APP="collaborativeeditor",RESOURCE="collaborativeeditor";class CollaborativeEditorResourceService extends ResourceService{async create(e){const{name:t,description:s,thumbnail:r,folder:i}=e,o=r?await this.getThumbnailPath(r):"",a=await this.http.post("/collaborativeeditor",{name:t,description:s,thumbnail:o,folder:i});return this.checkHttpResponse(a),a}async update(e){const{name:t,description:s,thumbnail:r,entId:i}=e,o=await this.getThumbnailPath(r),a=await this.http.put(`/collaborativeeditor/${i}`,{name:t,description:s,thumbnail:o});return this.checkHttpResponse(a),{thumbnail:o,entId:i}}getResourceType(){return RESOURCE}getApplication(){return APP}getFormUrl(){throw new Error("Method not implemented.")}getViewUrl(e){return`/collaborativeeditor#/view/${e}`}getPrintUrl(){throw new Error("Method not implemented.")}getEditUrl(){throw new Error("Method not implemented.")}getExportUrl(){throw new Error("Method not implemented.")}}ResourceService.register({application:RESOURCE,resourceType:RESOURCE},u=>new CollaborativeEditorResourceService(u));const globalCache={},mutexPromise={};class CacheService{constructor(e){this.context=e}get http(){return this.context.http()}async fromCacheIfPossible(e,t,s){if(mutexPromise[e]!==void 0&&await mutexPromise[e],globalCache[e])return globalCache[e];try{const r=t();mutexPromise[e]=r;const i=await r;return s(i)&&(globalCache[e]=i),i}catch(r){throw console.error(`Failed to retrieve value for: ${e}`,r),r}}clearCache(e){if(e)delete globalCache[e];else for(const t in globalCache)globalCache.hasOwnProperty(t)&&delete globalCache[t]}async httpGet(e,t){return this.fromCacheIfPossible(e,async()=>{const s=await this.http.get(e,t),r={...this.http.latestResponse};return{value:s,response:r}},({response:s})=>!(s.status<200||s.status>=300))}async httpGetJson(e,t){const{response:s,value:r}=await this.httpGet(e,t);if(s.status<200||s.status>=300)throw`Bad http status (${s.status}) for url: ${e}`;return r}}class ConfService{constructor(e){this.context=e}get http(){return this.context.http()}get cache(){return this.context.cache()}get cdnDomain(){return configure.Platform.cdnDomain}get notify(){return this.context.notify()}async getConf(e){const[t,s]=await Promise.all([this.getThemeConf(),this.getApplicationsList()]),[r,i]=await Promise.all([this.getTheme({conf:t,publicTheme:s===void 0}),this.getWebAppConf({app:e,applications:s??[]})]),o={app:e,applications:s??[],conf:t,currentApp:i,theme:r};return this.notify.onAppConfReady().resolve(o),o}async getPublicConf(e){const{response:t,value:s}=await this.cache.httpGet(`/${e}/conf/public`,{queryParams:{_:configure.Platform.deploymentTag}});if(t.status<200||t.status>=300)throw ERROR_CODE.APP_NOT_FOUND;return s}getCdnUrl(){}async savePreference(e,t){this.http.putJson(`/userbook/preference/${e}`,t)}async getPreference(e){const t=await this.http.get(`/userbook/preference/${e}`);return this.http.isResponseError()||typeof t=="string"?{}:JSON.parse(t.preference)}async getThemeConf(e){return await this.http.getScript("/assets/theme-conf.js",{queryParams:{v:e}},"exports.conf")}async getApplicationsList(){const e=await this.http.get("/applications-list");if(!(this.http.isResponseError()||typeof e=="string"))return e.apps}async getWebAppConf({app:e,applications:t}){return t.find(r=>{if(r!=null&&r.prefix)return(r==null?void 0:r.prefix.replace("/",""))===e})}async getTheme({version:e,conf:t,publicTheme:s}){var p;const r=await this.http.get("/theme"),i=(p=t==null?void 0:t.overriding)==null?void 0:p.find(d=>s?d.parent==="theme-open-ent"&&d.bootstrapVersion==="ode-bootstrap-neo":d.child===(r==null?void 0:r.themeName)),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";return{basePath:`${this.cdnDomain}${a}../../`,bootstrapVersion:l,is1d:h,logoutCallback:(r==null?void 0:r.logoutCallback)||"",skin:i==null?void 0:i.child,skinName:o,skins:c,themeName:i==null?void 0:i.child,themeUrl:a,npmTheme:(i==null?void 0:i.npmTheme)??void 0}}async getLogoutCallback(e){const{response:t,value:s}=await this.cache.httpGet("/theme",{queryParams:{_:e}});if(t.status<200||t.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return s.logoutCallback}}class DirectoryService{constructor(e){this.odeServices=e}get http(){return this.odeServices.http()}get cache(){return this.odeServices.cache()}getAvatarUrl(e,t,s="100x100"){return t==="user"?`/userbook/avatar/${e}?thumbnail=${s}`:"/assets/img/illustrations/group-avatar.svg"}getDirectoryUrl(e,t){return t==="user"?`/userbook/annuaire#/${e}`:`/userbook/annuaire#/group-view/${e}`}async getBookMarks(){return(await this.cache.httpGetJson("/directory/sharebookmark/all")).map(({id:t,name:s})=>({id:t,displayName:s,members:[]}))}async getBookMarkById(e){const{groups:t,id:s,name:r,users:i,notVisibleCount:o}=await this.http.get(`/directory/sharebookmark/${e}`);return{id:s,displayName:r,notVisibleCount:o,groups:t.map(({name:a,id:c,nbUsers:l})=>({nbUsers:l,displayName:a,id:c})),users:i.map(({displayName:a,id:c,profile:l})=>({profile:l,displayName:a,firstName:"",lastName:"",login:"",id:c}))}}async saveBookmarks(e,{bookmarks:t,groups:s,users:r}){this.cache.clearCache("/directory/sharebookmark/all");const i=r.map(d=>typeof d=="string"?d:d.id),o=s.map(d=>typeof d=="string"?d:d.id),a=t.map(async d=>{if(typeof d=="string"){const{displayName:R,groups:E,id:g,users:A}=await this.getBookMarkById(d),f=A.map(F=>F.id),y=E.map(F=>F.id);return{displayName:R,id:g,members:[...y,...f]}}else return Promise.resolve(d)}),l=(await Promise.all(a)).map(d=>d.members).reduce((d,R)=>[...d,...R],[]),h={name:e,members:[...i,...o,...l]},{id:p}=await this.http.postJson("/directory/sharebookmark",h);return{id:p,displayName:e,members:h.members}}}const loadedScripts={};class HttpService{constructor(e,t){n(this,"axios");n(this,"baseUrl");n(this,"headers",{});n(this,"_latestResponse");this.context=e,this.axios=axios.create(t)}fixBaseUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:this.baseUrl?this.baseUrl.endsWith("/")||e.startsWith("/")?`${this.baseUrl}${e}`:`${this.baseUrl}/${e}`:e}useBaseUrl(e){return this.baseUrl=e,this}useHeaders(e){return this.headers=e,this}setCdn(e){e&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=e,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const t=arguments[1];return t.startsWith("/infra/public")&&(arguments[1]=e+t),/^\/([^\/]*)\/public/.test(t)&&(arguments[1]=e+t),t.startsWith("/assets")&&(arguments[1]=e+t),t=="/conf/public"&&(arguments[1]=t),t.startsWith("http")&&(arguments[1]=t),this.baseOpen.apply(this,arguments)})}toAxiosConfig(e){if(e){const t=Object.assign({},this.axios.defaults);e.headers&&(t.headers=Object.assign({},this.axios.defaults.headers),Object.assign(t.headers,e.headers)),e.responseType&&(t.responseType=e.responseType),e.queryParams&&(t.params=Object.assign({},e.queryParams));const s=t.headers??{};return t.headers={...s,...this.headers},t}else return this.axios.defaults}toCdnUrl(e){e=this.fixBaseUrl(e);const t=this.context.conf().getCdnUrl()||"";if(t.length>0&&e!=="/conf/public"){const s=""+e;(s.startsWith("/infra/public")||s.startsWith("/assets")||/^\/([^\/]*)\/public/.test(s))&&(e=t+s)}return e}mapAxiosError(e,t){e.response?this._latestResponse=e.response:e.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN};const{status:s,statusText:r,headers:i,data:o}=this._latestResponse;return t!=null&&t.disableNotifications||notify.events().publish(LAYER_NAME.TRANSPORT,{name:EVENT_NAME.ERROR_OCCURED,data:{params:t,response:{status:s,statusText:r,headers:i},payload:o}}),o}mapAxiosResponse(e,t){return this._latestResponse=e,e.data}get latestResponse(){return this._latestResponse}isResponseError(){return this.latestResponse.status<200||this.latestResponse.status>=300}async get(e,t){try{const s=await this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t));return this.mapAxiosResponse(s,t)}catch(s){throw this.mapAxiosError(s,t)}}async post(e,t,s){try{const r=await this.axios.post(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(r,s)}catch(r){throw this.mapAxiosError(r,s)}}async postFile(e,t,s){const r=this.toAxiosConfig(s);r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"];try{const i=await this.axios.post(this.fixBaseUrl(e),t,{...r,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async postJson(e,t,s){const r=this.toAxiosConfig();r.headers&&(r.headers["Content-Type"]="application/json");try{const i=await this.axios.post(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async put(e,t,s){try{const r=await this.axios.put(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(r,s)}catch(r){throw this.mapAxiosError(r,s)}}async putFile(e,t,s){try{const r=this.toAxiosConfig(s);r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"];const i=await this.axios.put(this.fixBaseUrl(e),t,{...r,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(i,s)}catch(r){throw this.mapAxiosError(r,s)}}async putJson(e,t,s){const r=this.toAxiosConfig(s);r.headers&&(r.headers["Content-Type"]="application/json");try{const i=await this.axios.put(this.fixBaseUrl(e),t,r);return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async patch(e,t,s){try{const r=await this.axios.patch(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(r,s)}catch(r){throw this.mapAxiosError(r,s)}}async patchFile(e,t,s){try{const r=this.toAxiosConfig(s);r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"];const i=await this.axios.patch(this.fixBaseUrl(e),t,{...r,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(i,s)}catch(r){throw this.mapAxiosError(r,s)}}async patchJson(e,t,s){const r=this.toAxiosConfig(s);r.headers&&(r.headers["Content-Type"]="application/json");try{const i=await this.axios.patch(this.fixBaseUrl(e),t,r);return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async delete(e,t){try{const s=await this.axios.delete(this.fixBaseUrl(e),this.toAxiosConfig(t));return this.mapAxiosResponse(s,t)}catch(s){throw this.mapAxiosError(s,t)}}async deleteJson(e,t){try{const s=await this.axios.delete(this.fixBaseUrl(e),{data:t});return this.mapAxiosResponse(s)}catch(s){throw this.mapAxiosError(s)}}getScript(e,t,s){const r=s??"exports",i=this.toAxiosConfig(t);return i.headers&&(i.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),i).then(o=>this.mapAxiosResponse(o,t)).then(o=>{try{const a=`"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;return Function(a)()}catch{return o}}).catch(o=>{throw this.mapAxiosError(o,t),o})}loadScript(e,t){return loadedScripts[e]?Promise.resolve():this.getScript(e,t).then(s=>{loadedScripts[e]=!0})}}class RightService{constructor(e){this.context=e}get session(){return this.context.session()}parseResourceRight(e){const t=e.split(":");if(t.length===2){if(t[0]==="creator")return{id:t[1],right:"creator",type:"creator"}}else return t.length===3?{id:t[1],right:t[2],type:t[0]}:void 0}parseResourceRights(e){return e.map(s=>this.parseResourceRight(s)).filter(s=>s!==void 0)}hasResourceRight({id:e,groupIds:t},s,r){const i=r.map(o=>typeof o=="string"?this.parseResourceRight(o):o).filter(o=>o!==void 0);for(const o of i){if(o.id===e&&o.type==="creator")return!0;if(o.id===e&&o.type==="user"&&o.right===s)return!0;if(t.includes(o.id)&&o.type==="group"&&o.right===s)return!0}return!1}async sessionHasResourceRight(e,t){try{const s=await this.session.getUser();return!!s&&this.hasResourceRight({groupIds:s.groupsIds,id:s.userId},e,t)}catch(s){return console.error(`Unexpected error ${s} in sessionHasResourceRight()`),!1}}async sessionHasAtLeastOneResourceRight(e,t){for(const s of e)if(await this.sessionHasResourceRight(s,t))return!0;return!1}async sessionHasResourceRightForEachList(e,t){let s=0;for(const r of t)await this.sessionHasResourceRight(e,r)&&s++;return s===t.length}async sessionHasAtLeastOneResourceRightForEachList(e,t){for(const s of e){let r=0;for(const i of t)await this.sessionHasResourceRight(s,i)&&r++;if(r===t.length)return!0}return!1}hasWorkflowRight(e,t){return t.findIndex(s=>s===e)!==-1}async sessionHasWorkflowRight(e){try{const t=await this.session.getUser();return!!t&&this.hasWorkflowRight(e,t.authorizedActions.map(s=>s.name))}catch(t){return console.error(`Unexpected error ${t} in sessionHasWorkflowRight()`),!1}}async sessionHasWorkflowRights(e){const t={};try{const s=await this.session.getUser();for(const r of e)t[r]=!!s&&this.hasWorkflowRight(r,s.authorizedActions.map(i=>i.name))}catch(s){console.error(`Unexpected error ${s} in sessionHasWorkflowRights()`);for(const r of e)t[r]=!1}return t}}class SessionService{constructor(e){this.context=e}get http(){return this.context.http()}get cache(){return this.context.cache()}get conf(){return this.context.conf()}onLogout(){this.cache.clearCache()}onRefreshSession(){this.cache.clearCache()}async getSession(){const e=await this.getUser(),[t,s,r,i,o]=await Promise.all([this.getCurrentLanguage(e),this.latestQuotaAndUsage(e),this.loadDescription(e),this.getUserProfile(),this.getBookmarks(e)]);return{user:e,quotaAndUsage:s,currentLanguage:t,userDescription:r,userProfile:i,bookmarkedApps:o}}login(e,t,s,r){const i=new FormData;return i.append("email",e),i.append("password",t),typeof s<"u"&&i.append("rememberMe",""+s),typeof r<"u"&&i.append("secureLocation",""+r),this.http.post("/auth/login",i,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(this.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}async logout(){const e=await this.conf.getLogoutCallback();return this.http.get("/auth/logout?callback="+e).finally(()=>{})}async latestQuotaAndUsage(e){const t={quota:0,storage:0};if(!e)return t;try{return await this.http.get(`/workspace/quota/user/${e==null?void 0:e.userId}`)}catch(s){return console.error(s),t}}async getCurrentLanguage(e){const t=(e==null?void 0:e.sessionMetadata)&&(e==null?void 0:e.sessionMetadata.userId);try{let s;return t?s=await this.loadUserLanguage():s=await this.loadDefaultLanguage(),s}catch(s){console.error(s)}}async loadUserLanguage(){try{const e=await this.http.get("/userbook/preference/language");return JSON.parse(e.preference)["default-domain"]}catch{return await this.loadDefaultLanguage()}}async loadDefaultLanguage(){return(await this.cache.httpGetJson("/locale")).locale}async getUser(){const{response:e,value:t}=await this.cache.httpGet("/auth/oauth2/userinfo");if(!(e.status<200||e.status>=300)&&typeof t=="object")return t;throw ERROR_CODE.NOT_LOGGED_IN}hasWorkflow({workflowName:e,user:t}){return e===void 0||(t==null?void 0:t.authorizedActions.findIndex(s=>s.name===e))!==-1}async loadDescription(e){if(!e)return{};try{const[t,s]=await Promise.all([this.getUserProfile({options:{requestName:"refreshAvatar"}}),this.http.get("/directory/userbook/"+(e==null?void 0:e.userId))]);return{...s,profiles:t}}catch(t){return console.error(t),{}}}async getBookmarks(e){if(!e)return[];const t=await this.http.get("/userbook/preference/apps");t.preference||(t.preference=null);const s=JSON.parse(t.preference);let r;r=s,r||(r={bookmarks:[],applications:[]});const i=[];return r.bookmarks.forEach((o,a)=>{const c=((e==null?void 0:e.apps)||[]).find(l=>l.name===o);if(c){const l=Object.assign({},c);i.push(l)}}),i}async getUserProfile(e={}){var c,l;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(i,t);return o.status<200||o.status>=300||typeof a=="string"?["Guest"]:((l=(c=a==null?void 0:a.result)==null?void 0:c[0])==null?void 0:l.type)||["Guest"]}async isAdml(){const e=await this.getUser();return(e==null?void 0:e.functions.ADMIN_LOCAL)!==void 0}async getWebApp(e){const t=await this.getUser();return t==null?void 0:t.apps.find(s=>{var r;return s!=null&&s.prefix?(s==null?void 0:s.prefix.replace("/",""))===e||!1:s!=null&&s.address&&((r=s.address)==null?void 0:r.split("/")[1])===e||!1})}}const bundle={},promises={},defaultDiacriticsRemovalMap=[{base:"A",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},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class IdiomService{constructor(e){this.context=e}get http(){return this.context.http()}async getIdiom(e,t){await Promise.all([this.addBundlePromise(e,"/i18n"),this.addBundlePromise(e,`/${t}/i18n`)])}translate(e,t){e=e??"";let s=bundle[e]===void 0?e:bundle[e];if(t&&typeof t=="object")for(const r in t)typeof t[r]<"u"&&(s=s.replace(new RegExp("\\${"+r+"}","g"),""+t[r]));return s}addBundlePromise(e,t){return this.loadBundlePromise(e,t)}addBundle(e,t,s){this.loadBundle(e,t,s)}loadBundlePromise(e,t){return this.loadBundle(e,t),promises[t]}loadBundle(e,t,s){const r=promises[t];if(r)s&&r.then(s).catch(s);else{const i=new Promisified;promises[t]=i.promise;const o={};e&&(o["Accept-Language"]=e),this.http.get(t,{headers:o}).then(a=>{Object.assign(bundle,a),typeof s=="function"&&s(),i.resolve()}).catch(a=>{typeof s=="function"&&s(),i.reject()})}}addTranslations(e,t){notify.onLangReady().promise.then(s=>{this.loadBundle(s,e+"/"+s+".json",t)})}addAllTranslations(e){return e&&e.length>0?notify.onLangReady().promise.then(t=>Promise.all(e.map(s=>this.loadBundlePromise(t,s+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(const t in e)typeof bundle[t]!="string"&&(bundle[t]=e[t])}removeAccents(e){for(let t=0;t<defaultDiacriticsRemovalMap.length;t++)e=e.replace(defaultDiacriticsRemovalMap[t].letters,defaultDiacriticsRemovalMap[t].base);return e}}class StringUtils{static removeAccents(e){for(let t=0;t<defaultDiacriticsRemovalMap.length;t++)e=e.replace(defaultDiacriticsRemovalMap[t].letters,defaultDiacriticsRemovalMap[t].base);return e}}class ShareService{constructor(e){this.context=e}get directory(){return this.context.directory()}get http(){return this.context.http()}get cache(){return this.context.cache()}async searchShareSubjects(e,t,s,r){const i=StringUtils.removeAccents(s).toLowerCase(),o=await this.cache.httpGetJson(r||`/${e}/share/json/${t}?search=${s}`),a=o.users.visibles.filter(({username:p,firstName:d,lastName:R,login:E})=>{const g=StringUtils.removeAccents(R||"").toLowerCase(),A=StringUtils.removeAccents(d||"").toLowerCase(),f=StringUtils.removeAccents(p||"").toLowerCase(),y=StringUtils.removeAccents(E||"").toLowerCase();return f.includes(i)||A.includes(i)||g.includes(i)||y.includes(i)}).map(p=>({avatarUrl:this.directory.getAvatarUrl(p.id,"user"),directoryUrl:this.directory.getDirectoryUrl(p.id,"user"),displayName:p.username,id:p.id,profile:p.profile,type:"user"})),c=o.groups.visibles.filter(({name:p})=>StringUtils.removeAccents(p||"").toLowerCase().includes(i)).map(p=>({avatarUrl:this.directory.getAvatarUrl(p.id,"group"),directoryUrl:this.directory.getDirectoryUrl(p.id,"group"),displayName:p.name,id:p.id,type:"group",structureName:p.structureName}));return[...(await this.directory.getBookMarks()).filter(({displayName:p})=>StringUtils.removeAccents(p||"").toLowerCase().includes(i)).map(p=>({avatarUrl:"",directoryUrl:"",profile:"",displayName:p.displayName,id:p.id,type:"sharebookmark"})),...a,...c]}async getShareMapping(e,t){const s=await this.cache.httpGetJson(t||`/${e}/rights/sharing`);for(const r of Object.keys(s))if(r.includes(".")){const i=r.split(".")[1],o=s[r];delete s[r],s[i]=o}return s}getActionsAvailableFor({id:e,type:t},s,r){const o=(t==="user"?s.users.checked[e]:s.groups.checked[e])||[],a=Object.keys(r),c=[];for(const l of a)r[l].filter(d=>o.includes(d)).length>0&&c.push(l);return c}async getRightsForResource(e,t,s){const r=await this.directory.getBookMarks(),i=`/${e}/share/json/${t}?search=`,o=await this.cache.httpGetJson((s==null?void 0:s.getResourceRights)||i),a=await this.getShareMapping(e,s==null?void 0:s.getShareMapping),c=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),l=Object.keys(o.users.checked).map(E=>o.users.visibles.find(A=>A.id===E)).filter(E=>E!==void 0).map(E=>{const g=this.getActionsAvailableFor({id:E.id,type:"user"},o,a);return{id:E.id,type:"user",displayName:E.username,profile:E.profile,avatarUrl:this.directory.getAvatarUrl(E.id,"user"),directoryUrl:this.directory.getDirectoryUrl(E.id,"user"),actions:g.map(f=>{const y=c[f];return{displayName:f,id:f,priority:y.priority}})}}).sort((E,g)=>(E.displayName||"").localeCompare(g.displayName)),h=Object.keys(o.groups.checked).map(E=>o.groups.visibles.find(A=>A.id===E)).filter(E=>E!==void 0).map(E=>{const g=this.getActionsAvailableFor({id:E.id,type:"group"},o,a);return{id:E.id,type:"group",displayName:E.name,profile:void 0,avatarUrl:this.directory.getAvatarUrl(E.id,"group"),directoryUrl:this.directory.getDirectoryUrl(E.id,"group"),actions:g.map(f=>{const y=c[f];return{displayName:f,id:f,priority:y.priority}})}}).sort((E,g)=>(E.displayName||"").localeCompare(g.displayName)),p=[...l,...h],d=o.groups.visibles.map(({groupDisplayName:E,id:g,name:A,labels:f})=>({labels:f,displayName:E||A,id:g})),R=o.users.visibles.map(({id:E,profile:g,username:A,firstName:f,lastName:y,login:D})=>({displayName:A,firstName:f,lastName:y,login:D,profile:g,id:E}));return{rights:p,visibleBookmarks:r,visibleGroups:d,visibleUsers:R}}async getPutSharePayload(e,t,s){const r={users:{},groups:{},bookmarks:{}},i=await this.getShareMapping(e,s);for(const o of t){const a=o.actions.map(l=>i[l.id]).reduce((l,h)=>Array.isArray(h)?[...l,...h]:l,[]),c=[...new Set(a)];c.length>0&&(o.type==="user"?r.users[o.id]=c:o.type==="group"?r.groups[o.id]=c:r.bookmarks[o.id]=c)}return r}async saveRights(e,t,s,r){const i=await this.getPutSharePayload(e,s,r==null?void 0:r.getShareMapping),o=(r==null?void 0:r.saveResourceRights)||`/${e}/share/resource/${t}`;return this.cache.clearCache((r==null?void 0:r.getResourceRights)||`/${e}/share/json/${t}?search=`),await this.http.putJson(o,i)}async getActionsForApp(e,t){const s=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),r=await this.getShareMapping(e,t);return Object.keys(s).map(o=>{const a=s[o];return{displayName:o,id:o,priority:a.priority,requires:a.requires}}).filter(o=>{var a;return((a=r[o.id])==null?void 0:a.length)>0}).sort((o,a)=>o.priority-a.priority)}}const defaultMappers={csv:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isCsvLike(u,e)},doc:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isWordLike(u,e)?!0:u.indexOf("document")!==-1&&u.indexOf("wordprocessing")!==-1},xls:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isExcelLike(u,e)?!0:u.indexOf("document")!==-1&&u.indexOf("spreadsheet")!==-1||u.indexOf("ms-excel")!==-1},img:function({type:u}){return u.indexOf("image")!==-1},pdf:function({type:u}){return u.indexOf("pdf")!==-1||u==="application/x-download"},ppt:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isPowerpointLike(u,e)?!0:u.indexOf("document")!==-1&&u.indexOf("presentation")!==-1||u.indexOf("powerpoint")!==-1},txt:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isTxtLike(u,e)},md:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isMdLike(u,e)},video:function({type:u}){return u.indexOf("video")!==-1},audio:function({type:u}){return u.indexOf("audio")!==-1},zip:function({type:u}){return u.indexOf("zip")!==-1||u.indexOf("rar")!==-1||u.indexOf("tar")!==-1||u.indexOf("7z")!==-1}},_=class _{static getRole(e){var t,s;return _.role((t=e.metadata)==null?void 0:t["content-type"],!1,(s=e.metadata)==null?void 0:s.extension)}static role(e,t=!1,s){if(s&&(s=s.trim()),!e)return"unknown";this.roleMappers||console.warn("[DocumentHelper.role] should not have empty roles",this);const r={type:e,previewRole:t,extension:s};for(const i of this.roleMappers){const o=i(r);if(o)return o}return"unknown"}};n(_,"roleMappers",[e=>Object.keys(defaultMappers).find(s=>defaultMappers[s](e))]);let DocumentHelper=_;class WorkspaceService{constructor(e){this.context=e}get http(){return this.context.http()}extractMetadata(e){const t=e.name||"",s=t.split("."),r=e.type||"application/octet-stream",i=s.length>1?s[s.length-1]:"",o={"content-type":r,filename:t,size:e.size,extension:i,role:DocumentHelper.role(r,!1,i)},a=t.replace("."+o.extension,""),c=o.extension?a+"."+o.extension:a;return{basename:a,fullname:c,metadata:o}}async saveFile(e,t){const{fullname:s,metadata:r}=this.extractMetadata(e),i=new FormData;i.append("file",e,s);const o=[];((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}`);const a=await this.http.postFile(`/workspace/document?${o.join("&")}`,i);if(this.http.isResponseError())throw this.http.latestResponse.statusText;return a}async updateFile(e,t,s){const{fullname:r,metadata:i}=this.extractMetadata(t),o=new FormData;o.append("file",t,r);const a=[];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}`);const c=await this.http.putFile(`/workspace/document/${e}?${a.join("&")}`,o);if(this.http.isResponseError())throw this.http.latestResponse.statusText;return c}async deleteFile(e){const t=e.map(s=>s._id);if(t.length==0)Promise.resolve(null);else if(await this.http.deleteJson("/workspace/documents",{ids:t}),this.http.isResponseError())throw this.http.latestResponse.statusText}async acceptDocuments(e){const t=await this.context.session().getUser();return s=>s.deleted&&s.trasher?(t==null?void 0:t.userId)==s.trasher:!0}async searchDocuments(e){const t=e.filter!=="external"||e.parentId?await this.http.get("/workspace/documents",{queryParams:{...e,_:new Date().getTime()}}):[],s=await this.acceptDocuments(e);return t.filter(s)}async listDocuments(e,t){return this.searchDocuments({filter:e,parentId:t,includeall:!0})}async transferDocuments(e,t,s="protected"){const r=[];if(e.forEach(i=>{(s==="public"&&!i.public||!i.public&&!i.protected)&&r.push(i)}),r.length>0){const i=await this.http.post("/workspace/documents/transfer",{application:t,visibility:s,ids:r.map(o=>o._id)});if(this.http.isResponseError())throw this.http.latestResponse.statusText;return r.forEach((o,a)=>{const c=e.findIndex(l=>l._id===o._id);0<=c&&c<e.length&&(e[c]=i[a])}),e.filter(o=>!!o)}return e}getThumbnailUrl(e,t=0,s=0){var i,o;const r=t>0||s>0?`${t}x${s}`:"120x120";if(typeof e=="string")return e.includes("data:image")||e.includes("thumbnail")?e:`${e}${e.includes("?")?"&":"?"}thumbnail=${r}`;{const a=`/workspace/${e.public?"pub/":""}document/${e._id}?thumbnail=`,c=e.thumbnails;if((o=(i=e.metadata)==null?void 0:i["content-type"])!=null&&o.includes("video")){const l=c&&Object.keys(c).length>0?Object.keys(c)[0]:null;return l?a+l:null}else return a+r}}listFolder(e,t=!1,s,r){const i={filter:e,hierarchical:t,parentId:s,directShared:r};return this.http.get("/workspace/folders/list",{queryParams:i})}listOwnerFolders(e,t){return this.listFolder("owner",e,t)}listSharedFolders(e,t){return this.listFolder("shared",e,t,!0)}createFolder(e,t){const s=new FormData;return s.append("name",e),t&&s.append("parentFolderId",t),this.http.postFile("/workspace/folder",s)}}let ATTag;class AnalyticsService{constructor(u){this.context=u}get http(){return this.context.http()}get session(){return this.context.session()}async trackPageLoad(u,e){const[t]=await Promise.all([this.getXitiConfig(e.name.toLowerCase()),this.loadXitiScript()]);if(!t||!ATInternet)return;let s=t.LIBELLE_SERVICE.default||null;for(const r in t.LIBELLE_SERVICE)if(r!=="default"&&u.indexOf(r)>=0){s=t.LIBELLE_SERVICE[r];break}ATTag=new ATInternet.Tracker.Tag({site:t.STRUCT_ID}),ATTag.setProps({SERVICE:s,TYPE:t.TYPE,OUTIL:t.OUTIL,UAI:t.STRUCT_UAI,PROJET:t.PROJET,EXPLOITANT:t.EXPLOITANT,PLATEFORME:t.PLATFORME,PROFIL:t.PROFILE},!0),ATTag.identifiedVisitor.set({id:t.ID_PERSO,category:t.PROFILE}),ATTag.page.set({name:(e==null?void 0:e.prefix)==="userbook"?"directory":e==null?void 0:e.prefix,chapter1:"",chapter2:"",chapter3:"",level2:t.STRUCT_UAI}),ATTag.dispatch()}async getXitiConfig(u){const[e,t]=await Promise.all([this.http.get("/analyticsConf"),this.http.get("/xiti/config")]);if(!(e!=null&&e.type))throw ERROR_CODE.MALFORMED_DATA;return t!=null&&t.active&&(e.xiti=await this.getXitiTrackingParams(t,u)),e.xiti}async loadXitiScript(){if(typeof ATInternet>"u"){const scriptPath="/xiti/public/js/lib/smarttag_ENT.js",response=await this.http.get(scriptPath,{headers:{Accept:"application/javascript"}});if(this.http.latestResponse.status!=200)throw"Error while loading XiTi script";eval(response)}}async getXitiTrackingParams(u,e){if(!u.structureMap||!e)return;const t=await this.session.getUser(),s=await this.session.getUserProfile();let r;if(!(t!=null&&t.structures))return;for(const l of t.structures){const h=u.structureMap[l];if(h&&h.collectiviteId&&h.UAI){r=h;break}}if(!r||!r.active)return;const i=await configure.Platform.apps.getPublicConf(e);if(!i)return;const o=i.xiti;if(!o||!o.LIBELLE_SERVICE||!r.UAI)return;function a(l){let h="";for(let p=0;p<l.length;p++)h+=l.charCodeAt(p);return h}const c={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:o.LIBELLE_SERVICE,TYPE:o.OUTIL?"TIERS":"NATIF",OUTIL:o.OUTIL?o.OUTIL:"",STRUCT_ID:r.collectiviteId,STRUCT_UAI:r.UAI,PROJET:r.projetId?r.projetId:u.ID_PROJET,EXPLOITANT:u.ID_EXPLOITANT,PLATFORME:r.plateformeId?r.plateformeId:u.ID_PLATEFORME,ID_PERSO:a(t.userId),PROFILE:s&&s.length>0?c[s[0]]??"":""}}}const C=class C{constructor(e){this.context=e}get http(){return this.context.http()}get conf(){return this.context.conf()}async getVideoConf(){var t;const e=await this.conf.getPublicConf(APP$4.VIDEO);return{maxWeight:(e==null?void 0:e["max-videosize-mbytes"])??C.MAX_WEIGHT,maxDuration:(e==null?void 0:e["max-videoduration-minutes"])??C.MAX_DURATION,acceptVideoUploadExtensions:((t=e==null?void 0:e["accept-videoupload-extensions"])==null?void 0:t.map(s=>s.toUpperCase()))??[]}}async upload({data:e,appCode:t,captation:s,duration:r}){if(!e.file)throw new Error("Invalid video file.");if(!e.filename)throw new Error("Invalid video filename");const i=`${e.browser.name} ${e.browser.version}`,o=new FormData;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);let a=`/video/encode?captation=${s}`;r&&(a+=`&duration=${r}`);const c=await this.http.post(a,o,{headers:{"Content-Type":"multipart/form-data"}});if(c.state=="running"){let l=0,h=1;do{const p=h+l;await new Promise(R=>setTimeout(R,p*1e3)),l=h,h=Math.min(8,p);const d=await this.http.get(`/video/status/${c.processid}`);if(d.state=="succeed")return d.videoworkspaceid&&d.videosize&&this.context.data().trackVideoSave(d.videoworkspaceid,Math.round(r),d.videosize,s,e.url,i,e.device),d;if(d.state=="error")break}while(!0)}throw new Error("Video cannot be uploaded.")}};n(C,"MAX_WEIGHT",50),n(C,"MAX_DURATION",3);let VideoService=C;class EmbedderService{constructor(e){this.context=e}get http(){return this.context.http()}async getDefault(){return this.http.get("/infra/embed/default")}async getCustom(){return this.http.get("/infra/embed/custom")}getProviderFromUrl(e,t){for(const s of e)if(this.isUrlFromProvider(t,s))return s}urlIsFromPattern(e,t){const s=new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)","g"),r=new RegExp("{[^}]*}","g");let i=!0;const o=t.match(s)||[],a=[];return(t.match(r)||[]).forEach((l,h)=>{l.includes("ignore")||a.push(o[h])}),a.forEach(l=>{if(!e.includes(l)){i=!1;return}}),i}isUrlFromProvider(e,t){typeof t.url=="string"&&(t.url=[t.url]);for(const s of t.url)if(this.urlIsFromPattern(e,s))return!0;return!1}getEmbedCodeForProvider(e,t){for(const s of e.url)if(this.urlIsFromPattern(t,s)){const r=new RegExp("{[a-zA-Z0-9_.]+}","g"),i=s.match(r)||[];let o=e.embed;for(const a of i){let c=s.split(a)[0];const l=c.split("}");l.length>1&&(c=l[l.length-1]);let h=t.split(c)[1];if(!h)continue;const p=s.split(a)[1].split("{")[0];p&&(h=h.split(p)[0]);const d=new RegExp("\\"+a.replace(/}/,"\\}"),"g");o=o.replace(d,h)}return o}return""}}class AbstractBehaviourService{constructor(e){n(this,"_cache");this.context=e,this._cache=new CacheService(this.context)}getApplication(){return this.APP}getResourceType(){return this.RESOURCE}httpGet(e,t){return this._cache.httpGetJson(e,t)}dataToResource({modified:e,...t}){const s=typeof e=="string"?e:e!=null&&e.$date?""+e.$date:"";return{application:this.RESOURCE,name:t.title,creatorId:t.owner,creatorName:t.ownerName,thumbnail:t.icon,assetId:t._id,modifiedAt:s,shared:t.shared,path:t.path}}}class ActualitesBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","actualites");n(this,"RESOURCE","actualites")}async loadResources(){return(await this.httpGet("/actualites/linker/infos")).map(s=>{let r;return s.thread_icon?r=s.thread_icon+"?thumbnail=48x48":r="/img/icons/glyphicons_036_file.png",this.dataToResource({title:s.title+" ["+s.thread_title+"]",ownerName:s.username,owner:s.owner,icon:r,path:"/actualites#/view/thread/"+s.thread_id+"/info/"+s._id,_id:`${s.thread_id}#${s._id}`,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified})})}}class BlogBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","blog");n(this,"RESOURCE","blog")}loadResources(){return new Promise(async(t,s)=>{try{const r=await this.httpGet("/blog/linker"),i=[];r.forEach(o=>{o.thumbnail?o.thumbnail=o.thumbnail+"?thumbnail=48x48":o.thumbnail="/img/illustrations/blog.svg";const a=o.fetchPosts.map(c=>this.dataToResource({owner:o.author.userId,ownerName:o.author.username,title:c.title+" ["+o.title+"]",_id:`${o._id}#${c._id}`,icon:o.thumbnail,path:`/blog/id/${o._id}/post/${c._id}`,shared:!!(o.shared&&o.shared.length>=0),modified:o.modified}));i.push(...a)}),t(i)}catch(r){s(r)}})}}class CollaborativewallBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","collaborativewall");n(this,"RESOURCE","collaborativewall")}async loadResources(){return(await this.httpGet("/collaborativewall/list/all")).map(s=>this.dataToResource({title:s.name,ownerName:s.owner.displayName,owner:s.owner.userId,icon:s.icon?s.icon:"/img/illustrations/collaborative-wall-default.png",path:"/collaborativewall#/view/"+s._id,_id:s._id,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified}))}}class CommunityBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","community");n(this,"RESOURCE","community")}async loadResources(){return(await this.httpGet("/community/listallpages")).map(s=>{let r;return typeof s.thumbnail>"u"||s.thumbnail===""?r="/img/icons/glyphicons_036_file.png":r=s.thumbnail+"?thumbnail=48x48",this.dataToResource({title:s.name,icon:r,path:"/community#/view/"+s.id,_id:s.id,owner:"",ownerName:"",shared:!!(s.shared&&s.shared.length>=0),modified:s.name})})}}class ExercizerBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","exercizer");n(this,"RESOURCE","exercizer")}async loadResources(){return(await this.httpGet("/exercizer/subjects-scheduled")).map(s=>{const r=s.picture?s.picture+"?thumbnail=48x48":"/img/illustrations/exercizer.svg";let i,o=!1;const a=JSON.parse(s.scheduled_at);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({title:s.title,owner:s.owner,ownerName:i,icon:r,path:"/exercizer#/linker/"+s.id,_id:""+s.id,shared:o,modified:s.modified})})}}class FormulaireBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","formulaire");n(this,"RESOURCE","formulaire")}async loadResources(){return(await this.httpGet("/formulaire/forms/linker")).map(s=>(s.picture||(s.picture="/formulaire/public/img/logo.svg"),this.dataToResource({_id:""+s.id,icon:s.picture,title:s.title,ownerName:s.owner_name,owner:s.owner_id,path:s.is_public?`${window.location.origin}/formulaire-public#/form/${s.public_key}`:`${window.location.origin}/formulaire#/form/${s.id}/${s.rgpd?"rgpd":"new"}`,shared:!!(s.shared&&s.shared.length>=0),modified:""+s.date_modification})))}}class ForumBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","forum");n(this,"RESOURCE","forum")}async loadResources(){return(await this.httpGet("/forum/categories")).map(s=>this.dataToResource({_id:s._id,title:s.name,icon:s.icon||"/img/illustrations/forum.svg",path:"/forum#/view/"+s._id,ownerName:s.owner.displayName,owner:s.owner.userId,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified}))}}class HomeworksBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","homeworks");n(this,"RESOURCE","homeworks")}async loadResources(){return(await this.httpGet("/homeworks/list")).filter(t=>t.owner&&t.trashed===0).map(t=>this.dataToResource({title:t.title,ownerName:t.owner.displayName,owner:t.owner.userId,icon:t.thumbnail||"/img/illustrations/homeworks.svg",path:"/homeworks#/view-homeworks/"+t._id,_id:""+t._id,shared:typeof t.shared<"u",modified:t.modified}))}}class MagnetoBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","magneto");n(this,"RESOURCE","magneto")}async loadResources(){const{all:t}=await this.httpGet("/magneto/boards/editable");return t.map(s=>this.dataToResource({_id:s._id,title:s.title,icon:s.imageUrl,owner:s.ownerId,ownerName:s.ownerName,path:`/magneto#/board/${s._id}/view`,shared:!!(s.shared&&s.shared.length>=0),modified:""+s.modificationDate}))}}class MindmapBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","mindmap");n(this,"RESOURCE","mindmap")}async loadResources(){return(await this.httpGet("/mindmap/list/all")).map(s=>this.dataToResource({title:s.name,ownerName:s.owner.displayName,owner:s.owner.userId,icon:s.thumbnail||"/img/illustrations/mindmap-default.png",path:"/mindmap#/view/"+s._id,_id:s._id,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified}))}}class PagesBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","pages");n(this,"RESOURCE","pages")}async loadResources(){const t=await this.httpGet("/pages/list/all"),s=[];return t.forEach(r=>{var o;const i=r.thumbnail?r.thumbnail+"?thumbnail=48x48":"/img/illustrations/pages.svg";s.push(this.dataToResource({title:r.title,owner:r.owner.userId,ownerName:r.owner.displayName,icon:i,path:"/pages#/website/"+r._id,_id:r._id,shared:typeof r.shared<"u",modified:r.modified})),(o=r.pages)==null||o.forEach(a=>{s.push(this.dataToResource({title:a.title,owner:r.owner.userId,ownerName:r.owner.displayName,icon:i,path:"/pages#/website/"+r._id+"/"+a.titleLink,_id:r._id+"/"+a.titleLink,shared:typeof r.shared<"u",modified:r.modified}))})}),s}}class PollBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","poll");n(this,"RESOURCE","poll")}async loadResources(){return(await this.httpGet("/poll/list/all")).map(s=>{const r=s.icon?s.icon+"?thumbnail=48x48":"/img/icons/glyphicons_036_file.png";return this.dataToResource({title:s.question,ownerName:s.owner.displayName,icon:r,path:"/poll#/view/"+s._id,_id:s._id,owner:s.owner.userId,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified})})}}class ScrapbookBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","scrapbook");n(this,"RESOURCE","scrapbook")}async loadResources(){return(await this.httpGet("/scrapbook/list/all")).map(s=>{const r=s.icon||"/img/illustrations/scrapbook.svg";return this.dataToResource({title:s.name,owner:s.owner.userId,ownerName:s.owner.displayName,icon:r,path:"/scrapbook#/view-scrapbook/"+s._id,_id:s._id,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified})})}}class TimelinegeneratorBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","timelinegenerator");n(this,"RESOURCE","timelinegenerator")}loadResources(){return new Promise(async(t,s)=>{try{const i=(await this.httpGet("/timelinegenerator/timelines")).map(o=>{const a=o.icon||"/img/illustrations/timeline-default.png";return this.dataToResource({title:o.headline,ownerName:o.owner.displayName,owner:o.owner.userId,icon:a,path:"/timelinegenerator#/view/"+o._id,_id:o._id,shared:typeof o.shared<"u",modified:o.modified})});t(i)}catch(r){s(r)}})}}class WikiBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","wiki");n(this,"RESOURCE","wiki")}async loadResources(){return(await this.httpGet("/wiki/listallpages?visible=true")).map(s=>s.pages.map(r=>{let i;return typeof s.thumbnail>"u"||s.thumbnail===""?i="/img/icons/glyphicons_036_file.png":i=s.thumbnail+"?thumbnail=48x48",this.dataToResource({title:r.title+" ["+s.title+"]",ownerName:s.owner.displayName,owner:s.owner.userId,icon:i,path:"/wiki#/view/"+s._id+"/"+r._id,_id:`${s._id}#${r._id}`,shared:typeof s.shared<"u",modified:r.modified})})).flat()}}class WorkspaceBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","workspace");n(this,"RESOURCE","workspace")}loadResources({search:t,asset_id:s}){return new Promise(async(r,i)=>{try{let o="/workspace/documents?filter=all&hierarchical=true";s&&s.length?o+=`&search=${t}`:t&&t.length&&(o+=`&search=${t}`);const c=(await this.httpGet(o)).filter(l=>!l.deleted).map(l=>{const h=l.metadata["content-type"]&&l.metadata["content-type"].indexOf("image")!==-1?`/workspace/document/${l._id}?thumbnail=120x120`:"/img/icons/unknown-large.png";return this.dataToResource({title:l.name,ownerName:l.ownerName,owner:l.owner,icon:h,path:`/workspace/document/${l._id}`,_id:l._id,shared:!!(l.shared&&l.shared.length>=0),modified:l.modified})});r(c)}catch(o){i(o)}})}}const w=class w{static async initialize(e,t){const s=e.http();if(!this.resourceProducingApps.length){this.resourceProducingApps=[t,"workspace"];try{const[r,i]=await Promise.all([s.get("/resources-applications"),e.session().getUser()]);i!=null&&i.apps&&(r!=null&&r.length)&&(this.resourceProducingApps=r.filter(o=>i.apps.some(a=>a.address.includes(o))))}catch(r){console.warn("Failed to load resource-producing apps:",r)}}return this.resourceProducingApps}static registerCustomBehaviour(e,t,s){this.registry.register({application:e,resourceType:t},s)}static async registerBehaviours(e){this.resourceProducingApps.forEach(t=>{const s={application:e,resourceType:t};this.registry.register(s,r=>this.serviceFor(r,e,t))})}static serviceFor(e,t,s){let r;switch(s){case"timelinegenerator":r=new TimelinegeneratorBehaviour(e);break;case"workspace":r=new WorkspaceBehaviour(e);break;case"blog":r=new BlogBehaviour(e);break;case"actualites":r=new ActualitesBehaviour(e);break;case"wiki":r=new WikiBehaviour(e);break;case"pages":r=new PagesBehaviour(e);break;case"poll":r=new PollBehaviour(e);break;case"community":r=new CommunityBehaviour(e);break;case"mindmap":r=new MindmapBehaviour(e);break;case"forum":r=new ForumBehaviour(e);break;case"homeworks":r=new HomeworksBehaviour(e);break;case"scrapbook":r=new ScrapbookBehaviour(e);break;case"collaborativewall":r=new CollaborativewallBehaviour(e);break;case"exercizer":r=new ExercizerBehaviour(e);break;case"formulaire":r=new FormulaireBehaviour(e);break;case"magneto":r=new MagnetoBehaviour(e);break;default:throw ERROR_CODE.NOT_SUPPORTED}return r.APP=t,r}};n(w,"registry",new ServiceRegistry),n(w,"findBehaviour",w.registry.findService.bind(w.registry)),n(w,"hasBehaviour",w.registry.isRegistered.bind(w.registry)),n(w,"resourceProducingApps",[]);let SnipletsService=w;const SEND_ALL="*";class WebBroker{constructor(e){n(this,"subscription");this.odeServices=e}get http(){return this.odeServices.http()}get events(){return this.odeServices.notify().events()}dispatchEvent(e,t){t.findIndex(r=>SEND_ALL===r||e.data["event-type"]===r)>=0&&this.http.post("/infra/event/web/store",e.data,{disableNotifications:!0})}initialize(e){if(e===void 0||e.send===void 0||e.send.length>0){const t=(e==null?void 0:e.send)??[SEND_ALL];this.subscription=this.events.subscribe(LAYER_NAME.WEB_DATA,s=>this.dispatchEvent(s,t))}return this}destroy(){this.subscription&&(this.subscription.revoke(),delete this.subscription)}}class DataService{constructor(e){n(this,"_webBroker");n(this,"app");n(this,"user");n(this,"profile");this.odeServices=e}get conf(){return this.odeServices.conf()}get notify(){return this.odeServices.notify()}async initialize(){try{const{app:e}=await this.notify.onAppConfReady().promise;this.app=e,this.user=await this.odeServices.session().getUser(),this.profile=await this.odeServices.session().getUserProfile();const{["data-service"]:t}=await this.conf.getPublicConf(e);this._webBroker=new WebBroker(this.odeServices).initialize(t==null?void 0:t.web)}catch{console.log("DataService not initialized, usage data unavailable.")}}predestroy(){this._webBroker&&(this._webBroker.destroy(),delete this._webBroker)}trackWebEvent(e){this.notify.events().publish(LAYER_NAME.WEB_DATA,{name:EVENT_NAME.DATA_TRACKED,data:e})}addUserInfos(e){return this.user&&(e.userId=this.user.userId,e.structure=this.user.structureNames[0]),this.profile&&(e.profil=this.profile[0]),e}trackVideoSave(e,t,s,r,i,o,a){const c=this.addUserInfos({"event-type":"VIDEO_SAVE",module:this.app||"video",video_id:e,browser:o,duration:Math.round(t),weight:s,source:r?"CAPTURED":"UPLOADED",url:i});a&&(c.device_type=a),this.trackWebEvent(c)}trackVideoRead(e,t,s,r,i){const o=this.addUserInfos({"event-type":"VIDEO_READ",module:"video",video_id:e,browser:r,source:t?"CAPTURED":"UPLOADED",url:s});this.app&&(o["override-module"]=this.app),i&&(o.device_type=i),this.trackWebEvent(o)}trackSpeechAndText(e){const t=this.addUserInfos({"event-type":"SPEECH_AND_TEXT",function:e});this.app&&(t.module=this.app),this.trackWebEvent(t)}trackAccessLibraryFromExplorer(){const e=this.addUserInfos({"event-type":"ACCESS_LIBRARY_FROM_EXPLORER"});this.app&&(e.module=this.app),this.trackWebEvent(e)}}class ReactionsService{constructor(e,t,s){this.context=e,this.module=t,this.resourceType=s}get http(){return this.context.http()}async loadAvailableReactions(){try{const{"reaction-types":e}=await this.context.conf().getPublicConf("audience");return Array.isArray(e)?e:void 0}catch{console.error("Audience configuration not found");return}}async loadReactionSummaries(e){const t=await this.http.get(`/audience/reactions/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`);return this.http.isResponseError()?{}:t.reactionsByResource}async loadReactionDetails(e,t,s){const r=await this.http.get(`/audience/reactions/${this.module}/${this.resourceType}/${e}?page=${t}&size=${s}`);return this.http.isResponseError()?void 0:r}async deleteReaction(e){await this.http.delete(`/audience/reactions/${this.module}/${this.resourceType}/${e}`)}async updateReaction(e,t){await this.http.putJson(`/audience/reactions/${this.module}/${this.resourceType}`,{resourceId:e,reactionType:t})}async createReaction(e,t){await this.http.postJson(`/audience/reactions/${this.module}/${this.resourceType}`,{resourceId:e,reactionType:t})}}class ViewsService{constructor(e,t,s){this.context=e,this.module=t,this.resourceType=s}get http(){return this.context.http()}async getCounters(e){const t=await this.http.get(`/audience/views/count/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`);return this.http.isResponseError()?{}:t}async getDetails(e){const t=await this.http.get(`/audience/views/details/${this.module}/${this.resourceType}/${e}`);return this.http.isResponseError()?void 0:t}trigger(e){return this.http.post(`/audience/views/${this.module}/${this.resourceType}/${e}`)}}class AudienceService{constructor(e,t,s){this.context=e,this.module=t,this.resourceType=s}get views(){return new ViewsService(this.context,this.module,this.resourceType)}get reactions(){return new ReactionsService(this.context,this.module,this.resourceType)}}class OdeServices{constructor(){n(this,"_analytics");n(this,"_cache");n(this,"_conf");n(this,"_data");n(this,"_directory");n(this,"_http");n(this,"_idiom");n(this,"_notify");n(this,"_rights");n(this,"_session");n(this,"_share");n(this,"_video");n(this,"_workspace");n(this,"_embedder");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)}initialize(){return this._data.initialize(),this}analytics(){return this._analytics}audience(e,t){return new AudienceService(this,e,t)}cache(){return this._cache}conf(){return this._conf}data(){return this._data}directory(){return this._directory}http(){return this._http}idiom(){return this._idiom}notify(){return this._notify}resource(e,t){return t?ResourceService.findService({application:e,resourceType:t},this):ResourceService.findMainService({application:e},this)}behaviour(e,t){return SnipletsService.findBehaviour({application:e,resourceType:t},this)}rights(){return this._rights}session(){return this._session}share(){return this._share}video(){return this._video}workspace(){return this._workspace}embedder(){return this._embedder}}const ACTION={SEARCH:"search",CREATE:"create",CREATE_PUBLIC:"createPublic",OPEN:"open",EDIT:"edit",MANAGE:"manage",UPD_PROPS:"properties",COMMENT:"comment",DELETE:"delete",TRASH:"trash",RESTORE:"restore",MOVE:"move",COPY:"copy",EXPORT:"export",SHARE:"share",PRINT:"print",PAGES_LIST:"pages_list",DISTRIBUTE:"distribute",REGISTER:"register",PUBLISH:"publish",PUBLISH_MOODLE:"publish_moodle"},FOLDER={BIN:"bin",DEFAULT:"default"},BOOLEAN_FILTER={OWNER:"owner",SHARED:"shared",PUBLIC:"public",FAVORITE:"favorite"},SORT_ORDER={ASC:"asc",DESC:"desc"},SORT_BY={NAME:"name",MODIFY_DATE:"updatedAt",CREATED_AT:"createdAt",APPLICATION:"application",RESOURCE_TYPE:"resourceType"},odeServices=new OdeServices().initialize();class SessionFrameworkFactory{static instance(){return session}}const WIDGET_POSITION={LEFT:"left",RIGHT:"right"};class TransportFrameworkFactory{static instance(){return transport}}const isActionAvailable=(u,e)=>{const t=e==null?void 0:e.filter(s=>s.id===u&&s.available);return t&&t.length>0},firstLevelWidgets=["birthday","mood","calendar-widget","notes"],secondLevelWidgets=["agenda-widget","carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"],defaultWidgetPosition={"last-infos-widget":WIDGET_POSITION.LEFT,birthday:WIDGET_POSITION.LEFT,"calendar-widget":WIDGET_POSITION.RIGHT,"carnet-de-bord":WIDGET_POSITION.LEFT,"record-me":WIDGET_POSITION.RIGHT,mood:WIDGET_POSITION.LEFT,"my-apps":WIDGET_POSITION.RIGHT,notes:WIDGET_POSITION.RIGHT,"rss-widget":WIDGET_POSITION.LEFT,"bookmark-widget":WIDGET_POSITION.RIGHT,qwant:WIDGET_POSITION.RIGHT,"qwant-junior":WIDGET_POSITION.LEFT,"agenda-widget":WIDGET_POSITION.LEFT,"cursus-widget":WIDGET_POSITION.LEFT,"maxicours-widget":WIDGET_POSITION.RIGHT,"universalis-widget":WIDGET_POSITION.RIGHT,"briefme-widget":WIDGET_POSITION.LEFT,"school-widget":WIDGET_POSITION.LEFT},defaultWidgetOrder={"school-widget":0,"my-apps":10,"record-me":15,"last-infos-widget":20,qwant:30,"qwant-junior":30,"universalis-widget":35,"agenda-widget":40,"bookmark-widget":50,"carnet-de-bord":60,"maxicours-widget":70,"cursus-widget":80,"briefme-widget":90,"rss-widget":100,mood:110,birthday:120,"calendar-widget":130,notes:140};class WidgetFramework{constructor(){n(this,"_initialized");n(this,"_widgets",[]);n(this,"_userPrefs",{})}initialize(e,t){return this._initialized||(this._initialized=new Promisified,notify.onSessionReady().promise.then(s=>{var r;s&&s.widgets?(s.widgets.forEach(i=>{this._widgets.push(new Widget(i))}),this.loadUserPrefs().then(()=>{var i;(i=this._initialized)==null||i.resolve()}).catch(i=>{var o;(o=this._initialized)==null||o.reject()})):(r=this._initialized)==null||r.reject()})),this._initialized.promise}get list(){return this._widgets}lookup(e){return this._widgets.find(t=>t.platformConf.name===e)}lookupDefaultPosition(e){return defaultWidgetPosition[e]}get userPrefs(){return this._userPrefs}async loadUserPrefs(){await configure.User.preferences.load("widgets",{}).then(e=>this.applyUserPrefs(e))}saveUserPrefs(){return configure.User.preferences.update("widgets",this._userPrefs).save("widgets").then(()=>{notify.events().publish(LAYER_NAME.WIDGETS,{name:EVENT_NAME.USERPREF_CHANGED})})}async applyUserPrefs(e){this._userPrefs=e??this._userPrefs;const t=configure.Platform.theme,s=[];t.listSkins().then(r=>{var a;const i=((a=r.find(c=>c.child===t.skin))==null?void 0:a.parent)==="panda"?secondLevelWidgets:firstLevelWidgets;this._widgets=this._widgets.filter((c,l)=>{const h=c.platformConf.name;return i.indexOf(h)!==-1?!1:(this._userPrefs[h]||(this._userPrefs[h]={index:defaultWidgetOrder[h]??999,show:!0,position:c.platformConf.position}),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)});const o=new Idiom;this._widgets=this._widgets.sort((c,l)=>{const h=o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(),p=o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();return h<p?-1:h>p?1:0})})}}class Widget{constructor(e){n(this,"_schoolConf",{});n(this,"_userPref");this._platformConf=e,this._userPref=null}get platformConf(){return this._platformConf}get schoolConf(){return this._schoolConf}get userPref(){return this._userPref}applyUserPref(e){this._userPref=e,this._userPref.position=this._userPref.position??widgets.lookupDefaultPosition(this._platformConf.name)??"left"}}const widgets=new WidgetFramework;class LastInfosWidget{loadInfos(e){return transport.http.get("/actualites/infos/last/"+e)}getMaxResults(){return transport.http.get("/userbook/preference/maxInfos").then(e=>e.preference?parseInt(e.preference):4)}setMaxResults(e){return transport.http.putJson("/userbook/preference/maxInfos",`"${e}"`)}}const WIDGET_NAME={LAST_INFOS:"last-infos-widget",BIRTHDAY:"birthday",CALENDAR:"calendar-widget",CARNET:"carnet-de-bord",RECORD:"record-me",MOOD:"mood",MY_APPS:"my-apps",NOTES:"notes",RSS:"rss-widget",BOOKMARK:"bookmark-widget",QWANT:"qwant",QWANT_JUNIOR:"qwant-junior",AGENDA:"agenda-widget",CURSUS:"cursus-widget",MAXICOURS:"maxicours-widget",UNIVERSALIS:"universalis-widget",BRIEFME:"briefme-widget",SCHOOL:"school-widget"};class WidgetFrameworkFactory{static instance(){return widgets}}exports.ACTION=ACTION;exports.APP=APP$4;exports.BOOLEAN_FILTER=BOOLEAN_FILTER;exports.ConfigurationFrameworkFactory=ConfigurationFrameworkFactory;exports.DocumentHelper=DocumentHelper;exports.ERROR_CODE=ERROR_CODE;exports.EVENT_NAME=EVENT_NAME;exports.FOLDER=FOLDER;exports.ITimelineFactory=ITimelineFactory;exports.LAYER_NAME=LAYER_NAME;exports.LastInfosWidget=LastInfosWidget;exports.NotifyFrameworkFactory=NotifyFrameworkFactory;exports.ReactionTypes=ReactionTypes;exports.ResourceService=ResourceService;exports.SORT_BY=SORT_BY;exports.SORT_ORDER=SORT_ORDER;exports.SessionFrameworkFactory=SessionFrameworkFactory;exports.SnipletsService=SnipletsService;exports.StringUtils=StringUtils;exports.TransportFrameworkFactory=TransportFrameworkFactory;exports.USER_PREFS=USER_PREFS;exports.WIDGET_NAME=WIDGET_NAME;exports.WIDGET_POSITION=WIDGET_POSITION;exports.WidgetFrameworkFactory=WidgetFrameworkFactory;exports.isActionAvailable=isActionAvailable;exports.odeServices=odeServices;
|
|
1
|
+
"use strict";var T=Object.defineProperty;var P=(u,e,t)=>e in u?T(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t;var n=(u,e,t)=>P(u,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const axios=require("axios"),utilities=require("@edifice.io/utilities"),ERROR_CODE={SUCCESS:"0000",UNKNOWN:"0010",NOT_INITIALIZED:"0020",NOT_SUPPORTED:"0030",APP_NOT_FOUND:"0040",AGENT_NOT_FOUND:"0050",TRANSPORT_ERROR:"0060",TIME_OUT:"0070",MALFORMED_DATA:"0080",NOT_LOGGED_IN:"0090"},APP$4={ADMIN:"admin",ARCHIVE:"archive",AUTH:"auth",CAS:"cas",COMMUNICATION:"communication",CONVERSATION:"conversation",DIRECTORY:"directory",USERBOOK:"userbook",INFRA:"infra",PORTAL:"portal",TIMELINE:"timeline",WORKSPACE:"workspace",EXPLORER:"explorer",HOMEWORKS:"homeworks",VIDEO:"video",MINDMAP:"mindmap",SCRAPBOOK:"scrapbook",COLLABORATIVEWALL:"collaborativewall",WIKI:"wiki",TIMELINEGENERATOR:"timelinegenerator",COLLABORATIVEEDITOR:"collaborativeeditor"},USER_PREFS={APPS:"apps",WIDGETS:"widgets",LANGUAGE:"language",AUTH_CONNECTOR_ACCESSED:"authenticatedConnectorsAccessed",CURSUS:"cursus",INFOTIP:"infotip",RGPD_COOKIES:"rgpdCookies"},R=class R{constructor(e){n(this,"name");n(this,"listeners",new Set);this.name=e}static getChannel(e){let t=R.channels.get(e);return t||(t=new R(e),R.channels.set(e,t)),t}listen(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}publish(e){for(const t of Array.from(this.listeners))try{t(e)}catch(s){console.error("[SimpleChannel] publish failed",s)}}close(){this.listeners.clear(),R.channels.delete(this.name)}};n(R,"channels",new Map);let SimpleChannel=R;class Subscription{constructor(e,t){n(this,"revoke");this._channel=e,this.revoke=this.setReceiver(s=>t==null?void 0:t(s))}setReceiver(e){if(!this._channel)return()=>{};const t=this._channel.listen(e);return()=>{t(),this._channel=void 0}}}class Subject{constructor(){n(this,"publishChannels",new Map)}getChannelName(e){return"Subject:"+e}getPublishChannel(e){const t=this.getChannelName(e);let s=this.publishChannels.get(t);return s||(s=this.newChannel(e),this.publishChannels.set(t,s)),s}newChannel(e){const t=this.getChannelName(e);return SimpleChannel.getChannel(t)}publish(e,t){typeof e=="string"&&this.getPublishChannel(e).publish(t)}subscribe(e,t){if(typeof e=="string"){const s=this.newChannel(e);return new Subscription(s,t)}else return new Subscription}}const ASYNC_DATA_NAME={SESSION_READY:"sessionReady",LANG_READY:"langReady",SKIN_READY:"skinReady",OVERRIDE_READY:"overrideReady",APPCONF_READY:"appConfReady"};class Promisified{constructor(){n(this,"_resolution");n(this,"_rejection");n(this,"_promise",new Promise((e,t)=>{this._resolution=e,this._rejection=t}))}get promise(){return this._promise}resolve(e){this._resolution&&this._resolution(e)}reject(e){this._rejection&&this._rejection(e)}}class NotifyFramework{constructor(){n(this,"promises",{});n(this,"subject",new Subject)}asyncData(e){return typeof this.promises[e]>"u"&&(this.promises[e]=new Promisified),this.promises[e]}onSessionReady(){return this.asyncData(ASYNC_DATA_NAME.SESSION_READY)}onLangReady(){return this.asyncData(ASYNC_DATA_NAME.LANG_READY)}onSkinReady(){return this.asyncData(ASYNC_DATA_NAME.SKIN_READY)}onOverridesReady(){return this.asyncData(ASYNC_DATA_NAME.OVERRIDE_READY)}onAppConfReady(){return this.asyncData(ASYNC_DATA_NAME.APPCONF_READY)}promisify(){return new Promisified}events(){return this.subject}}const notify=new NotifyFramework,loadedScripts$1={};class Http{constructor(e){n(this,"axios");n(this,"_latestResponse");this.axios=axios.create(e)}setCdn(e){e&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=e,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const t=arguments[1];return t.startsWith("/infra/public")&&(arguments[1]=e+t),/^\/([^\/]*)\/public/.test(t)&&(arguments[1]=e+t),t.startsWith("/assets")&&(arguments[1]=e+t),t=="/conf/public"&&(arguments[1]=t),t.startsWith("http")&&(arguments[1]=t),this.baseOpen.apply(this,arguments)})}toAxiosConfig(e){if(e){const t=Object.assign({},this.axios.defaults);return e.headers&&(t.headers&&(t.headers=Object.assign({},this.axios.defaults.headers)),Object.assign(t.headers,e.headers)),e.responseType&&(t.responseType=e.responseType),e.queryParams&&(t.params=Object.assign({},e.queryParams)),t}else return this.axios.defaults}toCdnUrl(e){const t=ConfigurationFrameworkFactory.instance().Platform.cdnDomain;if((t==null?void 0:t.length)>0&&e!=="/conf/public"){const s=""+e;(s.startsWith("/infra/public")||s.startsWith("/assets")||/^\/([^\/]*)\/public/.test(s))&&(e=t+s)}return e}mapAxiosError(e,t){return e.response?this._latestResponse=e.response:e.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN},!t||t.disableNotifications,this._latestResponse}mapAxiosResponse(e,t){return this._latestResponse=e,e.data}get latestResponse(){return this._latestResponse}isResponseError(){return this.latestResponse.status<200||this.latestResponse.status>=300}get(e,t){return this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t)).then(s=>this.mapAxiosResponse(s,t)).catch(s=>this.mapAxiosError(s,t))}post(e,t,s){return this.axios.post(e,t,this.toAxiosConfig(s)).then(r=>this.mapAxiosResponse(r,s)).catch(r=>this.mapAxiosError(r,s))}postFile(e,t,s){const r=this.toAxiosConfig(s);return r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"],this.axios.post(e,t,r).then(i=>this.mapAxiosResponse(i,s)).catch(i=>this.mapAxiosError(i,s))}postJson(e,t,s){const r=this.toAxiosConfig();return r.headers&&(r.headers["Content-Type"]="application/json"),this.axios.post(e,t,this.toAxiosConfig(s)).then(i=>this.mapAxiosResponse(i,s)).catch(i=>this.mapAxiosError(i,s))}put(e,t,s){return this.axios.put(e,t,this.toAxiosConfig(s)).then(r=>this.mapAxiosResponse(r,s)).catch(r=>this.mapAxiosError(r,s))}putJson(e,t,s){const r=this.toAxiosConfig(s);return r.headers&&(r.headers["Content-Type"]="application/json"),this.axios.put(e,t,r).then(i=>this.mapAxiosResponse(i,s)).catch(i=>this.mapAxiosError(i,s))}delete(e,t){return this.axios.delete(e,this.toAxiosConfig(t)).then(s=>this.mapAxiosResponse(s,t)).catch(s=>this.mapAxiosError(s,t))}deleteJson(e,t){return this.axios.delete(e,{data:t}).then(s=>this.mapAxiosResponse(s)).catch(s=>this.mapAxiosError(s))}getScript(e,t,s){const r=s??"exports",i=this.toAxiosConfig(t);return i.headers&&(i.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),i).then(o=>this.mapAxiosResponse(o,t)).then(o=>{try{const a=`"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;return Function(a)()}catch{return o}}).catch(o=>{throw this.mapAxiosError(o,t),o})}loadScript(e,t){return loadedScripts$1[e]?Promise.resolve():this.getScript(e,t).then(s=>{loadedScripts$1[e]=!0})}}class TransportFramework{constructor(){n(this,"_http",new Http)}get http(){return this._http}newHttpInstance(e){return new Http(e)}}const transport=new TransportFramework;class ConfigurationFrameworkFactory{static instance(){return configure}}const http$2=transport.http;class Session{constructor(){n(this,"_me",null);n(this,"_currentLanguage","");n(this,"_notLoggedIn",!0);n(this,"_description");n(this,"_profile")}get currentLanguage(){return this._currentLanguage}get notLoggedIn(){return this._notLoggedIn}get description(){return this._description}get avatarUrl(){let e=this.description.photo;return(!e||e==="no-avatar.jpg"||e==="no-avatar.svg")&&(e=ConfigurationFrameworkFactory.instance().Platform.theme.basePath+"/img/illustrations/no-avatar.svg"),e}get user(){return this._me}get currentApp(){return configure.Platform.apps.currentApp}async initialize(){return http$2.get("/auth/oauth2/userinfo").then(e=>{if(http$2.isResponseError()||typeof e=="string")throw ERROR_CODE.NOT_LOGGED_IN;return this.setCurrentModel(e),this._notLoggedIn?this.loadDefaultLanguage():this.loadUserLanguage()}).then(e=>(this.setCurrentLanguage(e),this.loadDescription())).then(()=>this.getUserProfile()).then(()=>{notify.onSessionReady().resolve(this._me)}).catch(e=>{if(e===ERROR_CODE.NOT_LOGGED_IN)return Promise.resolve();notify.onSessionReady().reject(e)})}setCurrentModel(e){this._me=e,this._notLoggedIn=!(e&&e.sessionMetadata&&e.sessionMetadata.userId)}hasWorkflow(e){var t;return e===void 0||((t=this._me)==null?void 0:t.authorizedActions.findIndex(s=>s.name===e))!==-1}hasRight(e,t){if(t==="owner")return e.owner&&e.owner.userId===this._me.userId;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;return i&&o}get latestQuotaAndUsage(){return http$2.get(`/workspace/quota/user/${this._me.userId}`).then(e=>(this._description&&(this._description.quota=e.quota,this._description.storage=e.storage),e)).catch(()=>({quota:0,storage:0}))}setCurrentLanguage(e){this._currentLanguage=e,notify.onLangReady().resolve(e)}loadDefaultLanguage(){return http$2.get("/locale").then(e=>e.locale).catch(()=>this._currentLanguage)}loadDescription(){return Promise.all([http$2.get("/userbook/api/person",{requestName:"refreshAvatar"}),http$2.get("/directory/userbook/"+this._me.userId)]).then(e=>(e[0].status==="ok"&&e[0].result&&e[0].result.length>0?this._description=e[0].result[0]:this._description={},this._description.type&&!this._description.profiles&&(this._description.profiles=this._description.type),Object.assign(this._description,e[1]),this._description))}get profile(){return this._profile}getUserProfile(){return http$2.get("/userbook/api/person").then(e=>e.result).then(e=>this._profile=e[0].type)}loadUserLanguage(){return http$2.get("/userbook/preference/language").then(e=>{try{return JSON.parse(e.preference)["default-domain"]}catch{return this.loadDefaultLanguage()}}).catch(()=>this.loadDefaultLanguage())}getEmailValidationInfos(){return http$2.get("/directory/user/mailstate")}checkEmail(e){return http$2.put("/directory/user/mailstate",{email:e})}tryEmailValidation(e){return http$2.post("/directory/user/mailstate",{key:e})}getMobileValidationInfos(){return http$2.get("/directory/user/mobilestate")}checkMobile(e){return http$2.put("/directory/user/mobilestate",{mobile:e})}tryMobileValidation(e){return http$2.post("/directory/user/mobilestate",{key:e})}getMfaInfos(){return http$2.get("/auth/user/mfa/code")}tryMfaCode(e){return http$2.post("/auth/user/mfa/code",{key:e})}}class SessionFramework{constructor(){n(this,"session",new Session)}initialize(){return this.session.initialize()}login(e,t,s,r){const i=new FormData;return i.append("email",e),i.append("password",t),typeof s<"u"&&i.append("rememberMe",""+s),typeof r<"u"&&i.append("secureLocation",""+r),transport.http.post("/auth/login",i,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(transport.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return transport.http.get("/auth/logout").finally(()=>{})}}const session=new SessionFramework;class Theme{constructor(){n(this,"_conf");n(this,"_loaded");n(this,"skinName","");n(this,"themeName","");n(this,"skin","raw");n(this,"themeUrl","/assets/themes/raw/default/");n(this,"templateOverrides",{});n(this,"portalTemplate","/assets/themes/raw/portal.html");n(this,"basePath","");n(this,"logoutCallback","");n(this,"skins",[]);n(this,"is1D",!1);n(this,"is2D",!1);n(this,"_onSkinReady",notify.onSkinReady());n(this,"_onOverrideReady",notify.onOverridesReady())}initialize(e){return notify.onSessionReady().promise.then(()=>this.load(e))}get version(){return configure.Platform.deploymentTag}get cdnDomain(){return configure.Platform.cdnDomain}async onFullyReady(){return await this._loaded,this}onSkinReady(){return this._onSkinReady.promise}onOverrideReady(){return this._onOverrideReady.promise}async getConf(e){return this._conf=this._conf??await transport.http.getScript("/assets/theme-conf.js",{queryParams:{v:e??this.version}},"exports.conf"),this._conf}load(e){return e=e??this.version,this._loaded||(this._loaded=(session.session.notLoggedIn?this.loadDisconnected(e):this.loadConnected(e)).then(async()=>{var s,r;const t=await this.listSkins();this.is1D=((s=t.find(i=>i.child===this.skin))==null?void 0:s.parent)==="panda",this.is2D=((r=t.find(i=>i.child===this.skin))==null?void 0:r.parent)==="theme-open-ent"})),this._loaded}loadDisconnected(e){return new Promise((t,s)=>{transport.http.get("/skin",{queryParams:{v:this.version}}).then(r=>{this.skin=r.skin,this.themeUrl=`${this.cdnDomain}/assets/themes/${r.skin}/skins/default/`,this.basePath=this.themeUrl+"../../",this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${r.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(i=>{this.templateOverrides=i,this._onOverrideReady.resolve(i),t()}).catch(i=>{if(transport.http.latestResponse.status===404)t();else throw i})}).catch(r=>{this._onSkinReady.reject(r),this._onOverrideReady.reject(r),s()})})}loadConnected(e){return new Promise((t,s)=>{this.loadDefaultTheme(e).then(()=>{this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${this.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(r=>{this.templateOverrides=r,this._onOverrideReady.resolve(r),t()}).catch(r=>{if(transport.http.latestResponse.status===404)t(),this._onSkinReady.reject(r),this._onOverrideReady.reject(r);else throw r})})})}async loadDefaultTheme(e){return session.session.notLoggedIn?Promise.reject():transport.http.get("/theme",{queryParams:{_:e}}).then(t=>{this.skinName=t.skinName,this.themeName=t.themeName,this.themeUrl=t.skin,this.basePath=`${this.cdnDomain}${this.themeUrl}../../`,this.skin=this.themeUrl.split("/assets/themes/")[1].split("/")[0],this.portalTemplate=`${this.cdnDomain}/assets/themes/${this.skin}/portal.html`,this.logoutCallback=t.logoutCallback})}listThemes(){return transport.http.get("/themes")}async setDefaultTheme(e){await transport.http.get("/userbook/api/edit-userbook-info?prop=theme-"+this.skin+"&value="+e._id),await this.loadDefaultTheme(this.version)}listSkins(){return this.skins.length>0?Promise.resolve(this.skins):this.getConf().then(e=>{const t=e.overriding.find(s=>s.child===this.skin);return t!=null&&t.group?this.skins=this.skins.concat(e.overriding.filter(s=>s.group===t.group)):this.skins=this.skins.concat(e.overriding),this.skins})}async getHelpPath(){const t=(await this.listSkins()).find(s=>s.child===this.skin);return(t==null?void 0:t.help)??"/help"}}const bundle$1={},promises$1={},defaultDiacriticsRemovalMap$1=[{base:"A",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},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class Idiom{translate(e,t){e=e??"";let s=bundle$1[e]===void 0?e:bundle$1[e];if(t&&typeof t=="object")for(const r in t)typeof t[r]<"u"&&(s=s.replace(new RegExp("\\${"+r+"}","g"),""+t[r]));return s}addBundlePromise(e){return this.loadBundlePromise(session.session.currentLanguage,e)}addBundle(e,t){this.loadBundle(session.session.currentLanguage,e,t)}loadBundlePromise(e,t){return this.loadBundle(e,t),promises$1[t]}loadBundle(e,t,s){const r=promises$1[t];if(r)s&&r.then(s).catch(s);else{const i=new Promisified;promises$1[t]=i.promise;const o={};e&&(o["Accept-Language"]=e),transport.http.get(t,{headers:o}).then(a=>{Object.assign(bundle$1,a),typeof s=="function"&&s(),i.resolve()}).catch(a=>{typeof s=="function"&&s(),i.reject()})}}addTranslations(e,t){notify.onLangReady().promise.then(s=>{this.loadBundle(s,e+"/"+s+".json",t)})}addAllTranslations(e){return e&&e.length>0?notify.onLangReady().promise.then(t=>Promise.all(e.map(s=>this.loadBundlePromise(t,s+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(const t in e)typeof bundle$1[t]!="string"&&(bundle$1[t]=e[t])}removeAccents(e){for(let t=0;t<defaultDiacriticsRemovalMap$1.length;t++)e=e.replace(defaultDiacriticsRemovalMap$1[t].letters,defaultDiacriticsRemovalMap$1[t].base);return e}}class UserPreferences{constructor(){n(this,"data",{})}get(e){return this.data[e]}load(e,t){return transport.http.get("/userbook/preference/"+e).then(s=>{try{return JSON.parse(s.preference)}catch{return t??{}}}).then(s=>(this.data[e]=s??{},s))}update(e,t){return t!==void 0&&(this.data[e]=t),this}save(e){return transport.http.putJson("/userbook/preference/"+e,this.data[e])}}class User{constructor(){n(this,"_me",null);n(this,"_keepOpenOnLogout",!1);n(this,"_preferences",new UserPreferences);n(this,"_bookmarkedApps",[])}get keepOpenOnLogout(){return this._keepOpenOnLogout}get preferences(){return this._preferences}get bookmarkedApps(){return this._bookmarkedApps}initialize(e){return this.loadPublicConf(),notify.onSessionReady().promise.then(t=>{t&&this.setCurrentModel(t)})}setCurrentModel(e){this._me=e,this._preferences=new UserPreferences,this.loadBookmarks()}loadPublicConf(){return transport.http.get("/conf/public").then(e=>(this._keepOpenOnLogout=(e==null?void 0:e.keepOpenOnLogout)||!1,e))}async loadBookmarks(){await transport.http.get("/userbook/preference/apps").then(e=>{e.preference||(e.preference=null);const t=JSON.parse(e.preference);let s;if(t&&t.length&&typeof t.concat=="function"){this._bookmarkedApps=t,s={bookmarks:t.map(o=>o.name),applications:[]},transport.http.putJson("/userbook/preference/apps",s);return}else s=t;s||(s={bookmarks:[],applications:[]});let r=!0;const i=[];s.bookmarks.forEach((o,a)=>{const c=this._me.apps.find(l=>l.name===o);if(c){const l=Object.assign({},c);this._bookmarkedApps.push(l)}else i.push(o),r=!1}),i.forEach(o=>{const a=s.bookmarks.indexOf(o);a!==-1&&s.bookmarks.splice(a,1)}),r||transport.http.putJson("/userbook/preference/apps",s)})}loadAppPrefs(e){return this.preferences.load(e,{})}saveAppPrefs(e){return this.preferences.save(e)}loadLanguage(){return this.preferences.load("language",{"default-domain":session.session.currentLanguage}).then(e=>e["default-domain"])}saveLanguage(e){return this.preferences.update("language",{"default-domain":e}).save("language")}}const http$1=transport==null?void 0:transport.http;class AppConf{constructor(){n(this,"_publicConf",{});n(this,"_currentApp");n(this,"_appConf",{})}get currentApp(){return this._currentApp??null}setCurrentApp(e){return this._currentApp=e,this}async initialize(e,t=!1){t||this.setCurrentApp(e),await Promise.all([this.getPublicConf(e),this.loadI18n(e)])}async getPublicConf(e){return this._publicConf[e]||(this._publicConf[e]=await http$1.get(`/${e}/conf/public`,{queryParams:{_:configure.Platform.deploymentTag}})),this._publicConf[e]}async getWebAppConf(e){let t;return this._appConf[e]||(await http$1.get("/applications-list")).apps.forEach(r=>{if(r!=null&&r.prefix){const i=r.prefix.replace("/","");this._appConf[i]=r}else r!=null&&r.name&&r.name.toLowerCase()==e&&(t=r)}),this._appConf[e]??t}async loadI18n(e){return await notify.onLangReady().promise,configure.Platform.idiom.addBundlePromise(`/${e}/i18n`)}}class Analytics{constructor(){n(this,"_status","void");n(this,"_params")}get status(){return this._status}xiti(){return this.parametersWithCheck("xiti",!1)}parameters(e){return this.parametersWithCheck(e,!0)}async parametersWithCheck(e,t){return this.initialize().promise.then(s=>!t||s.type===e||s.type==="multiple"?s[e]:void 0)}initialize(){return this._params||(this._params=notify.promisify(),this._status="pending",Promise.all([transport.http.get("/analyticsConf"),transport.http.get("/xiti/config")]).then(async e=>{var t;if(!e||!e[0]||!e[0].type)throw ERROR_CODE.MALFORMED_DATA;e[1]&&e[1].active&&(e[0].xiti=await this.initializeXiti(e[1])),(t=this._params)==null||t.resolve(e[0]),this._status="ready"}).catch(e=>{var t;throw this._status="failed",(t=this._params)==null||t.reject(),e})),this._params}async initializeXiti(e){if(!e.structureMap||!configure.Platform.apps.currentApp)return;const t=await notify.onSessionReady().promise,s=session.session.description;let r;for(const l of t.structures){const p=e.structureMap[l];if(p&&p.collectiviteId&&p.UAI){r=p;break}}if(!r||!r.active)return;const i=await configure.Platform.apps.getPublicConf(configure.Platform.apps.currentApp);if(!i)return;const o=i.xiti;if(!o||!o.LIBELLE_SERVICE||!r.UAI)return;function a(l){let p="";for(let E=0;E<l.length;E++)p+=l.charCodeAt(E);return p}const c={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:o.LIBELLE_SERVICE,TYPE:o.OUTIL?"TIERS":"NATIF",OUTIL:o.OUTIL?o.OUTIL:"",STRUCT_ID:r.collectiviteId,STRUCT_UAI:r.UAI,PROJET:r.projetId?r.projetId:e.ID_PROJET,EXPLOITANT:e.ID_EXPLOITANT,PLATFORME:r.plateformeId?r.plateformeId:e.ID_PLATEFORME,ID_PERSO:a(t.userId),PROFILE:s.profiles&&s.profiles.length>0?c[s.profiles[0]]??"":""}}}class ConfigurationFramework{constructor(){n(this,"Platform",{deploymentTag:"",cdnDomain:"",apps:new AppConf,theme:new Theme,analytics:new Analytics,idiom:new Idiom,listLanguages:()=>transport.http.get("/languages")});n(this,"School",{});n(this,"User",new User)}async initialize(e,t){if(!e){const r=l=>(l<10?"0":"")+l.toFixed(0),i=new Date,o=i.getFullYear(),a=i.getMonth()+1,c=i.getDate();e=`${o}${r(a)}${r(c)}`}const s=e;this.Platform.deploymentTag=e,typeof t=="string"&&t.length>0&&(this.Platform.cdnDomain=t),transport.http.setCdn(this.Platform.cdnDomain),await Promise.all([this.Platform.theme.initialize(s),notify.onSessionReady().promise.then(r=>this.Platform.idiom.addBundlePromise("/i18n")),this.User.initialize(s)])}}const configure=new ConfigurationFramework,http=transport==null?void 0:transport.http;var v;const me=(v=session==null?void 0:session.session)==null?void 0:v.user;class Notification{constructor(e){n(this,"_id");n(this,"model");e.reported=e.reporters&&e.reporters.length>0,this._id=e._id,this.model=e}isUnread(){var e;return((e=this.model.recipients)==null?void 0:e.find(t=>t.userId===me.userId))!==void 0}delete(){return http.delete("/timeline/"+this._id)}discard(){return http.put("/timeline/"+this._id)}report(){return http.put("/timeline/"+this._id+"/report")}}class TimelineApp{constructor(){n(this,"_notifications",[]);n(this,"_notificationTypes",[]);n(this,"_flashMessages",[]);n(this,"_pageNumber",0);n(this,"_lastPage",!1);n(this,"_loading",!1);n(this,"showMine",!1)}get notifications(){return this._notifications}get isLoading(){return this._loading}get page(){return this._pageNumber}get hasMorePage(){return!this._lastPage}get notificationTypes(){return this._notificationTypes}get selectedNotificationTypes(){return this.preferences.type=this.preferences.type||[],this.preferences.type}get preferences(){return configure.User.preferences.get(APP$4.TIMELINE)}get flashMessages(){return this._flashMessages}savePreferences(){return configure.User.saveAppPrefs(APP$4.TIMELINE)}resetPagination(){this._pageNumber=0,this._lastPage=!1,this._loading=!1}initialize(){return Promise.all([configure.User.loadAppPrefs(APP$4.TIMELINE),transport.http.get("/timeline/types")]).then(e=>{this._notificationTypes=e[1]})}loadNotifications(e){if(this._loading||this._lastPage)return Promise.resolve();e&&(this._pageNumber++,this._lastPage=!1);const t=this.selectedNotificationTypes;if(t.length===0)return this._lastPage=!0,Promise.resolve();const s={page:this.page,mine:1};return this.showMine||delete s.mine,this._loading=!0,transport.http.get(`/timeline/lastNotifications?type=${t.join("&type=")}`,{queryParams:s}).then(r=>{if(this._loading=!1,r.status==="ok")if(r.number&&r.results){const i=r.results.filter(o=>this._notifications.findIndex(a=>a._id===o._id)===-1).map(o=>new Notification(o));this._notifications=this._notifications.concat(i),this._pageNumber++}else this._lastPage=!0}).catch(r=>{this._loading=!1})}loadFlashMessages(){return transport.http.get("/timeline/flashmsg/listuser").then(e=>{this._flashMessages=e})}markAsRead(e){return transport.http.put("/timeline/flashmsg/"+e.id+"/markasread")}}class ITimelineFactory{static createInstance(){return new TimelineApp}}const ReactionTypes=["REACTION_1","REACTION_2","REACTION_3","REACTION_4"];class NotifyFrameworkFactory{static instance(){return notify}}const LAYER_NAME={WIDGETS:"widgets",EXPLORER:"explorer",TRANSPORT:"transport",WEB_DATA:"webDataPipeline"},EVENT_NAME={USERPREF_CHANGED:"userprefChanged",SEARCH_RESULTED:"searchResulted",ERROR_OCCURED:"error",DATA_TRACKED:"track"};class ServiceRegistry extends Map{register({application:e,resourceType:t},s){this.set(`${e}:main`,s),this.set(`${e}:${t}`,s)}findService(e,t){return this.lookupService(e,t)}findMainService({application:e},t){return this.lookupService({application:e,resourceType:"main"},t)}isRegistered({application:e,resourceType:t}){return this.get(`${e}:${t}`)!==void 0}lookupService({application:e,resourceType:t},s){const r=this.get(`${e}:${t}`);if(r===void 0)throw`Service not found: ${e}:${t}`;return r(s)}}const m=class m{constructor(e){n(this,"checkHttpResponse",e=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return e});this.context=e}get http(){return this.context.http()}async copy(e){const t=await this.http.post("/archive/duplicate",{application:e.application,resourceId:e.resourceId});return this.checkHttpResponse(t)}async publish(e){const t=new FormData;return t.append("title",e.title),t.append("cover",e.cover),t.append("coverName",e.cover.name),t.append("coverType",e.cover.type),t.append("teacherAvatar",e.teacherAvatar),t.append("teacherAvatarName",e.teacherAvatar.name||`teacherAvatar_${e.userId}`),t.append("teacherAvatarType",e.teacherAvatar.type),t.append("language",e.language),e.activityType.forEach(i=>{t.append("activityType[]",i)}),e.subjectArea.forEach(i=>{t.append("subjectArea[]",i)}),e.age.forEach(i=>{t.append("age[]",i.toString())}),t.append("description",e.description),e.keyWords.split(",").forEach(i=>{t.append("keyWords[]",i.trim())}),t.append("licence",e.licence),t.append("pdfUri",`${window.location.origin}${this.getPrintUrl(e.resourceEntId)}`),t.append("application",e.application?e.application:""),t.append("resourceId",e.resourceId),t.append("teacherSchool",e.userStructureName),await this.http.post("/appregistry/library/resource",t,{headers:{"Content-Type":"multipart/form-data"}})}async createContext(e){const t=await this.http.get("/explorer/context",{queryParams:this.toQueryParams(e)});return this.checkHttpResponse(t)}async searchContext(e){const t=await this.http.get("/explorer/resources",{queryParams:this.toQueryParams(e)});return this.checkHttpResponse(t)}async searchResource(e){const t=await this.http.get(`/explorer/resources/${e.id}`,{queryParams:this.getResourceParams(e)});return this.checkHttpResponse(t)}async createFolder(e){const t=await this.http.post("/explorer/folders",this.createFolderToBodyParams(e));return this.checkHttpResponse(t)}async updateFolder(e){const t=await this.http.put(`/explorer/folders/${e.folderId}`,this.createFolderToBodyParams(e));return this.checkHttpResponse(t)}async moveToFolder(e,t=!1){e.resourceIds=t?await this.mapAssetIdToIds({application:e.application,assetIds:e.resourceIds}):e.resourceIds;const s=await this.http.post(`/explorer/folders/${e.folderId}/move`,this.moveToBodyParams(e));return this.checkHttpResponse(s)}async listSubfolders(e){const t=await this.http.get(`/explorer/folders/${e}`);return this.checkHttpResponse(t)}async deleteAll(e,t=!1){e.resourceIds=t?await this.mapAssetIdToIds({application:e.application,assetIds:e.resourceIds}):e.resourceIds;const s=await this.http.deleteJson("/explorer",e);return this.checkHttpResponse(s)}async trashAll({resourceType:e,...t},s=!1){t.resourceIds=s?await this.mapAssetIdToIds({application:t.application,assetIds:t.resourceIds}):t.resourceIds;const r=await this.http.putJson("/explorer/trash",t);return this.checkHttpResponse(r)}async restoreAll({resourceType:e,...t},s=!1){t.resourceIds=s?await this.mapAssetIdToIds({application:t.application,assetIds:t.resourceIds}):t.resourceIds;const r=await this.http.putJson("/explorer/restore",t);return this.checkHttpResponse(r)}async mapAssetIdToIds({application:e,assetIds:t}){const s=await this.searchContext({application:e,pagination:{startIdx:0,pageSize:t.length+1},types:[],filters:{},asset_id:t});return t.map(r=>{const i=s.resources.find(o=>o.assetId===r);if(i===void 0)throw"explorer.assetid.notfound";return i.id})}async getThumbnailPath(e){if(typeof e>"u")return e;if(typeof e=="string")if(e.startsWith("blob:")){const t=await fetch(e).then(r=>r.blob());return`/workspace/document/${(await this.context.workspace().saveFile(t,{visibility:"protected",application:this.getApplication()}))._id}`}else return e;else return`/workspace/document/${(await this.context.workspace().saveFile(e,{visibility:"protected",application:this.getApplication()}))._id}`}toQueryParams(e){const t={application:e.application,start_idx:e.pagination.startIdx,page_size:e.pagination.pageSize,trashed:e.trashed};if(e.types.length>0&&(t.resource_type=e.types[0]),e.orders&&Object.entries(e.orders).length){const[[s,r]]=Object.entries(e.orders);t.order_by=`${s}:${r}`}return e.filters&&Object.assign(t,e.filters),typeof e.search=="string"&&(t.search=e.search),typeof e.asset_id<"u"&&(t.asset_id=[...e.asset_id]),typeof e.id<"u"&&(t.id=e.id),t}getResourceParams(e){return{application:e.application}}createFolderToBodyParams(e){return{application:e.application,resourceType:e.type,parentId:e.parentId,name:e.name}}moveToBodyParams(e){return{application:e.application,resourceType:this.getResourceType(),resourceIds:e.resourceIds,folderIds:e.folderIds}}};n(m,"registry",new ServiceRegistry),n(m,"register",m.registry.register.bind(m.registry)),n(m,"findService",m.registry.findService.bind(m.registry)),n(m,"findMainService",m.registry.findMainService.bind(m.registry)),n(m,"isRegistered",m.registry.isRegistered.bind(m.registry));let ResourceService=m;const APP$3="scrapbook",RESOURCE$3="scrapbook";class ScrapbookResourceService extends ResourceService{create(e){throw new Error("Method not implemented.")}async update(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.put(`/scrapbook/${e.entId}`,{trashed:e.trashed?1:0,title:e.name,icon:t,subTitle:e.description});return this.checkHttpResponse(s),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE$3}getApplication(){return APP$3}getFormUrl(e){return e?`/scrapbook?folderid=${e}#/create-scrapbook/`:"/scrapbook#/create-scrapbook/"}getViewUrl(e){return`/scrapbook#/view-scrapbook/${e}`}getPrintUrl(e){return`/scrapbook/print#/print-scrapbook/${e}`}getEditUrl(e){return`/scrapbook#/edit-scrapbook/${e}`}getExportUrl(e){return`/scrapbook/exportHtml/${e}`}}ResourceService.register({application:RESOURCE$3,resourceType:RESOURCE$3},u=>new ScrapbookResourceService(u));const APP$2="homeworks",RESOURCE$2="homeworks";class HomeworksResourceService extends ResourceService{async create(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.post("/homeworks",{title:e.name,thumbnail:t,description:e.description,repeats:e.repeats,folder:e.folder});return this.checkHttpResponse(s),{thumbnail:t,entId:s._id}}async update(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.put(`/homeworks/${e.entId}`,{title:e.name,thumbnail:t,description:e.description,repeats:e.repeats});return this.checkHttpResponse(s),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE$2}getApplication(){return APP$2}getFormUrl(e){return e?`/homeworks?folderid=${e}#/create-homeworks/`:"/homeworks#/create-homeworks/"}getViewUrl(e){return`/homeworks#/view-homeworks/${e}`}getPrintUrl(e){return`/homeworks/print#/print-homeworks/${e}`}getEditUrl(e){return`/homeworks#/edit-homeworks/${e}`}getExportUrl(){throw new Error("Export not implemented.")}}ResourceService.register({application:RESOURCE$2,resourceType:RESOURCE$2},u=>new HomeworksResourceService(u));const APP$1="timelinegenerator",RESOURCE$1="timelinegenerator";class TimelineGeneratorResourceService extends ResourceService{async create(e){const t=e.thumbnail?await this.getThumbnailPath(e.thumbnail):"",s=await this.http.post("/timelinegenerator/timelines",{headline:e.name,text:e.description,icon:t,type:"default",folder:e.folder});return this.checkHttpResponse(s),s}async update(e){const t=await this.getThumbnailPath(e.thumbnail),s=await this.http.put(`/timelinegenerator/timeline/${e.entId}`,{headline:e.name,text:e.description,icon:t,trashed:!!e.trashed,_id:e.entId,type:"default"});return this.checkHttpResponse(s),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE$1}getApplication(){return APP$1}getFormUrl(){throw new Error("Method not implemented.")}getViewUrl(e){return`/timelinegenerator#/view/${e}`}getPrintUrl(e){return`/timelinegenerator/print#/print/${e}`}getEditUrl(){throw new Error("Method not implemented.")}getExportUrl(){throw new Error("Method not implemented.")}}ResourceService.register({application:RESOURCE$1,resourceType:RESOURCE$1},u=>new TimelineGeneratorResourceService(u));const APP="collaborativeeditor",RESOURCE="collaborativeeditor";class CollaborativeEditorResourceService extends ResourceService{async create(e){const{name:t,description:s,thumbnail:r,folder:i}=e,o=r?await this.getThumbnailPath(r):"",a=await this.http.post("/collaborativeeditor",{name:t,description:s,thumbnail:o,folder:i});return this.checkHttpResponse(a),a}async update(e){const{name:t,description:s,thumbnail:r,entId:i}=e,o=await this.getThumbnailPath(r),a=await this.http.put(`/collaborativeeditor/${i}`,{name:t,description:s,thumbnail:o});return this.checkHttpResponse(a),{thumbnail:o,entId:i}}getResourceType(){return RESOURCE}getApplication(){return APP}getFormUrl(){throw new Error("Method not implemented.")}getViewUrl(e){return`/collaborativeeditor#/view/${e}`}getPrintUrl(){throw new Error("Method not implemented.")}getEditUrl(){throw new Error("Method not implemented.")}getExportUrl(){throw new Error("Method not implemented.")}}ResourceService.register({application:RESOURCE,resourceType:RESOURCE},u=>new CollaborativeEditorResourceService(u));const globalCache={},mutexPromise={};class CacheService{constructor(e){this.context=e}get http(){return this.context.http()}async fromCacheIfPossible(e,t,s){if(mutexPromise[e]!==void 0&&await mutexPromise[e],globalCache[e])return globalCache[e];try{const r=t();mutexPromise[e]=r;const i=await r;return s(i)&&(globalCache[e]=i),i}catch(r){throw console.error(`Failed to retrieve value for: ${e}`,r),r}}clearCache(e){if(e)delete globalCache[e];else for(const t in globalCache)globalCache.hasOwnProperty(t)&&delete globalCache[t]}async httpGet(e,t){return this.fromCacheIfPossible(e,async()=>{const s=await this.http.get(e,t),r={...this.http.latestResponse};return{value:s,response:r}},({response:s})=>!(s.status<200||s.status>=300))}async httpGetJson(e,t){const{response:s,value:r}=await this.httpGet(e,t);if(s.status<200||s.status>=300)throw`Bad http status (${s.status}) for url: ${e}`;return r}}class ConfService{constructor(e){this.context=e}get http(){return this.context.http()}get cache(){return this.context.cache()}get cdnDomain(){return configure.Platform.cdnDomain}get notify(){return this.context.notify()}async getConf(e){const[t,s]=await Promise.all([this.getThemeConf(),this.getApplicationsList()]),[r,i]=await Promise.all([this.getTheme({conf:t,publicTheme:s===void 0}),this.getWebAppConf({app:e,applications:s??[]})]),o={app:e,applications:s??[],conf:t,currentApp:i,theme:r};return this.notify.onAppConfReady().resolve(o),o}async getPublicConf(e){const{response:t,value:s}=await this.cache.httpGet(`/${e}/conf/public`,{queryParams:{_:configure.Platform.deploymentTag}});if(t.status<200||t.status>=300)throw ERROR_CODE.APP_NOT_FOUND;return s}getCdnUrl(){}async savePreference(e,t){this.http.putJson(`/userbook/preference/${e}`,t)}async getPreference(e){const t=await this.http.get(`/userbook/preference/${e}`);return this.http.isResponseError()||typeof t=="string"?{}:JSON.parse(t.preference)}async getThemeConf(e){return await this.http.getScript("/assets/theme-conf.js",{queryParams:{v:e}},"exports.conf")}async getApplicationsList(){const e=await this.http.get("/applications-list");if(!(this.http.isResponseError()||typeof e=="string"))return e.apps}async getWebAppConf({app:e,applications:t}){return t.find(r=>{if(r!=null&&r.prefix)return(r==null?void 0:r.prefix.replace("/",""))===e})}async getTheme({version:e,conf:t,publicTheme:s}){var E;const r=await this.http.get("/theme"),i=(E=t==null?void 0:t.overriding)==null?void 0:E.find(h=>s?h.parent==="theme-open-ent"&&h.bootstrapVersion==="ode-bootstrap-neo":h.child===(r==null?void 0:r.themeName)),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],p=(i==null?void 0:i.parent)==="panda";return{basePath:`${this.cdnDomain}${a}../../`,bootstrapVersion:l,is1d:p,logoutCallback:(r==null?void 0:r.logoutCallback)||"",skin:i==null?void 0:i.child,skinName:o,skins:c,themeName:i==null?void 0:i.child,themeUrl:a,npmTheme:(i==null?void 0:i.npmTheme)??void 0}}async getLogoutCallback(e){const{response:t,value:s}=await this.cache.httpGet("/theme",{queryParams:{_:e}});if(t.status<200||t.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return s.logoutCallback}}class DirectoryService{constructor(e){this.odeServices=e}get http(){return this.odeServices.http()}get cache(){return this.odeServices.cache()}getAvatarUrl(e,t,s="100x100"){return t==="user"?`/userbook/avatar/${e}?thumbnail=${s}`:"/assets/img/illustrations/group-avatar.svg"}getDirectoryUrl(e,t){return t==="user"?`/userbook/annuaire#/${e}`:`/userbook/annuaire#/group-view/${e}`}async getBookMarks(){return(await this.cache.httpGetJson("/directory/sharebookmark/all")).map(({id:t,name:s})=>({id:t,displayName:s,members:[]}))}async getBookMarkById(e){const{groups:t,id:s,name:r,users:i,notVisibleCount:o}=await this.http.get(`/directory/sharebookmark/${e}`);return{id:s,displayName:r,notVisibleCount:o,groups:t.map(({name:a,id:c,nbUsers:l})=>({nbUsers:l,displayName:a,id:c})),users:i.map(({displayName:a,id:c,profile:l})=>({profile:l,displayName:a,firstName:"",lastName:"",login:"",id:c}))}}async saveBookmarks(e,{bookmarks:t,groups:s,users:r}){this.cache.clearCache("/directory/sharebookmark/all");const i=r.map(h=>typeof h=="string"?h:h.id),o=s.map(h=>typeof h=="string"?h:h.id),a=t.map(async h=>{if(typeof h=="string"){const{displayName:y,groups:d,id:g,users:A}=await this.getBookMarkById(h),f=A.map(_=>_.id),w=d.map(_=>_.id);return{displayName:y,id:g,members:[...w,...f]}}else return Promise.resolve(h)}),l=(await Promise.all(a)).map(h=>h.members).reduce((h,y)=>[...h,...y],[]),p={name:e,members:[...i,...o,...l]},{id:E}=await this.http.postJson("/directory/sharebookmark",p);return{id:E,displayName:e,members:p.members}}}const loadedScripts={};class HttpService{constructor(e,t){n(this,"axios");n(this,"baseUrl");n(this,"headers",{});n(this,"_latestResponse");this.context=e,this.axios=axios.create(t)}fixBaseUrl(e){return e.startsWith("http://")||e.startsWith("https://")?e:this.baseUrl?this.baseUrl.endsWith("/")||e.startsWith("/")?`${this.baseUrl}${e}`:`${this.baseUrl}/${e}`:e}useBaseUrl(e){return this.baseUrl=e,this}useHeaders(e){return this.headers=e,this}setCdn(e){e&&XMLHttpRequest&&!XMLHttpRequest.prototype.cdnUrl&&(XMLHttpRequest.prototype.cdnUrl=e,XMLHttpRequest.prototype.baseOpen=XMLHttpRequest.prototype.open,XMLHttpRequest.prototype.open=function(){const t=arguments[1];return t.startsWith("/infra/public")&&(arguments[1]=e+t),/^\/([^\/]*)\/public/.test(t)&&(arguments[1]=e+t),t.startsWith("/assets")&&(arguments[1]=e+t),t=="/conf/public"&&(arguments[1]=t),t.startsWith("http")&&(arguments[1]=t),this.baseOpen.apply(this,arguments)})}toAxiosConfig(e){if(e){const t=Object.assign({},this.axios.defaults);e.headers&&(t.headers=Object.assign({},this.axios.defaults.headers),Object.assign(t.headers,e.headers)),e.responseType&&(t.responseType=e.responseType),e.queryParams&&(t.params=Object.assign({},e.queryParams));const s=t.headers??{};return t.headers={...s,...this.headers},t}else return this.axios.defaults}toCdnUrl(e){e=this.fixBaseUrl(e);const t=this.context.conf().getCdnUrl()||"";if(t.length>0&&e!=="/conf/public"){const s=""+e;(s.startsWith("/infra/public")||s.startsWith("/assets")||/^\/([^\/]*)\/public/.test(s))&&(e=t+s)}return e}mapAxiosError(e,t){e.response?this._latestResponse=e.response:e.request?this._latestResponse={status:408,statusText:ERROR_CODE.TIME_OUT}:this._latestResponse={status:500,statusText:ERROR_CODE.UNKNOWN};const{status:s,statusText:r,headers:i,data:o}=this._latestResponse;return t!=null&&t.disableNotifications||notify.events().publish(LAYER_NAME.TRANSPORT,{name:EVENT_NAME.ERROR_OCCURED,data:{params:t,response:{status:s,statusText:r,headers:i},payload:o}}),o}mapAxiosResponse(e,t){return this._latestResponse=e,e.data}get latestResponse(){return this._latestResponse}isResponseError(){return this.latestResponse.status<200||this.latestResponse.status>=300}async get(e,t){try{const s=await this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t));return this.mapAxiosResponse(s,t)}catch(s){throw this.mapAxiosError(s,t)}}async post(e,t,s){try{const r=await this.axios.post(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(r,s)}catch(r){throw this.mapAxiosError(r,s)}}async postFile(e,t,s){const r=this.toAxiosConfig(s);r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"];try{const i=await this.axios.post(this.fixBaseUrl(e),t,{...r,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async postJson(e,t,s){const r=this.toAxiosConfig();r.headers&&(r.headers["Content-Type"]="application/json");try{const i=await this.axios.post(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async put(e,t,s){try{const r=await this.axios.put(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(r,s)}catch(r){throw this.mapAxiosError(r,s)}}async putFile(e,t,s){try{const r=this.toAxiosConfig(s);r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"];const i=await this.axios.put(this.fixBaseUrl(e),t,{...r,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(i,s)}catch(r){throw this.mapAxiosError(r,s)}}async putJson(e,t,s){const r=this.toAxiosConfig(s);r.headers&&(r.headers["Content-Type"]="application/json");try{const i=await this.axios.put(this.fixBaseUrl(e),t,r);return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async patch(e,t,s){try{const r=await this.axios.patch(this.fixBaseUrl(e),t,this.toAxiosConfig(s));return this.mapAxiosResponse(r,s)}catch(r){throw this.mapAxiosError(r,s)}}async patchFile(e,t,s){try{const r=this.toAxiosConfig(s);r.headers&&r.headers["Content-Type"]&&delete r.headers["Content-Type"];const i=await this.axios.patch(this.fixBaseUrl(e),t,{...r,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(i,s)}catch(r){throw this.mapAxiosError(r,s)}}async patchJson(e,t,s){const r=this.toAxiosConfig(s);r.headers&&(r.headers["Content-Type"]="application/json");try{const i=await this.axios.patch(this.fixBaseUrl(e),t,r);return this.mapAxiosResponse(i,s)}catch(i){throw this.mapAxiosError(i,s)}}async delete(e,t){try{const s=await this.axios.delete(this.fixBaseUrl(e),this.toAxiosConfig(t));return this.mapAxiosResponse(s,t)}catch(s){throw this.mapAxiosError(s,t)}}async deleteJson(e,t){try{const s=await this.axios.delete(this.fixBaseUrl(e),{data:t});return this.mapAxiosResponse(s)}catch(s){throw this.mapAxiosError(s)}}getScript(e,t,s){const r=s??"exports",i=this.toAxiosConfig(t);return i.headers&&(i.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),i).then(o=>this.mapAxiosResponse(o,t)).then(o=>{try{const a=`"use strict";var ${r.split(".")[0]}={};${o};return ${r};`;return Function(a)()}catch{return o}}).catch(o=>{throw this.mapAxiosError(o,t),o})}loadScript(e,t){return loadedScripts[e]?Promise.resolve():this.getScript(e,t).then(s=>{loadedScripts[e]=!0})}}class RightService{constructor(e){this.context=e}get session(){return this.context.session()}parseResourceRight(e){const t=e.split(":");if(t.length===2){if(t[0]==="creator")return{id:t[1],right:"creator",type:"creator"}}else return t.length===3?{id:t[1],right:t[2],type:t[0]}:void 0}parseResourceRights(e){return e.map(s=>this.parseResourceRight(s)).filter(s=>s!==void 0)}hasResourceRight({id:e,groupIds:t},s,r){const i=r.map(o=>typeof o=="string"?this.parseResourceRight(o):o).filter(o=>o!==void 0);for(const o of i){if(o.id===e&&o.type==="creator")return!0;if(o.id===e&&o.type==="user"&&o.right===s)return!0;if(t.includes(o.id)&&o.type==="group"&&o.right===s)return!0}return!1}async sessionHasResourceRight(e,t){try{const s=await this.session.getUser();return!!s&&this.hasResourceRight({groupIds:s.groupsIds,id:s.userId},e,t)}catch(s){return console.error(`Unexpected error ${s} in sessionHasResourceRight()`),!1}}async sessionHasAtLeastOneResourceRight(e,t){for(const s of e)if(await this.sessionHasResourceRight(s,t))return!0;return!1}async sessionHasResourceRightForEachList(e,t){let s=0;for(const r of t)await this.sessionHasResourceRight(e,r)&&s++;return s===t.length}async sessionHasAtLeastOneResourceRightForEachList(e,t){for(const s of e){let r=0;for(const i of t)await this.sessionHasResourceRight(s,i)&&r++;if(r===t.length)return!0}return!1}hasWorkflowRight(e,t){return t.findIndex(s=>s===e)!==-1}async sessionHasWorkflowRight(e){try{const t=await this.session.getUser();return!!t&&this.hasWorkflowRight(e,t.authorizedActions.map(s=>s.name))}catch(t){return console.error(`Unexpected error ${t} in sessionHasWorkflowRight()`),!1}}async sessionHasWorkflowRights(e){const t={};try{const s=await this.session.getUser();for(const r of e)t[r]=!!s&&this.hasWorkflowRight(r,s.authorizedActions.map(i=>i.name))}catch(s){console.error(`Unexpected error ${s} in sessionHasWorkflowRights()`);for(const r of e)t[r]=!1}return t}}class SessionService{constructor(e){this.context=e}get http(){return this.context.http()}get cache(){return this.context.cache()}get conf(){return this.context.conf()}onLogout(){this.cache.clearCache()}onRefreshSession(){this.cache.clearCache()}async getSession(){const e=await this.getUser(),[t,s,r,i,o]=await Promise.all([this.getCurrentLanguage(e),this.latestQuotaAndUsage(e),this.loadDescription(e),this.getUserProfile(),this.getBookmarks(e)]);return{user:e,quotaAndUsage:s,currentLanguage:t,userDescription:r,userProfile:i,bookmarkedApps:o}}login(e,t,s,r){const i=new FormData;return i.append("email",e),i.append("password",t),typeof s<"u"&&i.append("rememberMe",""+s),typeof r<"u"&&i.append("secureLocation",""+r),this.http.post("/auth/login",i,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(this.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}async logout(){const e=await this.conf.getLogoutCallback();return this.http.get("/auth/logout?callback="+e).finally(()=>{})}async latestQuotaAndUsage(e){const t={quota:0,storage:0};if(!e)return t;try{return await this.http.get(`/workspace/quota/user/${e==null?void 0:e.userId}`)}catch(s){return console.error(s),t}}async getCurrentLanguage(e){const t=(e==null?void 0:e.sessionMetadata)&&(e==null?void 0:e.sessionMetadata.userId);try{let s;return t?s=await this.loadUserLanguage():s=await this.loadDefaultLanguage(),s}catch(s){console.error(s)}}async loadUserLanguage(){try{const e=await this.http.get("/userbook/preference/language");return JSON.parse(e.preference)["default-domain"]}catch{return await this.loadDefaultLanguage()}}async loadDefaultLanguage(){return(await this.cache.httpGetJson("/locale")).locale}async getUser(){const{response:e,value:t}=await this.cache.httpGet("/auth/oauth2/userinfo");if(!(e.status<200||e.status>=300)&&typeof t=="object")return t;throw ERROR_CODE.NOT_LOGGED_IN}hasWorkflow({workflowName:e,user:t}){return e===void 0||(t==null?void 0:t.authorizedActions.findIndex(s=>s.name===e))!==-1}async loadDescription(e){if(!e)return{};try{const[t,s]=await Promise.all([this.getUserProfile({options:{requestName:"refreshAvatar"}}),this.http.get("/directory/userbook/"+(e==null?void 0:e.userId))]);return{...s,profiles:t}}catch(t){return console.error(t),{}}}async getBookmarks(e){if(!e)return[];const t=await this.http.get("/userbook/preference/apps");t.preference||(t.preference=null);const s=JSON.parse(t.preference);let r;r=s,r||(r={bookmarks:[],applications:[]});const i=[];return r.bookmarks.forEach((o,a)=>{const c=((e==null?void 0:e.apps)||[]).find(l=>l.name===o);if(c){const l=Object.assign({},c);i.push(l)}}),i}async getUserProfile(e={}){var c,l;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(i,t);return o.status<200||o.status>=300||typeof a=="string"?["Guest"]:((l=(c=a==null?void 0:a.result)==null?void 0:c[0])==null?void 0:l.type)||["Guest"]}async isAdml(){const e=await this.getUser();return(e==null?void 0:e.functions.ADMIN_LOCAL)!==void 0}async getWebApp(e){const t=await this.getUser();return t==null?void 0:t.apps.find(s=>{var r;return s!=null&&s.prefix?(s==null?void 0:s.prefix.replace("/",""))===e||!1:s!=null&&s.address&&((r=s.address)==null?void 0:r.split("/")[1])===e||!1})}}const bundle={},promises={},defaultDiacriticsRemovalMap=[{base:"A",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},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];class IdiomService{constructor(e){this.context=e}get http(){return this.context.http()}async getIdiom(e,t){await Promise.all([this.addBundlePromise(e,"/i18n"),this.addBundlePromise(e,`/${t}/i18n`)])}translate(e,t){e=e??"";let s=bundle[e]===void 0?e:bundle[e];if(t&&typeof t=="object")for(const r in t)typeof t[r]<"u"&&(s=s.replace(new RegExp("\\${"+r+"}","g"),""+t[r]));return s}addBundlePromise(e,t){return this.loadBundlePromise(e,t)}addBundle(e,t,s){this.loadBundle(e,t,s)}loadBundlePromise(e,t){return this.loadBundle(e,t),promises[t]}loadBundle(e,t,s){const r=promises[t];if(r)s&&r.then(s).catch(s);else{const i=new Promisified;promises[t]=i.promise;const o={};e&&(o["Accept-Language"]=e),this.http.get(t,{headers:o}).then(a=>{Object.assign(bundle,a),typeof s=="function"&&s(),i.resolve()}).catch(a=>{typeof s=="function"&&s(),i.reject()})}}addTranslations(e,t){notify.onLangReady().promise.then(s=>{this.loadBundle(s,e+"/"+s+".json",t)})}addAllTranslations(e){return e&&e.length>0?notify.onLangReady().promise.then(t=>Promise.all(e.map(s=>this.loadBundlePromise(t,s+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(const t in e)typeof bundle[t]!="string"&&(bundle[t]=e[t])}removeAccents(e){for(let t=0;t<defaultDiacriticsRemovalMap.length;t++)e=e.replace(defaultDiacriticsRemovalMap[t].letters,defaultDiacriticsRemovalMap[t].base);return e}}class StringUtils{static removeAccents(e){for(let t=0;t<defaultDiacriticsRemovalMap.length;t++)e=e.replace(defaultDiacriticsRemovalMap[t].letters,defaultDiacriticsRemovalMap[t].base);return e}}class ShareService{constructor(e){this.context=e}get directory(){return this.context.directory()}get http(){return this.context.http()}get cache(){return this.context.cache()}getSearchUrl(e,t,s,r){if(!r)return`/${e}/share/json/${t}?search=${s}`;if(r.includes("?search=")){const[i]=r.split("?search=");return`${i}?search=${s}`}else return r.includes("?")?`${r}&search=${s}`:`${r}?search=${s}`}async searchShareSubjects(e,t,s,r){const i=StringUtils.removeAccents(s).toLowerCase(),o=this.getSearchUrl(e,t,s,r),a=await this.cache.httpGetJson(o),c=a.users.visibles.filter(({username:h,firstName:y,lastName:d,login:g})=>{const A=StringUtils.removeAccents(d||"").toLowerCase(),f=StringUtils.removeAccents(y||"").toLowerCase(),w=StringUtils.removeAccents(h||"").toLowerCase(),F=StringUtils.removeAccents(g||"").toLowerCase();return w.includes(i)||f.includes(i)||A.includes(i)||F.includes(i)}).map(h=>({avatarUrl:this.directory.getAvatarUrl(h.id,"user"),directoryUrl:this.directory.getDirectoryUrl(h.id,"user"),displayName:h.username,id:h.id,profile:h.profile,type:"user"})),l=a.groups.visibles.filter(({name:h})=>StringUtils.removeAccents(h||"").toLowerCase().includes(i)).map(h=>({avatarUrl:this.directory.getAvatarUrl(h.id,"group"),directoryUrl:this.directory.getDirectoryUrl(h.id,"group"),displayName:h.name,id:h.id,type:"group",structureName:h.structureName}));return[...(await this.directory.getBookMarks()).filter(({displayName:h})=>StringUtils.removeAccents(h||"").toLowerCase().includes(i)).map(h=>({avatarUrl:"",directoryUrl:"",profile:"",displayName:h.displayName,id:h.id,type:"sharebookmark"})),...c,...l]}async getShareMapping(e,t){const s=await this.cache.httpGetJson(t||`/${e}/rights/sharing`);for(const r of Object.keys(s))if(r.includes(".")){const i=r.split(".")[1],o=s[r];delete s[r],s[i]=o}return s}getActionsAvailableFor({id:e,type:t},s,r){const o=(t==="user"?s.users.checked[e]:s.groups.checked[e])||[],a=Object.keys(r),c=[];for(const l of a)r[l].filter(h=>o.includes(h)).length>0&&c.push(l);return c}async getRightsForResource(e,t,s){const r=await this.directory.getBookMarks(),i=this.getSearchUrl(e,t,"",s==null?void 0:s.getResourceRights),o=await this.cache.httpGetJson(i),a=await this.getShareMapping(e,s==null?void 0:s.getShareMapping),c=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),l=Object.keys(o.users.checked).map(d=>o.users.visibles.find(A=>A.id===d)).filter(d=>d!==void 0).map(d=>{const g=this.getActionsAvailableFor({id:d.id,type:"user"},o,a);return{id:d.id,type:"user",displayName:d.username,profile:d.profile,avatarUrl:this.directory.getAvatarUrl(d.id,"user"),directoryUrl:this.directory.getDirectoryUrl(d.id,"user"),actions:g.map(f=>{const w=c[f];return{displayName:f,id:f,priority:w.priority}})}}).sort((d,g)=>(d.displayName||"").localeCompare(g.displayName)),p=Object.keys(o.groups.checked).map(d=>o.groups.visibles.find(A=>A.id===d)).filter(d=>d!==void 0).map(d=>{const g=this.getActionsAvailableFor({id:d.id,type:"group"},o,a);return{id:d.id,type:"group",displayName:d.name,profile:void 0,avatarUrl:this.directory.getAvatarUrl(d.id,"group"),directoryUrl:this.directory.getDirectoryUrl(d.id,"group"),actions:g.map(f=>{const w=c[f];return{displayName:f,id:f,priority:w.priority}})}}).sort((d,g)=>(d.displayName||"").localeCompare(g.displayName)),E=[...l,...p],h=o.groups.visibles.map(({groupDisplayName:d,id:g,name:A,labels:f})=>({labels:f,displayName:d||A,id:g})),y=o.users.visibles.map(({id:d,profile:g,username:A,firstName:f,lastName:w,login:F})=>({displayName:A,firstName:f,lastName:w,login:F,profile:g,id:d}));return{rights:E,visibleBookmarks:r,visibleGroups:h,visibleUsers:y}}async getPutSharePayload(e,t,s){const r={users:{},groups:{},bookmarks:{}},i=await this.getShareMapping(e,s);for(const o of t){const a=o.actions.map(l=>i[l.id]).reduce((l,p)=>Array.isArray(p)?[...l,...p]:l,[]),c=[...new Set(a)];c.length>0&&(o.type==="user"?r.users[o.id]=c:o.type==="group"?r.groups[o.id]=c:r.bookmarks[o.id]=c)}return r}async saveRights(e,t,s,r){const i=await this.getPutSharePayload(e,s,r==null?void 0:r.getShareMapping),o=(r==null?void 0:r.saveResourceRights)||`/${e}/share/resource/${t}`,a=this.getSearchUrl(e,t,"",r==null?void 0:r.getResourceRights);return this.cache.clearCache(a),await this.http.putJson(o,i)}async getActionsForApp(e,t){const s=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),r=await this.getShareMapping(e,t);return Object.keys(s).map(o=>{const a=s[o];return{displayName:o,id:o,priority:a.priority,requires:a.requires}}).filter(o=>{var a;return((a=r[o.id])==null?void 0:a.length)>0}).sort((o,a)=>o.priority-a.priority)}}const defaultMappers={csv:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isCsvLike(u,e)},doc:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isWordLike(u,e)?!0:u.indexOf("document")!==-1&&u.indexOf("wordprocessing")!==-1},xls:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isExcelLike(u,e)?!0:u.indexOf("document")!==-1&&u.indexOf("spreadsheet")!==-1||u.indexOf("ms-excel")!==-1},img:function({type:u}){return u.indexOf("image")!==-1},pdf:function({type:u}){return u.indexOf("pdf")!==-1||u==="application/x-download"},ppt:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isPowerpointLike(u,e)?!0:u.indexOf("document")!==-1&&u.indexOf("presentation")!==-1||u.indexOf("powerpoint")!==-1},txt:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isTxtLike(u,e)},md:function({type:u,extension:e}){return utilities.MimeTypeUtils.INSTANCE.isMdLike(u,e)},video:function({type:u}){return u.indexOf("video")!==-1},audio:function({type:u}){return u.indexOf("audio")!==-1},zip:function({type:u}){return u.indexOf("zip")!==-1||u.indexOf("rar")!==-1||u.indexOf("tar")!==-1||u.indexOf("7z")!==-1}},D=class D{static getRole(e){var t,s;return D.role((t=e.metadata)==null?void 0:t["content-type"],!1,(s=e.metadata)==null?void 0:s.extension)}static role(e,t=!1,s){if(s&&(s=s.trim()),!e)return"unknown";this.roleMappers||console.warn("[DocumentHelper.role] should not have empty roles",this);const r={type:e,previewRole:t,extension:s};for(const i of this.roleMappers){const o=i(r);if(o)return o}return"unknown"}};n(D,"roleMappers",[e=>Object.keys(defaultMappers).find(s=>defaultMappers[s](e))]);let DocumentHelper=D;class WorkspaceService{constructor(e){this.context=e}get http(){return this.context.http()}extractMetadata(e){const t=e.name||"",s=t.split("."),r=e.type||"application/octet-stream",i=s.length>1?s[s.length-1]:"",o={"content-type":r,filename:t,size:e.size,extension:i,role:DocumentHelper.role(r,!1,i)},a=t.replace("."+o.extension,""),c=o.extension?a+"."+o.extension:a;return{basename:a,fullname:c,metadata:o}}async saveFile(e,t){const{fullname:s,metadata:r}=this.extractMetadata(e),i=new FormData;i.append("file",e,s);const o=[];((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}`);const a=await this.http.postFile(`/workspace/document?${o.join("&")}`,i);if(this.http.isResponseError())throw this.http.latestResponse.statusText;return a}async updateFile(e,t,s){const{fullname:r,metadata:i}=this.extractMetadata(t),o=new FormData;o.append("file",t,r);const a=[];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}`);const c=await this.http.putFile(`/workspace/document/${e}?${a.join("&")}`,o);if(this.http.isResponseError())throw this.http.latestResponse.statusText;return c}async deleteFile(e){const t=e.map(s=>s._id);if(t.length==0)Promise.resolve(null);else if(await this.http.deleteJson("/workspace/documents",{ids:t}),this.http.isResponseError())throw this.http.latestResponse.statusText}async acceptDocuments(e){const t=await this.context.session().getUser();return s=>s.deleted&&s.trasher?(t==null?void 0:t.userId)==s.trasher:!0}async searchDocuments(e){const t=e.filter!=="external"||e.parentId?await this.http.get("/workspace/documents",{queryParams:{...e,_:new Date().getTime()}}):[],s=await this.acceptDocuments(e);return t.filter(s)}async listDocuments(e,t){return this.searchDocuments({filter:e,parentId:t,includeall:!0})}async transferDocuments(e,t,s="protected"){const r=[];if(e.forEach(i=>{(s==="public"&&!i.public||!i.public&&!i.protected)&&r.push(i)}),r.length>0){const i=await this.http.post("/workspace/documents/transfer",{application:t,visibility:s,ids:r.map(o=>o._id)});if(this.http.isResponseError())throw this.http.latestResponse.statusText;return r.forEach((o,a)=>{const c=e.findIndex(l=>l._id===o._id);0<=c&&c<e.length&&(e[c]=i[a])}),e.filter(o=>!!o)}return e}getThumbnailUrl(e,t=0,s=0){var i,o;const r=t>0||s>0?`${t}x${s}`:"120x120";if(typeof e=="string")return e.includes("data:image")||e.includes("thumbnail")?e:`${e}${e.includes("?")?"&":"?"}thumbnail=${r}`;{const a=`/workspace/${e.public?"pub/":""}document/${e._id}?thumbnail=`,c=e.thumbnails;if((o=(i=e.metadata)==null?void 0:i["content-type"])!=null&&o.includes("video")){const l=c&&Object.keys(c).length>0?Object.keys(c)[0]:null;return l?a+l:null}else return a+r}}listFolder(e,t=!1,s,r){const i={filter:e,hierarchical:t,parentId:s,directShared:r};return this.http.get("/workspace/folders/list",{queryParams:i})}listOwnerFolders(e,t){return this.listFolder("owner",e,t)}listSharedFolders(e,t){return this.listFolder("shared",e,t,!0)}createFolder(e,t){const s=new FormData;return s.append("name",e),t&&s.append("parentFolderId",t),this.http.postFile("/workspace/folder",s)}}let ATTag;class AnalyticsService{constructor(u){this.context=u}get http(){return this.context.http()}get session(){return this.context.session()}async trackPageLoad(u,e){const[t]=await Promise.all([this.getXitiConfig(e.name.toLowerCase()),this.loadXitiScript()]);if(!t||!ATInternet)return;let s=t.LIBELLE_SERVICE.default||null;for(const r in t.LIBELLE_SERVICE)if(r!=="default"&&u.indexOf(r)>=0){s=t.LIBELLE_SERVICE[r];break}ATTag=new ATInternet.Tracker.Tag({site:t.STRUCT_ID}),ATTag.setProps({SERVICE:s,TYPE:t.TYPE,OUTIL:t.OUTIL,UAI:t.STRUCT_UAI,PROJET:t.PROJET,EXPLOITANT:t.EXPLOITANT,PLATEFORME:t.PLATFORME,PROFIL:t.PROFILE},!0),ATTag.identifiedVisitor.set({id:t.ID_PERSO,category:t.PROFILE}),ATTag.page.set({name:(e==null?void 0:e.prefix)==="userbook"?"directory":e==null?void 0:e.prefix,chapter1:"",chapter2:"",chapter3:"",level2:t.STRUCT_UAI}),ATTag.dispatch()}async getXitiConfig(u){const[e,t]=await Promise.all([this.http.get("/analyticsConf"),this.http.get("/xiti/config")]);if(!(e!=null&&e.type))throw ERROR_CODE.MALFORMED_DATA;return t!=null&&t.active&&(e.xiti=await this.getXitiTrackingParams(t,u)),e.xiti}async loadXitiScript(){if(typeof ATInternet>"u"){const scriptPath="/xiti/public/js/lib/smarttag_ENT.js",response=await this.http.get(scriptPath,{headers:{Accept:"application/javascript"}});if(this.http.latestResponse.status!=200)throw"Error while loading XiTi script";eval(response)}}async getXitiTrackingParams(u,e){if(!u.structureMap||!e)return;const t=await this.session.getUser(),s=await this.session.getUserProfile();let r;if(!(t!=null&&t.structures))return;for(const l of t.structures){const p=u.structureMap[l];if(p&&p.collectiviteId&&p.UAI){r=p;break}}if(!r||!r.active)return;const i=await configure.Platform.apps.getPublicConf(e);if(!i)return;const o=i.xiti;if(!o||!o.LIBELLE_SERVICE||!r.UAI)return;function a(l){let p="";for(let E=0;E<l.length;E++)p+=l.charCodeAt(E);return p}const c={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:o.LIBELLE_SERVICE,TYPE:o.OUTIL?"TIERS":"NATIF",OUTIL:o.OUTIL?o.OUTIL:"",STRUCT_ID:r.collectiviteId,STRUCT_UAI:r.UAI,PROJET:r.projetId?r.projetId:u.ID_PROJET,EXPLOITANT:u.ID_EXPLOITANT,PLATFORME:r.plateformeId?r.plateformeId:u.ID_PLATEFORME,ID_PERSO:a(t.userId),PROFILE:s&&s.length>0?c[s[0]]??"":""}}}const C=class C{constructor(e){this.context=e}get http(){return this.context.http()}get conf(){return this.context.conf()}async getVideoConf(){var t;const e=await this.conf.getPublicConf(APP$4.VIDEO);return{maxWeight:(e==null?void 0:e["max-videosize-mbytes"])??C.MAX_WEIGHT,maxDuration:(e==null?void 0:e["max-videoduration-minutes"])??C.MAX_DURATION,acceptVideoUploadExtensions:((t=e==null?void 0:e["accept-videoupload-extensions"])==null?void 0:t.map(s=>s.toUpperCase()))??[]}}async upload({data:e,appCode:t,captation:s,duration:r}){if(!e.file)throw new Error("Invalid video file.");if(!e.filename)throw new Error("Invalid video filename");const i=`${e.browser.name} ${e.browser.version}`,o=new FormData;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);let a=`/video/encode?captation=${s}`;r&&(a+=`&duration=${r}`);const c=await this.http.post(a,o,{headers:{"Content-Type":"multipart/form-data"}});if(c.state=="running"){let l=0,p=1;do{const E=p+l;await new Promise(y=>setTimeout(y,E*1e3)),l=p,p=Math.min(8,E);const h=await this.http.get(`/video/status/${c.processid}`);if(h.state=="succeed")return h.videoworkspaceid&&h.videosize&&this.context.data().trackVideoSave(h.videoworkspaceid,Math.round(r),h.videosize,s,e.url,i,e.device),h;if(h.state=="error")break}while(!0)}throw new Error("Video cannot be uploaded.")}};n(C,"MAX_WEIGHT",50),n(C,"MAX_DURATION",3);let VideoService=C;class EmbedderService{constructor(e){this.context=e}get http(){return this.context.http()}async getDefault(){return this.http.get("/infra/embed/default")}async getCustom(){return this.http.get("/infra/embed/custom")}getProviderFromUrl(e,t){for(const s of e)if(this.isUrlFromProvider(t,s))return s}urlIsFromPattern(e,t){const s=new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)","g"),r=new RegExp("{[^}]*}","g");let i=!0;const o=t.match(s)||[],a=[];return(t.match(r)||[]).forEach((l,p)=>{l.includes("ignore")||a.push(o[p])}),a.forEach(l=>{if(!e.includes(l)){i=!1;return}}),i}isUrlFromProvider(e,t){typeof t.url=="string"&&(t.url=[t.url]);for(const s of t.url)if(this.urlIsFromPattern(e,s))return!0;return!1}getEmbedCodeForProvider(e,t){for(const s of e.url)if(this.urlIsFromPattern(t,s)){const r=new RegExp("{[a-zA-Z0-9_.]+}","g"),i=s.match(r)||[];let o=e.embed;for(const a of i){let c=s.split(a)[0];const l=c.split("}");l.length>1&&(c=l[l.length-1]);let p=t.split(c)[1];if(!p)continue;const E=s.split(a)[1].split("{")[0];E&&(p=p.split(E)[0]);const h=new RegExp("\\"+a.replace(/}/,"\\}"),"g");o=o.replace(h,p)}return o}return""}}class AbstractBehaviourService{constructor(e){n(this,"_cache");this.context=e,this._cache=new CacheService(this.context)}getApplication(){return this.APP}getResourceType(){return this.RESOURCE}httpGet(e,t){return this._cache.httpGetJson(e,t)}dataToResource({modified:e,...t}){const s=typeof e=="string"?e:e!=null&&e.$date?""+e.$date:"";return{application:this.RESOURCE,name:t.title,creatorId:t.owner,creatorName:t.ownerName,thumbnail:t.icon,assetId:t._id,modifiedAt:s,shared:t.shared,path:t.path}}}class ActualitesBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","actualites");n(this,"RESOURCE","actualites")}async loadResources(){return(await this.httpGet("/actualites/linker/infos")).map(s=>{let r;return s.thread_icon?r=s.thread_icon+"?thumbnail=48x48":r="/img/icons/glyphicons_036_file.png",this.dataToResource({title:s.title+" ["+s.thread_title+"]",ownerName:s.username,owner:s.owner,icon:r,path:"/actualites#/view/thread/"+s.thread_id+"/info/"+s._id,_id:`${s.thread_id}#${s._id}`,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified})})}}class BlogBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","blog");n(this,"RESOURCE","blog")}loadResources(){return new Promise(async(t,s)=>{try{const r=await this.httpGet("/blog/linker"),i=[];r.forEach(o=>{o.thumbnail?o.thumbnail=o.thumbnail+"?thumbnail=48x48":o.thumbnail="/img/illustrations/blog.svg";const a=o.fetchPosts.map(c=>this.dataToResource({owner:o.author.userId,ownerName:o.author.username,title:c.title+" ["+o.title+"]",_id:`${o._id}#${c._id}`,icon:o.thumbnail,path:`/blog/id/${o._id}/post/${c._id}`,shared:!!(o.shared&&o.shared.length>=0),modified:o.modified}));i.push(...a)}),t(i)}catch(r){s(r)}})}}class CollaborativewallBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","collaborativewall");n(this,"RESOURCE","collaborativewall")}async loadResources(){return(await this.httpGet("/collaborativewall/list/all")).map(s=>this.dataToResource({title:s.name,ownerName:s.owner.displayName,owner:s.owner.userId,icon:s.icon?s.icon:"/img/illustrations/collaborative-wall-default.png",path:"/collaborativewall#/view/"+s._id,_id:s._id,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified}))}}class CommunityBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","community");n(this,"RESOURCE","community")}async loadResources(){return(await this.httpGet("/community/listallpages")).map(s=>{let r;return typeof s.thumbnail>"u"||s.thumbnail===""?r="/img/icons/glyphicons_036_file.png":r=s.thumbnail+"?thumbnail=48x48",this.dataToResource({title:s.name,icon:r,path:"/community#/view/"+s.id,_id:s.id,owner:"",ownerName:"",shared:!!(s.shared&&s.shared.length>=0),modified:s.name})})}}class ExercizerBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","exercizer");n(this,"RESOURCE","exercizer")}async loadResources(){return(await this.httpGet("/exercizer/subjects-scheduled")).map(s=>{const r=s.picture?s.picture+"?thumbnail=48x48":"/img/illustrations/exercizer.svg";let i,o=!1;const a=JSON.parse(s.scheduled_at);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({title:s.title,owner:s.owner,ownerName:i,icon:r,path:"/exercizer#/linker/"+s.id,_id:""+s.id,shared:o,modified:s.modified})})}}class FormulaireBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","formulaire");n(this,"RESOURCE","formulaire")}async loadResources(){return(await this.httpGet("/formulaire/forms/linker")).map(s=>(s.picture||(s.picture="/formulaire/public/img/logo.svg"),this.dataToResource({_id:""+s.id,icon:s.picture,title:s.title,ownerName:s.owner_name,owner:s.owner_id,path:s.is_public?`${window.location.origin}/formulaire-public#/form/${s.public_key}`:`${window.location.origin}/formulaire#/form/${s.id}/${s.rgpd?"rgpd":"new"}`,shared:!!(s.shared&&s.shared.length>=0),modified:""+s.date_modification})))}}class ForumBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","forum");n(this,"RESOURCE","forum")}async loadResources(){return(await this.httpGet("/forum/categories")).map(s=>this.dataToResource({_id:s._id,title:s.name,icon:s.icon||"/img/illustrations/forum.svg",path:"/forum#/view/"+s._id,ownerName:s.owner.displayName,owner:s.owner.userId,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified}))}}class HomeworksBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","homeworks");n(this,"RESOURCE","homeworks")}async loadResources(){return(await this.httpGet("/homeworks/list")).filter(t=>t.owner&&t.trashed===0).map(t=>this.dataToResource({title:t.title,ownerName:t.owner.displayName,owner:t.owner.userId,icon:t.thumbnail||"/img/illustrations/homeworks.svg",path:"/homeworks#/view-homeworks/"+t._id,_id:""+t._id,shared:typeof t.shared<"u",modified:t.modified}))}}class MagnetoBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","magneto");n(this,"RESOURCE","magneto")}async loadResources(){const{all:t}=await this.httpGet("/magneto/boards/editable");return t.map(s=>this.dataToResource({_id:s._id,title:s.title,icon:s.imageUrl,owner:s.ownerId,ownerName:s.ownerName,path:`/magneto#/board/${s._id}/view`,shared:!!(s.shared&&s.shared.length>=0),modified:""+s.modificationDate}))}}class MindmapBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","mindmap");n(this,"RESOURCE","mindmap")}async loadResources(){return(await this.httpGet("/mindmap/list/all")).map(s=>this.dataToResource({title:s.name,ownerName:s.owner.displayName,owner:s.owner.userId,icon:s.thumbnail||"/img/illustrations/mindmap-default.png",path:"/mindmap#/view/"+s._id,_id:s._id,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified}))}}class PagesBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","pages");n(this,"RESOURCE","pages")}async loadResources(){const t=await this.httpGet("/pages/list/all"),s=[];return t.forEach(r=>{var o;const i=r.thumbnail?r.thumbnail+"?thumbnail=48x48":"/img/illustrations/pages.svg";s.push(this.dataToResource({title:r.title,owner:r.owner.userId,ownerName:r.owner.displayName,icon:i,path:"/pages#/website/"+r._id,_id:r._id,shared:typeof r.shared<"u",modified:r.modified})),(o=r.pages)==null||o.forEach(a=>{s.push(this.dataToResource({title:a.title,owner:r.owner.userId,ownerName:r.owner.displayName,icon:i,path:"/pages#/website/"+r._id+"/"+a.titleLink,_id:r._id+"/"+a.titleLink,shared:typeof r.shared<"u",modified:r.modified}))})}),s}}class PollBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","poll");n(this,"RESOURCE","poll")}async loadResources(){return(await this.httpGet("/poll/list/all")).map(s=>{const r=s.icon?s.icon+"?thumbnail=48x48":"/img/icons/glyphicons_036_file.png";return this.dataToResource({title:s.question,ownerName:s.owner.displayName,icon:r,path:"/poll#/view/"+s._id,_id:s._id,owner:s.owner.userId,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified})})}}class ScrapbookBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","scrapbook");n(this,"RESOURCE","scrapbook")}async loadResources(){return(await this.httpGet("/scrapbook/list/all")).map(s=>{const r=s.icon||"/img/illustrations/scrapbook.svg";return this.dataToResource({title:s.name,owner:s.owner.userId,ownerName:s.owner.displayName,icon:r,path:"/scrapbook#/view-scrapbook/"+s._id,_id:s._id,shared:!!(s.shared&&s.shared.length>=0),modified:s.modified})})}}class TimelinegeneratorBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","timelinegenerator");n(this,"RESOURCE","timelinegenerator")}loadResources(){return new Promise(async(t,s)=>{try{const i=(await this.httpGet("/timelinegenerator/timelines")).map(o=>{const a=o.icon||"/img/illustrations/timeline-default.png";return this.dataToResource({title:o.headline,ownerName:o.owner.displayName,owner:o.owner.userId,icon:a,path:"/timelinegenerator#/view/"+o._id,_id:o._id,shared:typeof o.shared<"u",modified:o.modified})});t(i)}catch(r){s(r)}})}}class WikiBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","wiki");n(this,"RESOURCE","wiki")}async loadResources(){return(await this.httpGet("/wiki/listallpages?visible=true")).map(s=>s.pages.map(r=>{let i;return typeof s.thumbnail>"u"||s.thumbnail===""?i="/img/icons/glyphicons_036_file.png":i=s.thumbnail+"?thumbnail=48x48",this.dataToResource({title:r.title+" ["+s.title+"]",ownerName:s.owner.displayName,owner:s.owner.userId,icon:i,path:"/wiki#/view/"+s._id+"/"+r._id,_id:`${s._id}#${r._id}`,shared:typeof s.shared<"u",modified:r.modified})})).flat()}}class WorkspaceBehaviour extends AbstractBehaviourService{constructor(){super(...arguments);n(this,"APP","workspace");n(this,"RESOURCE","workspace")}loadResources({search:t,asset_id:s}){return new Promise(async(r,i)=>{try{let o="/workspace/documents?filter=all&hierarchical=true";s&&s.length?o+=`&search=${t}`:t&&t.length&&(o+=`&search=${t}`);const c=(await this.httpGet(o)).filter(l=>!l.deleted).map(l=>{const p=l.metadata["content-type"]&&l.metadata["content-type"].indexOf("image")!==-1?`/workspace/document/${l._id}?thumbnail=120x120`:"/img/icons/unknown-large.png";return this.dataToResource({title:l.name,ownerName:l.ownerName,owner:l.owner,icon:p,path:`/workspace/document/${l._id}`,_id:l._id,shared:!!(l.shared&&l.shared.length>=0),modified:l.modified})});r(c)}catch(o){i(o)}})}}const b=class b{static async initialize(e,t){const s=e.http();if(!this.resourceProducingApps.length){this.resourceProducingApps=[t,"workspace"];try{const[r,i]=await Promise.all([s.get("/resources-applications"),e.session().getUser()]);i!=null&&i.apps&&(r!=null&&r.length)&&(this.resourceProducingApps=r.filter(o=>i.apps.some(a=>a.address.includes(o))))}catch(r){console.warn("Failed to load resource-producing apps:",r)}}return this.resourceProducingApps}static registerCustomBehaviour(e,t,s){this.registry.register({application:e,resourceType:t},s)}static async registerBehaviours(e){this.resourceProducingApps.forEach(t=>{const s={application:e,resourceType:t};this.registry.register(s,r=>this.serviceFor(r,e,t))})}static serviceFor(e,t,s){let r;switch(s){case"timelinegenerator":r=new TimelinegeneratorBehaviour(e);break;case"workspace":r=new WorkspaceBehaviour(e);break;case"blog":r=new BlogBehaviour(e);break;case"actualites":r=new ActualitesBehaviour(e);break;case"wiki":r=new WikiBehaviour(e);break;case"pages":r=new PagesBehaviour(e);break;case"poll":r=new PollBehaviour(e);break;case"community":r=new CommunityBehaviour(e);break;case"mindmap":r=new MindmapBehaviour(e);break;case"forum":r=new ForumBehaviour(e);break;case"homeworks":r=new HomeworksBehaviour(e);break;case"scrapbook":r=new ScrapbookBehaviour(e);break;case"collaborativewall":r=new CollaborativewallBehaviour(e);break;case"exercizer":r=new ExercizerBehaviour(e);break;case"formulaire":r=new FormulaireBehaviour(e);break;case"magneto":r=new MagnetoBehaviour(e);break;default:throw ERROR_CODE.NOT_SUPPORTED}return r.APP=t,r}};n(b,"registry",new ServiceRegistry),n(b,"findBehaviour",b.registry.findService.bind(b.registry)),n(b,"hasBehaviour",b.registry.isRegistered.bind(b.registry)),n(b,"resourceProducingApps",[]);let SnipletsService=b;const SEND_ALL="*";class WebBroker{constructor(e){n(this,"subscription");this.odeServices=e}get http(){return this.odeServices.http()}get events(){return this.odeServices.notify().events()}dispatchEvent(e,t){t.findIndex(r=>SEND_ALL===r||e.data["event-type"]===r)>=0&&this.http.post("/infra/event/web/store",e.data,{disableNotifications:!0})}initialize(e){if(e===void 0||e.send===void 0||e.send.length>0){const t=(e==null?void 0:e.send)??[SEND_ALL];this.subscription=this.events.subscribe(LAYER_NAME.WEB_DATA,s=>this.dispatchEvent(s,t))}return this}destroy(){this.subscription&&(this.subscription.revoke(),delete this.subscription)}}class DataService{constructor(e){n(this,"_webBroker");n(this,"app");n(this,"user");n(this,"profile");this.odeServices=e}get conf(){return this.odeServices.conf()}get notify(){return this.odeServices.notify()}async initialize(){try{const{app:e}=await this.notify.onAppConfReady().promise;this.app=e,this.user=await this.odeServices.session().getUser(),this.profile=await this.odeServices.session().getUserProfile();const{["data-service"]:t}=await this.conf.getPublicConf(e);this._webBroker=new WebBroker(this.odeServices).initialize(t==null?void 0:t.web)}catch{console.log("DataService not initialized, usage data unavailable.")}}predestroy(){this._webBroker&&(this._webBroker.destroy(),delete this._webBroker)}trackWebEvent(e){this.notify.events().publish(LAYER_NAME.WEB_DATA,{name:EVENT_NAME.DATA_TRACKED,data:e})}addUserInfos(e){return this.user&&(e.userId=this.user.userId,e.structure=this.user.structureNames[0]),this.profile&&(e.profil=this.profile[0]),e}trackVideoSave(e,t,s,r,i,o,a){const c=this.addUserInfos({"event-type":"VIDEO_SAVE",module:this.app||"video",video_id:e,browser:o,duration:Math.round(t),weight:s,source:r?"CAPTURED":"UPLOADED",url:i});a&&(c.device_type=a),this.trackWebEvent(c)}trackVideoRead(e,t,s,r,i){const o=this.addUserInfos({"event-type":"VIDEO_READ",module:"video",video_id:e,browser:r,source:t?"CAPTURED":"UPLOADED",url:s});this.app&&(o["override-module"]=this.app),i&&(o.device_type=i),this.trackWebEvent(o)}trackSpeechAndText(e){const t=this.addUserInfos({"event-type":"SPEECH_AND_TEXT",function:e});this.app&&(t.module=this.app),this.trackWebEvent(t)}trackAccessLibraryFromExplorer(){const e=this.addUserInfos({"event-type":"ACCESS_LIBRARY_FROM_EXPLORER"});this.app&&(e.module=this.app),this.trackWebEvent(e)}}class ReactionsService{constructor(e,t,s){this.context=e,this.module=t,this.resourceType=s}get http(){return this.context.http()}async loadAvailableReactions(){try{const{"reaction-types":e}=await this.context.conf().getPublicConf("audience");return Array.isArray(e)?e:void 0}catch{console.error("Audience configuration not found");return}}async loadReactionSummaries(e){const t=await this.http.get(`/audience/reactions/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`);return this.http.isResponseError()?{}:t.reactionsByResource}async loadReactionDetails(e,t,s){const r=await this.http.get(`/audience/reactions/${this.module}/${this.resourceType}/${e}?page=${t}&size=${s}`);return this.http.isResponseError()?void 0:r}async deleteReaction(e){await this.http.delete(`/audience/reactions/${this.module}/${this.resourceType}/${e}`)}async updateReaction(e,t){await this.http.putJson(`/audience/reactions/${this.module}/${this.resourceType}`,{resourceId:e,reactionType:t})}async createReaction(e,t){await this.http.postJson(`/audience/reactions/${this.module}/${this.resourceType}`,{resourceId:e,reactionType:t})}}class ViewsService{constructor(e,t,s){this.context=e,this.module=t,this.resourceType=s}get http(){return this.context.http()}async getCounters(e){const t=await this.http.get(`/audience/views/count/${this.module}/${this.resourceType}?resourceIds=${e.join(",")}`);return this.http.isResponseError()?{}:t}async getDetails(e){const t=await this.http.get(`/audience/views/details/${this.module}/${this.resourceType}/${e}`);return this.http.isResponseError()?void 0:t}trigger(e){return this.http.post(`/audience/views/${this.module}/${this.resourceType}/${e}`)}}class AudienceService{constructor(e,t,s){this.context=e,this.module=t,this.resourceType=s}get views(){return new ViewsService(this.context,this.module,this.resourceType)}get reactions(){return new ReactionsService(this.context,this.module,this.resourceType)}}class OdeServices{constructor(){n(this,"_analytics");n(this,"_cache");n(this,"_conf");n(this,"_data");n(this,"_directory");n(this,"_http");n(this,"_idiom");n(this,"_notify");n(this,"_rights");n(this,"_session");n(this,"_share");n(this,"_video");n(this,"_workspace");n(this,"_embedder");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)}initialize(){return this._data.initialize(),this}analytics(){return this._analytics}audience(e,t){return new AudienceService(this,e,t)}cache(){return this._cache}conf(){return this._conf}data(){return this._data}directory(){return this._directory}http(){return this._http}idiom(){return this._idiom}notify(){return this._notify}resource(e,t){return t?ResourceService.findService({application:e,resourceType:t},this):ResourceService.findMainService({application:e},this)}behaviour(e,t){return SnipletsService.findBehaviour({application:e,resourceType:t},this)}rights(){return this._rights}session(){return this._session}share(){return this._share}video(){return this._video}workspace(){return this._workspace}embedder(){return this._embedder}}const ACTION={SEARCH:"search",CREATE:"create",CREATE_PUBLIC:"createPublic",OPEN:"open",EDIT:"edit",MANAGE:"manage",UPD_PROPS:"properties",COMMENT:"comment",DELETE:"delete",TRASH:"trash",RESTORE:"restore",MOVE:"move",COPY:"copy",EXPORT:"export",SHARE:"share",PRINT:"print",PAGES_LIST:"pages_list",DISTRIBUTE:"distribute",REGISTER:"register",PUBLISH:"publish",PUBLISH_MOODLE:"publish_moodle"},FOLDER={BIN:"bin",DEFAULT:"default"},BOOLEAN_FILTER={OWNER:"owner",SHARED:"shared",PUBLIC:"public",FAVORITE:"favorite"},SORT_ORDER={ASC:"asc",DESC:"desc"},SORT_BY={NAME:"name",MODIFY_DATE:"updatedAt",CREATED_AT:"createdAt",APPLICATION:"application",RESOURCE_TYPE:"resourceType"},odeServices=new OdeServices().initialize();class SessionFrameworkFactory{static instance(){return session}}const WIDGET_POSITION={LEFT:"left",RIGHT:"right"};class TransportFrameworkFactory{static instance(){return transport}}const isActionAvailable=(u,e)=>{const t=e==null?void 0:e.filter(s=>s.id===u&&s.available);return t&&t.length>0},firstLevelWidgets=["birthday","mood","calendar-widget","notes"],secondLevelWidgets=["agenda-widget","carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"],defaultWidgetPosition={"last-infos-widget":WIDGET_POSITION.LEFT,birthday:WIDGET_POSITION.LEFT,"calendar-widget":WIDGET_POSITION.RIGHT,"carnet-de-bord":WIDGET_POSITION.LEFT,"record-me":WIDGET_POSITION.RIGHT,mood:WIDGET_POSITION.LEFT,"my-apps":WIDGET_POSITION.RIGHT,notes:WIDGET_POSITION.RIGHT,"rss-widget":WIDGET_POSITION.LEFT,"bookmark-widget":WIDGET_POSITION.RIGHT,qwant:WIDGET_POSITION.RIGHT,"qwant-junior":WIDGET_POSITION.LEFT,"agenda-widget":WIDGET_POSITION.LEFT,"cursus-widget":WIDGET_POSITION.LEFT,"maxicours-widget":WIDGET_POSITION.RIGHT,"universalis-widget":WIDGET_POSITION.RIGHT,"briefme-widget":WIDGET_POSITION.LEFT,"school-widget":WIDGET_POSITION.LEFT},defaultWidgetOrder={"school-widget":0,"my-apps":10,"record-me":15,"last-infos-widget":20,qwant:30,"qwant-junior":30,"universalis-widget":35,"agenda-widget":40,"bookmark-widget":50,"carnet-de-bord":60,"maxicours-widget":70,"cursus-widget":80,"briefme-widget":90,"rss-widget":100,mood:110,birthday:120,"calendar-widget":130,notes:140};class WidgetFramework{constructor(){n(this,"_initialized");n(this,"_widgets",[]);n(this,"_userPrefs",{})}initialize(e,t){return this._initialized||(this._initialized=new Promisified,notify.onSessionReady().promise.then(s=>{var r;s&&s.widgets?(s.widgets.forEach(i=>{this._widgets.push(new Widget(i))}),this.loadUserPrefs().then(()=>{var i;(i=this._initialized)==null||i.resolve()}).catch(i=>{var o;(o=this._initialized)==null||o.reject()})):(r=this._initialized)==null||r.reject()})),this._initialized.promise}get list(){return this._widgets}lookup(e){return this._widgets.find(t=>t.platformConf.name===e)}lookupDefaultPosition(e){return defaultWidgetPosition[e]}get userPrefs(){return this._userPrefs}async loadUserPrefs(){await configure.User.preferences.load("widgets",{}).then(e=>this.applyUserPrefs(e))}saveUserPrefs(){return configure.User.preferences.update("widgets",this._userPrefs).save("widgets").then(()=>{notify.events().publish(LAYER_NAME.WIDGETS,{name:EVENT_NAME.USERPREF_CHANGED})})}async applyUserPrefs(e){this._userPrefs=e??this._userPrefs;const t=configure.Platform.theme,s=[];t.listSkins().then(r=>{var a;const i=((a=r.find(c=>c.child===t.skin))==null?void 0:a.parent)==="panda"?secondLevelWidgets:firstLevelWidgets;this._widgets=this._widgets.filter((c,l)=>{const p=c.platformConf.name;return i.indexOf(p)!==-1?!1:(this._userPrefs[p]||(this._userPrefs[p]={index:defaultWidgetOrder[p]??999,show:!0,position:c.platformConf.position}),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)});const o=new Idiom;this._widgets=this._widgets.sort((c,l)=>{const p=o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(),E=o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();return p<E?-1:p>E?1:0})})}}class Widget{constructor(e){n(this,"_schoolConf",{});n(this,"_userPref");this._platformConf=e,this._userPref=null}get platformConf(){return this._platformConf}get schoolConf(){return this._schoolConf}get userPref(){return this._userPref}applyUserPref(e){this._userPref=e,this._userPref.position=this._userPref.position??widgets.lookupDefaultPosition(this._platformConf.name)??"left"}}const widgets=new WidgetFramework;class LastInfosWidget{loadInfos(e){return transport.http.get("/actualites/infos/last/"+e)}getMaxResults(){return transport.http.get("/userbook/preference/maxInfos").then(e=>e.preference?parseInt(e.preference):4)}setMaxResults(e){return transport.http.putJson("/userbook/preference/maxInfos",`"${e}"`)}}const WIDGET_NAME={LAST_INFOS:"last-infos-widget",BIRTHDAY:"birthday",CALENDAR:"calendar-widget",CARNET:"carnet-de-bord",RECORD:"record-me",MOOD:"mood",MY_APPS:"my-apps",NOTES:"notes",RSS:"rss-widget",BOOKMARK:"bookmark-widget",QWANT:"qwant",QWANT_JUNIOR:"qwant-junior",AGENDA:"agenda-widget",CURSUS:"cursus-widget",MAXICOURS:"maxicours-widget",UNIVERSALIS:"universalis-widget",BRIEFME:"briefme-widget",SCHOOL:"school-widget"};class WidgetFrameworkFactory{static instance(){return widgets}}exports.ACTION=ACTION;exports.APP=APP$4;exports.BOOLEAN_FILTER=BOOLEAN_FILTER;exports.ConfigurationFrameworkFactory=ConfigurationFrameworkFactory;exports.DocumentHelper=DocumentHelper;exports.ERROR_CODE=ERROR_CODE;exports.EVENT_NAME=EVENT_NAME;exports.FOLDER=FOLDER;exports.ITimelineFactory=ITimelineFactory;exports.LAYER_NAME=LAYER_NAME;exports.LastInfosWidget=LastInfosWidget;exports.NotifyFrameworkFactory=NotifyFrameworkFactory;exports.ReactionTypes=ReactionTypes;exports.ResourceService=ResourceService;exports.SORT_BY=SORT_BY;exports.SORT_ORDER=SORT_ORDER;exports.SessionFrameworkFactory=SessionFrameworkFactory;exports.SnipletsService=SnipletsService;exports.StringUtils=StringUtils;exports.TransportFrameworkFactory=TransportFrameworkFactory;exports.USER_PREFS=USER_PREFS;exports.WIDGET_NAME=WIDGET_NAME;exports.WIDGET_POSITION=WIDGET_POSITION;exports.WidgetFrameworkFactory=WidgetFrameworkFactory;exports.isActionAvailable=isActionAvailable;exports.odeServices=odeServices;
|
package/dist/index.js
CHANGED
|
@@ -1081,9 +1081,9 @@ class Analytics {
|
|
|
1081
1081
|
const t = await notify.onSessionReady().promise, s = session.session.description;
|
|
1082
1082
|
let r;
|
|
1083
1083
|
for (const l of t.structures) {
|
|
1084
|
-
const
|
|
1085
|
-
if (
|
|
1086
|
-
r =
|
|
1084
|
+
const p = e.structureMap[l];
|
|
1085
|
+
if (p && p.collectiviteId && p.UAI) {
|
|
1086
|
+
r = p;
|
|
1087
1087
|
break;
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
@@ -1095,10 +1095,10 @@ class Analytics {
|
|
|
1095
1095
|
const o = i.xiti;
|
|
1096
1096
|
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
1097
1097
|
function a(l) {
|
|
1098
|
-
let
|
|
1099
|
-
for (let
|
|
1100
|
-
|
|
1101
|
-
return
|
|
1098
|
+
let p = "";
|
|
1099
|
+
for (let E = 0; E < l.length; E++)
|
|
1100
|
+
p += l.charCodeAt(E);
|
|
1101
|
+
return p;
|
|
1102
1102
|
}
|
|
1103
1103
|
const c = {
|
|
1104
1104
|
Student: "ELEVE",
|
|
@@ -1904,19 +1904,19 @@ class ConfService {
|
|
|
1904
1904
|
conf: t,
|
|
1905
1905
|
publicTheme: s
|
|
1906
1906
|
}) {
|
|
1907
|
-
var
|
|
1908
|
-
const r = await this.http.get("/theme"), i = (
|
|
1909
|
-
(
|
|
1907
|
+
var E;
|
|
1908
|
+
const r = await this.http.get("/theme"), i = (E = t == null ? void 0 : t.overriding) == null ? void 0 : E.find(
|
|
1909
|
+
(h) => (
|
|
1910
1910
|
// Fix #WB2-2660:
|
|
1911
1911
|
// If Public access => get the neo theme
|
|
1912
1912
|
// Else get the theme from the user preference
|
|
1913
|
-
s ?
|
|
1913
|
+
s ? h.parent === "theme-open-ent" && h.bootstrapVersion === "ode-bootstrap-neo" : h.child === (r == null ? void 0 : r.themeName)
|
|
1914
1914
|
)
|
|
1915
|
-
), 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],
|
|
1915
|
+
), 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], p = (i == null ? void 0 : i.parent) === "panda";
|
|
1916
1916
|
return {
|
|
1917
1917
|
basePath: `${this.cdnDomain}${a}../../`,
|
|
1918
1918
|
bootstrapVersion: l,
|
|
1919
|
-
is1d:
|
|
1919
|
+
is1d: p,
|
|
1920
1920
|
logoutCallback: (r == null ? void 0 : r.logoutCallback) || "",
|
|
1921
1921
|
skin: i == null ? void 0 : i.child,
|
|
1922
1922
|
skinName: o,
|
|
@@ -1991,27 +1991,27 @@ class DirectoryService {
|
|
|
1991
1991
|
users: r
|
|
1992
1992
|
}) {
|
|
1993
1993
|
this.cache.clearCache("/directory/sharebookmark/all");
|
|
1994
|
-
const i = r.map((
|
|
1995
|
-
if (typeof
|
|
1996
|
-
const { displayName:
|
|
1994
|
+
const i = r.map((h) => typeof h == "string" ? h : h.id), o = s.map((h) => typeof h == "string" ? h : h.id), a = t.map(async (h) => {
|
|
1995
|
+
if (typeof h == "string") {
|
|
1996
|
+
const { displayName: y, groups: d, id: g, users: A } = await this.getBookMarkById(h), f = A.map((_) => _.id), w = d.map((_) => _.id);
|
|
1997
1997
|
return {
|
|
1998
|
-
displayName:
|
|
1998
|
+
displayName: y,
|
|
1999
1999
|
id: g,
|
|
2000
|
-
members: [...
|
|
2000
|
+
members: [...w, ...f]
|
|
2001
2001
|
};
|
|
2002
2002
|
} else
|
|
2003
|
-
return Promise.resolve(
|
|
2004
|
-
}), l = (await Promise.all(a)).map((
|
|
2003
|
+
return Promise.resolve(h);
|
|
2004
|
+
}), l = (await Promise.all(a)).map((h) => h.members).reduce((h, y) => [...h, ...y], []), p = {
|
|
2005
2005
|
name: e,
|
|
2006
2006
|
members: [...i, ...o, ...l]
|
|
2007
|
-
}, { id:
|
|
2007
|
+
}, { id: E } = await this.http.postJson(
|
|
2008
2008
|
"/directory/sharebookmark",
|
|
2009
|
-
|
|
2009
|
+
p
|
|
2010
2010
|
);
|
|
2011
2011
|
return {
|
|
2012
|
-
id:
|
|
2012
|
+
id: E,
|
|
2013
2013
|
displayName: e,
|
|
2014
|
-
members:
|
|
2014
|
+
members: p.members
|
|
2015
2015
|
};
|
|
2016
2016
|
}
|
|
2017
2017
|
}
|
|
@@ -2893,43 +2893,54 @@ class ShareService {
|
|
|
2893
2893
|
get cache() {
|
|
2894
2894
|
return this.context.cache();
|
|
2895
2895
|
}
|
|
2896
|
+
getSearchUrl(e, t, s, r) {
|
|
2897
|
+
if (!r)
|
|
2898
|
+
return `/${e}/share/json/${t}?search=${s}`;
|
|
2899
|
+
if (r.includes("?search=")) {
|
|
2900
|
+
const [i] = r.split("?search=");
|
|
2901
|
+
return `${i}?search=${s}`;
|
|
2902
|
+
} else return r.includes("?") ? `${r}&search=${s}` : `${r}?search=${s}`;
|
|
2903
|
+
}
|
|
2896
2904
|
async searchShareSubjects(e, t, s, r) {
|
|
2897
|
-
const i = StringUtils.removeAccents(s).toLowerCase(), o =
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2905
|
+
const i = StringUtils.removeAccents(s).toLowerCase(), o = this.getSearchUrl(
|
|
2906
|
+
e,
|
|
2907
|
+
t,
|
|
2908
|
+
s,
|
|
2909
|
+
r
|
|
2910
|
+
), a = await this.cache.httpGetJson(o), c = a.users.visibles.filter(({ username: h, firstName: y, lastName: d, login: g }) => {
|
|
2911
|
+
const A = StringUtils.removeAccents(
|
|
2903
2912
|
d || ""
|
|
2904
2913
|
).toLowerCase(), f = StringUtils.removeAccents(
|
|
2905
|
-
|
|
2906
|
-
).toLowerCase(),
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
+
y || ""
|
|
2915
|
+
).toLowerCase(), w = StringUtils.removeAccents(
|
|
2916
|
+
h || ""
|
|
2917
|
+
).toLowerCase(), F = StringUtils.removeAccents(g || "").toLowerCase();
|
|
2918
|
+
return w.includes(i) || f.includes(i) || A.includes(i) || F.includes(i);
|
|
2919
|
+
}).map((h) => ({
|
|
2920
|
+
avatarUrl: this.directory.getAvatarUrl(h.id, "user"),
|
|
2921
|
+
directoryUrl: this.directory.getDirectoryUrl(h.id, "user"),
|
|
2922
|
+
displayName: h.username,
|
|
2923
|
+
id: h.id,
|
|
2924
|
+
profile: h.profile,
|
|
2914
2925
|
type: "user"
|
|
2915
|
-
})),
|
|
2916
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
2917
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
2918
|
-
displayName:
|
|
2919
|
-
id:
|
|
2926
|
+
})), l = a.groups.visibles.filter(({ name: h }) => StringUtils.removeAccents(h || "").toLowerCase().includes(i)).map((h) => ({
|
|
2927
|
+
avatarUrl: this.directory.getAvatarUrl(h.id, "group"),
|
|
2928
|
+
directoryUrl: this.directory.getDirectoryUrl(h.id, "group"),
|
|
2929
|
+
displayName: h.name,
|
|
2930
|
+
id: h.id,
|
|
2920
2931
|
type: "group",
|
|
2921
|
-
structureName:
|
|
2932
|
+
structureName: h.structureName
|
|
2922
2933
|
}));
|
|
2923
|
-
return [...(await this.directory.getBookMarks()).filter(({ displayName:
|
|
2924
|
-
|
|
2925
|
-
).toLowerCase().includes(i)).map((
|
|
2934
|
+
return [...(await this.directory.getBookMarks()).filter(({ displayName: h }) => StringUtils.removeAccents(
|
|
2935
|
+
h || ""
|
|
2936
|
+
).toLowerCase().includes(i)).map((h) => ({
|
|
2926
2937
|
avatarUrl: "",
|
|
2927
2938
|
directoryUrl: "",
|
|
2928
2939
|
profile: "",
|
|
2929
|
-
displayName:
|
|
2930
|
-
id:
|
|
2940
|
+
displayName: h.displayName,
|
|
2941
|
+
id: h.id,
|
|
2931
2942
|
type: "sharebookmark"
|
|
2932
|
-
})), ...
|
|
2943
|
+
})), ...c, ...l];
|
|
2933
2944
|
}
|
|
2934
2945
|
async getShareMapping(e, t) {
|
|
2935
2946
|
const s = await this.cache.httpGetJson(
|
|
@@ -2946,87 +2957,92 @@ class ShareService {
|
|
|
2946
2957
|
const o = (t === "user" ? s.users.checked[e] : s.groups.checked[e]) || [], a = Object.keys(r), c = [];
|
|
2947
2958
|
for (const l of a)
|
|
2948
2959
|
r[l].filter(
|
|
2949
|
-
(
|
|
2960
|
+
(h) => o.includes(h)
|
|
2950
2961
|
).length > 0 && c.push(l);
|
|
2951
2962
|
return c;
|
|
2952
2963
|
}
|
|
2953
2964
|
async getRightsForResource(e, t, s) {
|
|
2954
|
-
const r = await this.directory.getBookMarks(), i =
|
|
2955
|
-
|
|
2965
|
+
const r = await this.directory.getBookMarks(), i = this.getSearchUrl(
|
|
2966
|
+
e,
|
|
2967
|
+
t,
|
|
2968
|
+
"",
|
|
2969
|
+
s == null ? void 0 : s.getResourceRights
|
|
2970
|
+
), o = await this.cache.httpGetJson(
|
|
2971
|
+
i
|
|
2956
2972
|
), a = await this.getShareMapping(
|
|
2957
2973
|
e,
|
|
2958
2974
|
s == null ? void 0 : s.getShareMapping
|
|
2959
2975
|
), c = await this.cache.httpGetJson(
|
|
2960
2976
|
"/infra/public/json/sharing-rights.json"
|
|
2961
|
-
), l = Object.keys(o.users.checked).map((
|
|
2962
|
-
(A) => A.id ===
|
|
2963
|
-
)).filter((
|
|
2977
|
+
), l = Object.keys(o.users.checked).map((d) => o.users.visibles.find(
|
|
2978
|
+
(A) => A.id === d
|
|
2979
|
+
)).filter((d) => d !== void 0).map((d) => {
|
|
2964
2980
|
const g = this.getActionsAvailableFor(
|
|
2965
|
-
{ id:
|
|
2981
|
+
{ id: d.id, type: "user" },
|
|
2966
2982
|
o,
|
|
2967
2983
|
a
|
|
2968
2984
|
);
|
|
2969
2985
|
return {
|
|
2970
|
-
id:
|
|
2986
|
+
id: d.id,
|
|
2971
2987
|
type: "user",
|
|
2972
|
-
displayName:
|
|
2973
|
-
profile:
|
|
2974
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
2975
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
2988
|
+
displayName: d.username,
|
|
2989
|
+
profile: d.profile,
|
|
2990
|
+
avatarUrl: this.directory.getAvatarUrl(d.id, "user"),
|
|
2991
|
+
directoryUrl: this.directory.getDirectoryUrl(d.id, "user"),
|
|
2976
2992
|
actions: g.map((f) => {
|
|
2977
|
-
const
|
|
2993
|
+
const w = c[f];
|
|
2978
2994
|
return {
|
|
2979
2995
|
displayName: f,
|
|
2980
2996
|
id: f,
|
|
2981
|
-
priority:
|
|
2997
|
+
priority: w.priority
|
|
2982
2998
|
};
|
|
2983
2999
|
})
|
|
2984
3000
|
};
|
|
2985
|
-
}).sort((
|
|
2986
|
-
(A) => A.id ===
|
|
2987
|
-
)).filter((
|
|
3001
|
+
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), p = Object.keys(o.groups.checked).map((d) => o.groups.visibles.find(
|
|
3002
|
+
(A) => A.id === d
|
|
3003
|
+
)).filter((d) => d !== void 0).map((d) => {
|
|
2988
3004
|
const g = this.getActionsAvailableFor(
|
|
2989
|
-
{ id:
|
|
3005
|
+
{ id: d.id, type: "group" },
|
|
2990
3006
|
o,
|
|
2991
3007
|
a
|
|
2992
3008
|
);
|
|
2993
3009
|
return {
|
|
2994
|
-
id:
|
|
3010
|
+
id: d.id,
|
|
2995
3011
|
type: "group",
|
|
2996
|
-
displayName:
|
|
3012
|
+
displayName: d.name,
|
|
2997
3013
|
profile: void 0,
|
|
2998
|
-
avatarUrl: this.directory.getAvatarUrl(
|
|
2999
|
-
directoryUrl: this.directory.getDirectoryUrl(
|
|
3014
|
+
avatarUrl: this.directory.getAvatarUrl(d.id, "group"),
|
|
3015
|
+
directoryUrl: this.directory.getDirectoryUrl(d.id, "group"),
|
|
3000
3016
|
actions: g.map((f) => {
|
|
3001
|
-
const
|
|
3017
|
+
const w = c[f];
|
|
3002
3018
|
return {
|
|
3003
3019
|
displayName: f,
|
|
3004
3020
|
id: f,
|
|
3005
|
-
priority:
|
|
3021
|
+
priority: w.priority
|
|
3006
3022
|
};
|
|
3007
3023
|
})
|
|
3008
3024
|
};
|
|
3009
|
-
}).sort((
|
|
3010
|
-
({ groupDisplayName:
|
|
3025
|
+
}).sort((d, g) => (d.displayName || "").localeCompare(g.displayName)), E = [...l, ...p], h = o.groups.visibles.map(
|
|
3026
|
+
({ groupDisplayName: d, id: g, name: A, labels: f }) => ({
|
|
3011
3027
|
labels: f,
|
|
3012
|
-
displayName:
|
|
3028
|
+
displayName: d || A,
|
|
3013
3029
|
id: g
|
|
3014
3030
|
})
|
|
3015
|
-
),
|
|
3016
|
-
({ id:
|
|
3031
|
+
), y = o.users.visibles.map(
|
|
3032
|
+
({ id: d, profile: g, username: A, firstName: f, lastName: w, login: F }) => ({
|
|
3017
3033
|
displayName: A,
|
|
3018
3034
|
firstName: f,
|
|
3019
|
-
lastName:
|
|
3020
|
-
login:
|
|
3035
|
+
lastName: w,
|
|
3036
|
+
login: F,
|
|
3021
3037
|
profile: g,
|
|
3022
|
-
id:
|
|
3038
|
+
id: d
|
|
3023
3039
|
})
|
|
3024
3040
|
);
|
|
3025
3041
|
return {
|
|
3026
|
-
rights:
|
|
3042
|
+
rights: E,
|
|
3027
3043
|
visibleBookmarks: r,
|
|
3028
|
-
visibleGroups:
|
|
3029
|
-
visibleUsers:
|
|
3044
|
+
visibleGroups: h,
|
|
3045
|
+
visibleUsers: y
|
|
3030
3046
|
};
|
|
3031
3047
|
}
|
|
3032
3048
|
async getPutSharePayload(e, t, s) {
|
|
@@ -3036,7 +3052,7 @@ class ShareService {
|
|
|
3036
3052
|
bookmarks: {}
|
|
3037
3053
|
}, i = await this.getShareMapping(e, s);
|
|
3038
3054
|
for (const o of t) {
|
|
3039
|
-
const a = o.actions.map((l) => i[l.id]).reduce((l,
|
|
3055
|
+
const a = o.actions.map((l) => i[l.id]).reduce((l, p) => Array.isArray(p) ? [...l, ...p] : l, []), c = [...new Set(a)];
|
|
3040
3056
|
c.length > 0 && (o.type === "user" ? r.users[o.id] = c : o.type === "group" ? r.groups[o.id] = c : r.bookmarks[o.id] = c);
|
|
3041
3057
|
}
|
|
3042
3058
|
return r;
|
|
@@ -3046,10 +3062,13 @@ class ShareService {
|
|
|
3046
3062
|
e,
|
|
3047
3063
|
s,
|
|
3048
3064
|
r == null ? void 0 : r.getShareMapping
|
|
3049
|
-
), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3065
|
+
), o = (r == null ? void 0 : r.saveResourceRights) || `/${e}/share/resource/${t}`, a = this.getSearchUrl(
|
|
3066
|
+
e,
|
|
3067
|
+
t,
|
|
3068
|
+
"",
|
|
3069
|
+
r == null ? void 0 : r.getResourceRights
|
|
3070
|
+
);
|
|
3071
|
+
return this.cache.clearCache(a), await this.http.putJson(o, i);
|
|
3053
3072
|
}
|
|
3054
3073
|
async getActionsForApp(e, t) {
|
|
3055
3074
|
const s = await this.cache.httpGetJson(
|
|
@@ -3103,11 +3122,11 @@ const defaultMappers = {
|
|
|
3103
3122
|
zip: function({ type: u }) {
|
|
3104
3123
|
return u.indexOf("zip") !== -1 || u.indexOf("rar") !== -1 || u.indexOf("tar") !== -1 || u.indexOf("7z") !== -1;
|
|
3105
3124
|
}
|
|
3106
|
-
},
|
|
3125
|
+
}, D = class D {
|
|
3107
3126
|
/* Similar role notion as in infra-front > workspace > Model.ts */
|
|
3108
3127
|
static getRole(e) {
|
|
3109
3128
|
var t, s;
|
|
3110
|
-
return
|
|
3129
|
+
return D.role(
|
|
3111
3130
|
(t = e.metadata) == null ? void 0 : t["content-type"],
|
|
3112
3131
|
!1,
|
|
3113
3132
|
(s = e.metadata) == null ? void 0 : s.extension
|
|
@@ -3127,10 +3146,10 @@ const defaultMappers = {
|
|
|
3127
3146
|
}
|
|
3128
3147
|
};
|
|
3129
3148
|
// FIXME add edumedia support
|
|
3130
|
-
n(
|
|
3149
|
+
n(D, "roleMappers", [
|
|
3131
3150
|
(e) => Object.keys(defaultMappers).find((s) => defaultMappers[s](e))
|
|
3132
3151
|
]);
|
|
3133
|
-
let DocumentHelper =
|
|
3152
|
+
let DocumentHelper = D;
|
|
3134
3153
|
class WorkspaceService {
|
|
3135
3154
|
constructor(e) {
|
|
3136
3155
|
this.context = e;
|
|
@@ -3373,9 +3392,9 @@ class AnalyticsService {
|
|
|
3373
3392
|
let r;
|
|
3374
3393
|
if (!(t != null && t.structures)) return;
|
|
3375
3394
|
for (const l of t.structures) {
|
|
3376
|
-
const
|
|
3377
|
-
if (
|
|
3378
|
-
r =
|
|
3395
|
+
const p = u.structureMap[l];
|
|
3396
|
+
if (p && p.collectiviteId && p.UAI) {
|
|
3397
|
+
r = p;
|
|
3379
3398
|
break;
|
|
3380
3399
|
}
|
|
3381
3400
|
}
|
|
@@ -3385,10 +3404,10 @@ class AnalyticsService {
|
|
|
3385
3404
|
const o = i.xiti;
|
|
3386
3405
|
if (!o || !o.LIBELLE_SERVICE || !r.UAI) return;
|
|
3387
3406
|
function a(l) {
|
|
3388
|
-
let
|
|
3389
|
-
for (let
|
|
3390
|
-
|
|
3391
|
-
return
|
|
3407
|
+
let p = "";
|
|
3408
|
+
for (let E = 0; E < l.length; E++)
|
|
3409
|
+
p += l.charCodeAt(E);
|
|
3410
|
+
return p;
|
|
3392
3411
|
}
|
|
3393
3412
|
const c = {
|
|
3394
3413
|
Student: "ELEVE",
|
|
@@ -3465,26 +3484,26 @@ const C = class C {
|
|
|
3465
3484
|
{ headers: { "Content-Type": "multipart/form-data" } }
|
|
3466
3485
|
);
|
|
3467
3486
|
if (c.state == "running") {
|
|
3468
|
-
let l = 0,
|
|
3487
|
+
let l = 0, p = 1;
|
|
3469
3488
|
do {
|
|
3470
|
-
const
|
|
3489
|
+
const E = p + l;
|
|
3471
3490
|
await new Promise(
|
|
3472
|
-
(
|
|
3473
|
-
), l =
|
|
3474
|
-
const
|
|
3491
|
+
(y) => setTimeout(y, E * 1e3)
|
|
3492
|
+
), l = p, p = Math.min(8, E);
|
|
3493
|
+
const h = await this.http.get(
|
|
3475
3494
|
`/video/status/${c.processid}`
|
|
3476
3495
|
);
|
|
3477
|
-
if (
|
|
3478
|
-
return
|
|
3479
|
-
|
|
3496
|
+
if (h.state == "succeed")
|
|
3497
|
+
return h.videoworkspaceid && h.videosize && this.context.data().trackVideoSave(
|
|
3498
|
+
h.videoworkspaceid,
|
|
3480
3499
|
Math.round(r),
|
|
3481
|
-
|
|
3500
|
+
h.videosize,
|
|
3482
3501
|
s,
|
|
3483
3502
|
e.url,
|
|
3484
3503
|
i,
|
|
3485
3504
|
e.device
|
|
3486
|
-
),
|
|
3487
|
-
if (
|
|
3505
|
+
), h;
|
|
3506
|
+
if (h.state == "error")
|
|
3488
3507
|
break;
|
|
3489
3508
|
} while (!0);
|
|
3490
3509
|
}
|
|
@@ -3530,8 +3549,8 @@ class EmbedderService {
|
|
|
3530
3549
|
const s = new RegExp("[^{}]+(?=(?:[^{}]*{[^}]*})*[^}]*$)", "g"), r = new RegExp("{[^}]*}", "g");
|
|
3531
3550
|
let i = !0;
|
|
3532
3551
|
const o = t.match(s) || [], a = [];
|
|
3533
|
-
return (t.match(r) || []).forEach((l,
|
|
3534
|
-
l.includes("ignore") || a.push(o[
|
|
3552
|
+
return (t.match(r) || []).forEach((l, p) => {
|
|
3553
|
+
l.includes("ignore") || a.push(o[p]);
|
|
3535
3554
|
}), a.forEach((l) => {
|
|
3536
3555
|
if (!e.includes(l)) {
|
|
3537
3556
|
i = !1;
|
|
@@ -3567,13 +3586,13 @@ class EmbedderService {
|
|
|
3567
3586
|
let c = s.split(a)[0];
|
|
3568
3587
|
const l = c.split("}");
|
|
3569
3588
|
l.length > 1 && (c = l[l.length - 1]);
|
|
3570
|
-
let
|
|
3571
|
-
if (!
|
|
3589
|
+
let p = t.split(c)[1];
|
|
3590
|
+
if (!p)
|
|
3572
3591
|
continue;
|
|
3573
|
-
const
|
|
3574
|
-
|
|
3575
|
-
const
|
|
3576
|
-
o = o.replace(
|
|
3592
|
+
const E = s.split(a)[1].split("{")[0];
|
|
3593
|
+
E && (p = p.split(E)[0]);
|
|
3594
|
+
const h = new RegExp("\\" + a.replace(/}/, "\\}"), "g");
|
|
3595
|
+
o = o.replace(h, p);
|
|
3577
3596
|
}
|
|
3578
3597
|
return o;
|
|
3579
3598
|
}
|
|
@@ -4003,12 +4022,12 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
|
4003
4022
|
let o = "/workspace/documents?filter=all&hierarchical=true";
|
|
4004
4023
|
s && s.length ? o += `&search=${t}` : t && t.length && (o += `&search=${t}`);
|
|
4005
4024
|
const c = (await this.httpGet(o)).filter((l) => !l.deleted).map((l) => {
|
|
4006
|
-
const
|
|
4025
|
+
const p = l.metadata["content-type"] && l.metadata["content-type"].indexOf("image") !== -1 ? `/workspace/document/${l._id}?thumbnail=120x120` : "/img/icons/unknown-large.png";
|
|
4007
4026
|
return this.dataToResource({
|
|
4008
4027
|
title: l.name,
|
|
4009
4028
|
ownerName: l.ownerName,
|
|
4010
4029
|
owner: l.owner,
|
|
4011
|
-
icon:
|
|
4030
|
+
icon: p,
|
|
4012
4031
|
path: `/workspace/document/${l._id}`,
|
|
4013
4032
|
_id: l._id,
|
|
4014
4033
|
shared: !!(l.shared && l.shared.length >= 0),
|
|
@@ -4022,7 +4041,7 @@ class WorkspaceBehaviour extends AbstractBehaviourService {
|
|
|
4022
4041
|
});
|
|
4023
4042
|
}
|
|
4024
4043
|
}
|
|
4025
|
-
const
|
|
4044
|
+
const b = class b {
|
|
4026
4045
|
static async initialize(e, t) {
|
|
4027
4046
|
const s = e.http();
|
|
4028
4047
|
if (!this.resourceProducingApps.length) {
|
|
@@ -4113,9 +4132,9 @@ const w = class w {
|
|
|
4113
4132
|
//
|
|
4114
4133
|
// STATIC REGISTRY
|
|
4115
4134
|
//
|
|
4116
|
-
n(
|
|
4117
|
-
n(
|
|
4118
|
-
let SnipletsService =
|
|
4135
|
+
n(b, "registry", new ServiceRegistry()), // Expose some useful functions
|
|
4136
|
+
n(b, "findBehaviour", b.registry.findService.bind(b.registry)), n(b, "hasBehaviour", b.registry.isRegistered.bind(b.registry)), n(b, "resourceProducingApps", []);
|
|
4137
|
+
let SnipletsService = b;
|
|
4119
4138
|
const SEND_ALL = "*";
|
|
4120
4139
|
class WebBroker {
|
|
4121
4140
|
constructor(e) {
|
|
@@ -4580,17 +4599,17 @@ class WidgetFramework {
|
|
|
4580
4599
|
var a;
|
|
4581
4600
|
const i = ((a = r.find((c) => c.child === t.skin)) == null ? void 0 : a.parent) === "panda" ? secondLevelWidgets : firstLevelWidgets;
|
|
4582
4601
|
this._widgets = this._widgets.filter((c, l) => {
|
|
4583
|
-
const
|
|
4584
|
-
return i.indexOf(
|
|
4585
|
-
index: defaultWidgetOrder[
|
|
4602
|
+
const p = c.platformConf.name;
|
|
4603
|
+
return i.indexOf(p) !== -1 ? !1 : (this._userPrefs[p] || (this._userPrefs[p] = {
|
|
4604
|
+
index: defaultWidgetOrder[p] ?? 999,
|
|
4586
4605
|
show: !0,
|
|
4587
4606
|
position: c.platformConf.position
|
|
4588
|
-
}), c.platformConf.mandatory && (this._userPrefs[
|
|
4607
|
+
}), 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);
|
|
4589
4608
|
});
|
|
4590
4609
|
const o = new Idiom();
|
|
4591
4610
|
this._widgets = this._widgets.sort((c, l) => {
|
|
4592
|
-
const
|
|
4593
|
-
return
|
|
4611
|
+
const p = o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(), E = o.translate(`timeline.settings.${l.platformConf.name}`).toLowerCase();
|
|
4612
|
+
return p < E ? -1 : p > E ? 1 : 0;
|
|
4594
4613
|
});
|
|
4595
4614
|
});
|
|
4596
4615
|
}
|
package/dist/share/Service.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class ShareService {
|
|
|
6
6
|
get directory(): import('../directory/Service').DirectoryService;
|
|
7
7
|
get http(): import('../transport/Service').HttpService;
|
|
8
8
|
get cache(): import('../cache/Service').CacheService;
|
|
9
|
+
private getSearchUrl;
|
|
9
10
|
searchShareSubjects(app: string, resourceId: string, searchText: string, urlResourceRights?: string): Promise<ShareSubject[]>;
|
|
10
11
|
getShareMapping(app: string, urlShareMapping?: string): Promise<ShareMapping>;
|
|
11
12
|
getActionsAvailableFor({ id, type }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/client",
|
|
3
|
-
"version": "2.5.5-develop-b2school.
|
|
3
|
+
"version": "2.5.5-develop-b2school.20260109162050",
|
|
4
4
|
"description": "Edifice TypeScript Client",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"axios": "^1.7.7",
|
|
38
38
|
"core-js": "^3.35.1",
|
|
39
|
-
"@edifice.io/utilities": "2.5.5-develop-b2school.
|
|
39
|
+
"@edifice.io/utilities": "2.5.5-develop-b2school.20260109162050"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/jasmine": "5.1.4",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"typedoc-plugin-markdown": "3.17.1",
|
|
49
49
|
"vite": "^5.4.11",
|
|
50
50
|
"vite-plugin-dts": "^4.1.0",
|
|
51
|
-
"@edifice.io/config": "2.5.5-develop-b2school.
|
|
51
|
+
"@edifice.io/config": "2.5.5-develop-b2school.20260109162050"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "vite build",
|