ode-ts-client 1.1.4-dev.202306051713 → 1.1.4-dev.202306131039

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var Ec=Object.defineProperty;var gc=(b,C,H)=>C in b?Ec(b,C,{enumerable:!0,configurable:!0,writable:!0,value:H}):b[C]=H;var v=(b,C,H)=>(gc(b,typeof C!="symbol"?C+"":C,H),H);(function(b,C){typeof exports=="object"&&typeof module<"u"?C(exports):typeof define=="function"&&define.amd?define(["exports"],C):(b=typeof globalThis<"u"?globalThis:b||self,C(b["ode-ts-client"]={}))})(this,function(b){var Ti,Si,Ii,Pi;"use strict";const C={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"},H={EXPLORER:"explorer",PORTAL:"portal",BLOG:"blog",EXERCIZER:"exercizer",TIMELINE:"timeline",CAS:"cas",VIDEO:"video"},Oi={APPS:"apps",WIDGETS:"widgets",LANGUAGE:"language",AUTH_CONNECTOR_ACCESSED:"authenticatedConnectorsAccessed",CURSUS:"cursus",INFOTIP:"infotip",RGPD_COOKIES:"rgpdCookies"};/*! *****************************************************************************
1
+ var P=Object.defineProperty;var D=(b,x,R)=>x in b?P(b,x,{enumerable:!0,configurable:!0,writable:!0,value:R}):b[x]=R;var m=(b,x,R)=>(D(b,typeof x!="symbol"?x+"":x,R),R);(function(b,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(b=typeof globalThis<"u"?globalThis:b||self,x(b["ode-ts-client"]={}))})(this,function(exports){var x,_,T,I;"use strict";const 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={EXPLORER:"explorer",PORTAL:"portal",BLOG:"blog",EXERCIZER:"exercizer",TIMELINE:"timeline",CAS:"cas",VIDEO:"video"},USER_PREFS={APPS:"apps",WIDGETS:"widgets",LANGUAGE:"language",AUTH_CONNECTOR_ACCESSED:"authenticatedConnectorsAccessed",CURSUS:"cursus",INFOTIP:"infotip",RGPD_COOKIES:"rgpdCookies"};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -11,8 +11,8 @@ var Ec=Object.defineProperty;var gc=(b,C,H)=>C in b?Ec(b,C,{enumerable:!0,config
11
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */var at=function(r,e){return at=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},at(r,e)};function k(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");at(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function _i(r,e,t,n){function i(s){return s instanceof t?s:new t(function(u){u(s)})}return new(t||(t=Promise))(function(s,u){function o(l){try{a(n.next(l))}catch(d){u(d)}}function c(l){try{a(n.throw(l))}catch(d){u(d)}}function a(l){l.done?s(l.value):i(l.value).then(o,c)}a((n=n.apply(r,e||[])).next())})}function ct(r,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,u;return u={next:o(0),throw:o(1),return:o(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function o(a){return function(l){return c([a,l])}}function c(a){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(s=a[0]&2?i.return:a[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;switch(i=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,i=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1],s=a;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(a);break}s[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(r,t)}catch(l){a=[6,l],i=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function V(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function T(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),i,s=[],u;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(o){u={error:o}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(u)throw u.error}}return s}function S(r,e){for(var t=0,n=e.length,i=r.length;t<n;t++,i++)r[i]=e[t];return r}function Ee(r){return this instanceof Ee?(this.v=r,this):new Ee(r)}function ki(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),i,s=[];return i={},u("next"),u("throw"),u("return"),i[Symbol.asyncIterator]=function(){return this},i;function u(f){n[f]&&(i[f]=function(h){return new Promise(function(m,p){s.push([f,h,m,p])>1||o(f,h)})})}function o(f,h){try{c(n[f](h))}catch(m){d(s[0][3],m)}}function c(f){f.value instanceof Ee?Promise.resolve(f.value.v).then(a,l):d(s[0][2],f)}function a(f){o("next",f)}function l(f){o("throw",f)}function d(f,h){f(h),s.shift(),s.length&&o(s[0][0],s[0][1])}}function Bi(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof V=="function"?V(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(s){t[s]=r[s]&&function(u){return new Promise(function(o,c){u=r[s](u),i(o,c,u.done,u.value)})}}function i(s,u,o,c){Promise.resolve(c).then(function(a){s({value:a,done:o})},u)}}function w(r){return typeof r=="function"}function ae(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var He=ae(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
15
- `+t.map(function(n,i){return i+1+") "+n.toString()}).join(`
16
- `):"",this.name="UnsubscriptionError",this.errors=t}});function ne(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var U=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}return r.prototype.unsubscribe=function(){var e,t,n,i,s;if(!this.closed){this.closed=!0;var u=this._parentage;if(u)if(this._parentage=null,Array.isArray(u))try{for(var o=V(u),c=o.next();!c.done;c=o.next()){var a=c.value;a.remove(this)}}catch(p){e={error:p}}finally{try{c&&!c.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}else u.remove(this);var l=this.initialTeardown;if(w(l))try{l()}catch(p){s=p instanceof He?p.errors:[p]}var d=this._teardowns;if(d){this._teardowns=null;try{for(var f=V(d),h=f.next();!h.done;h=f.next()){var m=h.value;try{mn(m)}catch(p){s=s!=null?s:[],p instanceof He?s=S(S([],T(s)),T(p.errors)):s.push(p)}}}catch(p){n={error:p}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}if(s)throw new He(s)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)mn(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._teardowns=(t=this._teardowns)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&ne(t,e)},r.prototype.remove=function(e){var t=this._teardowns;t&&ne(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}(),pn=U.EMPTY;function vn(r){return r instanceof U||r&&"closed"in r&&w(r.remove)&&w(r.add)&&w(r.unsubscribe)}function mn(r){w(r)?r():r.unsubscribe()}var ie={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},$e={setTimeout:function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=$e.delegate;return((t==null?void 0:t.setTimeout)||setTimeout).apply(void 0,S([],T(r)))},clearTimeout:function(r){var e=$e.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(r)},delegate:void 0};function En(r){$e.setTimeout(function(){var e=ie.onUnhandledError;if(e)e(r);else throw r})}function O(){}var Li=function(){return lt("C",void 0,void 0)}();function Ni(r){return lt("E",void 0,r)}function Ui(r){return lt("N",r,void 0)}function lt(r,e,t){return{kind:r,value:e,error:t}}var ce=null;function qe(r){if(ie.useDeprecatedSynchronousErrorHandling){var e=!ce;if(e&&(ce={errorThrown:!1,error:null}),r(),e){var t=ce,n=t.errorThrown,i=t.error;if(ce=null,n)throw i}}else r()}function Mi(r){ie.useDeprecatedSynchronousErrorHandling&&ce&&(ce.errorThrown=!0,ce.error=r)}var We=function(r){k(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,vn(t)&&t.add(n)):n.destination=ji,n}return e.create=function(t,n,i){return new Ge(t,n,i)},e.prototype.next=function(t){this.isStopped?ht(Ui(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ht(Ni(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ht(Li,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(U),Ge=function(r){k(e,r);function e(t,n,i){var s=r.call(this)||this,u;if(w(t))u=t;else if(t){u=t.next,n=t.error,i=t.complete;var o;s&&ie.useDeprecatedNextContext?(o=Object.create(t),o.unsubscribe=function(){return s.unsubscribe()}):o=t,u=u==null?void 0:u.bind(o),n=n==null?void 0:n.bind(o),i=i==null?void 0:i.bind(o)}return s.destination={next:u?ft(u):O,error:ft(n!=null?n:gn),complete:i?ft(i):O},s}return e}(We);function ft(r,e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{r.apply(void 0,S([],T(t)))}catch(i){ie.useDeprecatedSynchronousErrorHandling?Mi(i):En(i)}}}function gn(r){throw r}function ht(r,e){var t=ie.onStoppedNotification;t&&$e.setTimeout(function(){return t(r,e)})}var ji={closed:!0,next:O,error:gn,complete:O},De=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function M(r){return r}function dt(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return yn(r)}function yn(r){return r.length===0?M:r.length===1?r[0]:function(t){return r.reduce(function(n,i){return i(n)},t)}}var F=function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var i=this,s=$i(e)?e:new Ge(e,t,n);return qe(function(){var u=i,o=u.operator,c=u.source;s.add(o?o.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=An(t),new t(function(i,s){var u;u=n.subscribe(function(o){try{e(o)}catch(c){s(c),u==null||u.unsubscribe()}},s,i)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[De]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return yn(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=An(e),new e(function(n,i){var s;t.subscribe(function(u){return s=u},function(u){return i(u)},function(){return n(s)})})},r.create=function(e){return new r(e)},r}();function An(r){var e;return(e=r!=null?r:ie.Promise)!==null&&e!==void 0?e:Promise}function Hi(r){return r&&w(r.next)&&w(r.error)&&w(r.complete)}function $i(r){return r&&r instanceof We||Hi(r)&&vn(r)}function wn(r){return w(r==null?void 0:r.lift)}function y(r){return function(e){if(wn(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}var E=function(r){k(e,r);function e(t,n,i,s,u){var o=r.call(this,t)||this;return o.onFinalize=u,o._next=n?function(c){try{n(c)}catch(a){t.error(a)}}:r.prototype._next,o._error=s?function(c){try{s(c)}catch(a){t.error(a)}finally{this.unsubscribe()}}:r.prototype._error,o._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,o}return e.prototype.unsubscribe=function(){var t,n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))},e}(We);function bn(){return y(function(r,e){var t=null;r._refCount++;var n=new E(e,void 0,void 0,void 0,function(){if(!r||r._refCount<=0||0<--r._refCount){t=null;return}var i=r._connection,s=t;t=null,i&&(!s||i===s)&&i.unsubscribe(),e.unsubscribe()});r.subscribe(n),n.closed||(t=r.connect())})}var Ve=function(r){k(e,r);function e(t,n){var i=r.call(this)||this;return i.source=t,i.subjectFactory=n,i._subject=null,i._refCount=0,i._connection=null,wn(t)&&(i.lift=t.lift),i}return e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return(!t||t.isStopped)&&(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,t==null||t.unsubscribe()},e.prototype.connect=function(){var t=this,n=this._connection;if(!n){n=this._connection=new U;var i=this.getSubject();n.add(this.source.subscribe(new E(i,void 0,function(){t._teardown(),i.complete()},function(s){t._teardown(),i.error(s)},function(){return t._teardown()}))),n.closed&&(this._connection=null,n=U.EMPTY)}return n},e.prototype.refCount=function(){return bn()(this)},e}(F),xn={now:function(){return(xn.delegate||performance).now()},delegate:void 0},ge={schedule:function(r){var e=requestAnimationFrame,t=cancelAnimationFrame,n=ge.delegate;n&&(e=n.requestAnimationFrame,t=n.cancelAnimationFrame);var i=e(function(s){t=void 0,r(s)});return new U(function(){return t==null?void 0:t(i)})},requestAnimationFrame:function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=ge.delegate;return((t==null?void 0:t.requestAnimationFrame)||requestAnimationFrame).apply(void 0,S([],T(r)))},cancelAnimationFrame:function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=ge.delegate;return((t==null?void 0:t.cancelAnimationFrame)||cancelAnimationFrame).apply(void 0,S([],T(r)))},delegate:void 0};function qi(r){return r?Fn(r):Wi}function Fn(r){var e=ge.schedule;return new F(function(t){var n=new U,i=r||xn,s=i.now(),u=function(o){var c=i.now();t.next({timestamp:r?c:o,elapsed:c-s}),t.closed||n.add(e(u))};return n.add(e(u)),n})}var Wi=Fn(),Cn=ae(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),_=function(r){k(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Rn(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Cn},e.prototype.next=function(t){var n=this;qe(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){var u=n.observers.slice();try{for(var o=V(u),c=o.next();!c.done;c=o.next()){var a=c.value;a.next(t)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var n=this;qe(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var i=n.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;qe(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,i=n.hasError,s=n.isStopped,u=n.observers;return i||s?pn:(u.push(t),new U(function(){return ne(u,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,s=n.thrownError,u=n.isStopped;i?t.error(s):u&&t.complete()},e.prototype.asObservable=function(){var t=new F;return t.source=this,t},e.create=function(t,n){return new Rn(t,n)},e}(F),Rn=function(r){k(e,r);function e(t,n){var i=r.call(this)||this;return i.destination=t,i.source=n,i}return e.prototype.next=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,t)},e.prototype.error=function(t){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&i!==void 0?i:pn},e}(_),Dn=function(r){k(e,r);function e(t){var n=r.call(this)||this;return n._value=t,n}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var n=r.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},e.prototype.getValue=function(){var t=this,n=t.hasError,i=t.thrownError,s=t._value;if(n)throw i;return this._throwIfClosed(),s},e.prototype.next=function(t){r.prototype.next.call(this,this._value=t)},e}(_),ze={now:function(){return(ze.delegate||Date).now()},delegate:void 0},pt=function(r){k(e,r);function e(t,n,i){t===void 0&&(t=1/0),n===void 0&&(n=1/0),i===void 0&&(i=ze);var s=r.call(this)||this;return s._bufferSize=t,s._windowTime=n,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=n===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,n),s}return e.prototype.next=function(t){var n=this,i=n.isStopped,s=n._buffer,u=n._infiniteTimeWindow,o=n._timestampProvider,c=n._windowTime;i||(s.push(t),!u&&s.push(o.now()+c)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),i=this,s=i._infiniteTimeWindow,u=i._buffer,o=u.slice(),c=0;c<o.length&&!t.closed;c+=s?1:2)t.next(o[c]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,i=t._timestampProvider,s=t._buffer,u=t._infiniteTimeWindow,o=(u?1:2)*n;if(n<1/0&&o<s.length&&s.splice(0,s.length-o),!u){for(var c=i.now(),a=0,l=1;l<s.length&&s[l]<=c;l+=2)a=l;a&&s.splice(0,a+1)}},e}(_),vt=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return e.prototype._checkFinalizedStatuses=function(t){var n=this,i=n.hasError,s=n._hasValue,u=n._value,o=n.thrownError,c=n.isStopped,a=n._isComplete;i?t.error(o):(c||a)&&(s&&t.next(u),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var t=this,n=t._hasValue,i=t._value,s=t._isComplete;s||(this._isComplete=!0,n&&r.prototype.next.call(this,i),r.prototype.complete.call(this))},e}(_),Gi=function(r){k(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return this},e}(U),Je={setInterval:function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Je.delegate;return((t==null?void 0:t.setInterval)||setInterval).apply(void 0,S([],T(r)))},clearInterval:function(r){var e=Je.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(r)},delegate:void 0},Te=function(r){k(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.pending=!1,i}return e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=this.id||this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),Je.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;Je.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var i=!1,s;try{this.work(t)}catch(u){i=!0,s=!!u&&u||new Error(u)}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,i=t.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,ne(s,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e}(Gi),Vi=1,mt,Et={};function Tn(r){return r in Et?(delete Et[r],!0):!1}var Sn={setImmediate:function(r){var e=Vi++;return Et[e]=!0,mt||(mt=Promise.resolve()),mt.then(function(){return Tn(e)&&r()}),e},clearImmediate:function(r){Tn(r)}},zi=Sn.setImmediate,Ji=Sn.clearImmediate,Ye={setImmediate:function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Ye.delegate;return((t==null?void 0:t.setImmediate)||zi).apply(void 0,S([],T(r)))},clearImmediate:function(r){var e=Ye.delegate;return((e==null?void 0:e.clearImmediate)||Ji)(r)},delegate:void 0},Yi=function(r){k(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i}return e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!==null&&i>0?r.prototype.requestAsyncId.call(this,t,n,i):(t.actions.push(this),t._scheduled||(t._scheduled=Ye.setImmediate(t.flush.bind(t,void 0))))},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0)return r.prototype.recycleAsyncId.call(this,t,n,i);t.actions.length===0&&(Ye.clearImmediate(n),t._scheduled=void 0)},e}(Te),gt=function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=ze.now,r}(),Se=function(r){k(e,r);function e(t,n){n===void 0&&(n=gt.now);var i=r.call(this,t,n)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,i){for(;t=n.shift();)t.unsubscribe();throw i}},e}(gt),Xi=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.flush=function(t){this._active=!0,this._scheduled=void 0;var n=this.actions,i,s=-1;t=t||n.shift();var u=n.length;do if(i=t.execute(t.state,t.delay))break;while(++s<u&&(t=n.shift()));if(this._active=!1,i){for(;++s<u&&(t=n.shift());)t.unsubscribe();throw i}},e}(Se),In=new Xi(Yi),Ki=In,ee=new Se(Te),Ie=ee,Qi=function(r){k(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i}return e.prototype.schedule=function(t,n){return n===void 0&&(n=0),n>0?r.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},e.prototype.execute=function(t,n){return n>0||this.closed?r.prototype.execute.call(this,t,n):this._execute(t,n)},e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0?r.prototype.requestAsyncId.call(this,t,n,i):t.flush(this)},e}(Te),Zi=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e}(Se),Pn=new Zi(Qi),es=Pn,ts=function(r){k(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.scheduler=t,i.work=n,i}return e.prototype.requestAsyncId=function(t,n,i){return i===void 0&&(i=0),i!==null&&i>0?r.prototype.requestAsyncId.call(this,t,n,i):(t.actions.push(this),t._scheduled||(t._scheduled=ge.requestAnimationFrame(function(){return t.flush(void 0)})))},e.prototype.recycleAsyncId=function(t,n,i){if(i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0)return r.prototype.recycleAsyncId.call(this,t,n,i);t.actions.length===0&&(ge.cancelAnimationFrame(n),t._scheduled=void 0)},e}(Te),ns=function(r){k(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.flush=function(t){this._active=!0,this._scheduled=void 0;var n=this.actions,i,s=-1;t=t||n.shift();var u=n.length;do if(i=t.execute(t.state,t.delay))break;while(++s<u&&(t=n.shift()));if(this._active=!1,i){for(;++s<u&&(t=n.shift());)t.unsubscribe();throw i}},e}(Se),On=new ns(ts),rs=On,is=function(r){k(e,r);function e(t,n){t===void 0&&(t=_n),n===void 0&&(n=1/0);var i=r.call(this,t,function(){return i.frame})||this;return i.maxFrames=n,i.frame=0,i.index=-1,i}return e.prototype.flush=function(){for(var t=this,n=t.actions,i=t.maxFrames,s,u;(u=n[0])&&u.delay<=i&&(n.shift(),this.frame=u.delay,!(s=u.execute(u.state,u.delay))););if(s){for(;u=n.shift();)u.unsubscribe();throw s}},e.frameTimeFactor=10,e}(Se),_n=function(r){k(e,r);function e(t,n,i){i===void 0&&(i=t.index+=1);var s=r.call(this,t,n)||this;return s.scheduler=t,s.work=n,s.index=i,s.active=!0,s.index=t.index=i,s}return e.prototype.schedule=function(t,n){if(n===void 0&&(n=0),Number.isFinite(n)){if(!this.id)return r.prototype.schedule.call(this,t,n);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(t,n)}else return U.EMPTY},e.prototype.requestAsyncId=function(t,n,i){i===void 0&&(i=0),this.delay=t.frame+i;var s=t.actions;return s.push(this),s.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,n,i){},e.prototype._execute=function(t,n){if(this.active===!0)return r.prototype._execute.call(this,t,n)},e.sortActions=function(t,n){return t.delay===n.delay?t.index===n.index?0:t.index>n.index?1:-1:t.delay>n.delay?1:-1},e}(Te),K=new F(function(r){return r.complete()});function ss(r){return r?us(r):K}function us(r){return new F(function(e){return r.schedule(function(){return e.complete()})})}function yt(r,e){return new F(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}var At=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function kn(r){return w(r==null?void 0:r.then)}function os(r,e){return new F(function(t){var n=new U;return n.add(e.schedule(function(){var i=r[De]();n.add(i.subscribe({next:function(s){n.add(e.schedule(function(){return t.next(s)}))},error:function(s){n.add(e.schedule(function(){return t.error(s)}))},complete:function(){n.add(e.schedule(function(){return t.complete()}))}}))})),n})}function as(r,e){return new F(function(t){return e.schedule(function(){return r.then(function(n){t.add(e.schedule(function(){t.next(n),t.add(e.schedule(function(){return t.complete()}))}))},function(n){t.add(e.schedule(function(){return t.error(n)}))})})})}function cs(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Bn=cs();function Ln(r,e,t,n){n===void 0&&(n=0);var i=e.schedule(function(){try{t.call(this)}catch(s){r.error(s)}},n);return r.add(i),i}function Nn(r,e){return new F(function(t){var n;return t.add(e.schedule(function(){n=r[Bn](),Ln(t,e,function(){var i=n.next(),s=i.value,u=i.done;u?t.complete():(t.next(s),this.schedule())})})),function(){return w(n==null?void 0:n.return)&&n.return()}})}function Un(r,e){if(!r)throw new Error("Iterable cannot be null");return new F(function(t){var n=new U;return n.add(e.schedule(function(){var i=r[Symbol.asyncIterator]();n.add(e.schedule(function(){var s=this;i.next().then(function(u){u.done?t.complete():(t.next(u.value),s.schedule())})}))})),n})}function Mn(r){return w(r[De])}function jn(r){return w(r==null?void 0:r[Bn])}function Hn(r){return Symbol.asyncIterator&&w(r==null?void 0:r[Symbol.asyncIterator])}function $n(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function qn(r){return ki(this,arguments,function(){var t,n,i,s;return ct(this,function(u){switch(u.label){case 0:t=r.getReader(),u.label=1;case 1:u.trys.push([1,,9,10]),u.label=2;case 2:return[4,Ee(t.read())];case 3:return n=u.sent(),i=n.value,s=n.done,s?[4,Ee(void 0)]:[3,5];case 4:return[2,u.sent()];case 5:return[4,Ee(i)];case 6:return[4,u.sent()];case 7:return u.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Wn(r){return w(r==null?void 0:r.getReader)}function ls(r,e){return Un(qn(r),e)}function Gn(r,e){if(r!=null){if(Mn(r))return os(r,e);if(At(r))return yt(r,e);if(kn(r))return as(r,e);if(Hn(r))return Un(r,e);if(jn(r))return Nn(r,e);if(Wn(r))return ls(r,e)}throw $n(r)}function ye(r,e){return e?Gn(r,e):R(r)}function R(r){if(r instanceof F)return r;if(r!=null){if(Mn(r))return fs(r);if(At(r))return Vn(r);if(kn(r))return hs(r);if(Hn(r))return zn(r);if(jn(r))return ds(r);if(Wn(r))return ps(r)}throw $n(r)}function fs(r){return new F(function(e){var t=r[De]();if(w(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Vn(r){return new F(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function hs(r){return new F(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,En)})}function ds(r){return new F(function(e){var t,n;try{for(var i=V(r),s=i.next();!s.done;s=i.next()){var u=s.value;if(e.next(u),e.closed)return}}catch(o){t={error:o}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}function zn(r){return new F(function(e){vs(r,e).catch(function(t){return e.error(t)})})}function ps(r){return zn(qn(r))}function vs(r,e){var t,n,i,s;return _i(this,void 0,void 0,function(){var u,o;return ct(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=Bi(r),c.label=1;case 1:return[4,t.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(u=n.value,e.next(u),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return o=c.sent(),i={error:o},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Ae(r,e){return e?yt(r,e):Vn(r)}function Xe(r){return r&&w(r.schedule)}function wt(r){return r[r.length-1]}function Pe(r){return w(wt(r))?r.pop():void 0}function re(r){return Xe(wt(r))?r.pop():void 0}function Jn(r,e){return typeof wt(r)=="number"?r.pop():e}function bt(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=re(r);return t?yt(r,t):Ae(r)}function Yn(r,e){var t=w(r)?r:function(){return r},n=function(i){return i.error(t())};return new F(e?function(i){return e.schedule(n,0,i)}:n)}var xt;(function(r){r.NEXT="N",r.ERROR="E",r.COMPLETE="C"})(xt||(xt={}));var Ke=function(){function r(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue=e==="N"}return r.prototype.observe=function(e){return Xn(this,e)},r.prototype.do=function(e,t,n){var i=this,s=i.kind,u=i.value,o=i.error;return s==="N"?e==null?void 0:e(u):s==="E"?t==null?void 0:t(o):n==null?void 0:n()},r.prototype.accept=function(e,t,n){var i;return w((i=e)===null||i===void 0?void 0:i.next)?this.observe(e):this.do(e,t,n)},r.prototype.toObservable=function(){var e=this,t=e.kind,n=e.value,i=e.error,s=t==="N"?bt(n):t==="E"?Yn(function(){return i}):t==="C"?K:0;if(!s)throw new TypeError("Unexpected notification kind "+t);return s},r.createNext=function(e){return new r("N",e)},r.createError=function(e){return new r("E",void 0,e)},r.createComplete=function(){return r.completeNotification},r.completeNotification=new r("C"),r}();function Xn(r,e){var t,n,i,s=r,u=s.kind,o=s.value,c=s.error;if(typeof u!="string")throw new TypeError('Invalid notification, missing "kind"');u==="N"?(t=e.next)===null||t===void 0||t.call(e,o):u==="E"?(n=e.error)===null||n===void 0||n.call(e,c):(i=e.complete)===null||i===void 0||i.call(e)}function ms(r){return!!r&&(r instanceof F||w(r.lift)&&w(r.subscribe))}var le=ae(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function Es(r,e){var t=typeof e=="object";return new Promise(function(n,i){var s=!1,u;r.subscribe({next:function(o){u=o,s=!0},error:i,complete:function(){s?n(u):t?n(e.defaultValue):i(new le)}})})}function gs(r,e){var t=typeof e=="object";return new Promise(function(n,i){var s=new Ge({next:function(u){n(u),s.unsubscribe()},error:i,complete:function(){t?n(e.defaultValue):i(new le)}});r.subscribe(s)})}var Ft=ae(function(r){return function(){r(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}),Kn=ae(function(r){return function(t){r(this),this.name="NotFoundError",this.message=t}}),Qn=ae(function(r){return function(t){r(this),this.name="SequenceError",this.message=t}});function Ct(r){return r instanceof Date&&!isNaN(r)}var Zn=ae(function(r){return function(t){t===void 0&&(t=null),r(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function er(r,e){var t=Ct(r)?{first:r}:typeof r=="number"?{each:r}:r,n=t.first,i=t.each,s=t.with,u=s===void 0?ys:s,o=t.scheduler,c=o===void 0?e!=null?e:ee:o,a=t.meta,l=a===void 0?null:a;if(n==null&&i==null)throw new TypeError("No timeout provided.");return y(function(d,f){var h,m,p=null,g=0,A=function(I){m=Ln(f,c,function(){h.unsubscribe(),R(u({meta:l,lastValue:p,seen:g})).subscribe(f)},I)};h=d.subscribe(new E(f,function(I){m==null||m.unsubscribe(),g++,f.next(p=I),i>0&&A(i)},void 0,void 0,function(){m!=null&&m.closed||m==null||m.unsubscribe(),p=null})),A(n!=null?typeof n=="number"?n:+n-c.now():i)})}function ys(r){throw new Zn(r)}function tr(r,e){return e===void 0&&(e=0),y(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function se(r,e){return y(function(t,n){var i=0;t.subscribe(new E(n,function(s){n.next(r.call(e,s,i++))}))})}var As=Array.isArray;function ws(r,e){return As(e)?r.apply(void 0,S([],T(e))):r(e)}function fe(r){return se(function(e){return ws(r,e)})}function nr(r,e){return e===void 0&&(e=0),y(function(t,n){t.subscribe(new E(n,function(i){return n.add(r.schedule(function(){return n.next(i)},e))},function(){return n.add(r.schedule(function(){return n.complete()},e))},function(i){return n.add(r.schedule(function(){return n.error(i)},e))}))})}function Qe(r,e,t,n){if(t)if(Xe(t))n=t;else return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return Qe(r,e,n).apply(this,i).pipe(fe(t))};return n?function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return Qe(r,e).apply(this,i).pipe(tr(n),nr(n))}:function(){for(var i=this,s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];var o=new vt,c=!0;return new F(function(a){var l=o.subscribe(a);if(c){c=!1;var d=!1,f=!1;e.apply(i,S(S([],T(s)),[function(){for(var h=[],m=0;m<arguments.length;m++)h[m]=arguments[m];if(r){var p=h.shift();if(p!=null){o.error(p);return}}o.next(1<h.length?h:h[0]),f=!0,d&&o.complete()}])),f&&o.complete(),d=!0}return l})}}function bs(r,e,t){return Qe(!1,r,e,t)}function xs(r,e,t){return Qe(!0,r,e,t)}var Fs=Array.isArray,Cs=Object.getPrototypeOf,Rs=Object.prototype,Ds=Object.keys;function rr(r){if(r.length===1){var e=r[0];if(Fs(e))return{args:e,keys:null};if(Ts(e)){var t=Ds(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:r,keys:null}}function Ts(r){return r&&typeof r=="object"&&Cs(r)===Rs}function ir(r,e){return r.reduce(function(t,n,i){return t[n]=e[i],t},{})}function sr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=re(r),n=Pe(r),i=rr(r),s=i.args,u=i.keys;if(s.length===0)return ye([],t);var o=new F(ur(s,t,u?function(c){return ir(u,c)}:M));return n?o.pipe(fe(n)):o}function ur(r,e,t){return t===void 0&&(t=M),function(n){or(e,function(){for(var i=r.length,s=new Array(i),u=i,o=i,c=function(l){or(e,function(){var d=ye(r[l],e),f=!1;d.subscribe(new E(n,function(h){s[l]=h,f||(f=!0,o--),o||n.next(t(s.slice()))},function(){--u||n.complete()}))},n)},a=0;a<i;a++)c(a)},n)}}function or(r,e,t){r?t.add(r.schedule(e)):e()}function Rt(r,e,t,n,i,s,u,o){var c=[],a=0,l=0,d=!1,f=function(){d&&!c.length&&!a&&e.complete()},h=function(p){return a<n?m(p):c.push(p)},m=function(p){s&&e.next(p),a++;var g=!1;R(t(p,l++)).subscribe(new E(e,function(A){i==null||i(A),s?h(A):e.next(A)},function(){g=!0},void 0,function(){if(g)try{a--;for(var A=function(){var I=c.shift();u?e.add(u.schedule(function(){return m(I)})):m(I)};c.length&&a<n;)A();f()}catch(I){e.error(I)}}))};return r.subscribe(new E(e,h,function(){d=!0,f()})),function(){o==null||o()}}function Q(r,e,t){return t===void 0&&(t=1/0),w(e)?Q(function(n,i){return se(function(s,u){return e(n,s,i,u)})(R(r(n,i)))},t):(typeof e=="number"&&(t=e),y(function(n,i){return Rt(n,i,r,t)}))}function Ze(r){return r===void 0&&(r=1/0),Q(M,r)}function Dt(){return Ze(1)}function Oe(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Dt()(Ae(r,re(r)))}function _e(r){return new F(function(e){R(r()).subscribe(e)})}var Ss={connector:function(){return new _},resetOnDisconnect:!0};function Is(r,e){e===void 0&&(e=Ss);var t=null,n=e.connector,i=e.resetOnDisconnect,s=i===void 0?!0:i,u=n(),o=new F(function(c){return u.subscribe(c)});return o.connect=function(){return(!t||t.closed)&&(t=_e(function(){return r}).subscribe(u),s&&t.add(function(){return u=n()})),t},o}function Ps(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Pe(r),n=rr(r),i=n.args,s=n.keys,u=new F(function(o){var c=i.length;if(!c){o.complete();return}for(var a=new Array(c),l=c,d=c,f=function(m){var p=!1;R(i[m]).subscribe(new E(o,function(g){p||(p=!0,d--),a[m]=g},function(){(!--l||!p)&&(d||o.next(s?ir(s,a):a),o.complete())}))},h=0;h<c;h++)f(h)});return t?u.pipe(fe(t)):u}var Os=["addListener","removeListener"],_s=["addEventListener","removeEventListener"],ks=["on","off"];function Tt(r,e,t,n){if(w(t)&&(n=t,t=void 0),n)return Tt(r,e,t).pipe(fe(n));var i=T(Ns(r)?_s.map(function(o){return function(c){return r[o](e,c,t)}}):Bs(r)?Os.map(ar(r,e)):Ls(r)?ks.map(ar(r,e)):[],2),s=i[0],u=i[1];if(!s&&At(r))return Q(function(o){return Tt(o,e,t)})(Ae(r));if(!s)throw new TypeError("Invalid event target");return new F(function(o){var c=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return o.next(1<a.length?a:a[0])};return s(c),function(){return u(c)}})}function ar(r,e){return function(t){return function(n){return r[t](e,n)}}}function Bs(r){return w(r.addListener)&&w(r.removeListener)}function Ls(r){return w(r.on)&&w(r.off)}function Ns(r){return w(r.addEventListener)&&w(r.removeEventListener)}function cr(r,e,t){return t?cr(r,e).pipe(fe(t)):new F(function(n){var i=function(){for(var u=[],o=0;o<arguments.length;o++)u[o]=arguments[o];return n.next(u.length===1?u[0]:u)},s=r(i);return w(e)?function(){return e(i,s)}:void 0})}function Us(r,e,t,n,i){var s,u,o,c;arguments.length===1?(s=r,c=s.initialState,e=s.condition,t=s.iterate,u=s.resultSelector,o=u===void 0?M:u,i=s.scheduler):(c=r,!n||Xe(n)?(o=M,i=n):o=n);function a(){var l;return ct(this,function(d){switch(d.label){case 0:l=c,d.label=1;case 1:return!e||e(l)?[4,o(l)]:[3,4];case 2:d.sent(),d.label=3;case 3:return l=t(l),[3,1];case 4:return[2]}})}return _e(i?function(){return Nn(a(),i)}:a)}function Ms(r,e,t){return _e(function(){return r()?e:t})}function we(r,e,t){r===void 0&&(r=0),t===void 0&&(t=Ie);var n=-1;return e!=null&&(Xe(e)?t=e:n=e),new F(function(i){var s=Ct(r)?+r-t.now():r;s<0&&(s=0);var u=0;return t.schedule(function(){i.closed||(i.next(u++),0<=n?this.schedule(void 0,n):i.complete())},s)})}function lr(r,e){return r===void 0&&(r=0),e===void 0&&(e=ee),r<0&&(r=0),we(r,r,e)}function js(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=re(r),n=Jn(r,1/0),i=r;return i.length?i.length===1?R(i[0]):Ze(n)(Ae(i,t)):K}var fr=new F(O);function Hs(){return fr}var $s=Array.isArray;function be(r){return r.length===1&&$s(r[0])?r[0]:r}function qs(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=be(r);return y(function(n,i){var s=S([n],T(t)),u=function(){if(!i.closed)if(s.length>0){var o=void 0;try{o=R(s.shift())}catch{u();return}var c=new E(i,void 0,O,O);i.add(o.subscribe(c)),c.add(u)}else i.complete()};u()})}function Ws(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return qs(be(r))(K)}function Gs(r,e){return ye(Object.entries(r),e)}function Vs(r,e){return function(t,n){return!r.call(e,t,n)}}function ue(r,e){return y(function(t,n){var i=0;t.subscribe(new E(n,function(s){return r.call(e,s,i++)&&n.next(s)}))})}function zs(r,e,t){return[ue(e,t)(R(r)),ue(Vs(e,t))(R(r))]}function Js(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r=be(r),r.length===1?R(r[0]):new F(hr(r))}function hr(r){return function(e){for(var t=[],n=function(s){t.push(R(r[s]).subscribe(new E(e,function(u){if(t){for(var o=0;o<t.length;o++)o!==s&&t[o].unsubscribe();t=null}e.next(u)})))},i=0;t&&!e.closed&&i<r.length;i++)n(i)}}function Ys(r,e,t){if(e==null&&(e=r,r=0),e<=0)return K;var n=e+r;return new F(t?function(i){var s=r;return t.schedule(function(){s<n?(i.next(s++),this.schedule()):i.complete()})}:function(i){for(var s=r;s<n&&!i.closed;)i.next(s++);i.complete()})}function Xs(r,e){return new F(function(t){var n=r(),i=e(n),s=i?R(i):K;return s.subscribe(t),function(){n&&n.unsubscribe()}})}function St(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Pe(r),n=be(r);return n.length?new F(function(i){var s=n.map(function(){return[]}),u=n.map(function(){return!1});i.add(function(){s=u=null});for(var o=function(a){R(n[a]).subscribe(new E(i,function(l){if(s[a].push(l),s.every(function(f){return f.length})){var d=s.map(function(f){return f.shift()});i.next(t?t.apply(void 0,S([],T(d))):d),s.some(function(f,h){return!f.length&&u[h]})&&i.complete()}},function(){u[a]=!0,!s[a].length&&i.complete()}))},c=0;!i.closed&&c<n.length;c++)o(c);return function(){s=u=null}}):K}function dr(r){return y(function(e,t){var n=!1,i=null,s=null,u=!1,o=function(){if(s==null||s.unsubscribe(),s=null,n){n=!1;var a=i;i=null,t.next(a)}u&&t.complete()},c=function(){s=null,u&&t.complete()};e.subscribe(new E(t,function(a){n=!0,i=a,s||R(r(a)).subscribe(s=new E(t,o,c))},function(){u=!0,(!n||!s||s.closed)&&t.complete()}))})}function Ks(r,e){return e===void 0&&(e=Ie),dr(function(){return we(r,e)})}function Qs(r){return y(function(e,t){var n=[];return e.subscribe(new E(t,function(i){return n.push(i)},function(){t.next(n),t.complete()})),r.subscribe(new E(t,function(){var i=n;n=[],t.next(i)},O)),function(){n=null}})}function Zs(r,e){return e===void 0&&(e=null),e=e!=null?e:r,y(function(t,n){var i=[],s=0;t.subscribe(new E(n,function(u){var o,c,a,l,d=null;s++%e===0&&i.push([]);try{for(var f=V(i),h=f.next();!h.done;h=f.next()){var m=h.value;m.push(u),r<=m.length&&(d=d!=null?d:[],d.push(m))}}catch(A){o={error:A}}finally{try{h&&!h.done&&(c=f.return)&&c.call(f)}finally{if(o)throw o.error}}if(d)try{for(var p=V(d),g=p.next();!g.done;g=p.next()){var m=g.value;ne(i,m),n.next(m)}}catch(A){a={error:A}}finally{try{g&&!g.done&&(l=p.return)&&l.call(p)}finally{if(a)throw a.error}}},function(){var u,o;try{for(var c=V(i),a=c.next();!a.done;a=c.next()){var l=a.value;n.next(l)}}catch(d){u={error:d}}finally{try{a&&!a.done&&(o=c.return)&&o.call(c)}finally{if(u)throw u.error}}n.complete()},void 0,function(){i=null}))})}function eu(r){for(var e,t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=(e=re(n))!==null&&e!==void 0?e:ee,u=(t=n[0])!==null&&t!==void 0?t:null,o=n[1]||1/0;return y(function(c,a){var l=[],d=!1,f=function(p){var g=p.buffer,A=p.subs;A.unsubscribe(),ne(l,p),a.next(g),d&&h()},h=function(){if(l){var p=new U;a.add(p);var g=[],A={buffer:g,subs:p};l.push(A),p.add(s.schedule(function(){return f(A)},r))}};u!==null&&u>=0?a.add(s.schedule(function(){h(),!this.closed&&a.add(this.schedule(null,u))},u)):d=!0,h();var m=new E(a,function(p){var g,A,I=l.slice();try{for(var G=V(I),B=G.next();!B.done;B=G.next()){var W=B.value,X=W.buffer;X.push(p),o<=X.length&&f(W)}}catch(dn){g={error:dn}}finally{try{B&&!B.done&&(A=G.return)&&A.call(G)}finally{if(g)throw g.error}}},function(){for(;l!=null&&l.length;)a.next(l.shift().buffer);m==null||m.unsubscribe(),a.complete(),a.unsubscribe()},void 0,function(){return l=null});c.subscribe(m)})}function tu(r,e){return y(function(t,n){var i=[];R(r).subscribe(new E(n,function(s){var u=[];i.push(u);var o=new U,c=function(){ne(i,u),n.next(u),o.unsubscribe()};o.add(R(e(s)).subscribe(new E(n,c,O)))},O)),t.subscribe(new E(n,function(s){var u,o;try{for(var c=V(i),a=c.next();!a.done;a=c.next()){var l=a.value;l.push(s)}}catch(d){u={error:d}}finally{try{a&&!a.done&&(o=c.return)&&o.call(c)}finally{if(u)throw u.error}}},function(){for(;i.length>0;)n.next(i.shift());n.complete()}))})}function nu(r){return y(function(e,t){var n=null,i=null,s=function(){i==null||i.unsubscribe();var u=n;n=[],u&&t.next(u),R(r()).subscribe(i=new E(t,s,O))};s(),e.subscribe(new E(t,function(u){return n==null?void 0:n.push(u)},function(){n&&t.next(n),t.complete()},void 0,function(){return n=i=null}))})}function pr(r){return y(function(e,t){var n=null,i=!1,s;n=e.subscribe(new E(t,void 0,void 0,function(u){s=R(r(u,pr(r)(e))),n?(n.unsubscribe(),n=null,s.subscribe(t)):i=!0})),i&&(n.unsubscribe(),n=null,s.subscribe(t))})}function vr(r,e,t,n,i){return function(s,u){var o=t,c=e,a=0;s.subscribe(new E(u,function(l){var d=a++;c=o?r(c,l,d):(o=!0,l),n&&u.next(c)},i&&function(){o&&u.next(c),u.complete()}))}}function ke(r,e){return y(vr(r,e,arguments.length>=2,!1,!0))}var ru=function(r,e){return r.push(e),r};function mr(){return y(function(r,e){ke(ru,[])(r).subscribe(e)})}function Er(r,e){return dt(mr(),Q(function(t){return r(t)}),e?fe(e):M)}function gr(r){return Er(sr,r)}var iu=gr;function yr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Pe(r);return t?dt(yr.apply(void 0,S([],T(r))),fe(t)):y(function(n,i){ur(S([n],T(be(r))))(i)})}function su(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return yr.apply(void 0,S([],T(r)))}function It(r,e){return w(e)?Q(r,e,1):Q(r,1)}function uu(r,e){return w(e)?It(function(){return r},e):It(function(){return r})}function ou(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=re(r);return y(function(n,i){Dt()(Ae(S([n],T(r)),t)).subscribe(i)})}function au(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ou.apply(void 0,S([],T(r)))}function cu(r){return new F(function(e){return r.subscribe(e)})}var lu={connector:function(){return new _}};function Pt(r,e){e===void 0&&(e=lu);var t=e.connector;return y(function(n,i){var s=t();ye(r(cu(s))).subscribe(i),i.add(n.subscribe(s))})}function fu(r){return ke(function(e,t,n){return!r||r(t,n)?e+1:e},0)}function hu(r){return y(function(e,t){var n=!1,i=null,s=null,u=function(){if(s==null||s.unsubscribe(),s=null,n){n=!1;var o=i;i=null,t.next(o)}};e.subscribe(new E(t,function(o){s==null||s.unsubscribe(),n=!0,i=o,s=new E(t,u,O),R(r(o)).subscribe(s)},function(){u(),t.complete()},void 0,function(){i=s=null}))})}function du(r,e){return e===void 0&&(e=ee),y(function(t,n){var i=null,s=null,u=null,o=function(){if(i){i.unsubscribe(),i=null;var a=s;s=null,n.next(a)}};function c(){var a=u+r,l=e.now();if(l<a){i=this.schedule(void 0,a-l),n.add(i);return}o()}t.subscribe(new E(n,function(a){s=a,u=e.now(),i||(i=e.schedule(c,r),n.add(i))},function(){o(),n.complete()},void 0,function(){s=i=null}))})}function et(r){return y(function(e,t){var n=!1;e.subscribe(new E(t,function(i){n=!0,t.next(i)},function(){n||t.next(r),t.complete()}))})}function xe(r){return r<=0?function(){return K}:y(function(e,t){var n=0;e.subscribe(new E(t,function(i){++n<=r&&(t.next(i),r<=n&&t.complete())}))})}function Ar(){return y(function(r,e){r.subscribe(new E(e,O))})}function wr(r){return se(function(){return r})}function Ot(r,e){return e?function(t){return Oe(e.pipe(xe(1),Ar()),t.pipe(Ot(r)))}:Q(function(t,n){return r(t,n).pipe(xe(1),wr(t))})}function pu(r,e){e===void 0&&(e=ee);var t=we(r,e);return Ot(function(){return t})}function vu(){return y(function(r,e){r.subscribe(new E(e,function(t){return Xn(t,e)}))})}function mu(r,e){return y(function(t,n){var i=new Set;t.subscribe(new E(n,function(s){var u=r?r(s):s;i.has(u)||(i.add(u),n.next(s))})),e==null||e.subscribe(new E(n,function(){return i.clear()},O))})}function br(r,e){return e===void 0&&(e=M),r=r!=null?r:Eu,y(function(t,n){var i,s=!0;t.subscribe(new E(n,function(u){var o=e(u);(s||!r(i,o))&&(s=!1,i=o,n.next(u))}))})}function Eu(r,e){return r===e}function gu(r,e){return br(function(t,n){return e?e(t[r],n[r]):t[r]===n[r]})}function tt(r){return r===void 0&&(r=yu),y(function(e,t){var n=!1;e.subscribe(new E(t,function(i){n=!0,t.next(i)},function(){return n?t.complete():t.error(r())}))})}function yu(){return new le}function Au(r,e){if(r<0)throw new Ft;var t=arguments.length>=2;return function(n){return n.pipe(ue(function(i,s){return s===r}),xe(1),t?et(e):tt(function(){return new Ft}))}}function wu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return function(t){return Oe(t,bt.apply(void 0,S([],T(r))))}}function bu(r,e){return y(function(t,n){var i=0;t.subscribe(new E(n,function(s){r.call(e,s,i++,t)||(n.next(!1),n.complete())},function(){n.next(!0),n.complete()}))})}function xr(){return y(function(r,e){var t=!1,n=null;r.subscribe(new E(e,function(i){n||(n=R(i).subscribe(new E(e,void 0,function(){n=null,t&&e.complete()})))},function(){t=!0,!n&&e.complete()}))})}var xu=xr;function Fr(r,e){return e?function(t){return t.pipe(Fr(function(n,i){return R(r(n,i)).pipe(se(function(s,u){return e(n,s,i,u)}))}))}:y(function(t,n){var i=0,s=null,u=!1;t.subscribe(new E(n,function(o){s||(s=new E(n,void 0,function(){s=null,u&&n.complete()}),R(r(o,i++)).subscribe(s))},function(){u=!0,!s&&n.complete()}))})}function Fu(r,e,t){return e===void 0&&(e=1/0),e=(e||0)<1?1/0:e,y(function(n,i){return Rt(n,i,r,e,void 0,!0,t)})}function Cu(r){return y(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function Ru(r,e){return y(Cr(r,e,"value"))}function Cr(r,e,t){var n=t==="index";return function(i,s){var u=0;i.subscribe(new E(s,function(o){var c=u++;r.call(e,o,c,i)&&(s.next(n?c:o),s.complete())},function(){s.next(n?-1:void 0),s.complete()}))}}function Du(r,e){return y(Cr(r,e,"index"))}function Tu(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?ue(function(i,s){return r(i,s,n)}):M,xe(1),t?et(e):tt(function(){return new le}))}}function Su(r,e,t,n){return y(function(i,s){var u;!e||typeof e=="function"?u=e:(t=e.duration,u=e.element,n=e.connector);var o=new Map,c=function(f){o.forEach(f),f(s)},a=function(f){return c(function(h){return h.error(f)})},l=new Iu(s,function(f){try{var h=r(f),m=o.get(h);if(!m){o.set(h,m=n?n():new _);var p=d(h,m);if(s.next(p),t){var g=new E(m,function(){m.complete(),g==null||g.unsubscribe()},void 0,void 0,function(){return o.delete(h)});l.add(R(t(p)).subscribe(g))}}m.next(u?u(f):f)}catch(A){a(A)}},function(){return c(function(f){return f.complete()})},a,function(){return o.clear()});i.subscribe(l);function d(f,h){var m=new F(function(p){l.activeGroups++;var g=h.subscribe(p);return function(){g.unsubscribe(),--l.activeGroups===0&&l.teardownAttempted&&l.unsubscribe()}});return m.key=f,m}})}var Iu=function(r){k(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.activeGroups=0,t.teardownAttempted=!1,t}return e.prototype.unsubscribe=function(){this.teardownAttempted=!0,this.activeGroups===0&&r.prototype.unsubscribe.call(this)},e}(E);function Pu(){return y(function(r,e){r.subscribe(new E(e,function(){e.next(!1),e.complete()},function(){e.next(!0),e.complete()}))})}function Rr(r){return r<=0?function(){return K}:y(function(e,t){var n=[];e.subscribe(new E(t,function(i){n.push(i),r<n.length&&n.shift()},function(){var i,s;try{for(var u=V(n),o=u.next();!o.done;o=u.next()){var c=o.value;t.next(c)}}catch(a){i={error:a}}finally{try{o&&!o.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}t.complete()},void 0,function(){n=null}))})}function Ou(r,e){var t=arguments.length>=2;return function(n){return n.pipe(r?ue(function(i,s){return r(i,s,n)}):M,Rr(1),t?et(e):tt(function(){return new le}))}}function _u(){return y(function(r,e){r.subscribe(new E(e,function(t){e.next(Ke.createNext(t))},function(){e.next(Ke.createComplete()),e.complete()},function(t){e.next(Ke.createError(t)),e.complete()}))})}function ku(r){return ke(w(r)?function(e,t){return r(e,t)>0?e:t}:function(e,t){return e>t?e:t})}var Bu=Q;function Lu(r,e,t){return t===void 0&&(t=1/0),w(e)?Q(function(){return r},e,t):(typeof e=="number"&&(t=e),Q(function(){return r},t))}function Nu(r,e,t){return t===void 0&&(t=1/0),y(function(n,i){var s=e;return Rt(n,i,function(u,o){return r(s,u,o)},t,function(u){s=u},!1,void 0,function(){return s=null})})}function Uu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=re(r),n=Jn(r,1/0);return r=be(r),y(function(i,s){Ze(n)(Ae(S([i],T(r)),t)).subscribe(s)})}function Mu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Uu.apply(void 0,S([],T(r)))}function ju(r){return ke(w(r)?function(e,t){return r(e,t)<0?e:t}:function(e,t){return e<t?e:t})}function _t(r,e){var t=w(r)?r:function(){return r};return w(e)?Pt(e,{connector:t}):function(n){return new Ve(n,t)}}function Hu(){return y(function(r,e){var t,n=!1;r.subscribe(new E(e,function(i){var s=t;t=i,n&&e.next([s,i]),n=!0}))})}function $u(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=r.length;if(t===0)throw new Error("list of properties cannot be empty.");return se(function(n){for(var i=n,s=0;s<t;s++){var u=i==null?void 0:i[r[s]];if(typeof u<"u")i=u;else return}return i})}function qu(r){return r?function(e){return Pt(r)(e)}:function(e){return _t(new _)(e)}}function Wu(r){return function(e){var t=new Dn(r);return new Ve(e,function(){return t})}}function Gu(){return function(r){var e=new vt;return new Ve(r,function(){return e})}}function Vu(r,e,t,n){t&&!w(t)&&(n=t);var i=w(t)?t:void 0;return function(s){return _t(new pt(r,e,n),i)(s)}}function zu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return r.length?y(function(t,n){hr(S([t],T(r)))(n)}):M}function Ju(r){return r===void 0&&(r=1/0),r<=0?function(){return K}:y(function(e,t){var n=0,i,s=function(){var u=!1;i=e.subscribe(new E(t,void 0,function(){++n<r?i?(i.unsubscribe(),i=null,s()):u=!0:t.complete()})),u&&(i.unsubscribe(),i=null,s())};s()})}function Yu(r){return y(function(e,t){var n,i=!1,s,u=!1,o=!1,c=function(){return o&&u&&(t.complete(),!0)},a=function(){return s||(s=new _,r(s).subscribe(new E(t,function(){n?l():i=!0},function(){u=!0,c()}))),s},l=function(){o=!1,n=e.subscribe(new E(t,void 0,function(){o=!0,!c()&&a().next()})),i&&(n.unsubscribe(),n=null,i=!1,l())};l()})}function Xu(r){r===void 0&&(r=1/0);var e;r&&typeof r=="object"?e=r:e={count:r};var t=e.count,n=t===void 0?1/0:t,i=e.delay,s=e.resetOnSuccess,u=s===void 0?!1:s;return n<=0?M:y(function(o,c){var a=0,l,d=function(){var f=!1;l=o.subscribe(new E(c,function(h){u&&(a=0),c.next(h)},void 0,function(h){if(a++<n){var m=function(){l?(l.unsubscribe(),l=null,d()):f=!0};if(i!=null){var p=typeof i=="number"?we(i):R(i(h,a)),g=new E(c,function(){g.unsubscribe(),m()},function(){c.complete()});p.subscribe(g)}else m()}else c.error(h)})),f&&(l.unsubscribe(),l=null,d())};d()})}function Ku(r){return y(function(e,t){var n,i=!1,s,u=function(){n=e.subscribe(new E(t,void 0,void 0,function(o){s||(s=new _,r(s).subscribe(new E(t,function(){return n?u():i=!0}))),s&&s.next(o)})),i&&(n.unsubscribe(),n=null,i=!1,u())};u()})}function Dr(r){return y(function(e,t){var n=!1,i=null;e.subscribe(new E(t,function(u){n=!0,i=u}));var s=function(){if(n){n=!1;var u=i;i=null,t.next(u)}};r.subscribe(new E(t,s,O))})}function Qu(r,e){return e===void 0&&(e=ee),Dr(lr(r,e))}function Tr(r,e){return y(vr(r,e,arguments.length>=2,!0))}function Zu(r,e){return e===void 0&&(e=function(t,n){return t===n}),y(function(t,n){var i=Sr(),s=Sr(),u=function(c){n.next(c),n.complete()},o=function(c,a){var l=new E(n,function(d){var f=a.buffer,h=a.complete;f.length===0?h?u(!1):c.buffer.push(d):!e(d,f.shift())&&u(!1)},function(){c.complete=!0;var d=a.complete,f=a.buffer;d&&u(f.length===0),l==null||l.unsubscribe()});return l};t.subscribe(o(i,s)),r.subscribe(o(s,i))})}function Sr(){return{buffer:[],complete:!1}}function Ir(r){r===void 0&&(r={});var e=r.connector,t=e===void 0?function(){return new _}:e,n=r.resetOnError,i=n===void 0?!0:n,s=r.resetOnComplete,u=s===void 0?!0:s,o=r.resetOnRefCountZero,c=o===void 0?!0:o;return function(a){var l=null,d=null,f=null,h=0,m=!1,p=!1,g=function(){d==null||d.unsubscribe(),d=null},A=function(){g(),l=f=null,m=p=!1},I=function(){var G=l;A(),G==null||G.unsubscribe()};return y(function(G,B){h++,!p&&!m&&g();var W=f=f!=null?f:t();B.add(function(){h--,h===0&&!p&&!m&&(d=kt(I,c))}),W.subscribe(B),l||(l=new Ge({next:function(X){return W.next(X)},error:function(X){p=!0,g(),d=kt(A,i,X),W.error(X)},complete:function(){m=!0,g(),d=kt(A,u),W.complete()}}),ye(G).subscribe(l))})(a)}}function kt(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];return e===!0?(r(),null):e===!1?null:e.apply(void 0,S([],T(t))).pipe(xe(1)).subscribe(function(){return r()})}function eo(r,e,t){var n,i,s,u=!1;return r&&typeof r=="object"?(s=(n=r.bufferSize)!==null&&n!==void 0?n:1/0,e=(i=r.windowTime)!==null&&i!==void 0?i:1/0,u=!!r.refCount,t=r.scheduler):s=r!=null?r:1/0,Ir({connector:function(){return new pt(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}function to(r){return y(function(e,t){var n=!1,i,s=!1,u=0;e.subscribe(new E(t,function(o){s=!0,(!r||r(o,u++,e))&&(n&&t.error(new Qn("Too many matching values")),n=!0,i=o)},function(){n?(t.next(i),t.complete()):t.error(s?new Kn("No matching values"):new le)}))})}function no(r){return ue(function(e,t){return r<=t})}function ro(r){return r<=0?M:y(function(e,t){var n=new Array(r),i=0;return e.subscribe(new E(t,function(s){var u=i++;if(u<r)n[u]=s;else{var o=u%r,c=n[o];n[o]=s,t.next(c)}})),function(){n=null}})}function io(r){return y(function(e,t){var n=!1,i=new E(t,function(){i==null||i.unsubscribe(),n=!0},O);R(r).subscribe(i),e.subscribe(new E(t,function(s){return n&&t.next(s)}))})}function so(r){return y(function(e,t){var n=!1,i=0;e.subscribe(new E(t,function(s){return(n||(n=!r(s,i++)))&&t.next(s)}))})}function uo(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=re(r);return y(function(n,i){(t?Oe(r,n,t):Oe(r,n)).subscribe(i)})}function Be(r,e){return y(function(t,n){var i=null,s=0,u=!1,o=function(){return u&&!i&&n.complete()};t.subscribe(new E(n,function(c){i==null||i.unsubscribe();var a=0,l=s++;R(r(c,l)).subscribe(i=new E(n,function(d){return n.next(e?e(c,d,l,a++):d)},function(){i=null,o()}))},function(){u=!0,o()}))})}function oo(){return Be(M)}function ao(r,e){return w(e)?Be(function(){return r},e):Be(function(){return r})}function co(r,e){return y(function(t,n){var i=e;return Be(function(s,u){return r(i,s,u)},function(s,u){return i=u,u})(t).subscribe(n),function(){i=null}})}function lo(r){return y(function(e,t){R(r).subscribe(new E(t,function(){return t.complete()},O)),!t.closed&&e.subscribe(t)})}function fo(r,e){return e===void 0&&(e=!1),y(function(t,n){var i=0;t.subscribe(new E(n,function(s){var u=r(s,i++);(u||e)&&n.next(s),!u&&n.complete()}))})}function ho(r,e,t){var n=w(r)||e||t?{next:r,error:e,complete:t}:r;return n?y(function(i,s){var u;(u=n.subscribe)===null||u===void 0||u.call(n);var o=!0;i.subscribe(new E(s,function(c){var a;(a=n.next)===null||a===void 0||a.call(n,c),s.next(c)},function(){var c;o=!1,(c=n.complete)===null||c===void 0||c.call(n),s.complete()},function(c){var a;o=!1,(a=n.error)===null||a===void 0||a.call(n,c),s.error(c)},function(){var c,a;o&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(a=n.finalize)===null||a===void 0||a.call(n)}))}):M}var Pr={leading:!0,trailing:!1};function Or(r,e){var t=e===void 0?Pr:e,n=t.leading,i=t.trailing;return y(function(s,u){var o=!1,c=null,a=null,l=!1,d=function(){a==null||a.unsubscribe(),a=null,i&&(m(),l&&u.complete())},f=function(){a=null,l&&u.complete()},h=function(p){return a=R(r(p)).subscribe(new E(u,d,f))},m=function(){if(o){o=!1;var p=c;c=null,u.next(p),!l&&h(p)}};s.subscribe(new E(u,function(p){o=!0,c=p,!(a&&!a.closed)&&(n?m():h(p))},function(){l=!0,!(i&&o&&a&&!a.closed)&&u.complete()}))})}function po(r,e,t){e===void 0&&(e=ee),t===void 0&&(t=Pr);var n=we(r,e);return Or(function(){return n},t)}function vo(r){return r===void 0&&(r=Ie),function(e){return _e(function(){return e.pipe(Tr(function(t,n){var i=t.current;return{value:n,current:r.now(),last:i}},{current:r.now(),value:void 0,last:void 0}),se(function(t){var n=t.current,i=t.last,s=t.value;return new mo(s,n-i)}))})}}var mo=function(){function r(e,t){this.value=e,this.interval=t}return r}();function Eo(r,e,t){var n,i,s;if(t=t!=null?t:Ie,Ct(r)?n=r:typeof r=="number"&&(i=r),e)s=function(){return e};else throw new TypeError("No observable provided to switch to");if(n==null&&i==null)throw new TypeError("No timeout provided.");return er({first:n,each:i,scheduler:t,with:s})}function go(r){return r===void 0&&(r=ze),se(function(e){return{value:e,timestamp:r.now()}})}function yo(r){return y(function(e,t){var n=new _;t.next(n.asObservable());var i=function(s){n.error(s),t.error(s)};return e.subscribe(new E(t,function(s){return n==null?void 0:n.next(s)},function(){n.complete(),t.complete()},i)),r.subscribe(new E(t,function(){n.complete(),t.next(n=new _)},O,i)),function(){n==null||n.unsubscribe(),n=null}})}function Ao(r,e){e===void 0&&(e=0);var t=e>0?e:r;return y(function(n,i){var s=[new _],u=[],o=0;i.next(s[0].asObservable()),n.subscribe(new E(i,function(c){var a,l;try{for(var d=V(s),f=d.next();!f.done;f=d.next()){var h=f.value;h.next(c)}}catch(g){a={error:g}}finally{try{f&&!f.done&&(l=d.return)&&l.call(d)}finally{if(a)throw a.error}}var m=o-r+1;if(m>=0&&m%t===0&&s.shift().complete(),++o%t===0){var p=new _;s.push(p),i.next(p.asObservable())}},function(){for(;s.length>0;)s.shift().complete();i.complete()},function(c){for(;s.length>0;)s.shift().error(c);i.error(c)},function(){u=null,s=null}))})}function wo(r){for(var e,t,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var s=(e=re(n))!==null&&e!==void 0?e:ee,u=(t=n[0])!==null&&t!==void 0?t:null,o=n[1]||1/0;return y(function(c,a){var l=[],d=!1,f=function(g){var A=g.window,I=g.subs;A.complete(),I.unsubscribe(),ne(l,g),d&&h()},h=function(){if(l){var g=new U;a.add(g);var A=new _,I={window:A,subs:g,seen:0};l.push(I),a.next(A.asObservable()),g.add(s.schedule(function(){return f(I)},r))}};u!==null&&u>=0?a.add(s.schedule(function(){h(),!this.closed&&a.add(this.schedule(null,u))},u)):d=!0,h();var m=function(g){return l.slice().forEach(g)},p=function(g){m(function(A){var I=A.window;return g(I)}),g(a),a.unsubscribe()};return c.subscribe(new E(a,function(g){m(function(A){A.window.next(g),o<=++A.seen&&f(A)})},function(){return p(function(g){return g.complete()})},function(g){return p(function(A){return A.error(g)})})),function(){l=null}})}function bo(r,e){return y(function(t,n){var i=[],s=function(u){for(;0<i.length;)i.shift().error(u);n.error(u)};R(r).subscribe(new E(n,function(u){var o=new _;i.push(o);var c=new U,a=function(){ne(i,o),o.complete(),c.unsubscribe()},l;try{l=R(e(u))}catch(d){s(d);return}n.next(o.asObservable()),c.add(l.subscribe(new E(n,a,O,s)))},O)),t.subscribe(new E(n,function(u){var o,c,a=i.slice();try{for(var l=V(a),d=l.next();!d.done;d=l.next()){var f=d.value;f.next(u)}}catch(h){o={error:h}}finally{try{d&&!d.done&&(c=l.return)&&c.call(l)}finally{if(o)throw o.error}}},function(){for(;0<i.length;)i.shift().complete();n.complete()},s,function(){for(;0<i.length;)i.shift().unsubscribe()}))})}function xo(r){return y(function(e,t){var n,i,s=function(o){n.error(o),t.error(o)},u=function(){i==null||i.unsubscribe(),n==null||n.complete(),n=new _,t.next(n.asObservable());var o;try{o=R(r())}catch(c){s(c);return}o.subscribe(i=new E(t,u,u,s))};u(),e.subscribe(new E(t,function(o){return n.next(o)},function(){n.complete(),t.complete()},s,function(){i==null||i.unsubscribe(),n=null}))})}function Fo(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Pe(r);return y(function(n,i){for(var s=r.length,u=new Array(s),o=r.map(function(){return!1}),c=!1,a=function(d){R(r[d]).subscribe(new E(i,function(f){u[d]=f,!c&&!o[d]&&(o[d]=!0,(c=o.every(M))&&(o=null))},O))},l=0;l<s;l++)a(l);n.subscribe(new E(i,function(d){if(c){var f=S([d],T(u));i.next(t?t.apply(void 0,S([],T(f))):f)}}))})}function Co(r){return Er(St,r)}function Ro(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return y(function(t,n){St.apply(void 0,S([t],T(r))).subscribe(n)})}function Do(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ro.apply(void 0,S([],T(r)))}const To=Object.freeze(Object.defineProperty({__proto__:null,Observable:F,ConnectableObservable:Ve,observable:De,animationFrames:qi,Subject:_,BehaviorSubject:Dn,ReplaySubject:pt,AsyncSubject:vt,asap:Ki,asapScheduler:In,async:Ie,asyncScheduler:ee,queue:es,queueScheduler:Pn,animationFrame:rs,animationFrameScheduler:On,VirtualTimeScheduler:is,VirtualAction:_n,Scheduler:gt,Subscription:U,Subscriber:We,Notification:Ke,get NotificationKind(){return xt},pipe:dt,noop:O,identity:M,isObservable:ms,lastValueFrom:Es,firstValueFrom:gs,ArgumentOutOfRangeError:Ft,EmptyError:le,NotFoundError:Kn,ObjectUnsubscribedError:Cn,SequenceError:Qn,TimeoutError:Zn,UnsubscriptionError:He,bindCallback:bs,bindNodeCallback:xs,combineLatest:sr,concat:Oe,connectable:Is,defer:_e,empty:ss,forkJoin:Ps,from:ye,fromEvent:Tt,fromEventPattern:cr,generate:Us,iif:Ms,interval:lr,merge:js,never:Hs,of:bt,onErrorResumeNext:Ws,pairs:Gs,partition:zs,race:Js,range:Ys,throwError:Yn,timer:we,using:Xs,zip:St,scheduled:Gn,EMPTY:K,NEVER:fr,config:ie,audit:dr,auditTime:Ks,buffer:Qs,bufferCount:Zs,bufferTime:eu,bufferToggle:tu,bufferWhen:nu,catchError:pr,combineAll:iu,combineLatestAll:gr,combineLatestWith:su,concatAll:Dt,concatMap:It,concatMapTo:uu,concatWith:au,connect:Pt,count:fu,debounce:hu,debounceTime:du,defaultIfEmpty:et,delay:pu,delayWhen:Ot,dematerialize:vu,distinct:mu,distinctUntilChanged:br,distinctUntilKeyChanged:gu,elementAt:Au,endWith:wu,every:bu,exhaust:xu,exhaustAll:xr,exhaustMap:Fr,expand:Fu,filter:ue,finalize:Cu,find:Ru,findIndex:Du,first:Tu,groupBy:Su,ignoreElements:Ar,isEmpty:Pu,last:Ou,map:se,mapTo:wr,materialize:_u,max:ku,mergeAll:Ze,flatMap:Bu,mergeMap:Q,mergeMapTo:Lu,mergeScan:Nu,mergeWith:Mu,min:ju,multicast:_t,observeOn:nr,pairwise:Hu,pluck:$u,publish:qu,publishBehavior:Wu,publishLast:Gu,publishReplay:Vu,raceWith:zu,reduce:ke,repeat:Ju,repeatWhen:Yu,retry:Xu,retryWhen:Ku,refCount:bn,sample:Dr,sampleTime:Qu,scan:Tr,sequenceEqual:Zu,share:Ir,shareReplay:eo,single:to,skip:no,skipLast:ro,skipUntil:io,skipWhile:so,startWith:uo,subscribeOn:tr,switchAll:oo,switchMap:Be,switchMapTo:ao,switchScan:co,take:xe,takeLast:Rr,takeUntil:lo,takeWhile:fo,tap:ho,throttle:Or,throttleTime:po,throwIfEmpty:tt,timeInterval:vo,timeout:er,timeoutWith:Eo,timestamp:go,toArray:mr,window:yo,windowCount:Ao,windowTime:wo,windowToggle:bo,windowWhen:xo,withLatestFrom:Fo,zipAll:Co,zipWith:Do},Symbol.toStringTag,{value:"Module"}));class So{constructor(){v(this,"agents",{});v(this,"comm",new _)}setAgentFor(e,t,n){let i=this.getActionMapping(e);i[t]=n}getAgentFor(e,t){return this.getActionMapping(e)[t]}publish(e,t,n){return Promise.resolve().then(()=>{var i;return(i=this.getAgentFor(e,t))!=null?i:_r.requestAgentFor(e,t)}).then(i=>{const s=i.activate(e,t,n);return this.comm.next({res:e,action:t,input:n,output:s}),s})}subscribe(e,t){return this.comm.asObservable().pipe(ue(n=>n.res===e&&n.action===t))}getActionMapping(e){let t=this.agents[e];if(typeof t>"u"){t={};for(let n of Object.values(D))t[n]=null;this.agents[e]=t}return t}}class Bt{static get instance(){return this._instance=this._instance||new So}}v(Bt,"_instance");const P=class{constructor(e){v(this,"managedResource");v(this,"handlerFor",{comment:P.defaultHandler,copy:P.defaultHandler,create:P.defaultHandler,delete:P.defaultHandler,export:P.defaultHandler,initialize:P.defaultHandler,manage:P.defaultHandler,properties:P.defaultHandler,move:P.defaultHandler,open:P.defaultHandler,print:P.defaultHandler,publish:P.defaultHandler,search:P.defaultHandler,share:P.defaultHandler,distribute:P.defaultHandler,pages_list:P.defaultHandler,register:P.defaultHandler,trash:P.defaultHandler,publish_moodle:P.defaultHandler,restore:P.defaultHandler});this.managedResource=e,this.initialize()}initialize(){for(let e in Object.values(D))this.handlerFor[e]=P.defaultHandler;this.registerHandlers()}setHandler(e,t){Bt.instance.setAgentFor(this.managedResource,e,this),this.handlerFor[e]=t}getHandler(e){return this.handlerFor[e]}activate(e,t,n){return Promise.resolve().then(()=>this.getHandler(t).bind(this)(n))}};let Le=P;v(Le,"defaultHandler",function(e){throw new Error(C.NOT_SUPPORTED)}),console.log("Blog agent loading....");class Io extends Le{constructor(){super(z.BLOG);v(this,"ctx",null);v(this,"http",sn.instance().newHttpInstance());v(this,"checkHttpResponse",t=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return t});this.registerHandlers(),console.log("Blog agent initialized!")}registerHandlers(){this.setHandler(D.OPEN,this.openBlog),this.setHandler(D.CREATE,this.createBlog),this.setHandler(D.MANAGE,this.onManage),this.setHandler(D.UPD_PROPS,this.onUpdateProps),this.setHandler(D.PRINT,this.onPrint),this.setHandler(D.PUBLISH,this.onPublish)}onPrint(t){window.open(`/blog/print/blog#/print/${t.resourceId}?comments=${t.withComments||!0}`,"_blank")}openBlog(t){window.open(`/blog#/view/${t.resourceId}`,"_self")}createBlog(t){window.open("/blog#/edit/new","_self")}onManage(t){const n={genericProps:[{key:he.TITLE},{key:he.IMAGE},{key:he.URL}]};return Promise.resolve().then(()=>n)}onUpdateProps(t){const n={resources:t.resources};return alert("TODO: update properties"),Promise.resolve().then(()=>n)}async onPublish(t){const n=new FormData;return n.append("title",t.title),n.append("cover",t.cover),n.append("coverName",t.cover.name),n.append("coverType",t.cover.type),n.append("teacherAvatar",t.teacherAvatar),n.append("teacherAvatarName",t.teacherAvatar.name||`teacherAvatar_${t.userId}`),n.append("teacherAvatarType",t.teacherAvatar.type),n.append("language",t.language),t.activityType.forEach(s=>{n.append("activityType[]",s)}),t.subjectArea.forEach(s=>{n.append("subjectArea[]",s)}),t.age.forEach(s=>{n.append("age[]",s.toString())}),n.append("description",t.description),t.keyWords.split(",").forEach(s=>{n.append("keyWords[]",s.trim())}),n.append("licence",t.licence),n.append("pdfUri",`${window.location.origin}/blog/print/blog#/print/${t.resourceId}`),n.append("application",t.application?t.application:""),n.append("resourceId",t.resourceId),n.append("teacherSchool",t.userStructureName),this.http.post("/appregistry/library/resource",n,{headers:{"Content-Type":"multipart/form-data"}}).then(this.checkHttpResponse)}}const Po=()=>new Io;class Oo extends Le{constructor(){super(z.FOLDER);v(this,"ctx",null);v(this,"http",sn.instance().newHttpInstance({paramsSerializer:function(t){return Object.entries(t).map(n=>n[1]instanceof Array?n[1].map(i=>`${n[0]}=${encodeURIComponent(i)}`).join("&"):["string","number","boolean"].indexOf(typeof n[1])>=0?`${n[0]}=${encodeURIComponent(n[1])}`:"").join("&")}}));v(this,"checkHttpResponse",t=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return t});this.registerHandlers()}registerHandlers(){this.setHandler(D.INITIALIZE,this.createContext),this.setHandler(D.SEARCH,this.searchContext),this.setHandler(D.CREATE,this.createFolder),this.setHandler(D.OPEN,this.listSubfolders),this.setHandler(D.MOVE,this.moveToFolder),this.setHandler(D.DELETE,this.deleteFolders),this.setHandler(D.TRASH,this.trashFolders),this.setHandler(D.MANAGE,this.onManage),this.setHandler(D.UPD_PROPS,this.updateFolder)}createContext(t){return this.http.get("/explorer/context",{queryParams:this.toQueryParams(t)}).then(this.checkHttpResponse)}searchContext(t){return this.http.get("/explorer/resources",{queryParams:this.toQueryParams(t)}).then(this.checkHttpResponse)}createFolder(t){return this.http.post("/explorer/folders",this.createFolderToBodyParams(t)).then(this.checkHttpResponse)}updateFolder(t){return this.http.put(`/explorer/folders/${t.folderId}`,this.createFolderToBodyParams(t)).then(this.checkHttpResponse)}moveToFolder(t){return this.http.post(`/explorer/folders/${t.folderId}/move`,this.moveToBodyParams(t)).then(this.checkHttpResponse)}listSubfolders(t){return this.http.get(`/explorer/folders/${t}/move`).then(this.checkHttpResponse)}deleteFolders(t){return this.http.deleteJson("/explorer",t).then(this.checkHttpResponse)}trashFolders({trash:t,resourceType:n,...i}){return this.http.putJson(`/explorer/${t?"trash":"restore"}`,i).then(this.checkHttpResponse)}onManage(t){const n={genericProps:[{key:he.TITLE},{key:he.IMAGE},{key:he.URL}]};return Promise.resolve().then(()=>n)}toQueryParams(t){let n={application:t.app,start_idx:t.pagination.startIdx,page_size:t.pagination.pageSize,resource_type:t.types};return t.orders&&(n.order_by=Object.entries(t.orders).map(i=>`${i[0]}:${i[1]}`)),t.filters&&Object.assign(n,t.filters),typeof t.search=="string"&&(n.search=t.search),n}createFolderToBodyParams(t){return{application:t.app,resourceType:t.type,parentId:t.parentId,name:t.name}}moveToBodyParams(t){return{application:t.application,resourceType:this.managedResource,resourceIds:t.resourceIds,folderIds:t.folderIds}}}const _o=()=>new Oo;class ko{load(e){let t=Br[e];if(typeof t!="string")throw new Error(`The resource type ${e} is not supported yet.`);switch(t){case H.EXPLORER:_o();break;case H.BLOG:Po();break;default:throw new Error(`The resource type ${e} is not supported yet.`)}return Promise.resolve()}}class Bo{constructor(e,t){v(this,"searchParameters");v(this,"context");v(this,"bus");v(this,"latestResults",new _);this.context=null,this.bus=kr.instance().getBus(),this.searchParameters={types:e,app:t,filters:{},pagination:{startIdx:0,pageSize:20}}}clear(){this.searchParameters.filters={owner:!0,shared:!0,public:!0},this.searchParameters.pagination.startIdx=0,this.searchParameters.pagination.pageSize=20,this.context=null}isInitialized(){return this.context!==null}getContext(){if(this.context!==null)return this.context}getSearchParameters(){return this.searchParameters}duplicateSearchParameters(){return JSON.parse(JSON.stringify(this.searchParameters))}latestResources(){return this.latestResults.asObservable()}initialize(){const e=this.duplicateSearchParameters();return Promise.resolve().then(()=>this.bus.publish(z.FOLDER,D.INITIALIZE,e)).then(t=>{if(this.context=t,!this.context)throw new Error(C.UNKNOWN);return this.latestResults.next({input:e,output:this.context}),this.context})}getResources(){const e=this.duplicateSearchParameters();return this.bus.publish(z.FOLDER,D.SEARCH,e).then(t=>{let n=t;if(!n)throw new Error(C.UNKNOWN);return this.latestResults.next({input:e,output:n}),n})}getSubFolders(e){throw new Error("Method not implemented.")}createFolder(e,t,n){const i={app:this.searchParameters.app,name:n,parentId:t,type:e};return this.bus.publish(z.FOLDER,D.CREATE,i).then(s=>{let u=s;if(!u)throw new Error(C.UNKNOWN);return u})}updateFolder(e,t,n,i){const s={folderId:e,app:this.searchParameters.app,name:i,parentId:n,type:t};return this.bus.publish(z.FOLDER,D.UPD_PROPS,s).then(u=>{let o=u;if(!o)throw new Error(C.UNKNOWN);return o})}copy(e,t,n){const i={application:this.searchParameters.app,folderId:e,resourceIds:t,folderIds:n};return this.bus.publish(z.FOLDER,D.COPY,i).then(s=>{})}move(e,t,n){const i={application:this.searchParameters.app,folderId:e,resourceIds:t,folderIds:n};return this.bus.publish(z.FOLDER,D.MOVE,i).then(s=>{})}delete(e,t){const n={application:this.searchParameters.app,resourceType:this.searchParameters.types[0],resourceIds:e,folderIds:t};return this.bus.publish(z.FOLDER,D.DELETE,n).then(i=>{})}trash(e,t,n){const i={trash:e,application:this.searchParameters.app,resourceType:this.searchParameters.types[0],resourceIds:t,folderIds:n};return this.bus.publish(z.FOLDER,D.TRASH,i).then(s=>{})}manageProperties(e,t){const n={resources:t};return this.bus.publish(e,D.MANAGE,n).then(i=>{let s=i;if(!s)throw new Error(C.UNKNOWN);return s})}updateProperties(e,t,n){const i={resources:t,props:n};return this.bus.publish(e,D.UPD_PROPS,i).then(s=>{let u=s;if(!u)throw new Error(C.UNKNOWN);return u})}publish(e,t){return this.bus.publish(e,D.PUBLISH,t).then(n=>{let i=n;if(!i)throw new Error(C.UNKNOWN);return i})}}class Lo{constructor(){v(this,"_agentLoader")}get agentLoader(){return this._agentLoader||(this._agentLoader=new ko),this._agentLoader}setAgentLoader(e){e&&(this._agentLoader=e)}requestAgentFor(e,t){return this.agentLoader.load(e).then(()=>{let n=this.getBus().getAgentFor(e,t);if(!n)throw new Error(C.AGENT_NOT_FOUND);return n})}createContext(e,t){return new Bo(e,t)}getBus(){return Bt.instance}}const _r=new Lo;class kr{static instance(){return _r}}const z={FOLDER:"folder",BLOG:"blog",EXERCISE:"exercise"},Br={folder:H.EXPLORER,blog:H.BLOG,exercise:H.EXERCIZER},D={INITIALIZE:"initialize",SEARCH:"search",CREATE:"create",OPEN:"open",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"},No={BIN:"bin",DEFAULT:"default"},Uo={OWNER:"owner",SHARED:"shared",PUBLIC:"public",FAVORITE:"favorite"},Mo={},jo={ASC:"asc",DESC:"desc"},Ho={NAME:"name",MODIFY_DATE:"updatedAt",CREATEDAT:"createdAt",APPLICATION:"application",RESOURCE_TYPE:"resourceType"},he={TITLE:"title",IMAGE:"image",COLOR:"color",DESCRIPTION:"description",URL:"url"},$o={READONLY:"RO",READWRITE:"RW"},qo={TEXT:"text",NUMBER:"number",DATE:"date",IMAGE:"image"},Wo={PLAIN:"plain"},nt={SESSION_READY:"sessionReady",LANG_READY:"langReady",SKIN_READY:"skinReady",OVERRIDE_READY:"overrideReady"};class Ne{constructor(){v(this,"_resolution");v(this,"_rejection");v(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 Go{constructor(){v(this,"promises",{});v(this,"subject",new _)}asyncData(e){return typeof this.promises[e]>"u"&&(this.promises[e]=new Ne),this.promises[e]}onSessionReady(){return this.asyncData(nt.SESSION_READY)}onLangReady(){return this.asyncData(nt.LANG_READY)}onSkinReady(){return this.asyncData(nt.SKIN_READY)}onOverridesReady(){return this.asyncData(nt.OVERRIDE_READY)}promisify(){return new Ne}events(){return this.subject}}const N=new Go;class Vo{static instance(){return N}}const Lr={WIDGETS:"widgets",EXPLORER:"explorer"},Nr={USERPREF_CHANGED:"userprefChanged",SEARCH_RESULTED:"searchResulted"};function zo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ur={exports:{}},Lt={exports:{}},Mr=function(e,t){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(t,i)}},Jo=Mr,de=Object.prototype.toString;function Nt(r){return de.call(r)==="[object Array]"}function Ut(r){return typeof r>"u"}function Yo(r){return r!==null&&!Ut(r)&&r.constructor!==null&&!Ut(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function Xo(r){return de.call(r)==="[object ArrayBuffer]"}function Ko(r){return typeof FormData<"u"&&r instanceof FormData}function Qo(r){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&r.buffer instanceof ArrayBuffer,e}function Zo(r){return typeof r=="string"}function ea(r){return typeof r=="number"}function jr(r){return r!==null&&typeof r=="object"}function rt(r){if(de.call(r)!=="[object Object]")return!1;var e=Object.getPrototypeOf(r);return e===null||e===Object.prototype}function ta(r){return de.call(r)==="[object Date]"}function na(r){return de.call(r)==="[object File]"}function ra(r){return de.call(r)==="[object Blob]"}function Hr(r){return de.call(r)==="[object Function]"}function ia(r){return jr(r)&&Hr(r.pipe)}function sa(r){return typeof URLSearchParams<"u"&&r instanceof URLSearchParams}function ua(r){return r.replace(/^\s*/,"").replace(/\s*$/,"")}function oa(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function Mt(r,e){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),Nt(r))for(var t=0,n=r.length;t<n;t++)e.call(null,r[t],t,r);else for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.call(null,r[i],i,r)}function jt(){var r={};function e(i,s){rt(r[s])&&rt(i)?r[s]=jt(r[s],i):rt(i)?r[s]=jt({},i):Nt(i)?r[s]=i.slice():r[s]=i}for(var t=0,n=arguments.length;t<n;t++)Mt(arguments[t],e);return r}function aa(r,e,t){return Mt(e,function(i,s){t&&typeof i=="function"?r[s]=Jo(i,t):r[s]=i}),r}function ca(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}var Y={isArray:Nt,isArrayBuffer:Xo,isBuffer:Yo,isFormData:Ko,isArrayBufferView:Qo,isString:Zo,isNumber:ea,isObject:jr,isPlainObject:rt,isUndefined:Ut,isDate:ta,isFile:na,isBlob:ra,isFunction:Hr,isStream:ia,isURLSearchParams:sa,isStandardBrowserEnv:oa,forEach:Mt,merge:jt,extend:aa,trim:ua,stripBOM:ca},Fe=Y;function $r(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var qr=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(Fe.isURLSearchParams(t))i=t.toString();else{var s=[];Fe.forEach(t,function(c,a){c===null||typeof c>"u"||(Fe.isArray(c)?a=a+"[]":c=[c],Fe.forEach(c,function(d){Fe.isDate(d)?d=d.toISOString():Fe.isObject(d)&&(d=JSON.stringify(d)),s.push($r(a)+"="+$r(d))}))}),i=s.join("&")}if(i){var u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e},la=Y;function it(){this.handlers=[]}it.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},it.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},it.prototype.forEach=function(e){la.forEach(this.handlers,function(n){n!==null&&e(n)})};var fa=it,ha=Y,da=function(e,t,n){return ha.forEach(n,function(s){e=s(e,t)}),e},Ht,Wr;function Gr(){return Wr||(Wr=1,Ht=function(e){return!!(e&&e.__CANCEL__)}),Ht}var pa=Y,va=function(e,t){pa.forEach(e,function(i,s){s!==t&&s.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[s])})},$t,Vr;function ma(){return Vr||(Vr=1,$t=function(e,t,n,i,s){return e.config=t,n&&(e.code=n),e.request=i,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}),$t}var qt,zr;function Jr(){if(zr)return qt;zr=1;var r=ma();return qt=function(t,n,i,s,u){var o=new Error(t);return r(o,n,i,s,u)},qt}var Wt,Yr;function Ea(){if(Yr)return Wt;Yr=1;var r=Jr();return Wt=function(t,n,i){var s=i.config.validateStatus;!i.status||!s||s(i.status)?t(i):n(r("Request failed with status code "+i.status,i.config,null,i.request,i))},Wt}var Gt,Xr;function ga(){if(Xr)return Gt;Xr=1;var r=Y;return Gt=r.isStandardBrowserEnv()?function(){return{write:function(n,i,s,u,o,c){var a=[];a.push(n+"="+encodeURIComponent(i)),r.isNumber(s)&&a.push("expires="+new Date(s).toGMTString()),r.isString(u)&&a.push("path="+u),r.isString(o)&&a.push("domain="+o),c===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(n){var i=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Gt}var Vt,Kr;function ya(){return Kr||(Kr=1,Vt=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}),Vt}var zt,Qr;function Aa(){return Qr||(Qr=1,zt=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}),zt}var Jt,Zr;function wa(){if(Zr)return Jt;Zr=1;var r=ya(),e=Aa();return Jt=function(n,i){return n&&!r(i)?e(n,i):i},Jt}var Yt,ei;function ba(){if(ei)return Yt;ei=1;var r=Y,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return Yt=function(n){var i={},s,u,o;return n&&r.forEach(n.split(`
17
- `),function(a){if(o=a.indexOf(":"),s=r.trim(a.substr(0,o)).toLowerCase(),u=r.trim(a.substr(o+1)),s){if(i[s]&&e.indexOf(s)>=0)return;s==="set-cookie"?i[s]=(i[s]?i[s]:[]).concat([u]):i[s]=i[s]?i[s]+", "+u:u}}),i},Yt}var Xt,ti;function xa(){if(ti)return Xt;ti=1;var r=Y;return Xt=r.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a"),i;function s(u){var o=u;return t&&(n.setAttribute("href",o),o=n.href),n.setAttribute("href",o),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return i=s(window.location.href),function(o){var c=r.isString(o)?s(o):o;return c.protocol===i.protocol&&c.host===i.host}}():function(){return function(){return!0}}(),Xt}var Kt,ni;function ri(){if(ni)return Kt;ni=1;var r=Y,e=Ea(),t=ga(),n=qr,i=wa(),s=ba(),u=xa(),o=Jr();return Kt=function(a){return new Promise(function(d,f){var h=a.data,m=a.headers;r.isFormData(h)&&delete m["Content-Type"];var p=new XMLHttpRequest;if(a.auth){var g=a.auth.username||"",A=a.auth.password?unescape(encodeURIComponent(a.auth.password)):"";m.Authorization="Basic "+btoa(g+":"+A)}var I=i(a.baseURL,a.url);if(p.open(a.method.toUpperCase(),n(I,a.params,a.paramsSerializer),!0),p.timeout=a.timeout,p.onreadystatechange=function(){if(!(!p||p.readyState!==4)&&!(p.status===0&&!(p.responseURL&&p.responseURL.indexOf("file:")===0))){var W="getAllResponseHeaders"in p?s(p.getAllResponseHeaders()):null,X=!a.responseType||a.responseType==="text"?p.responseText:p.response,dn={data:X,status:p.status,statusText:p.statusText,headers:W,config:a,request:p};e(d,f,dn),p=null}},p.onabort=function(){!p||(f(o("Request aborted",a,"ECONNABORTED",p)),p=null)},p.onerror=function(){f(o("Network Error",a,null,p)),p=null},p.ontimeout=function(){var W="timeout of "+a.timeout+"ms exceeded";a.timeoutErrorMessage&&(W=a.timeoutErrorMessage),f(o(W,a,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var G=(a.withCredentials||u(I))&&a.xsrfCookieName?t.read(a.xsrfCookieName):void 0;G&&(m[a.xsrfHeaderName]=G)}if("setRequestHeader"in p&&r.forEach(m,function(W,X){typeof h>"u"&&X.toLowerCase()==="content-type"?delete m[X]:p.setRequestHeader(X,W)}),r.isUndefined(a.withCredentials)||(p.withCredentials=!!a.withCredentials),a.responseType)try{p.responseType=a.responseType}catch(B){if(a.responseType!=="json")throw B}typeof a.onDownloadProgress=="function"&&p.addEventListener("progress",a.onDownloadProgress),typeof a.onUploadProgress=="function"&&p.upload&&p.upload.addEventListener("progress",a.onUploadProgress),a.cancelToken&&a.cancelToken.promise.then(function(W){!p||(p.abort(),f(W),p=null)}),h||(h=null),p.send(h)})},Kt}var J=Y,ii=va,Fa={"Content-Type":"application/x-www-form-urlencoded"};function si(r,e){!J.isUndefined(r)&&J.isUndefined(r["Content-Type"])&&(r["Content-Type"]=e)}function Ca(){var r;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(r=ri()),r}var st={adapter:Ca(),transformRequest:[function(e,t){return ii(t,"Accept"),ii(t,"Content-Type"),J.isFormData(e)||J.isArrayBuffer(e)||J.isBuffer(e)||J.isStream(e)||J.isFile(e)||J.isBlob(e)?e:J.isArrayBufferView(e)?e.buffer:J.isURLSearchParams(e)?(si(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):J.isObject(e)?(si(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};st.headers={common:{Accept:"application/json, text/plain, */*"}},J.forEach(["delete","get","head"],function(e){st.headers[e]={}}),J.forEach(["post","put","patch"],function(e){st.headers[e]=J.merge(Fa)});var ui=st,oi=Y,Qt=da,Ra=Gr(),Da=ui;function Zt(r){r.cancelToken&&r.cancelToken.throwIfRequested()}var Ta=function(e){Zt(e),e.headers=e.headers||{},e.data=Qt(e.data,e.headers,e.transformRequest),e.headers=oi.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),oi.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||Da.adapter;return t(e).then(function(i){return Zt(e),i.data=Qt(i.data,i.headers,e.transformResponse),i},function(i){return Ra(i)||(Zt(e),i&&i.response&&(i.response.data=Qt(i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})},$=Y,ai=function(e,t){t=t||{};var n={},i=["url","method","data"],s=["headers","auth","proxy","params"],u=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],o=["validateStatus"];function c(f,h){return $.isPlainObject(f)&&$.isPlainObject(h)?$.merge(f,h):$.isPlainObject(h)?$.merge({},h):$.isArray(h)?h.slice():h}function a(f){$.isUndefined(t[f])?$.isUndefined(e[f])||(n[f]=c(void 0,e[f])):n[f]=c(e[f],t[f])}$.forEach(i,function(h){$.isUndefined(t[h])||(n[h]=c(void 0,t[h]))}),$.forEach(s,a),$.forEach(u,function(h){$.isUndefined(t[h])?$.isUndefined(e[h])||(n[h]=c(void 0,e[h])):n[h]=c(void 0,t[h])}),$.forEach(o,function(h){h in t?n[h]=c(e[h],t[h]):h in e&&(n[h]=c(void 0,e[h]))});var l=i.concat(s).concat(u).concat(o),d=Object.keys(e).concat(Object.keys(t)).filter(function(h){return l.indexOf(h)===-1});return $.forEach(d,a),n},ci=Y,Sa=qr,li=fa,Ia=Ta,ut=ai;function Ue(r){this.defaults=r,this.interceptors={request:new li,response:new li}}Ue.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=ut(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Ia,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(s){t.unshift(s.fulfilled,s.rejected)}),this.interceptors.response.forEach(function(s){t.push(s.fulfilled,s.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},Ue.prototype.getUri=function(e){return e=ut(this.defaults,e),Sa(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ci.forEach(["delete","get","head","options"],function(e){Ue.prototype[e]=function(t,n){return this.request(ut(n||{},{method:e,url:t,data:(n||{}).data}))}}),ci.forEach(["post","put","patch"],function(e){Ue.prototype[e]=function(t,n,i){return this.request(ut(i||{},{method:e,url:t,data:n}))}});var Pa=Ue,en,fi;function hi(){if(fi)return en;fi=1;function r(e){this.message=e}return r.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},r.prototype.__CANCEL__=!0,en=r,en}var tn,di;function Oa(){if(di)return tn;di=1;var r=hi();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var n;this.promise=new Promise(function(u){n=u});var i=this;t(function(u){i.reason||(i.reason=new r(u),n(i.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.source=function(){var n,i=new e(function(u){n=u});return{token:i,cancel:n}},tn=e,tn}var nn,pi;function _a(){return pi||(pi=1,nn=function(e){return function(n){return e.apply(null,n)}}),nn}var rn,vi;function ka(){return vi||(vi=1,rn=function(e){return typeof e=="object"&&e.isAxiosError===!0}),rn}var mi=Y,Ba=Mr,ot=Pa,La=ai,Na=ui;function Ei(r){var e=new ot(r),t=Ba(ot.prototype.request,e);return mi.extend(t,ot.prototype,e),mi.extend(t,e),t}var Z=Ei(Na);Z.Axios=ot,Z.create=function(e){return Ei(La(Z.defaults,e))},Z.Cancel=hi(),Z.CancelToken=Oa(),Z.isCancel=Gr(),Z.all=function(e){return Promise.all(e)},Z.spread=_a(),Z.isAxiosError=ka(),Lt.exports=Z,Lt.exports.default=Z,function(r){r.exports=Lt.exports}(Ur);const gi=zo(Ur.exports),yi={};class Ai{constructor(e){v(this,"axios");v(this,"_latestResponse");this.axios=gi.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=on.instance().Platform.cdnDomain;if((t==null?void 0:t.length)>0&&e!=="/conf/public"){const n=""+e;(n.startsWith("/infra/public")||n.startsWith("/assets")||/^\/([^\/]*)\/public/.test(n))&&(e=t+n)}return e}mapAxiosError(e,t){return e.response?this._latestResponse=e.response:e.request?this._latestResponse={status:408,statusText:C.TIME_OUT}:this._latestResponse={status:500,statusText:C.UNKNOWN},!t||t.disableNotifications,this._latestResponse}mapAxiosResponse(e,t){return this._latestResponse=e,e.data}get latestResponse(){return this._latestResponse}get(e,t){return this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t)).then(n=>this.mapAxiosResponse(n,t)).catch(n=>this.mapAxiosError(n,t))}post(e,t,n){return this.axios.post(e,t,this.toAxiosConfig(n)).then(i=>this.mapAxiosResponse(i,n)).catch(i=>this.mapAxiosError(i,n))}postFile(e,t,n){const i=this.toAxiosConfig(n);return i.headers&&i.headers["Content-Type"]&&delete i.headers["Content-Type"],this.axios.post(e,t,i).then(s=>this.mapAxiosResponse(s,n)).catch(s=>this.mapAxiosError(s,n))}postJson(e,t,n){const i=this.toAxiosConfig();return i.headers&&(i.headers["Content-Type"]="application/json"),this.axios.post(e,t,this.toAxiosConfig(n)).then(s=>this.mapAxiosResponse(s,n)).catch(s=>this.mapAxiosError(s,n))}put(e,t,n){return this.axios.put(e,t,this.toAxiosConfig(n)).then(i=>this.mapAxiosResponse(i,n)).catch(i=>this.mapAxiosError(i,n))}putJson(e,t,n){const i=this.toAxiosConfig(n);return i.headers&&(i.headers["Content-Type"]="application/json"),this.axios.put(e,t,i).then(s=>this.mapAxiosResponse(s,n)).catch(s=>this.mapAxiosError(s,n))}delete(e,t){return this.axios.delete(e,this.toAxiosConfig(t)).then(n=>this.mapAxiosResponse(n,t)).catch(n=>this.mapAxiosError(n,t))}deleteJson(e,t){return this.axios.delete(e,{data:t}).then(n=>this.mapAxiosResponse(n)).catch(n=>this.mapAxiosError(n))}getScript(e,t,n){const i=n!=null?n:"exports",s=this.toAxiosConfig(t);return s.headers&&(s.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),s).then(u=>this.mapAxiosResponse(u,t)).then(u=>{try{const o=`"use strict";var ${i.split(".")[0]}={};${u};return ${i};`;return Function(o)()}catch{return u}}).catch(u=>{throw this.mapAxiosError(u,t),u})}loadScript(e,t){return yi[e]?Promise.resolve():this.getScript(e,t).then(n=>{yi[e]=!0})}}class Ua{constructor(){v(this,"_http",new Ai)}get http(){return this._http}newHttpInstance(e){return new Ai(e)}}const x=new Ua;class sn{static instance(){return x}}const j=x.http;class Ma{constructor(){v(this,"_me",null);v(this,"_currentLanguage","");v(this,"_notLoggedIn",!0);v(this,"_description");v(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=on.instance().Platform.theme.basePath+"/img/illustrations/no-avatar.svg"),e}get user(){return this._me}get currentApp(){return q.Platform.apps.currentApp}async initialize(){return j.get("/auth/oauth2/userinfo").then(e=>{if(j.latestResponse.status<200||j.latestResponse.status>=300)throw C.NOT_LOGGED_IN;return this.setCurrentModel(e),this._notLoggedIn?this.loadDefaultLanguage():this.loadUserLanguage()}).then(e=>(this.setCurrentLanguage(e),this.loadDescription())).then(()=>this.getUserProfile()).then(()=>{N.onSessionReady().resolve(this._me)}).catch(e=>{if(e===C.NOT_LOGGED_IN)return Promise.resolve();N.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(n=>n.name===e))!==-1}hasRight(e,t){if(t==="owner")return e.owner&&e.owner.userId===this._me.userId;const n=t.right||t,s=e.shared.filter(o=>(this._me.groupsIds||[]).indexOf(o.groupId)!==-1||o.userId===this._me.userId).find(o=>o[n]||o.manager)!==void 0,u=t.workflow?this.hasWorkflow(t.workflow):!0;return s&&u}get latestQuotaAndUsage(){return j.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,N.onLangReady().resolve(e)}loadDefaultLanguage(){return j.get("/locale").then(e=>e.locale).catch(()=>this._currentLanguage)}loadDescription(){return Promise.all([j.get("/userbook/api/person",{requestName:"refreshAvatar"}),j.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 j.get("/userbook/api/person").then(e=>e.result).then(e=>this._profile=e[0].type)}loadUserLanguage(){return j.get("/userbook/preference/language").then(e=>{try{return JSON.parse(e.preference)["default-domain"]}catch{return this.loadDefaultLanguage()}}).catch(()=>this.loadDefaultLanguage())}getEmailValidationInfos(){return j.get("/directory/user/mailstate")}checkEmail(e){return j.put("/directory/user/mailstate",{email:e})}tryEmailValidation(e){return j.post("/directory/user/mailstate",{key:e})}getMobileValidationInfos(){return j.get("/directory/user/mobilestate")}checkMobile(e){return j.put("/directory/user/mobilestate",{mobile:e})}tryMobileValidation(e){return j.post("/directory/user/mobilestate",{key:e})}getMfaInfos(){return j.get("/auth/user/mfa/code")}tryMfaCode(e){return j.post("/auth/user/mfa/code",{key:e})}}class ja{constructor(){v(this,"session",new Ma)}initialize(){return this.session.initialize()}login(e,t,n,i){const s=new FormData;return s.append("email",e),s.append("password",t),typeof n<"u"&&s.append("rememberMe",""+n),typeof i<"u"&&s.append("secureLocation",""+i),x.http.post("/auth/login",s,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(x.http.latestResponse.status){case 200:throw C.MALFORMED_DATA}})}logout(){return x.http.get("/auth/logout").finally(()=>{})}}const te=new ja;class Ha{constructor(){v(this,"_conf");v(this,"_loaded");v(this,"skinName","");v(this,"themeName","");v(this,"skin","raw");v(this,"themeUrl","/assets/themes/raw/default/");v(this,"templateOverrides",{});v(this,"portalTemplate","/assets/themes/raw/portal.html");v(this,"basePath","");v(this,"logoutCallback","/");v(this,"skins",[]);v(this,"is1D",!1);v(this,"is2D",!1);v(this,"_onSkinReady",N.onSkinReady());v(this,"_onOverrideReady",N.onOverridesReady())}initialize(e){return N.onSessionReady().promise.then(()=>this.load(e))}get version(){return q.Platform.deploymentTag}get cdnDomain(){return q.Platform.cdnDomain}async onFullyReady(){return await this._loaded,this}onSkinReady(){return this._onSkinReady.promise}onOverrideReady(){return this._onOverrideReady.promise}async getConf(e){var t;return this._conf=(t=this._conf)!=null?t:await x.http.getScript("/assets/theme-conf.js",{queryParams:{v:e!=null?e:this.version}},"exports.conf"),this._conf}load(e){return e=e!=null?e:this.version,this._loaded||(this._loaded=(te.session.notLoggedIn?this.loadDisconnected(e):this.loadConnected(e)).then(async()=>{var n,i;const t=await this.listSkins();this.is1D=((n=t.find(s=>s.child===this.skin))==null?void 0:n.parent)==="panda",this.is2D=((i=t.find(s=>s.child===this.skin))==null?void 0:i.parent)==="theme-open-ent"})),this._loaded}loadDisconnected(e){return new Promise((t,n)=>{x.http.get("/skin",{queryParams:{v:this.version}}).then(i=>{this.skin=i.skin,this.themeUrl=`${this.cdnDomain}/assets/themes/${i.skin}/skins/default/`,this.basePath=this.themeUrl+"../../",this._onSkinReady.resolve(this),x.http.get(`/assets/themes/${i.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(s=>{this.templateOverrides=s,this._onOverrideReady.resolve(s),t()}).catch(s=>{if(x.http.latestResponse.status===404)t();else throw s})}).catch(i=>{this._onSkinReady.reject(i),this._onOverrideReady.reject(i),n()})})}loadConnected(e){return new Promise((t,n)=>{this.loadDefaultTheme(e).then(()=>{this._onSkinReady.resolve(this),x.http.get(`/assets/themes/${this.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(i=>{this.templateOverrides=i,this._onOverrideReady.resolve(i),t()}).catch(i=>{if(x.http.latestResponse.status===404)t(),this._onSkinReady.reject(i),this._onOverrideReady.reject(i);else throw i})})})}async loadDefaultTheme(e){return te.session.notLoggedIn?Promise.reject():x.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 x.http.get("/themes")}async setDefaultTheme(e){await x.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(n=>n.child===this.skin);return t!=null&&t.group?this.skins=this.skins.concat(e.overriding.filter(n=>n.group===t.group)):this.skins=this.skins.concat(e.overriding),this.skins})}async getHelpPath(){var n;const t=(await this.listSkins()).find(i=>i.child===this.skin);return(n=t==null?void 0:t.help)!=null?n:"/help"}}const Me={},un={},Ce=[{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 wi{translate(e,t){e=e!=null?e:"";let n=Me[e]===void 0?e:Me[e];if(t&&typeof t=="object")for(let i in t)typeof t[i]<"u"&&(n=n.replace(new RegExp("\\${"+i+"}","g"),""+t[i]));return n}addBundlePromise(e){return this.loadBundlePromise(te.session.currentLanguage,e)}addBundle(e,t){this.loadBundle(te.session.currentLanguage,e,t)}loadBundlePromise(e,t){return this.loadBundle(e,t),un[t]}loadBundle(e,t,n){const i=un[t];if(i)n&&i.then(n).catch(n);else{const s=new Ne;un[t]=s.promise;const u={};e&&(u["Accept-Language"]=e),x.http.get(t,{headers:u}).then(o=>{Object.assign(Me,o),typeof n=="function"&&n(),s.resolve()}).catch(o=>{typeof n=="function"&&n(),s.reject()})}}addTranslations(e,t){N.onLangReady().promise.then(n=>{this.loadBundle(n,e+"/"+n+".json",t)})}addAllTranslations(e){return e&&e.length>0?N.onLangReady().promise.then(t=>Promise.all(e.map(n=>this.loadBundlePromise(t,n+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(var t in e)typeof Me[t]!="string"&&(Me[t]=e[t])}removeAccents(e){for(var t=0;t<Ce.length;t++)e=e.replace(Ce[t].letters,Ce[t].base);return e}}class bi{constructor(){v(this,"data",{})}get(e){return this.data[e]}load(e,t){return x.http.get("/userbook/preference/"+e).then(n=>{try{return JSON.parse(n.preference)}catch{return t!=null?t:{}}}).then(n=>(this.data[e]=n!=null?n:{},n))}update(e,t){return t!==void 0&&(this.data[e]=t),this}save(e){return x.http.putJson("/userbook/preference/"+e,this.data[e])}}class $a{constructor(){v(this,"_me",null);v(this,"_keepOpenOnLogout",!1);v(this,"_preferences",new bi);v(this,"_bookmarkedApps",[])}get keepOpenOnLogout(){return this._keepOpenOnLogout}get preferences(){return this._preferences}get bookmarkedApps(){return this._bookmarkedApps}initialize(e){return this.loadPublicConf(),N.onSessionReady().promise.then(t=>{t&&this.setCurrentModel(t)})}setCurrentModel(e){this._me=e,this._preferences=new bi,this.loadBookmarks()}loadPublicConf(){return x.http.get("/conf/public").then(e=>(this._keepOpenOnLogout=(e==null?void 0:e.keepOpenOnLogout)||!1,e))}async loadBookmarks(){await x.http.get("/userbook/preference/apps").then(e=>{e.preference||(e.preference=null);const t=JSON.parse(e.preference);let n;if(t&&t.length&&typeof t.concat=="function"){this._bookmarkedApps=t,n={bookmarks:t.map(u=>u.name),applications:[]},x.http.putJson("/userbook/preference/apps",n);return}else n=t;n||(n={bookmarks:[],applications:[]});let i=!0;const s=[];n.bookmarks.forEach((u,o)=>{const c=this._me.apps.find(a=>a.name===u);if(c){let a=Object.assign({},c);this._bookmarkedApps.push(a)}else s.push(u),i=!1}),s.forEach(u=>{let o=n.bookmarks.indexOf(u);o!==-1&&n.bookmarks.splice(o,1)}),i||x.http.putJson("/userbook/preference/apps",n)})}loadAppPrefs(e){return this.preferences.load(e,{})}saveAppPrefs(e){return this.preferences.save(e)}loadLanguage(){return this.preferences.load("language",{"default-domain":te.session.currentLanguage}).then(e=>e["default-domain"])}saveLanguage(e){return this.preferences.update("language",{"default-domain":e}).save("language")}}const xi=x==null?void 0:x.http;class qa{constructor(){v(this,"_publicConf",{});v(this,"_currentApp");v(this,"_appConf",{})}get currentApp(){var e;return(e=this._currentApp)!=null?e: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 xi.get(`/${e}/conf/public`,{queryParams:{_:q.Platform.deploymentTag}})),this._publicConf[e]}async getWebAppConf(e){var n;let t;return this._appConf[e]||(await xi.get("/applications-list")).apps.forEach(s=>{if(s!=null&&s.prefix){const u=s.prefix.replace("/","");this._appConf[u]=s}else s!=null&&s.name&&s.name.toLowerCase()==e&&(t=s)}),(n=this._appConf[e])!=null?n:t}async loadI18n(e){return await N.onLangReady().promise,q.Platform.idiom.addBundlePromise(`/${e}/i18n`)}}class Wa{constructor(){v(this,"_status","void");v(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(n=>!t||n.type===e||n.type==="multiple"?n[e]:void 0)}initialize(){return this._params||(this._params=N.promisify(),this._status="pending",Promise.all([x.http.get("/analyticsConf"),x.http.get("/xiti/config")]).then(async e=>{var t;if(!e||!e[0]||!e[0].type)throw C.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){var a;if(!e.structureMap||!q.Platform.apps.currentApp)return;const t=await N.onSessionReady().promise,n=te.session.description;let i;for(let l of t.structures){const d=e.structureMap[l];if(d&&d.collectiviteId&&d.UAI){i=d;break}}if(!i||!i.active)return;const s=await q.Platform.apps.getPublicConf(q.Platform.apps.currentApp);if(!s)return;const u=s.xiti;if(!u||!u.LIBELLE_SERVICE||!i.UAI)return;function o(l){let d="";for(let f=0;f<l.length;f++)d+=l.charCodeAt(f);return d}const c={Student:"ELEVE",Teacher:"ENSEIGNANT",Relative:"PARENT",Personnel:"ADMIN_VIE_SCOL_TECH",Guest:"AUTRE"};return{LIBELLE_SERVICE:u.LIBELLE_SERVICE,TYPE:u.OUTIL?"TIERS":"NATIF",OUTIL:u.OUTIL?u.OUTIL:"",STRUCT_ID:i.collectiviteId,STRUCT_UAI:i.UAI,PROJET:i.projetId?i.projetId:e.ID_PROJET,EXPLOITANT:e.ID_EXPLOITANT,PLATFORME:i.plateformeId?i.plateformeId:e.ID_PLATEFORME,ID_PERSO:o(t.userId),PROFILE:n.profiles&&n.profiles.length>0&&(a=c[n.profiles[0]])!=null?a:""}}}class Ga{constructor(){v(this,"Platform",{deploymentTag:"",cdnDomain:"",apps:new qa,theme:new Ha,analytics:new Wa,idiom:new wi,listLanguages:()=>x.http.get("/languages")});v(this,"School",{});v(this,"User",new $a)}async initialize(e,t){if(!e){const i=a=>(a<10?"0":"")+a.toFixed(0),s=new Date,u=s.getFullYear(),o=s.getMonth()+1,c=s.getDate();e=`${u}${i(o)}${i(c)}`}const n=e;this.Platform.deploymentTag=e,typeof t=="string"&&t.length>0&&(this.Platform.cdnDomain=t),x.http.setCdn(this.Platform.cdnDomain),await Promise.all([this.Platform.theme.initialize(n),N.onSessionReady().promise.then(i=>this.Platform.idiom.addBundlePromise("/i18n")),this.User.initialize(n)])}}const q=new Ga;class on{static instance(){return q}}class Va{static instance(){return te}}const L={LEFT:"left",RIGHT:"right"},za=["birthday","mood","calendar-widget","notes"],Ja=["agenda-widget","carnet-de-bord","my-apps","rss-widget","bookmark-widget","cursus-widget","maxicours-widget","school-widget"],Ya={"last-infos-widget":L.LEFT,birthday:L.LEFT,"calendar-widget":L.RIGHT,"carnet-de-bord":L.LEFT,"record-me":L.RIGHT,mood:L.LEFT,"my-apps":L.RIGHT,notes:L.RIGHT,"rss-widget":L.LEFT,"bookmark-widget":L.RIGHT,qwant:L.RIGHT,"qwant-junior":L.LEFT,"agenda-widget":L.LEFT,"cursus-widget":L.LEFT,"maxicours-widget":L.RIGHT,"universalis-widget":L.RIGHT,"briefme-widget":L.LEFT,"school-widget":L.LEFT},Fi={"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 Xa{constructor(){v(this,"_initialized");v(this,"_widgets",[]);v(this,"_userPrefs",{})}initialize(e,t){return this._initialized||(this._initialized=new Ne,N.onSessionReady().promise.then(n=>{var i;n&&n.widgets?(n.widgets.forEach(s=>{this._widgets.push(new Ka(s))}),this.loadUserPrefs().then(()=>{var s;(s=this._initialized)==null||s.resolve()}).catch(s=>{var u;(u=this._initialized)==null||u.reject()})):(i=this._initialized)==null||i.reject()})),this._initialized.promise}get list(){return this._widgets}lookup(e){return this._widgets.find(t=>t.platformConf.name===e)}lookupDefaultPosition(e){return Ya[e]}get userPrefs(){return this._userPrefs}async loadUserPrefs(){await q.User.preferences.load("widgets",{}).then(e=>this.applyUserPrefs(e))}saveUserPrefs(){return q.User.preferences.update("widgets",this._userPrefs).save("widgets").then(()=>{N.events().next({name:Nr.USERPREF_CHANGED,layer:Lr.WIDGETS})})}async applyUserPrefs(e){this._userPrefs=e!=null?e:this._userPrefs;const t=q.Platform.theme,n=[];t.listSkins().then(i=>{var o;const s=((o=i.find(c=>c.child===t.skin))==null?void 0:o.parent)==="panda"?Ja:za;this._widgets=this._widgets.filter((c,a)=>{var f,h;const l=c.platformConf.name;return s.indexOf(l)!==-1?!1:(this._userPrefs[l]||(this._userPrefs[l]={index:(f=Fi[l])!=null?f:999,show:!0,position:c.platformConf.position}),c.platformConf.mandatory&&(this._userPrefs[l].show=!0,this._userPrefs[l].index=(h=Fi[l])!=null?h:999),c.platformConf.i18n&&n.push(c.platformConf.i18n),c.applyUserPref(this._userPrefs[l]),!0)});const u=new wi;this._widgets=this._widgets.sort((c,a)=>{const l=u.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(),d=u.translate(`timeline.settings.${a.platformConf.name}`).toLowerCase();return l<d?-1:l>d?1:0})})}}class Ka{constructor(e){v(this,"_schoolConf",{});v(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){var t,n;this._userPref=e,this._userPref.position=(n=(t=this._userPref.position)!=null?t:Ci.lookupDefaultPosition(this._platformConf.name))!=null?n:"left"}}const Ci=new Xa;class Qa{loadInfos(e){return x.http.get("/actualites/infos/last/"+e)}getMaxResults(){return x.http.get("/userbook/preference/maxInfos").then(e=>e.preference?parseInt(e.preference):4)}setMaxResults(e){return x.http.putJson("/userbook/preference/maxInfos",`"${e}"`)}}const Za={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 ec{static instance(){return Ci}}const an=x==null?void 0:x.http,tc=(Ti=te==null?void 0:te.session)==null?void 0:Ti.user;class nc{constructor(e){v(this,"_id");v(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===tc.userId))!==void 0}delete(){return an.delete("/timeline/"+this._id)}discard(){return an.put("/timeline/"+this._id)}report(){return an.put("/timeline/"+this._id+"/report")}}class rc{constructor(){v(this,"_notifications",[]);v(this,"_notificationTypes",[]);v(this,"_flashMessages",[]);v(this,"_pageNumber",0);v(this,"_lastPage",!1);v(this,"_loading",!1);v(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 q.User.preferences.get(H.TIMELINE)}get flashMessages(){return this._flashMessages}savePreferences(){return q.User.saveAppPrefs(H.TIMELINE)}resetPagination(){this._pageNumber=0,this._lastPage=!1,this._loading=!1}initialize(){return Promise.all([q.User.loadAppPrefs(H.TIMELINE),x.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);let t=this.selectedNotificationTypes;if(t.length===0)return this._lastPage=!0,Promise.resolve();let n={page:this.page,mine:1};return this.showMine||delete n.mine,this._loading=!0,x.http.get(`/timeline/lastNotifications?type=${t.join("&type=")}`,{queryParams:n}).then(i=>{if(this._loading=!1,i.status==="ok")if(i.number&&i.results){const s=i.results.filter(u=>this._notifications.findIndex(o=>o._id===u._id)===-1).map(u=>new nc(u));this._notifications=this._notifications.concat(s),this._pageNumber++}else this._lastPage=!0}).catch(i=>{this._loading=!1})}loadFlashMessages(){return x.http.get("/timeline/flashmsg/listuser").then(e=>{this._flashMessages=e})}markAsRead(e){return x.http.put("/timeline/flashmsg/"+e.id+"/markasread")}}class ic{static createInstance(){return new rc}}const Re=class{constructor(e){v(this,"checkHttpResponse",e=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return e});this.context=e}static register({application:e,resourceType:t},n){Re.registry.set(`${e}:main`,n),Re.registry.set(`${e}:${t}`,n)}static findService({application:e,resourceType:t},n){const i=Re.registry.get(`${e}:${t}`);if(i===void 0)throw`Service not found: ${e}:${t}`;return i(n)}static findMainService({application:e},t){const n=Re.registry.get(`${e}:main`);if(n===void 0)throw`Service not found: ${e}`;return n(t)}get http(){return this.context.http()}getShareReadUrl(e){return`/${this.getApplication()}/share/json/${e}?search=`}getSaveShareUrl(e){return`/${this.getApplication()}/share/resource/${e}`}gotoPrint(e,t){window.open(this.getPrintUrl(e,t),"_blank")}gotoView(e){window.open(this.getViewUrl(e),"_self")}gotoForm(e){window.open(this.getFormUrl(e),"_self")}async publish(e){const t=new FormData;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(s=>{t.append("activityType[]",s)}),e.subjectArea.forEach(s=>{t.append("subjectArea[]",s)}),e.age.forEach(s=>{t.append("age[]",s.toString())}),t.append("description",e.description),e.keyWords.split(",").forEach(s=>{t.append("keyWords[]",s.trim())}),t.append("licence",e.licence),t.append("pdfUri",`${window.location.origin}${this.getPrintUrl(e.resourceId)}`),t.append("application",e.application?e.application:""),t.append("resourceId",e.resourceId),t.append("teacherSchool",e.userStructureName);const i=await this.http.post("/appregistry/library/resource",t,{headers:{"Content-Type":"multipart/form-data"}});return this.checkHttpResponse(i)}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 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){const t=await this.http.post(`/explorer/folders/${e.folderId}/move`,this.moveToBodyParams(e));return this.checkHttpResponse(t)}async listSubfolders(e){const t=await this.http.get(`/explorer/folders/${e}`);return this.checkHttpResponse(t)}async deleteAll(e){const t=await this.http.deleteJson("/explorer",e);return this.checkHttpResponse(t)}async trashAll({resourceType:e,...t}){const n=await this.http.putJson("/explorer/trash",t);return this.checkHttpResponse(n)}async restoreAll({resourceType:e,...t}){const n=await this.http.putJson("/explorer/restore",t);return this.checkHttpResponse(n)}async getThumbnailPath(e){if(typeof e>"u")return e;if(typeof e=="string")if(e.startsWith("blob:")){const t=await fetch(e).then(i=>i.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){let t={application:e.app,start_idx:e.pagination.startIdx,page_size:e.pagination.pageSize,resource_type:e.types[0],trashed:e.trashed};if(e.orders&&Object.entries(e.orders).length){const[[n,i]]=Object.entries(e.orders);t.order_by=`${n}:${i}`}return e.filters&&Object.assign(t,e.filters),typeof e.search=="string"&&(t.search=e.search),t}createFolderToBodyParams(e){return{application:e.app,resourceType:e.type,parentId:e.parentId,name:e.name}}moveToBodyParams(e){return{application:e.application,resourceType:this.getResourceType(),resourceIds:e.resourceIds,folderIds:e.folderIds}}};let pe=Re;v(pe,"registry",new Map);class sc extends pe{async update(e){const t=await this.getThumbnailPath(e.thumbnail),n=await this.http.put(`/blog/${e.entId}`,{trashed:e.trashed,_id:e.entId,title:e.name,thumbnail:t,description:e.description,visibility:e.public?"PUBLIC":"OWNER",slug:e.public?e.slug:"","publish-type":e["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(n),{thumbnail:t,entId:e.entId}}getResourceType(){return z.BLOG}getApplication(){return H.BLOG}getFormUrl(e){return e?`/blog?folderid=${e}#/edit/new`:"/blog#/edit/new"}getViewUrl(e){return`/blog#/view/${e}`}getPrintUrl(e,t){return`/blog/print/blog#/print/${e}?comments=${t||!0}`}}pe.register({application:z.BLOG,resourceType:z.BLOG},r=>new sc(r));const ve={},cn={};class uc{constructor(e){this.context=e}get http(){return this.context.http()}async fromCacheIfPossible(e,t,n){if(cn[e]&&await cn[e],ve[e])return ve[e];try{const i=t();cn[e]=i;const s=await i;return n(s)&&(ve[e]=s),s}catch(i){throw console.error(`Failed to retrieve value for: ${e}`,i),i}}clearCache(e){if(e)delete ve[e];else for(const t in ve)ve.hasOwnProperty(t)&&delete ve[t]}async httpGet(e,t){return this.fromCacheIfPossible(e,async()=>{const n=await this.http.get(e,t),i={...this.http.latestResponse};return{value:n,response:i}},({response:n})=>!(n.status<200||n.status>=300))}async httpGetJson(e,t){const{response:n,value:i}=await this.httpGet(e,t);if(n.status<200||n.status>=300)throw`Bad http status (${n.status}) for url: ${e}`;return i}}class oc{constructor(e){this.context=e}get http(){return this.context.http()}get cdnDomain(){return q.Platform.cdnDomain}async getConf(e){const[t,n]=await Promise.all([this.getThemeConf(),this.getApplicationsList()]),[i,s]=await Promise.all([this.getTheme({conf:t}),this.getWebAppConf({app:e,applications:n})]);return{applications:n,conf:t,currentApp:s,theme:i}}getCdnUrl(){console.warn("[getCdnUrl] Not implemented yet")}async savePreference(e,t){this.http.putJson(`/userbook/preference/${e}`,t)}async getPreference(e){const t=await this.http.get(`/userbook/preference/${e}`);return JSON.parse(t.preference)}async getThemeConf(e){return await this.http.getScript("/assets/theme-conf.js",{queryParams:{v:e}},"exports.conf")}async getApplicationsList(){return(await this.http.get("/applications-list")).apps}async getWebAppConf({app:e,applications:t}){return t.find(i=>{if(i!=null&&i.prefix)return(i==null?void 0:i.prefix.replace("/",""))===e})}async getTheme({version:e,conf:t}){const n=await this.http.get("/theme",{queryParams:{_:e}}),i=n.themeName,s=t==null?void 0:t.overriding.find(d=>d.child===i).skins,u="/assets/themes/ode-bootstrap",o=t==null?void 0:t.overriding.find(d=>d.child===i).bootstrapVersion,c=`${this.cdnDomain}/assets/themes/${o}`,a=`${c}/skins/${n.skinName}`,l=(t==null?void 0:t.overriding.find(d=>d.child===i).parent)==="panda";return{basePath:`${this.cdnDomain}${n.skin}../../`,bootstrap:u,bootstrapPath:c,bootstrapUrl:a,bootstrapVersion:o,is1d:l,logoutCallback:n.logoutCallback,skin:n.skin.split("/assets/themes/")[1].split("/")[0],skinName:n.skinName,skins:s,themeName:n.themeName,themeUrl:n.skin}}}class ac{constructor(e){this.odeServices=e}get http(){return this.odeServices.http()}get cache(){return this.odeServices.cache()}getAvatarUrl(e,t,n="100x100"){return t==="user"?`/userbook/avatar/${e}?thumbnail=${n}`:"/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:n})=>({id:t,displayName:n,members:[]}))}async getBookMarkById(e){const{groups:t,id:n,name:i,users:s}=await this.http.get(`/directory/sharebookmark/${e}`);return{id:n,displayName:i,groups:t.map(({name:u,id:o})=>({displayName:u,id:o})),users:s.map(({displayName:u,id:o,profile:c})=>({profile:c,displayName:u,firstName:"",lastName:"",login:"",id:o}))}}async saveBookmarks(e,{bookmarks:t,groups:n,users:i}){this.cache.clearCache("/directory/sharebookmark/all");const s=i.map(f=>typeof f=="string"?f:f.id),u=n.map(f=>typeof f=="string"?f:f.id),o=t.map(async f=>{if(typeof f=="string"){const{displayName:h,groups:m,id:p,users:g}=await this.getBookMarkById(f),A=g.map(B=>B.id),I=m.map(B=>B.id);return{displayName:h,id:p,members:[...I,...A]}}else return Promise.resolve(f)}),a=(await Promise.all(o)).map(f=>f.members).reduce((f,h)=>[...f,...h],[]),l={name:e,members:[...s,...u,...a]},{id:d}=await this.http.postJson("/directory/sharebookmark",l);return{id:d,displayName:e,members:l.members}}}const Ri={};class cc{constructor(e,t){v(this,"axios");v(this,"_latestResponse");this.context=e,this.axios=gi.create(t)}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=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=this.context.conf().getCdnUrl()||"";if(t.length>0&&e!=="/conf/public"){const n=""+e;(n.startsWith("/infra/public")||n.startsWith("/assets")||/^\/([^\/]*)\/public/.test(n))&&(e=t+n)}return e}mapAxiosError(e,t){return console.error("[HttpService]",e),e.response?this._latestResponse=e.response:e.request?this._latestResponse={status:408,statusText:C.TIME_OUT}:this._latestResponse={status:500,statusText:C.UNKNOWN},!t||t.disableNotifications,this._latestResponse}mapAxiosResponse(e,t){return this._latestResponse=e,e.data}get latestResponse(){return this._latestResponse}async get(e,t){try{const n=await this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t));return this.mapAxiosResponse(n,t)}catch(n){return this.mapAxiosError(n,t)}}async post(e,t,n){try{const i=await this.axios.post(e,t,this.toAxiosConfig(n));return this.mapAxiosResponse(i,n)}catch(i){return this.mapAxiosError(i,n)}}async postFile(e,t,n){const i=this.toAxiosConfig(n);i.headers&&i.headers["Content-Type"]&&delete i.headers["Content-Type"];try{const s=await this.axios.post(e,t,{...i,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(s,n)}catch(s){return this.mapAxiosError(s,n)}}async postJson(e,t,n){const i=this.toAxiosConfig();i.headers&&(i.headers["Content-Type"]="application/json");try{const s=await this.axios.post(e,t,this.toAxiosConfig(n));return this.mapAxiosResponse(s,n)}catch(s){return this.mapAxiosError(s,n)}}async put(e,t,n){try{const i=await this.axios.put(e,t,this.toAxiosConfig(n));return this.mapAxiosResponse(i,n)}catch(i){return this.mapAxiosError(i,n)}}async putFile(e,t,n){try{const i=this.toAxiosConfig(n);i.headers&&i.headers["Content-Type"]&&delete i.headers["Content-Type"];const s=await this.axios.put(e,t,{...i,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(s,n)}catch(i){return this.mapAxiosError(i,n)}}async putJson(e,t,n){const i=this.toAxiosConfig(n);i.headers&&(i.headers["Content-Type"]="application/json");try{const s=await this.axios.put(e,t,i);return this.mapAxiosResponse(s,n)}catch(s){return this.mapAxiosError(s,n)}}async delete(e,t){try{const n=await this.axios.delete(e,this.toAxiosConfig(t));return this.mapAxiosResponse(n,t)}catch(n){return this.mapAxiosError(n,t)}}async deleteJson(e,t){try{const n=await this.axios.delete(e,{data:t});return this.mapAxiosResponse(n)}catch(n){return this.mapAxiosError(n)}}getScript(e,t,n){const i=n!=null?n:"exports",s=this.toAxiosConfig(t);return s.headers&&(s.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),s).then(u=>this.mapAxiosResponse(u,t)).then(u=>{try{const o=`"use strict";var ${i.split(".")[0]}={};${u};return ${i};`;return Function(o)()}catch{return u}}).catch(u=>{throw this.mapAxiosError(u,t),u})}loadScript(e,t){return Ri[e]?Promise.resolve():this.getScript(e,t).then(n=>{Ri[e]=!0})}}class lc{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(n=>this.parseResourceRight(n)).filter(n=>n!==void 0)}hasResourceRight({id:e,groupIds:t},n,i){const s=i.map(u=>typeof u=="string"?this.parseResourceRight(u):u).filter(u=>u!==void 0);for(const u of s){if(u.id===e&&u.type==="creator")return!0;if(u.id===e&&u.type==="user"&&u.right===n)return!0;if(t.includes(u.id)&&u.type==="group"&&u.right===n)return!0}return!1}async sessionHasResourceRight(e,t){try{const n=await this.session.getUser();return!!n&&this.hasResourceRight({groupIds:n.groupsIds,id:n.userId},e,t)}catch(n){return console.error(n),!1}}async sessionHasAtLeastOneResourceRight(e,t){for(const n of e)if(await this.sessionHasResourceRight(n,t))return!0;return!1}async sessionHasResourceRightForEachList(e,t){let n=0;for(const i of t)await this.sessionHasResourceRight(e,i)&&n++;return n===t.length}async sessionHasAtLeastOneResourceRightForEachList(e,t){for(const n of e){let i=0;for(const s of t)await this.sessionHasResourceRight(n,s)&&i++;if(i===t.length)return!0}return!1}hasWorkflowRight(e,t){return t.findIndex(n=>n===e)!==-1}async sessionHasWorkflowRight(e){try{const t=await this.session.getUser();return!!t&&this.hasWorkflowRight(e,t.authorizedActions.map(n=>n.name))}catch(t){return console.error(t),!1}}async sessionHasWorkflowRights(e){const t={};try{const n=await this.session.getUser();for(const i of e)t[i]=!!n&&this.hasWorkflowRight(i,n.authorizedActions.map(s=>s.name))}catch(n){console.error(n);for(const i of e)t[i]=!1}return t}}class fc{constructor(e){this.context=e}get http(){return this.context.http()}get cache(){return this.context.cache()}onLogout(){this.cache.clearCache()}onRefreshSession(){this.cache.clearCache()}async getSession(){const e=await this.getUser(),[t,n,i,s,u]=await Promise.all([this.getCurrentLanguage(e),this.latestQuotaAndUsage(e),this.loadDescription(e),this.getUserProfile(),this.getBookmarks(e)]);return{user:e,quotaAndUsage:n,currentLanguage:t,userDescription:i,userProfile:s,bookmarkedApps:u}}login(e,t,n,i){const s=new FormData;return s.append("email",e),s.append("password",t),typeof n<"u"&&s.append("rememberMe",""+n),typeof i<"u"&&s.append("secureLocation",""+i),this.http.post("/auth/login",s,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(this.http.latestResponse.status){case 200:throw C.MALFORMED_DATA}})}logout(){return this.http.get("/auth/logout").finally(()=>{})}async latestQuotaAndUsage(e){try{return await this.http.get(`/workspace/quota/user/${e==null?void 0:e.userId}`)}catch(t){return console.error(t),{quota:0,storage:0}}}async getCurrentLanguage(e){const t=(e==null?void 0:e.sessionMetadata)&&(e==null?void 0:e.sessionMetadata.userId);try{let n;return t?n=await this.loadUserLanguage():n=await this.loadDefaultLanguage(),n}catch(n){console.error(n)}}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)throw C.NOT_LOGGED_IN;return t}hasWorkflow({workflowName:e,user:t}){return e===void 0||(t==null?void 0:t.authorizedActions.findIndex(n=>n.name===e))!==-1}async loadDescription(e){try{const[t,n]=await Promise.all([this.getUserProfile({requestName:"refreshAvatar"}),this.http.get("/directory/userbook/"+(e==null?void 0:e.userId))]);return{...t,...n}}catch(t){return console.error(t),{}}}async getBookmarks(e){const t=await this.http.get("/userbook/preference/apps");t.preference||(t.preference=null);const n=JSON.parse(t.preference);let i;i=n,i||(i={bookmarks:[],applications:[]});let s=[];return i.bookmarks.forEach((u,o)=>{const c=e==null?void 0:e.apps.find(a=>a.name===u);if(c){let a=Object.assign({},c);s.push(a)}}),s}async getUserProfile(e){const{response:t,value:n}=await this.cache.httpGet("/userbook/api/person",e);if(t.status<200||t.status>=300)throw C.NOT_LOGGED_IN;return n.result[0].type}async isAdml(){const e=await this.getUser();return(e==null?void 0:e.functions.ADMIN_LOCAL)!==void 0}}class me{static removeAccents(e){for(var t=0;t<Ce.length;t++)e=e.replace(Ce[t].letters,Ce[t].base);return e}}class hc{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,n){const i=me.removeAccents(n).toLowerCase(),s=await this.cache.httpGetJson(`/${e}/share/json/${t}?search=${n}`),u=s.users.visibles.filter(({username:l,firstName:d,lastName:f,login:h})=>{const m=me.removeAccents(f||"").toLowerCase(),p=me.removeAccents(d||"").toLowerCase(),g=me.removeAccents(l||"").toLowerCase(),A=me.removeAccents(h||"").toLowerCase();return g.includes(i)||p.includes(i)||m.includes(i)||A.includes(i)}).map(l=>({avatarUrl:this.directory.getAvatarUrl(l.id,"user"),directoryUrl:this.directory.getDirectoryUrl(l.id,"user"),displayName:l.username,id:l.id,profile:l.profile,type:"user"})),o=s.groups.visibles.filter(({name:l})=>me.removeAccents(l||"").toLowerCase().includes(i)).map(l=>({avatarUrl:this.directory.getAvatarUrl(l.id,"group"),directoryUrl:this.directory.getDirectoryUrl(l.id,"group"),displayName:l.name,id:l.id,type:"group"}));return[...(await this.directory.getBookMarks()).filter(({displayName:l})=>me.removeAccents(l||"").toLowerCase().includes(i)).map(l=>({avatarUrl:"",directoryUrl:"",profile:"",displayName:l.displayName,id:l.id,type:"sharebookmark"})),...u,...o]}async getShareMapping(e){const t=await this.cache.httpGetJson(`/${e}/rights/sharing`);for(const n of Object.keys(t))if(n.includes(".")){const i=n.split(".")[1],s=t[n];delete t[n],t[i]=s}return t}getActionsAvailableFor({id:e,type:t},n,i){const u=(t==="user"?n.users.checked[e]:n.groups.checked[e])||[],o=Object.keys(i),c=[];for(const a of o)i[a].filter(f=>u.includes(f)).length>0&&c.push(a);return c}async getRightsForResource(e,t){const n=await this.directory.getBookMarks(),i=this.context.resource(e,e).getShareReadUrl(t),s=await this.cache.httpGetJson(i),u=await this.getShareMapping(e),o=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),c=Object.keys(s.users.checked).map(h=>s.users.visibles.find(p=>p.id===h)).filter(h=>h!==void 0).map(h=>{const m=this.getActionsAvailableFor({id:h.id,type:"user"},s,u);return{id:h.id,type:"user",displayName:h.username,profile:h.profile,avatarUrl:this.directory.getAvatarUrl(h.id,"user"),directoryUrl:this.directory.getDirectoryUrl(h.id,"user"),actions:m.map(g=>{const A=o[g];return{displayName:g,id:g,priority:A.priority}})}}).sort((h,m)=>(h.displayName||"").localeCompare(m.displayName)),a=Object.keys(s.groups.checked).map(h=>s.groups.visibles.find(p=>p.id===h)).filter(h=>h!==void 0).map(h=>{const m=this.getActionsAvailableFor({id:h.id,type:"group"},s,u);return{id:h.id,type:"group",displayName:h.name,profile:void 0,avatarUrl:this.directory.getAvatarUrl(h.id,"group"),directoryUrl:this.directory.getDirectoryUrl(h.id,"group"),actions:m.map(g=>{const A=o[g];return{displayName:g,id:g,priority:A.priority}})}}).sort((h,m)=>(h.displayName||"").localeCompare(m.displayName)),l=[...c,...a],d=s.groups.visibles.map(({groupDisplayName:h,id:m,name:p})=>({displayName:h||p,id:m})),f=s.users.visibles.map(({id:h,profile:m,username:p,firstName:g,lastName:A,login:I})=>({displayName:p,firstName:g,lastName:A,login:I,profile:m,id:h}));return{rights:l,visibleBookmarks:n,visibleGroups:d,visibleUsers:f}}async saveRights(e,t,n){const i=await this.getShareMapping(e),s={bookmarks:{},groups:{},users:{}};for(const a of n){const l=a.actions.map(f=>i[f.id]).reduce((f,h)=>[...f,...h],[]),d=[...new Set(l)];d.length>0&&(a.type==="user"?s.users[a.id]=d:a.type==="group"?s.groups[a.id]=d:s.bookmarks[a.id]=d)}const u=this.context.resource(e,e),o=u.getSaveShareUrl(t);return this.cache.clearCache(u.getShareReadUrl(t)),await this.http.putJson(o,s)}async getActionsForApp(e){const t=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),n=await this.getShareMapping(e);return Object.keys(t).map(s=>{const u=t[s];return{displayName:s,id:s,priority:u.priority,requires:u.requires}}).filter(s=>{var u;return((u=n[s.id])==null?void 0:u.length)>0}).sort((s,u)=>s.priority-u.priority)}}const hn=class{constructor(){v(this,"wordExtensions",new Set);v(this,"excelExtensions",new Set);v(this,"pptExtensions",new Set);v(this,"fileExtensionMap",new Map);v(this,"csvContentType",new Set);v(this,"csvExtensions",new Set);v(this,"txtExtensions",new Set);v(this,"PDF","application/pdf");v(this,"OCTET_STREAM","application/octet-stream");this.txtExtensions.add("txt"),this.wordExtensions.add("doc"),this.wordExtensions.add("dot"),this.wordExtensions.add("docx"),this.wordExtensions.add("dotx"),this.wordExtensions.add("docm"),this.wordExtensions.add("dotm"),this.wordExtensions.add("odt"),this.wordExtensions.add("ott"),this.wordExtensions.add("oth"),this.wordExtensions.add("odm"),this.excelExtensions.add("xls"),this.excelExtensions.add("xlt"),this.excelExtensions.add("xla"),this.excelExtensions.add("xlsx"),this.excelExtensions.add("xltx"),this.excelExtensions.add("xlsm"),this.excelExtensions.add("xltm"),this.excelExtensions.add("xlam"),this.excelExtensions.add("xlsb"),this.excelExtensions.add("ods"),this.excelExtensions.add("ots"),this.pptExtensions.add("ppt"),this.pptExtensions.add("pot"),this.pptExtensions.add("pps"),this.pptExtensions.add("ppa"),this.pptExtensions.add("pptx"),this.pptExtensions.add("potx"),this.pptExtensions.add("ppsx"),this.pptExtensions.add("ppam"),this.pptExtensions.add("pptm"),this.pptExtensions.add("potm"),this.pptExtensions.add("ppsm"),this.pptExtensions.add("odp"),this.pptExtensions.add("otp"),this.csvExtensions.add("csv"),this.fileExtensionMap.set("doc","application/msword"),this.fileExtensionMap.set("dot","application/msword"),this.fileExtensionMap.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),this.fileExtensionMap.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),this.fileExtensionMap.set("docm","application/vnd.ms-word.document.macroEnabled.12"),this.fileExtensionMap.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),this.fileExtensionMap.set("xls","application/vnd.ms-excel"),this.fileExtensionMap.set("xlt","application/vnd.ms-excel"),this.fileExtensionMap.set("xla","application/vnd.ms-excel"),this.fileExtensionMap.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),this.fileExtensionMap.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),this.fileExtensionMap.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),this.fileExtensionMap.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),this.fileExtensionMap.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),this.fileExtensionMap.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),this.fileExtensionMap.set("ppt","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pot","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pps","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("ppa","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),this.fileExtensionMap.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),this.fileExtensionMap.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),this.fileExtensionMap.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),this.fileExtensionMap.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),this.fileExtensionMap.set("odt","application/vnd.oasis.opendocument.text"),this.fileExtensionMap.set("ott","application/vnd.oasis.opendocument.text-template"),this.fileExtensionMap.set("oth","application/vnd.oasis.opendocument.text-web"),this.fileExtensionMap.set("odm","application/vnd.oasis.opendocument.text-master"),this.fileExtensionMap.set("odg","application/vnd.oasis.opendocument.graphics"),this.fileExtensionMap.set("otg","application/vnd.oasis.opendocument.graphics-template"),this.fileExtensionMap.set("odp","application/vnd.oasis.opendocument.presentation"),this.fileExtensionMap.set("otp","application/vnd.oasis.opendocument.presentation-template"),this.fileExtensionMap.set("ods","application/vnd.oasis.opendocument.spreadsheet"),this.fileExtensionMap.set("ots","application/vnd.oasis.opendocument.spreadsheet-template"),this.fileExtensionMap.set("odc","application/vnd.oasis.opendocument.chart"),this.fileExtensionMap.set("odf","application/vnd.oasis.opendocument.formula"),this.fileExtensionMap.set("odb","application/vnd.oasis.opendocument.database"),this.fileExtensionMap.set("odi","application/vnd.oasis.opendocument.image"),this.fileExtensionMap.set("oxt","application/vnd.openofficeorg.extension"),this.fileExtensionMap.set("txt","text/plain"),this.csvContentType.add("text/comma-separated-values"),this.csvContentType.add("text/csv"),this.csvContentType.add("application/csv")}getContentTypeForExtension(e){if(this.fileExtensionMap.has(e))return this.fileExtensionMap.get(e)}getExtensionForContentType(e){for(const t of Array.from(this.fileExtensionMap.keys()))if((this.fileExtensionMap.get(t)||"").toLowerCase()==(e||"").toLowerCase())return t;return null}isWordLike(e,t){const n=this.getExtensionForContentType(e);return n?this.wordExtensions.has(n):e==this.OCTET_STREAM&&t?this.wordExtensions.has(t):!1}isExcelLike(e,t){const n=this.getExtensionForContentType(e);return n?this.excelExtensions.has(n):e==this.OCTET_STREAM&&t?this.excelExtensions.has(t):!1}isCsvLike(e,t){return this.csvContentType.has(e)?!0:e==this.OCTET_STREAM&&t?this.csvExtensions.has(t):!1}isPowerpointLike(e,t){const n=this.getExtensionForContentType(e);return n?this.pptExtensions.has(n):e==this.OCTET_STREAM&&t?this.pptExtensions.has(t):!1}isTxtLike(e,t){const n=this.getExtensionForContentType(e);return n?this.txtExtensions.has(n):e==this.OCTET_STREAM&&t?this.txtExtensions.has(t):!1}};let oe=hn;v(oe,"INSTANCE",new hn);class Di{static registerContentTypeToFileType(e){this.fileTypes.push(e)}static getFileType(e,t=!1,n){if(n&&(n=n.trim()),!e)return"unknown";this.fileTypes||console.warn("[Element.role] should not have emptyRoles",this);for(let s of this.fileTypes||[]){const u=s(e,t);if(u)return u}const i={csv:function(s){return!!oe.INSTANCE.isCsvLike(s,n)},doc:function(s){return oe.INSTANCE.isWordLike(s,n)?!0:s.indexOf("document")!==-1&&s.indexOf("wordprocessing")!==-1},xls:function(s){return oe.INSTANCE.isExcelLike(s,n)?!0:s.indexOf("document")!==-1&&s.indexOf("spreadsheet")!==-1||s.indexOf("ms-excel")!==-1},img:function(s){return s.indexOf("image")!==-1},pdf:function(s){return s.indexOf("pdf")!==-1||s==="application/x-download"},ppt:function(s){return oe.INSTANCE.isPowerpointLike(s,n)?!0:s.indexOf("document")!==-1&&s.indexOf("presentation")!==-1||s.indexOf("powerpoint")!==-1},txt:function(s){return oe.INSTANCE.isTxtLike(s,n)},video:function(s){return s.indexOf("video")!==-1},audio:function(s){return s.indexOf("audio")!==-1},zip:function(s){return s.indexOf("zip")!==-1||s.indexOf("rar")!==-1||s.indexOf("tar")!==-1||s.indexOf("7z")!==-1}};for(let s in i)if(i[s](e))return s;return"unknown"}}v(Di,"fileTypes",[]);class dc{constructor(e){this.context=e}get http(){return this.context.http()}async saveFile(e,t){const n=e.name||"",i=n.split("."),s=e.type||"application/octet-stream",u=i.length>1?i[i.length-1]:"",o={"content-type":s,filename:n,size:e.size,extension:u,role:Di.getFileType(s,!1,u)},c=n.replace("."+o.extension,""),a=o.extension?c+"."+o.extension:c,l=new FormData;l.append("file",e,a);const d=[];return((t==null?void 0:t.visibility)==="public"||(t==null?void 0:t.visibility)==="protected")&&d.push(`${t.visibility}=true`),t!=null&&t.application&&d.push(`application=${t.application}`),o.role==="img"&&d.push("quality=1"),t!=null&&t.parentId&&d.push(`parentId=${t.parentId}`),await this.http.postFile(`/workspace/document?${d.join("&")}`,l)}}const je={},ln={},fn=[{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 pc{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!=null?e:"";let n=je[e]===void 0?e:je[e];if(t&&typeof t=="object")for(let i in t)typeof t[i]<"u"&&(n=n.replace(new RegExp("\\${"+i+"}","g"),""+t[i]));return n}addBundlePromise(e,t){return this.loadBundlePromise(e,t)}addBundle(e,t,n){this.loadBundle(e,t,n)}loadBundlePromise(e,t){return this.loadBundle(e,t),ln[t]}loadBundle(e,t,n){const i=ln[t];if(i)n&&i.then(n).catch(n);else{const s=new Ne;ln[t]=s.promise;const u={};e&&(u["Accept-Language"]=e),this.http.get(t,{headers:u}).then(o=>{Object.assign(je,o),typeof n=="function"&&n(),s.resolve()}).catch(o=>{typeof n=="function"&&n(),s.reject()})}}addTranslations(e,t){N.onLangReady().promise.then(n=>{this.loadBundle(n,e+"/"+n+".json",t)})}addAllTranslations(e){return e&&e.length>0?N.onLangReady().promise.then(t=>Promise.all(e.map(n=>this.loadBundlePromise(t,n+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(var t in e)typeof je[t]!="string"&&(je[t]=e[t])}removeAccents(e){for(var t=0;t<fn.length;t++)e=e.replace(fn[t].letters,fn[t].base);return e}}class vc{constructor(){v(this,"_cache");v(this,"_conf");v(this,"_directory");v(this,"_http");v(this,"_idiom");v(this,"_rights");v(this,"_session");v(this,"_share");v(this,"_workspace");this._cache=new uc(this),this._conf=new oc(this),this._directory=new ac(this),this._http=new cc(this),this._idiom=new pc(this),this._rights=new lc(this),this._session=new fc(this),this._share=new hc(this),this._workspace=new dc(this)}cache(){return this._cache}conf(){return this._conf}directory(){return this._directory}http(){return this._http}idiom(){return this._idiom}resource(e,t){return t?pe.findService({application:e,resourceType:t},this):pe.findMainService({application:e},this)}rights(){return this._rights}session(){return this._session}share(){return this._share}workspace(){return this._workspace}}const mc=new vc;typeof window<"u"&&(window.entcore=(Si=window.entcore)!=null?Si:{},window.entcore["ode-ts-client"]=(Pi=(Ii=window.entcore["ode-ts-client"])!=null?Ii:b)!=null?Pi:module==null?void 0:module.exports),b.ACTION=D,b.APP=H,b.BOOLEAN_FILTER=Uo,b.ConfigurationFrameworkFactory=on,b.ERROR_CODE=C,b.EVENT_NAME=Nr,b.ExplorerFrameworkFactory=kr,b.FOLDER=No,b.ITimelineFactory=ic,b.LAYER_NAME=Lr,b.LastInfosWidget=Qa,b.NotifyFrameworkFactory=Vo,b.PROP_FORMAT=Wo,b.PROP_KEY=he,b.PROP_MODE=$o,b.PROP_TYPE=qo,b.RESOURCE=z,b.RxJS=To,b.SORT_BY=Ho,b.SORT_ORDER=jo,b.STRING_FILTER=Mo,b.SessionFrameworkFactory=Va,b.TransportFrameworkFactory=sn,b.USER_PREFS=Oi,b.WIDGET_NAME=Za,b.WIDGET_POSITION=L,b.WidgetFrameworkFactory=ec,b.appNameForResource=Br,b.odeServices=mc,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
14
+ ***************************************************************************** */var extendStatics=function(n,e){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},extendStatics(n,e)};function __extends(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");extendStatics(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function __awaiter(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function u(l){try{a(r.next(l))}catch(d){o(d)}}function c(l){try{a(r.throw(l))}catch(d){o(d)}}function a(l){l.done?s(l.value):i(l.value).then(u,c)}a((r=r.apply(n,e||[])).next())})}function __generator(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=a[0]&2?i.return:a[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,a[1])).done)return s;switch(i=0,s&&(a=[a[0]&2,s.value]),a[0]){case 0:case 1:s=a;break;case 4:return t.label++,{value:a[1],done:!1};case 5:t.label++,i=a[1],a=[0];continue;case 7:a=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){t=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){t.label=a[1];break}if(a[0]===6&&t.label<s[1]){t.label=s[1],s=a;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(a);break}s[2]&&t.ops.pop(),t.trys.pop();continue}a=e.call(n,t)}catch(l){a=[6,l],i=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function __values(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),i,s=[],o;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)s.push(i.value)}catch(u){o={error:u}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(o)throw o.error}}return s}function __spreadArray(n,e){for(var t=0,r=e.length,i=n.length;t<r;t++,i++)n[i]=e[t];return n}function __await(n){return this instanceof __await?(this.v=n,this):new __await(n)}function __asyncGenerator(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(f){r[f]&&(i[f]=function(p){return new Promise(function(E,h){s.push([f,p,E,h])>1||u(f,p)})})}function u(f,p){try{c(r[f](p))}catch(E){d(s[0][3],E)}}function c(f){f.value instanceof __await?Promise.resolve(f.value.v).then(a,l):d(s[0][2],f)}function a(f){u("next",f)}function l(f){u("throw",f)}function d(f,p){f(p),s.shift(),s.length&&u(s[0][0],s[0][1])}}function __asyncValues(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(s){t[s]=n[s]&&function(o){return new Promise(function(u,c){o=n[s](o),i(u,c,o.done,o.value)})}}function i(s,o,u,c){Promise.resolve(c).then(function(a){s({value:a,done:u})},o)}}function isFunction$1(n){return typeof n=="function"}function createErrorClass(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var UnsubscriptionError=createErrorClass(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription:
15
+ `+t.map(function(r,i){return i+1+") "+r.toString()}).join(`
16
+ `):"",this.name="UnsubscriptionError",this.errors=t}});function arrRemove(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}var Subscription=function(){function n(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._teardowns=null}return n.prototype.unsubscribe=function(){var e,t,r,i,s;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var u=__values(o),c=u.next();!c.done;c=u.next()){var a=c.value;a.remove(this)}}catch(h){e={error:h}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(isFunction$1(l))try{l()}catch(h){s=h instanceof UnsubscriptionError?h.errors:[h]}var d=this._teardowns;if(d){this._teardowns=null;try{for(var f=__values(d),p=f.next();!p.done;p=f.next()){var E=p.value;try{execTeardown(E)}catch(h){s=s!=null?s:[],h instanceof UnsubscriptionError?s=__spreadArray(__spreadArray([],__read(s)),__read(h.errors)):s.push(h)}}}catch(h){r={error:h}}finally{try{p&&!p.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}}if(s)throw new UnsubscriptionError(s)}},n.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)execTeardown(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._teardowns=(t=this._teardowns)!==null&&t!==void 0?t:[]).push(e)}},n.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},n.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},n.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&arrRemove(t,e)},n.prototype.remove=function(e){var t=this._teardowns;t&&arrRemove(t,e),e instanceof n&&e._removeParent(this)},n.EMPTY=function(){var e=new n;return e.closed=!0,e}(),n}(),EMPTY_SUBSCRIPTION=Subscription.EMPTY;function isSubscription(n){return n instanceof Subscription||n&&"closed"in n&&isFunction$1(n.remove)&&isFunction$1(n.add)&&isFunction$1(n.unsubscribe)}function execTeardown(n){isFunction$1(n)?n():n.unsubscribe()}var config={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},timeoutProvider={setTimeout:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=timeoutProvider.delegate;return((t==null?void 0:t.setTimeout)||setTimeout).apply(void 0,__spreadArray([],__read(n)))},clearTimeout:function(n){var e=timeoutProvider.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(n)},delegate:void 0};function reportUnhandledError(n){timeoutProvider.setTimeout(function(){var e=config.onUnhandledError;if(e)e(n);else throw n})}function noop(){}var COMPLETE_NOTIFICATION=function(){return createNotification("C",void 0,void 0)}();function errorNotification(n){return createNotification("E",void 0,n)}function nextNotification(n){return createNotification("N",n,void 0)}function createNotification(n,e,t){return{kind:n,value:e,error:t}}var context=null;function errorContext(n){if(config.useDeprecatedSynchronousErrorHandling){var e=!context;if(e&&(context={errorThrown:!1,error:null}),n(),e){var t=context,r=t.errorThrown,i=t.error;if(context=null,r)throw i}}else n()}function captureError(n){config.useDeprecatedSynchronousErrorHandling&&context&&(context.errorThrown=!0,context.error=n)}var Subscriber=function(n){__extends(e,n);function e(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,isSubscription(t)&&t.add(r)):r.destination=EMPTY_OBSERVER,r}return e.create=function(t,r,i){return new SafeSubscriber(t,r,i)},e.prototype.next=function(t){this.isStopped?handleStoppedNotification(nextNotification(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?handleStoppedNotification(errorNotification(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?handleStoppedNotification(COMPLETE_NOTIFICATION,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Subscription),SafeSubscriber=function(n){__extends(e,n);function e(t,r,i){var s=n.call(this)||this,o;if(isFunction$1(t))o=t;else if(t){o=t.next,r=t.error,i=t.complete;var u;s&&config.useDeprecatedNextContext?(u=Object.create(t),u.unsubscribe=function(){return s.unsubscribe()}):u=t,o=o==null?void 0:o.bind(u),r=r==null?void 0:r.bind(u),i=i==null?void 0:i.bind(u)}return s.destination={next:o?wrapForErrorHandling(o):noop,error:wrapForErrorHandling(r!=null?r:defaultErrorHandler),complete:i?wrapForErrorHandling(i):noop},s}return e}(Subscriber);function wrapForErrorHandling(n,e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];try{n.apply(void 0,__spreadArray([],__read(t)))}catch(i){config.useDeprecatedSynchronousErrorHandling?captureError(i):reportUnhandledError(i)}}}function defaultErrorHandler(n){throw n}function handleStoppedNotification(n,e){var t=config.onStoppedNotification;t&&timeoutProvider.setTimeout(function(){return t(n,e)})}var EMPTY_OBSERVER={closed:!0,next:noop,error:defaultErrorHandler,complete:noop},observable=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function identity(n){return n}function pipe(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return pipeFromArray(n)}function pipeFromArray(n){return n.length===0?identity:n.length===1?n[0]:function(t){return n.reduce(function(r,i){return i(r)},t)}}var Observable=function(){function n(e){e&&(this._subscribe=e)}return n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.subscribe=function(e,t,r){var i=this,s=isSubscriber(e)?e:new SafeSubscriber(e,t,r);return errorContext(function(){var o=i,u=o.operator,c=o.source;s.add(u?u.call(s,c):c?i._subscribe(s):i._trySubscribe(s))}),s},n.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},n.prototype.forEach=function(e,t){var r=this;return t=getPromiseCtor(t),new t(function(i,s){var o;o=r.subscribe(function(u){try{e(u)}catch(c){s(c),o==null||o.unsubscribe()}},s,i)})},n.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},n.prototype[observable]=function(){return this},n.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pipeFromArray(e)(this)},n.prototype.toPromise=function(e){var t=this;return e=getPromiseCtor(e),new e(function(r,i){var s;t.subscribe(function(o){return s=o},function(o){return i(o)},function(){return r(s)})})},n.create=function(e){return new n(e)},n}();function getPromiseCtor(n){var e;return(e=n!=null?n:config.Promise)!==null&&e!==void 0?e:Promise}function isObserver(n){return n&&isFunction$1(n.next)&&isFunction$1(n.error)&&isFunction$1(n.complete)}function isSubscriber(n){return n&&n instanceof Subscriber||isObserver(n)&&isSubscription(n)}function hasLift(n){return isFunction$1(n==null?void 0:n.lift)}function operate(n){return function(e){if(hasLift(e))return e.lift(function(t){try{return n(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}var OperatorSubscriber=function(n){__extends(e,n);function e(t,r,i,s,o){var u=n.call(this,t)||this;return u.onFinalize=o,u._next=r?function(c){try{r(c)}catch(a){t.error(a)}}:n.prototype._next,u._error=s?function(c){try{s(c)}catch(a){t.error(a)}finally{this.unsubscribe()}}:n.prototype._error,u._complete=i?function(){try{i()}catch(c){t.error(c)}finally{this.unsubscribe()}}:n.prototype._complete,u}return e.prototype.unsubscribe=function(){var t,r=this.closed;n.prototype.unsubscribe.call(this),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))},e}(Subscriber);function refCount(){return operate(function(n,e){var t=null;n._refCount++;var r=new OperatorSubscriber(e,void 0,void 0,void 0,function(){if(!n||n._refCount<=0||0<--n._refCount){t=null;return}var i=n._connection,s=t;t=null,i&&(!s||i===s)&&i.unsubscribe(),e.unsubscribe()});n.subscribe(r),r.closed||(t=n.connect())})}var ConnectableObservable=function(n){__extends(e,n);function e(t,r){var i=n.call(this)||this;return i.source=t,i.subjectFactory=r,i._subject=null,i._refCount=0,i._connection=null,hasLift(t)&&(i.lift=t.lift),i}return e.prototype._subscribe=function(t){return this.getSubject().subscribe(t)},e.prototype.getSubject=function(){var t=this._subject;return(!t||t.isStopped)&&(this._subject=this.subjectFactory()),this._subject},e.prototype._teardown=function(){this._refCount=0;var t=this._connection;this._subject=this._connection=null,t==null||t.unsubscribe()},e.prototype.connect=function(){var t=this,r=this._connection;if(!r){r=this._connection=new Subscription;var i=this.getSubject();r.add(this.source.subscribe(new OperatorSubscriber(i,void 0,function(){t._teardown(),i.complete()},function(s){t._teardown(),i.error(s)},function(){return t._teardown()}))),r.closed&&(this._connection=null,r=Subscription.EMPTY)}return r},e.prototype.refCount=function(){return refCount()(this)},e}(Observable),performanceTimestampProvider={now:function(){return(performanceTimestampProvider.delegate||performance).now()},delegate:void 0},animationFrameProvider={schedule:function(n){var e=requestAnimationFrame,t=cancelAnimationFrame,r=animationFrameProvider.delegate;r&&(e=r.requestAnimationFrame,t=r.cancelAnimationFrame);var i=e(function(s){t=void 0,n(s)});return new Subscription(function(){return t==null?void 0:t(i)})},requestAnimationFrame:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=animationFrameProvider.delegate;return((t==null?void 0:t.requestAnimationFrame)||requestAnimationFrame).apply(void 0,__spreadArray([],__read(n)))},cancelAnimationFrame:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=animationFrameProvider.delegate;return((t==null?void 0:t.cancelAnimationFrame)||cancelAnimationFrame).apply(void 0,__spreadArray([],__read(n)))},delegate:void 0};function animationFrames(n){return n?animationFramesFactory(n):DEFAULT_ANIMATION_FRAMES}function animationFramesFactory(n){var e=animationFrameProvider.schedule;return new Observable(function(t){var r=new Subscription,i=n||performanceTimestampProvider,s=i.now(),o=function(u){var c=i.now();t.next({timestamp:n?c:u,elapsed:c-s}),t.closed||r.add(e(o))};return r.add(e(o)),r})}var DEFAULT_ANIMATION_FRAMES=animationFramesFactory(),ObjectUnsubscribedError=createErrorClass(function(n){return function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Subject=function(n){__extends(e,n);function e(){var t=n.call(this)||this;return t.closed=!1,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var r=new AnonymousSubject(this,this);return r.operator=t,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new ObjectUnsubscribedError},e.prototype.next=function(t){var r=this;errorContext(function(){var i,s;if(r._throwIfClosed(),!r.isStopped){var o=r.observers.slice();try{for(var u=__values(o),c=u.next();!c.done;c=u.next()){var a=c.value;a.next(t)}}catch(l){i={error:l}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(i)throw i.error}}}})},e.prototype.error=function(t){var r=this;errorContext(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var i=r.observers;i.length;)i.shift().error(t)}})},e.prototype.complete=function(){var t=this;errorContext(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var r=this,i=r.hasError,s=r.isStopped,o=r.observers;return i||s?EMPTY_SUBSCRIPTION:(o.push(t),new Subscription(function(){return arrRemove(o,t)}))},e.prototype._checkFinalizedStatuses=function(t){var r=this,i=r.hasError,s=r.thrownError,o=r.isStopped;i?t.error(s):o&&t.complete()},e.prototype.asObservable=function(){var t=new Observable;return t.source=this,t},e.create=function(t,r){return new AnonymousSubject(t,r)},e}(Observable),AnonymousSubject=function(n){__extends(e,n);function e(t,r){var i=n.call(this)||this;return i.destination=t,i.source=r,i}return e.prototype.next=function(t){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,t)},e.prototype.error=function(t){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,t)},e.prototype.complete=function(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)},e.prototype._subscribe=function(t){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&i!==void 0?i:EMPTY_SUBSCRIPTION},e}(Subject),BehaviorSubject=function(n){__extends(e,n);function e(t){var r=n.call(this)||this;return r._value=t,r}return Object.defineProperty(e.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),e.prototype._subscribe=function(t){var r=n.prototype._subscribe.call(this,t);return!r.closed&&t.next(this._value),r},e.prototype.getValue=function(){var t=this,r=t.hasError,i=t.thrownError,s=t._value;if(r)throw i;return this._throwIfClosed(),s},e.prototype.next=function(t){n.prototype.next.call(this,this._value=t)},e}(Subject),dateTimestampProvider={now:function(){return(dateTimestampProvider.delegate||Date).now()},delegate:void 0},ReplaySubject=function(n){__extends(e,n);function e(t,r,i){t===void 0&&(t=1/0),r===void 0&&(r=1/0),i===void 0&&(i=dateTimestampProvider);var s=n.call(this)||this;return s._bufferSize=t,s._windowTime=r,s._timestampProvider=i,s._buffer=[],s._infiniteTimeWindow=!0,s._infiniteTimeWindow=r===1/0,s._bufferSize=Math.max(1,t),s._windowTime=Math.max(1,r),s}return e.prototype.next=function(t){var r=this,i=r.isStopped,s=r._buffer,o=r._infiniteTimeWindow,u=r._timestampProvider,c=r._windowTime;i||(s.push(t),!o&&s.push(u.now()+c)),this._trimBuffer(),n.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),i=this,s=i._infiniteTimeWindow,o=i._buffer,u=o.slice(),c=0;c<u.length&&!t.closed;c+=s?1:2)t.next(u[c]);return this._checkFinalizedStatuses(t),r},e.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,i=t._timestampProvider,s=t._buffer,o=t._infiniteTimeWindow,u=(o?1:2)*r;if(r<1/0&&u<s.length&&s.splice(0,s.length-u),!o){for(var c=i.now(),a=0,l=1;l<s.length&&s[l]<=c;l+=2)a=l;a&&s.splice(0,a+1)}},e}(Subject),AsyncSubject=function(n){__extends(e,n);function e(){var t=n!==null&&n.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}return e.prototype._checkFinalizedStatuses=function(t){var r=this,i=r.hasError,s=r._hasValue,o=r._value,u=r.thrownError,c=r.isStopped,a=r._isComplete;i?t.error(u):(c||a)&&(s&&t.next(o),t.complete())},e.prototype.next=function(t){this.isStopped||(this._value=t,this._hasValue=!0)},e.prototype.complete=function(){var t=this,r=t._hasValue,i=t._value,s=t._isComplete;s||(this._isComplete=!0,r&&n.prototype.next.call(this,i),n.prototype.complete.call(this))},e}(Subject),Action=function(n){__extends(e,n);function e(t,r){return n.call(this)||this}return e.prototype.schedule=function(t,r){return this},e}(Subscription),intervalProvider={setInterval:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=intervalProvider.delegate;return((t==null?void 0:t.setInterval)||setInterval).apply(void 0,__spreadArray([],__read(n)))},clearInterval:function(n){var e=intervalProvider.delegate;return((e==null?void 0:e.clearInterval)||clearInterval)(n)},delegate:void 0},AsyncAction=function(n){__extends(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.pending=!1,i}return e.prototype.schedule=function(t,r){if(r===void 0&&(r=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,r)),this.pending=!0,this.delay=r,this.id=this.id||this.requestAsyncId(s,this.id,r),this},e.prototype.requestAsyncId=function(t,r,i){return i===void 0&&(i=0),intervalProvider.setInterval(t.flush.bind(t,this),i)},e.prototype.recycleAsyncId=function(t,r,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return r;intervalProvider.clearInterval(r)},e.prototype.execute=function(t,r){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(t,r);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,r){var i=!1,s;try{this.work(t)}catch(o){i=!0,s=!!o&&o||new Error(o)}if(i)return this.unsubscribe(),s},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,r=t.id,i=t.scheduler,s=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,arrRemove(s,this),r!=null&&(this.id=this.recycleAsyncId(i,r,null)),this.delay=null,n.prototype.unsubscribe.call(this)}},e}(Action),nextHandle=1,resolved,activeHandles={};function findAndClearHandle(n){return n in activeHandles?(delete activeHandles[n],!0):!1}var Immediate={setImmediate:function(n){var e=nextHandle++;return activeHandles[e]=!0,resolved||(resolved=Promise.resolve()),resolved.then(function(){return findAndClearHandle(e)&&n()}),e},clearImmediate:function(n){findAndClearHandle(n)}},setImmediate=Immediate.setImmediate,clearImmediate=Immediate.clearImmediate,immediateProvider={setImmediate:function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=immediateProvider.delegate;return((t==null?void 0:t.setImmediate)||setImmediate).apply(void 0,__spreadArray([],__read(n)))},clearImmediate:function(n){var e=immediateProvider.delegate;return((e==null?void 0:e.clearImmediate)||clearImmediate)(n)},delegate:void 0},AsapAction=function(n){__extends(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.scheduler=t,i.work=r,i}return e.prototype.requestAsyncId=function(t,r,i){return i===void 0&&(i=0),i!==null&&i>0?n.prototype.requestAsyncId.call(this,t,r,i):(t.actions.push(this),t._scheduled||(t._scheduled=immediateProvider.setImmediate(t.flush.bind(t,void 0))))},e.prototype.recycleAsyncId=function(t,r,i){if(i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0)return n.prototype.recycleAsyncId.call(this,t,r,i);t.actions.length===0&&(immediateProvider.clearImmediate(r),t._scheduled=void 0)},e}(AsyncAction),Scheduler=function(){function n(e,t){t===void 0&&(t=n.now),this.schedulerActionCtor=e,this.now=t}return n.prototype.schedule=function(e,t,r){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},n.now=dateTimestampProvider.now,n}(),AsyncScheduler=function(n){__extends(e,n);function e(t,r){r===void 0&&(r=Scheduler.now);var i=n.call(this,t,r)||this;return i.actions=[],i._active=!1,i._scheduled=void 0,i}return e.prototype.flush=function(t){var r=this.actions;if(this._active){r.push(t);return}var i;this._active=!0;do if(i=t.execute(t.state,t.delay))break;while(t=r.shift());if(this._active=!1,i){for(;t=r.shift();)t.unsubscribe();throw i}},e}(Scheduler),AsapScheduler=function(n){__extends(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.flush=function(t){this._active=!0,this._scheduled=void 0;var r=this.actions,i,s=-1;t=t||r.shift();var o=r.length;do if(i=t.execute(t.state,t.delay))break;while(++s<o&&(t=r.shift()));if(this._active=!1,i){for(;++s<o&&(t=r.shift());)t.unsubscribe();throw i}},e}(AsyncScheduler),asapScheduler=new AsapScheduler(AsapAction),asap=asapScheduler,asyncScheduler=new AsyncScheduler(AsyncAction),async=asyncScheduler,QueueAction=function(n){__extends(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.scheduler=t,i.work=r,i}return e.prototype.schedule=function(t,r){return r===void 0&&(r=0),r>0?n.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},e.prototype.execute=function(t,r){return r>0||this.closed?n.prototype.execute.call(this,t,r):this._execute(t,r)},e.prototype.requestAsyncId=function(t,r,i){return i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0?n.prototype.requestAsyncId.call(this,t,r,i):t.flush(this)},e}(AsyncAction),QueueScheduler=function(n){__extends(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(AsyncScheduler),queueScheduler=new QueueScheduler(QueueAction),queue=queueScheduler,AnimationFrameAction=function(n){__extends(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.scheduler=t,i.work=r,i}return e.prototype.requestAsyncId=function(t,r,i){return i===void 0&&(i=0),i!==null&&i>0?n.prototype.requestAsyncId.call(this,t,r,i):(t.actions.push(this),t._scheduled||(t._scheduled=animationFrameProvider.requestAnimationFrame(function(){return t.flush(void 0)})))},e.prototype.recycleAsyncId=function(t,r,i){if(i===void 0&&(i=0),i!=null&&i>0||i==null&&this.delay>0)return n.prototype.recycleAsyncId.call(this,t,r,i);t.actions.length===0&&(animationFrameProvider.cancelAnimationFrame(r),t._scheduled=void 0)},e}(AsyncAction),AnimationFrameScheduler=function(n){__extends(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.flush=function(t){this._active=!0,this._scheduled=void 0;var r=this.actions,i,s=-1;t=t||r.shift();var o=r.length;do if(i=t.execute(t.state,t.delay))break;while(++s<o&&(t=r.shift()));if(this._active=!1,i){for(;++s<o&&(t=r.shift());)t.unsubscribe();throw i}},e}(AsyncScheduler),animationFrameScheduler=new AnimationFrameScheduler(AnimationFrameAction),animationFrame=animationFrameScheduler,VirtualTimeScheduler=function(n){__extends(e,n);function e(t,r){t===void 0&&(t=VirtualAction),r===void 0&&(r=1/0);var i=n.call(this,t,function(){return i.frame})||this;return i.maxFrames=r,i.frame=0,i.index=-1,i}return e.prototype.flush=function(){for(var t=this,r=t.actions,i=t.maxFrames,s,o;(o=r[0])&&o.delay<=i&&(r.shift(),this.frame=o.delay,!(s=o.execute(o.state,o.delay))););if(s){for(;o=r.shift();)o.unsubscribe();throw s}},e.frameTimeFactor=10,e}(AsyncScheduler),VirtualAction=function(n){__extends(e,n);function e(t,r,i){i===void 0&&(i=t.index+=1);var s=n.call(this,t,r)||this;return s.scheduler=t,s.work=r,s.index=i,s.active=!0,s.index=t.index=i,s}return e.prototype.schedule=function(t,r){if(r===void 0&&(r=0),Number.isFinite(r)){if(!this.id)return n.prototype.schedule.call(this,t,r);this.active=!1;var i=new e(this.scheduler,this.work);return this.add(i),i.schedule(t,r)}else return Subscription.EMPTY},e.prototype.requestAsyncId=function(t,r,i){i===void 0&&(i=0),this.delay=t.frame+i;var s=t.actions;return s.push(this),s.sort(e.sortActions),!0},e.prototype.recycleAsyncId=function(t,r,i){},e.prototype._execute=function(t,r){if(this.active===!0)return n.prototype._execute.call(this,t,r)},e.sortActions=function(t,r){return t.delay===r.delay?t.index===r.index?0:t.index>r.index?1:-1:t.delay>r.delay?1:-1},e}(AsyncAction),EMPTY=new Observable(function(n){return n.complete()});function empty(n){return n?emptyScheduled(n):EMPTY}function emptyScheduled(n){return new Observable(function(e){return n.schedule(function(){return e.complete()})})}function scheduleArray(n,e){return new Observable(function(t){var r=0;return e.schedule(function(){r===n.length?t.complete():(t.next(n[r++]),t.closed||this.schedule())})})}var isArrayLike=function(n){return n&&typeof n.length=="number"&&typeof n!="function"};function isPromise(n){return isFunction$1(n==null?void 0:n.then)}function scheduleObservable(n,e){return new Observable(function(t){var r=new Subscription;return r.add(e.schedule(function(){var i=n[observable]();r.add(i.subscribe({next:function(s){r.add(e.schedule(function(){return t.next(s)}))},error:function(s){r.add(e.schedule(function(){return t.error(s)}))},complete:function(){r.add(e.schedule(function(){return t.complete()}))}}))})),r})}function schedulePromise(n,e){return new Observable(function(t){return e.schedule(function(){return n.then(function(r){t.add(e.schedule(function(){t.next(r),t.add(e.schedule(function(){return t.complete()}))}))},function(r){t.add(e.schedule(function(){return t.error(r)}))})})})}function getSymbolIterator(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var iterator=getSymbolIterator();function caughtSchedule(n,e,t,r){r===void 0&&(r=0);var i=e.schedule(function(){try{t.call(this)}catch(s){n.error(s)}},r);return n.add(i),i}function scheduleIterable(n,e){return new Observable(function(t){var r;return t.add(e.schedule(function(){r=n[iterator](),caughtSchedule(t,e,function(){var i=r.next(),s=i.value,o=i.done;o?t.complete():(t.next(s),this.schedule())})})),function(){return isFunction$1(r==null?void 0:r.return)&&r.return()}})}function scheduleAsyncIterable(n,e){if(!n)throw new Error("Iterable cannot be null");return new Observable(function(t){var r=new Subscription;return r.add(e.schedule(function(){var i=n[Symbol.asyncIterator]();r.add(e.schedule(function(){var s=this;i.next().then(function(o){o.done?t.complete():(t.next(o.value),s.schedule())})}))})),r})}function isInteropObservable(n){return isFunction$1(n[observable])}function isIterable(n){return isFunction$1(n==null?void 0:n[iterator])}function isAsyncIterable(n){return Symbol.asyncIterator&&isFunction$1(n==null?void 0:n[Symbol.asyncIterator])}function createInvalidObservableTypeError(n){return new TypeError("You provided "+(n!==null&&typeof n=="object"?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function readableStreamLikeToAsyncGenerator(n){return __asyncGenerator(this,arguments,function(){var t,r,i,s;return __generator(this,function(o){switch(o.label){case 0:t=n.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,__await(t.read())];case 3:return r=o.sent(),i=r.value,s=r.done,s?[4,__await(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return[4,__await(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function isReadableStreamLike(n){return isFunction$1(n==null?void 0:n.getReader)}function scheduleReadableStreamLike(n,e){return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(n),e)}function scheduled(n,e){if(n!=null){if(isInteropObservable(n))return scheduleObservable(n,e);if(isArrayLike(n))return scheduleArray(n,e);if(isPromise(n))return schedulePromise(n,e);if(isAsyncIterable(n))return scheduleAsyncIterable(n,e);if(isIterable(n))return scheduleIterable(n,e);if(isReadableStreamLike(n))return scheduleReadableStreamLike(n,e)}throw createInvalidObservableTypeError(n)}function from(n,e){return e?scheduled(n,e):innerFrom(n)}function innerFrom(n){if(n instanceof Observable)return n;if(n!=null){if(isInteropObservable(n))return fromInteropObservable(n);if(isArrayLike(n))return fromArrayLike(n);if(isPromise(n))return fromPromise(n);if(isAsyncIterable(n))return fromAsyncIterable(n);if(isIterable(n))return fromIterable(n);if(isReadableStreamLike(n))return fromReadableStreamLike(n)}throw createInvalidObservableTypeError(n)}function fromInteropObservable(n){return new Observable(function(e){var t=n[observable]();if(isFunction$1(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function fromArrayLike(n){return new Observable(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}function fromPromise(n){return new Observable(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,reportUnhandledError)})}function fromIterable(n){return new Observable(function(e){var t,r;try{for(var i=__values(n),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(u){t={error:u}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}e.complete()})}function fromAsyncIterable(n){return new Observable(function(e){process$1(n,e).catch(function(t){return e.error(t)})})}function fromReadableStreamLike(n){return fromAsyncIterable(readableStreamLikeToAsyncGenerator(n))}function process$1(n,e){var t,r,i,s;return __awaiter(this,void 0,void 0,function(){var o,u;return __generator(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=__asyncValues(n),c.label=1;case 1:return[4,t.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(o=r.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(s=t.return)?[4,s.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function internalFromArray(n,e){return e?scheduleArray(n,e):fromArrayLike(n)}function isScheduler(n){return n&&isFunction$1(n.schedule)}function last$1(n){return n[n.length-1]}function popResultSelector(n){return isFunction$1(last$1(n))?n.pop():void 0}function popScheduler(n){return isScheduler(last$1(n))?n.pop():void 0}function popNumber(n,e){return typeof last$1(n)=="number"?n.pop():e}function of(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popScheduler(n);return t?scheduleArray(n,t):internalFromArray(n)}function throwError(n,e){var t=isFunction$1(n)?n:function(){return n},r=function(i){return i.error(t())};return new Observable(e?function(i){return e.schedule(r,0,i)}:r)}var NotificationKind;(function(n){n.NEXT="N",n.ERROR="E",n.COMPLETE="C"})(NotificationKind||(NotificationKind={}));var Notification$1=function(){function n(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue=e==="N"}return n.prototype.observe=function(e){return observeNotification(this,e)},n.prototype.do=function(e,t,r){var i=this,s=i.kind,o=i.value,u=i.error;return s==="N"?e==null?void 0:e(o):s==="E"?t==null?void 0:t(u):r==null?void 0:r()},n.prototype.accept=function(e,t,r){var i;return isFunction$1((i=e)===null||i===void 0?void 0:i.next)?this.observe(e):this.do(e,t,r)},n.prototype.toObservable=function(){var e=this,t=e.kind,r=e.value,i=e.error,s=t==="N"?of(r):t==="E"?throwError(function(){return i}):t==="C"?EMPTY:0;if(!s)throw new TypeError("Unexpected notification kind "+t);return s},n.createNext=function(e){return new n("N",e)},n.createError=function(e){return new n("E",void 0,e)},n.createComplete=function(){return n.completeNotification},n.completeNotification=new n("C"),n}();function observeNotification(n,e){var t,r,i,s=n,o=s.kind,u=s.value,c=s.error;if(typeof o!="string")throw new TypeError('Invalid notification, missing "kind"');o==="N"?(t=e.next)===null||t===void 0||t.call(e,u):o==="E"?(r=e.error)===null||r===void 0||r.call(e,c):(i=e.complete)===null||i===void 0||i.call(e)}function isObservable(n){return!!n&&(n instanceof Observable||isFunction$1(n.lift)&&isFunction$1(n.subscribe))}var EmptyError=createErrorClass(function(n){return function(){n(this),this.name="EmptyError",this.message="no elements in sequence"}});function lastValueFrom(n,e){var t=typeof e=="object";return new Promise(function(r,i){var s=!1,o;n.subscribe({next:function(u){o=u,s=!0},error:i,complete:function(){s?r(o):t?r(e.defaultValue):i(new EmptyError)}})})}function firstValueFrom(n,e){var t=typeof e=="object";return new Promise(function(r,i){var s=new SafeSubscriber({next:function(o){r(o),s.unsubscribe()},error:i,complete:function(){t?r(e.defaultValue):i(new EmptyError)}});n.subscribe(s)})}var ArgumentOutOfRangeError=createErrorClass(function(n){return function(){n(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}}),NotFoundError=createErrorClass(function(n){return function(t){n(this),this.name="NotFoundError",this.message=t}}),SequenceError=createErrorClass(function(n){return function(t){n(this),this.name="SequenceError",this.message=t}});function isValidDate(n){return n instanceof Date&&!isNaN(n)}var TimeoutError=createErrorClass(function(n){return function(t){t===void 0&&(t=null),n(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function timeout(n,e){var t=isValidDate(n)?{first:n}:typeof n=="number"?{each:n}:n,r=t.first,i=t.each,s=t.with,o=s===void 0?timeoutErrorFactory:s,u=t.scheduler,c=u===void 0?e!=null?e:asyncScheduler:u,a=t.meta,l=a===void 0?null:a;if(r==null&&i==null)throw new TypeError("No timeout provided.");return operate(function(d,f){var p,E,h=null,v=0,g=function(y){E=caughtSchedule(f,c,function(){p.unsubscribe(),innerFrom(o({meta:l,lastValue:h,seen:v})).subscribe(f)},y)};p=d.subscribe(new OperatorSubscriber(f,function(y){E==null||E.unsubscribe(),v++,f.next(h=y),i>0&&g(i)},void 0,void 0,function(){E!=null&&E.closed||E==null||E.unsubscribe(),h=null})),g(r!=null?typeof r=="number"?r:+r-c.now():i)})}function timeoutErrorFactory(n){throw new TimeoutError(n)}function subscribeOn(n,e){return e===void 0&&(e=0),operate(function(t,r){r.add(n.schedule(function(){return t.subscribe(r)},e))})}function map(n,e){return operate(function(t,r){var i=0;t.subscribe(new OperatorSubscriber(r,function(s){r.next(n.call(e,s,i++))}))})}var isArray$3=Array.isArray;function callOrApply(n,e){return isArray$3(e)?n.apply(void 0,__spreadArray([],__read(e))):n(e)}function mapOneOrManyArgs(n){return map(function(e){return callOrApply(n,e)})}function observeOn(n,e){return e===void 0&&(e=0),operate(function(t,r){t.subscribe(new OperatorSubscriber(r,function(i){return r.add(n.schedule(function(){return r.next(i)},e))},function(){return r.add(n.schedule(function(){return r.complete()},e))},function(i){return r.add(n.schedule(function(){return r.error(i)},e))}))})}function bindCallbackInternals(n,e,t,r){if(t)if(isScheduler(t))r=t;else return function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return bindCallbackInternals(n,e,r).apply(this,i).pipe(mapOneOrManyArgs(t))};return r?function(){for(var i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];return bindCallbackInternals(n,e).apply(this,i).pipe(subscribeOn(r),observeOn(r))}:function(){for(var i=this,s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];var u=new AsyncSubject,c=!0;return new Observable(function(a){var l=u.subscribe(a);if(c){c=!1;var d=!1,f=!1;e.apply(i,__spreadArray(__spreadArray([],__read(s)),[function(){for(var p=[],E=0;E<arguments.length;E++)p[E]=arguments[E];if(n){var h=p.shift();if(h!=null){u.error(h);return}}u.next(1<p.length?p:p[0]),f=!0,d&&u.complete()}])),f&&u.complete(),d=!0}return l})}}function bindCallback(n,e,t){return bindCallbackInternals(!1,n,e,t)}function bindNodeCallback(n,e,t){return bindCallbackInternals(!0,n,e,t)}var isArray$2=Array.isArray,getPrototypeOf=Object.getPrototypeOf,objectProto=Object.prototype,getKeys=Object.keys;function argsArgArrayOrObject(n){if(n.length===1){var e=n[0];if(isArray$2(e))return{args:e,keys:null};if(isPOJO(e)){var t=getKeys(e);return{args:t.map(function(r){return e[r]}),keys:t}}}return{args:n,keys:null}}function isPOJO(n){return n&&typeof n=="object"&&getPrototypeOf(n)===objectProto}function createObject(n,e){return n.reduce(function(t,r,i){return t[r]=e[i],t},{})}function combineLatest$1(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popScheduler(n),r=popResultSelector(n),i=argsArgArrayOrObject(n),s=i.args,o=i.keys;if(s.length===0)return from([],t);var u=new Observable(combineLatestInit(s,t,o?function(c){return createObject(o,c)}:identity));return r?u.pipe(mapOneOrManyArgs(r)):u}function combineLatestInit(n,e,t){return t===void 0&&(t=identity),function(r){maybeSchedule(e,function(){for(var i=n.length,s=new Array(i),o=i,u=i,c=function(l){maybeSchedule(e,function(){var d=from(n[l],e),f=!1;d.subscribe(new OperatorSubscriber(r,function(p){s[l]=p,f||(f=!0,u--),u||r.next(t(s.slice()))},function(){--o||r.complete()}))},r)},a=0;a<i;a++)c(a)},r)}}function maybeSchedule(n,e,t){n?t.add(n.schedule(e)):e()}function mergeInternals(n,e,t,r,i,s,o,u){var c=[],a=0,l=0,d=!1,f=function(){d&&!c.length&&!a&&e.complete()},p=function(h){return a<r?E(h):c.push(h)},E=function(h){s&&e.next(h),a++;var v=!1;innerFrom(t(h,l++)).subscribe(new OperatorSubscriber(e,function(g){i==null||i(g),s?p(g):e.next(g)},function(){v=!0},void 0,function(){if(v)try{a--;for(var g=function(){var y=c.shift();o?e.add(o.schedule(function(){return E(y)})):E(y)};c.length&&a<r;)g();f()}catch(y){e.error(y)}}))};return n.subscribe(new OperatorSubscriber(e,p,function(){d=!0,f()})),function(){u==null||u()}}function mergeMap(n,e,t){return t===void 0&&(t=1/0),isFunction$1(e)?mergeMap(function(r,i){return map(function(s,o){return e(r,s,i,o)})(innerFrom(n(r,i)))},t):(typeof e=="number"&&(t=e),operate(function(r,i){return mergeInternals(r,i,n,t)}))}function mergeAll(n){return n===void 0&&(n=1/0),mergeMap(identity,n)}function concatAll(){return mergeAll(1)}function concat$1(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return concatAll()(internalFromArray(n,popScheduler(n)))}function defer(n){return new Observable(function(e){innerFrom(n()).subscribe(e)})}var DEFAULT_CONFIG$1={connector:function(){return new Subject},resetOnDisconnect:!0};function connectable(n,e){e===void 0&&(e=DEFAULT_CONFIG$1);var t=null,r=e.connector,i=e.resetOnDisconnect,s=i===void 0?!0:i,o=r(),u=new Observable(function(c){return o.subscribe(c)});return u.connect=function(){return(!t||t.closed)&&(t=defer(function(){return n}).subscribe(o),s&&t.add(function(){return o=r()})),t},u}function forkJoin(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popResultSelector(n),r=argsArgArrayOrObject(n),i=r.args,s=r.keys,o=new Observable(function(u){var c=i.length;if(!c){u.complete();return}for(var a=new Array(c),l=c,d=c,f=function(E){var h=!1;innerFrom(i[E]).subscribe(new OperatorSubscriber(u,function(v){h||(h=!0,d--),a[E]=v},function(){(!--l||!h)&&(d||u.next(s?createObject(s,a):a),u.complete())}))},p=0;p<c;p++)f(p)});return t?o.pipe(mapOneOrManyArgs(t)):o}var nodeEventEmitterMethods=["addListener","removeListener"],eventTargetMethods=["addEventListener","removeEventListener"],jqueryMethods=["on","off"];function fromEvent(n,e,t,r){if(isFunction$1(t)&&(r=t,t=void 0),r)return fromEvent(n,e,t).pipe(mapOneOrManyArgs(r));var i=__read(isEventTarget(n)?eventTargetMethods.map(function(u){return function(c){return n[u](e,c,t)}}):isNodeStyleEventEmitter(n)?nodeEventEmitterMethods.map(toCommonHandlerRegistry(n,e)):isJQueryStyleEventEmitter(n)?jqueryMethods.map(toCommonHandlerRegistry(n,e)):[],2),s=i[0],o=i[1];if(!s&&isArrayLike(n))return mergeMap(function(u){return fromEvent(u,e,t)})(internalFromArray(n));if(!s)throw new TypeError("Invalid event target");return new Observable(function(u){var c=function(){for(var a=[],l=0;l<arguments.length;l++)a[l]=arguments[l];return u.next(1<a.length?a:a[0])};return s(c),function(){return o(c)}})}function toCommonHandlerRegistry(n,e){return function(t){return function(r){return n[t](e,r)}}}function isNodeStyleEventEmitter(n){return isFunction$1(n.addListener)&&isFunction$1(n.removeListener)}function isJQueryStyleEventEmitter(n){return isFunction$1(n.on)&&isFunction$1(n.off)}function isEventTarget(n){return isFunction$1(n.addEventListener)&&isFunction$1(n.removeEventListener)}function fromEventPattern(n,e,t){return t?fromEventPattern(n,e).pipe(mapOneOrManyArgs(t)):new Observable(function(r){var i=function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];return r.next(o.length===1?o[0]:o)},s=n(i);return isFunction$1(e)?function(){return e(i,s)}:void 0})}function generate(n,e,t,r,i){var s,o,u,c;arguments.length===1?(s=n,c=s.initialState,e=s.condition,t=s.iterate,o=s.resultSelector,u=o===void 0?identity:o,i=s.scheduler):(c=n,!r||isScheduler(r)?(u=identity,i=r):u=r);function a(){var l;return __generator(this,function(d){switch(d.label){case 0:l=c,d.label=1;case 1:return!e||e(l)?[4,u(l)]:[3,4];case 2:d.sent(),d.label=3;case 3:return l=t(l),[3,1];case 4:return[2]}})}return defer(i?function(){return scheduleIterable(a(),i)}:a)}function iif(n,e,t){return defer(function(){return n()?e:t})}function timer(n,e,t){n===void 0&&(n=0),t===void 0&&(t=async);var r=-1;return e!=null&&(isScheduler(e)?t=e:r=e),new Observable(function(i){var s=isValidDate(n)?+n-t.now():n;s<0&&(s=0);var o=0;return t.schedule(function(){i.closed||(i.next(o++),0<=r?this.schedule(void 0,r):i.complete())},s)})}function interval(n,e){return n===void 0&&(n=0),e===void 0&&(e=asyncScheduler),n<0&&(n=0),timer(n,n,e)}function merge$2(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popScheduler(n),r=popNumber(n,1/0),i=n;return i.length?i.length===1?innerFrom(i[0]):mergeAll(r)(internalFromArray(i,t)):EMPTY}var NEVER=new Observable(noop);function never(){return NEVER}var isArray$1=Array.isArray;function argsOrArgArray(n){return n.length===1&&isArray$1(n[0])?n[0]:n}function onErrorResumeNext$1(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=argsOrArgArray(n);return operate(function(r,i){var s=__spreadArray([r],__read(t)),o=function(){if(!i.closed)if(s.length>0){var u=void 0;try{u=innerFrom(s.shift())}catch{o();return}var c=new OperatorSubscriber(i,void 0,noop,noop);i.add(u.subscribe(c)),c.add(o)}else i.complete()};o()})}function onErrorResumeNext(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return onErrorResumeNext$1(argsOrArgArray(n))(EMPTY)}function pairs(n,e){return from(Object.entries(n),e)}function not(n,e){return function(t,r){return!n.call(e,t,r)}}function filter(n,e){return operate(function(t,r){var i=0;t.subscribe(new OperatorSubscriber(r,function(s){return n.call(e,s,i++)&&r.next(s)}))})}function partition(n,e,t){return[filter(e,t)(innerFrom(n)),filter(not(e,t))(innerFrom(n))]}function race(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n=argsOrArgArray(n),n.length===1?innerFrom(n[0]):new Observable(raceInit(n))}function raceInit(n){return function(e){for(var t=[],r=function(s){t.push(innerFrom(n[s]).subscribe(new OperatorSubscriber(e,function(o){if(t){for(var u=0;u<t.length;u++)u!==s&&t[u].unsubscribe();t=null}e.next(o)})))},i=0;t&&!e.closed&&i<n.length;i++)r(i)}}function range(n,e,t){if(e==null&&(e=n,n=0),e<=0)return EMPTY;var r=e+n;return new Observable(t?function(i){var s=n;return t.schedule(function(){s<r?(i.next(s++),this.schedule()):i.complete()})}:function(i){for(var s=n;s<r&&!i.closed;)i.next(s++);i.complete()})}function using(n,e){return new Observable(function(t){var r=n(),i=e(r),s=i?innerFrom(i):EMPTY;return s.subscribe(t),function(){r&&r.unsubscribe()}})}function zip$1(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popResultSelector(n),r=argsOrArgArray(n);return r.length?new Observable(function(i){var s=r.map(function(){return[]}),o=r.map(function(){return!1});i.add(function(){s=o=null});for(var u=function(a){innerFrom(r[a]).subscribe(new OperatorSubscriber(i,function(l){if(s[a].push(l),s.every(function(f){return f.length})){var d=s.map(function(f){return f.shift()});i.next(t?t.apply(void 0,__spreadArray([],__read(d))):d),s.some(function(f,p){return!f.length&&o[p]})&&i.complete()}},function(){o[a]=!0,!s[a].length&&i.complete()}))},c=0;!i.closed&&c<r.length;c++)u(c);return function(){s=o=null}}):EMPTY}function audit(n){return operate(function(e,t){var r=!1,i=null,s=null,o=!1,u=function(){if(s==null||s.unsubscribe(),s=null,r){r=!1;var a=i;i=null,t.next(a)}o&&t.complete()},c=function(){s=null,o&&t.complete()};e.subscribe(new OperatorSubscriber(t,function(a){r=!0,i=a,s||innerFrom(n(a)).subscribe(s=new OperatorSubscriber(t,u,c))},function(){o=!0,(!r||!s||s.closed)&&t.complete()}))})}function auditTime(n,e){return e===void 0&&(e=async),audit(function(){return timer(n,e)})}function buffer(n){return operate(function(e,t){var r=[];return e.subscribe(new OperatorSubscriber(t,function(i){return r.push(i)},function(){t.next(r),t.complete()})),n.subscribe(new OperatorSubscriber(t,function(){var i=r;r=[],t.next(i)},noop)),function(){r=null}})}function bufferCount(n,e){return e===void 0&&(e=null),e=e!=null?e:n,operate(function(t,r){var i=[],s=0;t.subscribe(new OperatorSubscriber(r,function(o){var u,c,a,l,d=null;s++%e===0&&i.push([]);try{for(var f=__values(i),p=f.next();!p.done;p=f.next()){var E=p.value;E.push(o),n<=E.length&&(d=d!=null?d:[],d.push(E))}}catch(g){u={error:g}}finally{try{p&&!p.done&&(c=f.return)&&c.call(f)}finally{if(u)throw u.error}}if(d)try{for(var h=__values(d),v=h.next();!v.done;v=h.next()){var E=v.value;arrRemove(i,E),r.next(E)}}catch(g){a={error:g}}finally{try{v&&!v.done&&(l=h.return)&&l.call(h)}finally{if(a)throw a.error}}},function(){var o,u;try{for(var c=__values(i),a=c.next();!a.done;a=c.next()){var l=a.value;r.next(l)}}catch(d){o={error:d}}finally{try{a&&!a.done&&(u=c.return)&&u.call(c)}finally{if(o)throw o.error}}r.complete()},void 0,function(){i=null}))})}function bufferTime(n){for(var e,t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var s=(e=popScheduler(r))!==null&&e!==void 0?e:asyncScheduler,o=(t=r[0])!==null&&t!==void 0?t:null,u=r[1]||1/0;return operate(function(c,a){var l=[],d=!1,f=function(h){var v=h.buffer,g=h.subs;g.unsubscribe(),arrRemove(l,h),a.next(v),d&&p()},p=function(){if(l){var h=new Subscription;a.add(h);var v=[],g={buffer:v,subs:h};l.push(g),h.add(s.schedule(function(){return f(g)},n))}};o!==null&&o>=0?a.add(s.schedule(function(){p(),!this.closed&&a.add(this.schedule(null,o))},o)):d=!0,p();var E=new OperatorSubscriber(a,function(h){var v,g,y=l.slice();try{for(var F=__values(y),A=F.next();!A.done;A=F.next()){var w=A.value,C=w.buffer;C.push(h),u<=C.length&&f(w)}}catch(O){v={error:O}}finally{try{A&&!A.done&&(g=F.return)&&g.call(F)}finally{if(v)throw v.error}}},function(){for(;l!=null&&l.length;)a.next(l.shift().buffer);E==null||E.unsubscribe(),a.complete(),a.unsubscribe()},void 0,function(){return l=null});c.subscribe(E)})}function bufferToggle(n,e){return operate(function(t,r){var i=[];innerFrom(n).subscribe(new OperatorSubscriber(r,function(s){var o=[];i.push(o);var u=new Subscription,c=function(){arrRemove(i,o),r.next(o),u.unsubscribe()};u.add(innerFrom(e(s)).subscribe(new OperatorSubscriber(r,c,noop)))},noop)),t.subscribe(new OperatorSubscriber(r,function(s){var o,u;try{for(var c=__values(i),a=c.next();!a.done;a=c.next()){var l=a.value;l.push(s)}}catch(d){o={error:d}}finally{try{a&&!a.done&&(u=c.return)&&u.call(c)}finally{if(o)throw o.error}}},function(){for(;i.length>0;)r.next(i.shift());r.complete()}))})}function bufferWhen(n){return operate(function(e,t){var r=null,i=null,s=function(){i==null||i.unsubscribe();var o=r;r=[],o&&t.next(o),innerFrom(n()).subscribe(i=new OperatorSubscriber(t,s,noop))};s(),e.subscribe(new OperatorSubscriber(t,function(o){return r==null?void 0:r.push(o)},function(){r&&t.next(r),t.complete()},void 0,function(){return r=i=null}))})}function catchError(n){return operate(function(e,t){var r=null,i=!1,s;r=e.subscribe(new OperatorSubscriber(t,void 0,void 0,function(o){s=innerFrom(n(o,catchError(n)(e))),r?(r.unsubscribe(),r=null,s.subscribe(t)):i=!0})),i&&(r.unsubscribe(),r=null,s.subscribe(t))})}function scanInternals(n,e,t,r,i){return function(s,o){var u=t,c=e,a=0;s.subscribe(new OperatorSubscriber(o,function(l){var d=a++;c=u?n(c,l,d):(u=!0,l),r&&o.next(c)},i&&function(){u&&o.next(c),o.complete()}))}}function reduce(n,e){return operate(scanInternals(n,e,arguments.length>=2,!1,!0))}var arrReducer=function(n,e){return n.push(e),n};function toArray(){return operate(function(n,e){reduce(arrReducer,[])(n).subscribe(e)})}function joinAllInternals(n,e){return pipe(toArray(),mergeMap(function(t){return n(t)}),e?mapOneOrManyArgs(e):identity)}function combineLatestAll(n){return joinAllInternals(combineLatest$1,n)}var combineAll=combineLatestAll;function combineLatest(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popResultSelector(n);return t?pipe(combineLatest.apply(void 0,__spreadArray([],__read(n))),mapOneOrManyArgs(t)):operate(function(r,i){combineLatestInit(__spreadArray([r],__read(argsOrArgArray(n))))(i)})}function combineLatestWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return combineLatest.apply(void 0,__spreadArray([],__read(n)))}function concatMap(n,e){return isFunction$1(e)?mergeMap(n,e,1):mergeMap(n,1)}function concatMapTo(n,e){return isFunction$1(e)?concatMap(function(){return n},e):concatMap(function(){return n})}function concat(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popScheduler(n);return operate(function(r,i){concatAll()(internalFromArray(__spreadArray([r],__read(n)),t)).subscribe(i)})}function concatWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return concat.apply(void 0,__spreadArray([],__read(n)))}function fromSubscribable(n){return new Observable(function(e){return n.subscribe(e)})}var DEFAULT_CONFIG={connector:function(){return new Subject}};function connect(n,e){e===void 0&&(e=DEFAULT_CONFIG);var t=e.connector;return operate(function(r,i){var s=t();from(n(fromSubscribable(s))).subscribe(i),i.add(r.subscribe(s))})}function count(n){return reduce(function(e,t,r){return!n||n(t,r)?e+1:e},0)}function debounce(n){return operate(function(e,t){var r=!1,i=null,s=null,o=function(){if(s==null||s.unsubscribe(),s=null,r){r=!1;var u=i;i=null,t.next(u)}};e.subscribe(new OperatorSubscriber(t,function(u){s==null||s.unsubscribe(),r=!0,i=u,s=new OperatorSubscriber(t,o,noop),innerFrom(n(u)).subscribe(s)},function(){o(),t.complete()},void 0,function(){i=s=null}))})}function debounceTime(n,e){return e===void 0&&(e=asyncScheduler),operate(function(t,r){var i=null,s=null,o=null,u=function(){if(i){i.unsubscribe(),i=null;var a=s;s=null,r.next(a)}};function c(){var a=o+n,l=e.now();if(l<a){i=this.schedule(void 0,a-l),r.add(i);return}u()}t.subscribe(new OperatorSubscriber(r,function(a){s=a,o=e.now(),i||(i=e.schedule(c,n),r.add(i))},function(){u(),r.complete()},void 0,function(){s=i=null}))})}function defaultIfEmpty(n){return operate(function(e,t){var r=!1;e.subscribe(new OperatorSubscriber(t,function(i){r=!0,t.next(i)},function(){r||t.next(n),t.complete()}))})}function take(n){return n<=0?function(){return EMPTY}:operate(function(e,t){var r=0;e.subscribe(new OperatorSubscriber(t,function(i){++r<=n&&(t.next(i),n<=r&&t.complete())}))})}function ignoreElements(){return operate(function(n,e){n.subscribe(new OperatorSubscriber(e,noop))})}function mapTo(n){return map(function(){return n})}function delayWhen(n,e){return e?function(t){return concat$1(e.pipe(take(1),ignoreElements()),t.pipe(delayWhen(n)))}:mergeMap(function(t,r){return n(t,r).pipe(take(1),mapTo(t))})}function delay(n,e){e===void 0&&(e=asyncScheduler);var t=timer(n,e);return delayWhen(function(){return t})}function dematerialize(){return operate(function(n,e){n.subscribe(new OperatorSubscriber(e,function(t){return observeNotification(t,e)}))})}function distinct(n,e){return operate(function(t,r){var i=new Set;t.subscribe(new OperatorSubscriber(r,function(s){var o=n?n(s):s;i.has(o)||(i.add(o),r.next(s))})),e==null||e.subscribe(new OperatorSubscriber(r,function(){return i.clear()},noop))})}function distinctUntilChanged(n,e){return e===void 0&&(e=identity),n=n!=null?n:defaultCompare,operate(function(t,r){var i,s=!0;t.subscribe(new OperatorSubscriber(r,function(o){var u=e(o);(s||!n(i,u))&&(s=!1,i=u,r.next(o))}))})}function defaultCompare(n,e){return n===e}function distinctUntilKeyChanged(n,e){return distinctUntilChanged(function(t,r){return e?e(t[n],r[n]):t[n]===r[n]})}function throwIfEmpty(n){return n===void 0&&(n=defaultErrorFactory),operate(function(e,t){var r=!1;e.subscribe(new OperatorSubscriber(t,function(i){r=!0,t.next(i)},function(){return r?t.complete():t.error(n())}))})}function defaultErrorFactory(){return new EmptyError}function elementAt(n,e){if(n<0)throw new ArgumentOutOfRangeError;var t=arguments.length>=2;return function(r){return r.pipe(filter(function(i,s){return s===n}),take(1),t?defaultIfEmpty(e):throwIfEmpty(function(){return new ArgumentOutOfRangeError}))}}function endWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return function(t){return concat$1(t,of.apply(void 0,__spreadArray([],__read(n))))}}function every(n,e){return operate(function(t,r){var i=0;t.subscribe(new OperatorSubscriber(r,function(s){n.call(e,s,i++,t)||(r.next(!1),r.complete())},function(){r.next(!0),r.complete()}))})}function exhaustAll(){return operate(function(n,e){var t=!1,r=null;n.subscribe(new OperatorSubscriber(e,function(i){r||(r=innerFrom(i).subscribe(new OperatorSubscriber(e,void 0,function(){r=null,t&&e.complete()})))},function(){t=!0,!r&&e.complete()}))})}var exhaust=exhaustAll;function exhaustMap(n,e){return e?function(t){return t.pipe(exhaustMap(function(r,i){return innerFrom(n(r,i)).pipe(map(function(s,o){return e(r,s,i,o)}))}))}:operate(function(t,r){var i=0,s=null,o=!1;t.subscribe(new OperatorSubscriber(r,function(u){s||(s=new OperatorSubscriber(r,void 0,function(){s=null,o&&r.complete()}),innerFrom(n(u,i++)).subscribe(s))},function(){o=!0,!s&&r.complete()}))})}function expand(n,e,t){return e===void 0&&(e=1/0),e=(e||0)<1?1/0:e,operate(function(r,i){return mergeInternals(r,i,n,e,void 0,!0,t)})}function finalize(n){return operate(function(e,t){try{e.subscribe(t)}finally{t.add(n)}})}function find(n,e){return operate(createFind(n,e,"value"))}function createFind(n,e,t){var r=t==="index";return function(i,s){var o=0;i.subscribe(new OperatorSubscriber(s,function(u){var c=o++;n.call(e,u,c,i)&&(s.next(r?c:u),s.complete())},function(){s.next(r?-1:void 0),s.complete()}))}}function findIndex(n,e){return operate(createFind(n,e,"index"))}function first(n,e){var t=arguments.length>=2;return function(r){return r.pipe(n?filter(function(i,s){return n(i,s,r)}):identity,take(1),t?defaultIfEmpty(e):throwIfEmpty(function(){return new EmptyError}))}}function groupBy(n,e,t,r){return operate(function(i,s){var o;!e||typeof e=="function"?o=e:(t=e.duration,o=e.element,r=e.connector);var u=new Map,c=function(f){u.forEach(f),f(s)},a=function(f){return c(function(p){return p.error(f)})},l=new GroupBySubscriber(s,function(f){try{var p=n(f),E=u.get(p);if(!E){u.set(p,E=r?r():new Subject);var h=d(p,E);if(s.next(h),t){var v=new OperatorSubscriber(E,function(){E.complete(),v==null||v.unsubscribe()},void 0,void 0,function(){return u.delete(p)});l.add(innerFrom(t(h)).subscribe(v))}}E.next(o?o(f):f)}catch(g){a(g)}},function(){return c(function(f){return f.complete()})},a,function(){return u.clear()});i.subscribe(l);function d(f,p){var E=new Observable(function(h){l.activeGroups++;var v=p.subscribe(h);return function(){v.unsubscribe(),--l.activeGroups===0&&l.teardownAttempted&&l.unsubscribe()}});return E.key=f,E}})}var GroupBySubscriber=function(n){__extends(e,n);function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.activeGroups=0,t.teardownAttempted=!1,t}return e.prototype.unsubscribe=function(){this.teardownAttempted=!0,this.activeGroups===0&&n.prototype.unsubscribe.call(this)},e}(OperatorSubscriber);function isEmpty(){return operate(function(n,e){n.subscribe(new OperatorSubscriber(e,function(){e.next(!1),e.complete()},function(){e.next(!0),e.complete()}))})}function takeLast(n){return n<=0?function(){return EMPTY}:operate(function(e,t){var r=[];e.subscribe(new OperatorSubscriber(t,function(i){r.push(i),n<r.length&&r.shift()},function(){var i,s;try{for(var o=__values(r),u=o.next();!u.done;u=o.next()){var c=u.value;t.next(c)}}catch(a){i={error:a}}finally{try{u&&!u.done&&(s=o.return)&&s.call(o)}finally{if(i)throw i.error}}t.complete()},void 0,function(){r=null}))})}function last(n,e){var t=arguments.length>=2;return function(r){return r.pipe(n?filter(function(i,s){return n(i,s,r)}):identity,takeLast(1),t?defaultIfEmpty(e):throwIfEmpty(function(){return new EmptyError}))}}function materialize(){return operate(function(n,e){n.subscribe(new OperatorSubscriber(e,function(t){e.next(Notification$1.createNext(t))},function(){e.next(Notification$1.createComplete()),e.complete()},function(t){e.next(Notification$1.createError(t)),e.complete()}))})}function max(n){return reduce(isFunction$1(n)?function(e,t){return n(e,t)>0?e:t}:function(e,t){return e>t?e:t})}var flatMap=mergeMap;function mergeMapTo(n,e,t){return t===void 0&&(t=1/0),isFunction$1(e)?mergeMap(function(){return n},e,t):(typeof e=="number"&&(t=e),mergeMap(function(){return n},t))}function mergeScan(n,e,t){return t===void 0&&(t=1/0),operate(function(r,i){var s=e;return mergeInternals(r,i,function(o,u){return n(s,o,u)},t,function(o){s=o},!1,void 0,function(){return s=null})})}function merge$1(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popScheduler(n),r=popNumber(n,1/0);return n=argsOrArgArray(n),operate(function(i,s){mergeAll(r)(internalFromArray(__spreadArray([i],__read(n)),t)).subscribe(s)})}function mergeWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return merge$1.apply(void 0,__spreadArray([],__read(n)))}function min(n){return reduce(isFunction$1(n)?function(e,t){return n(e,t)<0?e:t}:function(e,t){return e<t?e:t})}function multicast(n,e){var t=isFunction$1(n)?n:function(){return n};return isFunction$1(e)?connect(e,{connector:t}):function(r){return new ConnectableObservable(r,t)}}function pairwise(){return operate(function(n,e){var t,r=!1;n.subscribe(new OperatorSubscriber(e,function(i){var s=t;t=i,r&&e.next([s,i]),r=!0}))})}function pluck(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=n.length;if(t===0)throw new Error("list of properties cannot be empty.");return map(function(r){for(var i=r,s=0;s<t;s++){var o=i==null?void 0:i[n[s]];if(typeof o<"u")i=o;else return}return i})}function publish(n){return n?function(e){return connect(n)(e)}:function(e){return multicast(new Subject)(e)}}function publishBehavior(n){return function(e){var t=new BehaviorSubject(n);return new ConnectableObservable(e,function(){return t})}}function publishLast(){return function(n){var e=new AsyncSubject;return new ConnectableObservable(n,function(){return e})}}function publishReplay(n,e,t,r){t&&!isFunction$1(t)&&(r=t);var i=isFunction$1(t)?t:void 0;return function(s){return multicast(new ReplaySubject(n,e,r),i)(s)}}function raceWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return n.length?operate(function(t,r){raceInit(__spreadArray([t],__read(n)))(r)}):identity}function repeat(n){return n===void 0&&(n=1/0),n<=0?function(){return EMPTY}:operate(function(e,t){var r=0,i,s=function(){var o=!1;i=e.subscribe(new OperatorSubscriber(t,void 0,function(){++r<n?i?(i.unsubscribe(),i=null,s()):o=!0:t.complete()})),o&&(i.unsubscribe(),i=null,s())};s()})}function repeatWhen(n){return operate(function(e,t){var r,i=!1,s,o=!1,u=!1,c=function(){return u&&o&&(t.complete(),!0)},a=function(){return s||(s=new Subject,n(s).subscribe(new OperatorSubscriber(t,function(){r?l():i=!0},function(){o=!0,c()}))),s},l=function(){u=!1,r=e.subscribe(new OperatorSubscriber(t,void 0,function(){u=!0,!c()&&a().next()})),i&&(r.unsubscribe(),r=null,i=!1,l())};l()})}function retry(n){n===void 0&&(n=1/0);var e;n&&typeof n=="object"?e=n:e={count:n};var t=e.count,r=t===void 0?1/0:t,i=e.delay,s=e.resetOnSuccess,o=s===void 0?!1:s;return r<=0?identity:operate(function(u,c){var a=0,l,d=function(){var f=!1;l=u.subscribe(new OperatorSubscriber(c,function(p){o&&(a=0),c.next(p)},void 0,function(p){if(a++<r){var E=function(){l?(l.unsubscribe(),l=null,d()):f=!0};if(i!=null){var h=typeof i=="number"?timer(i):innerFrom(i(p,a)),v=new OperatorSubscriber(c,function(){v.unsubscribe(),E()},function(){c.complete()});h.subscribe(v)}else E()}else c.error(p)})),f&&(l.unsubscribe(),l=null,d())};d()})}function retryWhen(n){return operate(function(e,t){var r,i=!1,s,o=function(){r=e.subscribe(new OperatorSubscriber(t,void 0,void 0,function(u){s||(s=new Subject,n(s).subscribe(new OperatorSubscriber(t,function(){return r?o():i=!0}))),s&&s.next(u)})),i&&(r.unsubscribe(),r=null,i=!1,o())};o()})}function sample(n){return operate(function(e,t){var r=!1,i=null;e.subscribe(new OperatorSubscriber(t,function(o){r=!0,i=o}));var s=function(){if(r){r=!1;var o=i;i=null,t.next(o)}};n.subscribe(new OperatorSubscriber(t,s,noop))})}function sampleTime(n,e){return e===void 0&&(e=asyncScheduler),sample(interval(n,e))}function scan(n,e){return operate(scanInternals(n,e,arguments.length>=2,!0))}function sequenceEqual(n,e){return e===void 0&&(e=function(t,r){return t===r}),operate(function(t,r){var i=createState(),s=createState(),o=function(c){r.next(c),r.complete()},u=function(c,a){var l=new OperatorSubscriber(r,function(d){var f=a.buffer,p=a.complete;f.length===0?p?o(!1):c.buffer.push(d):!e(d,f.shift())&&o(!1)},function(){c.complete=!0;var d=a.complete,f=a.buffer;d&&o(f.length===0),l==null||l.unsubscribe()});return l};t.subscribe(u(i,s)),n.subscribe(u(s,i))})}function createState(){return{buffer:[],complete:!1}}function share(n){n===void 0&&(n={});var e=n.connector,t=e===void 0?function(){return new Subject}:e,r=n.resetOnError,i=r===void 0?!0:r,s=n.resetOnComplete,o=s===void 0?!0:s,u=n.resetOnRefCountZero,c=u===void 0?!0:u;return function(a){var l=null,d=null,f=null,p=0,E=!1,h=!1,v=function(){d==null||d.unsubscribe(),d=null},g=function(){v(),l=f=null,E=h=!1},y=function(){var F=l;g(),F==null||F.unsubscribe()};return operate(function(F,A){p++,!h&&!E&&v();var w=f=f!=null?f:t();A.add(function(){p--,p===0&&!h&&!E&&(d=handleReset(y,c))}),w.subscribe(A),l||(l=new SafeSubscriber({next:function(C){return w.next(C)},error:function(C){h=!0,v(),d=handleReset(g,i,C),w.error(C)},complete:function(){E=!0,v(),d=handleReset(g,o),w.complete()}}),from(F).subscribe(l))})(a)}}function handleReset(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];return e===!0?(n(),null):e===!1?null:e.apply(void 0,__spreadArray([],__read(t))).pipe(take(1)).subscribe(function(){return n()})}function shareReplay(n,e,t){var r,i,s,o=!1;return n&&typeof n=="object"?(s=(r=n.bufferSize)!==null&&r!==void 0?r:1/0,e=(i=n.windowTime)!==null&&i!==void 0?i:1/0,o=!!n.refCount,t=n.scheduler):s=n!=null?n:1/0,share({connector:function(){return new ReplaySubject(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:o})}function single(n){return operate(function(e,t){var r=!1,i,s=!1,o=0;e.subscribe(new OperatorSubscriber(t,function(u){s=!0,(!n||n(u,o++,e))&&(r&&t.error(new SequenceError("Too many matching values")),r=!0,i=u)},function(){r?(t.next(i),t.complete()):t.error(s?new NotFoundError("No matching values"):new EmptyError)}))})}function skip(n){return filter(function(e,t){return n<=t})}function skipLast(n){return n<=0?identity:operate(function(e,t){var r=new Array(n),i=0;return e.subscribe(new OperatorSubscriber(t,function(s){var o=i++;if(o<n)r[o]=s;else{var u=o%n,c=r[u];r[u]=s,t.next(c)}})),function(){r=null}})}function skipUntil(n){return operate(function(e,t){var r=!1,i=new OperatorSubscriber(t,function(){i==null||i.unsubscribe(),r=!0},noop);innerFrom(n).subscribe(i),e.subscribe(new OperatorSubscriber(t,function(s){return r&&t.next(s)}))})}function skipWhile(n){return operate(function(e,t){var r=!1,i=0;e.subscribe(new OperatorSubscriber(t,function(s){return(r||(r=!n(s,i++)))&&t.next(s)}))})}function startWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popScheduler(n);return operate(function(r,i){(t?concat$1(n,r,t):concat$1(n,r)).subscribe(i)})}function switchMap(n,e){return operate(function(t,r){var i=null,s=0,o=!1,u=function(){return o&&!i&&r.complete()};t.subscribe(new OperatorSubscriber(r,function(c){i==null||i.unsubscribe();var a=0,l=s++;innerFrom(n(c,l)).subscribe(i=new OperatorSubscriber(r,function(d){return r.next(e?e(c,d,l,a++):d)},function(){i=null,u()}))},function(){o=!0,u()}))})}function switchAll(){return switchMap(identity)}function switchMapTo(n,e){return isFunction$1(e)?switchMap(function(){return n},e):switchMap(function(){return n})}function switchScan(n,e){return operate(function(t,r){var i=e;return switchMap(function(s,o){return n(i,s,o)},function(s,o){return i=o,o})(t).subscribe(r),function(){i=null}})}function takeUntil(n){return operate(function(e,t){innerFrom(n).subscribe(new OperatorSubscriber(t,function(){return t.complete()},noop)),!t.closed&&e.subscribe(t)})}function takeWhile(n,e){return e===void 0&&(e=!1),operate(function(t,r){var i=0;t.subscribe(new OperatorSubscriber(r,function(s){var o=n(s,i++);(o||e)&&r.next(s),!o&&r.complete()}))})}function tap(n,e,t){var r=isFunction$1(n)||e||t?{next:n,error:e,complete:t}:n;return r?operate(function(i,s){var o;(o=r.subscribe)===null||o===void 0||o.call(r);var u=!0;i.subscribe(new OperatorSubscriber(s,function(c){var a;(a=r.next)===null||a===void 0||a.call(r,c),s.next(c)},function(){var c;u=!1,(c=r.complete)===null||c===void 0||c.call(r),s.complete()},function(c){var a;u=!1,(a=r.error)===null||a===void 0||a.call(r,c),s.error(c)},function(){var c,a;u&&((c=r.unsubscribe)===null||c===void 0||c.call(r)),(a=r.finalize)===null||a===void 0||a.call(r)}))}):identity}var defaultThrottleConfig={leading:!0,trailing:!1};function throttle(n,e){var t=e===void 0?defaultThrottleConfig:e,r=t.leading,i=t.trailing;return operate(function(s,o){var u=!1,c=null,a=null,l=!1,d=function(){a==null||a.unsubscribe(),a=null,i&&(E(),l&&o.complete())},f=function(){a=null,l&&o.complete()},p=function(h){return a=innerFrom(n(h)).subscribe(new OperatorSubscriber(o,d,f))},E=function(){if(u){u=!1;var h=c;c=null,o.next(h),!l&&p(h)}};s.subscribe(new OperatorSubscriber(o,function(h){u=!0,c=h,!(a&&!a.closed)&&(r?E():p(h))},function(){l=!0,!(i&&u&&a&&!a.closed)&&o.complete()}))})}function throttleTime(n,e,t){e===void 0&&(e=asyncScheduler),t===void 0&&(t=defaultThrottleConfig);var r=timer(n,e);return throttle(function(){return r},t)}function timeInterval(n){return n===void 0&&(n=async),function(e){return defer(function(){return e.pipe(scan(function(t,r){var i=t.current;return{value:r,current:n.now(),last:i}},{current:n.now(),value:void 0,last:void 0}),map(function(t){var r=t.current,i=t.last,s=t.value;return new TimeInterval(s,r-i)}))})}}var TimeInterval=function(){function n(e,t){this.value=e,this.interval=t}return n}();function timeoutWith(n,e,t){var r,i,s;if(t=t!=null?t:async,isValidDate(n)?r=n:typeof n=="number"&&(i=n),e)s=function(){return e};else throw new TypeError("No observable provided to switch to");if(r==null&&i==null)throw new TypeError("No timeout provided.");return timeout({first:r,each:i,scheduler:t,with:s})}function timestamp(n){return n===void 0&&(n=dateTimestampProvider),map(function(e){return{value:e,timestamp:n.now()}})}function window$1(n){return operate(function(e,t){var r=new Subject;t.next(r.asObservable());var i=function(s){r.error(s),t.error(s)};return e.subscribe(new OperatorSubscriber(t,function(s){return r==null?void 0:r.next(s)},function(){r.complete(),t.complete()},i)),n.subscribe(new OperatorSubscriber(t,function(){r.complete(),t.next(r=new Subject)},noop,i)),function(){r==null||r.unsubscribe(),r=null}})}function windowCount(n,e){e===void 0&&(e=0);var t=e>0?e:n;return operate(function(r,i){var s=[new Subject],o=[],u=0;i.next(s[0].asObservable()),r.subscribe(new OperatorSubscriber(i,function(c){var a,l;try{for(var d=__values(s),f=d.next();!f.done;f=d.next()){var p=f.value;p.next(c)}}catch(v){a={error:v}}finally{try{f&&!f.done&&(l=d.return)&&l.call(d)}finally{if(a)throw a.error}}var E=u-n+1;if(E>=0&&E%t===0&&s.shift().complete(),++u%t===0){var h=new Subject;s.push(h),i.next(h.asObservable())}},function(){for(;s.length>0;)s.shift().complete();i.complete()},function(c){for(;s.length>0;)s.shift().error(c);i.error(c)},function(){o=null,s=null}))})}function windowTime(n){for(var e,t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var s=(e=popScheduler(r))!==null&&e!==void 0?e:asyncScheduler,o=(t=r[0])!==null&&t!==void 0?t:null,u=r[1]||1/0;return operate(function(c,a){var l=[],d=!1,f=function(v){var g=v.window,y=v.subs;g.complete(),y.unsubscribe(),arrRemove(l,v),d&&p()},p=function(){if(l){var v=new Subscription;a.add(v);var g=new Subject,y={window:g,subs:v,seen:0};l.push(y),a.next(g.asObservable()),v.add(s.schedule(function(){return f(y)},n))}};o!==null&&o>=0?a.add(s.schedule(function(){p(),!this.closed&&a.add(this.schedule(null,o))},o)):d=!0,p();var E=function(v){return l.slice().forEach(v)},h=function(v){E(function(g){var y=g.window;return v(y)}),v(a),a.unsubscribe()};return c.subscribe(new OperatorSubscriber(a,function(v){E(function(g){g.window.next(v),u<=++g.seen&&f(g)})},function(){return h(function(v){return v.complete()})},function(v){return h(function(g){return g.error(v)})})),function(){l=null}})}function windowToggle(n,e){return operate(function(t,r){var i=[],s=function(o){for(;0<i.length;)i.shift().error(o);r.error(o)};innerFrom(n).subscribe(new OperatorSubscriber(r,function(o){var u=new Subject;i.push(u);var c=new Subscription,a=function(){arrRemove(i,u),u.complete(),c.unsubscribe()},l;try{l=innerFrom(e(o))}catch(d){s(d);return}r.next(u.asObservable()),c.add(l.subscribe(new OperatorSubscriber(r,a,noop,s)))},noop)),t.subscribe(new OperatorSubscriber(r,function(o){var u,c,a=i.slice();try{for(var l=__values(a),d=l.next();!d.done;d=l.next()){var f=d.value;f.next(o)}}catch(p){u={error:p}}finally{try{d&&!d.done&&(c=l.return)&&c.call(l)}finally{if(u)throw u.error}}},function(){for(;0<i.length;)i.shift().complete();r.complete()},s,function(){for(;0<i.length;)i.shift().unsubscribe()}))})}function windowWhen(n){return operate(function(e,t){var r,i,s=function(u){r.error(u),t.error(u)},o=function(){i==null||i.unsubscribe(),r==null||r.complete(),r=new Subject,t.next(r.asObservable());var u;try{u=innerFrom(n())}catch(c){s(c);return}u.subscribe(i=new OperatorSubscriber(t,o,o,s))};o(),e.subscribe(new OperatorSubscriber(t,function(u){return r.next(u)},function(){r.complete(),t.complete()},s,function(){i==null||i.unsubscribe(),r=null}))})}function withLatestFrom(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=popResultSelector(n);return operate(function(r,i){for(var s=n.length,o=new Array(s),u=n.map(function(){return!1}),c=!1,a=function(d){innerFrom(n[d]).subscribe(new OperatorSubscriber(i,function(f){o[d]=f,!c&&!u[d]&&(u[d]=!0,(c=u.every(identity))&&(u=null))},noop))},l=0;l<s;l++)a(l);r.subscribe(new OperatorSubscriber(i,function(d){if(c){var f=__spreadArray([d],__read(o));i.next(t?t.apply(void 0,__spreadArray([],__read(f))):f)}}))})}function zipAll(n){return joinAllInternals(zip$1,n)}function zip(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return operate(function(t,r){zip$1.apply(void 0,__spreadArray([t],__read(n))).subscribe(r)})}function zipWith(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];return zip.apply(void 0,__spreadArray([],__read(n)))}const index=Object.freeze(Object.defineProperty({__proto__:null,Observable,ConnectableObservable,observable,animationFrames,Subject,BehaviorSubject,ReplaySubject,AsyncSubject,asap,asapScheduler,async,asyncScheduler,queue,queueScheduler,animationFrame,animationFrameScheduler,VirtualTimeScheduler,VirtualAction,Scheduler,Subscription,Subscriber,Notification:Notification$1,get NotificationKind(){return NotificationKind},pipe,noop,identity,isObservable,lastValueFrom,firstValueFrom,ArgumentOutOfRangeError,EmptyError,NotFoundError,ObjectUnsubscribedError,SequenceError,TimeoutError,UnsubscriptionError,bindCallback,bindNodeCallback,combineLatest:combineLatest$1,concat:concat$1,connectable,defer,empty,forkJoin,from,fromEvent,fromEventPattern,generate,iif,interval,merge:merge$2,never,of,onErrorResumeNext,pairs,partition,race,range,throwError,timer,using,zip:zip$1,scheduled,EMPTY,NEVER,config,audit,auditTime,buffer,bufferCount,bufferTime,bufferToggle,bufferWhen,catchError,combineAll,combineLatestAll,combineLatestWith,concatAll,concatMap,concatMapTo,concatWith,connect,count,debounce,debounceTime,defaultIfEmpty,delay,delayWhen,dematerialize,distinct,distinctUntilChanged,distinctUntilKeyChanged,elementAt,endWith,every,exhaust,exhaustAll,exhaustMap,expand,filter,finalize,find,findIndex,first,groupBy,ignoreElements,isEmpty,last,map,mapTo,materialize,max,mergeAll,flatMap,mergeMap,mergeMapTo,mergeScan,mergeWith,min,multicast,observeOn,pairwise,pluck,publish,publishBehavior,publishLast,publishReplay,raceWith,reduce,repeat,repeatWhen,retry,retryWhen,refCount,sample,sampleTime,scan,sequenceEqual,share,shareReplay,single,skip,skipLast,skipUntil,skipWhile,startWith,subscribeOn,switchAll,switchMap,switchMapTo,switchScan,take,takeLast,takeUntil,takeWhile,tap,throttle,throttleTime,throwIfEmpty,timeInterval,timeout,timeoutWith,timestamp,toArray,window:window$1,windowCount,windowTime,windowToggle,windowWhen,withLatestFrom,zipAll,zipWith},Symbol.toStringTag,{value:"Module"}));class Bus{constructor(){m(this,"agents",{});m(this,"comm",new Subject)}setAgentFor(e,t,r){let i=this.getActionMapping(e);i[t]=r}getAgentFor(e,t){return this.getActionMapping(e)[t]}publish(e,t,r){return Promise.resolve().then(()=>{var i;return(i=this.getAgentFor(e,t))!=null?i:explorer.requestAgentFor(e,t)}).then(i=>{const s=i.activate(e,t,r);return this.comm.next({res:e,action:t,input:r,output:s}),s})}subscribe(e,t){return this.comm.asObservable().pipe(filter(r=>r.res===e&&r.action===t))}getActionMapping(e){let t=this.agents[e];if(typeof t>"u"){t={};for(let r of Object.values(ACTION))t[r]=null;this.agents[e]=t}return t}}class BusFactory{static get instance(){return this._instance=this._instance||new Bus}}m(BusFactory,"_instance");const b=class{constructor(e){m(this,"managedResource");m(this,"handlerFor",{comment:b.defaultHandler,copy:b.defaultHandler,create:b.defaultHandler,delete:b.defaultHandler,export:b.defaultHandler,initialize:b.defaultHandler,manage:b.defaultHandler,properties:b.defaultHandler,move:b.defaultHandler,open:b.defaultHandler,print:b.defaultHandler,publish:b.defaultHandler,search:b.defaultHandler,share:b.defaultHandler,distribute:b.defaultHandler,pages_list:b.defaultHandler,register:b.defaultHandler,trash:b.defaultHandler,publish_moodle:b.defaultHandler,restore:b.defaultHandler});this.managedResource=e,this.initialize()}initialize(){for(let e in Object.values(ACTION))this.handlerFor[e]=b.defaultHandler;this.registerHandlers()}setHandler(e,t){BusFactory.instance.setAgentFor(this.managedResource,e,this),this.handlerFor[e]=t}getHandler(e){return this.handlerFor[e]}activate(e,t,r){return Promise.resolve().then(()=>this.getHandler(t).bind(this)(r))}};let AbstractBusAgent=b;m(AbstractBusAgent,"defaultHandler",function(e){throw new Error(ERROR_CODE.NOT_SUPPORTED)}),console.log("Blog agent loading....");class BlogAgent extends AbstractBusAgent{constructor(){super(RESOURCE.BLOG);m(this,"ctx",null);m(this,"http",TransportFrameworkFactory.instance().newHttpInstance());m(this,"checkHttpResponse",t=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return t});this.registerHandlers(),console.log("Blog agent initialized!")}registerHandlers(){this.setHandler(ACTION.OPEN,this.openBlog),this.setHandler(ACTION.CREATE,this.createBlog),this.setHandler(ACTION.MANAGE,this.onManage),this.setHandler(ACTION.UPD_PROPS,this.onUpdateProps),this.setHandler(ACTION.PRINT,this.onPrint),this.setHandler(ACTION.PUBLISH,this.onPublish)}onPrint(t){window.open(`/blog/print/blog#/print/${t.resourceId}?comments=${t.withComments||!0}`,"_blank")}openBlog(t){window.open(`/blog#/view/${t.resourceId}`,"_self")}createBlog(t){window.open("/blog#/edit/new","_self")}onManage(t){const r={genericProps:[{key:PROP_KEY.TITLE},{key:PROP_KEY.IMAGE},{key:PROP_KEY.URL}]};return Promise.resolve().then(()=>r)}onUpdateProps(t){const r={resources:t.resources};return alert("TODO: update properties"),Promise.resolve().then(()=>r)}async onPublish(t){const r=new FormData;return r.append("title",t.title),r.append("cover",t.cover),r.append("coverName",t.cover.name),r.append("coverType",t.cover.type),r.append("teacherAvatar",t.teacherAvatar),r.append("teacherAvatarName",t.teacherAvatar.name||`teacherAvatar_${t.userId}`),r.append("teacherAvatarType",t.teacherAvatar.type),r.append("language",t.language),t.activityType.forEach(s=>{r.append("activityType[]",s)}),t.subjectArea.forEach(s=>{r.append("subjectArea[]",s)}),t.age.forEach(s=>{r.append("age[]",s.toString())}),r.append("description",t.description),t.keyWords.split(",").forEach(s=>{r.append("keyWords[]",s.trim())}),r.append("licence",t.licence),r.append("pdfUri",`${window.location.origin}/blog/print/blog#/print/${t.resourceId}`),r.append("application",t.application?t.application:""),r.append("resourceId",t.resourceId),r.append("teacherSchool",t.userStructureName),this.http.post("/appregistry/library/resource",r,{headers:{"Content-Type":"multipart/form-data"}}).then(this.checkHttpResponse)}}const factory$1=()=>new BlogAgent;class FolderAgent extends AbstractBusAgent{constructor(){super(RESOURCE.FOLDER);m(this,"ctx",null);m(this,"http",TransportFrameworkFactory.instance().newHttpInstance({paramsSerializer:function(t){return Object.entries(t).map(r=>r[1]instanceof Array?r[1].map(i=>`${r[0]}=${encodeURIComponent(i)}`).join("&"):["string","number","boolean"].indexOf(typeof r[1])>=0?`${r[0]}=${encodeURIComponent(r[1])}`:"").join("&")}}));m(this,"checkHttpResponse",t=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return t});this.registerHandlers()}registerHandlers(){this.setHandler(ACTION.INITIALIZE,this.createContext),this.setHandler(ACTION.SEARCH,this.searchContext),this.setHandler(ACTION.CREATE,this.createFolder),this.setHandler(ACTION.OPEN,this.listSubfolders),this.setHandler(ACTION.MOVE,this.moveToFolder),this.setHandler(ACTION.DELETE,this.deleteFolders),this.setHandler(ACTION.TRASH,this.trashFolders),this.setHandler(ACTION.MANAGE,this.onManage),this.setHandler(ACTION.UPD_PROPS,this.updateFolder)}createContext(t){return this.http.get("/explorer/context",{queryParams:this.toQueryParams(t)}).then(this.checkHttpResponse)}searchContext(t){return this.http.get("/explorer/resources",{queryParams:this.toQueryParams(t)}).then(this.checkHttpResponse)}createFolder(t){return this.http.post("/explorer/folders",this.createFolderToBodyParams(t)).then(this.checkHttpResponse)}updateFolder(t){return this.http.put(`/explorer/folders/${t.folderId}`,this.createFolderToBodyParams(t)).then(this.checkHttpResponse)}moveToFolder(t){return this.http.post(`/explorer/folders/${t.folderId}/move`,this.moveToBodyParams(t)).then(this.checkHttpResponse)}listSubfolders(t){return this.http.get(`/explorer/folders/${t}/move`).then(this.checkHttpResponse)}deleteFolders(t){return this.http.deleteJson("/explorer",t).then(this.checkHttpResponse)}trashFolders({trash:t,resourceType:r,...i}){return this.http.putJson(`/explorer/${t?"trash":"restore"}`,i).then(this.checkHttpResponse)}onManage(t){const r={genericProps:[{key:PROP_KEY.TITLE},{key:PROP_KEY.IMAGE},{key:PROP_KEY.URL}]};return Promise.resolve().then(()=>r)}toQueryParams(t){let r={application:t.app,start_idx:t.pagination.startIdx,page_size:t.pagination.pageSize,resource_type:t.types};return t.orders&&(r.order_by=Object.entries(t.orders).map(i=>`${i[0]}:${i[1]}`)),t.filters&&Object.assign(r,t.filters),typeof t.search=="string"&&(r.search=t.search),r}createFolderToBodyParams(t){return{application:t.app,resourceType:t.type,parentId:t.parentId,name:t.name}}moveToBodyParams(t){return{application:t.application,resourceType:this.managedResource,resourceIds:t.resourceIds,folderIds:t.folderIds}}}const factory=()=>new FolderAgent;class AgentLoader{load(e){let t=appNameForResource[e];if(typeof t!="string")throw new Error(`The resource type ${e} is not supported yet.`);switch(t){case APP.EXPLORER:factory();break;case APP.BLOG:factory$1();break;default:throw new Error(`The resource type ${e} is not supported yet.`)}return Promise.resolve()}}class ExplorerContext{constructor(e,t){m(this,"searchParameters");m(this,"context");m(this,"bus");m(this,"latestResults",new Subject);this.context=null,this.bus=ExplorerFrameworkFactory.instance().getBus(),this.searchParameters={types:e,app:t,filters:{},pagination:{startIdx:0,pageSize:20}}}clear(){this.searchParameters.filters={owner:!0,shared:!0,public:!0},this.searchParameters.pagination.startIdx=0,this.searchParameters.pagination.pageSize=20,this.context=null}isInitialized(){return this.context!==null}getContext(){if(this.context!==null)return this.context}getSearchParameters(){return this.searchParameters}duplicateSearchParameters(){return JSON.parse(JSON.stringify(this.searchParameters))}latestResources(){return this.latestResults.asObservable()}initialize(){const e=this.duplicateSearchParameters();return Promise.resolve().then(()=>this.bus.publish(RESOURCE.FOLDER,ACTION.INITIALIZE,e)).then(t=>{if(this.context=t,!this.context)throw new Error(ERROR_CODE.UNKNOWN);return this.latestResults.next({input:e,output:this.context}),this.context})}getResources(){const e=this.duplicateSearchParameters();return this.bus.publish(RESOURCE.FOLDER,ACTION.SEARCH,e).then(t=>{let r=t;if(!r)throw new Error(ERROR_CODE.UNKNOWN);return this.latestResults.next({input:e,output:r}),r})}getSubFolders(e){throw new Error("Method not implemented.")}createFolder(e,t,r){const i={app:this.searchParameters.app,name:r,parentId:t,type:e};return this.bus.publish(RESOURCE.FOLDER,ACTION.CREATE,i).then(s=>{let o=s;if(!o)throw new Error(ERROR_CODE.UNKNOWN);return o})}updateFolder(e,t,r,i){const s={folderId:e,app:this.searchParameters.app,name:i,parentId:r,type:t};return this.bus.publish(RESOURCE.FOLDER,ACTION.UPD_PROPS,s).then(o=>{let u=o;if(!u)throw new Error(ERROR_CODE.UNKNOWN);return u})}copy(e,t,r){const i={application:this.searchParameters.app,folderId:e,resourceIds:t,folderIds:r};return this.bus.publish(RESOURCE.FOLDER,ACTION.COPY,i).then(s=>{})}move(e,t,r){const i={application:this.searchParameters.app,folderId:e,resourceIds:t,folderIds:r};return this.bus.publish(RESOURCE.FOLDER,ACTION.MOVE,i).then(s=>{})}delete(e,t){const r={application:this.searchParameters.app,resourceType:this.searchParameters.types[0],resourceIds:e,folderIds:t};return this.bus.publish(RESOURCE.FOLDER,ACTION.DELETE,r).then(i=>{})}trash(e,t,r){const i={trash:e,application:this.searchParameters.app,resourceType:this.searchParameters.types[0],resourceIds:t,folderIds:r};return this.bus.publish(RESOURCE.FOLDER,ACTION.TRASH,i).then(s=>{})}manageProperties(e,t){const r={resources:t};return this.bus.publish(e,ACTION.MANAGE,r).then(i=>{let s=i;if(!s)throw new Error(ERROR_CODE.UNKNOWN);return s})}updateProperties(e,t,r){const i={resources:t,props:r};return this.bus.publish(e,ACTION.UPD_PROPS,i).then(s=>{let o=s;if(!o)throw new Error(ERROR_CODE.UNKNOWN);return o})}publish(e,t){return this.bus.publish(e,ACTION.PUBLISH,t).then(r=>{let i=r;if(!i)throw new Error(ERROR_CODE.UNKNOWN);return i})}}class ExplorerFramework{constructor(){m(this,"_agentLoader")}get agentLoader(){return this._agentLoader||(this._agentLoader=new AgentLoader),this._agentLoader}setAgentLoader(e){e&&(this._agentLoader=e)}requestAgentFor(e,t){return this.agentLoader.load(e).then(()=>{let r=this.getBus().getAgentFor(e,t);if(!r)throw new Error(ERROR_CODE.AGENT_NOT_FOUND);return r})}createContext(e,t){return new ExplorerContext(e,t)}getBus(){return BusFactory.instance}}const explorer=new ExplorerFramework;class ExplorerFrameworkFactory{static instance(){return explorer}}const RESOURCE={FOLDER:"folder",BLOG:"blog",EXERCISE:"exercise"},appNameForResource={folder:APP.EXPLORER,blog:APP.BLOG,exercise:APP.EXERCIZER},ACTION={INITIALIZE:"initialize",SEARCH:"search",CREATE:"create",OPEN:"open",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"},STRING_FILTER={},SORT_ORDER={ASC:"asc",DESC:"desc"},SORT_BY={NAME:"name",MODIFY_DATE:"updatedAt",CREATEDAT:"createdAt",APPLICATION:"application",RESOURCE_TYPE:"resourceType"},PROP_KEY={TITLE:"title",IMAGE:"image",COLOR:"color",DESCRIPTION:"description",URL:"url"},PROP_MODE={READONLY:"RO",READWRITE:"RW"},PROP_TYPE={TEXT:"text",NUMBER:"number",DATE:"date",IMAGE:"image"},PROP_FORMAT={PLAIN:"plain"},ASYNC_DATA_NAME={SESSION_READY:"sessionReady",LANG_READY:"langReady",SKIN_READY:"skinReady",OVERRIDE_READY:"overrideReady"};class Promisified{constructor(){m(this,"_resolution");m(this,"_rejection");m(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(){m(this,"promises",{});m(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)}promisify(){return new Promisified}events(){return this.subject}}const notify=new NotifyFramework;class NotifyFrameworkFactory{static instance(){return notify}}const LAYER_NAME={WIDGETS:"widgets",EXPLORER:"explorer"},EVENT_NAME={USERPREF_CHANGED:"userprefChanged",SEARCH_RESULTED:"searchResulted"};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var axios$3={exports:{}},axios$2={exports:{}},bind$2=function(e,t){return function(){for(var i=new Array(arguments.length),s=0;s<i.length;s++)i[s]=arguments[s];return e.apply(t,i)}},bind$1=bind$2,toString=Object.prototype.toString;function isArray(n){return toString.call(n)==="[object Array]"}function isUndefined(n){return typeof n>"u"}function isBuffer(n){return n!==null&&!isUndefined(n)&&n.constructor!==null&&!isUndefined(n.constructor)&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function isArrayBuffer(n){return toString.call(n)==="[object ArrayBuffer]"}function isFormData(n){return typeof FormData<"u"&&n instanceof FormData}function isArrayBufferView(n){var e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&n.buffer instanceof ArrayBuffer,e}function isString(n){return typeof n=="string"}function isNumber(n){return typeof n=="number"}function isObject(n){return n!==null&&typeof n=="object"}function isPlainObject(n){if(toString.call(n)!=="[object Object]")return!1;var e=Object.getPrototypeOf(n);return e===null||e===Object.prototype}function isDate(n){return toString.call(n)==="[object Date]"}function isFile(n){return toString.call(n)==="[object File]"}function isBlob(n){return toString.call(n)==="[object Blob]"}function isFunction(n){return toString.call(n)==="[object Function]"}function isStream(n){return isObject(n)&&isFunction(n.pipe)}function isURLSearchParams(n){return typeof URLSearchParams<"u"&&n instanceof URLSearchParams}function trim(n){return n.replace(/^\s*/,"").replace(/\s*$/,"")}function isStandardBrowserEnv(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function forEach(n,e){if(!(n===null||typeof n>"u"))if(typeof n!="object"&&(n=[n]),isArray(n))for(var t=0,r=n.length;t<r;t++)e.call(null,n[t],t,n);else for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.call(null,n[i],i,n)}function merge(){var n={};function e(i,s){isPlainObject(n[s])&&isPlainObject(i)?n[s]=merge(n[s],i):isPlainObject(i)?n[s]=merge({},i):isArray(i)?n[s]=i.slice():n[s]=i}for(var t=0,r=arguments.length;t<r;t++)forEach(arguments[t],e);return n}function extend(n,e,t){return forEach(e,function(i,s){t&&typeof i=="function"?n[s]=bind$1(i,t):n[s]=i}),n}function stripBOM(n){return n.charCodeAt(0)===65279&&(n=n.slice(1)),n}var utils$9={isArray,isArrayBuffer,isBuffer,isFormData,isArrayBufferView,isString,isNumber,isObject,isPlainObject,isUndefined,isDate,isFile,isBlob,isFunction,isStream,isURLSearchParams,isStandardBrowserEnv,forEach,merge,extend,trim,stripBOM},utils$8=utils$9;function encode(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var buildURL$1=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(utils$8.isURLSearchParams(t))i=t.toString();else{var s=[];utils$8.forEach(t,function(c,a){c===null||typeof c>"u"||(utils$8.isArray(c)?a=a+"[]":c=[c],utils$8.forEach(c,function(d){utils$8.isDate(d)?d=d.toISOString():utils$8.isObject(d)&&(d=JSON.stringify(d)),s.push(encode(a)+"="+encode(d))}))}),i=s.join("&")}if(i){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e},utils$7=utils$9;function InterceptorManager$1(){this.handlers=[]}InterceptorManager$1.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},InterceptorManager$1.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},InterceptorManager$1.prototype.forEach=function(e){utils$7.forEach(this.handlers,function(r){r!==null&&e(r)})};var InterceptorManager_1=InterceptorManager$1,utils$6=utils$9,transformData$1=function(e,t,r){return utils$6.forEach(r,function(s){e=s(e,t)}),e},isCancel$1,hasRequiredIsCancel;function requireIsCancel(){return hasRequiredIsCancel||(hasRequiredIsCancel=1,isCancel$1=function(e){return!!(e&&e.__CANCEL__)}),isCancel$1}var utils$5=utils$9,normalizeHeaderName$1=function(e,t){utils$5.forEach(e,function(i,s){s!==t&&s.toUpperCase()===t.toUpperCase()&&(e[t]=i,delete e[s])})},enhanceError,hasRequiredEnhanceError;function requireEnhanceError(){return hasRequiredEnhanceError||(hasRequiredEnhanceError=1,enhanceError=function(e,t,r,i,s){return e.config=t,r&&(e.code=r),e.request=i,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}),enhanceError}var createError,hasRequiredCreateError;function requireCreateError(){if(hasRequiredCreateError)return createError;hasRequiredCreateError=1;var n=requireEnhanceError();return createError=function(t,r,i,s,o){var u=new Error(t);return n(u,r,i,s,o)},createError}var settle,hasRequiredSettle;function requireSettle(){if(hasRequiredSettle)return settle;hasRequiredSettle=1;var n=requireCreateError();return settle=function(t,r,i){var s=i.config.validateStatus;!i.status||!s||s(i.status)?t(i):r(n("Request failed with status code "+i.status,i.config,null,i.request,i))},settle}var cookies,hasRequiredCookies;function requireCookies(){if(hasRequiredCookies)return cookies;hasRequiredCookies=1;var n=utils$9;return cookies=n.isStandardBrowserEnv()?function(){return{write:function(r,i,s,o,u,c){var a=[];a.push(r+"="+encodeURIComponent(i)),n.isNumber(s)&&a.push("expires="+new Date(s).toGMTString()),n.isString(o)&&a.push("path="+o),n.isString(u)&&a.push("domain="+u),c===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(r){var i=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return i?decodeURIComponent(i[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),cookies}var isAbsoluteURL,hasRequiredIsAbsoluteURL;function requireIsAbsoluteURL(){return hasRequiredIsAbsoluteURL||(hasRequiredIsAbsoluteURL=1,isAbsoluteURL=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}),isAbsoluteURL}var combineURLs,hasRequiredCombineURLs;function requireCombineURLs(){return hasRequiredCombineURLs||(hasRequiredCombineURLs=1,combineURLs=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}),combineURLs}var buildFullPath,hasRequiredBuildFullPath;function requireBuildFullPath(){if(hasRequiredBuildFullPath)return buildFullPath;hasRequiredBuildFullPath=1;var n=requireIsAbsoluteURL(),e=requireCombineURLs();return buildFullPath=function(r,i){return r&&!n(i)?e(r,i):i},buildFullPath}var parseHeaders,hasRequiredParseHeaders;function requireParseHeaders(){if(hasRequiredParseHeaders)return parseHeaders;hasRequiredParseHeaders=1;var n=utils$9,e=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];return parseHeaders=function(r){var i={},s,o,u;return r&&n.forEach(r.split(`
17
+ `),function(a){if(u=a.indexOf(":"),s=n.trim(a.substr(0,u)).toLowerCase(),o=n.trim(a.substr(u+1)),s){if(i[s]&&e.indexOf(s)>=0)return;s==="set-cookie"?i[s]=(i[s]?i[s]:[]).concat([o]):i[s]=i[s]?i[s]+", "+o:o}}),i},parseHeaders}var isURLSameOrigin,hasRequiredIsURLSameOrigin;function requireIsURLSameOrigin(){if(hasRequiredIsURLSameOrigin)return isURLSameOrigin;hasRequiredIsURLSameOrigin=1;var n=utils$9;return isURLSameOrigin=n.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),i;function s(o){var u=o;return t&&(r.setAttribute("href",u),u=r.href),r.setAttribute("href",u),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return i=s(window.location.href),function(u){var c=n.isString(u)?s(u):u;return c.protocol===i.protocol&&c.host===i.host}}():function(){return function(){return!0}}(),isURLSameOrigin}var xhr,hasRequiredXhr;function requireXhr(){if(hasRequiredXhr)return xhr;hasRequiredXhr=1;var n=utils$9,e=requireSettle(),t=requireCookies(),r=buildURL$1,i=requireBuildFullPath(),s=requireParseHeaders(),o=requireIsURLSameOrigin(),u=requireCreateError();return xhr=function(a){return new Promise(function(d,f){var p=a.data,E=a.headers;n.isFormData(p)&&delete E["Content-Type"];var h=new XMLHttpRequest;if(a.auth){var v=a.auth.username||"",g=a.auth.password?unescape(encodeURIComponent(a.auth.password)):"";E.Authorization="Basic "+btoa(v+":"+g)}var y=i(a.baseURL,a.url);if(h.open(a.method.toUpperCase(),r(y,a.params,a.paramsSerializer),!0),h.timeout=a.timeout,h.onreadystatechange=function(){if(!(!h||h.readyState!==4)&&!(h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0))){var w="getAllResponseHeaders"in h?s(h.getAllResponseHeaders()):null,C=!a.responseType||a.responseType==="text"?h.responseText:h.response,O={data:C,status:h.status,statusText:h.statusText,headers:w,config:a,request:h};e(d,f,O),h=null}},h.onabort=function(){!h||(f(u("Request aborted",a,"ECONNABORTED",h)),h=null)},h.onerror=function(){f(u("Network Error",a,null,h)),h=null},h.ontimeout=function(){var w="timeout of "+a.timeout+"ms exceeded";a.timeoutErrorMessage&&(w=a.timeoutErrorMessage),f(u(w,a,"ECONNABORTED",h)),h=null},n.isStandardBrowserEnv()){var F=(a.withCredentials||o(y))&&a.xsrfCookieName?t.read(a.xsrfCookieName):void 0;F&&(E[a.xsrfHeaderName]=F)}if("setRequestHeader"in h&&n.forEach(E,function(w,C){typeof p>"u"&&C.toLowerCase()==="content-type"?delete E[C]:h.setRequestHeader(C,w)}),n.isUndefined(a.withCredentials)||(h.withCredentials=!!a.withCredentials),a.responseType)try{h.responseType=a.responseType}catch(A){if(a.responseType!=="json")throw A}typeof a.onDownloadProgress=="function"&&h.addEventListener("progress",a.onDownloadProgress),typeof a.onUploadProgress=="function"&&h.upload&&h.upload.addEventListener("progress",a.onUploadProgress),a.cancelToken&&a.cancelToken.promise.then(function(w){!h||(h.abort(),f(w),h=null)}),p||(p=null),h.send(p)})},xhr}var utils$4=utils$9,normalizeHeaderName=normalizeHeaderName$1,DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(n,e){!utils$4.isUndefined(n)&&utils$4.isUndefined(n["Content-Type"])&&(n["Content-Type"]=e)}function getDefaultAdapter(){var n;return(typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(n=requireXhr()),n}var defaults$2={adapter:getDefaultAdapter(),transformRequest:[function(e,t){return normalizeHeaderName(t,"Accept"),normalizeHeaderName(t,"Content-Type"),utils$4.isFormData(e)||utils$4.isArrayBuffer(e)||utils$4.isBuffer(e)||utils$4.isStream(e)||utils$4.isFile(e)||utils$4.isBlob(e)?e:utils$4.isArrayBufferView(e)?e.buffer:utils$4.isURLSearchParams(e)?(setContentTypeIfUnset(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):utils$4.isObject(e)?(setContentTypeIfUnset(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if(typeof e=="string")try{e=JSON.parse(e)}catch{}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};defaults$2.headers={common:{Accept:"application/json, text/plain, */*"}},utils$4.forEach(["delete","get","head"],function(e){defaults$2.headers[e]={}}),utils$4.forEach(["post","put","patch"],function(e){defaults$2.headers[e]=utils$4.merge(DEFAULT_CONTENT_TYPE)});var defaults_1=defaults$2,utils$3=utils$9,transformData=transformData$1,isCancel=requireIsCancel(),defaults$1=defaults_1;function throwIfCancellationRequested(n){n.cancelToken&&n.cancelToken.throwIfRequested()}var dispatchRequest$1=function(e){throwIfCancellationRequested(e),e.headers=e.headers||{},e.data=transformData(e.data,e.headers,e.transformRequest),e.headers=utils$3.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),utils$3.forEach(["delete","get","head","post","put","patch","common"],function(i){delete e.headers[i]});var t=e.adapter||defaults$1.adapter;return t(e).then(function(i){return throwIfCancellationRequested(e),i.data=transformData(i.data,i.headers,e.transformResponse),i},function(i){return isCancel(i)||(throwIfCancellationRequested(e),i&&i.response&&(i.response.data=transformData(i.response.data,i.response.headers,e.transformResponse))),Promise.reject(i)})},utils$2=utils$9,mergeConfig$2=function(e,t){t=t||{};var r={},i=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function c(f,p){return utils$2.isPlainObject(f)&&utils$2.isPlainObject(p)?utils$2.merge(f,p):utils$2.isPlainObject(p)?utils$2.merge({},p):utils$2.isArray(p)?p.slice():p}function a(f){utils$2.isUndefined(t[f])?utils$2.isUndefined(e[f])||(r[f]=c(void 0,e[f])):r[f]=c(e[f],t[f])}utils$2.forEach(i,function(p){utils$2.isUndefined(t[p])||(r[p]=c(void 0,t[p]))}),utils$2.forEach(s,a),utils$2.forEach(o,function(p){utils$2.isUndefined(t[p])?utils$2.isUndefined(e[p])||(r[p]=c(void 0,e[p])):r[p]=c(void 0,t[p])}),utils$2.forEach(u,function(p){p in t?r[p]=c(e[p],t[p]):p in e&&(r[p]=c(void 0,e[p]))});var l=i.concat(s).concat(o).concat(u),d=Object.keys(e).concat(Object.keys(t)).filter(function(p){return l.indexOf(p)===-1});return utils$2.forEach(d,a),r},utils$1=utils$9,buildURL=buildURL$1,InterceptorManager=InterceptorManager_1,dispatchRequest=dispatchRequest$1,mergeConfig$1=mergeConfig$2;function Axios$1(n){this.defaults=n,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}Axios$1.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=mergeConfig$1(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[dispatchRequest,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach(function(s){t.unshift(s.fulfilled,s.rejected)}),this.interceptors.response.forEach(function(s){t.push(s.fulfilled,s.rejected)});t.length;)r=r.then(t.shift(),t.shift());return r},Axios$1.prototype.getUri=function(e){return e=mergeConfig$1(this.defaults,e),buildURL(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},utils$1.forEach(["delete","get","head","options"],function(e){Axios$1.prototype[e]=function(t,r){return this.request(mergeConfig$1(r||{},{method:e,url:t,data:(r||{}).data}))}}),utils$1.forEach(["post","put","patch"],function(e){Axios$1.prototype[e]=function(t,r,i){return this.request(mergeConfig$1(i||{},{method:e,url:t,data:r}))}});var Axios_1=Axios$1,Cancel_1,hasRequiredCancel;function requireCancel(){if(hasRequiredCancel)return Cancel_1;hasRequiredCancel=1;function n(e){this.message=e}return n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,Cancel_1=n,Cancel_1}var CancelToken_1,hasRequiredCancelToken;function requireCancelToken(){if(hasRequiredCancelToken)return CancelToken_1;hasRequiredCancelToken=1;var n=requireCancel();function e(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var r;this.promise=new Promise(function(o){r=o});var i=this;t(function(o){i.reason||(i.reason=new n(o),r(i.reason))})}return e.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},e.source=function(){var r,i=new e(function(o){r=o});return{token:i,cancel:r}},CancelToken_1=e,CancelToken_1}var spread,hasRequiredSpread;function requireSpread(){return hasRequiredSpread||(hasRequiredSpread=1,spread=function(e){return function(r){return e.apply(null,r)}}),spread}var isAxiosError,hasRequiredIsAxiosError;function requireIsAxiosError(){return hasRequiredIsAxiosError||(hasRequiredIsAxiosError=1,isAxiosError=function(e){return typeof e=="object"&&e.isAxiosError===!0}),isAxiosError}var utils=utils$9,bind=bind$2,Axios=Axios_1,mergeConfig=mergeConfig$2,defaults=defaults_1;function createInstance(n){var e=new Axios(n),t=bind(Axios.prototype.request,e);return utils.extend(t,Axios.prototype,e),utils.extend(t,e),t}var axios$1=createInstance(defaults);axios$1.Axios=Axios,axios$1.create=function(e){return createInstance(mergeConfig(axios$1.defaults,e))},axios$1.Cancel=requireCancel(),axios$1.CancelToken=requireCancelToken(),axios$1.isCancel=requireIsCancel(),axios$1.all=function(e){return Promise.all(e)},axios$1.spread=requireSpread(),axios$1.isAxiosError=requireIsAxiosError(),axios$2.exports=axios$1,axios$2.exports.default=axios$1,function(n){n.exports=axios$2.exports}(axios$3);const axios=getDefaultExportFromCjs(axios$3.exports),loadedScripts$1={};class Http{constructor(e){m(this,"axios");m(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 r=""+e;(r.startsWith("/infra/public")||r.startsWith("/assets")||/^\/([^\/]*)\/public/.test(r))&&(e=t+r)}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}get(e,t){return this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t)).then(r=>this.mapAxiosResponse(r,t)).catch(r=>this.mapAxiosError(r,t))}post(e,t,r){return this.axios.post(e,t,this.toAxiosConfig(r)).then(i=>this.mapAxiosResponse(i,r)).catch(i=>this.mapAxiosError(i,r))}postFile(e,t,r){const i=this.toAxiosConfig(r);return i.headers&&i.headers["Content-Type"]&&delete i.headers["Content-Type"],this.axios.post(e,t,i).then(s=>this.mapAxiosResponse(s,r)).catch(s=>this.mapAxiosError(s,r))}postJson(e,t,r){const i=this.toAxiosConfig();return i.headers&&(i.headers["Content-Type"]="application/json"),this.axios.post(e,t,this.toAxiosConfig(r)).then(s=>this.mapAxiosResponse(s,r)).catch(s=>this.mapAxiosError(s,r))}put(e,t,r){return this.axios.put(e,t,this.toAxiosConfig(r)).then(i=>this.mapAxiosResponse(i,r)).catch(i=>this.mapAxiosError(i,r))}putJson(e,t,r){const i=this.toAxiosConfig(r);return i.headers&&(i.headers["Content-Type"]="application/json"),this.axios.put(e,t,i).then(s=>this.mapAxiosResponse(s,r)).catch(s=>this.mapAxiosError(s,r))}delete(e,t){return this.axios.delete(e,this.toAxiosConfig(t)).then(r=>this.mapAxiosResponse(r,t)).catch(r=>this.mapAxiosError(r,t))}deleteJson(e,t){return this.axios.delete(e,{data:t}).then(r=>this.mapAxiosResponse(r)).catch(r=>this.mapAxiosError(r))}getScript(e,t,r){const i=r!=null?r:"exports",s=this.toAxiosConfig(t);return s.headers&&(s.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),s).then(o=>this.mapAxiosResponse(o,t)).then(o=>{try{const u=`"use strict";var ${i.split(".")[0]}={};${o};return ${i};`;return Function(u)()}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(r=>{loadedScripts$1[e]=!0})}}class TransportFramework{constructor(){m(this,"_http",new Http)}get http(){return this._http}newHttpInstance(e){return new Http(e)}}const transport=new TransportFramework;class TransportFrameworkFactory{static instance(){return transport}}const http$2=transport.http;class Session{constructor(){m(this,"_me",null);m(this,"_currentLanguage","");m(this,"_notLoggedIn",!0);m(this,"_description");m(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.latestResponse.status<200||http$2.latestResponse.status>=300)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(r=>r.name===e))!==-1}hasRight(e,t){if(t==="owner")return e.owner&&e.owner.userId===this._me.userId;const r=t.right||t,s=e.shared.filter(u=>(this._me.groupsIds||[]).indexOf(u.groupId)!==-1||u.userId===this._me.userId).find(u=>u[r]||u.manager)!==void 0,o=t.workflow?this.hasWorkflow(t.workflow):!0;return s&&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(){m(this,"session",new Session)}initialize(){return this.session.initialize()}login(e,t,r,i){const s=new FormData;return s.append("email",e),s.append("password",t),typeof r<"u"&&s.append("rememberMe",""+r),typeof i<"u"&&s.append("secureLocation",""+i),transport.http.post("/auth/login",s,{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(){m(this,"_conf");m(this,"_loaded");m(this,"skinName","");m(this,"themeName","");m(this,"skin","raw");m(this,"themeUrl","/assets/themes/raw/default/");m(this,"templateOverrides",{});m(this,"portalTemplate","/assets/themes/raw/portal.html");m(this,"basePath","");m(this,"logoutCallback","/");m(this,"skins",[]);m(this,"is1D",!1);m(this,"is2D",!1);m(this,"_onSkinReady",notify.onSkinReady());m(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){var t;return this._conf=(t=this._conf)!=null?t:await transport.http.getScript("/assets/theme-conf.js",{queryParams:{v:e!=null?e:this.version}},"exports.conf"),this._conf}load(e){return e=e!=null?e:this.version,this._loaded||(this._loaded=(session.session.notLoggedIn?this.loadDisconnected(e):this.loadConnected(e)).then(async()=>{var r,i;const t=await this.listSkins();this.is1D=((r=t.find(s=>s.child===this.skin))==null?void 0:r.parent)==="panda",this.is2D=((i=t.find(s=>s.child===this.skin))==null?void 0:i.parent)==="theme-open-ent"})),this._loaded}loadDisconnected(e){return new Promise((t,r)=>{transport.http.get("/skin",{queryParams:{v:this.version}}).then(i=>{this.skin=i.skin,this.themeUrl=`${this.cdnDomain}/assets/themes/${i.skin}/skins/default/`,this.basePath=this.themeUrl+"../../",this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${i.skin}/template/override.json`,{disableNotifications:!0,queryParams:{v:e}}).then(s=>{this.templateOverrides=s,this._onOverrideReady.resolve(s),t()}).catch(s=>{if(transport.http.latestResponse.status===404)t();else throw s})}).catch(i=>{this._onSkinReady.reject(i),this._onOverrideReady.reject(i),r()})})}loadConnected(e){return new Promise((t,r)=>{this.loadDefaultTheme(e).then(()=>{this._onSkinReady.resolve(this),transport.http.get(`/assets/themes/${this.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(),this._onSkinReady.reject(i),this._onOverrideReady.reject(i);else throw i})})})}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(r=>r.child===this.skin);return t!=null&&t.group?this.skins=this.skins.concat(e.overriding.filter(r=>r.group===t.group)):this.skins=this.skins.concat(e.overriding),this.skins})}async getHelpPath(){var r;const t=(await this.listSkins()).find(i=>i.child===this.skin);return(r=t==null?void 0:t.help)!=null?r:"/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!=null?e:"";let r=bundle$1[e]===void 0?e:bundle$1[e];if(t&&typeof t=="object")for(let i in t)typeof t[i]<"u"&&(r=r.replace(new RegExp("\\${"+i+"}","g"),""+t[i]));return r}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,r){const i=promises$1[t];if(i)r&&i.then(r).catch(r);else{const s=new Promisified;promises$1[t]=s.promise;const o={};e&&(o["Accept-Language"]=e),transport.http.get(t,{headers:o}).then(u=>{Object.assign(bundle$1,u),typeof r=="function"&&r(),s.resolve()}).catch(u=>{typeof r=="function"&&r(),s.reject()})}}addTranslations(e,t){notify.onLangReady().promise.then(r=>{this.loadBundle(r,e+"/"+r+".json",t)})}addAllTranslations(e){return e&&e.length>0?notify.onLangReady().promise.then(t=>Promise.all(e.map(r=>this.loadBundlePromise(t,r+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(var t in e)typeof bundle$1[t]!="string"&&(bundle$1[t]=e[t])}removeAccents(e){for(var t=0;t<defaultDiacriticsRemovalMap$1.length;t++)e=e.replace(defaultDiacriticsRemovalMap$1[t].letters,defaultDiacriticsRemovalMap$1[t].base);return e}}class UserPreferences{constructor(){m(this,"data",{})}get(e){return this.data[e]}load(e,t){return transport.http.get("/userbook/preference/"+e).then(r=>{try{return JSON.parse(r.preference)}catch{return t!=null?t:{}}}).then(r=>(this.data[e]=r!=null?r:{},r))}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(){m(this,"_me",null);m(this,"_keepOpenOnLogout",!1);m(this,"_preferences",new UserPreferences);m(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 r;if(t&&t.length&&typeof t.concat=="function"){this._bookmarkedApps=t,r={bookmarks:t.map(o=>o.name),applications:[]},transport.http.putJson("/userbook/preference/apps",r);return}else r=t;r||(r={bookmarks:[],applications:[]});let i=!0;const s=[];r.bookmarks.forEach((o,u)=>{const c=this._me.apps.find(a=>a.name===o);if(c){let a=Object.assign({},c);this._bookmarkedApps.push(a)}else s.push(o),i=!1}),s.forEach(o=>{let u=r.bookmarks.indexOf(o);u!==-1&&r.bookmarks.splice(u,1)}),i||transport.http.putJson("/userbook/preference/apps",r)})}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(){m(this,"_publicConf",{});m(this,"_currentApp");m(this,"_appConf",{})}get currentApp(){var e;return(e=this._currentApp)!=null?e: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){var r;let t;return this._appConf[e]||(await http$1.get("/applications-list")).apps.forEach(s=>{if(s!=null&&s.prefix){const o=s.prefix.replace("/","");this._appConf[o]=s}else s!=null&&s.name&&s.name.toLowerCase()==e&&(t=s)}),(r=this._appConf[e])!=null?r:t}async loadI18n(e){return await notify.onLangReady().promise,configure.Platform.idiom.addBundlePromise(`/${e}/i18n`)}}class Analytics{constructor(){m(this,"_status","void");m(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(r=>!t||r.type===e||r.type==="multiple"?r[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){var a;if(!e.structureMap||!configure.Platform.apps.currentApp)return;const t=await notify.onSessionReady().promise,r=session.session.description;let i;for(let l of t.structures){const d=e.structureMap[l];if(d&&d.collectiviteId&&d.UAI){i=d;break}}if(!i||!i.active)return;const s=await configure.Platform.apps.getPublicConf(configure.Platform.apps.currentApp);if(!s)return;const o=s.xiti;if(!o||!o.LIBELLE_SERVICE||!i.UAI)return;function u(l){let d="";for(let f=0;f<l.length;f++)d+=l.charCodeAt(f);return d}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:i.collectiviteId,STRUCT_UAI:i.UAI,PROJET:i.projetId?i.projetId:e.ID_PROJET,EXPLOITANT:e.ID_EXPLOITANT,PLATFORME:i.plateformeId?i.plateformeId:e.ID_PLATEFORME,ID_PERSO:u(t.userId),PROFILE:r.profiles&&r.profiles.length>0&&(a=c[r.profiles[0]])!=null?a:""}}}class ConfigurationFramework{constructor(){m(this,"Platform",{deploymentTag:"",cdnDomain:"",apps:new AppConf,theme:new Theme,analytics:new Analytics,idiom:new Idiom,listLanguages:()=>transport.http.get("/languages")});m(this,"School",{});m(this,"User",new User)}async initialize(e,t){if(!e){const i=a=>(a<10?"0":"")+a.toFixed(0),s=new Date,o=s.getFullYear(),u=s.getMonth()+1,c=s.getDate();e=`${o}${i(u)}${i(c)}`}const r=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(r),notify.onSessionReady().promise.then(i=>this.Platform.idiom.addBundlePromise("/i18n")),this.User.initialize(r)])}}const configure=new ConfigurationFramework;class ConfigurationFrameworkFactory{static instance(){return configure}}class SessionFrameworkFactory{static instance(){return session}}const WIDGET_POSITION={LEFT:"left",RIGHT:"right"},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(){m(this,"_initialized");m(this,"_widgets",[]);m(this,"_userPrefs",{})}initialize(e,t){return this._initialized||(this._initialized=new Promisified,notify.onSessionReady().promise.then(r=>{var i;r&&r.widgets?(r.widgets.forEach(s=>{this._widgets.push(new Widget(s))}),this.loadUserPrefs().then(()=>{var s;(s=this._initialized)==null||s.resolve()}).catch(s=>{var o;(o=this._initialized)==null||o.reject()})):(i=this._initialized)==null||i.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().next({name:EVENT_NAME.USERPREF_CHANGED,layer:LAYER_NAME.WIDGETS})})}async applyUserPrefs(e){this._userPrefs=e!=null?e:this._userPrefs;const t=configure.Platform.theme,r=[];t.listSkins().then(i=>{var u;const s=((u=i.find(c=>c.child===t.skin))==null?void 0:u.parent)==="panda"?secondLevelWidgets:firstLevelWidgets;this._widgets=this._widgets.filter((c,a)=>{var f,p;const l=c.platformConf.name;return s.indexOf(l)!==-1?!1:(this._userPrefs[l]||(this._userPrefs[l]={index:(f=defaultWidgetOrder[l])!=null?f:999,show:!0,position:c.platformConf.position}),c.platformConf.mandatory&&(this._userPrefs[l].show=!0,this._userPrefs[l].index=(p=defaultWidgetOrder[l])!=null?p:999),c.platformConf.i18n&&r.push(c.platformConf.i18n),c.applyUserPref(this._userPrefs[l]),!0)});const o=new Idiom;this._widgets=this._widgets.sort((c,a)=>{const l=o.translate(`timeline.settings.${c.platformConf.name}`).toLowerCase(),d=o.translate(`timeline.settings.${a.platformConf.name}`).toLowerCase();return l<d?-1:l>d?1:0})})}}class Widget{constructor(e){m(this,"_schoolConf",{});m(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){var t,r;this._userPref=e,this._userPref.position=(r=(t=this._userPref.position)!=null?t:widgets.lookupDefaultPosition(this._platformConf.name))!=null?r:"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}}const http=transport==null?void 0:transport.http,me=(x=session==null?void 0:session.session)==null?void 0:x.user;class Notification{constructor(e){m(this,"_id");m(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(){m(this,"_notifications",[]);m(this,"_notificationTypes",[]);m(this,"_flashMessages",[]);m(this,"_pageNumber",0);m(this,"_lastPage",!1);m(this,"_loading",!1);m(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.TIMELINE)}get flashMessages(){return this._flashMessages}savePreferences(){return configure.User.saveAppPrefs(APP.TIMELINE)}resetPagination(){this._pageNumber=0,this._lastPage=!1,this._loading=!1}initialize(){return Promise.all([configure.User.loadAppPrefs(APP.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);let t=this.selectedNotificationTypes;if(t.length===0)return this._lastPage=!0,Promise.resolve();let r={page:this.page,mine:1};return this.showMine||delete r.mine,this._loading=!0,transport.http.get(`/timeline/lastNotifications?type=${t.join("&type=")}`,{queryParams:r}).then(i=>{if(this._loading=!1,i.status==="ok")if(i.number&&i.results){const s=i.results.filter(o=>this._notifications.findIndex(u=>u._id===o._id)===-1).map(o=>new Notification(o));this._notifications=this._notifications.concat(s),this._pageNumber++}else this._lastPage=!0}).catch(i=>{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 R=class{constructor(e){m(this,"checkHttpResponse",e=>{if(this.http.latestResponse.status>=300)throw this.http.latestResponse.statusText;return e});this.context=e}static register({application:e,resourceType:t},r){R.registry.set(`${e}:main`,r),R.registry.set(`${e}:${t}`,r)}static findService({application:e,resourceType:t},r){const i=R.registry.get(`${e}:${t}`);if(i===void 0)throw`Service not found: ${e}:${t}`;return i(r)}static findMainService({application:e},t){const r=R.registry.get(`${e}:main`);if(r===void 0)throw`Service not found: ${e}`;return r(t)}get http(){return this.context.http()}getShareReadUrl(e){return`/${this.getApplication()}/share/json/${e}?search=`}getSaveShareUrl(e){return`/${this.getApplication()}/share/resource/${e}`}gotoPrint(e,t){window.open(this.getPrintUrl(e,t),"_blank")}gotoView(e){window.open(this.getViewUrl(e),"_self")}gotoForm(e){window.open(this.getFormUrl(e),"_self")}async publish(e){const t=new FormData;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(s=>{t.append("activityType[]",s)}),e.subjectArea.forEach(s=>{t.append("subjectArea[]",s)}),e.age.forEach(s=>{t.append("age[]",s.toString())}),t.append("description",e.description),e.keyWords.split(",").forEach(s=>{t.append("keyWords[]",s.trim())}),t.append("licence",e.licence),t.append("pdfUri",`${window.location.origin}${this.getPrintUrl(e.resourceId)}`),t.append("application",e.application?e.application:""),t.append("resourceId",e.resourceId),t.append("teacherSchool",e.userStructureName);const i=await this.http.post("/appregistry/library/resource",t,{headers:{"Content-Type":"multipart/form-data"}});return this.checkHttpResponse(i)}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 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){const t=await this.http.post(`/explorer/folders/${e.folderId}/move`,this.moveToBodyParams(e));return this.checkHttpResponse(t)}async listSubfolders(e){const t=await this.http.get(`/explorer/folders/${e}`);return this.checkHttpResponse(t)}async deleteAll(e){const t=await this.http.deleteJson("/explorer",e);return this.checkHttpResponse(t)}async trashAll({resourceType:e,...t}){const r=await this.http.putJson("/explorer/trash",t);return this.checkHttpResponse(r)}async restoreAll({resourceType:e,...t}){const r=await this.http.putJson("/explorer/restore",t);return this.checkHttpResponse(r)}async getThumbnailPath(e){if(typeof e>"u")return e;if(typeof e=="string")if(e.startsWith("blob:")){const t=await fetch(e).then(i=>i.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){let t={application:e.app,start_idx:e.pagination.startIdx,page_size:e.pagination.pageSize,resource_type:e.types[0],trashed:e.trashed};if(e.orders&&Object.entries(e.orders).length){const[[r,i]]=Object.entries(e.orders);t.order_by=`${r}:${i}`}return e.filters&&Object.assign(t,e.filters),typeof e.search=="string"&&(t.search=e.search),t}createFolderToBodyParams(e){return{application:e.app,resourceType:e.type,parentId:e.parentId,name:e.name}}moveToBodyParams(e){return{application:e.application,resourceType:this.getResourceType(),resourceIds:e.resourceIds,folderIds:e.folderIds}}};let ResourceService=R;m(ResourceService,"registry",new Map);class BlogResourceService extends ResourceService{async update(e){const t=await this.getThumbnailPath(e.thumbnail),r=await this.http.put(`/blog/${e.entId}`,{trashed:e.trashed,_id:e.entId,title:e.name,thumbnail:t,description:e.description,visibility:e.public?"PUBLIC":"OWNER",slug:e.public?e.slug:"","publish-type":e["publish-type"]||"RESTRAINT","comment-type":"IMMEDIATE"});return this.checkHttpResponse(r),{thumbnail:t,entId:e.entId}}getResourceType(){return RESOURCE.BLOG}getApplication(){return APP.BLOG}getFormUrl(e){return e?`/blog?folderid=${e}#/edit/new`:"/blog#/edit/new"}getViewUrl(e){return`/blog#/view/${e}`}getPrintUrl(e,t){return`/blog/print/blog#/print/${e}?comments=${t||!0}`}}ResourceService.register({application:RESOURCE.BLOG,resourceType:RESOURCE.BLOG},n=>new BlogResourceService(n));const globalCache={},mutexPromise={};class CacheService{constructor(e){this.context=e}get http(){return this.context.http()}async fromCacheIfPossible(e,t,r){if(mutexPromise[e]&&await mutexPromise[e],globalCache[e])return globalCache[e];try{const i=t();mutexPromise[e]=i;const s=await i;return r(s)&&(globalCache[e]=s),s}catch(i){throw console.error(`Failed to retrieve value for: ${e}`,i),i}}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 r=await this.http.get(e,t),i={...this.http.latestResponse};return{value:r,response:i}},({response:r})=>!(r.status<200||r.status>=300))}async httpGetJson(e,t){const{response:r,value:i}=await this.httpGet(e,t);if(r.status<200||r.status>=300)throw`Bad http status (${r.status}) for url: ${e}`;return i}}class ConfService{constructor(e){this.context=e}get http(){return this.context.http()}get cdnDomain(){return configure.Platform.cdnDomain}async getConf(e){const[t,r]=await Promise.all([this.getThemeConf(),this.getApplicationsList()]),[i,s]=await Promise.all([this.getTheme({conf:t}),this.getWebAppConf({app:e,applications:r})]);return{applications:r,conf:t,currentApp:s,theme:i}}getCdnUrl(){console.warn("[getCdnUrl] Not implemented yet")}async savePreference(e,t){this.http.putJson(`/userbook/preference/${e}`,t)}async getPreference(e){const t=await this.http.get(`/userbook/preference/${e}`);return JSON.parse(t.preference)}async getThemeConf(e){return await this.http.getScript("/assets/theme-conf.js",{queryParams:{v:e}},"exports.conf")}async getApplicationsList(){return(await this.http.get("/applications-list")).apps}async getWebAppConf({app:e,applications:t}){return t.find(i=>{if(i!=null&&i.prefix)return(i==null?void 0:i.prefix.replace("/",""))===e})}async getTheme({version:e,conf:t}){const r=await this.http.get("/theme",{queryParams:{_:e}}),i=r.themeName,s=t==null?void 0:t.overriding.find(d=>d.child===i).skins,o="/assets/themes/ode-bootstrap",u=t==null?void 0:t.overriding.find(d=>d.child===i).bootstrapVersion,c=`${this.cdnDomain}/assets/themes/${u}`,a=`${c}/skins/${r.skinName}`,l=(t==null?void 0:t.overriding.find(d=>d.child===i).parent)==="panda";return{basePath:`${this.cdnDomain}${r.skin}../../`,bootstrap:o,bootstrapPath:c,bootstrapUrl:a,bootstrapVersion:u,is1d:l,logoutCallback:r.logoutCallback,skin:r.skin.split("/assets/themes/")[1].split("/")[0],skinName:r.skinName,skins:s,themeName:r.themeName,themeUrl:r.skin}}}class DirectoryService{constructor(e){this.odeServices=e}get http(){return this.odeServices.http()}get cache(){return this.odeServices.cache()}getAvatarUrl(e,t,r="100x100"){return t==="user"?`/userbook/avatar/${e}?thumbnail=${r}`:"/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:r})=>({id:t,displayName:r,members:[]}))}async getBookMarkById(e){const{groups:t,id:r,name:i,users:s}=await this.http.get(`/directory/sharebookmark/${e}`);return{id:r,displayName:i,groups:t.map(({name:o,id:u})=>({displayName:o,id:u})),users:s.map(({displayName:o,id:u,profile:c})=>({profile:c,displayName:o,firstName:"",lastName:"",login:"",id:u}))}}async saveBookmarks(e,{bookmarks:t,groups:r,users:i}){this.cache.clearCache("/directory/sharebookmark/all");const s=i.map(f=>typeof f=="string"?f:f.id),o=r.map(f=>typeof f=="string"?f:f.id),u=t.map(async f=>{if(typeof f=="string"){const{displayName:p,groups:E,id:h,users:v}=await this.getBookMarkById(f),g=v.map(A=>A.id),y=E.map(A=>A.id);return{displayName:p,id:h,members:[...y,...g]}}else return Promise.resolve(f)}),a=(await Promise.all(u)).map(f=>f.members).reduce((f,p)=>[...f,...p],[]),l={name:e,members:[...s,...o,...a]},{id:d}=await this.http.postJson("/directory/sharebookmark",l);return{id:d,displayName:e,members:l.members}}}const loadedScripts={};class HttpService{constructor(e,t){m(this,"axios");m(this,"_latestResponse");this.context=e,this.axios=axios.create(t)}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=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=this.context.conf().getCdnUrl()||"";if(t.length>0&&e!=="/conf/public"){const r=""+e;(r.startsWith("/infra/public")||r.startsWith("/assets")||/^\/([^\/]*)\/public/.test(r))&&(e=t+r)}return e}mapAxiosError(e,t){return console.error("[HttpService]",e),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}async get(e,t){try{const r=await this.axios.get(this.toCdnUrl(e),this.toAxiosConfig(t));return this.mapAxiosResponse(r,t)}catch(r){return this.mapAxiosError(r,t)}}async post(e,t,r){try{const i=await this.axios.post(e,t,this.toAxiosConfig(r));return this.mapAxiosResponse(i,r)}catch(i){return this.mapAxiosError(i,r)}}async postFile(e,t,r){const i=this.toAxiosConfig(r);i.headers&&i.headers["Content-Type"]&&delete i.headers["Content-Type"];try{const s=await this.axios.post(e,t,{...i,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(s,r)}catch(s){return this.mapAxiosError(s,r)}}async postJson(e,t,r){const i=this.toAxiosConfig();i.headers&&(i.headers["Content-Type"]="application/json");try{const s=await this.axios.post(e,t,this.toAxiosConfig(r));return this.mapAxiosResponse(s,r)}catch(s){return this.mapAxiosError(s,r)}}async put(e,t,r){try{const i=await this.axios.put(e,t,this.toAxiosConfig(r));return this.mapAxiosResponse(i,r)}catch(i){return this.mapAxiosError(i,r)}}async putFile(e,t,r){try{const i=this.toAxiosConfig(r);i.headers&&i.headers["Content-Type"]&&delete i.headers["Content-Type"];const s=await this.axios.put(e,t,{...i,headers:{"Content-Type":"multipart/form-data"}});return this.mapAxiosResponse(s,r)}catch(i){return this.mapAxiosError(i,r)}}async putJson(e,t,r){const i=this.toAxiosConfig(r);i.headers&&(i.headers["Content-Type"]="application/json");try{const s=await this.axios.put(e,t,i);return this.mapAxiosResponse(s,r)}catch(s){return this.mapAxiosError(s,r)}}async delete(e,t){try{const r=await this.axios.delete(e,this.toAxiosConfig(t));return this.mapAxiosResponse(r,t)}catch(r){return this.mapAxiosError(r,t)}}async deleteJson(e,t){try{const r=await this.axios.delete(e,{data:t});return this.mapAxiosResponse(r)}catch(r){return this.mapAxiosError(r)}}getScript(e,t,r){const i=r!=null?r:"exports",s=this.toAxiosConfig(t);return s.headers&&(s.headers.Accept="application/javascript"),this.axios.get(this.toCdnUrl(e),s).then(o=>this.mapAxiosResponse(o,t)).then(o=>{try{const u=`"use strict";var ${i.split(".")[0]}={};${o};return ${i};`;return Function(u)()}catch{return o}}).catch(o=>{throw this.mapAxiosError(o,t),o})}loadScript(e,t){return loadedScripts[e]?Promise.resolve():this.getScript(e,t).then(r=>{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(r=>this.parseResourceRight(r)).filter(r=>r!==void 0)}hasResourceRight({id:e,groupIds:t},r,i){const s=i.map(o=>typeof o=="string"?this.parseResourceRight(o):o).filter(o=>o!==void 0);for(const o of s){if(o.id===e&&o.type==="creator")return!0;if(o.id===e&&o.type==="user"&&o.right===r)return!0;if(t.includes(o.id)&&o.type==="group"&&o.right===r)return!0}return!1}async sessionHasResourceRight(e,t){try{const r=await this.session.getUser();return!!r&&this.hasResourceRight({groupIds:r.groupsIds,id:r.userId},e,t)}catch(r){return console.error(r),!1}}async sessionHasAtLeastOneResourceRight(e,t){for(const r of e)if(await this.sessionHasResourceRight(r,t))return!0;return!1}async sessionHasResourceRightForEachList(e,t){let r=0;for(const i of t)await this.sessionHasResourceRight(e,i)&&r++;return r===t.length}async sessionHasAtLeastOneResourceRightForEachList(e,t){for(const r of e){let i=0;for(const s of t)await this.sessionHasResourceRight(r,s)&&i++;if(i===t.length)return!0}return!1}hasWorkflowRight(e,t){return t.findIndex(r=>r===e)!==-1}async sessionHasWorkflowRight(e){try{const t=await this.session.getUser();return!!t&&this.hasWorkflowRight(e,t.authorizedActions.map(r=>r.name))}catch(t){return console.error(t),!1}}async sessionHasWorkflowRights(e){const t={};try{const r=await this.session.getUser();for(const i of e)t[i]=!!r&&this.hasWorkflowRight(i,r.authorizedActions.map(s=>s.name))}catch(r){console.error(r);for(const i of e)t[i]=!1}return t}}class SessionService{constructor(e){this.context=e}get http(){return this.context.http()}get cache(){return this.context.cache()}onLogout(){this.cache.clearCache()}onRefreshSession(){this.cache.clearCache()}async getSession(){const e=await this.getUser(),[t,r,i,s,o]=await Promise.all([this.getCurrentLanguage(e),this.latestQuotaAndUsage(e),this.loadDescription(e),this.getUserProfile(),this.getBookmarks(e)]);return{user:e,quotaAndUsage:r,currentLanguage:t,userDescription:i,userProfile:s,bookmarkedApps:o}}login(e,t,r,i){const s=new FormData;return s.append("email",e),s.append("password",t),typeof r<"u"&&s.append("rememberMe",""+r),typeof i<"u"&&s.append("secureLocation",""+i),this.http.post("/auth/login",s,{headers:{"content-type":"application/x-www-form-urlencoded"}}).finally(()=>{switch(this.http.latestResponse.status){case 200:throw ERROR_CODE.MALFORMED_DATA}})}logout(){return this.http.get("/auth/logout").finally(()=>{})}async latestQuotaAndUsage(e){try{return await this.http.get(`/workspace/quota/user/${e==null?void 0:e.userId}`)}catch(t){return console.error(t),{quota:0,storage:0}}}async getCurrentLanguage(e){const t=(e==null?void 0:e.sessionMetadata)&&(e==null?void 0:e.sessionMetadata.userId);try{let r;return t?r=await this.loadUserLanguage():r=await this.loadDefaultLanguage(),r}catch(r){console.error(r)}}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)throw ERROR_CODE.NOT_LOGGED_IN;return t}hasWorkflow({workflowName:e,user:t}){return e===void 0||(t==null?void 0:t.authorizedActions.findIndex(r=>r.name===e))!==-1}async loadDescription(e){try{const[t,r]=await Promise.all([this.getUserProfile({requestName:"refreshAvatar"}),this.http.get("/directory/userbook/"+(e==null?void 0:e.userId))]);return{...t,...r}}catch(t){return console.error(t),{}}}async getBookmarks(e){const t=await this.http.get("/userbook/preference/apps");t.preference||(t.preference=null);const r=JSON.parse(t.preference);let i;i=r,i||(i={bookmarks:[],applications:[]});let s=[];return i.bookmarks.forEach((o,u)=>{const c=e==null?void 0:e.apps.find(a=>a.name===o);if(c){let a=Object.assign({},c);s.push(a)}}),s}async getUserProfile(e){const{response:t,value:r}=await this.cache.httpGet("/userbook/api/person",e);if(t.status<200||t.status>=300)throw ERROR_CODE.NOT_LOGGED_IN;return r.result[0].type}async isAdml(){const e=await this.getUser();return(e==null?void 0:e.functions.ADMIN_LOCAL)!==void 0}}class StringUtils{static removeAccents(e){for(var t=0;t<defaultDiacriticsRemovalMap$1.length;t++)e=e.replace(defaultDiacriticsRemovalMap$1[t].letters,defaultDiacriticsRemovalMap$1[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,r){const i=StringUtils.removeAccents(r).toLowerCase(),s=await this.cache.httpGetJson(`/${e}/share/json/${t}?search=${r}`),o=s.users.visibles.filter(({username:l,firstName:d,lastName:f,login:p})=>{const E=StringUtils.removeAccents(f||"").toLowerCase(),h=StringUtils.removeAccents(d||"").toLowerCase(),v=StringUtils.removeAccents(l||"").toLowerCase(),g=StringUtils.removeAccents(p||"").toLowerCase();return v.includes(i)||h.includes(i)||E.includes(i)||g.includes(i)}).map(l=>({avatarUrl:this.directory.getAvatarUrl(l.id,"user"),directoryUrl:this.directory.getDirectoryUrl(l.id,"user"),displayName:l.username,id:l.id,profile:l.profile,type:"user"})),u=s.groups.visibles.filter(({name:l})=>StringUtils.removeAccents(l||"").toLowerCase().includes(i)).map(l=>({avatarUrl:this.directory.getAvatarUrl(l.id,"group"),directoryUrl:this.directory.getDirectoryUrl(l.id,"group"),displayName:l.name,id:l.id,type:"group"}));return[...(await this.directory.getBookMarks()).filter(({displayName:l})=>StringUtils.removeAccents(l||"").toLowerCase().includes(i)).map(l=>({avatarUrl:"",directoryUrl:"",profile:"",displayName:l.displayName,id:l.id,type:"sharebookmark"})),...o,...u]}async getShareMapping(e){const t=await this.cache.httpGetJson(`/${e}/rights/sharing`);for(const r of Object.keys(t))if(r.includes(".")){const i=r.split(".")[1],s=t[r];delete t[r],t[i]=s}return t}getActionsAvailableFor({id:e,type:t},r,i){const o=(t==="user"?r.users.checked[e]:r.groups.checked[e])||[],u=Object.keys(i),c=[];for(const a of u)i[a].filter(f=>o.includes(f)).length>0&&c.push(a);return c}async getRightsForResource(e,t){const r=await this.directory.getBookMarks(),i=this.context.resource(e,e).getShareReadUrl(t),s=await this.cache.httpGetJson(i),o=await this.getShareMapping(e),u=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),c=Object.keys(s.users.checked).map(p=>s.users.visibles.find(h=>h.id===p)).filter(p=>p!==void 0).map(p=>{const E=this.getActionsAvailableFor({id:p.id,type:"user"},s,o);return{id:p.id,type:"user",displayName:p.username,profile:p.profile,avatarUrl:this.directory.getAvatarUrl(p.id,"user"),directoryUrl:this.directory.getDirectoryUrl(p.id,"user"),actions:E.map(v=>{const g=u[v];return{displayName:v,id:v,priority:g.priority}})}}).sort((p,E)=>(p.displayName||"").localeCompare(E.displayName)),a=Object.keys(s.groups.checked).map(p=>s.groups.visibles.find(h=>h.id===p)).filter(p=>p!==void 0).map(p=>{const E=this.getActionsAvailableFor({id:p.id,type:"group"},s,o);return{id:p.id,type:"group",displayName:p.name,profile:void 0,avatarUrl:this.directory.getAvatarUrl(p.id,"group"),directoryUrl:this.directory.getDirectoryUrl(p.id,"group"),actions:E.map(v=>{const g=u[v];return{displayName:v,id:v,priority:g.priority}})}}).sort((p,E)=>(p.displayName||"").localeCompare(E.displayName)),l=[...c,...a],d=s.groups.visibles.map(({groupDisplayName:p,id:E,name:h})=>({displayName:p||h,id:E})),f=s.users.visibles.map(({id:p,profile:E,username:h,firstName:v,lastName:g,login:y})=>({displayName:h,firstName:v,lastName:g,login:y,profile:E,id:p}));return{rights:l,visibleBookmarks:r,visibleGroups:d,visibleUsers:f}}async saveRights(e,t,r){const i=await this.getShareMapping(e),s={bookmarks:{},groups:{},users:{}};for(const a of r){const l=a.actions.map(f=>i[f.id]).reduce((f,p)=>[...f,...p],[]),d=[...new Set(l)];d.length>0&&(a.type==="user"?s.users[a.id]=d:a.type==="group"?s.groups[a.id]=d:s.bookmarks[a.id]=d)}const o=this.context.resource(e,e),u=o.getSaveShareUrl(t);return this.cache.clearCache(o.getShareReadUrl(t)),await this.http.putJson(u,s)}async getActionsForApp(e){const t=await this.cache.httpGetJson("/infra/public/json/sharing-rights.json"),r=await this.getShareMapping(e);return Object.keys(t).map(s=>{const o=t[s];return{displayName:s,id:s,priority:o.priority,requires:o.requires}}).filter(s=>{var o;return((o=r[s.id])==null?void 0:o.length)>0}).sort((s,o)=>s.priority-o.priority)}}const S=class{constructor(){m(this,"wordExtensions",new Set);m(this,"excelExtensions",new Set);m(this,"pptExtensions",new Set);m(this,"fileExtensionMap",new Map);m(this,"csvContentType",new Set);m(this,"csvExtensions",new Set);m(this,"txtExtensions",new Set);m(this,"PDF","application/pdf");m(this,"OCTET_STREAM","application/octet-stream");this.txtExtensions.add("txt"),this.wordExtensions.add("doc"),this.wordExtensions.add("dot"),this.wordExtensions.add("docx"),this.wordExtensions.add("dotx"),this.wordExtensions.add("docm"),this.wordExtensions.add("dotm"),this.wordExtensions.add("odt"),this.wordExtensions.add("ott"),this.wordExtensions.add("oth"),this.wordExtensions.add("odm"),this.excelExtensions.add("xls"),this.excelExtensions.add("xlt"),this.excelExtensions.add("xla"),this.excelExtensions.add("xlsx"),this.excelExtensions.add("xltx"),this.excelExtensions.add("xlsm"),this.excelExtensions.add("xltm"),this.excelExtensions.add("xlam"),this.excelExtensions.add("xlsb"),this.excelExtensions.add("ods"),this.excelExtensions.add("ots"),this.pptExtensions.add("ppt"),this.pptExtensions.add("pot"),this.pptExtensions.add("pps"),this.pptExtensions.add("ppa"),this.pptExtensions.add("pptx"),this.pptExtensions.add("potx"),this.pptExtensions.add("ppsx"),this.pptExtensions.add("ppam"),this.pptExtensions.add("pptm"),this.pptExtensions.add("potm"),this.pptExtensions.add("ppsm"),this.pptExtensions.add("odp"),this.pptExtensions.add("otp"),this.csvExtensions.add("csv"),this.fileExtensionMap.set("doc","application/msword"),this.fileExtensionMap.set("dot","application/msword"),this.fileExtensionMap.set("docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"),this.fileExtensionMap.set("dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"),this.fileExtensionMap.set("docm","application/vnd.ms-word.document.macroEnabled.12"),this.fileExtensionMap.set("dotm","application/vnd.ms-word.template.macroEnabled.12"),this.fileExtensionMap.set("xls","application/vnd.ms-excel"),this.fileExtensionMap.set("xlt","application/vnd.ms-excel"),this.fileExtensionMap.set("xla","application/vnd.ms-excel"),this.fileExtensionMap.set("xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),this.fileExtensionMap.set("xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"),this.fileExtensionMap.set("xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"),this.fileExtensionMap.set("xltm","application/vnd.ms-excel.template.macroEnabled.12"),this.fileExtensionMap.set("xlam","application/vnd.ms-excel.addin.macroEnabled.12"),this.fileExtensionMap.set("xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"),this.fileExtensionMap.set("ppt","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pot","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pps","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("ppa","application/vnd.ms-powerpoint"),this.fileExtensionMap.set("pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"),this.fileExtensionMap.set("potx","application/vnd.openxmlformats-officedocument.presentationml.template"),this.fileExtensionMap.set("ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"),this.fileExtensionMap.set("ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"),this.fileExtensionMap.set("pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"),this.fileExtensionMap.set("ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"),this.fileExtensionMap.set("odt","application/vnd.oasis.opendocument.text"),this.fileExtensionMap.set("ott","application/vnd.oasis.opendocument.text-template"),this.fileExtensionMap.set("oth","application/vnd.oasis.opendocument.text-web"),this.fileExtensionMap.set("odm","application/vnd.oasis.opendocument.text-master"),this.fileExtensionMap.set("odg","application/vnd.oasis.opendocument.graphics"),this.fileExtensionMap.set("otg","application/vnd.oasis.opendocument.graphics-template"),this.fileExtensionMap.set("odp","application/vnd.oasis.opendocument.presentation"),this.fileExtensionMap.set("otp","application/vnd.oasis.opendocument.presentation-template"),this.fileExtensionMap.set("ods","application/vnd.oasis.opendocument.spreadsheet"),this.fileExtensionMap.set("ots","application/vnd.oasis.opendocument.spreadsheet-template"),this.fileExtensionMap.set("odc","application/vnd.oasis.opendocument.chart"),this.fileExtensionMap.set("odf","application/vnd.oasis.opendocument.formula"),this.fileExtensionMap.set("odb","application/vnd.oasis.opendocument.database"),this.fileExtensionMap.set("odi","application/vnd.oasis.opendocument.image"),this.fileExtensionMap.set("oxt","application/vnd.openofficeorg.extension"),this.fileExtensionMap.set("txt","text/plain"),this.csvContentType.add("text/comma-separated-values"),this.csvContentType.add("text/csv"),this.csvContentType.add("application/csv")}getContentTypeForExtension(e){if(this.fileExtensionMap.has(e))return this.fileExtensionMap.get(e)}getExtensionForContentType(e){for(const t of Array.from(this.fileExtensionMap.keys()))if((this.fileExtensionMap.get(t)||"").toLowerCase()==(e||"").toLowerCase())return t;return null}isWordLike(e,t){const r=this.getExtensionForContentType(e);return r?this.wordExtensions.has(r):e==this.OCTET_STREAM&&t?this.wordExtensions.has(t):!1}isExcelLike(e,t){const r=this.getExtensionForContentType(e);return r?this.excelExtensions.has(r):e==this.OCTET_STREAM&&t?this.excelExtensions.has(t):!1}isCsvLike(e,t){return this.csvContentType.has(e)?!0:e==this.OCTET_STREAM&&t?this.csvExtensions.has(t):!1}isPowerpointLike(e,t){const r=this.getExtensionForContentType(e);return r?this.pptExtensions.has(r):e==this.OCTET_STREAM&&t?this.pptExtensions.has(t):!1}isTxtLike(e,t){const r=this.getExtensionForContentType(e);return r?this.txtExtensions.has(r):e==this.OCTET_STREAM&&t?this.txtExtensions.has(t):!1}};let MimeTypeUtils=S;m(MimeTypeUtils,"INSTANCE",new S);class FileTypeUtils{static registerContentTypeToFileType(e){this.fileTypes.push(e)}static getFileType(e,t=!1,r){if(r&&(r=r.trim()),!e)return"unknown";this.fileTypes||console.warn("[Element.role] should not have emptyRoles",this);for(let s of this.fileTypes||[]){const o=s(e,t);if(o)return o}const i={csv:function(s){return!!MimeTypeUtils.INSTANCE.isCsvLike(s,r)},doc:function(s){return MimeTypeUtils.INSTANCE.isWordLike(s,r)?!0:s.indexOf("document")!==-1&&s.indexOf("wordprocessing")!==-1},xls:function(s){return MimeTypeUtils.INSTANCE.isExcelLike(s,r)?!0:s.indexOf("document")!==-1&&s.indexOf("spreadsheet")!==-1||s.indexOf("ms-excel")!==-1},img:function(s){return s.indexOf("image")!==-1},pdf:function(s){return s.indexOf("pdf")!==-1||s==="application/x-download"},ppt:function(s){return MimeTypeUtils.INSTANCE.isPowerpointLike(s,r)?!0:s.indexOf("document")!==-1&&s.indexOf("presentation")!==-1||s.indexOf("powerpoint")!==-1},txt:function(s){return MimeTypeUtils.INSTANCE.isTxtLike(s,r)},video:function(s){return s.indexOf("video")!==-1},audio:function(s){return s.indexOf("audio")!==-1},zip:function(s){return s.indexOf("zip")!==-1||s.indexOf("rar")!==-1||s.indexOf("tar")!==-1||s.indexOf("7z")!==-1}};for(let s in i)if(i[s](e))return s;return"unknown"}}m(FileTypeUtils,"fileTypes",[]);class WorkspaceService{constructor(e){this.context=e}get http(){return this.context.http()}async saveFile(e,t){const r=e.name||"",i=r.split("."),s=e.type||"application/octet-stream",o=i.length>1?i[i.length-1]:"",u={"content-type":s,filename:r,size:e.size,extension:o,role:FileTypeUtils.getFileType(s,!1,o)},c=r.replace("."+u.extension,""),a=u.extension?c+"."+u.extension:c,l=new FormData;l.append("file",e,a);const d=[];return((t==null?void 0:t.visibility)==="public"||(t==null?void 0:t.visibility)==="protected")&&d.push(`${t.visibility}=true`),t!=null&&t.application&&d.push(`application=${t.application}`),u.role==="img"&&d.push("quality=1"),t!=null&&t.parentId&&d.push(`parentId=${t.parentId}`),await this.http.postFile(`/workspace/document?${d.join("&")}`,l)}}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!=null?e:"";let r=bundle[e]===void 0?e:bundle[e];if(t&&typeof t=="object")for(let i in t)typeof t[i]<"u"&&(r=r.replace(new RegExp("\\${"+i+"}","g"),""+t[i]));return r}addBundlePromise(e,t){return this.loadBundlePromise(e,t)}addBundle(e,t,r){this.loadBundle(e,t,r)}loadBundlePromise(e,t){return this.loadBundle(e,t),promises[t]}loadBundle(e,t,r){const i=promises[t];if(i)r&&i.then(r).catch(r);else{const s=new Promisified;promises[t]=s.promise;const o={};e&&(o["Accept-Language"]=e),this.http.get(t,{headers:o}).then(u=>{Object.assign(bundle,u),typeof r=="function"&&r(),s.resolve()}).catch(u=>{typeof r=="function"&&r(),s.reject()})}}addTranslations(e,t){notify.onLangReady().promise.then(r=>{this.loadBundle(r,e+"/"+r+".json",t)})}addAllTranslations(e){return e&&e.length>0?notify.onLangReady().promise.then(t=>Promise.all(e.map(r=>this.loadBundlePromise(t,r+"/"+t+".json")))).then(()=>{}):Promise.reject()}addKeys(e){for(var t in e)typeof bundle[t]!="string"&&(bundle[t]=e[t])}removeAccents(e){for(var t=0;t<defaultDiacriticsRemovalMap.length;t++)e=e.replace(defaultDiacriticsRemovalMap[t].letters,defaultDiacriticsRemovalMap[t].base);return e}}let ATTag;class AnalyticsService{constructor(n){this.context=n}get http(){return this.context.http()}get session(){return this.context.session()}async trackPageLoad(n,e){const[t]=await Promise.all([this.getXitiConfig(e.name.toLowerCase()),this.loadXitiScript()]);if(!t||!ATInternet)return;let r=t.LIBELLE_SERVICE.default||null;for(let i in t.LIBELLE_SERVICE)if(i!=="default"&&n.indexOf(i)>=0){r=t.LIBELLE_SERVICE[i];break}ATTag=new ATInternet.Tracker.Tag({site:t.STRUCT_ID}),ATTag.setProps({SERVICE:r,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(n){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,n)),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(n,e){var a;if(!n.structureMap||!e)return;const t=await this.session.getUser(),r=await this.session.getUserProfile();let i;if(!(t!=null&&t.structures))return;for(let l of t.structures){const d=n.structureMap[l];if(d&&d.collectiviteId&&d.UAI){i=d;break}}if(!i||!i.active)return;const s=await configure.Platform.apps.getPublicConf(e);if(!s)return;const o=s.xiti;if(!o||!o.LIBELLE_SERVICE||!i.UAI)return;function u(l){let d="";for(let f=0;f<l.length;f++)d+=l.charCodeAt(f);return d}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:i.collectiviteId,STRUCT_UAI:i.UAI,PROJET:i.projetId?i.projetId:n.ID_PROJET,EXPLOITANT:n.ID_EXPLOITANT,PLATFORME:i.plateformeId?i.plateformeId:n.ID_PLATEFORME,ID_PERSO:u(t.userId),PROFILE:r&&r.length>0&&(a=c[r[0]])!=null?a:""}}}class OdeServices{constructor(){m(this,"_analytics");m(this,"_cache");m(this,"_conf");m(this,"_directory");m(this,"_http");m(this,"_idiom");m(this,"_rights");m(this,"_session");m(this,"_share");m(this,"_workspace");this._analytics=new AnalyticsService(this),this._cache=new CacheService(this),this._conf=new ConfService(this),this._directory=new DirectoryService(this),this._http=new HttpService(this),this._idiom=new IdiomService(this),this._rights=new RightService(this),this._session=new SessionService(this),this._share=new ShareService(this),this._workspace=new WorkspaceService(this)}analytics(){return this._analytics}cache(){return this._cache}conf(){return this._conf}directory(){return this._directory}http(){return this._http}idiom(){return this._idiom}resource(e,t){return t?ResourceService.findService({application:e,resourceType:t},this):ResourceService.findMainService({application:e},this)}rights(){return this._rights}session(){return this._session}share(){return this._share}workspace(){return this._workspace}}const odeServices=new OdeServices;typeof window<"u"&&(window.entcore=(_=window.entcore)!=null?_:{},window.entcore["ode-ts-client"]=(I=(T=window.entcore["ode-ts-client"])!=null?T:exports)!=null?I:module==null?void 0:module.exports),exports.ACTION=ACTION,exports.APP=APP,exports.BOOLEAN_FILTER=BOOLEAN_FILTER,exports.ConfigurationFrameworkFactory=ConfigurationFrameworkFactory,exports.ERROR_CODE=ERROR_CODE,exports.EVENT_NAME=EVENT_NAME,exports.ExplorerFrameworkFactory=ExplorerFrameworkFactory,exports.FOLDER=FOLDER,exports.ITimelineFactory=ITimelineFactory,exports.LAYER_NAME=LAYER_NAME,exports.LastInfosWidget=LastInfosWidget,exports.NotifyFrameworkFactory=NotifyFrameworkFactory,exports.PROP_FORMAT=PROP_FORMAT,exports.PROP_KEY=PROP_KEY,exports.PROP_MODE=PROP_MODE,exports.PROP_TYPE=PROP_TYPE,exports.RESOURCE=RESOURCE,exports.RxJS=index,exports.SORT_BY=SORT_BY,exports.SORT_ORDER=SORT_ORDER,exports.STRING_FILTER=STRING_FILTER,exports.SessionFrameworkFactory=SessionFrameworkFactory,exports.TransportFrameworkFactory=TransportFrameworkFactory,exports.USER_PREFS=USER_PREFS,exports.WIDGET_NAME=WIDGET_NAME,exports.WIDGET_POSITION=WIDGET_POSITION,exports.WidgetFrameworkFactory=WidgetFrameworkFactory,exports.appNameForResource=appNameForResource,exports.odeServices=odeServices,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
18
18
  //# sourceMappingURL=ode-ts-client.js.map