@olympeio/runtime-node 9.6.0 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/import/olympe.dm/datamodel/.Primordial.newInst.json +1 -1
- package/import/olympe.dm/datamodel/00_bootstrap.newInst.json +1 -1
- package/import/olympe.dm/datamodel/00_bootstrap.newRel.json +1 -1
- package/import/olympe.dm/datamodel/02_permissions.newInst.json +1 -1
- package/import/olympe.dm/datamodel/05_permission_schema.updateInst.json +1 -1
- package/import/olympe.sc/datamodel/01_language.newInst.json +1 -1
- package/import/olympe.sc/datamodel/01_language.newRel.json +1 -1
- package/index.js +860 -859
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -202,25 +202,25 @@ UMDLibWrapper(this, 'SRPClient', function() {
|
|
|
202
202
|
"use strict";
|
|
203
203
|
|
|
204
204
|
var m,aa='function'==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};function ba(a){a=['object'==typeof globalThis&&globalThis,a,'object'==typeof window&&window,'object'==typeof self&&self,'object'==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error('Cannot find global object');}var ca=ba(this);
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
function
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
(()=>{const a=console.trace,b=console.debug,c=console.log,d=console.info,e=console.warn,f=console.error;console.trace=(...g)=>a(
|
|
214
|
-
olympe.W.
|
|
215
|
-
olympe.W.Xg=class{constructor(a,b,c=2){this.F=a;this.parameters=b;this.C=Object.create(null);this.H=new olympe.W.
|
|
216
|
-
function
|
|
217
|
-
olympe.W.
|
|
218
|
-
var g=this.
|
|
219
|
-
Object.keys(this.
|
|
220
|
-
olympe.W
|
|
221
|
-
(g=this.C)?void 0:g.size)){b.C++;
|
|
222
|
-
(this.C=new Map);var f=this.C,g=f.set;b=new olympe.W.
|
|
223
|
-
olympe.Y.promise.
|
|
205
|
+
function v(a,b){if(b)a:{var c=ca;a=a.split('.');for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}}function da(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function f(g){g.done?d(g.value):Promise.resolve(g.value).then(b,c).then(f,e)}f(a.next())})}function x(a){return da(a())}
|
|
206
|
+
v('Array.prototype.includes',function(a){return a?a:function(b,c){var d=this;d instanceof String&&(d=String(d));var e=d.length;c=c||0;for(0>c&&(c=Math.max(c+e,0));c<e;c++){var f=d[c];if(f===b||Object.is(f,b))return!0}return!1}});function ea(a,b){a instanceof String&&(a+='');var c=0,d=!1,e={next:function(){if(!d&&c<a.length){var f=c++;return{value:b(f,a[f]),done:!1}}d=!0;return{done:!0,value:void 0}}};e[Symbol.iterator]=function(){return e};return e}
|
|
207
|
+
v('Array.prototype.values',function(a){return a?a:function(){return ea(this,function(b,c){return c})}});v('Promise.prototype.finally',function(a){return a?a:function(b){return this.then(function(c){return Promise.resolve(b()).then(function(){return c})},function(c){return Promise.resolve(b()).then(function(){throw c;})})}});
|
|
208
|
+
v('Object.fromEntries',function(a){return a?a:function(b){var c={};if(!(Symbol.iterator in b))throw new TypeError(''+b+' is not iterable');b=b[Symbol.iterator].call(b);for(var d=b.next();!d.done;d=b.next()){d=d.value;if(Object(d)!==d)throw new TypeError('iterable for fromEntries should yield objects');c[d[0]]=d[1]}return c}});function fa(a){if(null==a)throw new TypeError("The 'this' value for String.prototype.padStart must not be null or undefined");return a+''}
|
|
209
|
+
function ha(a,b){a=void 0!==a?String(a):' ';return 0<b&&a?a.repeat(Math.ceil(b/a.length)).substring(0,b):''}v('String.prototype.padStart',function(a){return a?a:function(b,c){var d=fa(this);return ha(c,b-d.length)+d}});v('String.prototype.padEnd',function(a){return a?a:function(b,c){var d=fa(this);return d+ha(c,b-d.length)}});
|
|
210
|
+
v('Promise.allSettled',function(a){function b(d){return{status:'fulfilled',value:d}}function c(d){return{status:'rejected',reason:d}}return a?a:function(d){var e=this;d=Array.from(d,function(f){return e.resolve(f).then(b,c)});return e.all(d)}});v('Object.entries',function(a){return a?a:function(b){var c=[],d;for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&c.push([d,b[d]]);return c}});
|
|
211
|
+
v('Object.values',function(a){return a?a:function(b){var c=[],d;for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&c.push(b[d]);return c}});v('Array.prototype.flatMap',function(a){return a?a:function(b,c){for(var d=[],e=0;e<this.length;e++){var f=b.call(c,this[e],e,this);Array.isArray(f)?d.push.apply(d,f):d.push(f)}return d}});
|
|
212
|
+
v('Array.prototype.flat',function(a){return a?a:function(b){b=void 0===b?1:b;for(var c=[],d=0;d<this.length;d++){var e=this[d];Array.isArray(e)&&0<b?(e=Array.prototype.flat.call(e,b-1),c.push.apply(c,e)):c.push(e)}return c}});var ia=this||self;function B(a,b){a=a.split('.');let c=ia;a[0]in c||'undefined'==typeof c.execScript||c.execScript('var '+a[0]);for(let d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b};const olympe={ge:()=>'object'===typeof window?window:'object'===typeof global?global:self};if('olympe'in olympe.ge())throw Error('The olympe runtime is loaded more than once. Make sure not to import `@olympeio/runtime-web` or `@olympeio/runtime-node` explicitly, and to always use the `olympe` alias.');olympe.ge().olympe=olympe;olympe.AC=(a,...b)=>{b.forEach(c=>{Object.getOwnPropertyNames(c.prototype).forEach(d=>{'constructor'!==d&&void 0===a.prototype[d]&&(a.prototype[d]=c.prototype[d])})})};const ja=(a,b)=>{a={level:a,message:b.map(c=>String(c)).join(' ')};for(const c of b){let d;if(null==(d=c)?0:d.stack)a.stackTrace||(a.stackTrace=''),a.stackTrace+=c.stack}return JSON.stringify(a)};
|
|
213
|
+
(()=>{const a=console.trace,b=console.debug,c=console.log,d=console.info,e=console.warn,f=console.error;console.trace=(...g)=>a(ja('TRACE',g));console.debug=(...g)=>b(ja('DEBUG',g));console.log=(...g)=>c(ja('LOG',g));console.info=(...g)=>d(ja('INFO',g));console.warn=(...g)=>e(ja('WARN',g));console.error=(...g)=>f(ja('ERROR',g))})();olympe.Sa={};olympe.Sa.node={};olympe.W={};olympe.W.rf={};olympe.W.rf.Pn=class{process(a){for(const b of Object.keys(a.qe))if(a.rd(b).Mm())throw Error('Service "'+b+'" is defined as abstract and needs to be overridden');}};olympe.W.rf.Pn.xa=[olympe.W.rf.Pp];olympe.W.rf.Qn=class{process(a){function b(e,f){if(f.includes(e))throw Error('Circular dependency detected: '+f.join(' > ')+' > '+e);if(d.has(e)){f=f.concat(e);d.delete(e);e=a.rd(e);c(e.Gi(),f);for(const g of ka(e))c(g.Gi(),f)}}function c(e,f){for(const g of e)g instanceof olympe.W.wb&&b(g.V(),f)}const d=new Set(Object.keys(a.qe));for(const e of d)b(e,[])}};olympe.W.rf.Qn.xa=[olympe.W.rf.Pp];olympe.W.rf.Pp=class{process(){}};const la=[],ma=[];function na(a){const b=a.ab();b.debug('Registering configurations...');b.C++;la.forEach(c=>{D(a.H,'Registering configure callback '+(c.C?'for module '+c.C:''));a.F.push(c.F)});oa(b);b.debug('done registering')}function pa(a){const b=a.ab();b.debug('Running run callbacks of container...');b.C++;ma.forEach(c=>{const d=qa(a,c.Gi());a.H.debug('Calling run callback '+`for module ${c.C}`);c.F.apply(null,d)});oa(b);b.debug('done calling run callbacks. DI process completed!')}
|
|
214
|
+
olympe.W.Vn=class{constructor(){}static C(a,b){la.push(new olympe.W.Rk(a,b))}static F(a,b,c){a.forEach(d=>{if(null===d||void 0===d)throw Error('Cannot proceed - DI configuration error. '+(c?`Run callback "${c}"`:'A run callback')+' cannot have a null or undefined dependency');});ma.push(new olympe.W.Rk(b,c,a))}};olympe.W.config=olympe.W.Vn.C;olympe.W.run=olympe.W.Vn.F;olympe.W.Fk=class{constructor(){}getValue(){}};function ra(a,b){let c,d;return null!=(d=null==(c=a.G)?void 0:c.call(a,b))?d:!0}olympe.W.Rk=class{constructor(a,b,c){this.F=a;this.L=(null!=c?c:[]).map(d=>'string'===typeof d?new olympe.W.wb(d):d);this.C=null!=b?b:'no name di callback';this.G=null}Gi(){return this.L}};function sa(a,b,c){let d=a.C[b];if(void 0===d){const e=a.F[b];if(void 0===e){if(c===olympe.W.Xg.C.Bl)return null;throw Error('Service "'+b+'" not found');}try{d=e.instantiate(a)}catch(f){throw a.H.error('Error during instantiation of service '+b),f;}!e.L&&(a.C[b]=d)}return d}function qa(a,b){const c=b.length,d=Array(c);let e,f;for(e=0;e<c;e++)a.H.C++,f=b[e],d[e]=f instanceof olympe.W.Fk?f.getValue(a):f,oa(a.H);return d}
|
|
215
|
+
olympe.W.Xg=class{constructor(a,b,c=2){this.F=a;this.parameters=b;this.C=Object.create(null);this.H=new olympe.W.mp(c);a=olympe.W.R.bg;if(void 0!==this.C[a])throw Error('Service "'+a+'" has already been instantiated');this.C[a]=this}ab(){return this.H}getParameter(a){return this.parameters[a.toLowerCase()]}};olympe.W.Xg.C={xs:'exception',Bl:'null'};function ua(a,b,c){function d(f,g){let h,k,l;for(h in f)Object.prototype.hasOwnProperty.call(f,h)&&(k=f[h],l=g.concat((h.startsWith('#')?h.substring(1):h).toLowerCase()),'object'!==typeof k||null===k||h.startsWith('#')?e[l.join('.')]=k:d(k,l))}const e=a.parameters;d(b,c?[c]:[])}function E(a,b,c,...d){D(a.H,'Defining service '+b);a.C(b,c,d,!1,!1)}function va(a,b,c,...d){D(a.H,'Defining service '+b);a.C(b,c,d,!1,!0)}
|
|
216
|
+
function F(a,b,c,d,e=!1){D(a.H,'Defining service (as a factory) '+b);a.C(b,d,c,!0,e)}function wa(a,b,c,d=!1){D(a.H,'Defining service alias '+b);a.C(b,e=>e,[c],!0,d)}function xa(a,b){D(a.H,'Defining abstract service '+b);a.C(b).G=!0}function ya(a,b,c){a.parameters[b.toLowerCase()]=c}function G(a,b,c){b=b.toLowerCase();Object.prototype.hasOwnProperty.call(a.parameters,b)||(a.parameters[b]=c)}
|
|
217
|
+
olympe.W.ms=class{constructor(a){var b=za,c=Aa;this.qe=Object.create(null);this.parameters=Object.create(null);this.L=[new olympe.W.rf.Pn,new olympe.W.rf.Qn];this.F=[];b&&ua(this,b);c&&ua(this,c,'version');a&&ua(this,a);a=this.getParameter(olympe.W.U.At);this.G=void 0!==a?a:3;this.H=new olympe.W.mp(this.G)}ab(){return this.H}C(a,b,c,d,e){const f=a instanceof olympe.W.wb?a.V():a;if(3<=arguments.length&&c){const h=c.indexOf(f);if(-1!==h){if(void 0===this.qe[f])throw Error(`ContainerBuilder.define: Service ${f} references itself and is not an override definition!`);
|
|
218
|
+
var g=this.qe[f];g.id=g.id+'!!'+ ++olympe.W.$k.C;g.L=!0;g=g.id;c[h]=g;this.qe[g]=this.qe[f]}}this.qe[f]=new olympe.W.$k(b,c,d||!1,f);return this.qe[f]}rd(a){const b=this.qe[a];if(void 0===b)throw Error(`DI Error: Definition ${a} was not found`);return b}getParameter(a){return this.parameters[a.toLowerCase()]}compile(){const a=this.F;this.H.debug('Calling '+a.length+' configure callbacks');this.H.C++;a.forEach(b=>{D(this.H,'Calling callback');this.H.C++;b(this);oa(this.H)});oa(this.H);this.H.debug('Configuration summary: '+
|
|
219
|
+
Object.keys(this.qe).length+' definitions');this.H.debug('Compiling...');this.H.C++;this.L.forEach((b,c)=>{this.H.debug('running compilation pass '+(c+1)+': '+b.constructor.name);b.process(this)});oa(this.H);this.H.debug('Compilation done, returning container');return new olympe.W.Xg(this.qe,this.parameters,this.G)}};function ka(a){let b,c;return null!=(c=null==(b=a.C)?void 0:b.values())?c:[]}
|
|
220
|
+
olympe.W.$k=class{constructor(a,b,c,d){this.O=a||null;this.T=!!c;this.F=(null!=b?b:[]).map(e=>'string'===typeof e?new olympe.W.wb(e):e);this.G=!1;this.C=null;this.id=null!=d?d:'';this.L=!1}V(){return this.id}instantiate(a){const b=a.ab();b.debug('Resolving arguments for '+this.id);const c=this.O;let d=qa(a,this.F);const e=()=>{if(this.T)return c.apply(null,d);d.unshift(null);return new (c.bind.apply(c,d))};D(b,'Instantiating '+this.id);const f=olympe.D?olympe.D.Gg().run(()=>e()):e();let g;if(0<(null==
|
|
221
|
+
(g=this.C)?void 0:g.size)){b.C++;D(b,'Calling configuration callbacks:');for(const h of this.C.values())b.C++,D(b,'Check if need to call additional configuration callback '+h.C),ra(h,f)?(D(b,'Calling additional configuration callback '+h.C),d=qa(a,h.Gi()),d.push(f),h.F.apply(null,d)):D(b,'Will not call additional configuration callback '+h.C+'predicate has returned false'),oa(b);oa(b)}D(b,'Done instantiating '+this.id);return f}Gi(){return this.F}Mm(){return this.G}config(a,b,c,d,e){null===this.C&&
|
|
222
|
+
(this.C=new Map);var f=this.C,g=f.set;b=new olympe.W.Rk(c,e,b);b.G=d;g.call(f,a,b)}};olympe.W.$k.C=0;function oa(a){0<a.C&&a.C--}function D(a,b){1>=a.F&&Ba(a,'log','DI: '+b)}function Ba(a,b,c){if(console&&console[b]){var d='';for(let e=0;e<a.C;e++)d+=' ';console[b](d+c)}}olympe.W.mp=class{constructor(a){this.F=a;this.C=0}debug(a){2>=this.F&&Ba(this,'log','DI: '+a)}info(a){3>=this.F&&Ba(this,'info','DI: '+a)}warn(a){4>=this.F&&Ba(this,'warn','DI: '+a)}error(a){5>=this.F&&Ba(this,'error','DI: '+a)}};olympe.W.ja=class extends olympe.W.Fk{constructor(a){super();this.id=a}V(){return this.id}getValue(a){return a.getParameter(this.id)}};olympe.W.wb=class extends olympe.W.Fk{constructor(a,b){super();this.id=a;this.C=b||olympe.W.Xg.C.xs}V(){return this.id}getValue(a){return sa(a,this.id,this.C)}};olympe.W.R={bg:'di.Container',mA:'di.PublicContainer'};olympe.W.U={At:'logging.di'};olympe.W.run([olympe.W.R.bg],a=>{olympe.W.getParameter=b=>a.getParameter(b);olympe.ge().getConfig=b=>a.getParameter(b);olympe.ge().getConfigNames=()=>Object.keys(a.parameters)});olympe.Y={};olympe.Y.$o=class{constructor(a){this.id=a||olympe.Y.$o.C++}Qa(a){return a?this.id===a.id:!1}toJSON(){return this.id.toString()}toString(){return this.id.toString()}};olympe.Y.$o.C=0;olympe.Y.Sz=class{constructor(a,b,c,d,e,f){this.C=[a||0,b||0,0,c||0,d||0,0,e||0,f||0,1]}set(a,b,c){this.C[3*a+b]=c}get(a,b){return this.C[3*a+b]}};olympe.Y.eh=function(a,b,c,d,e,f,g,h,k,l,n,p,q){this.values=[a,b,c,0,0,d,e,f,0,0,g,h,k,0,0,l,n,p,q,0]};olympe.Y.eh.F=function(a){return new olympe.Y.eh(.213+.787*a,.715-.715*a,.072-.072*a,.213-.213*a,.715+.285*a,.072-.072*a,.213-.213*a,.715-.715*a,.072+.928*a,0,0,0,1)};olympe.Y.eh.C=function(){return new olympe.Y.eh(0,0,0,0,0,0,0,0,0,.2125,.7154,.0721,0)};olympe.Y.eh.prototype.set=function(a,b,c){this.values[5*a+b]=c};olympe.Y.eh.prototype.get=function(a,b){return this.values[5*a+b]};olympe.Y.Promise={};olympe.Y.Promise.bk=function(a,b){let c=null;return(...d)=>new Promise((e,f)=>{clearTimeout(c);c=setTimeout(()=>x(function*(){try{const g=yield a(...d);e(g)}catch(g){f(g)}}),b)})};olympe.Y.Promise.en=function(a,b,c='Promise timeout'){return new Promise((d,e)=>{const f=setTimeout(()=>{e(Error(c))},b);a.then(g=>{clearTimeout(f);d(g)}).catch(g=>{clearTimeout(f);e(g)})})};olympe.Y.promise={};function Ca(a){if(0===a.size())a.F.next(!1);else if(a.G()){a.C++;var b=Da(a);b&&b.F.call(a).then(c=>{b.resolve(c)}).catch(c=>{b.C(c)}).finally(()=>{a.C--;0===a.size()&&a.F.next(!1);Ca(a)})}}function Ea(a,b){return new Promise((c,d)=>{a.Ya.push(new olympe.Y.promise.Cu(c,d,b));Ca(a)})}function Da(a){a.F.next(!0);let b;return null!=(b=a.Ya.shift())?b:null}
|
|
223
|
+
olympe.Y.promise.Aq=class{constructor(){this.Ya=[];this.F=new rxjs.BehaviorSubject(!1);this.C=0}G(){return 0===this.C}clear(){for(;0<this.Ya.length;)this.Ya.shift().C(Error('Canceled by a clearStack'));Ca(this)}size(){return this.Ya.length}};olympe.Y.promise.Cu=class{constructor(a,b,c){this.resolve=a;this.C=b;this.F=c}};olympe.Y.promise.Du=class extends olympe.Y.promise.Aq{constructor(a){super();if('number'!==typeof a||0>=a)throw Error('StackWindow with an invalid concurrentLimit. It must be a number > 0 for the stack to work properly');this.Mi=a}G(){return this.C<this.Mi}};olympe.Y.promise.FB=class{constructor(a,...b){this.G=a;this.parameters=b;this.C=this.F=null;this.promise=new Promise((c,d)=>{this.F=c;this.C=d});this.start()}then(a){return this.promise.then(a)}catch(a){return this.promise.catch(a)}finally(a){return this.promise.finally(a)}start(){'undefined'!==typeof Worker?setTimeout(()=>{const a=URL.createObjectURL(new Blob([`
|
|
224
224
|
function onFullfilledCallback(data) {
|
|
225
225
|
self.postMessage({ type: "done", data, });
|
|
226
226
|
self.close();
|
|
@@ -231,863 +231,864 @@ olympe.Y.promise.yq=class{constructor(){this.Ya=[];this.F=new rxjs.BehaviorSubje
|
|
|
231
231
|
}
|
|
232
232
|
self.onmessage = ({ data: { params } }) => {
|
|
233
233
|
(${this.G.toString()})(onFullfilledCallback, onRejectedCallback, ...(params ?? []));
|
|
234
|
-
};`])),b=new Worker(a);b.addEventListener('message',c=>{const {data:d,type:e}=c.data;URL.revokeObjectURL(a);if('done'===e){let f;null==(f=this.F)||f.call(this,d)}else{let f;null==(f=this.C)||f.call(this,d)}});b.postMessage({params:this.parameters})},0):this.G(this.F,this.C,...this.parameters)}};function
|
|
235
|
-
olympe.Y.
|
|
236
|
-
olympe.Y
|
|
237
|
-
olympe.Y.
|
|
238
|
-
function
|
|
239
|
-
c,d,b[14],17,-1502002290);d=
|
|
240
|
-
e=
|
|
241
|
-
f=
|
|
242
|
-
b[4],6,-145523070);f=
|
|
243
|
-
function
|
|
244
|
-
|
|
245
|
-
olympe.Y.
|
|
246
|
-
olympe.Y.Ah=function(){let a='';for(let b=0;19>b;b++)a+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.charAt(Math.floor(62*Math.random()));return'@'+a};olympe.Y.
|
|
247
|
-
olympe.Y.
|
|
248
|
-
r=decodeURIComponent(r);b[q[1]]=r}return{scheme:a||null,
|
|
249
|
-
olympe.Y.
|
|
250
|
-
olympe.Y.
|
|
251
|
-
|
|
252
|
-
olympe.
|
|
253
|
-
olympe.ma.
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
olympe.D.
|
|
258
|
-
|
|
259
|
-
this.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
function
|
|
266
|
-
a
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
function
|
|
270
|
-
function
|
|
271
|
-
|
|
272
|
-
olympe.D.Node
|
|
273
|
-
olympe.D.Node
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
function
|
|
278
|
-
function yb(a,b){
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
olympe.D.
|
|
282
|
-
this.value
|
|
283
|
-
|
|
284
|
-
c
|
|
285
|
-
a],(b,c)=>olympe.D.
|
|
286
|
-
a],(b,c)=>
|
|
287
|
-
b)
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
olympe.D.ta([a],
|
|
293
|
-
|
|
294
|
-
olympe.D.
|
|
295
|
-
olympe.D.aa.
|
|
296
|
-
olympe.D.aa.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
b,c,d){
|
|
301
|
-
|
|
302
|
-
m.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
olympe.D.
|
|
306
|
-
b){return olympe.D.ta([this,a,b],(c,d,e)=>olympe.D.
|
|
307
|
-
e.valueOf())),olympe.D.Na,'OString.
|
|
308
|
-
|
|
309
|
-
m.
|
|
310
|
-
|
|
311
|
-
olympe.D.
|
|
312
|
-
|
|
313
|
-
olympe.D.
|
|
314
|
-
olympe.D
|
|
315
|
-
olympe.D.
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
m.
|
|
234
|
+
};`])),b=new Worker(a);b.addEventListener('message',c=>{const {data:d,type:e}=c.data;URL.revokeObjectURL(a);if('done'===e){let f;null==(f=this.F)||f.call(this,d)}else{let f;null==(f=this.C)||f.call(this,d)}});b.postMessage({params:this.parameters})},0):this.G(this.F,this.C,...this.parameters)}};function Fa(a,b){var c=a.C;b=(new TextEncoder).encode(b);return c.call(a,b)}function Ga(a){return(new TextDecoder('utf8')).decode(a)}olympe.Y.Lk=class{G(){}C(){}F(){}};olympe.Y.Xq=a=>a.replace('+','-').replace('/','_');olympe.Y.ov=a=>a.replace('-','+').replace('_','/');function Ha(a){a.C=setTimeout(()=>{const b=Date.now(),c=a.timeout;for(const [d,e]of a.values)b-e>c&&(a.delete(d),a.F&&a.F(d));if(0<a.values.size)Ha(a);else{let d;null==(d=a.G)||d.call(a)}},a.L)}function Ia(a,b){return a.values.has(b)?(a.values.set(b,Date.now()),!0):!1}function Ka(a,b){a.F=b;return a}
|
|
235
|
+
olympe.Y.am=class{constructor(a,b=a/2){this.timeout=a;this.L=b;this.values=new Map;this.G=this.F=this.C=null}add(a){this.values.set(a,Date.now());null===this.C&&Ha(this)}has(a){return this.values.has(a)}forEach(a){this.values.forEach((b,c)=>a(c))}delete(a){a=this.values.delete(a);if(0===this.values.size){this.C&&clearTimeout(this.C);this.C=null;let b;null==(b=this.G)||b.call(this)}return a}clear(){this.C&&clearTimeout(this.C);this.C=null;this.values.clear();return this}};function La(a,b){a.F=b;return a}function Ma(a,b){a.C.G=b}
|
|
236
|
+
olympe.Y.$l=class{constructor(a){this.C=Ka(new olympe.Y.am(a,void 0),b=>{const c=this.values.get(b);this.values.delete(b);let d;null==(d=this.F)||d.call(this,b,c)});this.values=new Map;this.F=null}set(a,b){this.values.set(a,b);this.C.add(a);return this}has(a){return this.values.has(a)}get(a){return this.values.get(a)}forEach(a){this.values.forEach((b,c)=>a(b,c))}delete(a){this.values.delete(a);return this.C.delete(a)}clear(){this.C.clear();this.values.clear();return this}};function Na(a,b){a.T.push(b)}function Oa(a,b){a.Z.push(b)}function Pa(a,b){let c;'object'!==typeof b&&'function'!==typeof b?c=b:b instanceof olympe.dc.CloudObject?c=b.toJSON():Array.isArray(b)?c=b.map(d=>Pa(a,d)):c='N/A';return c}function Qa(a,b,c,d){b={cat:b,epoch:null!=d?d:performance.now()-a.F};let e;for(const [f,g]of null!=(e=c)?e:[])b[f]=Pa(a,g);a.G.push(b)}
|
|
237
|
+
olympe.Y.du=class{constructor(){this.G=[];this.T=[];this.Z=[];this.O=new Map;this.L=new Map;this.C=!1;this.F=null}start(){this.C||(this.F||(this.F=performance.now()),this.C=!0,this.T.forEach(a=>a()))}stop(){this.C&&(this.Z.forEach(a=>a()),this.C=!1)}};function Ra(a,b){return a+b&4294967295}
|
|
238
|
+
function Sa(a,b){let c=a[0],d=a[1],e=a[2],f=a[3];c=H(c,d,e,f,b[0],7,-680876936);f=H(f,c,d,e,b[1],12,-389564586);e=H(e,f,c,d,b[2],17,606105819);d=H(d,e,f,c,b[3],22,-1044525330);c=H(c,d,e,f,b[4],7,-176418897);f=H(f,c,d,e,b[5],12,1200080426);e=H(e,f,c,d,b[6],17,-1473231341);d=H(d,e,f,c,b[7],22,-45705983);c=H(c,d,e,f,b[8],7,1770035416);f=H(f,c,d,e,b[9],12,-1958414417);e=H(e,f,c,d,b[10],17,-42063);d=H(d,e,f,c,b[11],22,-1990404162);c=H(c,d,e,f,b[12],7,1804603682);f=H(f,c,d,e,b[13],12,-40341101);e=H(e,f,
|
|
239
|
+
c,d,b[14],17,-1502002290);d=H(d,e,f,c,b[15],22,1236535329);c=I(c,d,e,f,b[1],5,-165796510);f=I(f,c,d,e,b[6],9,-1069501632);e=I(e,f,c,d,b[11],14,643717713);d=I(d,e,f,c,b[0],20,-373897302);c=I(c,d,e,f,b[5],5,-701558691);f=I(f,c,d,e,b[10],9,38016083);e=I(e,f,c,d,b[15],14,-660478335);d=I(d,e,f,c,b[4],20,-405537848);c=I(c,d,e,f,b[9],5,568446438);f=I(f,c,d,e,b[14],9,-1019803690);e=I(e,f,c,d,b[3],14,-187363961);d=I(d,e,f,c,b[8],20,1163531501);c=I(c,d,e,f,b[13],5,-1444681467);f=I(f,c,d,e,b[2],9,-51403784);
|
|
240
|
+
e=I(e,f,c,d,b[7],14,1735328473);d=I(d,e,f,c,b[12],20,-1926607734);c=J(d^e^f,c,d,b[5],4,-378558);f=J(c^d^e,f,c,b[8],11,-2022574463);e=J(f^c^d,e,f,b[11],16,1839030562);d=J(e^f^c,d,e,b[14],23,-35309556);c=J(d^e^f,c,d,b[1],4,-1530992060);f=J(c^d^e,f,c,b[4],11,1272893353);e=J(f^c^d,e,f,b[7],16,-155497632);d=J(e^f^c,d,e,b[10],23,-1094730640);c=J(d^e^f,c,d,b[13],4,681279174);f=J(c^d^e,f,c,b[0],11,-358537222);e=J(f^c^d,e,f,b[3],16,-722521979);d=J(e^f^c,d,e,b[6],23,76029189);c=J(d^e^f,c,d,b[9],4,-640364487);
|
|
241
|
+
f=J(c^d^e,f,c,b[12],11,-421815835);e=J(f^c^d,e,f,b[15],16,530742520);d=J(e^f^c,d,e,b[2],23,-995338651);c=L(c,d,e,f,b[0],6,-198630844);f=L(f,c,d,e,b[7],10,1126891415);e=L(e,f,c,d,b[14],15,-1416354905);d=L(d,e,f,c,b[5],21,-57434055);c=L(c,d,e,f,b[12],6,1700485571);f=L(f,c,d,e,b[3],10,-1894986606);e=L(e,f,c,d,b[10],15,-1051523);d=L(d,e,f,c,b[1],21,-2054922799);c=L(c,d,e,f,b[8],6,1873313359);f=L(f,c,d,e,b[15],10,-30611744);e=L(e,f,c,d,b[6],15,-1560198380);d=L(d,e,f,c,b[13],21,1309151649);c=L(c,d,e,f,
|
|
242
|
+
b[4],6,-145523070);f=L(f,c,d,e,b[11],10,-1120210379);e=L(e,f,c,d,b[2],15,718787259);d=L(d,e,f,c,b[9],21,-343485551);a[0]=Ra(c,a[0]);a[1]=Ra(d,a[1]);a[2]=Ra(e,a[2]);a[3]=Ra(f,a[3])}function J(a,b,c,d,e,f){b=Ra(Ra(b,a),Ra(d,f));return Ra(b<<e|b>>>32-e,c)}function H(a,b,c,d,e,f,g){return J(b&c|~b&d,a,b,e,f,g)}function I(a,b,c,d,e,f,g){return J(b&d|c&~d,a,b,e,f,g)}function L(a,b,c,d,e,f,g){return J(c^(b|~d),a,b,e,f,g)}
|
|
243
|
+
function Ta(a,b=32){const c='0123456789abcdef'.split('');var d=a,e=d.length;a=[1732584193,-271733879,-1732584194,271733878];var f;for(f=64;f<=d.length;f+=64){var g=d.substring(f-64,f),h=[];for(let k=0;64>k;k+=4)h[k>>2]=g.charCodeAt(k)+(g.charCodeAt(k+1)<<8)+(g.charCodeAt(k+2)<<16)+(g.charCodeAt(k+3)<<24);Sa(a,h)}d=d.substring(f-64);g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(f=0;f<d.length;f++)g[f>>2]|=d.charCodeAt(f)<<(f%4<<3);g[f>>2]|=128<<(f%4<<3);if(55<f)for(Sa(a,g),f=0;16>f;f++)g[f]=0;g[14]=8*e;
|
|
244
|
+
Sa(a,g);d='';e=0;b=0<=b?b:32;for(f=0;4>f;f++)for(h=a[f],g=0;4>g;g++){if(++e>b)return d;d+=c[h>>8*g+4&15];if(++e>b)return d;d+=c[h>>8*g&15]}return d}'5d41402abc4b2a76b9719d911017c592'!==Ta('hello')&&(Ra=(a,b)=>{const c=(a&65535)+(b&65535);return(a>>16)+(b>>16)+(c>>16)<<16|c&65535});olympe.Y.vb=Ta;function Ua(a){a='0'.repeat(12)+a.toString(16);return a.substring(a.length-12,a.length)}function Va(){var a=Math.random();return Ua((new Date).getTime())+(a.toString(16)+'0'.repeat(8)).substr(2,8)}const Wa=Math.pow(2,32)-1;olympe.Y.Fc=function(){return Va()};olympe.Y.tf=function(){return Va()};olympe.Y.OC=function(a,b=1){const c=a.substr(12,a.length-12);return Ua(parseInt(a.substr(0,12),16)+b)+c};
|
|
245
|
+
olympe.Y.NC=function(a){return Ua(parseInt(a.substr(0,12),16)+1)+(Math.random().toString(16)+'00000000').substr(2,8)};let Xa=0,Ya=0;olympe.Y.Mv=function(){var a=(new Date).getTime();a<=Xa?4294967295===Ya?(Ya=Math.floor(Math.random()/4*Wa),Xa+=1):Ya=Math.floor(Ya+(4294967295-Ya)/2):(Ya=Math.floor(Math.random()/4*Wa),Xa=a);a='00000000'+Ya.toString(16);return Ua(Xa)+a.substr(a.length-8,8)};olympe.Y.cD=function(){for(let a=0;1E4>a;a++)console.log(olympe.Y.Mv())};
|
|
246
|
+
olympe.Y.Ah=function(){let a='';for(let b=0;19>b;b++)a+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.charAt(Math.floor(62*Math.random()));return'@'+a};olympe.Y.GC=function(a){let b='';for(let c=0;5>c;c++)b+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.charAt(Math.floor(62*Math.random()));return(a?a:'UI')+'-'+b};olympe.Y.CC=function(a,b){return(b?b:'UI')+'-'+a};
|
|
247
|
+
olympe.Y.zx=function(a){var b=/^(?:(\S*)@)?([^:]+)(?::(\d{2,5}))?$/;const c=/([^&=]+)=([^&=]+)/g,d=/^true|false$/i,e=/^\d+(\.\d+)?$/;var f=a.match(/^(?:([^:/?#]+):)?(?:\/\/([^/?#]*))?\/?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/);a=f[1];const g=f[2],h=f[3],k=f[4];f=f[5];let l=null,n=null;var p=null;g&&(p=g.match(b),l=p[1],n=p[2],p=p[3]);b={};let q;for(;q=c.exec(k);){let r=q[2];void 0===r?r=!0:r.startsWith('"')&&r.endsWith('"')?r=r.substring(1,r.length-1):d.test(r)?r='true'===r.toLowerCase():e.test(r)?r=parseFloat(r):
|
|
248
|
+
r=decodeURIComponent(r);b[q[1]]=r}return{scheme:a||null,jC:g||null,Gr:l||null,host:n||null,port:p&&parseInt(p,10)||null,path:h&&'/'!==h?h:null,query:k||null,DC:f||null,parameters:b}};olympe.Y.YC=function(a){a=a.substring(1);return''===a?new Map:new Map(a.split('&').map(b=>b.split('=').map(decodeURIComponent)))};
|
|
249
|
+
olympe.Y.aD=function(a){a=Array.from(a.entries()).filter(([,b])=>null!==b&&void 0!==b).map(([b,c])=>`${encodeURIComponent(b)}=${encodeURIComponent(c)}`).join('&');return 0<a.length?`#${a}`:''};olympe.Y.MC=(a,b)=>{const c=Object.keys(a).find(d=>a[d]===b);return void 0===c?null:c};olympe.Y.Rm=(a,b)=>{if(b instanceof Object)for(const c of Object.keys(b)){const d=b[c];d instanceof Object&&void 0!==a[c]?olympe.Y.Rm(a[c],d):a[c]=d}};
|
|
250
|
+
olympe.Y.xe=(a,b,c)=>{const d=Object.create(null);b(a,e=>{olympe.Y.Rm(d,e);b(`conf.d/${a}`,f=>{olympe.Y.Rm(d,f);c(d)})})};olympe.Y.iC=class a{constructor(b,c){this.x=b;this.y=c}add(b){return new a(this.x+b.x,this.y+b.y)}Fm(){return Math.sqrt(this.x*this.x+this.y*this.y)}toString(){return`Vector(${this.x}, ${this.y})`}};olympe.Y.Dt=class{constructor(a,b){this.start=a;this.end=b}};olympe.Y.Dt.C={Gz:'left',uA:'right',my:'bottom',EB:'top'};function Za(a){return`${a.C}.${a.F}.${a.G}`}
|
|
251
|
+
olympe.Y.pf=class{constructor(a,b,c,d){this.C=a;this.F=b;this.G=c;this.L=d||null}static parse(a){a=/([0-9]*)\.([0-9]*)\.([0-9]*)-?([A-z\-_0-9]*)/.exec(a);if(null===a||4>a.length)return olympe.Y.pf.C;const b=Number.parseInt(a[1],10),c=Number.parseInt(a[2],10),d=Number.parseInt(a[3],10);return isNaN(b)||isNaN(c)||isNaN(d)?olympe.Y.pf.C:new olympe.Y.pf(b,c,d,a[4])}lk(a){return this.C!==a.C?this.C>a.C:this.F!==a.F?this.F>a.F:this.G>a.G}Ui(a){return this.C!==a.C?this.C<a.C:this.F!==a.F?this.F<a.F:this.G<
|
|
252
|
+
a.G}Qa(a){return this.C===a.C&&this.F===a.F&&this.G===a.G}toString(){return`${this.C}.${this.F}.${this.G}`+(null!==this.L?`-${this.L}`:'')}};olympe.Y.pf.C=new olympe.Y.pf(Number.NaN,Number.NaN,Number.NaN);olympe.Y.R={ag:'utils.binaryConverter',Sr:'utils.base64Converter',Lf:'utils.Profiler'};olympe.W.config(a=>{xa(a,olympe.Y.R.ag);wa(a,olympe.Y.R.Sr,olympe.Y.R.ag,!0);E(a,olympe.Y.R.Lf,olympe.Y.du)},'Utils services');olympe.W.run([olympe.Y.R.ag,olympe.Y.R.Lf],(a,b)=>{olympe.Y.Se=()=>a;olympe.ge().isProfilerEnabled=()=>b.C;olympe.ge().startProfiler=()=>b.start();olympe.ge().stopProfiler=()=>b.stop();olympe.ge().getProfilerEvents=()=>({events:b.G,names:Object.fromEntries(b.O.entries()),models:Object.fromEntries(b.L.entries())})});olympe.ma={};olympe.ma.Hb=class{la(){}Z(){}L(){}C(){}oa(){}O(){}za(){}ba(){}fa(){}trace(){}debug(){}log(){}info(){}warn(){}error(){}fatal(){}};olympe.ma.Hb.prototype.fatal=olympe.ma.Hb.prototype.fatal;olympe.ma.Hb.prototype.error=olympe.ma.Hb.prototype.error;olympe.ma.Hb.prototype.warn=olympe.ma.Hb.prototype.warn;olympe.ma.Hb.prototype.info=olympe.ma.Hb.prototype.info;olympe.ma.Hb.prototype.log=olympe.ma.Hb.prototype.log;olympe.ma.Hb.prototype.debug=olympe.ma.Hb.prototype.debug;olympe.ma.Hb.prototype.trace=olympe.ma.Hb.prototype.trace;
|
|
253
|
+
olympe.ma.Hb.C={Ju:0,Ff:1,zt:2,Uo:3,Xu:4,Eb:5,As:6,hi:7};olympe.ma.Hb.F={0:'TRACE',1:'DEBUG',2:'LOG',3:'INFO',4:'WARN',5:'ERROR',6:'FATAL',7:'NOTHING'};olympe.ma.Ta=class{Oc(){}};olympe.ma.me={};function $a(a,b,c,d){a.Ja[b](`[OLYMPE.${c}]:`,d.join(' '));if(0<a.T.size){var e=new Date;e=('00'+e.getHours()).substring(-2)+':'+('00'+e.getMinutes()).substring(-2)+':'+('00'+e.getSeconds()).substring(-2)+'.'+('00'+e.getMilliseconds()).substring(-3);for(const f of a.T.values())f(e,c,b,...d)}}
|
|
254
|
+
olympe.ma.me.Hb=class{constructor(a,b){this.name=a;this.F=b;this.G=a.toUpperCase();this.T=new Map;this.Ja=console}la(){return this.name}Z(){return this.F}L(){return this.F<=olympe.ma.Hb.C.Ju}C(){return this.F<=olympe.ma.Hb.C.Ff}O(){return this.F<=olympe.ma.Hb.C.zt}oa(){return this.F<=olympe.ma.Hb.C.Uo}za(){return this.F<=olympe.ma.Hb.C.Xu}ba(){return this.F<=olympe.ma.Hb.C.Eb}fa(){return this.F<=olympe.ma.Hb.C.As}trace(...a){this.L()&&$a(this,'trace',this.G,a)}debug(...a){this.C()&&$a(this,'debug',
|
|
255
|
+
this.G,a)}log(...a){this.O()&&$a(this,'log',this.G,a)}info(...a){this.oa()&&$a(this,'info',this.G,a)}warn(...a){this.za()&&$a(this,'warn',this.G,a)}error(...a){this.ba()&&$a(this,'error',this.G,a)}fatal(...a){this.fa()&&$a(this,'error',this.G,a)}};olympe.ma.me.Hb.xa=[olympe.ma.Hb];olympe.ma.me.Ta=class{constructor(a,b,c){this.C=a;this.F=parseInt(b,10);this.G=c;this.channels=new Map;this.H=this.Oc('logging');this.H.info('Logging initialized, global log level is '+olympe.ma.Hb.F[b])}Oc(a){var b=this.channels.get(a);if(!b){b=this.F;var c=`${olympe.ma.U.Yr}.${a}`;Object.prototype.hasOwnProperty.call(this.C.parameters,c.toLowerCase())&&(b=parseInt(this.C.getParameter(c),10));let d=this.G;c=`${c}.${olympe.ma.U.uu}`;Object.prototype.hasOwnProperty.call(this.C.parameters,c.toLowerCase())&&
|
|
256
|
+
(d=!0===this.C.getParameter(c));b=new olympe.ma.me.Hb(a,b,d);this.channels.set(a,b)}return b}};olympe.ma.me.Ta.xa=[olympe.ma.Ta];olympe.ma.R={Ha:'logging.Manager'};olympe.ma.U={Fo:'logging',Go:'logging.showLogLevel',Yr:'logging',uu:'showLogLevel'};olympe.W.config(function(a){G(a,olympe.ma.U.Fo,olympe.ma.Hb.C.Uo);G(a,olympe.ma.U.Go,!0);va(a,olympe.ma.R.Ha,olympe.ma.me.Ta,olympe.W.R.bg,new olympe.W.ja(olympe.ma.U.Fo),new olympe.W.ja(olympe.ma.U.Go))},'olympe.logging');olympe.W.run([olympe.ma.R.Ha],a=>{olympe.ma.ab=b=>a.Oc(b)},'Logging singleton getter initialization');olympe.D={};olympe.D.U={rp:'df.nodeCreationThreshold'};const ab=[];function bb(){}function cb(){}olympe.D.J=class a{constructor(b,c,d){this.C=void 0===b?bb:b;this.F=void 0===c?ab:c;this.Z=d}static L(){var b=[];return void 0===b||0===b.length?olympe.D.J.ba:new a(cb,b)}L(){return this.C?this.C():void 0}G(){return this.F?this.F:ab}O(){return null===this.C&&null===this.F}T(){return this.C===cb}};olympe.D.J.Z=new olympe.D.J;olympe.D.J.C=new olympe.D.J(null,null);olympe.D.J.ba=new olympe.D.J(cb);olympe.D.J.G=new olympe.D.J(()=>olympe.D.aa);
|
|
257
|
+
olympe.D.J.F=new olympe.D.J(()=>olympe.D.Na);olympe.D.J.O=new olympe.D.J(()=>olympe.D.ea);olympe.D.J.T=new olympe.D.J(()=>olympe.D.Sb);olympe.D.Zg=class{V(){return''}Od(){return''}destroy(){}eb(){return!1}Wc(){return!1}run(a,...b){return a(...b)}G(a){return a}getParent(){return null}sf(){}Kc(){}pd(){}ak(){}oa(){}onDestroy(){return''}zf(){}Z(){return''}Pe(){}};olympe.D.Zg.prototype.offDestroy=olympe.D.Zg.prototype.zf;olympe.D.Zg.prototype.onDestroy=olympe.D.Zg.prototype.onDestroy;let db=0;olympe.W.run([new olympe.W.ja(olympe.D.U.rp)],()=>{});
|
|
258
|
+
olympe.D.Yb=class{constructor(a='SimpleContext',b){++db;this.ob=new Map;this.jb=new Map;this.Ja=new Map;this.ac=0;this.name=a;this.id=String(db);this.L=this.tb=!1;(this.ba=void 0===b?olympe.D.Xa():b)&&this.ba.Kc(this);this.debug=!1}V(){return this.id}Od(){return this.name}run(a,...b){if(!this.tb){var c=olympe.D.Cr(this);a=a(...b);c&&olympe.D.Cr(c);return a}}G(a){return(...b)=>this.run(a,...b)}destroy(){if(!this.tb&&!this.L){this.L=!0;this.oa();for(const a of this.jb.keys())this.jb.has(a)&&this.jb.get(a)();
|
|
259
|
+
this.jb.clear();this.Ja.clear();this.ba&&(this.ba.pd(this,!1),this.ba=null);this.tb=!0;this.L=!1;this.oa()}}eb(){return this.tb}Wc(){return this.L}Kc(a){if(!this.tb){var b;olympe.D.fb(a)?b=a.Da:olympe.D.Pm(a)&&(b=a);b&&this.ob.set(b.V(),b)}}pd(a,b=!0){let c;olympe.D.fb(a)?c=a.Da:olympe.D.Pm(a)&&(c=a);c&&this.ob.has(c.V())&&(b&&c.ak(this),this.ob.delete(c.V()))}ak(){this.ba=null;this.destroy()}oa(){const a=this.ob;for(const b of a.keys())a.has(b)&&a.get(b).ak(this);this.ob.clear();for(const b of this.Ja.keys())this.Ja.has(b)&&
|
|
260
|
+
this.Ja.get(b)();this.Ja.clear()}onDestroy(a,b){void 0===b&&(++this.ac,b=String(this.ac));this.jb.set(b,a);return b}zf(a){this.jb.delete(a)}Z(a){if(void 0===b){++this.ac;var b=String(this.ac)}this.Ja.set(b,a);return b}Pe(a){this.Ja.delete(a)}sf(a){this.ba&&this.ba.pd(this,!1);(this.ba=a||null)&&this.ba.Kc(this)}getParent(){return this.ba}};olympe.D.kq=class extends olympe.D.Yb{constructor(){super('Root',null)}destroy(){}onDestroy(){return''}zf(){}};olympe.D.Zg.xa=[olympe.D.Zg];let eb=0;
|
|
261
|
+
function fb(a,b){a.fa||(a.fa=new Map);a.fa.set(b.V(),b);switch(b.yc()){case olympe.D.Node.C.fh:break;case olympe.D.Node.C.ph:break;case olympe.D.Node.C.vj:case olympe.D.Node.C.Gf:olympe.D.H.warn('Not bad as such but should not happen!');break;case olympe.D.Node.C.$g:gb(a,olympe.D.Node.C.$g);break;case olympe.D.Node.C.OBSOLETE:a.hc=!0;a.C!==olympe.D.Node.C.$g&&gb(a,olympe.D.Node.C.OBSOLETE);break;case olympe.D.Node.C.Ld:olympe.D.H.warn('Adding a destroyed node as upstream => should never happen!');break;
|
|
262
|
+
default:olympe.D.H.warn('Unknown state, investigate: ',b.yc())}hb(b,a)}
|
|
263
|
+
function ib(a){if(a.xd){var b=[],c=[];if(a.Af)if(a.Af instanceof olympe.D.Node)if(jb(a.Af))b=a.Af.Db;else return;else b=a.Af;else b=null;if(null!==a.za){const e=a.Rf;for(let f=0,g=a.za.length;f<g;f++)if(null!==e&&-1<e.indexOf(f)){const h=a.za[f];if(jb(h))c.push(h.Db);else return}else c.push(a.za[f])}if(a.xd instanceof Function)var d=a.xd;else b&&(b[a.xd]||olympe.D.H.warn('looks like you forget a cast somewhere around '+a.xd),d=b[a.xd]);a.run(()=>{a.oa();if(void 0!==d){const e=d.apply(b,c);e&&e.Sq?
|
|
264
|
+
kb(a,e.Da):e instanceof olympe.D.Node?kb(a,e):(N(a,e),void 0===e&&void 0===a.valueType&&gb(a,olympe.D.Node.C.ph))}else lb(a)})}}function O(a){void 0===a.Tb&&(a.Tb=a.valueType===olympe.D.Proxy?mb(void 0,a.ve):mb(a.valueType,a.ve),a.Tb.Da=a);return a.Tb}function nb(a){void 0!==a.O&&(ob(a.O,a),a.O=void 0)}function pb(a){if(a.C===olympe.D.Node.C.OBSOLETE&&(a.C=olympe.D.Node.C.ph,null!==a.T))for(const b of a.T.values())qb(b)}function gb(a,b){b!==a.C&&(a.C=b)}
|
|
265
|
+
function rb(a){if(a.C!==olympe.D.Node.C.OBSOLETE&&a.C!==olympe.D.Node.C.vj&&a.C!==olympe.D.Node.C.fh&&a.C!==olympe.D.Node.C.$g){gb(a,olympe.D.Node.C.vj);var b=a.T;if(b)for(const c of b.values())b.has(c.V())&&rb(c);gb(a,olympe.D.Node.C.OBSOLETE)}}function sb(a,b,c){if(a.C!==olympe.D.Node.C.Gf)if(b===a.O)N(a,c,!0);else{if(a.C===olympe.D.Node.C.OBSOLETE||a.C===olympe.D.Node.C.vj)a.hc=!0;ib(a)}}
|
|
266
|
+
function N(a,b,c){b instanceof olympe.D.Node&&(olympe.D.H.warn('We are setting the value of a node as a node, that should never happen?'),b=b.Db);a.Kb||c||void 0===a.O||nb(a);if(void 0!==b){if((a.Kb||a.C===olympe.D.Node.C.ph||a.C===olympe.D.Node.C.OBSOLETE)&&!olympe.D.fb(b)&&void 0!==a.Db){if(null===b&&null===a.Db){pb(a);return}if(null!==b&&null!==a.Db&&(b.valueOf()===a.Db.valueOf()||a.Db.Qa&&a.Db.Qa(b))){pb(a);return}}if(!0===a.Kb)olympe.D.H.error("Circular dependency detected: updating a downstream node caused this node's (#"+
|
|
267
|
+
a.V()+') value to get updated !');else{a.C===olympe.D.Node.C.Ld&&olympe.D.H.warn(`trying to set a value on a destroyed node (#${a.V()} ${a.gd?', '+a.gd:''})`);a.C===olympe.D.Node.C.Gf&&olympe.D.H.warn(`trying to set a value on a node being destroyed (#${a.V()} ${a.gd?', '+a.gd:''})`);a.Kb=!0;c=b;var d=!1,e=(f,g)=>f instanceof g?!0:!1;void 0===a.valueType||null===c||e(c,a.valueType)||(e=a.valueType&&a.valueType.name?a.valueType.name:'undefined',b='object'===typeof c?b.constructor.name:typeof c,c instanceof
|
|
268
|
+
Object?d=!0:b.toLowerCase()!==e.toLowerCase()&&a.valueType!==Object&&(d=!0),d&&('string'===b.toLowerCase()&&a.valueType===olympe.D.Na?(c=olympe.D.xb(c),d=!1):'number'===b.toLowerCase()&&a.valueType===olympe.D.aa?(c=olympe.D.ra(c),d=!1):'boolean'===b.toLowerCase()&&a.valueType===olympe.D.ea&&(c=olympe.D.Qb(c),d=!1)));a.Db=c;gb(a,olympe.D.Node.C.ph);if(b=a.T){d=0;for(const f of b.values())0<d&&rb(f),d++;for(const f of b.values())sb(f,a,c)}a.Kb=!1}}}
|
|
269
|
+
function tb(a,b){if(a.C!==olympe.D.Node.C.Gf&&a.C!==olympe.D.Node.C.Ld&&(a.C!==olympe.D.Node.C.fh||a.xd)){var c=void 0!==a.defaultValue;a.xd&&b!==a.O&&a.oa();if(c)N(a,a.defaultValue,!0);else if(a.Db=void 0,gb(a,olympe.D.Node.C.fh),b=a.T)for(const d of b.values())tb(d,a)}}function lb(a){if(a.C!==olympe.D.Node.C.$g){gb(a,olympe.D.Node.C.$g);var b=a.T;if(b)for(const c of b.values())lb(c);a.oa();void 0!==a.O&&nb(a);a.Db=a.defaultValue}}function jb(a){return a.C===olympe.D.Node.C.ph}
|
|
270
|
+
function kb(a,b){b===a?olympe.D.H.error('Setting a node as provider of itself. Ignoring'):(a.O&&a.O!==b&&nb(a),hb(b,a),jb(b)?N(a,b.Db,!0):void 0!==a.defaultValue?N(a,a.defaultValue,!0):tb(a),a.O=b)}function ub(a,b){a.xd&&(a.xd=void 0);a.gd='Repeater';kb(a,b)}function qb(a){a.O?pb(a):null!==a.fa&&0===Array.from(a.fa.values()).filter(b=>!jb(b)).length&&(a.hc&&(a.hc=!1,ib(a)),pb(a))}
|
|
271
|
+
function hb(a,b){a.T||(a.T=new Map);a.T.set(b.V(),b);a.C===olympe.D.Node.C.Ld&&olympe.D.H.warn('adding a downstream node on a deleted one (#'+a.V()+') !')}function ob(a,b){a.T&&(b=b.V(),a.T.has(b)&&(a.T.delete(b),vb(a)))}function vb(a){if(null===a.getParent()){var b=a.T;b&&0<b.size||a.destroy()}}
|
|
272
|
+
olympe.D.Node=class extends olympe.D.Yb{constructor({valueType:a,xd:b,Dx:c=!0,Af:d,Lm:e,debug:f=!1,Rf:g=null,gd:h='Node',Bi:k}={}){++eb;super(String(eb));this.debug=!!f;this.gd=h;h&&'string'===typeof h||(b?this.gd=b.name?b.name:'anon()':this.gd='Node');this.za=e&&0<e.length?e:null;this.Rf=g&&0<g.length?g:null;this.valueType=a;this.Db=void 0;this.Kb=!1;this.C=olympe.D.Node.C.fh;this.hc=!1;this.T=this.fa=null;this.xd=b;this.Af=d||null;this.defaultValue=this.Tb=this.O=void 0;this.Bi=k;d&&d instanceof
|
|
273
|
+
olympe.D.Node&&fb(this,d);if(g)for(b=0;b<g.length;b++)a=e[g[b]],fb(this,a);c&&ib(this)}Sg(a){this.defaultValue=a;this.C===olympe.D.Node.C.fh&&N(this,a,!0);return this}Ci(a){this.valueType=a}Nb(){return this.valueType||Object}asObservable(a=olympe.D.Xa()){return new rxjs.Observable(b=>{const c=a.run(()=>olympe.D.createNode(this.valueType,b.next.bind(b),null,[this],[0],`Observable of ${this.gd}`));c.onDestroy(()=>b.complete());return()=>c.destroy()})}yc(){return this.C}eb(){return this.C===olympe.D.Node.C.Ld}Wc(){return this.C===
|
|
274
|
+
olympe.D.Node.C.Gf}ve(...a){if(this.Bi instanceof Function)return this.Bi(...a);var b=a.length;--b;const c=a[b];--b;const d=a[b],e=Array(b);for(var f=0;f<b;f++)e[f]=a[f];a=this.yc();a!==olympe.D.Node.C.Gf&&a!==olympe.D.Node.C.Ld||olympe.D.H.warn('Calling a function on a destroyed node!!!',this);a=d.G();b=[];if(1===a.length&&-1===a[0])for(var g of e)olympe.D.fb(g)&&b.push(g.Da);else for(let h=0,k=a.length;h<k;h++)g=a[h],f=e[g],void 0!==f&&null!==f&&f.Ag&&(e[g]=f.Da,b.push(g));return O(new olympe.D.Node({valueType:d.L(),
|
|
275
|
+
xd:c,Af:this,Lm:e,debug:!1,Rf:b,gd:'Proxy.'+c+'()'}))}ak(a){if(null===this.getParent())olympe.D.H.warn('context is undefined, investigate');else if(this.getParent()!==a){olympe.D.H.warn('Investigate a potential issue in creator-createe link: create node mismatch',a,this.getParent());return}this.sf(null);vb(this)}destroy(){var a=this.C;if(a!==olympe.D.Node.C.Gf&&a!==olympe.D.Node.C.Ld){gb(this,olympe.D.Node.C.Gf);if(a=this.T){for(const c of a.values())if(a.has(c.V())){var b=c;b.fa&&b.fa.delete(this.V());
|
|
276
|
+
b.O&&b.O.V()===this.V()?b.O=void 0:b.destroy()}a.clear()}this.T=null;super.destroy();if(this.fa){for(const c of this.fa.values())this.fa.has(c.V())&&ob(c,this);this.fa.clear()}this.fa=null;this.O&&(ob(this.O,this),this.O=void 0);this.Db=void 0;this.za&&(this.za.length=0,this.za=null);this.Rf&&(this.Rf.length=0,this.Rf=null);this.Bi=this.xd=void 0;this.defaultValue=this.Af=null;this.gd=`** Destroyed ** ${this.gd}`;gb(this,olympe.D.Node.C.Ld)}}Od(){return this.gd}};olympe.D.Node.F='rootNode';
|
|
277
|
+
olympe.D.Node.C={fh:0,ph:1,$g:3,vj:4,OBSOLETE:5,Gf:6,Ld:7};function mb(a,b){if('function'!==typeof a)return new olympe.D.Proxy(a,b);var c=olympe.D.Proxy.prototype;void 0===a.prototype&&olympe.D.H.error('investigate');c=Object.create(wb(c,a.prototype));c.rh=a;c.Tq=b;return c}function wb(a,b){Object.prototype.hasOwnProperty.call(b,olympe.D.Proxy.Kl)||Object.defineProperty(b,olympe.D.Proxy.Kl,{enumerable:!1,configurable:!1,writable:!1,value:xb(a,b)});return b[olympe.D.Proxy.Kl]}
|
|
278
|
+
function yb(a,b){if(a.rh!==b){a.rh=b;b.prototype||olympe.D.H.error('Cast not possible, provided type is not a valid type!');var c=wb(a,b.prototype);Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c;a.Da&&a.Da.Ci(b)}}
|
|
279
|
+
function xb(a,b){let c={};if(b.prototype)olympe.D.H.error('first level of prototyping, investigate');else if(b.__proto__)c=Object.create(wb(a,b.__proto__));else return olympe.D.Proxy.prototype;Object.getOwnPropertyNames(b).forEach(d=>{if('function'===typeof b[d]&&'__getReplacementFunction'!==d){var e=b[d].K;null===e||e&&e.O()?c[d]=function(...f){var g=this.Da;if(g&&jb(g)&&(g=g.Db)&&g[d]&&'function'===typeof g[d])return g[d].apply(g,f)}:(e=e||b[d].__oSig__||olympe.D.J.Z,c[d]=function(...f){f=this.Tq.call(this.Da,
|
|
280
|
+
...f,e,d);const g=e.Z;if(g){const h=this.Da.Db;h&&h[g]&&yb(f,h[g])}return e.T()?this:f})}});return c}function zb(a,b){N(a.Da,b)}function Ab(a){tb(a.Da)}function Bb(a,b){ub(a.Da,olympe.D.yf(b)?b:b.Da)}function Cb(a,b){olympe.D.fb(b)||olympe.D.yf(b)?Bb(a,b):zb(a,b)}
|
|
281
|
+
olympe.D.Proxy=class{constructor(a,b){this.Da=null;this.rh=a;this.Tq=b}static fb(a){return!(!a||!a.Ag)}Qa(a){return olympe.D.ta([this,a],(b,c)=>b===c,Boolean)}vd(a){return olympe.D.ta([this,a],(b,c)=>null===b||null===c?b===c?olympe.D.ea.F:olympe.D.ea.C:b.valueOf()===c.valueOf()?olympe.D.ea.F:olympe.D.ea.C,olympe.D.ea)}asObservable(a){return this.Da.asObservable(a)}Sq(){return this.Da}};olympe.D.Proxy.Kl='__opp__';olympe.D.Proxy.prototype.Ag=!0;function Db(a,b){a.node.Sg(b);return a}olympe.D.mj=class{constructor(a,b='FlowSource'){this.node=olympe.D.createNode(a,void 0,void 0,void 0,void 0,b)}update(a){olympe.D.fb(a)?N(this.node,olympe.D.Ra(a)):N(this.node,a);return this}repeat(a){ub(this.node,olympe.D.fb(a)?a.Da:a);return this}clear(){tb(this.node);return this}rb(){return O(this.node)}getContext(){return this.node}};function Eb(a,b,c=1E3,d,e){const f=olympe.D.fc(olympe.D.aa),g=d||olympe.D.aa.mo.kp;let h,k,l,n;f.update(olympe.D.ra(a));const p=window.performance.now(),q=b.valueOf();l=q-a.valueOf();if(0!==l&&void 0===n){const r=()=>{f.getContext().eb()||(l=q-a.valueOf(),k=(window.performance.now()-p)/c,1<=k&&(k=1,n=void 0),h=a.valueOf()+l*g(k,0,1,1),f.update(olympe.D.ra(h)),1===k&&void 0!==e&&e(h),1>k&&(n=window.requestAnimationFrame(r)))};n=window.requestAnimationFrame(r)}return f.rb()}
|
|
282
|
+
olympe.D.aa=class{constructor(a){this.value=void 0===a||null===a?0:a}toJSON(){return'{ "type": "number", "value": '+JSON.stringify(this.value)+' }'}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return olympe.D.ra(b.value)}dn(){return'number'===typeof this.value&&!isNaN(this.value)}isNaN(){return olympe.D.Qb(!this.dn())}Ic(){return null===this.value||void 0===this.value||void 0===this.value.toString||isNaN(this.value)?olympe.D.xb(''):olympe.D.xb(this.value.toString())}toString(a,b){return void 0!==
|
|
283
|
+
this.value&&null!==this.value?'number'===typeof a?this.value.toString(a):'number'===typeof b?this.value.toFixed(b):this.value.toString():'-'}toFixed(a){return this.dn()?this.valueOf().toFixed(a):''}static max(a){const b=new Map;let c=-Infinity;const d=olympe.D.fc(olympe.D.aa,'ONumber.max result'),e=()=>{c=-Infinity;for(const f of b.values())f>c&&(c=f);d.update(olympe.D.ra(c))};a.forEach((f,g)=>{olympe.D.Gc([f],h=>{b.set(g,h.valueOf());e()})},f=>{if(!d.getContext().eb()){var g=b.get(f);b.delete(f);
|
|
284
|
+
g===c&&e()}});return d.rb()}Vd(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ra(b.valueOf()+c.valueOf()),olympe.D.aa,'ONumber.plus')}Qg(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ra(b.valueOf()-c.valueOf()),olympe.D.aa,'ONumber.minus')}round(){return olympe.D.ra(Math.round(this.valueOf()))}Vi(){return olympe.D.ra(-this.valueOf())}sk(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ra(b.valueOf()*c.valueOf()),olympe.D.aa,'ONumber.mul')}Di(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ra(b.valueOf()/
|
|
285
|
+
c.valueOf()),olympe.D.aa,'ONumber.div')}gx(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ra(b.valueOf()%c.valueOf()),olympe.D.aa,'ONumber.div')}floor(){return olympe.D.ra(Math.floor(this.valueOf()))}ceil(){return olympe.D.ra(Math.ceil(this.valueOf()))}trunc(){return olympe.D.ra(Math.trunc(this.valueOf()))}log(){return olympe.D.ra(Math.log(this.valueOf()))}pow(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ra(Math.pow(b.valueOf(),c.valueOf())),olympe.D.aa,'ONumber.pow')}exp(){return olympe.D.ra(Math.exp(this.valueOf()))}vd(a){return olympe.D.ta([this,
|
|
286
|
+
a],(b,c)=>olympe.D.Qb(b.Qa(c)),olympe.D.ea,'ONumber.oEquals')}Qa(a){return this.valueOf()===(void 0!==a&&null!==a?a.valueOf():void 0)}valueOf(){return void 0!==this.value?this.value.valueOf():void 0}uw(){return this.valueOf()}Om(a){return olympe.D.ta([this,a],(b,c)=>b.valueOf()>c.valueOf()?olympe.D.ea.F:olympe.D.ea.C,olympe.D.ea,'ONumber.isBiggerThan')}Hx(a){return olympe.D.ta([this,a],(b,c)=>b.valueOf()>=c.valueOf()?b:olympe.D.ra(c),olympe.D.aa,'ONumber.returnsBiggest')}Ar(a){return olympe.D.ta([this,
|
|
287
|
+
a],(b,c)=>b.valueOf()<=c.valueOf()?b:olympe.D.ra(c),olympe.D.aa,'ONumber.returnsSmallest')}Xw(a){return olympe.D.ta([this,a],(b,c)=>b.valueOf()<c.valueOf()?olympe.D.ea.F:olympe.D.ea.C,olympe.D.ea,'ONumber.isSmallerThan')}sin(){return olympe.D.ra(Math.sin(this.valueOf()))}cos(){return olympe.D.ra(Math.cos(this.valueOf()))}atan2(a){return olympe.D.fb(a)?olympe.D.ne([a],b=>olympe.D.ra(Math.atan2(this.valueOf(),b.valueOf())),olympe.D.aa):olympe.D.ra(Math.atan2(this.valueOf(),a.valueOf()))}abs(){return olympe.D.ra(Math.abs(this.valueOf()))}Ni(a,
|
|
288
|
+
b){return olympe.D.fb(a)||olympe.D.fb(b)?olympe.D.ne([a,b],(c,d)=>olympe.D.ra(this.valueOf()*d.valueOf()+c.valueOf()*(1-d.valueOf())),olympe.D.aa):olympe.D.ra(this.valueOf()*b.valueOf()+a.valueOf()*(1-b.valueOf()))}static $u(a,b,c,d){'number'===typeof a&&(a=olympe.D.Ud(a));'number'===typeof b&&(b=olympe.D.Ud(b));'number'===typeof c&&(c=olympe.D.Ud(c));let e=0;const f=olympe.D.Ud(0);let g,h;void 0!==b&&void 0!==c&&olympe.D.Ki(b.Om(c),()=>{olympe.ma.ab('df').warn('You have a min bigger than max, cap your inputs')});
|
|
289
|
+
const k=(l,n)=>{n=olympe.D.Ud(n);const p=olympe.D.aa.animate(n,500);Bb(f,p);zb(n,olympe.D.ra(l));e=l};olympe.D.ne([a],l=>{e+=l.valueOf();e>h?k(h,e):e<g?k(g,e):Bb(f,olympe.D.Ud(e))},olympe.D.aa);void 0!==b&&olympe.D.Tm(b.valueOf(),l=>{if(g!==l&&(g=l,g>e)){const n=olympe.D.Ud(e),p=olympe.D.aa.animate(n,400,d);l=olympe.D.ra(g);N(n.Da,l);e=g;Bb(f,p)}});void 0!==c&&olympe.D.Tm(c.valueOf(),l=>{if(h!==l&&(h=l,h<e)){const n=olympe.D.Ud(e),p=olympe.D.aa.animate(n,400,d);l=olympe.D.ra(h);N(n.Da,l);e=h;Bb(f,
|
|
290
|
+
p)}});return f}static offset(a){let b;return olympe.D.ne([a],c=>{void 0===b&&(b=c);return olympe.D.ra(c-b)},olympe.D.aa,'offset')}static dr(a){let b,c,d;return olympe.D.ta([a],e=>{if(void 0===b)return b=e,c=window.performance.now(),olympe.D.ra(0);d=window.performance.now();const f=olympe.D.ra((e.valueOf()-b.valueOf())/(d-c));b=e;c=d;return f},olympe.D.aa,'derivative')}static Rw(a){let b=olympe.D.ra(0),c,d,e;return olympe.D.ta([a],f=>{if(void 0===c)return c=f,d=window.performance.now(),olympe.D.ra(0);
|
|
291
|
+
e=window.performance.now();b=b.Vd((f.valueOf()+c.valueOf())/2*(e-d));c=f;d=e;return b},olympe.D.aa,'integrate')}static Av(a){let b;return olympe.D.ta([a],c=>{void 0===b&&(b=c.valueOf());const d=olympe.D.ra(c.valueOf()-b.valueOf());b=c;return d},olympe.D.aa,'diff')}static qv(a,b,c){return olympe.D.ne([a,b,c],(d,e,f)=>{d='number'===typeof d?d:d.valueOf();e='number'===typeof e?e:e.valueOf();f='number'===typeof f?f:f.valueOf();return olympe.D.ra(d>=e?d<=f?d:f:e)},olympe.D.aa)}static animate(a,b,c,d){let e;
|
|
292
|
+
return e=olympe.D.ta([a],f=>{const g=olympe.D.Ra(b,1E3),h=olympe.D.Ra(e);return void 0===h?olympe.D.ra(f):Eb(h,f,g,c,k=>{d&&d(k)})},olympe.D.aa)}static mv(a,b,c){let d,e,f,g,h,k,l=olympe.D.Ud(),n;olympe.D.Gc([a],p=>{void 0===d?g=d=p.valueOf():d=g;f=window.performance.now();e=p.valueOf();k=e-d;0!==k&&void 0===n&&(n=setInterval(()=>{k=e-d;h=(window.performance.now()-f)/b;1<=h&&(h=1);g=d+k*c(h,0,1,1);zb(l,olympe.D.ra(g));1===h&&(clearTimeout(n),n=void 0)},0))});return l}static Ic(a){return olympe.D.fb(a)?
|
|
293
|
+
olympe.D.ta([a],b=>olympe.D.xb(b.valueOf().toString()),olympe.D.Na):olympe.D.xb(a)}static Vi(a){return olympe.D.fb(a)?olympe.D.ta([a],b=>olympe.D.ra(-b.valueOf()),olympe.D.aa):olympe.D.ra(-a.valueOf())}static Vd(a,b){return olympe.D.fb(a)||olympe.D.fb(b)?olympe.D.ta([a,b],(c,d)=>olympe.D.ra(c.valueOf()+d.valueOf()),olympe.D.aa,'plus'):olympe.D.ra(a.valueOf()+b.valueOf())}static Qg(a,b){return olympe.D.fb(a)||olympe.D.fb(b)?olympe.D.ne([a,b],(c,d)=>olympe.D.ra(c.valueOf()-d.valueOf()),olympe.D.aa,
|
|
294
|
+
'minus'):olympe.D.ra(a.valueOf()-b.valueOf())}static Di(a,b){return olympe.D.fb(a)||olympe.D.fb(b)?olympe.D.ne([a,b],(c,d)=>olympe.D.ra(c.valueOf()/d.valueOf()),olympe.D.aa,'div'):olympe.D.ra(a.valueOf()/b.valueOf())}static Bx(a,b){if(void 0===b)return a;olympe.D.Gc([b],c=>{c=olympe.D.ra(a.Da.Db.valueOf()+c.valueOf());N(a.Da,c)},'plusEqual');return a}};olympe.D.aa.ZERO=new olympe.D.aa(0);olympe.D.aa.ONE=new olympe.D.aa(1);olympe.D.aa.Lu=new olympe.D.aa(2);olympe.D.aa.PI=new olympe.D.aa(Math.PI);
|
|
295
|
+
olympe.D.aa.Rs=new olympe.D.aa(Infinity);olympe.D.aa.Kt=new olympe.D.aa(-Infinity);olympe.D.aa.qp=new olympe.D.aa(NaN);olympe.D.aa.oA=olympe.D.aa.Bx;olympe.D.aa.ay=olympe.D.aa.$u;olympe.D.aa.cA=olympe.D.aa.offset;olympe.D.aa.Ky=olympe.D.aa.dr;olympe.D.aa.vC=olympe.D.aa.dr;olympe.D.aa.Fz=olympe.D.aa.Rw;olympe.D.aa.Ly=olympe.D.aa.Av;olympe.D.aa.sy=olympe.D.aa.qv;olympe.D.aa.by=olympe.D.aa.animate;olympe.D.aa.ey=olympe.D.aa.mv;olympe.D.aa.GB=olympe.D.aa.Ic;olympe.D.aa.HB=olympe.D.aa.Vi;
|
|
296
|
+
olympe.D.aa.nA=olympe.D.aa.Vd;olympe.D.aa.Tz=olympe.D.aa.Qg;olympe.D.aa.My=olympe.D.aa.Di;
|
|
297
|
+
olympe.D.aa.mo={kp:function(a,b,c,d){return c*a/d+b},fz:function(a,b,c,d){a/=d;return c*a*a+b},pz:function(a,b,c,d){a/=d;return-c*a*(a-2)+b},bz:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a+b;a--;return-c/2*(a*(a-2)-1)+b},Vy:function(a,b,c,d){a/=d;return c*a*a*a+b},lz:function(a,b,c,d){a/=d;a--;return c*(a*a*a+1)+b},$y:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a*a+b;a-=2;return c/2*(a*a*a+2)+b},gz:function(a,b,c,d){a/=d;return c*a*a*a*a+b},qz:function(a,b,c,d){a/=d;a--;return-c*(a*a*a*a-1)+b},
|
|
298
|
+
cz:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a*a*a+b;a-=2;return-c/2*(a*a*a*a-2)+b},hz:function(a,b,c,d){a/=d;return c*a*a*a*a*a+b},rz:function(a,b,c,d){a/=d;a--;return c*(a*a*a*a*a+1)+b},dz:function(a,b,c,d){a/=d/2;if(1>a)return c/2*a*a*a*a*a+b;a-=2;return c/2*(a*a*a*a*a+2)+b},iz:function(a,b,c,d){return-c*Math.cos(a/d*(Math.PI/2))+c+b},sz:function(a,b,c,d){return c*Math.sin(a/d*(Math.PI/2))+b},ez:function(a,b,c,d){return-c/2*(Math.cos(Math.PI*a/d)-1)+b},Yy:function(a,b,c,d){return c*Math.pow(2,
|
|
299
|
+
10*(a/d-1))+b},oz:function(a,b,c,d){return c*(-Math.pow(2,-10*a/d)+1)+b},az:function(a,b,c,d){a/=d/2;if(1>a)return c/2*Math.pow(2,10*(a-1))+b;a--;return c/2*(-Math.pow(2,-10*a)+2)+b},Uy:function(a,b,c,d){a/=d;return-c*(Math.sqrt(1-a*a)-1)+b},kz:function(a,b,c,d){a/=d;a--;return c*Math.sqrt(1-a*a)+b},Zy:function(a,b,c,d){a/=d/2;if(1>a)return-c/2*(Math.sqrt(1-a*a)-1)+b;a-=2;return c/2*(Math.sqrt(1-a*a)+1)+b},Py:function(a,b,c,d){d=(a/=d)*a;return b+c*(4*d*a+-3*d)},Qy:function(a,b,c,d){d=(a/=d)*a;return b+
|
|
300
|
+
c*(2*d*d+2*d*a+-3*d)},Ry:function(a,b,c,d){d=(a/=d)*a;return b+c*(4*d*a+-9*d+6*a)},Sy:function(a,b,c,d){d=(a/=d)*a;return b+c*(-2*d*d+10*d*a+-15*d+8*a)},nz:function(a,b,c,d){d=(a/=d)*a;const e=d*a;return b+c*(33*e*d+-106*d*d+126*e+-67*d+15*a)},mz:function(a,b,c,d){d=(a/=d)*a;const e=d*a;return b+c*(56*e*d+-175*d*d+200*e+-100*d+20*a)},Xy:function(a,b,c,d){d=(a/=d)*a;a*=d;return b+c*(33*a*d+-59*d*d+32*a+-5*d)},Wy:function(a,b,c,d){d=(a/=d)*a;a*=d;return b+c*(56*a*d+-105*d*d+60*a+-10*d)},jz:function(a,
|
|
301
|
+
b,c,d){return(a/=d)<1/2.75?7.5625*c*a*a+b:a<2/2.75?c*(7.5625*(a-=1.5/2.75)*a+.75)+b:a<2.5/2.75?c*(7.5625*(a-=2.25/2.75)*a+.9375)+b:c*(7.5625*(a-=2.625/2.75)*a+.984375)+b},Ty:function(a,b,c,d){a=d-a;d=(a/=d)<1/2.75?7.5625*c*a*a:a<2/2.75?c*(7.5625*(a-=1.5/2.75)*a+.75):a<2.5/2.75?c*(7.5625*(a-=2.25/2.75)*a+.9375):c*(7.5625*(a-=2.625/2.75)*a+.984375);return c-d+b}};m=olympe.D.aa.prototype;m.toJSON.K=olympe.D.J.C;m.dn.K=olympe.D.J.C;m.isNaN.K=olympe.D.J.O;m.Ic.K=olympe.D.J.F;
|
|
302
|
+
m.toString.K=new olympe.D.J(()=>String,[]);m.toFixed.K=new olympe.D.J(()=>String,[]);m.Vd.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.Qg.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.round.K=olympe.D.J.G;m.Vi.K=olympe.D.J.G;m.sk.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.Di.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.gx.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.floor.K=olympe.D.J.G;m.ceil.K=olympe.D.J.G;m.trunc.K=olympe.D.J.G;m.log.K=olympe.D.J.G;m.pow.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.exp.K=olympe.D.J.G;
|
|
303
|
+
m.vd.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Qa.K=olympe.D.J.C;m.valueOf.K=olympe.D.J.C;m.uw.K=olympe.D.J.C;m.Om.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Hx.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.Ar.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.Xw.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.sin.K=olympe.D.J.G;m.cos.K=olympe.D.J.G;m.atan2.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.abs.K=olympe.D.J.G;m.Ni.K=new olympe.D.J(()=>olympe.D.aa,[0,1]);olympe.D.Na=class{constructor(a){this.value=a}toJSON(){return'{ "type": "string", "value": '+JSON.stringify(this.value)+' }'}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return olympe.D.xb(b.value)}ar(a){return olympe.D.Na.concat(this,'.',a)}concat(...a){let b;Array.isArray(a[0])?b=a[0]:b=a;return olympe.D.ta([this,...b],(...c)=>{let d='';for(let e=0,f=c.length;e<f;e++)d=c[e]?d+c[e].valueOf():d+c[e];return olympe.D.xb(d)},olympe.D.Na,'OString.concat')}Ic(){return this}Vx(a){return olympe.D.ra(parseInt(this.value,
|
|
304
|
+
a))}Er(){return olympe.D.ra(parseFloat(this.value))}toString(){return this.value}valueOf(){return this.value.valueOf()}Qa(a){return this.value===(void 0===a||null===a?void 0:a.valueOf())}vd(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.Qb(c&&b.valueOf()===c.valueOf()),olympe.D.ea,'OString.oEquals')}Fh(){return olympe.D.Qb(!this.value||0===this.value.length)}contains(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.Qb((c instanceof olympe.D.Na||'string'===typeof c)&&b.valueOf().includes(c.valueOf())),
|
|
305
|
+
olympe.D.ea,'OString.contains')}startsWith(a,b){return olympe.D.ta([this,a,b||0],(c,d,e)=>olympe.D.Qb(c.valueOf().startsWith(d.valueOf(),e.valueOf())),olympe.D.ea,'OString.startsWith')}endsWith(a,b){return olympe.D.ta([this,a,b||-1],(c,d,e)=>{e=0<=e.valueOf()?e.valueOf():this.Fm().valueOf()+e.valueOf()+1;return olympe.D.Qb(c.valueOf().endsWith(d.valueOf(),e))},olympe.D.ea,'OString.endsWith')}indexOf(a,b){return olympe.D.ta([this,a,b||0],(c,d,e)=>olympe.D.ra(c.valueOf().indexOf(d.valueOf(),e.valueOf())),
|
|
306
|
+
olympe.D.aa,'OString.indexOf')}lastIndexOf(a,b){return olympe.D.ta([this,a,b||Infinity],(c,d,e)=>olympe.D.ra(c.valueOf().lastIndexOf(d.valueOf(),e.valueOf())),olympe.D.aa,'OString.lastIndexOf')}slice(a,b){return olympe.D.ta([this,a,b],(c,d,e)=>olympe.D.xb(c.valueOf().slice(d.valueOf(),e?e.valueOf():void 0)),olympe.D.Na,'OString.slice')}Fm(){return olympe.D.ra(this.value.length)}threshold(a){return olympe.D.ta([this,a],(b,c)=>b.valueOf().length>=c.valueOf()?b:olympe.D.Na.EMPTY,olympe.D.Na,'OString.threshold')}toLowerCase(){return olympe.D.xb(this.value.toLowerCase())}toUpperCase(){return olympe.D.xb(this.value.toUpperCase())}trim(){return olympe.D.xb(this.value.trim())}padStart(a,
|
|
307
|
+
b){return olympe.D.ta([this,a,b],(c,d,e)=>olympe.D.xb(c.valueOf().padStart(d.valueOf(),e.valueOf())),olympe.D.Na,'OString.padStart')}padEnd(a,b){return olympe.D.ta([this,a,b],(c,d,e)=>olympe.D.xb(c.valueOf().padEnd(d.valueOf(),e.valueOf())),olympe.D.Na,'OString.padEnd')}replace(a,b){return olympe.D.ta([this,a,b],(c,d,e)=>olympe.D.xb(c.valueOf().replace(d.valueOf(),e.valueOf())),olympe.D.Na,'OString.replace')}Rx(a,b){return olympe.D.ta([this,a,b],(c,d,e)=>olympe.D.xb(c.valueOf().substr(d.valueOf(),
|
|
308
|
+
e.valueOf())),olympe.D.Na,'OString.subOStr')}static concat(...a){return olympe.D.xb('').concat(...a)}};olympe.D.Na.EMPTY=new olympe.D.Na('');olympe.D.Na.xu=new olympe.D.Na(' ');m=olympe.D.Na.prototype;m.toJSON.K=olympe.D.J.C;m.ar.K=new olympe.D.J(()=>olympe.D.Na,[0,1]);m.concat.K=olympe.D.J.F;m.Ic.K=olympe.D.J.F;m.Vx.K=olympe.D.J.G;m.Er.K=olympe.D.J.G;m.toString.K=olympe.D.J.C;m.valueOf.K=olympe.D.J.C;m.Qa.K=olympe.D.J.C;m.vd.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Fh.K=olympe.D.J.O;
|
|
309
|
+
m.contains.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.startsWith.K=new olympe.D.J(()=>olympe.D.ea,[0,1]);m.endsWith.K=new olympe.D.J(()=>olympe.D.ea,[0,1]);m.indexOf.K=new olympe.D.J(()=>olympe.D.aa,[0,1]);m.lastIndexOf.K=new olympe.D.J(()=>olympe.D.aa,[0,1]);m.slice.K=new olympe.D.J(()=>olympe.D.Na,[0,1]);m.Fm.K=olympe.D.J.G;m.threshold.K=new olympe.D.J(()=>olympe.D.Na,[0]);m.toLowerCase.K=olympe.D.J.F;m.toUpperCase.K=olympe.D.J.F;m.trim.K=olympe.D.J.F;m.padStart.K=olympe.D.J.F;m.padEnd.K=olympe.D.J.F;
|
|
310
|
+
m.replace.K=olympe.D.J.F;m.Rx.K=olympe.D.J.F;olympe.D.ea=class{constructor(a){this.value=a}toJSON(){return`{ "type": "boolean", "value": ${this.value.valueOf()}}`}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return b.value?olympe.D.ea.F:olympe.D.ea.C}and(a){if(void 0!==a)return olympe.D.fb(a)?olympe.D.ne([a],b=>new olympe.D.ea(this.valueOf()&&b.valueOf()),olympe.D.ea,'and'):this.value&&a.valueOf()?olympe.D.ea.F:olympe.D.ea.C}Qa(a){return this.valueOf()===(void 0!==a?a.valueOf():void 0)}vd(a){if(void 0!==a)return olympe.D.fb(a)?
|
|
311
|
+
olympe.D.ne([a],b=>new olympe.D.ea(this.valueOf()===b.valueOf()),olympe.D.ea,'oEquals'):this.Qa(a)?olympe.D.ea.F:olympe.D.ea.C}jd(){return this.value?olympe.D.ea.C:olympe.D.ea.F}lv(a){if(void 0!==a)return olympe.D.fb(a)?olympe.D.ne([a],b=>new olympe.D.ea(!(this.valueOf()&&b.valueOf())),olympe.D.ea,'andNot'):this.value&&!a.valueOf()?olympe.D.ea.F:olympe.D.ea.C}or(a){if(void 0!==a)return olympe.D.fb(a)?olympe.D.ne([a],b=>new olympe.D.ea(this.valueOf()||b.valueOf()),olympe.D.ea,'or'):this.value||a.valueOf()?
|
|
312
|
+
olympe.D.ea.F:olympe.D.ea.C}xor(a){return olympe.D.ta([this,a],(b,c)=>{b=b.valueOf();c=c.valueOf();return olympe.D.Qb(b&&!c||!b&&c)},olympe.D.ea,'OBoolean.xor')}Ov(){return this.value}nr(){return!0===this.value?olympe.D.aa.ONE:olympe.D.aa.ZERO}Ic(){return olympe.D.xb(this.toString())}toString(){return this.value?'true':'false'}valueOf(){return this.value}};olympe.D.ea.F=new olympe.D.ea(!0);olympe.D.ea.C=new olympe.D.ea(!1);m=olympe.D.ea.prototype;m.toJSON.K=olympe.D.J.C;
|
|
313
|
+
m.and.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Qa.K=olympe.D.J.C;m.vd.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.jd.K=olympe.D.J.O;m.lv.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.or.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.xor.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Ov.K=new olympe.D.J(()=>Boolean,[]);m.nr.K=olympe.D.J.G;m.Ic.K=olympe.D.J.F;m.toString.K=olympe.D.J.C;m.valueOf.K=olympe.D.J.C;function Fb(a){return new olympe.D.gb(new Date(a))}
|
|
314
|
+
olympe.D.gb=class{constructor(a){this.qb=a}toJSON(){return'{ "type": "dateTime", "value": "'+this.qb.toJSON()+'" }'}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.D.gb(new Date(b.value.valueOf()))}static now(){return new olympe.D.gb(new Date)}Li(){return this.qb&&!isNaN(this.qb.getTime())?olympe.D.ea.F:olympe.D.ea.C}Ys(){return olympe.D.ra(this.qb.getMilliseconds())}$s(){return olympe.D.ra(this.qb.getSeconds())}Zs(){return olympe.D.ra(this.qb.getMinutes())}Xs(){return olympe.D.ra(this.qb.getHours())}$v(){return olympe.D.ra(this.qb.getDate())}getMonth(){return olympe.D.ra(this.qb.getMonth()+1)}at(){return olympe.D.ra(this.qb.getFullYear())}getTime(){return this.qb.getTime()}Ox(){var a=
|
|
315
|
+
olympe.D,b=a.xb;var c=this.qb.getDate();c=10>c?'0'+c:c;var d=this.qb.getMonth()+1;return b.call(a,`${c}.${10>d?'0'+d:d}.${this.qb.getFullYear()}`)}toLocaleString(a){return void 0===a||'string'===typeof a?olympe.D.xb(this.qb.toLocaleString(a)):olympe.D.ta([this,a],(b,c)=>olympe.D.xb(b.qb.toLocaleString(c.valueOf())),olympe.D.Na)}toLocaleDateString(a){return void 0===a||'string'===typeof a?olympe.D.xb(this.qb.toLocaleDateString(a)):olympe.D.ta([this,a],(b,c)=>olympe.D.xb(b.qb.toLocaleDateString(c.valueOf())),
|
|
316
|
+
olympe.D.Na)}toLocaleTimeString(a){return void 0===a||'string'===typeof a?olympe.D.xb(this.qb.toLocaleTimeString(a)):olympe.D.ta([this,a],(b,c)=>olympe.D.xb(b.qb.toLocaleTimeString(c.valueOf())),olympe.D.Na)}Ic(){return olympe.D.xb(this.qb.toISOString())}Sx(){return new Date(this.getTime())}Ux(){return this}Wx(){return this}Qf(a,b){return olympe.D.ta([b],c=>{const d=new olympe.D.gb(new Date(this.qb.getTime()));d.qb['set'+a](this.qb['get'+a]()+c.valueOf());return d},olympe.D.gb)}bv(a){return this.Qf('Milliseconds',
|
|
317
|
+
a)}hv(a){return this.Qf('Seconds',a)}dv(a){return this.Qf('Minutes',a)}av(a){return this.Qf('Hours',a)}km(a){return this.Qf('Date',a)}jv(a){return'number'===typeof a?this.km(7*a):this.km(a.sk(7))}ev(a){return this.Qf('Month',a)}kv(a){return this.Qf('FullYear',a)}Px(){let a=this.qb.getDay();a=0===a?6:a-1;return new olympe.D.gb(new Date(this.qb.getFullYear(),this.qb.getMonth(),this.qb.getDate()-a))}Qx(){return new olympe.D.gb(new Date(this.qb.getFullYear(),this.qb.getMonth()))}vd(a){return olympe.D.ta([a],
|
|
318
|
+
b=>olympe.D.Qb(this.Qa(b)),olympe.D.ea)}Qa(a){return a instanceof olympe.D.gb?this.getTime()===a.getTime()||isNaN(this.getTime())&&isNaN(a.getTime()):!1}mw(){let a=this.qb.getDay();0===a&&(a=7);return olympe.D.ra(a)}dw(a,b){return olympe.D.ta([a,b],(c,d)=>{d=d.valueOf();'years'===d?c=this.qb.getFullYear()-c.qb.getFullYear():'months'===d?c=12*(this.qb.getFullYear()-c.qb.getFullYear())+(this.qb.getMonth()-c.qb.getMonth()):(d={milliseconds:1,seconds:1E3,minutes:6E4,hours:36E5,days:864E5,weeks:6048E5}[d],
|
|
319
|
+
void 0===d&&(olympe.ma.ab('df').warn("[getDiff] '_unit' is not a valid unit! Defaulting to milliseconds"),d=1),c=Math.trunc((this.qb.getTime()-c.qb.getTime())/d));return olympe.D.ra(c)},olympe.D.aa)}Uw(a){return olympe.D.ta([a],b=>olympe.D.Qb(this.getTime()<b.getTime()),olympe.D.ea)}Sw(a){return olympe.D.ta([a],b=>olympe.D.Qb(this.getTime()>b.getTime()),olympe.D.ea)}Vw(a,b){return olympe.D.ta([a,b],(c,d)=>olympe.D.Qb(this.getTime()>c.getTime()&&this.getTime()<d.getTime()),olympe.D.ea)}valueOf(){return this.Li().valueOf()?
|
|
320
|
+
new Date(this.getTime()):new Date(0)}};olympe.D.gb.C=Fb(0);olympe.D.gb.F=Fb(Number.NaN);m=olympe.D.gb.prototype;m.Li.K=olympe.D.J.O;m.Ys.K=olympe.D.J.G;m.$s.K=olympe.D.J.G;m.Zs.K=olympe.D.J.G;m.Xs.K=olympe.D.J.G;m.$v.K=olympe.D.J.G;m.getMonth.K=olympe.D.J.G;m.at.K=olympe.D.J.G;m.getTime.K=olympe.D.J.C;m.Ox.K=new olympe.D.J(()=>olympe.D.Na,[0]);m.toLocaleString.K=olympe.D.J.F;m.toLocaleDateString.K=olympe.D.J.F;m.toLocaleTimeString.K=olympe.D.J.F;m.Ic.K=olympe.D.J.F;m.Sx.K=olympe.D.J.C;
|
|
321
|
+
m.Ux.K=new olympe.D.J(()=>olympe.D.gb,[]);m.Wx.K=new olympe.D.J(()=>olympe.D.gb,[]);m.Qf.K=new olympe.D.J(()=>olympe.D.gb,[]);m.bv.K=new olympe.D.J(()=>olympe.D.gb,[]);m.hv.K=new olympe.D.J(()=>olympe.D.gb,[]);m.dv.K=new olympe.D.J(()=>olympe.D.gb,[]);m.av.K=new olympe.D.J(()=>olympe.D.gb,[]);m.km.K=new olympe.D.J(()=>olympe.D.gb,[0]);m.jv.K=new olympe.D.J(()=>olympe.D.gb,[]);m.ev.K=new olympe.D.J(()=>olympe.D.gb,[]);m.kv.K=new olympe.D.J(()=>olympe.D.gb,[0]);
|
|
322
|
+
m.Px.K=new olympe.D.J(()=>olympe.D.gb,[]);m.Qx.K=new olympe.D.J(()=>olympe.D.gb,[]);m.vd.K=olympe.D.J.O;m.Qa.K=olympe.D.J.C;m.mw.K=olympe.D.J.G;m.dw.K=new olympe.D.J(()=>olympe.D.aa,[0,1]);m.Uw.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Sw.K=new olympe.D.J(()=>olympe.D.ea,[0]);m.Vw.K=new olympe.D.J(()=>olympe.D.ea,[0,1]);m.valueOf.K=olympe.D.J.C;const Gb=new Map,Hb=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})?$/i,Ib=/^#?([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;function Jb(a){const b=c=>{let d;c=c.valueOf();6>c.length?(d=17,c=Ib.exec(c)):(d=1,c=Hb.exec(c));c=c?c.slice(1).map(e=>parseInt(e,16)*d):[0,0,0];return olympe.D.Color.create(c[0],c[1],c[2],isNaN(c[3])?1:c[3]/255)};return olympe.D.We(a)?olympe.D.ne([a],b,olympe.D.Color):b(a)}
|
|
322
323
|
olympe.D.Color=class{constructor(a,b,c,d){this.C=olympe.D.ra(void 0!==a?Math.min(255,Math.max(0,Math.round(a))):0);this.F=olympe.D.ra(void 0!==b?Math.min(255,Math.max(0,Math.round(b))):0);this.b=olympe.D.ra(void 0!==c?Math.min(255,Math.max(0,Math.round(c))):0);this.a=olympe.D.ra(void 0!==d?Math.min(1,Math.max(0,d)):1)}toJSON(){return{r:this.C.valueOf(),g:this.F.valueOf(),b:this.b.valueOf(),a:this.a.valueOf()}}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return olympe.D.Color.create(b.r,
|
|
323
|
-
b.g,b.b,b.a)}static create(a,b,c,d=1){return olympe.D.ta([a,b,c,d],(e,f,g,h)=>{e=olympe.D.ra(void 0!==e?Math.min(255,Math.max(0,Math.round(e.valueOf()))):0);f=olympe.D.ra(void 0!==f?Math.min(255,Math.max(0,Math.round(f.valueOf()))):0);g=olympe.D.ra(void 0!==g?Math.min(255,Math.max(0,Math.round(g.valueOf()))):0);h=olympe.D.ra(void 0!==h?Math.min(1,Math.max(0,h.valueOf())):1);for(let k of
|
|
324
|
-
b){return olympe.D.Color.create(this.C.
|
|
325
|
-
this.F.valueOf()===a.F.valueOf()&&this.b.valueOf()===a.b.valueOf()&&this.a.valueOf()===a.a.valueOf():!1}compare(a){const b=(this.
|
|
326
|
-
olympe.D.Color.prototype.getAlpha=olympe.D.Color.prototype.
|
|
327
|
-
m.
|
|
328
|
-
olympe.D.Sb,'Vector2.plus')}Qg(a){return olympe.D.ta([this,a],(b,c)=>new olympe.D.Sb(b.x.Qg(c.x),b.y.Qg(c.y)),olympe.D.Sb,'Vector2.minus')}
|
|
329
|
-
a+b*b)),olympe.D.aa)}normalize(){return olympe.D.ta([this.x,this.y],(a,b)=>{const c=Math.sqrt(a*a+b*b);return new olympe.D.Sb(a/c,b/c)},olympe.D.Sb)}floor(){return olympe.D.ta([this.x,this.y],(a,b)=>new olympe.D.Sb(Math.floor(a),Math.floor(b)),olympe.D.Sb)}ceil(){return olympe.D.ta([this.x,this.y],(a,b)=>new olympe.D.Sb(Math.ceil(a),Math.ceil(b)),olympe.D.Sb)}round(){return olympe.D.ta([this.x,this.y],(a,b)=>new olympe.D.Sb(Math.round(a),Math.round(b)),olympe.D.Sb)}
|
|
330
|
-
this.y.
|
|
331
|
-
m.Qg.
|
|
332
|
-
m.
|
|
333
|
-
c)&&
|
|
334
|
-
f||this.O.run(()=>{f=olympe.D.Gd(d,void 0,e);a[b]=f;f.Da.onDestroy(()=>delete a[b]);olympe.D.
|
|
335
|
-
b){this.
|
|
336
|
-
a(b[c],c,this))break}
|
|
337
|
-
e[a]&&
|
|
338
|
-
c)){b=this.Z[c];for(const d in b)Object.prototype.hasOwnProperty.call(b,d)&&b[d].destroy()}this.size=0;null!==this.
|
|
339
|
-
m.
|
|
340
|
-
[a.Da],[0],'onResolved('+(b.name||'')+')')):b(a)}
|
|
341
|
-
b||this.O.run(()=>{b=this.get(this.
|
|
342
|
-
this.fa.Da.onDestroy(()=>{this.
|
|
343
|
-
c[a]&&
|
|
344
|
-
a)for(b in a)
|
|
345
|
-
m.
|
|
346
|
-
a){const b=this.values[a];b&&b instanceof olympe.D.Proxy?
|
|
347
|
-
m.
|
|
348
|
-
olympe.D.Gd=function(a,b,c){a=olympe.D.createNode(a,void 0,void 0,void 0,void 0,c);olympe.D.
|
|
349
|
-
olympe.D.
|
|
350
|
-
olympe.D.Sg=function(a,b){let c;olympe.D.
|
|
351
|
-
olympe.D.
|
|
352
|
-
olympe.D.
|
|
353
|
-
olympe.D.
|
|
354
|
-
olympe.D.fc=function(a,b='flowSource'){return new olympe.D.
|
|
355
|
-
olympe.D.
|
|
356
|
-
olympe.D.
|
|
357
|
-
''))});c.onDestroy(()=>{delete
|
|
358
|
-
olympe.D.ra=function(a){if(void 0===a)return olympe.D.aa.ZERO;if(a instanceof olympe.D.aa)return a;a&&a.valueOf&&(a=a.valueOf());if('number'===typeof a){if(isNaN(a))return olympe.D.aa.
|
|
359
|
-
olympe.D.
|
|
360
|
-
olympe.D.
|
|
361
|
-
olympe.D.
|
|
362
|
-
olympe.D.
|
|
363
|
-
olympe.D.Ub=a=>{a='string'===typeof a?JSON.parse(a):a;if(a.type){let b=null;switch(a.type){case 'dateTime':b=olympe.D.
|
|
364
|
-
olympe.D.
|
|
365
|
-
class
|
|
366
|
-
this.next=null}destroy(){this.F.destroy();this.G=this.C=this.next=null}}m=
|
|
367
|
-
function
|
|
368
|
-
{
|
|
369
|
-
olympe.host.
|
|
370
|
-
olympe.host.
|
|
371
|
-
|
|
372
|
-
olympe.W.
|
|
373
|
-
olympe.
|
|
374
|
-
olympe.net.
|
|
375
|
-
olympe.net.
|
|
376
|
-
olympe.net
|
|
377
|
-
|
|
378
|
-
function
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
()=>{this.H.info('Mqtt client
|
|
382
|
-
()
|
|
383
|
-
olympe.net.
|
|
384
|
-
olympe.net.
|
|
385
|
-
olympe.
|
|
386
|
-
b
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
this.buffer.length=0});c.addEventListener('message',d=>{d='string'===typeof d.data?String(d.data):Ha(d.data);(this.H.K()||this.H.C()&&!d.startsWith('pong'))&&this.H.debug(b,'<',d);this.G&&this.G(d)});c.addEventListener('close',()=>{this.H.debug(`WebSocket ${b} CLOSED`);this.K&&this.K()});c.addEventListener('error',()=>{this.H.debug(`WebSocket ${b} ERROR`);this.O&&this.O()});this.C=c}send(a){const b=`#${this.id}`;if(null!==this.C){const c=this.C.constructor;switch(this.C.readyState){case c.OPEN:(this.H.K()||
|
|
324
|
+
b.g,b.b,b.a)}static create(a,b,c,d=1){return olympe.D.ta([a,b,c,d],(e,f,g,h)=>{e=olympe.D.ra(void 0!==e?Math.min(255,Math.max(0,Math.round(e.valueOf()))):0);f=olympe.D.ra(void 0!==f?Math.min(255,Math.max(0,Math.round(f.valueOf()))):0);g=olympe.D.ra(void 0!==g?Math.min(255,Math.max(0,Math.round(g.valueOf()))):0);h=olympe.D.ra(void 0!==h?Math.min(1,Math.max(0,h.valueOf())):1);for(let k of Gb.values())if(k&&k.C.Qa(e)&&k.F.Qa(f)&&k.b.Qa(g)&&k.a.Qa(h))return k;return new olympe.D.Color(e,f,g,h)},olympe.D.Color)}Kg(){return this.C}Dg(){return this.b}Hg(){return this.F}Cg(){return this.a}pv(a,
|
|
325
|
+
b){return olympe.D.Color.create(this.C.Ni(a.Kg(),b),this.F.Ni(a.Hg(),b),this.b.Ni(a.Dg(),b),this.a.Ni(a.Cg(),b))}Hv(a){return olympe.D.Color.create(this.C,this.F,this.b,a)}Fr(){return`rgba(${this.C},${this.F},${this.b},${this.a})`}bn(){const a=(16777216|this.b|this.F<<8|this.C<<16).toString(16).slice(1),b=1===this.a.valueOf()?'':(256|255*this.a).toString(16).slice(1);return'#'+(a+b).toUpperCase()}toString(){return this.bn()}Qa(a){return a instanceof olympe.D.Color?this.C.valueOf()===a.C.valueOf()&&
|
|
326
|
+
this.F.valueOf()===a.F.valueOf()&&this.b.valueOf()===a.b.valueOf()&&this.a.valueOf()===a.a.valueOf():!1}compare(a){const b=(this.Kg().valueOf()<<16|this.Hg().valueOf()<<8|this.Dg().valueOf())-(a.Kg().valueOf()<<16|a.Hg().valueOf()<<8|a.Dg().valueOf());return 0===b?this.Cg().valueOf()-a.Cg().valueOf():b}};olympe.D.Color.prototype.equals=olympe.D.Color.prototype.Qa;olympe.D.Color.prototype.toHexString=olympe.D.Color.prototype.bn;olympe.D.Color.prototype.toRGBString=olympe.D.Color.prototype.Fr;
|
|
327
|
+
olympe.D.Color.prototype.getAlpha=olympe.D.Color.prototype.Cg;olympe.D.Color.prototype.getGreen=olympe.D.Color.prototype.Hg;olympe.D.Color.prototype.getBlue=olympe.D.Color.prototype.Dg;olympe.D.Color.prototype.getRed=olympe.D.Color.prototype.Kg;olympe.D.Color.create=olympe.D.Color.create;m=olympe.D.Color.prototype;m.toJSON.K=olympe.D.J.C;m.Kg.K=olympe.D.J.G;m.Dg.K=olympe.D.J.G;m.Hg.K=olympe.D.J.G;m.Cg.K=olympe.D.J.G;m.pv.K=new olympe.D.J(()=>olympe.D.Color,[]);
|
|
328
|
+
m.Hv.K=new olympe.D.J(()=>olympe.D.Color,[]);m.Fr.K=new olympe.D.J(()=>String,[]);m.bn.K=new olympe.D.J(()=>String,[]);m.Qa.K=olympe.D.J.C;m.compare.K=olympe.D.J.C;olympe.D.File=class{la(){}bp(){}rl(){}Hm(){}fk(){}Bm(){}gk(){}rename(){}};olympe.D.Sb=class{constructor(a,b){this.x=olympe.D.Ud(a);this.y=olympe.D.Ud(b)}toJSON(){return'{ "type": "vector2", "x": '+JSON.stringify(olympe.D.Ra(this.x).valueOf())+', "y": '+JSON.stringify(olympe.D.Ra(this.y).valueOf())+' }'}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.D.Sb(b.x,b.y)}cp(){return this.x}Mx(a){Cb(this.x,a)}ep(){return this.y}Nx(a){Cb(this.y,a)}Fw(){return this.x.Ar(this.y)}Vd(a){return olympe.D.ta([this,a],(b,c)=>new olympe.D.Sb(b.x.Vd(c.x),b.y.Vd(c.y)),
|
|
329
|
+
olympe.D.Sb,'Vector2.plus')}Qg(a){return olympe.D.ta([this,a],(b,c)=>new olympe.D.Sb(b.x.Qg(c.x),b.y.Qg(c.y)),olympe.D.Sb,'Vector2.minus')}ix(a){return new olympe.D.Sb(this.x.sk(a),this.y.sk(a))}Cv(a){return new olympe.D.Sb(this.x.Di(a),this.y.Di(a))}kx(){return new olympe.D.Sb(this.x.Vi(),this.y.Vi())}Dv(a){return olympe.D.ta([this,a],(b,c)=>olympe.D.ta([b.x,b.y,c.x,c.y],(d,e,f,g)=>olympe.D.ra(d*f+e*g),olympe.D.aa),olympe.D.aa)}length(){return olympe.D.ta([this.x,this.y],(a,b)=>olympe.D.ra(Math.sqrt(a*
|
|
330
|
+
a+b*b)),olympe.D.aa)}normalize(){return olympe.D.ta([this.x,this.y],(a,b)=>{const c=Math.sqrt(a*a+b*b);return new olympe.D.Sb(a/c,b/c)},olympe.D.Sb)}floor(){return olympe.D.ta([this.x,this.y],(a,b)=>new olympe.D.Sb(Math.floor(a),Math.floor(b)),olympe.D.Sb)}ceil(){return olympe.D.ta([this.x,this.y],(a,b)=>new olympe.D.Sb(Math.ceil(a),Math.ceil(b)),olympe.D.Sb)}round(){return olympe.D.ta([this.x,this.y],(a,b)=>new olympe.D.Sb(Math.round(a),Math.round(b)),olympe.D.Sb)}fv(a){return new olympe.D.Sb(this.x.Vd(a),
|
|
331
|
+
this.y.Vd(a))}gv(a,b){return new olympe.D.Sb(this.x.Vd(a),this.y.Vd(b))}Ic(){return olympe.D.ta([this.x,this.y],(a,b)=>olympe.D.xb(`Vector2[${a.valueOf()}, ${b.valueOf()}]`),olympe.D.Na)}toString(){return`Vector2[${this.x.Da.Db}, ${this.y.Da.Db}]`}Qa(a){return this===a?!0:!1}};m=olympe.D.Sb.prototype;m.toJSON.K=olympe.D.J.C;m.cp.K=olympe.D.J.G;m.Mx.K=olympe.D.J.C;m.ep.K=olympe.D.J.G;m.Nx.K=olympe.D.J.C;m.Fw.K=olympe.D.J.G;m.Vd.K=new olympe.D.J(()=>olympe.D.Sb,[0]);
|
|
332
|
+
m.Qg.K=new olympe.D.J(()=>olympe.D.Sb,[0]);m.ix.K=olympe.D.J.T;m.Cv.K=olympe.D.J.T;m.kx.K=olympe.D.J.T;m.Dv.K=new olympe.D.J(()=>olympe.D.aa,[0]);m.length.K=olympe.D.J.G;m.normalize.K=olympe.D.J.T;m.floor.K=olympe.D.J.T;m.ceil.K=olympe.D.J.T;m.round.K=olympe.D.J.T;m.fv.K=olympe.D.J.T;m.gv.K=olympe.D.J.T;m.Ic.K=olympe.D.J.F;m.toString.K=olympe.D.J.C;m.Qa.K=olympe.D.J.C;olympe.D.eg=class{constructor(){}Nb(){}Cd(){}get(){}Bh(){}has(){}Ng(){}xc(){}wf(){}ef(){}Tf(){}forEach(){}de(){}};olympe.D.eg.prototype.forEachCurrentValue=olympe.D.eg.prototype.de;olympe.D.eg.prototype.forEach=olympe.D.eg.prototype.forEach;m=olympe.D.eg.prototype;m.has.K=olympe.D.J.O;m.Ng.K=olympe.D.J.C;m.xc.K=new olympe.D.J(()=>Object,[]);m.wf.K=new olympe.D.J(()=>String,[]);m.ef.K=olympe.D.J.G;m.Tf.K=olympe.D.J.C;m.forEach.K=new olympe.D.J(()=>{},[]);m.de.K=olympe.D.J.C;olympe.D.ed=class extends olympe.D.eg{Rd(){}vf(){}Ue(){}uf(){}ee(){}Te(){}Ei(){}Dh(){}};olympe.D.ed.prototype.getCurrentAt=olympe.D.ed.prototype.Te;olympe.D.ed.prototype.getAt=olympe.D.ed.prototype.ee;olympe.D.ed.prototype.getCurrentKeyAt=olympe.D.ed.prototype.uf;olympe.D.ed.prototype.getKeyAt=olympe.D.ed.prototype.Ue;olympe.D.ed.prototype.getCurrentRank=olympe.D.ed.prototype.vf;olympe.D.ed.prototype.getRank=olympe.D.ed.prototype.Rd;m=olympe.D.ed.prototype;m.Rd.K=olympe.D.J.G;m.vf.K=olympe.D.J.C;
|
|
333
|
+
m.Ue.K=new olympe.D.J(()=>String,[]);m.uf.K=olympe.D.J.C;m.ee.K=new olympe.D.J(()=>Object,[]);m.Te.K=olympe.D.J.C;m.Ei.K=olympe.D.J.C;m.Dh.K=new olympe.D.J(()=>Array,[]);olympe.D.Mh=class{constructor(a,b){this.O=b||olympe.D.Xa();this.valueType=a||Object;this.values={};this.ob=this.za=null;this.Pe=0;this.Z=Object.create(null);this.tb=Object.create(null);this.size=0;this.L=null;this.O.onDestroy(()=>{const c=this.Z;if(c){const d=Object.keys(c),e=d.length;for(let f=0;f<e;f++){const g=c[d[f]],h=Object.keys(g);for(let k=h.length,l=0;l<k;l++)g[h[l]].destroy()}}})}getContext(){return this.O}Nb(){return this.valueType}Cd(a){this.valueType=a;const b=this.za;if(null!==b)for(const c in b)Object.prototype.hasOwnProperty.call(b,
|
|
334
|
+
c)&&yb(b[c],a)}get(a){const b=c=>{null===this.za&&(this.za={});return this.Hi(this.za,c,this.values[c],this.valueType,'Map.get('+c+')')};return olympe.D.ta([a],c=>b(c),this.valueType)}Bh(a){a=this.values[a];return olympe.D.fb(a)?jb(a.Da)?a.Da.Db:void 0:a}has(a){const b=c=>{null===this.ob&&(this.ob={});return this.Hi(this.ob,c,c in this.values?olympe.D.ea.F:olympe.D.ea.C,olympe.D.ea,'Map.has('+c+')')};return olympe.D.ta([a],c=>b(c),olympe.D.ea)}Ng(a){return a in this.values}Hi(a,b,c,d,e){let f=a[b];
|
|
335
|
+
f||this.O.run(()=>{f=olympe.D.Gd(d,void 0,e);a[b]=f;f.Da.onDestroy(()=>delete a[b]);olympe.D.fb(c)?Bb(f,c):zb(f,c)});return f}xc(){throw Error('Abstract method getFirstKey needs to be overridden');}wf(){throw Error('Abstract method getFirstKey needs to be overridden');}ef(){null===this.L&&this.O.run(()=>{this.L=olympe.D.Gd(olympe.D.aa,olympe.D.ra(this.size));this.L.Da.onDestroy(()=>{this.L=null})});return this.L}Tf(){return this.size}forEach(a,b){const c=this.gm();a=this.Uq(c,a,b);this.fm(c,a)}gm(){return String(++this.Pe)}fm(a,
|
|
336
|
+
b){this.tb[a]=b;olympe.D.Xa().Z(()=>{const c=this.Z;for(const d in c)Object.prototype.hasOwnProperty.call(c,d)&&delete c[d][a];delete this.tb[a]});this.de(b)}Uq(a,b,c){const d=olympe.D.Xa();return(e,f)=>{d.run(()=>{const g=olympe.D.createNode(void 0,b,null,[e,f,this],null,`forEach-${a}-${f}`);if(void 0!==c)g.onDestroy(()=>{c(f)});this.jm(a,f,g)})}}jm(a,b,c){void 0===this.Z[b]&&(this.Z[b]={});this.Z[b][a]=c}de(a){const b=this.values;for(const c in b)if(Object.prototype.hasOwnProperty.call(b,c)&&!1===
|
|
337
|
+
a(b[c],c,this))break}Yj(a,b){void 0!==this.values[a]&&this.Ai(a,!0);this.values[a]=b;var c=this.za;null!==c&&void 0!==c[a]&&(b&&b instanceof olympe.D.Proxy?Bb(c[a],b):zb(c[a],b));c=this.ob;null!==c&&void 0!==c[a]&&Cb(c[a],!0);this.size++;c=this.tb;for(const d in c)if(Object.prototype.hasOwnProperty.call(c,d))c[d](b,a,this)}Ai(a,b){const c=this.values;if(Object.prototype.hasOwnProperty.call(c,a)){var d=(d=c[a])&&d.Ag?d.Da.Db:d;var e=this.za;null!==e&&void 0!==e[a]&&Ab(e[a]);e=this.ob;null!==e&&void 0!==
|
|
338
|
+
e[a]&&Cb(e[a],!1);delete c[a];this.size--;b||this.qf()}a=this.Z[a];if(void 0!==a)for(const f in a)Object.prototype.hasOwnProperty.call(a,f)&&a[f].destroy();return d}qf(){null!==this.L&&Cb(this.L,this.size)}th(){var a=this.za;if(null!==a)for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&Ab(a[c]);a=this.ob;if(null!==a)for(var b in a)Object.prototype.hasOwnProperty.call(a,b)&&Cb(a[b],!1);for(const c in this.values)Object.prototype.hasOwnProperty.call(this.values,c)&&delete this.values[c];for(const c in this.Z)if(Object.prototype.hasOwnProperty.call(this.Z,
|
|
339
|
+
c)){b=this.Z[c];for(const d in b)Object.prototype.hasOwnProperty.call(b,d)&&b[d].destroy()}this.size=0;null!==this.L&&Cb(this.L,this.size)}hg(){const a=this.values;let b='\n';for(const c in a)Object.prototype.hasOwnProperty.call(a,c)&&(b+=a[c]+'\n');return b}};olympe.D.Mh.xa=[olympe.D.eg];m=olympe.D.Mh.prototype;m.getContext.K=olympe.D.J.C;m.Nb.K=olympe.D.J.C;m.Cd.K=olympe.D.J.C;m.get.K=new olympe.D.J(()=>Object,[],'valueType');m.Bh.K=olympe.D.J.C;m.has.K=olympe.D.J.O;m.Ng.K=olympe.D.J.C;m.Hi.K=olympe.D.J.C;
|
|
340
|
+
m.ef.K=olympe.D.J.G;m.Tf.K=olympe.D.J.C;m.forEach.K=new olympe.D.J(()=>{},[]);m.gm.K=olympe.D.J.C;m.fm.K=olympe.D.J.C;m.Uq.K=olympe.D.J.C;m.jm.K=olympe.D.J.C;m.de.K=olympe.D.J.C;m.Yj.K=olympe.D.J.C;m.Ai.K=olympe.D.J.C;m.qf.K=olympe.D.J.C;m.th.K=olympe.D.J.C;m.hg.K=olympe.D.J.C;olympe.D.Yi=class extends olympe.D.Mh{constructor(a,b){super(a,b);this.F=Object.create(null);this.C=[];this.oa=this.Ja=this.jb=this.fa=null}Cd(a){super.Cd(a);if(null!==this.oa)for(let b of this.oa.values())yb(b,a)}xc(){return this.ee(0)}wf(){return this.Ue(0)}Rd(a){const b=c=>{null===this.jb&&(this.jb=Object.create(null));let d=this.vf(a);d=void 0!==d?olympe.D.ra(d):void 0;return this.Hi(this.jb,c,d,olympe.D.aa,`List.getRank(${c})`)};return olympe.D.fb(a)?O(olympe.D.createNode(olympe.D.aa,b,null,
|
|
341
|
+
[a.Da],[0],'onResolved('+(b.name||'')+')')):b(a)}vf(a){return this.F[a]}Ue(a){const b=c=>{const d=c.valueOf(),e=this.uf(d);null===this.Ja&&(this.Ja=Object.create(null));return this.Hi(this.Ja,String(d),e,String,'List.getKeyAt('+c+')')};return olympe.D.ta([a],c=>b(c),String)}uf(a){return this.C[a.valueOf()]}ee(a){if(olympe.D.fb(a))return this.get(olympe.D.ta([a],c=>{c=this.Ue(c);if(!jb(c.Da)){const d=olympe.D.Xa();olympe.D.yf(d)&&tb(d)}return c},String));null===this.oa&&(this.oa=new Map);let b=this.oa.get(a);
|
|
342
|
+
b||this.O.run(()=>{b=this.get(this.Ue(a));this.oa.set(a,b);b.Da.onDestroy(()=>this.oa.delete(a))});return b}Te(a){return this.Bh(this.uf(a))}Ei(a,b,c,d){let e=this.gm();a=this.xr(e,a,b,c,d);this.fm(e,a)}xr(a,b,c,d,e){return olympe.D.Xa().G((f,g)=>{let h=!1,k=olympe.D.Kh([b,c,this.Rd(g)],(l,n,p)=>{p>=l&&p<l+n?h||(d(f,g,this),h=!0):h&&(e(g),h=!1)});if(void 0!==e)k.onDestroy(e.bind(null,g));this.jm(a,g,k)})}Dh(){null===this.fa&&this.O.run(()=>{this.fa=olympe.D.Gd(Array,this.C.filter(a=>void 0!==a));
|
|
343
|
+
this.fa.Da.onDestroy(()=>{this.L=null})});return this.fa}de(a){if(this.C.length!==this.size)super.de(a);else{var b=this.values;for(let c of this.C.filter(d=>void 0!==d))if(Object.prototype.hasOwnProperty.call(b,c)&&!1===a(b[c],c,this))break}}im(a,b){const c=this.jb,d=this.Ja,e=this.F[a],f=b.valueOf();if(e!==f||this.C[e]!==a){var g=this.C[f];void 0!==g&&delete this.F[g];void 0!==e&&null!==e&&this.C[e]===a&&(this.C[e]=void 0);this.F[a]=f;this.C[f]=a;null!==c&&(void 0!==g&&void 0!==c[g]&&Ab(c[g]),void 0!==
|
|
344
|
+
c[a]&&zb(c[a],olympe.D.ra(f)));null!==d&&(void 0!==e&&null!==e&&void 0!==d[e]&&Ab(d[e]),void 0!==d[b]&&zb(d[b],a))}}hm(a){var b=this.Ja,c=this.F[a];null!==c&&void 0!==c&&null!==b&&(b=b[c],void 0!==b&&b.Da.Db===a&&Ab(b));delete this.F[a];this.C.splice(c,1);c=this.jb;null!==c&&void 0!==c[a]&&Ab(c[a])}Vq(){if(null!==this.fa){const a=this.C,b=this.fa.Da.Db;b&&a.join(',')!==b.join(',')&&zb(this.fa,a)}}qf(){this.Vq();super.qf()}th(){var a=this.F;for(b in a)delete a[b];this.C.length=0;a=this.jb;if(null!==
|
|
345
|
+
a)for(b in a)Ab(a[b]);a=this.Ja;if(null!==a)for(b in a)Ab(a[parseInt(b,10)]);var b=this.fa;null!==b&&(rb(b.Da),zb(b,this.C));return olympe.D.Mh.prototype.th.call(this)}hg(){const a=this.values,b=this.F;let c='[\n';for(let d in a)Object.prototype.hasOwnProperty.call(a,d)&&(c+=`${b[d]}. ${a[d]}\n`);return c+']'}};olympe.D.Yi.xa=[olympe.D.ed];m=olympe.D.Yi.prototype;m.Cd.K=olympe.D.J.C;m.xc.K=new olympe.D.J(()=>Object,[]);m.wf.K=new olympe.D.J(()=>String,[]);m.Rd.K=olympe.D.J.G;m.vf.K=olympe.D.J.C;
|
|
346
|
+
m.Ue.K=new olympe.D.J(()=>String,[]);m.uf.K=olympe.D.J.C;m.ee.K=new olympe.D.J(()=>Object,[]);m.Te.K=olympe.D.J.C;m.Ei.K=new olympe.D.J(()=>{},[]);m.xr.K=olympe.D.J.C;m.Dh.K=new olympe.D.J(()=>Array,[]);m.de.K=olympe.D.J.C;m.im.K=olympe.D.J.C;m.hm.K=olympe.D.J.C;m.Vq.K=olympe.D.J.C;m.qf.K=olympe.D.J.C;m.th.K=olympe.D.J.C;m.hg.K=olympe.D.J.C;olympe.D.Map=class extends olympe.D.Mh{constructor(a){a===olympe.D.Proxy&&(a=Object);super(a);this.C=this.F=null}Cd(a){a===olympe.D.Proxy&&(a=Object);null!==this.F&&yb(this.F,a);super.Cd(a)}xc(){null===this.F&&this.vm();return this.F}wf(){null===this.C&&this.vm();return this.C}vm(){this.getContext().run(()=>{this.F=olympe.D.Gd(this.Nb());this.C=olympe.D.Gd(String);this.Si(this.ym())})}ym(){const a=this.values;let b,c;for(b in a)if(Object.prototype.hasOwnProperty.call(a,b)){c=b;break}return c}Si(a){if(void 0!==
|
|
347
|
+
a){const b=this.values[a];b&&b instanceof olympe.D.Proxy?Bb(this.F,b):zb(this.F,b);zb(this.C,a)}else void 0!==this.F.Da.Db&&(Ab(this.F),Ab(this.C))}set(a,b){this.Yj(a,b);1===this.size&&null!==this.C&&this.Si(a);this.qf()}remove(a){const b=this.Ai(a);null!==this.C&&this.C.Da.Db===a&&this.Si(this.ym());return b}clear(){this.th();null!==this.C&&this.Si()}};m=olympe.D.Map.prototype;m.Cd.K=olympe.D.J.C;m.xc.K=new olympe.D.J(()=>Object,[]);m.wf.K=new olympe.D.J(()=>String,[]);m.vm.K=olympe.D.J.C;
|
|
348
|
+
m.ym.K=olympe.D.J.C;m.Si.K=olympe.D.J.C;m.set.K=olympe.D.J.C;m.remove.K=new olympe.D.J(()=>Object,[]);m.clear.K=olympe.D.J.C;olympe.D.kg=class extends olympe.D.Yi{constructor(a){super(a)}set(a,b,c){this.Yj(a,b);void 0!==c&&olympe.D.Gc([c],d=>{this.im(a,d)});this.qf()}remove(a){this.hm(a);return this.Ai(a)}clear(){this.th()}};olympe.D.kg.prototype.remove.K=olympe.D.J.C;olympe.D.kg.prototype.clear.K=olympe.D.J.C;olympe.D.Pr=class extends olympe.D.mj{constructor(a,b){super(olympe.D.aa,'animatedFlowSource');this.duration=a;this.C=b||olympe.D.aa.mo.kp}rb(){return olympe.D.lx(this.node,this.duration,this.C,void 0)}};let Kb=null;olympe.D.H=void 0;olympe.D.Xm=void 0;olympe.D.yh=void 0;olympe.D.sh=new Map;olympe.D.sh.set(0,olympe.D.aa.ZERO);olympe.D.sh.set(1,olympe.D.aa.ONE);olympe.D.sh.set(2,olympe.D.aa.Lu);olympe.D.Xj=new Map;olympe.D.Xj.set('',olympe.D.Na.EMPTY);olympe.D.Xj.set(' ',olympe.D.Na.xu);olympe.D.createNode=function(a,b,c,d,e,f,g,h){return new olympe.D.Node({valueType:a,xd:b,Af:c,Lm:d,debug:g,Rf:e,gd:f,Bi:h})};olympe.D.yf=function(a){return a instanceof olympe.D.Node};
|
|
349
|
+
olympe.D.Gd=function(a,b,c){a=olympe.D.createNode(a,void 0,void 0,void 0,void 0,c);olympe.D.yf(b)?ub(a,b):olympe.D.fb(b)?ub(a,b.Da):N(a,b);return O(a)};olympe.D.fb=function(a){return!(!a||!a.Ag)};olympe.D.We=function(a){return!(!a||!(a instanceof olympe.D.Node||a.Ag))};olympe.D.Pm=function(a){return a instanceof olympe.D.Yb||a instanceof olympe.D.kq||a instanceof olympe.D.Node};olympe.D.Og=function(a){return a instanceof olympe.D.mj};
|
|
350
|
+
olympe.D.Tm=function(a,b){if(void 0!==a){olympe.D.Og(a)&&(a=a.rb().Da);if(!olympe.D.We(a))return b(a);var c=[];olympe.D.fb(a)?c.push(a.Da):c.push(a);return olympe.D.createNode(void 0,b,null,c,[0],'onResolved')}};olympe.D.Ra=function(a,b){let c=a;olympe.D.fb(a)?c=a.Da.Db:olympe.D.yf(a)?c=a.Db:olympe.D.Og(a)&&(c=a.rb().Da.Db);return void 0===c?b:c};
|
|
351
|
+
olympe.D.Sg=function(a,b){let c;olympe.D.fb(a)?c=a.Da:olympe.D.yf(a)?c=a:olympe.D.Og(a)&&(c=a.rb().Da);c&&olympe.D.Gc([b],d=>{c.Sg(d)},'setDefaultValue');return a};olympe.D.Kh=function(a,b,c,d){const e=a.length,f=Array(e),g=[];let h;for(let k=0;k<e;k++)h=a[k],void 0!==h&&null!==h&&(void 0!==h.Sq?(h=h.Da,g.push(k)):h instanceof olympe.D.Node?g.push(k):olympe.D.Og(h)&&(h=h.rb().Da,g.push(k))),f[k]=h;return olympe.D.createNode(c,b,null,f,g,d||'syncNodes')};
|
|
352
|
+
olympe.D.ne=function(a,b,c,d){return O(olympe.D.Kh(a,b,c,d||'syncProxies'))};const Lb=a=>{for(const b of a)if(olympe.D.We(b)||olympe.D.Og(b))return!1;return!0};olympe.D.ta=function(a,b,c,d,e){if(Lb(a))return b(...a);const f=olympe.D.Kh(a,b,c,d||'TransformFlows');e&&olympe.D.Gc([e],g=>{f.Sg(g)},'setDefaultValue');return O(f)};olympe.D.Gc=function(a,b,c){Lb(a)?b(...a):olympe.D.Kh(a,b,void 0,c||'processFlows')};
|
|
353
|
+
olympe.D.tC=function(a,b,c){const d=olympe.D.yf(a)?a.Nb():olympe.D.Og(a)?a.rb().rh:a.rh,e=olympe.D.fc(d,c),f=olympe.Y.Promise.bk(g=>{e.getContext().eb()||e.update(g)},b);olympe.D.Gc([a],g=>f(g).then());return e.rb()};olympe.D.Um=function(a,b){if(Lb(a))b(...a);else{const c=olympe.D.Xa();olympe.D.Kh(a,(...d)=>{olympe.D.Xa().destroy();c.run(b,...d)},void 0,'processFlowsOnce')}};
|
|
354
|
+
olympe.D.Vm=function(a,b,c){const d=a.length,e=Array(d),f=[];let g;for(let h=0;h<d;h++)g=a[h],void 0!==g&&null!==g&&(olympe.D.fb(g)?(g=g.Da,f.push(h)):g instanceof olympe.D.Node?f.push(h):olympe.D.Og(g)&&(g=g.rb().Da,f.push(h))),e[h]=g;0!==f.length&&new olympe.D.Node({xd:b,Lm:e,Rf:f,Dx:!1,gd:c})};olympe.D.zr=function(a,b){const c=olympe.D.Xa();olympe.D.Vm(a,(...d)=>{olympe.D.Xa().destroy();c.run(b,...d)},'processFutureFlowsOnce')};olympe.D.rC=function(a,b,c){a=new olympe.D.mj(a,c);b(a);return a.rb()};
|
|
355
|
+
olympe.D.fc=function(a,b='flowSource'){return new olympe.D.mj(a,b)};olympe.D.bD=function(a,b,c,d){const e=olympe.D.Xa();olympe.D.Kh(a,(...f)=>{olympe.D.Xa().destroy();e.run(b,...f)},c,d||'syncProxiesOnce')};olympe.D.Ki=function(a,b,c){olympe.D.ta([a],d=>d.valueOf()?b.apply(null,void 0):c&&c.apply(null,void 0),Object,'If')};olympe.D.EC=function(a,b,c='from observable'){const d=olympe.D.fc(b,c),e=a.subscribe(f=>d.update(f));d.getContext().onDestroy(()=>e.unsubscribe());return d.rb()};
|
|
356
|
+
olympe.D.BC=function(a,b,...c){return a?a.run(b,...c):b(...c)};olympe.D.eD=function(a){return olympe.D.Xa().G(a)};olympe.D.yC=function(a,b,c){olympe.D.Ev(a?a.Da:a,b,c)};
|
|
357
|
+
olympe.D.Ev=function(a,b,c){if(a){var d=a.V();null===Kb&&(Kb={});if(Kb[d])olympe.D.H.log(`Already started node #${d} dump`+(b?`: ${b}`:''));else{Kb[d]=!0;var e=`Starting node #${d} dump`+(b?`: ${b}`:'');c?olympe.D.H.warn(e):olympe.D.H.log(e);var f=`#${d}`+(b?`: ${b}`:'')+':';c=olympe.D.createNode(null,g=>{void 0===g?olympe.D.H.log(f,'undefined'):null===g?olympe.D.H.log(f,'null'):olympe.D.H.log(f,String(g))},null,[a],[0],'DataFlowDump');a.onDestroy(()=>{olympe.D.H.log(`Node #${d} destroyed`+(b?`: ${b}`:
|
|
358
|
+
''))});c.onDestroy(()=>{delete Kb[d]})}}else olympe.D.H.log('NOT starting node dump, node is '+String(a))};olympe.D.xC=function(){let a='',b=olympe.D.Xa();for(;null!==b;)a+=b.Od()+' --\x3e ',b=b.getParent();olympe.D.H.log(a)};
|
|
359
|
+
olympe.D.ra=function(a){if(void 0===a)return olympe.D.aa.ZERO;if(a instanceof olympe.D.aa)return a;a&&a.valueOf&&(a=a.valueOf());if('number'===typeof a){if(isNaN(a))return olympe.D.aa.qp;if(a===Math.PI)return olympe.D.aa.PI;if(Infinity===a)return olympe.D.aa.Rs;if(-Infinity===a)return olympe.D.aa.Kt;if(isNaN(a))var b=!1;else b=parseFloat(a),b=(b|0)===b;return b&&-1<=a&&100>=a?(olympe.D.sh.has(a)||olympe.D.sh.set(a,new olympe.D.aa(a)),olympe.D.sh.get(a)):new olympe.D.aa(a)}return null};
|
|
360
|
+
olympe.D.Ud=function(a){return void 0===a?olympe.D.Gd(olympe.D.aa):olympe.D.Gd(olympe.D.aa,olympe.D.We(a)?a:olympe.D.ra(a))};olympe.D.lx=olympe.D.aa.animate;olympe.D.SC=function(a,b){return new olympe.D.Pr(a,b)};olympe.D.xb=function(a){if(a instanceof olympe.D.Na)return a;a instanceof Object&&(a=a.valueOf());const b=typeof a;if('string'===b||'number'===b||'boolean'===b)return a=String(a),olympe.D.Xj.has(a)?olympe.D.Xj.get(a):new olympe.D.Na(a)};
|
|
361
|
+
olympe.D.WC=function(a){return void 0===a?olympe.D.Gd(olympe.D.Na):olympe.D.Gd(olympe.D.Na,olympe.D.We(a)?a:olympe.D.xb(a))};olympe.D.Qb=function(a){return a instanceof olympe.D.ea?a:void 0!==a&&null!==a&&a.valueOf()?olympe.D.ea.F:olympe.D.ea.C};olympe.D.TC=function(a){return void 0===a?olympe.D.Gd(olympe.D.ea):olympe.D.Gd(olympe.D.ea,olympe.D.We(a)?a:olympe.D.Qb(a))};olympe.D.mx=function(a){if(a instanceof Date)return new olympe.D.gb(a)};
|
|
362
|
+
olympe.D.VC=function(a){return olympe.D.Gd(olympe.D.gb,void 0!==a?new olympe.D.gb(a):null)};olympe.D.vr=a=>a instanceof olympe.D.ea||a instanceof olympe.D.aa||a instanceof olympe.D.Na||a instanceof olympe.D.gb;olympe.D.XC=function(a,b){return olympe.D.Gd(olympe.D.Sb,void 0===a&&void 0===b?void 0:new olympe.D.Sb(a,b))};olympe.D.yx=function(a,b,c,d){let e;void 0!==a&&(a instanceof olympe.D.Color?e=a:e=olympe.D.Color.create(a,b,c,d));return olympe.D.Gd(olympe.D.Color,e)};olympe.D.UC=olympe.D.yx;
|
|
363
|
+
olympe.D.vv=function(a){olympe.D.H=a;olympe.D.yh=olympe.D.Gg()};olympe.D.Gg=function(){olympe.D.Xm||(olympe.D.Xm=new olympe.D.kq);return olympe.D.Xm};olympe.D.Xa=function(){olympe.D.yh||(olympe.D.yh=olympe.D.Gg());return olympe.D.yh};olympe.D.Cr=function(a){const b=olympe.D.yh;olympe.D.Pm(a)&&(olympe.D.yh=a);return null!=b?b:null};
|
|
364
|
+
olympe.D.Ub=a=>{a='string'===typeof a?JSON.parse(a):a;if(a.type){let b=null;switch(a.type){case 'dateTime':b=olympe.D.gb.Ub(a);break;case 'number':b=olympe.D.aa.Ub(a);break;case 'string':b=olympe.D.Na.Ub(a);break;case 'vector2':b=olympe.D.Sb.Ub(a);break;case 'color':b=olympe.D.Color.Ub(a);break;case 'boolean':b=olympe.D.ea.Ub(a)}return b}return null};function Mb(a){a.C.eb()||(a.G.forEach(b=>{b.destroy()}),a.G.clear(),a.F.clear(),a.size.clear(),a.O.clear(),a.T.length=0,a.L.length=0)}
|
|
365
|
+
olympe.D.RA=class{constructor(){this.C=new olympe.D.Yb('Slot Manager context');this.G=new Map;this.C.run(()=>{this.F=olympe.D.fc(Nb,'Last slot manager entry');this.size=Db(olympe.D.fc(olympe.D.aa,'SlotManager size').repeat(this.F.rb().Em()),olympe.D.aa.ZERO);this.O=Db(olympe.D.fc(olympe.D.aa,'last valid slots'),olympe.D.ra(-1))});this.T=[];this.L=[];this.C.onDestroy(()=>{Mb(this)})}};
|
|
366
|
+
class Nb{constructor(a,b,c,d){this.id=a;this.F=new olympe.D.Yb('Slot manager entry');this.L=c;this.O=d;this.F.run(()=>{const e=Db(olympe.D.fc(olympe.D.aa),olympe.D.aa.ZERO);olympe.D.fb(b)?e.repeat(b):e.update(b);this.C=olympe.D.fc(olympe.D.aa);this.G=this.C.rb().Vd(e.rb())});this.next=null}V(){return this.id}Jw(){return this.C.rb()}Em(){return this.G}Rd(){return this.L}Tw(){return this.O}Yx(a){this.L=a}Lx(a){null===a?this.C.update(olympe.D.aa.ZERO):(this.C.repeat(a.Em()),a.next=this)}bt(){this.C.clear();
|
|
367
|
+
this.next=null}destroy(){this.F.destroy();this.G=this.C=this.next=null}}m=Nb.prototype;m.V.K=olympe.D.J.C;m.Jw.K=new olympe.D.J(()=>olympe.D.aa);m.Em.K=new olympe.D.J(()=>olympe.D.aa);m.Rd.K=olympe.D.J.C;m.Tw.K=olympe.D.J.C;m.Yx.K=olympe.D.J.C;m.Lx.K=olympe.D.J.C;m.bt.K=olympe.D.J.C;m.destroy.K=olympe.D.J.C;olympe.D.R={Ca:'df.Logger'};olympe.W.config(a=>{G(a,olympe.D.U.rp,Number.POSITIVE_INFINITY);F(a,olympe.D.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('df'))},'olympe.df');olympe.W.run([olympe.D.R.Ca],a=>{olympe.D.vv(a)},'olympe.df');olympe.host={};const Ob=new Map,Pb=new Map;olympe.host.up=class{static register(a,b,...c){Ob.set(a,b);0<c.length&&Pb.set(a,c)}static create(a,b,c,d){const e=Ob.get(a);if(void 0===e)throw Error('Undefined UI element type: '+a);a=Pb.get(a);return void 0!==a?new e(b,c,...a.map(f=>sa(d,f))):new e(b,c)}};function Qb(a,b,c){a.H.debug('CREATE #',b,', type=',c);a.C.set(b,olympe.host.up.create(c,b,a.H,a.L))}function Rb(a,b,c,...d){const e=a.C.get(b);if(void 0!==e){a.H.Z()<=olympe.ma.Hb.C.Ff&&a.H.debug('CALL #'+b+', '+c+'('+Array.prototype.slice.call(d,0)+')');b=[];for(const f of d)if(void 0===f||null===f)b.push(f);else if(olympe.D.fb(f))b.push(a.C.get(f.Zu)||null);else if('function'===typeof f){const g=f,h=olympe.D.Xa();b.push((...k)=>{h.eb()||g(...k)})}else b.push(f.valueOf());e[c].apply(e,b)}}
|
|
368
|
+
function Sb(a){var b=olympe.host.ue.od,c=olympe.host.ue.tp.Lq;++a.G;const d=a.G;Qb(a,d,c);const e=olympe.D.createNode(b,void 0,void 0,void 0,void 0,'Native('+d+')',!1,function(){var f=arguments.length-2;const g=Array.from({length:f}),h=[],k=arguments[f+1],l=d+'_'+k;this.F.has(l)&&this.F.get(l).destroy();for(let n=0;n<f;n++){let p=arguments[n];olympe.D.fb(p)?(h.push(n),p=p.Da):olympe.D.yf(p)&&h.push(n);g[n]=p}0===h.length?e.run(()=>{Rb(this,d,k,...g)}):(f=olympe.D.createNode(void 0,(...n)=>{e.run(()=>
|
|
369
|
+
{Rb(this,d,k,...n)})},void 0,g,h,'Native('+d+').'+k),this.F.set(l,f),f.onDestroy(()=>this.F.delete(l)));return null}.bind(a));e.Z(a.O.bind(a,d));a=O(e);a.Zu=d;N(e,a);return a}olympe.host.Ta=class{constructor(a,b){this.H=a;this.L=b;this.G=0;this.C=new Map;this.F=new Map;a.debug('Starting host manager')}ab(){return this.H}O(a){this.H.debug('DESTROY #',a);const b=this.C.get(a);this.C.delete(a);b.destroy()}};olympe.host.Dd=class{constructor(a){this.C=a;this.F=olympe.D.Xa()}G(){return this.C}Wc(){return this.C.Da.Wc()||this.F.Wc()}eb(){return this.C.Da.eb()}};olympe.host.Dd.prototype.G.K=new olympe.D.J(()=>olympe.host.ue.Dd,[]);olympe.host.Tj=class{C(){}F(){}};olympe.host.Ls=class{F(){}C(){return x(function*(){})}Li(){}};function Tb(a,b){var c=olympe.host.Bf;const d=olympe.Y.Fc(),e=new olympe.D.Yb('onTimeout context');c.C.Z(b,d,()=>{e.eb()||e.Wc()||e.run(a);c.C.G(d)});return new olympe.host.od.F(c.C,d,e)}function Ub(a,b){var c=olympe.host.Bf;const d=olympe.Y.Fc(),e=new olympe.D.Yb('onInterval context');c.C.T(b,d,()=>{e.eb()||e.Wc()?c.C.F(d):e.run(a)})}olympe.host.od=class{constructor(a){this.C=Sb(a)}};olympe.host.od.C=class{constructor(a,b,c){this.Bf=a;this.id=b;this.C=null!=c?c:null}V(){return this.id}cancel(){}};
|
|
370
|
+
olympe.host.od.L=class extends olympe.host.od.C{cancel(){this.Bf.O(this.id);let a;null==(a=this.C)||a.destroy();this.C=null}};olympe.host.od.F=class extends olympe.host.od.C{cancel(){this.Bf.G(this.id);let a;null==(a=this.C)||a.destroy();this.C=null}};olympe.host.od.G=class extends olympe.host.od.C{cancel(){this.Bf.F(this.id);let a;null==(a=this.C)||a.destroy();this.C=null}};olympe.host.Dj=class{F(a,b){return null!=b?b:''}ba(a,b){return null!=b?b:''}O(){}C(a,b){return null!=b?b:''}G(){}};olympe.host.ue={};olympe.host.ue.Dd=class{destroy(){}};olympe.host.ue.Dd.prototype.destroy=olympe.host.ue.Dd.prototype.destroy;olympe.host.ue.tp={hy:100,jy:101,iy:102,ly:103,ky:104,gy:105,IA:201,GA:202,DA:204,LA:205,CA:206,FA:207,JA:208,MA:209,NA:210,OA:211,EA:212,KA:218,HA:219,PA:220,BA:221,AA:222,WA:300,XA:301,YA:302,bB:303,cB:304,dB:305,ZA:310,$A:311,aB:312,dA:400,eA:401,fA:402,Uz:450,Nz:500,Lz:501,Qz:502,Pz:503,Mz:504,Oz:505,wB:600,nB:601,rB:602,jB:603,kB:604,hB:605,mB:606,CB:607,uB:608,eB:609,iB:610,lB:611,tB:612,yB:613,fB:614,xB:615,sB:616,BB:617,oB:618,pB:619,qB:620,vB:630,gB:631,zB:632,AB:633,fC:700,JB:701,KB:702,
|
|
371
|
+
LB:703,NB:704,OB:705,PB:706,MB:707,RB:708,QB:709,SB:710,WB:711,dC:712,TB:713,UB:714,XB:715,YB:716,$B:717,aC:718,cC:719,ZB:720,bC:721,eC:722,VB:723,gC:724,hC:725,Lq:800};olympe.host.ue.od=class{O(){}Z(){}G(){}T(){}F(){}};olympe.host.R={Qj:'host.System',gl:'host.HistoryManager',mq:'host.Scheduler',Ca:'host.platform.Logger',Ha:'host.Manager',Je:'host.ProcessManager'};olympe.host.U={Lp:'host.processProbe',rq:'host.gracefulShutdownTimeout'};olympe.host.Bf=null;
|
|
372
|
+
olympe.W.config(function(a){xa(a,olympe.host.R.Qj);xa(a,olympe.host.R.gl);E(a,olympe.host.R.Je,olympe.host.Dj);F(a,olympe.host.R.Ca,[olympe.ma.R.Ha],function(b){return b.Oc('host')});E(a,olympe.host.R.Ha,olympe.host.Ta,olympe.host.R.Ca,olympe.W.R.bg);F(a,olympe.host.R.mq,[olympe.host.R.Ha],b=>{null===olympe.host.Bf&&(olympe.host.Bf=new olympe.host.od(b));return olympe.host.Bf},!0)},'olympe.host');olympe.W.run([olympe.host.R.mq],a=>a,'olympe.host.scheduler');olympe.W.run([olympe.host.R.Ha],a=>a,'olympe.host');
|
|
373
|
+
olympe.W.run([olympe.host.R.Je],a=>{olympe.host.jk=()=>a});olympe.net={};olympe.net.Ba={};olympe.net.Ba.Nd={ih:'POST',GET:'GET',Is:'HEAD',Mp:'PUT',zc:'DELETE',Cp:'OPTIONS',gA:'PATCH'};olympe.net.Ba.ResponseType={Xl:'text',Ik:'blob',Fq:'arraybuffer'};olympe.net.Ba.Headers={Rh:'content-type',vy:'content-length',tn:'authorization',Nr:'access-control-allow-origin',Lr:'access-control-allow-headers',Mr:'access-control-allow-methods',zo:'x-forwarded-host',Ao:'x-forwarded-proto'};olympe.net.Ba.Tk={yz:'text/html',JSON:'application/json',Yu:'application/zip',yu:'application/octet-stream'};
|
|
374
|
+
olympe.net.Ba.Zb={Xr:0,gh:200,On:201,Wi:202,Gk:400,Ou:401,xo:403,Al:404,Rz:405,ni:500,ru:503};function Vb(a){return a.host&&encodeURI(a.host)}function Wb(a){return encodeURI(a.path).replace(olympe.net.zi.C,(b,c)=>'%'+c)}function Xb(a){return void 0===a.G?443===a.port:a.G}olympe.net.zi=class{constructor(a,b,c,d){this.host='localhost';this.port=80;this.path='';this.G=!1;void 0!==a&&(this.host=a);void 0!==b&&(this.port=b);void 0!==c&&(this.path=c.replace(/^\/+/,''));void 0!==d&&(this.G=d)}C(){return`${Xb(this)?'wss':'ws'}://${Vb(this)}:${this.port}/${Wb(this)}`}toString(){return`${Vb(this)}:${this.port}/${Wb(this)}`}};
|
|
375
|
+
olympe.net.zi.C=/%25([0-9a-f]{2})/i;olympe.net.WebSocket=class{send(){}close(){}fa(){}ba(){}Z(){}F(){}};function P(a,b,c,d){a=olympe.Y.zx(a.valueOf());if(!a.host&&!a.path)return null;const e=a.scheme?a.scheme.includes('s'):!1;b=new olympe.net.ai(a.host,a.port||(e?443:80),a.path||'',e,b,c,d,a.query||void 0);a.Gr&&(c=a.Gr.split(':'),2===c.length&&(c=Fa(olympe.Y.Se(),`${c[0]}:${c[1]}`),Q(b,{Authorization:`Basic ${c}`})));return b}function Yb(a){return void 0!==a.query?a.query.replace(/[^=&]+/g,b=>encodeURIComponent(b)):null}function Q(a,b){Object.assign(a.headers,b)}
|
|
376
|
+
olympe.net.ai=class extends olympe.net.zi{constructor(a,b,c,d,e,f,g,h){super(a,b,c,d);this.method=void 0!==e?e:olympe.net.Ba.Nd.GET;this.query=h;this.headers={};this.body=f;this.F=void 0!==g?g:olympe.net.Ba.ResponseType.Xl;this.ca=this.cert=this.key=null;this.rejectUnauthorized=!1}Ii(){return this.headers}C(){let a=Yb(this);a=a?`?${a}`:'';return Vb(this)?`${Xb(this)?'https':'http'}://${Vb(this)}:${this.port}/${Wb(this)}${a}`:`${Wb(this)}${a}`}toString(){return this.C()}};
|
|
377
|
+
olympe.net.ai.Nd={ih:'POST',GET:'GET',Is:'HEAD',Mp:'PUT',zc:'DELETE',Cp:'OPTIONS'};olympe.net.Yd=class{constructor(a,b,c,d){this.data=a;this.status=void 0===b?200:b;this.statusText=void 0===c?'':c;this.headers=void 0===d?{}:d}getData(){return this.data}yc(){return this.status}Ii(){return this.headers}};function Zb(a,b,c){const d=olympe.D.Xa(),e=d.onDestroy(()=>{var f=a.F();const g=f.C.get(b);g&&(f.C.delete(b),g())});return d.G(f=>{d.zf(e);a.F().C.delete(b);c(f)})}function $b(a,b){return new olympe.net.gf(a,b)}olympe.net.Ta=class{constructor(a){this.H=a;this.L=1;a='Initializing NET layer';this.H.C()&&(a+=' (implementation: '+this.T()+')');this.H.info(a);this.H.log('DONE initializing NET layer (ready to receive connection requests)')}F(){}G(){}C(){}O(){}Uf(){}T(){}};function ac(a){let b;return!(null==(b=a.C)||!b.connected)}function bc(a,b){const c=()=>{const d=b(),e=d.sd();return{username:`${a.T.vhost}:${d.uc()}`,password:e}};return Object.assign({},a.T,c(),{transformWsUrl:(d,e,f)=>{Object.assign(f.options,c());return d}})}
|
|
378
|
+
function cc(a,b,c){if(!ac(a))return Promise.reject(Error('Cannot subscribe because the MQTT client is disconnected'));a.H.C()&&a.H.debug(`MQTT subscribe to topic ${b}`);return new Promise((d,e)=>{a.C.subscribe(b,void 0,f=>{f?e(Error(`Failed to subscribe to topic ${b}: ${f}`)):(a.F.set(b,c),d())})})}
|
|
379
|
+
function dc(a,b){if(!ac(a))return Promise.reject(Error('Cannot unsubscribe because the MQTT client is disconnected'));a.H.C()&&a.H.debug(`MQTT unsubscribe topic ${b}`);return new Promise((c,d)=>{a.C.unsubscribe(b,void 0,e=>{a.F.delete(b);e?d(e):c()})})}function ec(a,b){a.L.push(b)}function fc(a,b){a.G.push(b)}function gc(a,b){a.O.push(b)}
|
|
380
|
+
olympe.net.gf=class{constructor(a,b){this.url=a;this.T=b||null;this.C=null;this.G=[];this.O=[];this.ba=[];this.Z=[];this.L=[];this.F=new Map;this.H=olympe.ma.ab('MQTT')}connect(a,b){if(ac(this))return b&&b(),this;b&&this.G.push(b);null===this.C&&(this.C=mqtt.connect(this.url,bc(this,a)),this.C.on(olympe.net.gf.C.Jt,(c,d)=>{this.H.C()&&this.H.debug(`MQTT < ${d}`);this.F.has(c)?this.F.get(c)(JSON.parse(d.toString())):this.H.warn('There is no subscriber for topic '+c)}),this.C.on(olympe.net.gf.C.ds,
|
|
381
|
+
()=>{this.H.info('Mqtt client is connected to bus');this.G.forEach(c=>c())}),this.C.on(olympe.net.gf.C.hu,()=>{this.H.info('Mqtt client is reconnecting to bus ... ');this.O.forEach(c=>c())}),this.C.on(olympe.net.gf.C.Eb,c=>{this.H.error('Mqtt client error ',c);this.Z.forEach(d=>d(c))}),this.C.on(olympe.net.gf.C.$d,()=>{this.H.info('Mqtt client is offline');this.ba.forEach(c=>c())}),this.C.on(olympe.net.gf.C.cs,()=>{this.H.info('Mqtt client is closed');this.L.forEach(c=>c())}),this.C.on(olympe.net.gf.C.al,
|
|
382
|
+
()=>{this.H.info('Mqtt client has ended')}));return this}publish(a,b,c){if(!ac(this))return Promise.reject(Error('Cannot publish message because the MQTT client is disconnected'));const d=JSON.stringify(b);this.H.C()&&this.H.debug(`MQTT > ${d}`);return new Promise((e,f)=>{this.C.publish(a,d,c,g=>{g?f(Error('Failed to publish a message '+d)):e()})})}end(a,b){this.F.clear();this.C?this.C.end(a,{},()=>{b&&b();this.C=null}):null==b||b();return this}};
|
|
383
|
+
olympe.net.gf.C={ds:'connect',hu:'reconnect',Jt:'message',cs:'close',al:'end',Eb:'error',$d:'offline'};olympe.net.yi=class{constructor(a){this.H=a}start(){return Promise.reject('Try to start web server with the browser implementation.')}G(){return Promise.reject('Try to restart web server with the browser implementation.')}stop(){return Promise.reject('Try to stop web server with the browser implementation.')}L(){return Promise.reject('Try to open a route on a web server using the browser implementation.')}Z(){return Promise.reject('Try to close a route on a web server using the browser implementation.')}};
|
|
384
|
+
olympe.net.yi.C='*';olympe.net.Bu=class{register(){return x(function*(){throw Error('Service Worker Manager must be overridden by a native layer: called "register"');})}};olympe.net.R={Ha:'net.Manager',Ca:'net.Logger',xi:'net.WebServer',tu:'net.ServiceWorkerManager',Dl:'net.OfflineConfig'};olympe.net.U={Zh:'net.httpPort',Oo:'net.httpBodyLimit',Kq:'net.http2',No:'net.httpsCertificatesPath',rj:'net.localNetworkSuffix',ki:'offline.enabled',Cl:'offline.autoBackOnline',Bp:'offline.downloadBatchSize'};
|
|
385
|
+
olympe.W.config(function(a){G(a,olympe.net.U.Zh,3141);G(a,olympe.net.U.Oo,100);G(a,olympe.net.U.Kq,!1);G(a,olympe.net.U.No,null);G(a,olympe.net.U.rj,'frontend');G(a,olympe.net.U.ki,!1);G(a,olympe.net.U.Cl,!1);G(a,olympe.net.U.Bp,20);xa(a,olympe.net.R.Ha);F(a,olympe.net.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('net'));E(a,olympe.net.R.xi,olympe.net.yi,olympe.net.R.Ca);E(a,olympe.net.R.tu,olympe.net.Bu);F(a,olympe.net.R.Dl,[new olympe.W.ja(olympe.net.U.ki),new olympe.W.ja(olympe.net.U.Cl)],(b,c)=>new Map([['offlineEnabled',
|
|
386
|
+
b],['offlineAutoBackOnline',!b||c]]))},'olympe.net');olympe.Sa.node.host={};olympe.Sa.node.host.Dd=function(a,b){this.H=b};olympe.Sa.node.host.Dd.prototype.constructor=olympe.Sa.node.host.Dd;olympe.Sa.node.host.Dd.prototype.destroy=function(){};olympe.Sa.node.host.Dd.prototype.destroy=olympe.Sa.node.host.Dd.prototype.destroy;olympe.Sa.node.host.Dd.prototype.ab=function(){return this.H};olympe.Sa.node.host.Dd.xa=[olympe.host.ue.Dd];function hc(a){a.H.error('No history manager implemented in Node')}olympe.Sa.node.host.vp=class{constructor(a){this.H=a}Li(){return!1}F(){hc(this);return null}C(){const a=this;return x(function*(){hc(a)})}};olympe.Sa.node.host.vp.xa=[olympe.host.Ls];olympe.Sa.node.host.od=class{constructor(){this.C={};this.L={}}destroy(){}O(a){clearTimeout(this.C[a]);delete this.C[a]}Z(a,b,c){this.C[b]=setTimeout(c,a)}G(a){clearTimeout(this.C[a]);delete this.C[a]}T(a,b,c){this.L[b]=setInterval(c,a)}F(a){clearInterval(this.L[a]);delete this.L[a]}};olympe.host.up.register(olympe.host.ue.tp.Lq,olympe.Sa.node.host.od);olympe.Sa.node.host.od.xa=[olympe.host.ue.od];olympe.Sa.node.host.Tj=class{constructor(a){this.H=a}C(){return olympe.D.ea.F}F(){return!0}};olympe.Sa.node.host.Tj.xa=[olympe.host.Tj];function ic(a){const b=olympe.net.Ba.Zb.gh,c=olympe.net.Ba.Zb.ni;a.fa.L('healthcheck','/readiness',[olympe.net.Ba.Nd.GET],()=>{const d=Array.from(a.Z.values()).map(e=>e.apply(a));return 0===d.length?Promise.resolve(new olympe.net.Yd('No healthCheck is set',b,'Nothing to check')):Promise.allSettled(d).then(e=>{let f=!1,g='Health check result: ';for(const h of e)'rejected'===h.status?(f=!0,e=h.reason,g+=`\n${e}`,a.H.warn(`Health check detected a service which is DOWN: ${e}`)):g+=`\n${h.value}`;return new olympe.net.Yd(g,
|
|
387
|
+
f?c:b,f?'Some services are not working':'Everything is OK')})}).catch(d=>a.H.error(`Failed to add health check route ${d}`));a.F(()=>a.fa.stop())}function jc(a,b){b=Array.from(b.entries()).map(([c,d])=>olympe.Y.Promise.en(d(),a.oa,`Shutdown hook ${c} has timeout`));return Promise.allSettled(b).then(c=>{let d=!1;for(const e of c)'rejected'===e.status&&(d=!0,a.H.warn(`Failed to close some resource: ${e.reason}`));return d})}
|
|
388
|
+
function kc(a){return x(function*(){try{const b=yield jc(a,a.L),c=yield jc(a,a.T);if(b||c)throw Error('Failed to gracefully close the backend');}finally{a.L.clear(),a.T.clear()}})}
|
|
389
|
+
olympe.Sa.node.host.Dj=class extends olympe.host.Dj{constructor(a,b,c,d=!0){super();this.H=a;this.fa=b;this.oa=c;this.Z=new Map;this.L=new Map;this.T=new Map;d&&ic(this)}C(a,b=olympe.Y.tf()){this.Z.set(b,a);return b}G(a){this.Z.delete(a)}F(a,b=olympe.Y.tf()){this.L.set(b,a);return b}ba(a,b=olympe.Y.tf()){this.T.set(b,a);return b}O(a){this.L.has(a)?this.L.delete(a):this.T.delete(a)}};olympe.W.config(function(a){G(a,olympe.host.U.Lp,!0);G(a,olympe.host.U.rq,1E4);va(a,olympe.host.R.gl,olympe.Sa.node.host.vp,olympe.host.R.Ca);va(a,olympe.host.R.Qj,olympe.Sa.node.host.Tj,olympe.host.R.Ca);E(a,olympe.host.R.Je,olympe.Sa.node.host.Dj,olympe.host.R.Ca,olympe.net.R.xi,new olympe.W.ja(olympe.host.U.rq),new olympe.W.ja(olympe.host.U.Lp))},'olympe.native.node.host');olympe.W.run([olympe.host.R.Je],a=>{olympe.Sa.node.host.jk=()=>a});olympe.net.me={};olympe.net.me.nl=class{constructor(a){this.H=a;this.C=new Map}G(){}F(){}};olympe.net.me.WebSocket=class{constructor(a,b){this.H=b;this.id=a;this.C=null;this.buffer=[];this.O=this.G=this.L=this.T=null}V(){return this.id}open(a){const b=`#${this.id}`,c=this.oa(a);c.binaryType='arraybuffer';c.addEventListener('open',()=>{this.H.info('Websocket OPENED');this.T?(this.H.debug('Notifying upper layer for WebSocket',b),this.T()):this.H.warn('Nothing to notify for WebSocket',b);this.H.debug(b,`Send all buffered messages (n=${this.buffer.length}).`);this.buffer.forEach(c.send.bind(c));
|
|
390
|
+
this.buffer.length=0});c.addEventListener('message',d=>{d='string'===typeof d.data?String(d.data):Ga(d.data);(this.H.L()||this.H.C()&&!d.startsWith('pong'))&&this.H.debug(b,'<',d);this.G&&this.G(d)});c.addEventListener('close',()=>{this.H.debug(`WebSocket ${b} CLOSED`);this.L&&this.L()});c.addEventListener('error',()=>{this.H.debug(`WebSocket ${b} ERROR`);this.O&&this.O()});this.C=c}send(a){const b=`#${this.id}`;if(null!==this.C){const c=this.C.constructor;switch(this.C.readyState){case c.OPEN:(this.H.L()||
|
|
391
391
|
this.H.C()&&!a.startsWith('ping'))&&this.H.debug(b,'>',a);this.C.send(a);break;case c.CONNECTING:this.H.debug(b,'- Connecting: BUFFER','>',a);this.buffer.push(a);break;default:return this.H.debug(b,'- Closed','>',a),!1}}else this.H.debug(b,'- Not opened yet: BUFFER','>',a),this.buffer.push(a);return!0}close(){if(null!==this.C){const a=this.C.constructor,b=this.C.readyState;if(b===a.OPEN||b===a.CONNECTING){this.H.debug(`Force closing native websocket ${`#${this.id}`}`);this.C.close(1E3);return}}this.H.debug('Try to force close native websocket, but not open nor connecting')}fa(a){this.T=
|
|
392
|
-
a||null}ba(a){this.G=a||null}F(a){this.O=a||null}Z(a){this.
|
|
393
|
-
b:a.body,r:a.F},b)}O(){this.H.warn('DOWNLOAD FILE not available with node native implementation. URL:')}F(){return this.Z}};const
|
|
394
|
-
olympe.
|
|
395
|
-
new Uint8Array(Buffer.from(M,'binary'));K=w===olympe.net.Ba.ResponseType.
|
|
396
|
-
ArrayBuffer?Buffer.from(C):C);A.end()})};d&&(h||k||l)?h&&k&&l?(b.rejectUnauthorized=n,g(h,'key',b).then(g.bind(null,k,'cert')).then(g.bind(null,l,'ca')).then(p).catch(y=>{this.H.log('Error loading self signed files:',y)})):this.H.warn('All three self signed files must be specified!'):p(b)}F(a,b,c,d){this.H.debug('Received HTTP response',a,c);return new olympe.net.
|
|
397
|
-
function
|
|
398
|
-
u]of Object.entries(g.headers))k.headers[t]=u;a.H.debug('< HTTP:',k.toString());n=new Map(Object.entries(g.params));g=new Map(Object.entries(g.query));return d(k,n,g).then(t=>{const u=t.yc(),w=t.getData();(w instanceof Uint8Array||w instanceof ArrayBuffer||w instanceof
|
|
399
|
-
t.
|
|
400
|
-
olympe.
|
|
401
|
-
host:'0.0.0.0'}).then(a=>{this.C=
|
|
402
|
-
yield c.start()})})})}stop(){return this.C===
|
|
403
|
-
this.timer=setTimeout(a,b)}};olympe.W.config(function(a){
|
|
404
|
-
olympe.async.
|
|
405
|
-
this.ba),0<this.timeout&&(this.timer=setTimeout(()=>{this.C='Timeout expired.';this.timer=0;this.complete(!1)},this.timeout)))}clear(){this.F=[];this.Z=[];this.env.clear();this.oa&&this.G.destroy()}complete(a){this.G.
|
|
406
|
-
function
|
|
407
|
-
olympe.async.
|
|
408
|
-
0<this.F.length){this.T=this.F.length;for(const a of this.F)this.run(a)}else this.complete(!0)}};olympe.Bb={};olympe.Bb.
|
|
409
|
-
olympe.N.errors.
|
|
410
|
-
olympe.W.config(a=>{
|
|
411
|
-
'rest/authorization/roleMembers')});function
|
|
412
|
-
function
|
|
413
|
-
function
|
|
414
|
-
function
|
|
415
|
-
function
|
|
416
|
-
e&&c(e)})})}function
|
|
417
|
-
function
|
|
418
|
-
function
|
|
419
|
-
function
|
|
420
|
-
olympe.N.
|
|
421
|
-
{this.T=!1;
|
|
422
|
-
a()),this.
|
|
423
|
-
(yield b.connect());var c=a.
|
|
424
|
-
new olympe.N.Response(a,this.
|
|
425
|
-
function
|
|
426
|
-
typeof k?k:typeof k}`);e(k);break;case
|
|
427
|
-
a.H.error(k),500===h.yc()&&'Connection refused'===h.statusText?f(new olympe.N.errors.
|
|
428
|
-
()=>{let d=!1;olympe.D.
|
|
429
|
-
function
|
|
430
|
-
function
|
|
392
|
+
a||null}ba(a){this.G=a||null}F(a){this.O=a||null}Z(a){this.L=a||null}oa(){}};olympe.net.me.WebSocket.xa=[olympe.net.WebSocket];olympe.Sa.node.net={};olympe.Sa.node.net.Nt=class extends olympe.net.Ta{constructor(a,b){super(a,b);this.Z=new olympe.Sa.node.net.nl(a)}T(){return'NodeJS'}Uf(){return olympe.D.ea.F}G(a){var b=this.L++;a=a.C();this.H.debug('CREATE Websocket #'+b+' to '+a);b=new olympe.Sa.node.net.Ot(b,this.H);b.open(a);return b}C(a,b){this.H.debug('SEND HTTP '+a.method+' to '+a.C());const c=this.L++;b=Zb(this,c,b);this.Z.G(c,{u:a.C(),s:Xb(a),h:Vb(a),p:a.port,z:Wb(a),q:Yb(a),m:a.method,v:a.Ii(),k:a.key,c:a.cert,a:a.ca,j:a.rejectUnauthorized,
|
|
393
|
+
b:a.body,r:a.F},b)}O(){this.H.warn('DOWNLOAD FILE not available with node native implementation. URL:')}F(){return this.Z}};const lc=require('fs'),mc=require('http'),nc=require('https');
|
|
394
|
+
olympe.Sa.node.net.nl=class extends olympe.net.me.nl{G(a,b,c){const d=b.s,e=b.b,f=b.m;var g=b.v;const h=b.k,k=b.c,l=b.a,n=b.j;var p=b.h;const q=b.p;let r=b.z;r.startsWith('/')||(r=`/${r}`);const t=b.q,u=b.u,w=b.r;b={host:p,port:q,path:t?r+'?'+t:r,method:f};g&&(b.headers=g);g=(y,z,A)=>new Promise((C,M)=>{lc.readFile(y,(K,ta)=>{K?M(K):(A[z]=ta,C(A))})});p=y=>{const z=C=>{C.setEncoding(w===olympe.net.Ba.ResponseType.Xl?'utf-8':'binary');let M='';C.on('data',K=>{M+=K});C.on('end',()=>{if(w!==olympe.net.Ba.ResponseType.Xl){var K=
|
|
395
|
+
new Uint8Array(Buffer.from(M,'binary'));K=w===olympe.net.Ba.ResponseType.Ik?new Blob(K):K}else K=M;c(this.F(C.statusCode,C.statusMessage,K,C.headers))})},A=d?new nc.request(y,z):new mc.request(y,z);this.C.set(a,()=>{A.destroy()});A.on('error',C=>{c(this.F(olympe.net.Ba.Zb.ni,'Connection refused','Error connecting to '+u+' with method '+f+', code = '+C.code+', message = '+C.message,''))});!e||'POST'!==f&&'PUT'!==f?A.end():(e instanceof Blob?e.arrayBuffer():Promise.resolve(e)).then(C=>{A.write(C instanceof
|
|
396
|
+
ArrayBuffer?Buffer.from(C):C);A.end()})};d&&(h||k||l)?h&&k&&l?(b.rejectUnauthorized=n,g(h,'key',b).then(g.bind(null,k,'cert')).then(g.bind(null,l,'ca')).then(p).catch(y=>{this.H.log('Error loading self signed files:',y)})):this.H.warn('All three self signed files must be specified!'):p(b)}F(a,b,c,d){this.H.debug('Received HTTP response',a,c);return new olympe.net.Yd(c,a,b,d)}};olympe.Sa.node.net.Ot=class extends olympe.net.me.WebSocket{oa(a){return new (require('ws'))(a)}};olympe.Sa.node.net.U={IB:'native.html.net.useWorkers'};olympe.W.config(function(a){a.getParameter(olympe.net.U.ki)&&ya(a,olympe.net.U.ki,!1);va(a,olympe.net.R.Ha,olympe.Sa.node.net.Nt,olympe.net.R.Ca,olympe.host.R.Ha)},'olympe.native.node.net');olympe.Sa.node.net.http={};const oc=require('fastify'),{Readable:pc}=require('stream'),qc={Pj:0,Oj:1,Tl:2},rc=olympe.net.Ba.Nd.Cp,sc=olympe.net.Ba.Headers.Nr,tc=olympe.net.Ba.Headers.Lr,uc=olympe.net.Ba.Headers.Mr,vc=olympe.net.Ba.Zb.gh;
|
|
397
|
+
function wc(a,b){const c=b.methods,d=b.Ow,e=b.headers,f=b.origin;a.F.route({bodyLimit:a.ba<<20,url:b.path,method:[...c,rc],handler:(g,h)=>{var k=g.method;const l={[sc]:f,[uc]:c,[tc]:e};if(k===rc)return a.H.debug('< HTTP: OPTIONS'),h.code(vc).headers(l).send();var n=g.body;if(n instanceof Buffer){var p=new Uint8Array(n.length);n.copy(p)}else if('string'===typeof n||n instanceof Object)p=n;const [q,r]=g.hostname.split(':');k=new olympe.net.ai(q,parseInt(r,10),g.url,'https'===g.protocol,k,p);for(const [t,
|
|
398
|
+
u]of Object.entries(g.headers))k.headers[t]=u;a.H.debug('< HTTP:',k.toString());n=new Map(Object.entries(g.params));g=new Map(Object.entries(g.query));return d(k,n,g).then(t=>{const u=t.yc(),w=t.getData();(w instanceof Uint8Array||w instanceof ArrayBuffer||w instanceof pc)&&h.type(olympe.net.Ba.Tk.yu);if(u>=olympe.net.Ba.Zb.ni)throw Error(w);u>=olympe.net.Ba.Zb.Gk?a.H.warn('> HTTP: client bad request: reply with error:',w):a.H.debug('> HTTP: reply with body:',Buffer.isBuffer(w)?'binary':w);return h.code(u).headers(Object.assign(l,
|
|
399
|
+
t.Ii())).send(w)}).catch(t=>{a.H.error('> HTTP: reply with internal server error:',t);return h.code(olympe.net.Ba.Zb.ni).headers(Object.assign(l,{[olympe.net.Ba.Headers.Rh]:'text/plain'})).send('Internal server error')})}})}
|
|
400
|
+
olympe.Sa.node.net.http.yi=class extends olympe.net.yi{constructor(a,b,c,d,e){super(a);this.ba=c;this.port=b;this.fa=d;this.T=e;this.F=this.createServer();this.O=new Map;this.C=qc.Pj;this.wd=new Set;this.timer=null}L(a,b,c,d){this.O.set(a,{path:b,methods:c,Ow:d,headers:'*',origin:'*'});return this.G()}Z(a){const b=this;return x(function*(){b.O.delete(a);return 0<b.O.size?b.G():b.stop()})}start(){if(this.C===qc.Pj)return this.G();if(this.C===qc.Oj){for(const a of this.O.values())wc(this,a);return this.F.listen({port:this.port,
|
|
401
|
+
host:'0.0.0.0'}).then(a=>{this.C=qc.Tl;this.H.debug('Web server listening on '+a);this.wd.forEach(b=>b(null))}).catch(a=>{this.stop().then();this.wd.forEach(b=>b(a))}).finally(()=>this.wd.clear())}return Promise.reject('Try to start a webservice already started')}G(){return this.C===qc.Oj?(new Promise((a,b)=>{this.wd.add(c=>c?b(c):a())})).then(()=>this.G()):new Promise((a,b)=>{this.wd.add(c=>c?b(c):a());this.bk(()=>{const c=this;return x(function*(){c.C=qc.Oj;yield c.F.close();c.F=c.createServer();
|
|
402
|
+
yield c.start()})})})}stop(){return this.C===qc.Tl?this.F.close().then(()=>{this.C=qc.Pj}):Promise.resolve()}createServer(){var a={logger:{level:'warn'},http2:this.fa};if('string'===typeof this.T){const b=require('fs'),c=require('path');Object.assign(a,{https:{allowHTTP1:!0,key:b.readFileSync(c.join(this.T,'key.pem')),cert:b.readFileSync(c.join(this.T,'cert.pem'))}})}a=oc(a);a.addContentTypeParser('*',{parseAs:'buffer'},(b,c,d)=>{d(null,c)});return a}bk(a,b=1E3){this.timer&&clearTimeout(this.timer);
|
|
403
|
+
this.timer=setTimeout(a,b)}};olympe.W.config(function(a){E(a,olympe.net.R.xi,olympe.Sa.node.net.http.yi,olympe.net.R.Ca,new olympe.W.ja(olympe.net.U.Zh),new olympe.W.ja(olympe.net.U.Oo),new olympe.W.ja(olympe.net.U.Kq),new olympe.W.ja(olympe.net.U.No))},'olympe.native.node.net.http');olympe.Sa.node.Y={};const xc=require('buffer');olympe.Sa.node.Y.Lk=class extends olympe.Y.Lk{G(a){return new Uint8Array(Buffer.from(a,'base64'))}C(a){return a instanceof Uint8Array?Buffer.from(a,a.byteOffset,a.byteLength).toString('base64'):Buffer.from(a).toString('base64')}F(a,b,c){try{b(xc.resolveObjectURL(a))}catch(d){c(`Error while trying to fetch buffer from ObjectURL: ${d}`)}}};olympe.W.config(function(a){va(a,olympe.Y.R.ag,olympe.Sa.node.Y.Lk)},'olympe.native.node.utils');olympe.async={};function yc(a,b){a.L||a.Z.push(a.G.G(b))}
|
|
404
|
+
olympe.async.so=class{constructor(a,b=void 0===a){this.F=[];this.Z=[];this.G=a||new olympe.D.Yb('Async executor context');this.oa=b;this.C=null;this.env=new Map;this.env.set('Executor',this);this.L=this.O=!1;this.H=null;this.timer=this.timeout=0;this.ba=olympe.Y.Fc()}en(a){0<=a&&(this.timeout=a);return this}ab(){return this.H}add(a){this.L||this.F.push(this.G.G(a));return this}start(){this.O||(this.H&&this.H.log('Executor started.'),this.O=!0,this.G.onDestroy(()=>{this.C='Context destroyed.';this.complete(!1)},
|
|
405
|
+
this.ba),0<this.timeout&&(this.timer=setTimeout(()=>{this.C='Timeout expired.';this.timer=0;this.complete(!1)},this.timeout)))}clear(){this.F=[];this.Z=[];this.env.clear();this.oa&&this.G.destroy()}complete(a){this.G.zf(this.ba);if(!this.L){this.L=!0;this.timer&&(clearTimeout(this.timer),this.timer=0);this.H&&this.H.log(a?'Executor completed successfully':`Executor completed with error: ${this.C}`);for(const b of this.Z)b(a,a?null:this.C,this.env);this.clear()}}getContext(){return this.G}};
|
|
406
|
+
function zc(a){if(0<a.F.length){const b=a.F.shift();a.H&&a.H.log(`Executing next task. ${a.F.length} tasks left in the pipeline.`);a.getContext().run(()=>{b(()=>{Promise.resolve().then(()=>{zc(a)})},c=>{c&&(a.C=c);a.complete(!1)},a.env)})}else a.complete(!0)}olympe.async.vq=class extends olympe.async.so{static create(){return new olympe.async.vq(new olympe.D.Yb('SequencedExecutor'),!0)}start(){this.O||(super.start(),zc(this))}};
|
|
407
|
+
olympe.async.Cj=class extends olympe.async.so{constructor(a,b){super(a,b);this.T=0;this.fa=!0}static create(){return new olympe.async.Cj(new olympe.D.Yb('ParallelExecutor'),!0)}run(a){this.H&&this.H.log('Starting a task');this.getContext().run(()=>{a(()=>{this.done()},b=>{this.fa=!1;b&&(this.C=this.C?`${this.C}. ${b}`:b);this.done()},this.env)})}add(a){super.add(a);this.O&&!this.L&&(this.T++,this.run(a));return this}done(){this.T--;0>=this.T&&this.complete(this.fa)}start(){if(!this.O)if(super.start(),
|
|
408
|
+
0<this.F.length){this.T=this.F.length;for(const a of this.F)this.run(a)}else this.complete(!0)}};olympe.Bb={};olympe.Bb.wt=class{F(){return x(function*(){})}Z(){}O(){}G(){}T(){}forEach(){}has(){}get(){}set(){}remove(){}fa(){}ba(){}clear(){}L(){}};olympe.Bb.xt=class{F(){}};olympe.Bb.Storage=class{open(){}write(){}close(){}};olympe.Bb.Gt=class{get(){return null}set(){return this}delete(){}};olympe.Bb.R={qj:'localStorage.KeyValueDatabaseManager',oi:'localStorage.Storage',zy:'localStorage.DatacloudStorage',wl:'localStorage.LocalStorage',Ca:'localStorage.Logger',tg:'localStorage.prefix'};olympe.W.config(function(a){xa(a,olympe.Bb.R.qj);F(a,olympe.Bb.R.tg,[],()=>'olympe');F(a,olympe.Bb.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('localstorage'));E(a,olympe.Bb.R.wl,olympe.Bb.Gt)},'olympe.localstorage');olympe.N={};olympe.N.errors={};olympe.N.errors.Gp=class extends Error{};olympe.N.errors.zp=class extends Error{};olympe.N.errors.Uj=class extends Error{};olympe.N.errors.Un=class extends Error{};olympe.N.errors.hq=class extends Error{};olympe.N.errors.Jp=class extends Error{};olympe.N.errors.Uu=class extends Error{};olympe.N.errors.Vl=class extends Error{constructor(a,b){super(a);this.id=b}V(){return this.id}};olympe.N.errors.uj=class extends olympe.N.errors.Vl{};olympe.N.errors.Hn=class extends olympe.N.errors.Vl{};
|
|
409
|
+
olympe.N.errors.Lo=class extends olympe.N.errors.Vl{};olympe.N.$b={kj:'urls.FileSvc',un:'urls.BackupSvc',$p:'urls.RestoreBackupSvc',fg:'urls.GetContext',Io:'urls.GraphDef',Jn:'urls.StaticGraphDef',TRANSACTION:'urls.Transaction',Jq:'urls.UserTagFromToken',Tu:'urls.UserNameFromTag',Su:'urls.UserRoles',lu:'urls.RoleMembers',wj:'urls.OpenIDSvc'};
|
|
410
|
+
olympe.W.config(a=>{G(a,olympe.N.$b.kj,'rest/filesvc');G(a,olympe.N.$b.un,'rest/backupsvc');G(a,olympe.N.$b.$p,'rest/backupsvc/restore');G(a,olympe.N.$b.wj,'rest/openid');G(a,olympe.N.$b.fg,'rest/initialData');G(a,olympe.N.$b.Io,'rest/querysvc/graphDef');G(a,olympe.N.$b.Jn,'rest/querysvc/graphDef/static');G(a,olympe.N.$b.TRANSACTION,'rest/transaction');G(a,olympe.N.$b.Jq,'rest/token');G(a,olympe.N.$b.Tu,'rest/authorization/getUserTag');G(a,olympe.N.$b.Su,'rest/authorization/getUserRoles');G(a,olympe.N.$b.lu,
|
|
411
|
+
'rest/authorization/roleMembers')});function Ac(a){a.H.info('Disconnected from bus');let b;null==(b=a.C)||b.forEach((c,d)=>{null!==c.F&&(a.H.info(`Disconnected from bus: pause keep alive of ${c.C.size} subscriptions for ${d} service.`),Bc(c))})}
|
|
412
|
+
function Cc(a){a.H.debug('Connection to bus established. Listening to responses on topic',a.L);return cc(a.F,a.L,b=>{a.H.C()&&a.H.debug('BUS <',JSON.stringify(b));Dc(a,b.seq,'consumed');b=new olympe.N.Response(b.dest,b.src,b.seq,b.type,a.za.F(b.content));Dc(a,b.Ve().toString(),'deserialized',(new Map).set('source',b.yb()).set('messageType',b.getType().toString()));let c;null==(c=a.G.get(b.Ve()))||c(b)})}
|
|
413
|
+
function Ec(a){a.ba.forEach(c=>c(null));a.ba=[];a.H.debug(`Reconnected to bus: resubscribe to ${a.oa.size} active topics.`);a.oa.forEach((c,d)=>{Fc(a,d,c).then(()=>{})});let b;null==(b=a.C)||b.forEach((c,d)=>{null===c.F&&(a.H.debug(`Reconnected to bus: restart keep alive of ${c.C.size} subscriptions for ${d} service.`),Gc(c,!0))})}function Hc(a){return Ic(a.ob)&&ac(a.F)}function Jc(a){a.tb=a.fa.C(()=>Hc(a)?Promise.resolve('Bus connection OK'):Promise.reject('Bus is disconnected'))}
|
|
414
|
+
function Dc(a,b,c,d=new Map){a.Kb.C&&Qa(a.Kb,'com',d.set('id',`${b}`).set('channel','bus').set('eventType',c))}
|
|
415
|
+
function Fc(a,b,c){return x(function*(){Hc(a)||(yield a.connect());a.H.debug(`Bus: Subscribe to ${b}`);a.oa.set(b,c);yield cc(a.F,b,d=>{a.H.C()&&a.H.debug(`BUS < #${b}: ${JSON.stringify(d)}`);let e=null;try{Dc(a,d.seq,'consumed'),e=new olympe.N.Request(d.dest,d.src,d.auth,d.seq,d.type,a.za.F(d.content)),Dc(a,e.Ve().toString(),'deserialized',(new Map).set('source',e.yb()).set('messageType',e.getType().toString()))}catch(f){a.H.error(`An error occurred while trying to deserialize the request: ${JSON.stringify(d)} with error ${f}`)}null!==
|
|
416
|
+
e&&c(e)})})}function Kc(a,b,c,d,e){b=new olympe.N.Response(c,a.L,b,d,e);return a.publish(b)}function Mc(a,b,c,d){const e=Nc(a.O).sd();a.Z++;return new olympe.N.Request(b,a.L,e,a.Z,c,d)}function Oc(a,b,c,d){const e=b.Ve(),f=olympe.N.Response.pb.Ak;let g=null;g=setTimeout(()=>Pc(a,e),a.Tb);a.G.set(e,h=>{g&&clearTimeout(g);h.getType()===f?g=setTimeout(()=>Pc(a,e),d):(a.G.delete(e),c(h))})}
|
|
417
|
+
function Pc(a,b){const c=a.G.get(b);a.G.delete(b);null==c||c(new olympe.N.Response(a.L,a.L,b,olympe.N.Response.pb.Eb,{reason:'Timeout'}))}function Qc(a,b){a.Z++;const c=a.Z,d=setTimeout(()=>Pc(a,c),a.Tb);a.G.set(c,e=>{a.G.delete(c);clearTimeout(d);b(e)});return a.Z}function Rc(a,b){return x(function*(){let c;const d=null==(c=a.C)?void 0:c.get(b);d&&(Bc(d),a.C.delete(b));a.oa.delete(b);a.H.debug(`Bus: Unsubscribe to ${b}`);if(Hc(a))return dc(a.F,b)})}
|
|
418
|
+
function Sc(a,b,c,d,e){null===a.C&&(a.C=new Map);let f=a.C.get(b);f?(a=f,a.G!==d&&(a.G=d,null!==a.F&&(Bc(a),Gc(a,!1)))):(f=new olympe.N.Gu(a.H,a,b,d),a.C.set(b,f));d=f;d.C.set(c,e);1===d.C.size&&Gc(d,!1)}function Tc(a,b,c){var d;const e=null==(d=a.C)?void 0:d.get(b);if(null==e?0:Uc(e,c))d=olympe.N.Request.pb.Gq,Hc(a)&&a.publish(Mc(a,b,d,c)).catch(f=>a.H.error(`Impossible to keep alive subscriptions: ${f}`)),0===e.C.size&&(a.C.delete(b),0===a.C.size&&(a.C=null))}
|
|
419
|
+
function Vc(a,b){return new Promise((c,d)=>{a.O.Mg(b.je(),(e,f)=>{e?d(e):c(f)})})}
|
|
420
|
+
olympe.N.In=class{constructor(a,b,c,d,e,f,g,h){b=h.get('connectionOptions');this.H=a;this.ob=c;this.O=d;this.fa=e;this.za=f;this.Kb=g;this.Tb=h.get('shortTimeout');this.Kc=h.get('requestTimeout');this.hc=h.get('subscriptionsRefreshRate');this.G=new Map;this.F=$b(h.get('url'),b);this.jb=h.get('allowGuest');this.Z=0;this.L=olympe.Y.Fc();this.C=null;this.T=!1;this.ba=[];this.oa=new Map;this.ac=this.tb='';this.Ja=!1;ec(this.F,()=>{Ac(this)});gc(this.F,()=>{this.T=!0});fc(this.F,()=>{this.T&&Cc(this).then(()=>
|
|
421
|
+
{this.T=!1;Ec(this)}).catch(k=>{this.H.error(`An error occurred while trying to subscribe to "response topic" on the bus. Close connection: ${k}`);this.F.end()})})}connect(){return new Promise((a,b)=>{const c=d=>{b(d);this.ba.forEach(e=>e(d));this.ba=[]};Hc(this)?a():this.T||this.Ja?this.ba.push(d=>d?b(d):a()):Ic(this.ob)?(this.Ja=!0,olympe.D.Um([this.O.rk()],d=>{Jc(this);this.Ja=!1;d.valueOf()||this.jb?(this.jb||Wc(this.O,()=>this.disconnect().then()),this.T=!0,this.F.connect(()=>Nc(this.O),()=>
|
|
422
|
+
a()),this.ac=this.fa.ba(()=>this.disconnect(),'Bus websocket')):c(Error('Guest user is not allowed to connect to RabbitMQ, you can allow guest with the bus.allowGuest oConfig parameter!'))})):c(Error('Cannot connect to the bus if working offline'))})}disconnect(){return new Promise(a=>{this.H.debug('Disconnecting from bus');this.O.oa.delete('busLogoutCallback');this.F.end(!1,()=>a());this.fa.G(this.tb);this.fa.O(this.ac)})}publish(a){const b=this;return x(function*(){if(!b.T||a.getType()!==olympe.N.Request.pb.Ge){Hc(b)||
|
|
423
|
+
(yield b.connect());var c=a.nc();try{Dc(b,a.Ve().toString(),'serialize');var d=a.ha(b.za);b.H.C()&&b.H.debug(`BUS > #${c}: ${JSON.stringify(d)}`)}catch(e){throw Error(`An error occurred while serializing the message (seqId=${a.Ve()}): ${e}`);}yield b.F.publish(c,d);Dc(b,a.Ve().toString(),'publish',(new Map).set('destination',a.nc()).set('messageType',a.getType().toString()))}})}kd(a,b,c){return Kc(this,a.Ve(),a.yb(),b,c)}request(a,b,c,d){const e=Mc(this,a,b,c);if(b===olympe.N.Request.pb.PUBLISH){const f=
|
|
424
|
+
new olympe.N.Response(a,this.L,e.Ve(),olympe.N.Response.pb.Ak);return this.publish(e).then(()=>f)}return new Promise((f,g)=>{Oc(this,e,f,null!=d?d:this.Kc);this.publish(e).catch(g)})}};olympe.N.In.C='Timeout';const Xc=olympe.net.Ba.Headers.tn,Yc=olympe.net.Ba.Zb.gh,Zc=olympe.net.Ba.Zb.On,$c=olympe.net.Ba.Zb.Wi,ad=olympe.net.Ba.Zb.ru,bd=olympe.net.Ba.Zb.Xr,cd=olympe.net.Ba.Zb.xo,dd=olympe.net.Ba.Zb.Ou,ed=olympe.net.Ba.Zb.Al;function fd(a,b){let c;return null!=(c=a.L.get(b))?c:''}function gd(a,b,c,d=new Map){a.C.C&&Qa(a.C,'com',d.set('id',`${b}`).set('channel','http').set('eventType',c))}
|
|
425
|
+
function hd(a,b,c){if(null===b)return Promise.reject('No http request to send');Q(b,{[Xc]:c});const d=b.C();return rxjs.firstValueFrom(rxjs.defer(()=>new Promise((e,f)=>{a.F++;const g=a.F;if(a.H.C()){const h=b.body;a.H.debug('HTTP >',d,`body: ${'string'===typeof h?h:typeof h}`)}gd(a,g,'request',(new Map).set('destination',b.C()).set('messageType',b.method.toString()));a.G.C(b,h=>{gd(a,g,'reply');switch(h.yc()){case Yc:case Zc:case $c:var k=h.getData();a.H.C()&&a.H.debug('HTTP <',h.yc(),`content: ${'string'===
|
|
426
|
+
typeof k?k:typeof k}`);e(k);break;case ad:h=`HTTP < Service provider for http request to ${b.C()} is overloaded, retry later`;a.H.warn(h);f(new olympe.N.errors.Jp(h));break;case bd:a.H.debug(`HTTP < request canceled (${b.C()}).`);e();break;case cd:case dd:h=`HTTP < request authorization denied: ${b.C()}`;a.H.error(h);f(new olympe.N.errors.Uu(h));break;case ed:h=`HTTP < requested resource not found: ${b.C()}`;a.H.error(h);f(new olympe.N.errors.zp(h));break;default:k=`HTTP < Error: ${h.yc()}, ${h.statusText}`,
|
|
427
|
+
a.H.error(k),500===h.yc()&&'Connection refused'===h.statusText?f(new olympe.N.errors.Un(k)):f(Error(k))}})})).pipe(olympe.N.operators.Ri(olympe.N.errors.Jp,(e,f)=>{a.H.warn(`Service overloaded (${d}), retry sending http request after ${f}ms.`)},4E3)))}olympe.N.Js=class{constructor(a,b,c,d){this.H=a;this.G=b;this.C=c;this.L=d;this.F=0}};function id(a,b,c){a.H.info('Initializing COMMUNICATION layer');if(a.H.C()){const d=['Server layer parameters:'];b.forEach((e,f)=>{d.push(f+'="'+e+'"')});a.H.debug(d.join('\n\t'))}jd(a,olympe.N.He.Eb,d=>{switch(d.c){case olympe.N.pb.Qu:a.H.error('Unknown message sent to the server:',olympe.N.Va.Jb[d.s]);break;case olympe.N.pb.Bs:a.H.error('Fatal error, the last message is probably too big according to the websocket config.'),a.G.forEach((e,f)=>{null!==e.Ym&&kd(a,f,d.i)})}});olympe.D.Ki(a.connected,
|
|
428
|
+
()=>{let d=!1;olympe.D.Ki(a.za.C(),()=>{d&&(a.Tb(),a.jb(),d=!1);Ub(a.Tb.bind(a),a.pd);Ub(a.jb.bind(a),a.ob)},()=>{a.L=[0,0,a.L[2]];d=!0})},()=>{a.O=null;Tb(a.jb.bind(a),a.ob)});c.C(()=>ld(a)?Promise.resolve('WebSocket connection to Orchestrator OK'):Promise.reject(`WebSocket connection to Orchestrator is ${a.C}`));c.ba(()=>a.disconnect(),'Orchestrator websocket');a.H.log('DONE initializing SERVER layer (waiting for NET layer connection to be opened)')}
|
|
429
|
+
function ld(a){return a.C===olympe.N.Va.C.Ug}
|
|
430
|
+
function R(a,b){if(a.C!==b)switch(a.H.debug('State change '+a.C+' --\x3e '+b),a.C=b,a.tb.forEach(c=>c(b)),b){case olympe.N.Va.C.em:case olympe.N.Va.C.CONNECTING:case olympe.N.Va.C.ho:break;case olympe.N.Va.C.Ug:a.connected.update(olympe.D.ea.F);break;case olympe.N.Va.C.pg:a.L=[0,0,a.L[2]];md(a);break;case olympe.N.Va.C.Eb:a.H.error('Connection to server',a.Z.C(),'aborted due to error');a.connected.update(olympe.D.ea.C);break;case olympe.N.Va.C.nn:md(a);break;case olympe.N.Va.C.Wd:a.connected.update(olympe.D.ea.C);
|
|
431
431
|
break;default:throw Error('State machine error in server manager. Should not get in state '+b);}}
|
|
432
|
-
function
|
|
433
|
-
|
|
434
|
-
function
|
|
435
|
-
function
|
|
436
|
-
function
|
|
437
|
-
(f=olympe.N.errors.
|
|
438
|
-
function
|
|
439
|
-
function
|
|
440
|
-
olympe.N.Va=class{constructor(a,b,c,d,e,f,g,h){this.H=a;this.
|
|
441
|
-
new Map;this.Kc=new Map;this.hc=-1;
|
|
442
|
-
{g===d?a():b(Error('Was not able to disconnect'))},!0),this.C!==c&&(
|
|
443
|
-
b.sv||'undefined';var d=b.activityTimeout?Math.max(b.activityTimeout-60,5):null;switch(b.status){case c.
|
|
444
|
-
a,'is invalid. Cannot check against it');else try{var e=olympe.Y.
|
|
445
|
-
|
|
446
|
-
var b=0;this.ba.C&&(b=performance.now()-this.ba.F);try{var c=JSON.parse(a)}catch(e){return this.H.error('Unable to parse response from server: '+e.toString()),Error('Unable to parse response from server')}this.H.C()&&this.H.debug('WS <',
|
|
447
|
-
Date.now();for(const [b,{
|
|
448
|
-
function
|
|
449
|
-
setTimeout(()=>a.connect().catch(k=>a.H.error(k)),g)}else a.H.info('Disconnected, stay offline.')});a.T.F(()=>{a.C.update(f);return Promise.resolve()},'Connectivity manager: shutdown state')}function
|
|
450
|
-
olympe.N.pc=class{constructor(a,b,c,d,e,f){this.H=a;this.G=b;this.T=d;this.storage=e;this.C=olympe.D.fc(Number).update(olympe.N.pc.C.INIT);this.F=f.get('offlineEnabled');this.O=f.get('offlineAutoBackOnline');this.
|
|
451
|
-
this;return
|
|
452
|
-
(a.C.update(c),yield olympe.N.
|
|
453
|
-
olympe.N.Response.
|
|
454
|
-
olympe.N.Mc=class{constructor(a,b,c){this.request=a;this.C=b;this.G=c;this.F=null}
|
|
455
|
-
|
|
456
|
-
olympe.N.Mc.prototype.notifyOn=olympe.N.Mc.prototype.
|
|
457
|
-
olympe.N.
|
|
458
|
-
return{t:3,m:b};case Array.isArray(a):return a.map(this.C.bind(this));case a instanceof ArrayBuffer:return{t:
|
|
459
|
-
this.F(b));switch(a.t){case 1:return new Date(a.d);case 2:return olympe.D.Color.Ub(a);case 3:return new Map(Object.entries(a.m).map(([b,c])=>[b,this.F(c)]));case 4:return olympe.Y.
|
|
460
|
-
function
|
|
461
|
-
olympe.N.
|
|
462
|
-
g));break;case
|
|
463
|
-
d.call(this,c)})}let a;null==(a=this.C)||a.clear()}static publish(a,b){return olympe.N.
|
|
464
|
-
a);case
|
|
465
|
-
l())}).then(()=>{k=p.id;
|
|
466
|
-
let k;null==(k=d.onRetry)||k.call(d)}))}};olympe.N.
|
|
467
|
-
olympe.N.Va.
|
|
468
|
-
18:'Try to unsubscribe multiple times',21:'GraphDef Query Failed',22:'Client Request Invalid',23:'Internal Server Error',24:'File Retrieval Error',25:'File Does Not Exists',26:'Restore Failed',27:'Permission Error',14:'Handshake Failed',28:'Client Version Too Old',29:'Client Version Invalid Format',34:'Server overloaded, retry later',35:'Add token error',36:'Keep token alive error',37:'Unknown client message',39:'Fetch data while concurrency transaction'};olympe.N.R={
|
|
469
|
-
olympe.N.U={
|
|
470
|
-
|
|
471
|
-
olympe.W.config(function(a){var b=['localhost','127.0.0.1'];
|
|
472
|
-
15E3);
|
|
473
|
-
|
|
474
|
-
l||void 0===l)return null;l=l.replace(/\/+/g,'/').replace(/\/$/,'');return new olympe.net.
|
|
475
|
-
olympe.N.R
|
|
476
|
-
|
|
477
|
-
new olympe.W.
|
|
478
|
-
h],['connectionOptions',w],['allowGuest',q],['shortTimeout',r],['requestTimeout',t],['subscriptionsRefreshRate',u]])});
|
|
479
|
-
olympe.N.R.
|
|
480
|
-
function
|
|
481
|
-
olympe.N.
|
|
482
|
-
function
|
|
483
|
-
olympe.auth.
|
|
484
|
-
a=
|
|
485
|
-
function
|
|
486
|
-
function
|
|
487
|
-
olympe.D.
|
|
488
|
-
a.oa.forEach(e=>{e(c,d)});else if(c===olympe.auth.
|
|
489
|
-
function
|
|
490
|
-
function
|
|
491
|
-
!0)}function
|
|
492
|
-
function
|
|
493
|
-
function
|
|
494
|
-
function
|
|
495
|
-
olympe.auth.
|
|
496
|
-
olympe.D.fc(olympe.auth.
|
|
497
|
-
d.update(olympe.D.ea.C)):d.clear()});return d.rb()}
|
|
498
|
-
else{var c,d=null==(c=olympe.D.
|
|
499
|
-
this.H.error('Was not able to send the auth keep alive message:',b.message);null==a||a(b)})}Tb(a,b){const c=null===this.G?olympe.auth.
|
|
500
|
-
this.storage)||
|
|
501
|
-
m.
|
|
502
|
-
olympe.auth.
|
|
503
|
-
d.parse;var f=
|
|
504
|
-
olympe.auth.Jd.
|
|
505
|
-
olympe.auth.Jd.
|
|
506
|
-
function
|
|
507
|
-
null)}})}olympe.auth.Jd.SRP=class extends olympe.auth.wc{G(){return olympe.auth.wc.C.SRP}
|
|
508
|
-
olympe.W.config(function(a){
|
|
509
|
-
olympe.auth.R.
|
|
510
|
-
k,l,n,p,q,r,t)=>{const u=[new olympe.auth.Jd.
|
|
511
|
-
olympe.W.run([olympe.auth.R.Ha],a=>{olympe.auth.
|
|
512
|
-
olympe.
|
|
513
|
-
return
|
|
514
|
-
null==(c=b.C.get(a))||c.clear()})}
|
|
515
|
-
function
|
|
516
|
-
(f=g[3],void 0===f?f=!0:f.startsWith('"')&&f.endsWith('"')?f=f.substring(1,f.length-1):d.test(f)?f='true'===f.toLowerCase():e.test(f)&&(f=parseFloat(f)),a[g[1]]=f)}a=new olympe.W.
|
|
517
|
-
olympe.Y.
|
|
518
|
-
e,f);else{var n=p=>{p=p instanceof Uint8Array?new Blob([p],{type:l}):p;this.G&&this.
|
|
519
|
-
this.db.model(b);e=new olympe.dc.Request(olympe.dc.Request.C.
|
|
520
|
-
b=URL.createObjectURL(c);this.C.set(d,b);const e=a.C(d);
|
|
521
|
-
olympe.dc.Request.C={
|
|
522
|
-
p.X(),!a.sources.has(h)){const q=new olympe.dc.sources.
|
|
523
|
-
olympe.dc.
|
|
524
|
-
function
|
|
525
|
-
olympe.dc.na=class{constructor(){}static C(a,b,...c){if(
|
|
526
|
-
olympe.dc.Ma.Entry=class{constructor(a,b,c){this.tag=a;this.F=b;this.
|
|
527
|
-
a)}
|
|
528
|
-
olympe.dc.Ma.Relation.prototype.getInverse=olympe.dc.Ma.Relation.prototype.Vb;olympe.dc.Ma.Relation.prototype.getDirection=olympe.dc.Ma.Relation.prototype.Ga;olympe.dc.Ma.Relation.prototype.getTag=olympe.dc.Ma.Relation.prototype.X;olympe.dc.Ma.Relation.
|
|
529
|
-
y===e?t.set(z,u):y===f?t.set(w,u):y===g?u.forEach((A,C)=>{k.Ea(z,C,r)}):y===h&&u.forEach((A,C)=>{k.Ea(z,r,C)})});l=l.source();k.Nc(r,l,t)}else{const r=new Map;for(const t of l.Cb().keys()){var q=t[0]===f;const u=q?t.substring(1):t;q=q?
|
|
530
|
-
function
|
|
531
|
-
olympe.dc.db.
|
|
532
|
-
function
|
|
533
|
-
class
|
|
534
|
-
olympe.dc.db.Database=class a extends Map{constructor(b,c,d){super();let e;this.id=null!=(e=d.get('selfTag'))?e:olympe.dc.Pa.SELF;this.H=b;this.hc=olympe.D.Xa();this.T=olympe.dc.db.Database.G.IDLE;this.ba=new Map;this.oa=[];this.G=[];this.fa=new Map;var f;b=null!=(f=d.get('garbageCollector'))?f:olympe.dc.db.
|
|
535
|
-
c,d,e=!1){var f=this.F(b,!0);if(!f.e&&null!==c&&(null===f.G||f.G===c)){f.G=c;let g;(null==(g=f.model())?0:g.e)&&f.db.Z(f,!0)}e&&f.persist();d&&this.Tb(f,d);this.C(a.F.
|
|
536
|
-
case
|
|
537
|
-
{e(c,...d)})}Z(b,c){this.fa.set(b,c)}
|
|
538
|
-
this.hc))}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
function
|
|
543
|
-
function
|
|
544
|
-
function
|
|
545
|
-
function W(a,b,c,d,e){a=a.C.F(olympe.dc.ga(b));c=c.Ga()+c.X();e=null!=e?e:
|
|
546
|
-
function
|
|
547
|
-
null!=(t=null==(r=a.C.get(q))?void 0:r.get(h))?t:0;(f|g)&u&&l.forEach(w=>{k.push([w,q,p,!!(f&u)])})}});return k}function
|
|
548
|
-
function
|
|
549
|
-
function
|
|
550
|
-
olympe.dc.ib=class{constructor(a,b){this.H=a;this.C=b}V(){return this.C.V()}F(a,b,c,d=!1){a=V(this,a);if(null!==a){b=b.Ga()+b.X();const e=
|
|
551
|
-
a,!0))&&a.
|
|
552
|
-
...d])=>[c.tag(),...d])}bb(a,b){a=V(this,a,!0);b=b.Ga()+b.X();b=null==a?void 0:a.get(b);a=[];if(b)for(const c of b.values())c.Fa()&&a.push(c.tag());return a}
|
|
553
|
-
V(this,a,!0);const d=b.Ga()+b.X();c=null==c?void 0:c.get(d);if(1<(null==c?void 0:c.size))return this.H.warn(`Relation ${b.X()} to instance ${a} is not unique: found ${c.size} related items`),null;a=null==c?void 0:c.values().next().value;return(null==a?0:a.Fa())?a.tag():null}
|
|
554
|
-
a,b);const d=[olympe.dc.ga(a)];for(const e of d){if(c(e))return e;if(a=b.get(e))for(const f of a.filter(g=>!d.includes(g)))d.push(f)}return null}
|
|
555
|
-
Error(a);null!==c&&e.push(c)}c=V(this,olympe.dc.CloudObject,!0);if(d!==c&&e[e.length-1]===c)throw Error(`The model "${this.name(a)}" (tag = ${a}) does not extend the expected model "${this.name(b)}" (tag = ${b}).`);return e.map(f=>f.tag())}
|
|
556
|
-
olympe.dc.ib.prototype.getExtendedModels=olympe.dc.ib.prototype.
|
|
557
|
-
olympe.dc.ib.prototype.getRelated=olympe.dc.ib.prototype.bb;olympe.dc.ib.prototype.getProperties=olympe.dc.ib.prototype.Cb;olympe.dc.ib.prototype.getProperty=olympe.dc.ib.prototype.
|
|
558
|
-
olympe.dc.ib.prototype.name=olympe.dc.ib.prototype.name;olympe.dc.ib.prototype.exist=olympe.dc.ib.prototype.Fa;const
|
|
559
|
-
function
|
|
560
|
-
function
|
|
561
|
-
function
|
|
562
|
-
olympe.dc.db.
|
|
563
|
-
e=f=>{this.F.add(f);this.C.getState()===d&&
|
|
564
|
-
l?a.Ea(h,f,k,g,e.Ec()):a.ic(h,f,k,g,e.Ec())})}Fh(){return 0===this.zb.size}
|
|
565
|
-
e).
|
|
566
|
-
this.
|
|
567
|
-
d=olympe.dc.ua.DESTINATION,e=this.zb.get(a);for(const [g,h,k]of e.
|
|
568
|
-
|
|
569
|
-
k.O());else if(!h.
|
|
570
|
-
function
|
|
571
|
-
function
|
|
572
|
-
function
|
|
573
|
-
function
|
|
574
|
-
function
|
|
575
|
-
function
|
|
576
|
-
function
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
b
|
|
583
|
-
|
|
584
|
-
b.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
olympe.
|
|
596
|
-
olympe.dc.
|
|
597
|
-
|
|
598
|
-
olympe.
|
|
599
|
-
olympe.dc.query.
|
|
432
|
+
function nd(a){const b=olympe.N.Va.C.nn,c=olympe.N.Va.C.em,d=olympe.N.Va.C.Wd,e=Wb(a.Ja);a.H.info(`Trying to wakeup orchestrator with ${e}`);R(a,c);const f=a.ac.G(a.Ja);f.ba(g=>{const h=JSON.parse(g);a.H.info(`${e}: ${null==h?void 0:h.status}`);switch(null==h?void 0:h.status){case 'ready':R(a,b);f.close();break;case 'asleep':a.H.info(`Trying to wakeup orchestrator with ${e}`);f.send('{"action": "wakeup"}');R(a,c);break;case 'waking-up':break;default:a.H.warn(`Invalid message from ${e}: ${g}`),f.close(),
|
|
433
|
+
R(a,d)}});f.F(()=>{a.H.warn(`Communication with ${e} failed.`);f.close();R(a,d)});f.fa(()=>{a.H.info(`Checking orchestrator status with ${e}`);f.send('{"action": "status"}')})}function od(a,b,c,d=!1){const e=f=>{if(0===b.length||b.includes(f))d&&a.tb.delete(e),c(f)};a.tb.add(e);e(a.C)}function pd(a,b,c,d,e){a.ba.C&&Qa(a.ba,'com',d.set('id',`${b}`).set('channel','ws').set('eventType',c),e)}
|
|
434
|
+
function md(a){const b=olympe.N.Va.C.INIT,c=olympe.N.Va.C.CONNECTING,d=olympe.N.Va.C.Ug,e=olympe.N.Va.C.Wd,f=olympe.N.Va.C.pg,g=olympe.N.Va.C.em,h=olympe.N.Va.C.Eb;null!==a.F&&(a.F.Z(null),a.F.close());a.H.log(`Asking NET layer for a connection to ${Vb(a.Z)}:${a.Z.port}...`);a.F=a.ac.G(a.Z);a.F.fa(a.Od.bind(a));a.F.ba(a.Pe.bind(a));a.F.Z(()=>{a.F=null;a.C===d?R(a,f):a.C!==h&&a.C!==g&&R(a,e)});a.Ja&&a.C===b&&a.F.F(()=>{a.F.F(null);a.C===c&&nd(a);a.Ja=null});a.C!==f&&R(a,c)}
|
|
435
|
+
function qd(a,b,c,d){const e=a.ve;a.ve++;c={message:{seqId:e,messageFamily:b,payload:c},om:d?rd(a,d):null,Ym:null};a.G.set(e,c);pd(a,e,'publish',(new Map).set('family',b));d=[olympe.N.Va.C.CONNECTING,olympe.N.Va.C.pg];(ld(a)||b===olympe.N.He.oj&&d.includes(a.C))&&sd(a,e,c)}
|
|
436
|
+
function rd(a,b){const c=olympe.N.Va.G.pi;return d=>{if(null!==d&&void 0!==d){var e=null,f,g=null==(f=d.info)?void 0:f.warn;f=d.s;if('string'===typeof g)a.H.debug(`A message has raised a warning in the orchestrator: ${g}. Investigate.`);else if(void 0!==f&&f!==c){e=void 0!==olympe.N.Va.Jb[f]?`Status code = ${f} [${olympe.N.Va.Jb[f]}]`:`Status code = ${f}`;g=d.info;f=olympe.N.errors.hq;if(void 0!==g&&void 0!==g.error){var h=g.error.reason;'string'===typeof h&&0<h.length&&(h.includes('Message timeout')&&
|
|
437
|
+
(f=olympe.N.errors.Uj),e+=`\nReason:\n${g.error.reason}`);h=g.error.detailedReason;'string'===typeof h&&0<h.length&&(e+=`\nDetails:\n${g.error.detailedReason}`)}e=new f('Rejected by orchestrator:\n'+e)}b(e,d)}}}function sd(a,b,c){var d=c.message;a.H.C()&&a.H.debug('WS >',JSON.stringify(d.payload));(d=a.F.send(JSON.stringify(d)))?null===c.om?a.G.delete(b):c.Ym=Date.now():olympe.D.Ra(a.za.C()).valueOf()&&R(a,olympe.N.Va.C.pg);return d}
|
|
438
|
+
function jd(a,b,c,d){void 0===d&&(d=olympe.Y.Fc());let e=a.fa.get(b);void 0===e&&(e=new Map,a.fa.set(b,e));e.set(d,c)}function td(a){a=a.fa.get(olympe.N.He.jg);void 0!==a&&a.delete('logoutHandler')}function kd(a,b,c){if(a.G.has(b)){const {om:d}=a.G.get(b);a.G.delete(b);d&&d({s:23,info:c})}}function ud(a,b){a.H.error(b);R(a,olympe.N.Va.C.Eb)}
|
|
439
|
+
function vd(a,b,c){a.hc=c?1E3*c:-1;a.H.info(`Connected to ${a.Z.C()}`,'|',b?`server version: ${b}`:'','|',null!==c?`activity timeout: ${c}s`:'');b=Array.from(a.G).sort(([d],[e])=>d-e);for(const [d,e]of b)if(!sd(a,d,e))return;R(a,olympe.N.Va.C.Ug)}
|
|
440
|
+
olympe.N.Va=class{constructor(a,b,c,d,e,f,g,h){this.H=a;this.ac=b;this.Z=e;this.F=null;this.Ja=f;this.ba=g;this.pd=h.get('pingInterval');h.get('retryHttpOverload');this.ob=h.get('messageTimeout');this.T=olympe.Y.pf.parse(h.get('clientVersion'));this.oa=olympe.Y.pf.parse(h.get('serverVersion'));this.C=olympe.N.Va.C.INIT;this.za=d;this.Kb=h.get('getContextMode');this.ve=1;this.O=null;this.L=[0,0,0];this.fa=new Map;this.connected=olympe.D.fc(olympe.D.ea,'Server is connected');this.tb=new Set;this.G=
|
|
441
|
+
new Map;this.Kc=new Map;this.hc=-1;id(this,h,c)}connect(){const a=olympe.N.Va.C.Ug,b=olympe.N.Va.C.Wd,c=olympe.N.Va.C.Eb,d=olympe.N.Va.C.INIT;return new Promise((e,f)=>{this.C!==d&&this.C!==b||md(this);od(this,[a,b,c],g=>{g===a?e():f(Error('Was not able to open a connection to the orchestrator'))},!0)})}disconnect(){return new Promise((a,b)=>{const c=olympe.N.Va.C.ho,d=olympe.N.Va.C.Wd,e=olympe.N.Va.C.CONNECTING,f=olympe.N.Va.C.Eb;this.C===olympe.N.Va.C.Ug||this.C===e||this.C===c?(od(this,[d,f],g=>
|
|
442
|
+
{g===d?a():b(Error('Was not able to disconnect'))},!0),this.C!==c&&(R(this,c),this.F.close())):(R(this,d),a())})}Od(){this.H.debug('Websocket connected, sending handshake. Client version:',Za(this.T),'subscribeEverything:',this.Kb?'NO':'YES');qd(this,olympe.N.He.oj,{c:olympe.N.pb.oj,cv:Za(this.T),m:this.Kb?0:1,s:this.O,b:this.za.F()},this.sf.bind(this))}sf(a,b){if(a)ud(this,'Error in receiving handshake response: '+a.message);else{this.H.debug('Handshake response received');var c=olympe.N.Va.F;a=
|
|
443
|
+
b.sv||'undefined';var d=b.activityTimeout?Math.max(b.activityTimeout-60,5):null;switch(b.status){case c.Us:ud(this,`Framework version (${Za(this.T)}) provided to the orchestrator was not valid. See orchestrator logs for more info.`);return;case c.Iu:ud(this,`Framework version (${Za(this.T)}) is not compatible with the orchestrator in use. See orchestrator logs for more info.`);return;case c.Es:ud(this,'Handshake failed. See orchestrator logs for more info.');return}if(this.oa.Qa(olympe.Y.pf.C))this.H.warn('Handshake successful but received server version',
|
|
444
|
+
a,'is invalid. Cannot check against it');else try{var e=olympe.Y.pf.parse(a);if(e.Ui(this.oa)){ud(this,`Framework v${Za(this.T)} is expecting Orchestrator to be at least in v${Za(this.oa)}`);return}this.H.log('Handshake successful. Orchestrator version: ',e,'required:',Za(this.oa))}catch(f){ud(this,f);return}e=olympe.N.Va.C.Wd;if(this.C===olympe.N.Va.C.pg&&null!==this.O&&this.O!==b.sessionId)this.H.warn('Trying to do a session recovering, but got another session id so retry from disconnected state'),
|
|
445
|
+
R(this,e);else{if(e=b.identityProviders)for(const [f,g]of Object.entries(e))this.Kc.set(f,g);this.O=b.sessionId||null;vd(this,a,d)}}}Tb(){this.L[0]-this.L[1]>this.pd/2?(this.H.debug('Ping did not get answer, try to reconnect'),R(this,olympe.N.Va.C.pg)):(this.L[0]=Date.now(),this.F.send('ping')||(this.H.debug('Impossible to send ping, try to reconnect'),R(this,olympe.N.Va.C.pg)))}Pe(a){this.L[2]=Date.now();if(a.startsWith('pong'))return olympe.D.Ra(this.za.C()).valueOf()&&(this.L[1]=this.L[2]),null;
|
|
446
|
+
var b=0;this.ba.C&&(b=performance.now()-this.ba.F);try{var c=JSON.parse(a)}catch(e){return this.H.error('Unable to parse response from server: '+e.toString()),Error('Unable to parse response from server')}a=c.seqId;const d=c.messageFamily;c=c.payload;this.H.C()&&this.H.debug('WS <',JSON.stringify(c));pd(this,a,'consumed',new Map,b);pd(this,a,'deserialized',(new Map).set('family',d));this.G.has(a)&&({om:b}=this.G.get(a),this.G.delete(a),null==b||b(c));b=this.fa.get(d);if(void 0!==b)for(const e of b.values())e(c);
|
|
447
|
+
return null}jb(){const a=Date.now();for(const [b,{Ym:c}]of this.G)null!==c&&a-c>this.ob&&(this.H.warn(`No response was received from the server for the seqId = ${b}`),kd(this,b,{error:{reason:'Message timeout: never receive acknowledge'}}))}};function Ic(a){return olympe.D.Ra(a.C)===olympe.N.pc.C.li}
|
|
448
|
+
function wd(a,b){const c=olympe.N.pc.C.Il,d=olympe.N.pc.C.$d,e=olympe.N.pc.C.Wd,f=olympe.N.pc.C.vu,g=b.get('reconnectionDelay');od(a.G,[olympe.N.Va.C.INIT],()=>{xd(a)?(a.C.update(c),a.connect().catch(h=>a.H.error(h))):a.G.disconnect().catch(h=>a.H.error(h))},!0);od(a.G,[olympe.N.Va.C.Wd],()=>{if(olympe.D.Ra(a.C)===f)a.H.info('Disconnected, from orchestrator for shutdown');else if(a.C.update(a.F?d:e),xd(a)&&a.O){const h=`Disconnected, will try to auto reconnect in ${g} ms`;a.F?a.H.log(h):a.H.error(h);
|
|
449
|
+
setTimeout(()=>a.connect().catch(k=>a.H.error(k)),g)}else a.H.info('Disconnected, stay offline.')});a.T.F(()=>{a.C.update(f);return Promise.resolve()},'Connectivity manager: shutdown state')}function xd(a){return null===a.storage.get(a.L+'olympe_manual_offline')}
|
|
450
|
+
olympe.N.pc=class{constructor(a,b,c,d,e,f){this.H=a;this.G=b;this.T=d;this.storage=e;this.C=olympe.D.fc(Number).update(olympe.N.pc.C.INIT);this.F=f.get('offlineEnabled');this.O=f.get('offlineAutoBackOnline');this.L=f.get('storagePrefix');wd(this,f)}Uf(){const a=olympe.N.pc.C.li,b=olympe.N.pc.C.$d,c=olympe.N.pc.C.Wd;let d=olympe.D.ea.C;return olympe.D.ta([this.C],e=>{if(e===a)d=olympe.D.ea.F;else if(e===b||e===c)d=olympe.D.ea.C;return d},olympe.D.ea)}getState(){return this.C.rb()}connect(){const a=
|
|
451
|
+
this;return x(function*(){const b=olympe.N.pc.C.li,c=olympe.N.pc.C.Il;olympe.D.Ra(a.C)!==b&&(a.C.update(c),a.storage.delete(a.L+'olympe_manual_offline'),yield a.G.connect(),yield yd(),a.C.update(b))})}disconnect(){const a=this;return x(function*(){const b=olympe.N.pc.C.$d,c=olympe.N.pc.C.Il;if(!a.F)throw Error('Try to go offline manually while the process does not support it. Please add `offline.enabled=true` in the config');a.storage.set(a.L+'olympe_manual_offline','true');olympe.D.Ra(a.C)!==b&&
|
|
452
|
+
(a.C.update(c),yield olympe.N.Eg().disconnect(),yield a.G.disconnect())})}};olympe.N.pc.C={INIT:0,Il:1,li:2,$d:3,Wd:4,vu:5};olympe.N.pc.F='olympe_manual_offline';olympe.N.Request=class{constructor(a,b,c,d,e,f){this.G=d;this.C=a;this.source=b;this.L=c;this.Jh=e;this.F=f||null}nc(){return this.C}yb(){return this.source}Ve(){return this.G}getType(){return this.Jh}je(){return this.L}ha(a){return{dest:this.C,src:this.source,seq:this.G,auth:this.L,type:this.Jh,content:a.ha(this.F)}}toString(){return`Request(dest: ${this.C}, src: ${this.source}, seqId: ${this.G}, type: ${this.Jh})`}};olympe.N.Request.pb={SEND:0,GET:1,PUBLISH:2,SUBSCRIBE:3,Ge:4,Gq:5};function zd(a){const b=olympe.N.Response.pb.Eq;return a.F!==olympe.N.Response.pb.Yl?Promise.reject('Should only call `topicAck` on TOPIC responses'):Kc(olympe.N.Eg(),a.C.seq,a.source,b)}olympe.N.Response=class{constructor(a,b,c,d,e){this.L=c;this.G=a;this.source=b;this.F=d;this.C=null!=e?e:null}nc(){return this.G}yb(){return this.source}Ve(){return this.L}getType(){return this.F}ha(a){return{dest:this.G,src:this.source,seq:this.L,type:this.F,content:a.ha(this.C)}}toString(){return JSON.stringify(this)}};
|
|
453
|
+
olympe.N.Response.pb={Ak:0,nq:1,Nq:2,Yl:3,Eq:4,Eb:5};const Ad=olympe.N.Response.pb.nq,Bd=olympe.N.Response.pb.Eb,Cd=olympe.N.Response.pb.Nq,Dd=olympe.N.Response.pb.Yl,Ed=olympe.N.Response.pb.Eq,Fd=olympe.N.Request.pb.SEND,Gd=olympe.N.Request.pb.GET,Hd=olympe.N.Request.pb.SUBSCRIBE,Id=olympe.N.Request.pb.Ge;
|
|
454
|
+
olympe.N.Mc=class{constructor(a,b,c){this.request=a;this.C=b;this.G=c;this.F=null}Lh(){return null!==this.F?Promise.resolve(this.F):Vc(this.C,this.request).then(a=>this.F=a)}Jh(){return this.request.getType()}source(){return this.request.yb()}body(){return this.request.F}Wq(){return this.request.getType()===Fd?this.C.kd(this.request,Ad):Promise.reject('Should only call `ack` on SEND requests')}kd(a){const b=this.request.getType();return b===Gd||b===Id?this.C.kd(this.request,Cd,a):Promise.reject('Should only call `reply` on GET requests')}Sm(a){if(this.request.getType()!==
|
|
455
|
+
Hd)return Promise.reject('Should only call `notifyOn` on SUBSCRIBE requests');const b=olympe.Y.Fc();return new Promise((c,d)=>{const e={seq:Qc(this.C,f=>{switch(f.getType()){case Ed:Jd(this.G,b);c(b);break;case Bd:d(f.C.reason);break;default:d('Unsupported response type for a SUBSCRIBE request')}}),topic:a,id:b,refresh:this.C.hc};this.C.kd(this.request,Dd,e).catch(d)})}zh(a){return this.C.kd(this.request,Bd,{reason:a.message})}};olympe.N.Mc.prototype.fail=olympe.N.Mc.prototype.zh;
|
|
456
|
+
olympe.N.Mc.prototype.notifyOn=olympe.N.Mc.prototype.Sm;olympe.N.Mc.prototype.reply=olympe.N.Mc.prototype.kd;olympe.N.Mc.prototype.ack=olympe.N.Mc.prototype.Wq;olympe.N.Mc.prototype.body=olympe.N.Mc.prototype.body;olympe.N.Mc.prototype.source=olympe.N.Mc.prototype.source;olympe.N.Mc.prototype.requestType=olympe.N.Mc.prototype.Jh;olympe.N.Mc.prototype.userTag=olympe.N.Mc.prototype.Lh;function Bc(a){if(null!==a.F){var b=a.F;a.F=null;clearInterval(b)}}function Gc(a,b){b&&a.Xe();null===a.F&&(a.F=setInterval(a.Xe.bind(a),a.G))}function Uc(a,b){b=a.C.delete(b);0===a.C.size&&Bc(a);return b}function Kd(a,b){a.C.forEach((c,d)=>{Uc(a,d);c(b)})}
|
|
457
|
+
olympe.N.Gu=class{constructor(a,b,c,d){this.H=a;this.L=b;this.O=c;this.G=d;this.C=new Map;this.F=null}Xe(){const a=olympe.N.errors.uj;Hc(this.L)?this.L.request(this.O,olympe.N.Request.pb.Ge,Array.from(this.C.keys())).then(b=>{b=b.C;0<b.length&&b.forEach(c=>{const d=this.C.get(c);Uc(this,c);null==d||d(new a('Subscription does not exist in the service.',c))})}).catch(b=>{b=`Impossible to keep alive subscriptions: ${b}`;this.H.error(b);Kd(this,Error(b))}):Bc(this)}};olympe.N.ug=class{ha(a){return this.C(a)}F(a){return this.G(a)}C(a){switch(!0){case null===a:case void 0===a:return null;case 'string'===typeof a:case 'boolean'===typeof a:case 'number'===typeof a:return a;case a instanceof olympe.D.gb:return{t:1,d:a.valueOf().toISOString()};case a instanceof Date:return{t:1,d:a.toISOString()};case a instanceof olympe.D.Color:return Object.assign({t:2},a.toJSON());case a instanceof Map:const b=Object.create(null);for(const [c,d]of a)'string'===typeof c&&(b[c]=this.C(d));
|
|
458
|
+
return{t:3,m:b};case a instanceof Set:return{t:4,m:Array.from(a).map(this.C.bind(this))};case Array.isArray(a):return a.map(this.C.bind(this));case a instanceof ArrayBuffer:return{t:5,v:olympe.Y.Se().C(a)};case a instanceof Uint8Array:return{t:6,v:olympe.Y.Se().C(a)};case 'object'===typeof a:return Object.entries(a).reduce((c,[d,e])=>{c[d]=this.C(e);return c},{});default:throw Error(`Impossible to serialize the following value: ${a}`);}}G(a){switch(!0){case null===a:case void 0===a:return null;case 'string'===
|
|
459
|
+
typeof a:case 'boolean'===typeof a:case 'number'===typeof a:return a}if(Array.isArray(a))return a.map(b=>this.F(b));switch(a.t){case 1:return new Date(a.d);case 2:return olympe.D.Color.Ub(a);case 3:return new Map(Object.entries(a.m).map(([b,c])=>[b,this.F(c)]));case 4:return new Set(a.m.map(b=>this.F(b)));case 5:return olympe.Y.Se().G(a.v).buffer;case 6:return olympe.Y.Se().G(a.v);default:return Object.entries(a).reduce((b,[c,d])=>{b[c]=this.F(d);return b},{})}}};const Ld=olympe.N.Response.pb.nq,Md=olympe.N.Response.pb.Ak,Nd=olympe.N.Response.pb.Eb,Od=olympe.N.Response.pb.Nq,Pd=olympe.N.Response.pb.Yl,Qd=olympe.N.Request.pb.SEND,Rd=olympe.N.Request.pb.GET,Sd=olympe.N.Request.pb.PUBLISH,Td=olympe.N.Request.pb.SUBSCRIBE,Ud=olympe.N.Request.pb.Ge,Vd=olympe.N.Request.pb.Gq;function Jd(a,b){a.C||(a.C=Ka(new olympe.Y.am(a.F.hc+3E4),c=>{let d;null==(d=a.G)||d.call(a,c)}));a.C.add(b)}
|
|
460
|
+
function Wd(a){let b,c;a=null!=(c=null==(b=a.C)?void 0:b.reason)?c:'Unknown reason';return'Timeout'===a?new olympe.N.errors.Uj(a):Error(a)}
|
|
461
|
+
olympe.N.wb=class{constructor(a,b){this.F=olympe.N.Eg();this.L=a;this.G=this.C=null;this.O=new olympe.D.Yb(`Service ${a}`,'function'===typeof b.F?b.F():b);this.H=olympe.ma.ab(`Service ${this.L}`)}listen(){return new rxjs.Observable(a=>{const b=()=>{a.complete();this.clear()};this.O.onDestroy(b);Fc(this.F,this.L,c=>{const d=new olympe.N.Mc(c,this.F,this);switch(c.getType()){case Ud:var e=d.body().filter(g=>{let h;return!(null==(h=this.C)?0:Ia(h,g))});d.kd(e).catch(g=>this.H.error('Not able to validate subscription keep alive',
|
|
462
|
+
g));break;case Vd:c=d.body();null==(e=this.C)||e.delete(c);let f;null==(f=this.G)||f.call(this,c);break;case Sd:a.next(d);break;default:this.F.kd(c,Md).then(()=>a.next(d))}}).catch(c=>{c='Failed to connect to the bus: '+c;this.H.error(c);a.error(Error(c))});return b})}Dr(a){this.G=a;return this}stop(){this.O.destroy()}clear(){Rc(this.F,this.L).catch(b=>this.H.error('Failed to unsubscribe from '+this.L+', error: '+b));if(this.G){let b;null==(b=this.C)||b.forEach(c=>{let d;return null==(d=this.G)?void 0:
|
|
463
|
+
d.call(this,c)})}let a;null==(a=this.C)||a.clear()}static publish(a,b){return olympe.N.Eg().request(a,Sd,b).then(()=>{})}static send(a,b,c={}){return olympe.N.Eg().request(a,Qd,b,c.timeout).then(d=>{switch(d.getType()){case Ld:break;case Nd:throw Wd(d);default:throw Error('Unsupported response type for a SEND request');}})}static get(a,b,c={}){return olympe.N.Eg().request(a,Rd,b,c.timeout).then(d=>{switch(d.getType()){case Od:d=d.C;if(null!==d)return d;throw Error('No payload after request to service: '+
|
|
464
|
+
a);case Nd:throw Wd(d);default:throw Error('Unsupported response type for a GET request');}})}static observe(a,b,c,d={}){const e='function'===typeof b.F?b.F():b,f=olympe.N.Eg();return(new rxjs.Observable(g=>{let h=null,k=null;const l=()=>{g.complete();k&&Tc(f,a,k);h&&Rc(f,h).catch(n=>olympe.ma.ab('Service '+a).error('Failed to unsubscribe from a topic '+n))};e.Z(l);f.request(a,Td,c,d.timeout).then(n=>{switch(n.getType()){case Pd:const p=n.C;h=p.topic;Fc(f,h,q=>{q.getType()===Sd?g.next(q.F):(g.error('Unsupported notification message. It should be a publish'),
|
|
465
|
+
l())}).then(()=>{k=p.id;Sc(f,a,k,p.refresh,q=>g.error(q));zd(n).catch(q=>{g.error(`Was unable to ack the subscription: ${q}`);l()})}).catch(q=>{g.error(`Was not able to subscribe to notification topic ${h}: ${q}`);l()});break;case Nd:g.error(Wd(n));break;default:g.error('Unsupported response type for a SUBSCRIBE request')}}).catch(n=>g.error(n));return l})).pipe(olympe.N.operators.Ri(olympe.N.errors.uj,(g,h)=>{olympe.ma.ab(`Service ${a}`).debug(`Subscribed to topic ${g.V()} now that we are back online, after waiting for ${h}ms`);
|
|
466
|
+
let k;null==(k=d.onRetry)||k.call(d)}))}};olympe.N.wb.observe=olympe.N.wb.observe;olympe.N.wb.get=olympe.N.wb.get;olympe.N.wb.send=olympe.N.wb.send;olympe.N.wb.publish=olympe.N.wb.publish;olympe.N.wb.prototype.stop=olympe.N.wb.prototype.stop;olympe.N.wb.prototype.setUnsubscriptionHandler=olympe.N.wb.prototype.Dr;olympe.N.wb.prototype.listen=olympe.N.wb.prototype.listen;olympe.N.He={Zn:1,Ff:2,Eb:3,jg:4,qy:5,oj:6};olympe.N.pb={oj:1,Qu:2,Bs:3,Ge:5};olympe.N.Va.C={INIT:'initialize',CONNECTING:'connecting',Wd:'disconnected',ho:'disconnecting',Ug:'connected',pg:'reconnecting',em:'waking',nn:'awake',Eb:'error'};olympe.N.Va.F={gh:1,Es:-1,Us:-2,Iu:-3};olympe.N.Va.G={pi:0,Dz:23};
|
|
467
|
+
olympe.N.Va.Jb={0:'OK',1:'SRP Authentication First Step Failed',2:'SRP Authentication Last Step Failed',3:'SRP Authentication Bad Credentials',4:'AutoLogin Authentication Failed',5:'AutoLogin Authentication Token Invalid',6:'Logout Failed',7:'SAML Request Generation Failed',8:'SAML Authentication Save Failed',9:'Invalid SAML Response',10:'SAML User Not Found',11:'Transaction Failed',12:'GetContext Failed',13:'Notification Failed',15:'FileService Clean Failed',17:'Try to subscribe multiple times',
|
|
468
|
+
18:'Try to unsubscribe multiple times',21:'GraphDef Query Failed',22:'Client Request Invalid',23:'Internal Server Error',24:'File Retrieval Error',25:'File Does Not Exists',26:'Restore Failed',27:'Permission Error',14:'Handshake Failed',28:'Client Version Too Old',29:'Client Version Invalid Format',34:'Server overloaded, retry later',35:'Add token error',36:'Keep token alive error',37:'Unknown client message',39:'Fetch data while concurrency transaction'};olympe.N.R={Ze:'com.ConnectivityManager',Kj:'com.ServerManager',zn:'com.BusManager',jl:'com.HttpManager',ae:'com.Serializer',Ca:'com.Logger',tq:'com.Source',Hq:'com.Urls',hA:'com.peerFileSvcUrl'};
|
|
469
|
+
olympe.N.U={Wk:'defaultHost',nh:'server.host',Lj:'server.port',Mj:'server.ssl',Hk:'server.basePath',Qq:'server.wsPath',Ol:'server.reconnectionDelay',Kp:'server.pingInterval',Pq:'server.messageTimeout',bq:'server.retryHttpOnOverload',Pk:'server.clientVersion',qq:'server.serverVersion',su:'server.wakeUpService',Kk:'bus.host',An:'bus.path',Bn:'bus.port',Gn:'bus.vhost',En:'bus.ssl',Ge:'bus.keepalive',ju:'bus.reschedulePings',bs:'bus.clientId',Zr:'bus.clean',es:'bus.connectTimeout',Dn:'bus.shortTimeout',
|
|
470
|
+
Cn:'bus.requestTimeout',Fn:'bus.subscriptionRefreshRate',fu:'bus.queueQoSZero',Jk:'bus.allowGuest'};
|
|
471
|
+
olympe.W.config(function(a){var b=['localhost','127.0.0.1'];G(a,olympe.N.U.Wk,'object'===typeof window&&window.location&&window.location.hostname||b[1]);var c=a.getParameter(olympe.N.U.Wk);G(a,olympe.N.U.nh,c);var d=a.getParameter(olympe.N.U.nh);const e=b.includes(d);d=e||d.endsWith(a.getParameter(olympe.net.U.rj));G(a,olympe.N.U.Lj,e?8080:d?80:443);G(a,olympe.N.U.Mj,!d);G(a,olympe.N.U.Hk,'OlympeServer');G(a,olympe.N.U.Qq,'websocket');G(a,olympe.N.U.Ol,5E3);G(a,olympe.N.U.Kp,5E3);G(a,olympe.N.U.Pq,
|
|
472
|
+
15E3);G(a,olympe.N.U.bq,5E3);G(a,olympe.N.U.qq,'7.2.2');G(a,olympe.N.U.Kk,c);c=a.getParameter(olympe.N.U.Kk);c=(b=b.includes(c))||c.endsWith(a.getParameter(olympe.net.U.rj));G(a,olympe.N.U.An,b?'':'/mqtt');G(a,olympe.N.U.Bn,b?15675:c?80:443);G(a,olympe.N.U.En,!c);G(a,olympe.N.U.Gn,b?'/':'');G(a,olympe.N.U.Ge,30);G(a,olympe.N.U.Dn,5E3);G(a,olympe.N.U.Cn,3E4);G(a,olympe.N.U.Fn,6E4);G(a,olympe.N.U.Jk,!1);b=a.getParameter(olympe.Wf.U.yo);if(void 0!==b)ya(a,olympe.N.U.Pk,b);else throw Error('Framework version could not be found! Is field "olympe-framework" present in version.json?');
|
|
473
|
+
F(a,olympe.N.R.Ca,[olympe.ma.R.Ha],g=>g.Oc('communication'));F(a,'server.WebSocketRequest',[new olympe.W.ja(olympe.N.U.nh),new olympe.W.ja(olympe.N.U.Lj),new olympe.W.ja(olympe.N.U.Mj),new olympe.W.ja(olympe.N.U.Hk),new olympe.W.ja(olympe.N.U.Qq)],(g,h,k,l,n)=>new olympe.net.zi(g,h,(l+'/'+n).replace(/\/+/g,'/').replace(/\/$/,''),k));F(a,'server.wakeUpRequest',[new olympe.W.ja(olympe.N.U.nh),new olympe.W.ja(olympe.N.U.Lj),new olympe.W.ja(olympe.N.U.Mj),new olympe.W.ja(olympe.N.U.su)],(g,h,k,l)=>{if(null===
|
|
474
|
+
l||void 0===l)return null;l=l.replace(/\/+/g,'/').replace(/\/$/,'');return new olympe.net.zi(g,h,l,k)});const f=Array.from(Object.values(olympe.N.$b));F(a,olympe.N.R.Hq,[new olympe.W.ja(olympe.N.U.nh),new olympe.W.ja(olympe.N.U.Lj),new olympe.W.ja(olympe.N.U.Mj),new olympe.W.ja(olympe.N.U.Hk),...f.map(g=>new olympe.W.ja(g))],(g,h,k,l,...n)=>{const p=f.map((q,r)=>{r=n[r];r=(new olympe.net.ai(g,h,`${l}${r?'/'+r:''}`.replace(/\/+/g,'/').replace(/\/$/,''),k)).C();return[q,r]});return new Map(p)});E(a,
|
|
475
|
+
olympe.N.R.ae,olympe.N.ug);E(a,olympe.N.R.jl,olympe.N.Js,olympe.N.R.Ca,olympe.net.R.Ha,olympe.Y.R.Lf,olympe.N.R.Hq);F(a,'com.server.ManagerConfig',[new olympe.W.ja(olympe.N.U.Kp),new olympe.W.ja(olympe.N.U.Pq),new olympe.W.ja(olympe.N.U.Pk),new olympe.W.ja(olympe.N.U.qq),new olympe.W.ja(olympe.dc.U.oh),new olympe.W.ja(olympe.N.U.bq)],(...g)=>{const h='pingInterval messageTimeout clientVersion serverVersion getContextMode retryHttpOverload'.split(' '),k=new Map;g.forEach((l,n)=>k.set(h[n],l));return k});
|
|
476
|
+
E(a,olympe.N.R.Kj,olympe.N.Va,olympe.N.R.Ca,olympe.net.R.Ha,olympe.host.R.Je,olympe.host.R.Qj,'server.WebSocketRequest','server.wakeUpRequest',olympe.Y.R.Lf,'com.server.ManagerConfig');F(a,'com.bus.ManagerConfig',[new olympe.W.ja(olympe.N.U.nh),new olympe.W.ja(olympe.N.U.Kk),new olympe.W.ja(olympe.N.U.An),new olympe.W.ja(olympe.N.U.Bn),new olympe.W.ja(olympe.N.U.Gn),new olympe.W.ja(olympe.N.U.En),new olympe.W.ja(olympe.N.U.Jk),new olympe.W.ja(olympe.N.U.Dn),new olympe.W.ja(olympe.N.U.Cn),new olympe.W.ja(olympe.N.U.Fn),
|
|
477
|
+
new olympe.W.ja(olympe.N.U.Ge),new olympe.W.ja(olympe.N.U.ju),new olympe.W.ja(olympe.N.U.bs),new olympe.W.ja(olympe.N.U.Zr),new olympe.W.ja(olympe.N.U.Ol),new olympe.W.ja(olympe.N.U.es),new olympe.W.ja(olympe.N.U.fu)],(g,h,k,l,n,p,q,r,t,u,...w)=>{h=`${p?'wss://':'ws://'}${h}:${l}${k}/ws`;const y='keepalive reschedulePings clientId clean reconnectPeriod connectTimeout queueQoSZero shortTimeout requestTimeout'.split(' ');w=w.reduce((z,A,C)=>{z[y[C]]=A;return z},{});w.vhost=`${n||g.split('.')[0]}`;return new Map([['url',
|
|
478
|
+
h],['connectionOptions',w],['allowGuest',q],['shortTimeout',r],['requestTimeout',t],['subscriptionsRefreshRate',u]])});E(a,olympe.N.R.zn,olympe.N.In,olympe.N.R.Ca,olympe.net.R.Ha,olympe.N.R.Ze,olympe.auth.R.Ha,olympe.host.R.Je,olympe.N.R.ae,olympe.Y.R.Lf,'com.bus.ManagerConfig');F(a,'com.connectivity.ManagerConfig',[olympe.net.R.Dl,olympe.Bb.R.tg,new olympe.W.ja(olympe.N.U.Ol)],(g,...h)=>['storagePrefix','reconnectionDelay'].reduce((k,l,n)=>k.set(l,h[n]),g));E(a,olympe.N.R.Ze,olympe.N.pc,olympe.N.R.Ca,
|
|
479
|
+
olympe.N.R.Kj,olympe.net.R.Ha,olympe.host.R.Je,olympe.Bb.R.wl,'com.connectivity.ManagerConfig')},'olympe.communication');olympe.W.run([olympe.N.R.zn,olympe.N.R.Ze],(a,b)=>{olympe.N.Eg=()=>a;olympe.N.Am=()=>b});olympe.N.operators={};olympe.N.operators.Ri=(a,b,c=5E3)=>rxjs.operators.retry({resetOnSuccess:!0,delay:(d,e)=>{if(d instanceof a){const f=Math.round(Math.random()*(e+1)*c);return rxjs.timer(f).pipe(rxjs.operators.tap(()=>null==b?void 0:b(d,f)))}return rxjs.throwError(()=>d)}});olympe.auth={};function Xd(a,b){td(a.C);jd(a.C,olympe.N.He.jg,c=>{const d=c.c;d===olympe.auth.dd.C.Bt?(a.C.Od(),b(olympe.auth.Ta.F.Wi,c)):d===olympe.auth.dd.C.pu&&b(olympe.auth.Ta.F.Ro,c)},'logoutHandler')}
|
|
480
|
+
function Yd(a,b,c){const d=null==b?void 0:b.ff();if(b instanceof olympe.auth.zj){const e=g=>{const h=Object.create(null);h.url=g;h.olympe_token=b.sd();h.access_token=Zd(b);g=`${fd(a.bh,olympe.N.$b.wj)}/logout${d?`?idpName=${d}`:''}`;a.F.redirect(g,h)};c=a.F.C();const f=new URL(c);0!==f.hash.length||0!==f.search.length?(f.hash='',f.search='',a.G.db.set('main',c,'redirectTo').then(()=>{e(f.toString())}).catch(g=>{a.H.error(`Error when trying to set the redirectKey in Auth store: ${g}`)})):e(c)}else qd(a.C,
|
|
481
|
+
olympe.N.He.jg,Object.assign({},{c:olympe.auth.dd.C.Ct},d&&{idpName:d}),c)}function $d(a,b,c,d){olympe.D.Ra(a.L.getState())===olympe.N.pc.C.$d?d(new olympe.N.errors.Gp('Working offline'),'Working offline'):(c.c=b,qd(a.C,olympe.N.He.jg,c,d))}
|
|
482
|
+
function ae(a,b,c){if(b.ig()!==olympe.auth.wc.C.OAUTH2)c(Error('Only oAuth2 tokens can be refreshed'),null);else{var d=`?idpName=${b.ff()}&access_token=${Zd(b)}`;d=`${fd(a.bh,olympe.N.$b.wj)}/refresh${d}`;hd(a.bh,P(d),b.sd()).then(e=>{'string'===typeof e?(e=JSON.parse(e),e=new olympe.auth.zj(b.uc(),b.ke(),b.sd(),e,b.ff()),c(null,e)):c(null,b)}).catch(e=>c(Error(e),null))}}
|
|
483
|
+
olympe.auth.dd=class{constructor(a,b,c,d,e,f){this.H=a;this.C=b;this.bh=c;this.L=d;this.F=e;this.G=f;be(this.G).then(g=>{g&&this.G.db.remove('main','redirectTo').then(()=>{this.F.redirect(g,null,olympe.auth.Jj.C.GET)}).catch(h=>{this.H.error(`Error when trying to remove redirect key from AUTH storage: ${h}`)})}).catch(g=>{this.H.error(`Error when trying to get redirect key from AUTH storage: ${g}`)})}Xe(a){qd(this.C,olympe.N.He.jg,{c:olympe.auth.dd.C.Ge},b=>a(b))}Mg(a,b,c){const d=fd(this.bh,olympe.N.$b.Jq);
|
|
484
|
+
a=P(`${d}/${a}`);hd(this.bh,a,b).then(e=>c(null,e)).catch(e=>c(Error(e)))}};olympe.auth.dd.C={jg:1,Ct:2,Eb:3,Ge:5,pi:6,Ms:10,Au:11,Kr:12,SAML:13,pu:14,Bt:20};function Wc(a,b){var c='busLogoutCallback';void 0===c&&(c=olympe.Y.Ah());a.oa.set(c,b)}function Nc(a){return olympe.D.Ra(a.C.rb())}
|
|
485
|
+
function yd(){var a=olympe.auth.he();const b=olympe.auth.Ta.C.Xi,c=olympe.auth.Ta.C.INIT;ce(a,b);a.jb?(a.G=olympe.auth.Ta.G.Jr,a.H.log('Connector online, parameter auth.autoLogin=true --\x3e attempting to log with parameters'),de(a)):(a.G=olympe.auth.Ta.G.si,a.H.log('Connector online, attempting to log with token'),ee(a));return rxjs.firstValueFrom(a.F.rb().asObservable().pipe(rxjs.operators.filter(d=>!(d===b||d===c)))).catch(()=>{})}
|
|
486
|
+
function fe(a){a.H.info('Initializing AUTH layer');let b=a.hc;if(a.fa){const c=a.fa.F();b=null!=c?c:b;c&&a.fa.C().then(()=>{})}b&&a.storage&&ge(a.storage,b).catch(c=>a.H.error(c));a.H.debug('Asking to be notified when auth connector gets online');olympe.D.Gc([a.ob.getState()],c=>{switch(c){case olympe.N.pc.C.$d:a.G=olympe.auth.Ta.G.si;a.H.log('Connector offline, attempting to recover sessions from current token');ee(a);break;case olympe.N.pc.C.Wd:switch(olympe.D.Ra(a.F)){case olympe.auth.Ta.C.Cf:c=
|
|
487
|
+
olympe.D.Ra(a.C).uc();he(a,`Disconnected from server - session of user ${c} lost`);break;case olympe.auth.Ta.C.Yh:a.H.info('Disconnected from server - guest session lost');break;case olympe.auth.Ta.C.Xi:he(a,'Disconnected from server - authentication aborted');break;case olympe.auth.Ta.C.INIT:he(a,'Cannot open auth session - no server connection');break;default:he(a,'Should not get there, investigate',!0)}}});Xd(a.L,(c,d)=>{if(c===olympe.auth.Ta.F.Wi)he(a,'authentication revoked'),a.storage&&ie(a.storage),
|
|
488
|
+
a.oa.forEach(e=>{e(c,d)});else if(c===olympe.auth.Ta.F.Ro)a.H.info('Redirection to IDP to invalidate token (SAML)'),Nc(a),a.storage&&ie(a.storage),a.tb.F();else throw Error(`Unknown logout step coming from server : ${c}`);});a.Ja=je(a);a.T.F(()=>a.Ih().catch(c=>a.H.error(`Failed to logout ${c}`)),'Logout');a.H.log('DONE initializing AUTH layer (waiting for connector to be online)')}
|
|
489
|
+
function ke(a,b){let c=null;olympe.D.Ki(a.F.rb().vd(olympe.auth.Ta.C.Cf).and(b),()=>{const d=Nc(a);!le(a)&&d&&(c=a.Jd.get(d.ig()).L(d,(e,f)=>{e?(a.H.error('Failed to refresh token, error message: ',e.message),a.Ih().catch(g=>a.H.error(`Failed to logout after wrong refresh ${g}`))):f&&me(a,f)}))},()=>{let d;null==(d=c)||d()})}
|
|
490
|
+
function ee(a){null!==a.storage?(a.H.debug('Retrieving token from local storage'),a.storage.je().then(b=>{if(b){const e=new olympe.auth.Request;var c=b.uc();e.set('username',c);c=e;var d=b.sd();c.set('nonce',d);'string'===typeof b.ff()&&e.set('idpName',b.ff());a.H.debug('Token found, trying login with',e);ne(a,e,olympe.auth.wc.C.El)}else he(a,'No token found, cannot perform auto login')}).catch(b=>{he(a,b.message,!0)})):he(a,'Cannot retrieve token: no storage configured, cannot perform auto login',
|
|
491
|
+
!0)}function he(a,b,c=!1){a.C.update(a.ba);ce(a,olympe.auth.Ta.C.Yh);b=`Authenticated as guest (${b})`;c?a.H.error(b):a.H.info(b)}function je(a){const b=[olympe.auth.Ta.C.Cf];a.jb||b.push(olympe.auth.Ta.C.Yh);return a.T.C(()=>{const c=oe(a);return b.includes(c)?Promise.resolve('The auth manager is OK'):Promise.reject(`The auth manager is not in valid state, the current state is: ${c}`)})}function ce(a,b){a.H.log('State change: ',oe(a),'--\x3e',b);a.F.update(b)}
|
|
492
|
+
function de(a){if(a.Z){const b=new olympe.auth.Request;b.set('username',a.Z);b.set('password',a.Kb);a.H.log('Autologin with user "'+a.Z+'"');ne(a,b)}else he(a,'No user specified for auto login',!0)}function le(a){return olympe.D.Ra(a.C)===a.ba}function me(a,b){if(b){a.C.update(b);let c;null==(c=a.storage)||ge(c,b).catch(d=>a.H.error(d));a.H.debug('Token updated')}}function oe(a){return olympe.D.Ra(a.F.rb())}function pe(){var a=olympe.public.Ia.get();return new Map(a.L.C.Kc)}
|
|
493
|
+
function qe(a,b,c,d=!1){b=b+c?':'+c.message:'';a.H.error(b);a.error.update(olympe.D.xb(b));ce(a,olympe.auth.Ta.C.Eb);if(d)throw Error(b);}function ne(a,b,c,d){void 0===c&&(c=a.ac);void 0===c&&qe(a,'No authentication provider specified',null,!0);const e=a.Jd.get(c);e||qe(a,'Undefined authentication provider "'+c+'"',null,!0);d&&a.O.set('login',d);a.H.log('Sending authentication request using "'+c+'" for '+b);e.je(b,a.Tb.bind(a));ce(a,olympe.auth.Ta.C.Xi)}
|
|
494
|
+
function re(a,b,c){a.O.forEach(d=>{d(b,c)})}
|
|
495
|
+
olympe.auth.Ta=class{constructor(a,b,c,d,e,f,g,h,k,l){this.H=a;this.ob=b;this.L=c;this.storage=d;this.tb=e;this.fa=f;this.ac=l.get('defaultProvider');this.jb=!!l.get('autoLogin');this.Z=l.get('autoUser');this.Kb=l.get('autoPassword');this.hc=l.get('autoToken');this.Jd=new Map;this.T=g;this.Ja='';this.F=olympe.D.fc(String).update(olympe.auth.Ta.C.INIT);this.error=olympe.D.fc(olympe.D.Na);this.G=null;this.ba=new olympe.auth.zg('guest','0163d9653067b6237f62','e96e099c-55bb-4004-b0e8-bd76b6209218');this.C=
|
|
496
|
+
olympe.D.fc(olympe.auth.zg).update(this.ba);this.O=new Map;this.oa=new Map;this.za=new olympe.Y.$l(l.get('cacheTokenTimeout'));k.forEach(n=>{const p=n.G();if(this.Jd.has(p))throw Error('Provider "'+p+'" has already been registered !');this.Jd.set(p,n)});fe(this);ke(this,h.C())}rk(){const a=olympe.auth.Ta.C.Cf,b=olympe.auth.Ta.C.Yh,c=olympe.auth.Ta.C.Eb,d=olympe.D.fc(olympe.D.ea);olympe.D.Gc([this.F],e=>{e===a?d.update(olympe.D.ea.F):e===b?d.update(olympe.D.ea.C):e===c?(this.H.error('Authentication failed.'),
|
|
497
|
+
d.update(olympe.D.ea.C)):d.clear()});return d.rb()}Xf(a){if(olympe.D.Ra(this.F)===olympe.auth.Ta.C.Cf){var b=Nc(this);!le(this)&&b&&this.Jd.get(b.ig()).Xf(b,(c,d)=>{c?(this.H.error('Failed to refresh token, error message: ',c.message),this.Ih().catch(e=>this.H.error(`Failed to logout after wrong refresh ${e}`))):d&&me(this,d);a(c)})}}getState(){return this.F.rb()}uc(){return this.C.rb().uc()}ke(){return this.C.rb().ke()}Ch(){return this.C.rb().Ch()}Mg(a,b){if(Ia(this.za.C,a))b(null,this.za.get(a));
|
|
498
|
+
else{var c,d=null==(c=olympe.D.Ra(this.C.rb()))?void 0:c.sd();this.L.Mg(a,d,(e,f)=>{'string'===typeof f&&this.za.set(a,f);b(e,f)})}}Ih(){return le(this)?(this.H.warn('Logout called for Guest user so it will be ignored'),Promise.resolve()):new Promise((a,b)=>{this.H.debug('Sending logout');ie(this.storage);Yd(this.L,Nc(this),c=>{c?(qe(this,'Logout request rejected:',c),b(c)):(this.H.debug('Logout request acknowledged'),a())});this.T.G(this.Ja)})}Xe(a){oe(this)===olympe.auth.Ta.C.Cf&&this.L.Xe(b=>{b&&
|
|
499
|
+
this.H.error('Was not able to send the auth keep alive message:',b.message);null==a||a(b)})}Tb(a,b){const c=null===this.G?olympe.auth.Ta.G.It:this.G;this.G=null;if(!a||a instanceof olympe.N.errors.Gp){null===a?this.H.info(`User ${b.uc()} (#${b.ke()}) successfully authenticated`):this.H.info(`User ${b.uc()} (#${b.ke()}) recovered from token, while offline`);this.C.update(b);ce(this,olympe.auth.Ta.C.Cf);re(this,a,c);let d;null==(d=this.storage)||ge(d,b).catch(e=>this.H.error(e))}else{let d;null==(d=
|
|
500
|
+
this.storage)||ie(d).catch(e=>this.H.error(e));this.error.update(olympe.D.xb(a.message));he(this,'authentication rejected: '+a.message);re(this,a,c)}this.O.has('login')&&this.O.delete('login')}};olympe.auth.Ta.C={INIT:'init',Xi:'authenticating',Yh:'guest',Cf:'authenticated',Eb:'error'};olympe.auth.Ta.G={It:'manual',Jr:'auto',si:'tokenOnFirstConnection'};olympe.auth.Ta.F={Wi:'accepted',Ro:'redirect'};olympe.auth.wc=class{constructor(a,b){this.H=a;this.F=b;this.C=null}G(){}je(){}L(a,b){const c=()=>{this.C=setTimeout(()=>this.F.Xe(d=>{d?b(d,null):(b(null,null),c())}),this.F.C.hc)};c();return()=>{this.C&&clearTimeout(this.C);this.C=null}}Xf(a,b){this.F.Xe(c=>{b(c,null)})}};olympe.auth.wc.C={SAML:'saml',OAUTH2:'openID',SRP:'srp',El:'olympeToken'};function se(a){return a.get('idpName')}olympe.auth.Request=class{constructor(){this.C=new Map}set(a,b){olympe.D.Gc([b],c=>{this.C.set(a.toLocaleLowerCase(),c.toString())})}get(a){(a=this.C.get(a.toLowerCase()))&&a.Ag&&(a=a.Da.Db);return a?a.valueOf():a}uc(){return this.get('username')}sd(){return this.get('nonce')}toString(){return this.uc()+(this.sd()?' with nonce':'')+(this.get('password')?' with password':'')+(se(this)?` with idp name ${se(this)}`:'')}};olympe.auth.zg=class{constructor(a,b,c,d={},e=null){this.L=a;this.Lh=b;this.F=c;this.C=e;this.G=d}uc(){return this.L}ke(){return this.Lh}sd(){return this.F}di(){return this.G}Ch(){return null}ff(){return this.C}ha(){const a=olympe.Y.Se(),b=Object.assign({},{user:this.L,userTag:this.Lh,nonce:this.F},this.C&&{idpName:this.C},{payload:this.G});return olympe.Y.Xq(Fa(a,JSON.stringify(b)))}ig(){return olympe.auth.wc.C.SRP}};m=olympe.auth.zg.prototype;m.uc.K=new olympe.D.J(()=>String,[]);
|
|
501
|
+
m.ke.K=new olympe.D.J(()=>String,[]);m.sd.K=new olympe.D.J(()=>String,[]);m.di.K=new olympe.D.J(()=>Object,[]);m.Ch.K=new olympe.D.J(()=>String,[]);m.ff.K=new olympe.D.J(()=>String,[]);m.ha.K=new olympe.D.J(()=>String,[]);m.ig.K=new olympe.D.J(()=>String,[]);function Zd(a){return a.di().access_token||null}function te(a){return 1E3*parseInt(a.di().access_token_exp||'0',10)}olympe.auth.zj=class extends olympe.auth.zg{constructor(a,b,c,d,e){super(a,b,c,d,e);this.O=Date.now()}Ch(){return Zd(this)}ig(){return olympe.auth.wc.C.OAUTH2}};olympe.auth.lq=class extends olympe.auth.zg{constructor(a,b,c,d,e,f){super(a,b,c,e,f);this.O=d}Ch(){return this.O}ig(){return olympe.auth.wc.C.SAML}ha(){const a=olympe.Y.Se(),b=Object.assign({},{user:this.uc(),userTag:this.ke(),nonce:this.sd()},this.ff()&&{idpName:this.ff()},{payload:this.di(),fullToken:this.O});return olympe.Y.Xq(Fa(a,JSON.stringify(b)))}};function be(a){let b;return null!=(b=a.db.get('main','redirectTo'))?b:null}function ge(a,b){return Ea(a.F,()=>a.db.set('main','string'===typeof b?b:b.ha(),a.C).catch(c=>{throw Error(`Error when trying to set the token from the auth store: ${c}`);}))}function ie(a){return Ea(a.F,()=>a.db.remove('main',a.C).catch(b=>{a.H.error(`Error when trying to remove the token from the auth store: ${b}`)}))}
|
|
502
|
+
olympe.auth.Rr=class{constructor(a,b,c){this.G=a;this.H=b;this.C='OlympeToken-'+c.C;this.F=new olympe.Y.promise.Aq;this.db=this.G.F('AUTH')}je(){this.H.debug(`olympe.auth.AuthStorage: retrieve token with key ${this.C}`);return Ea(this.F,()=>{const a=this;return x(function*(){let b;try{b=yield a.db.get('main',a.C)}catch(g){throw Error(`Error when trying to get the token from the auth store: ${g}`);}let c=null;if(b)try{a.H.debug('olympe.auth.AuthStorage: Token retrieved successfully');var d=JSON,e=
|
|
503
|
+
d.parse;var f=Ga(olympe.Y.Se().G(olympe.Y.ov(b)));const g=e.call(d,f);let h;g.fullToken?h=new olympe.auth.lq(g.user,g.userTag,g.nonce,g.fullToken,g.payload,g.idpName):g.payload&&g.payload.id_token?h=new olympe.auth.zj(g.user,g.userTag,g.nonce,g.payload,g.idpName):h=new olympe.auth.zg(g.user,g.userTag,g.nonce,g.payload,g.idpName);c=h}catch(g){throw Error(`Error while unserializing token: ${g}`);}else a.H.debug('olympe.auth.AuthStorage: No token found');return c})})}};olympe.auth.Jj=class{redirect(){}F(){}C(){}};olympe.auth.Jj.C={GET:'GET',ih:'POST'};olympe.auth.rn=class{constructor(a){this.C=a||'default'}};olympe.auth.Jd={};function ue(a,b,c){$d(a.F,olympe.auth.dd.C.jg,{token:b.sd()},(d,e)=>{if(null!==d)c(d,null);else switch(e.c){case olympe.auth.dd.C.Eb:c(Error('Invalid token'),null);break;case olympe.auth.dd.C.pi:d=null;if(e=e.payload){const f=e.userName,g=e.userTag,h=e.rndCook,k=e.payload,l=e.protocol;'SAML'===l?d=new olympe.auth.lq(f,g,h,e.samlToken,k,se(b)):'openid'===l&&(d=new olympe.auth.zj(f,g,h,k,se(b)))}c(null,d);break;default:c(Error('Unknown response from server'),null)}})}
|
|
504
|
+
olympe.auth.Jd.Ht=class extends olympe.auth.wc{constructor(a,b,c){super(a,b);this.storage=c}G(){return olympe.auth.wc.C.El}je(a,b){this.storage.je().then(c=>{ue(this,a,(d,e)=>{b(d,null!=e?e:c)})}).catch(c=>{b(c,null)})}};function ve(a,b,c){var d=te(b);const e=Math.max(d-b.O,0),f=olympe.W.getParameter(olympe.auth.U.Dq);d=Math.max(Math.round(d-e*(1-Math.max(Math.min((f||50)/100,.95),0))-Date.now()),0);if(0<d)return setTimeout(()=>{a.Xf(b,c)},d);a.Xf(b,c);return null}
|
|
505
|
+
olympe.auth.Jd.Vt=class extends olympe.auth.wc{constructor(a,b,c,d){super(a,b);this.O=c;this.T=d}G(){return olympe.auth.wc.C.OAUTH2}je(a){const b=encodeURIComponent(this.O.C());a=se(a)?`idpName=${se(a)}&`:'';this.O.redirect(`${this.T}/auth?${a}url=${b}`,null,olympe.auth.Jj.C.GET)}L(a,b){0<te(a)?this.C=ve(this,a,b):b(null,a);return this.Z.bind(this)}Xf(a,b){ae(this.F,a,(c,d)=>{c?b(c,null):d&&(b(null,d),this.C&&(this.C=ve(this,d,b)))})}Z(){this.C&&clearTimeout(this.C);this.C=null}};function we(a,b){$d(a.F,olympe.auth.dd.C.SAML,{},(c,d)=>{null!==c?b(c):d.url&&d.request?b(null,d.url,d.request.replace(/\s/g,''),d.id):b(Error('Missing parameters from server response'))})}olympe.auth.Jd.SAML=class extends olympe.auth.wc{constructor(a,b,c){super(a,b);this.O=c}G(){return olympe.auth.wc.C.SAML}je(a,b){we(this,c=>{c?b(c,null):this.O.F(se(a))})}};function xe(a,b,c){const d=olympe.auth.dd.C.Ms,e=olympe.auth.dd.C.Eb,f=olympe.auth.dd.C.Au,g={I:b.uc()};$d(a.F,d,g,(h,k)=>{if(null!==h)c(h);else switch(k.c){case e:c(Error(`Username '${b.uc()}' invalid, or password does not match`));break;case f:h=k.payload;c(null,h.S,h.B);break;default:c(Error('Unknown response from server'))}})}
|
|
506
|
+
function ye(a,b,c){const d=olympe.auth.dd.C.Kr,e=olympe.auth.dd.C.Eb,f=olympe.auth.dd.C.pi;b={A:b.get('a'),M:b.get('m1'),I:b.uc()};$d(a.F,d,b,(g,h)=>{if(null!==g)c(g,null);else switch(h.c){case e:a.H.debug('Login failed, invalid username or password');c(Error('Invalid username or password'),null);break;case f:g=h.payload;a.H.debug('Login successful, creating token');h=g.payload?JSON.parse(g.payload):void 0;c(null,new olympe.auth.zg(g.userName,g.userTag,g.rndCook,h));break;default:c(Error(`Unknown response from server (type ${h.c})`),
|
|
507
|
+
null)}})}olympe.auth.Jd.SRP=class extends olympe.auth.wc{G(){return olympe.auth.wc.C.SRP}je(a,b){const c=a.get('password');a.C.delete('password');this.H.debug('Sending SRP request');xe(this,a,(d,e,f)=>{this.H.debug('Received Salt+B message');if(d)b(d,null);else{try{const g=new SRPClient;g.step1(a.uc(),c);const h=g.step2(e,f);a.set('a',h.A);a.set('m1',h.M1)}catch(g){b(g,null);return}this.H.debug('Sending SRP A+M (proof) message');ye(this,a,b)}})}};olympe.auth.R={Ha:'auth.Manager',Ca:'auth.Logger',oi:'auth.Storage',Ck:'auth.appNameToken',Gj:'auth.Redirector',oq:'auth.ServerConnector'};olympe.auth.U={Xk:'auth.defaultProvider',kn:'auth.autoLogin',mn:'auth.autoUser',ln:'auth.autoPassword',si:'auth.token',Kn:'auth.cacheTokenTimeout',Dq:'auth.tokenDurationPercentage'};
|
|
508
|
+
olympe.W.config(function(a){G(a,olympe.auth.U.Xk,olympe.auth.wc.C.SRP);G(a,olympe.auth.U.kn,!1);G(a,olympe.auth.U.mn,'');G(a,olympe.auth.U.ln,'');G(a,olympe.auth.U.si,'');G(a,olympe.auth.U.Dq,50);G(a,olympe.auth.U.Kn,3E5);F(a,olympe.auth.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('auth'));E(a,olympe.auth.R.Ck,olympe.auth.rn,olympe.Bb.R.tg);E(a,olympe.auth.R.oi,olympe.auth.Rr,olympe.Bb.R.qj,olympe.auth.R.Ca,olympe.auth.R.Ck);E(a,olympe.auth.R.oq,olympe.auth.dd,olympe.auth.R.Ca,olympe.N.R.Kj,olympe.N.R.jl,olympe.N.R.Ze,
|
|
509
|
+
olympe.auth.R.Gj,olympe.auth.R.oi);xa(a,olympe.auth.R.Gj);F(a,olympe.auth.R.Ha,[olympe.auth.R.Ca,olympe.N.R.Ze,olympe.auth.R.oq,olympe.host.R.gl,olympe.host.R.Je,olympe.host.R.Qj,new olympe.W.wb(olympe.auth.R.oi,olympe.W.Xg.C.Bl),new olympe.W.wb(olympe.auth.R.Gj,olympe.W.Xg.C.Bl),new olympe.W.ja(olympe.auth.U.Xk),new olympe.W.ja(olympe.auth.U.kn),new olympe.W.ja(olympe.auth.U.mn),new olympe.W.ja(olympe.auth.U.ln),new olympe.W.ja(olympe.auth.U.si),new olympe.W.ja(olympe.auth.U.Kn)],(b,c,d,e,f,g,h,
|
|
510
|
+
k,l,n,p,q,r,t)=>{const u=[new olympe.auth.Jd.Ht(b,d,h),new olympe.auth.Jd.SRP(b,d),new olympe.auth.Jd.SAML(b,d,k),new olympe.auth.Jd.Vt(b,d,k,fd(d.bh,olympe.N.$b.wj))];if(!u.map(w=>w.G()).includes(l))throw Error(`Default provider name ${l} given by parameter ${olympe.auth.U.Xk} cannot be found`);return new olympe.auth.Ta(b,c,d,h,k,e.Li()?e:null,f,g,u,new Map([['defaultProvider',l],['autoLogin',n],['autoUser',p],['autoPassword',q],['autoToken',r],['cacheTokenTimeout',t]]))},!0)},'olympe.auth');
|
|
511
|
+
olympe.W.run([olympe.auth.R.Ha],a=>{olympe.auth.he=()=>a});olympe.Sa.node.auth={};olympe.Sa.node.auth.yp=class{redirect(){console.warn('Redirection n/a in Node.JS')}F(){console.warn('Redirection n/a in Node.JS')}C(){console.warn('Redirection n/a in Node.JS');return''}};olympe.Sa.node.auth.yp.xa=[olympe.auth.Jj];olympe.W.config(a=>{E(a,olympe.auth.R.Gj,olympe.Sa.node.auth.yp)},'olympe.native.node.auth');olympe.Sa.node.Bb={};function ze(){throw Error('Key-Value Database does not implement this in NodeJS');}
|
|
512
|
+
olympe.Sa.node.Bb.wp=class{constructor(a){this.H=a;this.C=new Map}Z(){return 0}O(a){const b=this;return x(function*(){let c,d;return null!=(d=null==(c=b.C.get(a))?void 0:c.size)?d:0})}G(a){const b=this;return x(function*(){const c=b.C.get(a);return c?Array.from(c.values()):[]})}T(a){const b=this;return x(function*(){const c=b.C.get(a);return c?Array.from(c.keys()):[]})}forEach(a,b){const c=this;return x(function*(){let d;for(const [e,f]of null!=(d=c.C.get(a))?d:new Map)b(f,e)})}has(a,b){const c=this;
|
|
513
|
+
return x(function*(){let d,e;return null!=(e=null==(d=c.C.get(a))?void 0:d.has(b))?e:!1})}get(a,b){const c=this;return x(function*(){let d;return null==(d=c.C.get(a))?void 0:d.get(b)})}set(a,b,c){const d=this;return x(function*(){let e;return null==(e=d.C.get(a))?void 0:e.set(c,b)})}remove(a,b){const c=this;return x(function*(){let d;yield null==(d=c.C.get(a))?void 0:d.delete(b)})}fa(){ze();return Promise.resolve()}ba(){ze();return Promise.resolve()}clear(a){const b=this;return x(function*(){let c;
|
|
514
|
+
null==(c=b.C.get(a))||c.clear()})}L(){ze();return Promise.resolve([])}F(){return x(function*(){ze()})}};olympe.Sa.node.Bb.wp.xa=[olympe.Bb.wt];olympe.Sa.node.Bb.xp=class{constructor(a){this.C=new Map;this.H=a}F(a){this.C.has(a)||this.C.set(a,new olympe.Sa.node.Bb.wp(this.H));return this.C.get(a)}};olympe.Sa.node.Bb.xp.xa=[olympe.Bb.xt];olympe.W.config(function(a){E(a,olympe.Bb.R.qj,olympe.Sa.node.Bb.xp,olympe.Bb.R.Ca)},'olympe.native.node.localstorage');olympe.Sa.node.storage={};olympe.Sa.node.storage.Storage=class{constructor(a){this.H=a}write(a,b,c,d,e){e&&e('Not Implemented.')}open(a){a(null)}close(a){a(null)}};olympe.Sa.node.storage.Storage.xa=[olympe.Bb.Storage];olympe.W.config(function(a){va(a,olympe.Bb.R.oi,olympe.Sa.node.storage.Storage,olympe.host.R.Ca)},'olympe.native.html.storage');olympe.Wf={};olympe.Wf.U={VERSION:'version.version',Vr:'version.branch',Ye:'version.commit',Hu:'version.tag',yo:'version.olympe-framework',Wr:'version.build'};olympe.W.config(function(a){G(a,olympe.Wf.U.VERSION,'');G(a,olympe.Wf.U.Vr,'');G(a,olympe.Wf.U.Ye,'');G(a,olympe.Wf.U.Hu,'');G(a,olympe.Wf.U.yo,'');G(a,olympe.Wf.U.Wr,'')},'olympe.main');const Ae=require('fs');let Aa,za;function Be(a,b){Ae.readFile(a,(c,d)=>{c?b(Object.create(null)):(d=JSON.parse(d),b(d))})}
|
|
515
|
+
function Ce(){if(void 0!==Aa&&void 0!==za){0===Object.keys(za).length&&console.warn('No configuration found. Check presence of oConfig.json');0===Object.keys(Aa).length&&console.warn('No version found. Check presence of version.json');var a=Object.create(null);const b=process.argv;for(let c=2;c<b.length;c++){const d=/^true|false$/i,e=/^\d+(\.\d+)?$/;let f;const g=/([^?&=]+)(=?([^?&=]+))?/g.exec(b[c]);!Array.isArray(g)||4>g.length?console.warn(`Malformed config parameter "${b[c]}" ignored. It should of the form 'a=b'`):
|
|
516
|
+
(f=g[3],void 0===f?f=!0:f.startsWith('"')&&f.endsWith('"')?f=f.substring(1,f.length-1):d.test(f)?f='true'===f.toLowerCase():e.test(f)&&(f=parseFloat(f)),a[g[1]]=f)}a=new olympe.W.ms(a);na(a);pa(a.compile())}}function De(){console.log('The node process received a signal for graceful shutdown');let a,b;null==(b=(a=olympe.Sa.node.host).jk)||kc(b.call(a)).then(()=>console.log('The node backend has stopped successfully')).catch(c=>console.warn(c)).finally(()=>process.exit(0))}
|
|
517
|
+
olympe.Y.xe('oConfig.json',Be,function(a){za=a;Ce()});Be('version.json',function(a){Aa=a;Ce()});process.on('SIGTERM',De);process.on('SIGINT',De);process.on('SIGBREAK',De);process.on('SIGHUP',De);process.on('uncaughtException',a=>{console.error('Uncaught Exception:',a);De()});olympe.dc={};olympe.dc.ua={ORIGIN:'<',DESTINATION:'>'};B('olympe.dc.Direction',olympe.dc.ua);olympe.dc.qc={$c:'ff022000000000000000',Uh:'ff02200000000000000e',cj:'ff02200000000000000f'};olympe.dc.ap={VERSION:'@v',tq:'@s'};olympe.dc.pj={Ee:'?'};olympe.dc.TA={li:'online',$d:'offline',Ez:'invalidate'};olympe.dc.Pa={SELF:'self',SERVER:'server',jf:'remote',$d:'offline'};olympe.dc.ec={NONE:null,io:'ff023000000000000037',zc:'ff023000000000000137',Mf:'ff023000000000000237',wu:'ff023000000000000337'};olympe.dc.Ep=class extends Error{constructor(a){var b=olympe.dc.ia(),c=olympe.dc.Sd(),d=b.model(a);d=`\n- model: ${d} (${d?b.name(d):'no name'})`;b=b.source(a);c=`\n- source: ${b} (${b?c.yb(b).name():'no name'})`;super(`Trying to use a CloudObject that does not exist:\n- tag: ${a}${d}${c}${''}`)}};olympe.dc.Writable=class{Nc(){}Xc(){}F(){}Ea(){}ic(){}};olympe.dc.au=class{qd(){}V(){}L(){}};olympe.dc.Bc=class{constructor(a){this.tag='string'===typeof a?a:a.X()}X(){return this.tag}Qa(a){return a instanceof olympe.dc.Bc&&this.tag===a.tag}};olympe.dc.Bc.xa=[olympe.dc.Fe];olympe.dc.Bc.prototype.Qa.K=olympe.D.J.C;olympe.dc.Ds=class a{constructor(b,c,d,e,f,g){this.H=b;this.db=c;this.T=d;this.Xb=e;this.O=f;this.G=g;this.C=La(new olympe.Y.$l(6E5),(h,k)=>{URL.revokeObjectURL(k);Ee(this.db,h,a.C(h))})}Z(b,c,d,e,f){this.ba(c).then(g=>{this.fa(b,g,d,!!this.G,e,f)}).catch(g=>this.H.error(g))}F(b,c,d){const e=olympe.D.Xa().G(c),f=olympe.D.Xa().G(g=>{g=`Failed to download file ${b.X()}: ${g}`;this.H.error(g);null==d||d(g)});olympe.D.Um([b.ur(),b.X(),b.rl(),b.Hm()],(g,h,k,l)=>{if(Ia(this.C.C,h))k=this.C.get(h),this.O.F(k,
|
|
518
|
+
e,f);else{var n=p=>{p=p instanceof Uint8Array?new Blob([p],{type:l}):p;this.G&&this.L(h,p);e(p)};g.valueOf()?(g=this.db.model(b),k=new olympe.dc.Request(olympe.dc.Request.C.Hf,olympe.dc.Sd().we(b),{tag:h,model:g,url:k.valueOf()}),this.Xb.request(k).then(n).catch(f)):(k=P(k),k.F=olympe.net.Ba.ResponseType.Ik,this.T.C(k,p=>{const q=p.yc();200<=q&&300>q?n(p.getData()):f(`Failed to download file ${b}. Response code ${q}`)}))}})}fa(b,c,d,e,f,g){const h=e?k=>{this.L(b,new Blob([c],{type:d}));f(k)}:f;e=
|
|
519
|
+
this.db.model(b);e=new olympe.dc.Request(olympe.dc.Request.C.Of,olympe.dc.Sd().we(b),{tag:b,model:e,content:c,mimeType:d});this.Xb.request(e).then(k=>h(null!=k?k:'')).catch(null!=g?g:this.H.error.bind(this.H))}ba(b){return x(function*(){var c=b instanceof olympe.D.Na?b.valueOf():b;return'string'===typeof c?(new TextEncoder).encode(c):c instanceof ArrayBuffer?new Uint8Array(c,0,c.byteLength):c instanceof Blob?(c=yield c.arrayBuffer(),new Uint8Array(c,0,c.byteLength)):c})}L(b,c){const d=olympe.dc.ga(b);
|
|
520
|
+
b=URL.createObjectURL(c);this.C.set(d,b);const e=a.C(d);Fe(this.db,d,f=>{f||(this.C.delete(d),Ee(this.db,d,e))},e)}static C(b){return`cacheBinary${b}`}};function Ge(a,b){let c=He(b),d=null;for(;!c&&b&&b!==d;){d=b;b=a.db.Qe(b);if(null===b)break;c=He(b)}let e;return null!=(e=c)?e:null}olympe.dc.Ws=class{constructor(a,b,c){this.H=a;this.C=b;this.db=b.view;this.F=c;this.Ma=new FinalizationRegistry(d=>{this.H.L()&&this.H.debug(`Collect instance ${d} (${this.db.name(d)||'no name'})`);this.C.C.tb([d])})}};function Ie(a,b){a.origin=b;return a}function Je(a,b,c){a.F.set(b,c);return a}function Ke(a){let b;return null!=(b=a.F)?b:new Map}olympe.dc.Request=class{constructor(a,b,c,d){this.type=a;this.origin=olympe.dc.Pa.SELF;this.C=b;this.content=null!=c?c:null;this.G=null!=d?d:Nc(olympe.auth.he()).ke();this.F=new Map}getType(){return this.type}uc(){return this.G}nc(){return this.C}toString(){return`Request of type ${this.type}, from ${this.origin} to ${this.C}; content: ${this.content}`}};
|
|
521
|
+
olympe.dc.Request.C={Jb:1,fg:10,Fs:24,Jo:25,Gs:28,og:30,Fj:31,qA:32,xg:40,yg:41,vn:42,aq:43,Ph:45,xn:46,lj:47,Of:50,Hf:51,dg:52,Pu:60,iu:61,Eo:62,wz:63,$r:64,Tg:65,ao:91,Hs:93,zl:95,QUERY_RESULT:97};function Le(a,b,c,d,e){const f=olympe.D.Gg();a.sources.set(olympe.dc.Pa.SERVER,e.init(a));a.G?a.sources.set(olympe.dc.Pa.jf,d.init(a)):Fe(b,a.C,()=>{a.sources.set(olympe.dc.Pa.jf,d.init(a));const g=new Map;olympe.dc.pa.from(a.C,a.C).cb(olympe.dm.DataSource.Pi).filter(olympe.dc.query.Aa.Qa(olympe.dm.DataSource.uh,!0)).observe(f).subscribe(h=>{var k=Me(h);for(var l of k){const [p,q]=g.get(l);c.G(p);c.O(q);k=a.sources.get(l);a.sources.delete(l);var n=void 0;null==(n=k)||n.destroy()}h=Ne(h);for(const p of h)if(h=
|
|
522
|
+
p.X(),!a.sources.has(h)){const q=new olympe.dc.sources.lp(a.H,p);a.sources.set(h,q);l=c.C(()=>q.healthCheck());n=c.F(()=>q.destroy(),`Datasource ${h}`);g.set(h,[l,n]);q.init(a)}});Ee(b,a.C,'router',!0)},'router')}function Oe(a,b,c){a.H.debug('Router: subscribes',b);return a.yb(b.nc()).fa(b,c)}function Pe(a,b,c){let d=a.F.get(b);void 0===d&&(d=[],a.F.set(b,d));d.push(c)}
|
|
523
|
+
olympe.dc.nu=class{constructor(a,b,c,d,e,f,g){this.H=a;this.C=f;this.G=g;this.sources=new Map;this.F=new Map;Le(this,d,e,b,c)}request(a){this.H.debug('Router: sends',a);return this.yb(a.nc()).request(a)}kd(a){const b=a.nc();if(b===this.C){let c;null==(c=this.F.get(a.getType()))||c.forEach(d=>d(a))}else olympe.N.wb.publish(b,a).catch(c=>{this.H.error(`Error while publishing the message ${a} to remote router: ${c}`)})}yb(a){let b;return null!=(b=this.sources.get(a))?b:this.sources.get(olympe.dc.Pa.jf)}};olympe.dc.Ma={};const Qe=olympe.dc.ua.ORIGIN,Re=olympe.dc.ua.DESTINATION,Se=new Map,Te=new Map,Ue=new Map,Ve=new Map;function He(a){let b;return null!=(b=Se.get(a))?b:null}function We(a,b,c){let d=a;'function'===typeof a&&(d=c.entry);a=[...(d.an||[])];return olympe.dc.na.C(b,c,...a)}function Xe(a,b){Ve.set(a,b);return a}function Ye(a){let b,c;return null!=(c=null==(b=Se.get(a))?void 0:b.F)?c:olympe.dc.CloudObject}
|
|
524
|
+
function Ze(a,b,c){const d=a+'@'+(b===Re?Qe:Re);if(Te.has(d))throw Error(`Try to register the same relation (${b+a}) multiple times.`);Te.set(d,c)}function $e(a){a=a.X()+'@'+a.Ga();return Te.get(a)||olympe.dc.CloudObject}function S(a,b){b.NAME=a;Ue.set(a,b)}function T(a){let b;return null!=(b=a.NAME)?b:null}
|
|
525
|
+
olympe.dc.na=class{constructor(){}static C(a,b,...c){if(Se.has(a))throw Error(`Tag: ${a} - overwriting already defined CloudObject class ${Se.get(a).F.name} with ${b.name}`);let d=null;const e=c.length;if(0<e){d=Array(e);for(let f=0;f<e;f++){let g=c[f];d[f]='string'===typeof g?new olympe.W.wb(g):g}}b=new olympe.dc.Ma.Entry(a,b,d);Se.set(a,b);return b.F.entry=b}static cc(a){let b,c;return null!=(c=null==(b=a.entry)?void 0:b.X())?c:null}};function af(a,b){a.C=b}function U(a,b){b=b.Vb();Ze(b.X(),b.Ga(),a.F);return b}function bf(a){a.G=!0;return a}
|
|
526
|
+
olympe.dc.Ma.Entry=class{constructor(a,b,c){this.tag=a;this.F=b;this.an=c||null;this.C=null;this.G=!1}X(){return this.tag}instantiate(a,b){const c=this.F;if(this.Mm()&&b.getParameter(olympe.dc.U.qo)){var d=olympe.dc.ia();d=`Trying to instantiate an abstract class ${d.name(this)} (${this.X()}).`+` This may happen when the implementation of another class extending ${d.name(this)} has not been registered`;olympe.ma.ab('dc').error(d)}return this.an?(a=[void 0,a].concat(qa(b,this.an)),new c(...a)):new c(void 0,
|
|
527
|
+
a)}ka(a){return new olympe.dc.Ma.Property(a)}sa(a,b=olympe.dc.ua.DESTINATION){Ze(a,b,this.F);return new olympe.dc.da.Le(a,b)}Mm(){return this.G}};B('olympe.dc.registry.Entry',olympe.dc.Ma.Entry);olympe.dc.Ma.Entry.prototype.addRelation=olympe.dc.Ma.Entry.prototype.sa;olympe.dc.Ma.Entry.prototype.addProperty=olympe.dc.Ma.Entry.prototype.ka;olympe.dc.Ma.Entry.xa=[olympe.dc.Fe];olympe.dc.Ma.Property=class{constructor(a){this.tag=a}X(){return this.tag}toString(){return`Property: ${this.tag}`}};olympe.dc.Ma.Property.prototype.getTag=olympe.dc.Ma.Property.prototype.X;olympe.dc.Ma.Property.xa=[olympe.dc.Fe];olympe.dc.Ma.Relation=class{constructor(a,b=olympe.dc.ua.DESTINATION,c=olympe.dc.CloudObject,d=olympe.dc.CloudObject){this.tag=olympe.dc.ga(a);this.direction=b;this.origin=c;this.L=d}X(){return this.tag}Ga(){return this.direction}type(){return this.L}Vb(){return new olympe.dc.Ma.Relation(this.tag,this.direction===olympe.dc.ua.DESTINATION?olympe.dc.ua.ORIGIN:olympe.dc.ua.DESTINATION,this.L,this.origin)}Qa(a){return a instanceof olympe.dc.Ma.Relation?a.X()===this.X()&&a.Ga()===this.Ga():!1}toString(){return`${this.direction}${olympe.dc.ia().name(this.tag)} (${this.tag})`}};
|
|
528
|
+
olympe.dc.Ma.Relation.prototype.getInverse=olympe.dc.Ma.Relation.prototype.Vb;olympe.dc.Ma.Relation.prototype.getDirection=olympe.dc.Ma.Relation.prototype.Ga;olympe.dc.Ma.Relation.prototype.getTag=olympe.dc.Ma.Relation.prototype.X;olympe.dc.Ma.Relation.xa=[olympe.dc.Fe];olympe.dc.db={};function cf(a,b){const c=a.G,d=olympe.dc.ia(),e=olympe.dc.db.Database.C.mi,f=olympe.dc.db.Database.C.Ee,g=olympe.dc.db.Database.C.ORIGIN,h=olympe.dc.db.Database.C.DESTINATION,k=new olympe.dc.db.Sc('rev-'+b.V());a.H.debug('Generate the reverse graphLayer of',b.V());b.zb.forEach((l,n)=>{if(l.G()){k.F(n,olympe.dc.ec.NONE);for(const [r,t]of l.td())k.ic(r,n,t)}else{var p=c.get(n);if(void 0!==p)if(l.Td())for(const r of df(d,n,l.O())){l=c.get(r);const t=new Map;l.forEach((u,w)=>{const y=w[0],z=w.substring(1);
|
|
529
|
+
y===e?t.set(z,u):y===f?t.set(w,u):y===g?u.forEach((A,C)=>{k.Ea(z,C,r)}):y===h&&u.forEach((A,C)=>{k.Ea(z,r,C)})});l=l.source();k.Nc(r,l,t)}else{const r=new Map;for(const t of l.Cb().keys()){var q=t[0]===f;const u=q?t.substring(1):t;q=q?ef(p,u,!0):p.Ka(u,!0);let w;r.set(t,null!=(w=q)?w:null)}0<r.size&&k.Xc(n,r);for(const [t,u,w]of l.td())w?k.ic(t,n,u):k.Ea(t,n,u)}}});return k}
|
|
530
|
+
function ff(a,b,c){const d=b.V();if(a.F.has(d))throw Error(`You try to execute the patch ${d} a second times whereas the first execution has not been validated yet.`);const e=new gf(b,cf(a,b));a.C.push(d);a.F.set(d,e);a.G.mk(c);a.write(b,!1)}function hf(a,b,c){return a.C.slice(0,c).map(d=>a.F.get(d)).reduce((d,e)=>e?e.Hc(d):d,b)}
|
|
531
|
+
olympe.dc.db.ks=class{constructor(a,b,c,d){this.H=a;this.G=b;this.ia=c;this.L=d;this.C=[];this.F=new Map}Hc(a){const b=a.V();this.C.includes(b)?this.push(b):this.write(hf(this,a,this.C.length),!0)}push(a){const b=this.C.indexOf(a);if(-1<b){const c=this.F.get(a);this.C.splice(b,1);hf(this,c.F,b);this.F.delete(a)}}write(a,b){(new olympe.dc.db.Rq(this.H,this.G,this.ia,this.L,b)).write(a)}};
|
|
532
|
+
function jf(a,b,c,d){const e=olympe.dc.ua.DESTINATION;c=c.tag();const f=a.C.Hd(c);b.Cb().forEach((g,h)=>{f.ka(h,g);b.fa(h)});for(const [g,h,k,l]of b.jb()){if(!l)continue;const n=h===e?c:k,p=h===e?k:c;a.C.Ea(g,n,p);d.O(g,n,p)}}function kf(a,b,c,d){const e=olympe.dc.ua.DESTINATION,f=c.tag(),g=a.C.Hd(f);b.Cb().forEach((h,k)=>{void 0!==c.Ka(k)&&(g.ka(k,h),b.fa(k))});for(const [h,k,l]of b.td()){const n=c.tb(h,e,k);void 0!==n&&(d.O(h,f,k),n===l&&a.C.O(h,f,k))}}
|
|
533
|
+
class gf{constructor(a,b){this.F=a;this.C=b;this.db=olympe.dc.ia()}V(){return this.F.V()}Hc(a){var b=this.F.zb,c=a.zb;const d=b.size>c.size,e=d?b:c;b=d?c:b;for(const [g,h]of b){b=g;var f=e.get(b);void 0!==f&&(c=d?f:h,f=d?h:f,f.Td()?c.G()||this.C.G(b,f.O()):c.Td()?(jf(this,f,c,a),a.G(b,c.O())):kf(this,f,c,a))}return a}};const lf=olympe.dc.qc.$c,mf=olympe.dc.qc.Uh,nf=olympe.dc.ua.ORIGIN,of=olympe.dc.ua.DESTINATION;
|
|
534
|
+
olympe.dc.db.Database=class a extends Map{constructor(b,c,d){super();let e;this.id=null!=(e=d.get('selfTag'))?e:olympe.dc.Pa.SELF;this.H=b;this.hc=olympe.D.Xa();this.T=olympe.dc.db.Database.G.IDLE;this.ba=new Map;this.oa=[];this.G=[];this.fa=new Map;var f;b=null!=(f=d.get('garbageCollector'))?f:olympe.dc.db.df.C.Zk;let g;f=null!=(g=d.get('garbageCollectorDelay'))?g:5E3;this.Kc=new olympe.dc.db.df(c,this,b,f);d.get('debug')&&this.ek()}V(){return this.id}getState(){return this.T}ab(){return this.H}create(b,
|
|
535
|
+
c,d,e=!1){var f=this.F(b,!0);if(!f.e&&null!==c&&(null===f.G||f.G===c)){f.G=c;let g;(null==(g=f.model())?0:g.e)&&f.db.Z(f,!0)}e&&f.persist();d&&this.Tb(f,d);this.C(a.F.Vo,b)}update(b,c){c&&(b=this.F(b,!0),this.Tb(b,c))}za(b){const c=this.get(b);void 0!==c&&(this.Z(c,!1),this.C(a.F.Wo,b))}link(b,c,d){c=this.F(c,!0);d=this.F(d,!0);switch(b){case lf:pf(c,d);break;case mf:qf(c,d);break;default:c.link(b,d)}}unlink(b,c,d){c=this.get(c);d=this.get(d);if(void 0!==c&&void 0!==d)switch(b){case lf:rf(c,d);break;
|
|
536
|
+
case mf:sf(c,d);break;default:c.unlink(b,d)}}jb(b){for(const c of b)tf(this.F(c))}tb(b){for(const c of b)(b=this.get(c))&&uf(b)}mk(b){b.forEach(c=>{this.F(c).persist()})}pd(b){const c=this.get(b);void 0!==c&&(c.clear(),super.delete(b),this.C(a.F.oo,b))}F(b,c=!1){let d=this.get(b);void 0===d&&(d=new olympe.dc.db.Instance(b,this),this.set(b,d),this.C(a.F.no,b),c&&this.C(a.F.cm,b));return d}ob(b){vf(this.G[0],olympe.Y.Ah(),b)}O(b){this.G[0].C.delete(b)}C(b,c,...d){this.ba.has(b)&&this.ba.get(b).forEach(e=>
|
|
537
|
+
{e(c,...d)})}Z(b,c){this.fa.set(b,c)}Pe(b,c,d,e){let f;null!=(f=this.G[0])&&wf(f,b).ka(e?xf+c:c,d)}sf(b,c,d,e,f){let g;null!=(g=this.G[0])&&(d===yf?f?wf(g,b).link(c,e):wf(g,b).unlink(c,e):f?wf(g,b).Kb(c,e):wf(g,b).Tb(c,e))}Kb(b,c,d){let e;null!=(e=this.G[0])&&wf(e,b).pd(c,d)}addEventListener(b,c){let d=this.ba.get(b);void 0===d&&(d=[],this.ba.set(b,d));d.push(c)}Ja(b){this.oa.push(b)}L(b){return this.G.reduce((c,d)=>d.O.has(b)||c,!1)}ve(){this.T===a.G.IDLE&&(this.T=a.G.Tr);this.G.unshift(new olympe.dc.db.zs(this,
|
|
538
|
+
this.hc))}Od(){this.T=a.G.Ye;this.pk();zf(this.G[0]);this.G.shift();0===this.G.length&&(this.T=a.G.IDLE,this.oa.forEach(b=>{b()}),Af(this.Kc))}Tb(b,c){const d=a.C.Ee;for(const [e,f]of c)void 0!==f&&(e[0]===d?Bf(b,e.substring(1),f):b.update(e,f))}pk(){const b=this.G[0];for(const [c,d]of this.fa)this.ac(new Set,c).filter(e=>{var f=d;const g=e.e!==f;g&&(f?(e.e=f,Cf(e)):(Df(e),e.e=f),e.db.C(f?Ef.bl:Ef.zc,e.C));return g}).forEach(e=>{e=e.tag();d?wf(b,e).create():wf(b,e).delete()});this.fa.clear()}ac(b,
|
|
539
|
+
c,d=[]){const e=c.tag();if(!b.has(e)&&(b.add(e),d.push(c),c=c.get(nf+lf)))for(const f of c.values())null!==f.source()&&this.ac(b,f,d);return d}ek(){const b=a.F.bl,c=a.F.Hj,d=new Set,e=new Map;this.addEventListener(a.F.Vo,f=>{d.add(f)});this.addEventListener(b,f=>{d.delete(f);e.delete(f)});this.addEventListener(c,(f,...g)=>{if(g[0]===mf&&g[1]===of){const h=g[2];this.get(h).Fa()||(g=e.get(h)||new Set,0===g.size&&e.set(h,g),g.add(f))}});this.Ja(()=>{d.forEach(f=>{const g=this.get(f);g&&null===g.model()&&
|
|
540
|
+
this.H.error(`\n[DEBUG - DATABASE]\nInstance ${f} created but does not exist !\n${g.toString()}`)});d.clear();e.forEach((f,g)=>{const h=this.get(g);h&&this.H.error(`\n[DEBUG - DATABASE]\nThe model ${g} is extended by other models but does not exist !`+`\nExtension models: ${Array.from(f.values()).join(', ')}`+`\n\n ${h.toString()}`)});e.clear()})}};olympe.dc.db.Database.C={mi:'$',Ss:'~',Ee:'?',Bk:'=',So:'|',Ln:'@',ORIGIN:olympe.dc.ua.ORIGIN,DESTINATION:olympe.dc.ua.DESTINATION};
|
|
541
|
+
olympe.dc.db.Database.F={no:0,oo:1,Iq:2,cm:3,Mn:4,Nn:5,bl:6,zc:7,Hj:8,Pl:9,Vo:10,Wo:11,Vp:12};olympe.dc.db.Database.G={IDLE:0,Tr:1,Ye:2};function Ff(a,b,c=[]){const d=b.V();ff(a.F,b,c);return e=>{if(e)a.F.push(d);else{e=a.F;const f=e.F.get(d);if(void 0!==f){const g=e.C.indexOf(d);e.C.splice(g,1);e.write(hf(e,f.C,e.C.length),!1);e.F.delete(d)}}}}function Gf(a,b){a.C.Ja(b)}olympe.dc.db.vs=class{constructor(a,b,c,d,e){this.H=a;this.C=b;this.view=c;this.F=new olympe.dc.db.ks(a,b,c,d);this.hx=new olympe.dc.db.Lt(a,c,b,e)}ab(){return this.H}Hc(a){this.F.Hc(a)}};const Hf=olympe.dc.db.Database.C.ORIGIN,If=olympe.dc.db.Database.C.DESTINATION,Jf=olympe.dc.db.Database.C.mi,Kf=olympe.dc.db.Database.C.Ee,Lf=olympe.dc.db.Database.C.Bk,Mf=olympe.dc.db.Database.C.So,Nf=Hf+If,Of=Jf+Jf,Pf=olympe.dc.db.Database.G;let Qf=0;function Ee(a,b,c,d=!1){const e=V(a,b);if(null!==e){const f=Rf(e,'',c);void 0!==f&&(a.C.getState()!==Pf.Ye||e.L()&&!d||a.C.O(c),d||!e.Fa()&&!e.L()||f(!1,b))}}
|
|
542
|
+
function Fe(a,b,c,d){a=a.C.F(olympe.dc.ga(b));d=null!=d?d:Sf();Tf(a,'',d,c)&&a.Fa()&&c(!0,b);return d}function df(a,b,c){return{[Symbol.iterator]:function*(d,e,f){const g=(new Set).add(e);for(const h of g)yield h,d.hk(h,f).forEach(([k,,,l])=>{l&&g.add(k)})}.bind(null,a,b,c)}}function Sf(){++Qf;return String(Qf)}
|
|
543
|
+
function Uf(a,b,c,d,e){a=a.C.F(olympe.dc.ga(b));c=olympe.dc.ga(c);b=Jf+c;e=null!=e?e:Sf();if(Tf(a,b,e,d)&&a.Fa()){let f=!1;b=a.get(b);void 0===b&&(f=!0,b=a.get(Lf+c));void 0!==b&&d(b,f)}return e}function V(a,b,c=!1){if(b)return a=a.C.get(olympe.dc.ga(b)),!a||c&&!a.Fa()?null:a;throw Error('DBView: Impossible to get instance, provided tag is null or undefined.');}function Vf(a,b,c,d){b=V(a,b);null!==b&&(c=olympe.dc.ga(c),Rf(b,Jf+c,d),a.C.getState()===Pf.Ye&&a.C.O(d))}
|
|
544
|
+
function Wf(a,b,c,d){a=a.C.F(olympe.dc.ga(b));d=null!=d?d:Sf();Tf(a,Of,d,c)&&a.Fa()&&a.forEach((e,f)=>{const g=f[0];g!==Jf&&g!==Lf||c(f.substring(1),e,g===Lf)});return d}function Xf(a,b,c){b=V(a,b);null!==b&&(Rf(b,Of,c),a.C.getState()===Pf.Ye&&a.C.O(c))}function Yf(a,b,c,d,e){let f;null==(f=a.get(b))||f.forEach((g,h)=>{if(g.Fa()||!c&&g.L())e?d(b.substring(1),b[0],c,h):d(c,h)})}
|
|
545
|
+
function W(a,b,c,d,e){a=a.C.F(olympe.dc.ga(b));c=c.Ga()+c.X();e=null!=e?e:Sf();(d=Zf(a,c,e,d))&&a.Fa()&&Yf(a,c,!0,d,!1);return e}function $f(a,b,c,d){const e=a.C.F(olympe.dc.ga(b));a=null!=d?d:Sf();const f=Zf(e,Nf,a,c);f&&e.Fa()&&e.forEach((g,h)=>{g=h[0];g!==Hf&&g!==If||Yf(e,h,!0,f,!0)})}function ag(a,b,c){const d=V(a,b);if(null!==d){const e=Rf(d,Nf,c);void 0!==e&&(a.C.getState()!==Pf.Ye||d.L()||a.C.O(c),!d.Fa()&&!d.L()||d.forEach((f,g)=>{f=g[0];(f===Hf||f===If)&&e&&Yf(d,g,!1,e,!0)}))}}
|
|
546
|
+
function bg(a,b,c){b=V(a,b,!1);if(!b)return[];const d=olympe.dm.Relation.C.Rl,e=olympe.dm.Relation.C.ku,f=olympe.dm.Relation.C.bm,g=olympe.dm.Relation.C.Wp,h=Jf+c,k=[];b.forEach((l,n)=>{const p=n[0];if(l instanceof olympe.dc.Bc&&p===Jf)(l=a.C.get(l.X()))&&k.push([l,n.substring(1),null,!0]);else if(p===Hf){const q=n.substring(1);let r,t;const u=null!=(t=null==(r=a.C.get(q))?void 0:r.get(h))?t:0;(d|e)&u&&l.forEach(w=>{k.push([w,q,p,!!(d&u)])})}else if(p===If){const q=n.substring(1);let r,t;const u=
|
|
547
|
+
null!=(t=null==(r=a.C.get(q))?void 0:r.get(h))?t:0;(f|g)&u&&l.forEach(w=>{k.push([w,q,p,!!(f&u)])})}});return k}function cg(a,b,c,d,e){const f=a.C.F(olympe.dc.ga(b));e=null!=e?e:Sf();const g=Zf(f,Mf+c,e,d);g&&f.Fa()&&bg(a,b,c).forEach(([h,...k])=>{h.Fa()&&g(...k,!0,h.tag())})}function dg(a,b,c,d){const e=V(a,b);if(null!==e){const f=Rf(e,Mf+c,d);void 0!==f&&(a.C.getState()!==Pf.Ye||e.L()||a.C.O(d),!e.Fa()&&!e.L()||bg(a,b,c).forEach(([g,...h])=>{(g.Fa()||g.L())&&f(...h,!1,g.tag())}))}}
|
|
548
|
+
function eg(a,b){a=V(a,b,!0);b=new Map;if(a)for(const [c,d]of a)c[0]===Kf&&b.set(c.substring(1),d);return b}function fg(a,b,c){return c===olympe.dc.ec.NONE?0:a.Ka(b,c,!0)||0}function gg(a,b){return function*(c){if(c)for(const [d,e]of c)if(c=d[0],c===Hf||c===If){const f=d.substring(1);for(const g of e.keys())yield[f,c,g]}}(V(a,b,!0))}
|
|
549
|
+
function hg(a,b,c){if(!a.Fa(b))return a.H.warn(`No instance found with tag ${b}`),new Map;const d=new Map,e=[olympe.dc.ga(b)];for(const f of e){const g=a.bb(f,c);d.set(f,g);for(const h of g.filter(k=>!d.has(k)))e.push(h)}a.H.debug(`Found ${d.size} instances in sub-tree rooted at ${olympe.dc.ga(b)}`);return d}function ig(a,b,c,d){return(c=(a=V(a,b,!0))&&a.get(d+c))?Array.from(c.values()).filter(e=>e.Fa()).length:0}
|
|
550
|
+
olympe.dc.ib=class{constructor(a,b){this.H=a;this.C=b}V(){return this.C.V()}F(a,b,c,d=!1){a=V(this,a);if(null!==a){b=b.Ga()+b.X();const e=Rf(a,b,c);void 0!==e&&(this.C.getState()!==Pf.Ye||a.L()&&!d||this.C.O(c),d||!a.Fa()&&!a.L()||Yf(a,b,!1,e,!1))}}Fa(a){a=this.C.get(olympe.dc.ga(a));return!(null==a||!a.Fa())}name(a){let b,c;return null!=(c=null==(b=V(this,a))?void 0:b.Ka(olympe.dc.CloudObject.nameProp.X()))?c:''}model(a){return(a=(a=V(this,a,!0))?a.model():null)?a.tag():null}Qe(a){return(a=(a=V(this,
|
|
551
|
+
a,!0))&&a.Qe())?a.tag():null}Hh(a){a=V(this,a,!0);return!(!a||!a.Qe())}jc(a,b){a=(a=V(this,a,!0))&&a.model();return!(!a||!this.Gh(a.tag(),b))}source(a){return(a=V(this,a,!0))&&a.source()}Vf(a){a=V(this,a,!1);return!a||a.O}Ka(a,b,c){let d;a=null==(d=V(this,a,!0))?void 0:d.Ka(olympe.dc.ga(b),c);return void 0!==a?a:null}Cb(a,b=!1){var c=V(this,a,!0);a=new Map;if(c)for(const [d,e]of c)c=d[0],(c===Jf||!b&&c===Lf)&&a.set(d.substring(1),e);return a}hk(a,b){return bg(this,a,b).filter(([c])=>c.Fa()).map(([c,
|
|
552
|
+
...d])=>[c.tag(),...d])}bb(a,b){a=V(this,a,!0);b=b.Ga()+b.X();b=null==a?void 0:a.get(b);a=[];if(b)for(const c of b.values())c.Fa()&&a.push(c.tag());return a}wr(a,b,c){let d,e;a=null==(d=V(this,a,!0))?void 0:null==(e=d.get(b.Ga()+b.X()))?void 0:e.get(olympe.dc.ga(c));return!(null==a||!a.Fa())}Im(a,b){a=V(this,a,!0);if(!a)return[];a=[a.tag()];for(const c of b){b=[];for(const d of a)if(a=V(this,d,!0).get(c.Ga()+c.X()),void 0!==a)for(const e of a.values())e.Fa()&&b.push(e.tag());a=b}return a}Pb(a,b){var c=
|
|
553
|
+
V(this,a,!0);const d=b.Ga()+b.X();c=null==c?void 0:c.get(d);if(1<(null==c?void 0:c.size))return this.H.warn(`Relation ${b.X()} to instance ${a} is not unique: found ${c.size} related items`),null;a=null==c?void 0:c.values().next().value;return(null==a?0:a.Fa())?a.tag():null}Jg(a,b,c){a=olympe.dc.ga(a);const d=hg(this,a,b);d.delete(a);return c?(c=olympe.dc.ga(c),d.has(c)?Array.from(hg(this,c,b.Vb()).keys()).filter(e=>d.has(e)):[]):Array.from(d.keys())}gr(a,b,c){if(!this.Fa(a))return null;b=hg(this,
|
|
554
|
+
a,b);const d=[olympe.dc.ga(a)];for(const e of d){if(c(e))return e;if(a=b.get(e))for(const f of a.filter(g=>!d.includes(g)))d.push(f)}return null}zm(a,b,c){return this.Im(a,b).find(c)||null}Iv(a,b,c){return this.Im(a,b).filter(c)}lr(a,b=olympe.dc.CloudObject){var c=V(this,a,!0);const d=b&&V(this,b,!0),e=[c];for(;c&&c!==d;){c=c.Qe();if(e.includes(c))throw Error(`Cycle detected when following recursively extend relations from base model instance "${a}".`);if(c&&!c.Fa())throw a=`Try to get all extensions of the model ${olympe.dc.ga(a)} but one of them does not exists (${c.tag()})`,
|
|
555
|
+
Error(a);null!==c&&e.push(c)}c=V(this,olympe.dc.CloudObject,!0);if(d!==c&&e[e.length-1]===c)throw Error(`The model "${this.name(a)}" (tag = ${a}) does not extend the expected model "${this.name(b)}" (tag = ${b}).`);return e.map(f=>f.tag())}Gh(a,b){const c=olympe.dc.ga(b);return!!this.gr(a,olympe.dc.CloudObject.extendRel,d=>d===c)}Id(a){return this.bb(a,olympe.dc.CloudObject.instancesRel)}};olympe.dc.ib.prototype.getInstances=olympe.dc.ib.prototype.Id;olympe.dc.ib.prototype.isExtending=olympe.dc.ib.prototype.Gh;
|
|
556
|
+
olympe.dc.ib.prototype.getExtendedModels=olympe.dc.ib.prototype.lr;olympe.dc.ib.prototype.findAllRelated=olympe.dc.ib.prototype.Iv;olympe.dc.ib.prototype.findRelated=olympe.dc.ib.prototype.zm;olympe.dc.ib.prototype.findRecursive=olympe.dc.ib.prototype.gr;olympe.dc.ib.prototype.getRecursiveRelated=olympe.dc.ib.prototype.Jg;olympe.dc.ib.prototype.getUniqueRelated=olympe.dc.ib.prototype.Pb;olympe.dc.ib.prototype.getMultiRelated=olympe.dc.ib.prototype.Im;olympe.dc.ib.prototype.isRelated=olympe.dc.ib.prototype.wr;
|
|
557
|
+
olympe.dc.ib.prototype.getRelated=olympe.dc.ib.prototype.bb;olympe.dc.ib.prototype.getProperties=olympe.dc.ib.prototype.Cb;olympe.dc.ib.prototype.getProperty=olympe.dc.ib.prototype.Ka;olympe.dc.ib.prototype.isPersisted=olympe.dc.ib.prototype.Vf;olympe.dc.ib.prototype.instanceOf=olympe.dc.ib.prototype.jc;olympe.dc.ib.prototype.isModel=olympe.dc.ib.prototype.Hh;olympe.dc.ib.prototype.extension=olympe.dc.ib.prototype.Qe;olympe.dc.ib.prototype.model=olympe.dc.ib.prototype.model;
|
|
558
|
+
olympe.dc.ib.prototype.name=olympe.dc.ib.prototype.name;olympe.dc.ib.prototype.exist=olympe.dc.ib.prototype.Fa;const jg=olympe.dc.db.Database.C.ORIGIN,yf=olympe.dc.db.Database.C.DESTINATION,xf=olympe.dc.db.Database.C.Bk,kg=olympe.dc.db.Database.C.mi,lg=olympe.dc.db.Database.C.So,mg=olympe.dc.db.Database.C.Ln,ng=jg+yf,og=kg+kg,pg=Array.from(Object.values(olympe.dc.ec)).filter(a=>null!==a);function vf(a,b,c){let d=a.C.get(b);void 0===d&&(d=[],a.C.set(b,d));a.buffer.push([b,d.length]);d.push(c)}
|
|
559
|
+
function zf(a){const b=a.L;a.F.forEach((c,d)=>{var e=b.get(d);if(c.G()||c.Td()){var f=e.get(mg);f&&qg(a,f,c.G(),d);c.Td()&&a.O.add(d)}for(const [n,p]of c.Cb()){var g=n[0]===xf,h=g?n.substring(1):n;f=a;var k=e,l=p;const q=k.get(mg+kg+h);q&&qg(f,q,l,g);(k=k.get(mg+og))&&qg(f,k,h,l,g)}for(const n of c.jb())rg(a,e,...n);(e=c.ba)&&sg(a,b.get(e),c.ac,!c.Td(),d)});a.F.clear();a.G.clear();tg(a)}function wf(a,b){let c=a.F.get(b);void 0===c&&(c=new olympe.dc.db.ah(b),a.F.set(b,c));return c}
|
|
560
|
+
function qg(a,b,...c){b.forEach((d,e)=>{vf(a,e,d.bind(null,...c))})}function rg(a,b,c,d,e,f){var g=b.get(mg+d+c);g&&qg(a,g,f,e);(g=b.get(mg+ng))&&qg(a,g,c,d,f,e);ug(a,c,d).forEach((h,k)=>{(k=b.get(mg+lg+k))&&qg(a,k,c,d,h,f,e)})}function sg(a,b,c,d,e){pg.forEach(f=>{(f=b.get(mg+lg+f))&&qg(a,f,c,null,!0,d,e)})}function tg(a){a.T.run(()=>{const b=a.C;for(const [c,d]of a.buffer){let e,f,g;null==(e=b.get(c))||null==(g=(f=e)[d])||g.call(f)}});a.C.clear();a.buffer.length=0}
|
|
561
|
+
function ug(a,b,c){const d=b+c;let e=a.G.get(d);if(!e){const f=a.L.get(b);e=new Map;pg.forEach(g=>{let h;const k=null!=(h=null==f?void 0:f.get(kg+g))?h:0;(c===jg?12:3)&k&&e.set(g,!!((c===jg?8:2)&k))});a.G.set(d,e)}return e}olympe.dc.db.zs=class{constructor(a,b){this.L=a;this.T=b;this.F=new Map;this.O=new Set;this.C=new Map;this.G=new Map;this.buffer=[]}};function Af(a){if(!a.G&&0<a.F.size)switch(a.mode){case olympe.dc.db.df.C.hn:a.G=!0;setTimeout(()=>a.run(),a.delay);break;case olympe.dc.db.df.C.zu:a.G=!0,a.run()}}
|
|
562
|
+
olympe.dc.db.df=class{constructor(a,b,c,d){this.H=a;this.C=b;this.F=new Set;this.mode=c;this.delay=d;this.G=!1;c!==olympe.dc.db.df.C.Zk&&this.init()}run(){const a=this.C;this.H.debug('Start garbage collector with',this.F.size,'instances to check');for(const b of this.F){const c=a.get(b);!c||0<c.c||(this.H.debug('Remove unused instance',b,'from database'),a.pd(b))}this.F.clear();this.G=!1}init(){const a=olympe.dc.db.Database.F.Iq,b=olympe.dc.db.Database.F.Wo,c=olympe.dc.db.Database.F.Vp,d=olympe.dc.db.Database.G.IDLE,
|
|
563
|
+
e=f=>{this.F.add(f);this.C.getState()===d&&Af(this)};this.C.addEventListener(olympe.dc.db.Database.F.cm,e.bind(this));this.C.addEventListener(b,e.bind(this));this.C.addEventListener(a,f=>{this.F.delete(f)});this.C.addEventListener(c,(f,...g)=>{this.H.error(g[0])})}};olympe.dc.db.df.C={Zk:0,zu:1,hn:2};olympe.dc.db.df.F=5E3;olympe.dc.db.Sc=class{constructor(a){this.id=null!=a?a:olympe.Y.tf();this.zb=new Map}V(){return this.id}qd(a){const b=olympe.dc.db.ah.C.yl,c=olympe.dc.db.ah.C.zc,d=olympe.dc.db.ah.C.Vj;this.zb.forEach((e,f)=>{const g=e.Ec();switch(e.getState()){case b:const h=e.yb();if(null===h)throw Error(`GraphPatch: try to create the instance ${f} with no source`);const k=e.T()?e.Cb():void 0;a.Nc(f,h,k,g);break;case d:e.T()&&a.Xc(f,e.Cb(),g);break;case c:a.F(f,e.O(),g)}for(const [h,k,l]of e.td())e=this.zb.get(k),
|
|
564
|
+
l?a.Ea(h,f,k,g,e.Ec()):a.ic(h,f,k,g,e.Ec())})}Fh(){return 0===this.zb.size}L(){let a=0;this.zb.forEach(b=>{a+=b.Kc()});return a}Nc(a,b,c,d=null){b=this.C(a).create(b);'string'===typeof d&&this.Ea(olympe.dc.qc.$c,a,d,d,null);c&&b.mm(c)}Xc(a,b,c=null){b&&this.C(a,c).mm(b)}F(a,b=olympe.dc.ec.NONE,c=null){const d=this.zb.get(a);if(d&&d.G())this.G(a,b);else{this.C(a,c).delete(b);for(const e of this.hk(a,b,!1))this.zb.get(e).Cb().clear(),this.Z(e,!0)}}Ea(a,b,c,d=null,e=null){this.C(b,d).link(a,c);this.C(c,
|
|
565
|
+
e).Kb(a,b)}ic(a,b,c,d=null,e=null){this.C(b,d).unlink(a,c);this.C(c,e).Tb(a,b)}ba(a){var b=olympe.dc.ia();if(b.Fa(a)){const c=b.model(a),d=b.source(a),e=b.Cb(a,!0);eg(b,a).forEach((f,g)=>{e.set(`${olympe.dc.pj.Ee}${g}`,f)});this.Nc(a,d,e,c);(b=b.Qe(a))&&this.Ea(olympe.dc.qc.Uh,a,b);e.forEach(f=>{f instanceof olympe.dc.Bc&&this.ba(f.X())})}}Id(){return function*(a){for(const b of a.values())if(b.G()||b.Td()||b.T())yield b}(this.zb)}Hd(a){return this.zb.get(olympe.dc.ga(a))||null}G(a,b=olympe.dc.ec.NONE){a=
|
|
566
|
+
this.hk(a,b);for(const c of a)this.Z(c,!1),this.zb.delete(c)}td(){return function*(a){for(var b=a.next();!b.done;){b=b.value;const c=b.tag();yield*b.td((d,e,f)=>[d,c,e,f]);b=a.next()}}(this.zb.values())}Jg(a,b,c=(d,e)=>[d,e]){return this.fa(a,b,c)}*fa(a,b,c,d=[]){d.push(a);a=this.Hd(a);for(const [e,f]of a.bb(b))d.includes(e)||(yield*this.fa(e,b,c,d),yield c(e,f))}O(a,b,c){const d=this.zb.get(b),e=this.zb.get(c);d&&d.L(a,olympe.dc.ua.DESTINATION,c);e&&e.L(a,olympe.dc.ua.ORIGIN,b)}Z(a,b){const c=olympe.dc.ua.ORIGIN,
|
|
567
|
+
d=olympe.dc.ua.DESTINATION,e=this.zb.get(a);for(const [g,h,k]of e.td())if(k||!b){e.L(g,d,h);var f=this.zb.get(h);f&&f.L(g,c,a)}for(const [g,h,k]of e.ob())if(k||!b)e.L(g,c,h),(f=this.zb.get(h))&&f.L(g,d,a)}hk(a,b,c=!0){const d=olympe.dm.Relation.C.Rl,e=olympe.dm.Relation.C.bm,f=olympe.dc.ua.ORIGIN,g=olympe.dc.ia();a=new Set([a]);const h=new Set;for(const l of a){var k=this.zb.get(l);if(void 0!==k){for(const [n,p,q]of k.td())q&&fg(g,n,b)&e?a.add(p):c||q||h.add(`${l}.${n}.${p}`);for(const [n,p,q]of k.ob())q&&
|
|
568
|
+
fg(g,n,b)&d?a.add(p):c||q||h.add(`${p}.${n}.${l}`)}for(const [n,p,q]of gg(g,l))k=p===f?d:e,!h.has(p===f?`${q}.${n}.${l}`:`${l}.${n}.${q}`)&&fg(g,n,b)&k&&a.add(q)}return Array.from(a).filter(l=>this.zb.has(l))}C(a,b){let c=this.zb.get(a);void 0===c&&(c=new olympe.dc.db.ah(a),this.zb.set(a,c));return b?c.za(b):c}T(a){const b=olympe.dc.ua.DESTINATION;var c=this.zb;const d=a.zb,e=(a=a.L()>this.L())?d:c;c=a?c:d;for(const [f,g]of c){c=e.get(f);if(void 0===c)continue;const h=a?g:c,k=a?c:g;if(k.Td())this.G(f,
|
|
569
|
+
k.O());else if(!h.Td()){h.Cb().forEach((l,n)=>{void 0!==k.Ka(n)&&h.fa(n)});for(const [l,n,p]of h.td())c=k.tb(l,b,n),void 0!==c&&p!==c&&this.O(l,f,n)}}}};olympe.dc.db.Sc.xa=[olympe.dc.Writable,olympe.dc.au];const Ef=olympe.dc.db.Database.F,vg=olympe.dc.db.Database.C.mi,wg=olympe.dc.db.Database.C.Ss,xg=olympe.dc.db.Database.C.Ee,yg=olympe.dc.db.Database.C.Bk,zg=olympe.dc.db.Database.C.Ln,X=olympe.dc.ua.ORIGIN,Y=olympe.dc.ua.DESTINATION,Ag=olympe.dc.qc.$c,Bg=olympe.dc.qc.Uh;function ef(a,b,c=!1){const d=a.get(xg+b);return c||void 0!==d?d:a.get(wg+b)}
|
|
570
|
+
function pf(a,b){const c=a.model();if(null!==c){if(c===b)return;a.unlink(Ag,c)}a.link(Ag,b);b.forEach((d,e)=>{if(e[0]===xg||e[0]===wg)e=e.substring(1),Cg(a,e,d)});null===a.G||!b.e&&b!==a||a.db.Z(a,!0)}function qf(a,b){const c=a.Qe();if(null!==c){if(c===b)return;a.unlink(Bg,c)}a.link(Bg,b);const d=new Map;b.forEach((e,f)=>{if(f[0]===xg||f[0]===wg)f=f.substring(1),a.has(xg+f)||(a.set(wg+f,e),d.set(f,e))});Dg(a,d)}
|
|
571
|
+
function rf(a,b){a.unlink(Ag,b);a.forEach((c,d)=>{c=d.substring(1);Cg(a,c,null)});a.db.Z(a,!1)}function sf(a,b){a.unlink(Bg,b);const c=new Map;a.forEach((d,e)=>{e[0]===wg&&(a.delete(e),d=e.substring(1),c.set(d,null))});Dg(a,c)}function tf(a){a.c++;1===a.c&&a.db.C(Ef.Iq,a.C)}
|
|
572
|
+
function uf(a){0<a.c?--a.c:a.db.C(Ef.Vp,a.C,`Try to decrease references on instance ${a.C} but the reference counter is already 0.\n`+'It happens when you try to remove a callback from an instance multiple times.\nThis counter reference is used for garbage collection of instances in the database.');0===a.c&&a.db.C(Ef.cm,a.C)}
|
|
573
|
+
function Bf(a,b,c){const d=xg+b;var e=a.get(d);e=void 0===e?null:e;if(!Eg(e,c))if(Fg(a,b,e,c),e=wg+b,null===c){a.delete(d);let f;c=null==(f=a.Qe())?void 0:ef(f,b);c=void 0===c?null:c;null!==c&&a.set(e,c);Dg(a,(new Map).set(b,c))}else void 0!==a.get(e)&&a.delete(e),a.set(d,c),Dg(a,(new Map).set(b,c))}function Tf(a,b,c,d){const e=Gg(a,zg+b);return e.has(c)?!1:(e.set(c,d),tf(a),a.db.C(Ef.Mn,a.C,b,c),!0)}function Rf(a,b,c){const d=Hg(a,zg+b,c);void 0!==d&&(uf(a),a.db.C(Ef.Nn,a.C,b,c));return d}
|
|
574
|
+
function Zf(a,b,c,d){const e=(...f)=>{var g=f.length;const h=f[g-2];(g=a.db.get(f[g-1]))&&(h?tf(g):uf(g));d(...f)};return Tf(a,b,c,e)?e:null}function Eg(a,b){return a instanceof Date?b instanceof Date&&a.getTime()===b.getTime():null!==a&&'function'===typeof a.Qa?a.Qa(b):a===b}
|
|
575
|
+
function Fg(a,b,c,d){c instanceof olympe.dc.Bc&&(Ig(a.db.get(c.X())),a.db.za(c.X()));d instanceof olympe.dc.Bc&&(c=a.db.F(d.X(),!0),c.F&&c.F.tag!==a.C&&a.db.ab().fatal('Instance',d.X(),'referenced multiple times!\nThis instance is currently property of',c.F.tag,'(for the property '+c.F.La+')','and is assigned as a property of',a.C,'(for the property '+b+')'),d=c,a=a.C,void 0===d.F&&(tf(d),d.db.Kb(d.C,a,b)),d.F={tag:a,La:b})}function Jg(a,b,c,d){a.e&&a.db.Pe(a.C,b,c,d)}
|
|
576
|
+
function Dg(a,b,c=[]){const d=a.get(X+Ag);void 0!==d&&d.forEach(e=>{b.forEach((f,g)=>Cg(e,g,f))});a=a.get(X+Bg);void 0!==a&&a.forEach((e,f)=>{if(!c.includes(e.tag())){var g=new Map;b.forEach((h,k)=>{e.has(xg+k)||(g.set(k,h),null!==h?e.set(wg+k,h):e.delete(wg+k))});Dg(e,g,[...c,f])}})}function Gg(a,b){let c=a.get(b);void 0===c&&(c=new Map,a.set(b,c));return c}function Kg(a,b,c,d,e){a.db.sf(a.C,b,c,d.C,e)}
|
|
577
|
+
function Hg(a,b,c){const d=a.get(b);if(void 0!==d){const e=d.get(c);d.delete(c);0===d.size&&a.delete(b);return e}}function Cg(a,b,c){if(!a.has(vg+b)){const d=yg+b,e=a.get(d);Eg(c,void 0!==e?e:null)||(null===c?a.delete(d):a.set(d,c),Jg(a,b,c,null!==c))}}function Cf(a){a.forEach((b,c)=>{const d=c[0];if(d===X||d===Y){const e=c.substring(1),f=d===X?Y:X;b.forEach(g=>{g.e&&(Kg(a,e,d,g,!0),Kg(g,e,f,a,!0))})}else if(d===vg||d===yg)c=c.substring(1),Jg(a,c,b,d===yg)})}
|
|
578
|
+
function Df(a){a.forEach((b,c)=>{const d=c[0];if(d!==zg){var e=c.substring(1);d===X?b.forEach(f=>{f.unlink(e,a)}):d===Y?b.forEach(f=>{a.unlink(e,f)}):d===vg?a.update(e,null):d===xg&&Bf(a,e,null);a.delete(c)}});if(void 0!==a.F){const b=a.db.get(a.F.tag);let c,d;(null==(c=b.get(vg+a.F.La))?void 0:null==(d=c.X)?void 0:d.call(c))===a.C&&b.update(a.F.La,null)}}function Ig(a){void 0!==a.F&&(uf(a),a.db.Kb(a.C,a.F.tag,a.F.La),a.F=void 0)}
|
|
579
|
+
olympe.dc.db.Instance=class extends Map{constructor(a,b){super();this.C=a;this.G=null;this.e=!1;this.F=void 0;this.c=0;this.O=!1;this.db=b}tag(){return this.C}Fa(){return this.e}L(){return this.db.L(this.C)}source(){return this.G}model(){const a=this.get(Y+Ag);let b;return null!=(b=a&&Array.from(a.values())[0])?b:null}Qe(){const a=this.get(Y+Bg);let b;return null!=(b=a&&Array.from(a.values())[0])?b:null}toString(){var a=this.Ka(olympe.dc.CloudObject.nameProp.X());a=`Instance: ${this.C}, Exist: ${this.e}, Name: ${a}`;
|
|
580
|
+
var b=this.model();if(b){var c=b.Ka(olympe.dc.CloudObject.nameProp.X())||'No model name';a+=`\nModel: ${b.C}, Exist: ${b.e}, Model name: ${c}`}else a+='\nModel: no model';(b=this.Qe())?(c=b.Ka(olympe.dc.CloudObject.nameProp.X())||'No extension name',a+=`\nExtension: ${b.C}, Exist: ${b.e}, Extension name: ${c}`):a+='\nExtension: no extension';return a}Ka(a,b=!1){const c=this.get(vg+a);return b||void 0!==c?c:this.get(yg+a)}update(a,b){const c=vg+a;var d=this.get(c);d=void 0===d?null:d;if(!Eg(d,b))if(Fg(this,
|
|
581
|
+
a,d,b),d=yg+a,null===b){this.delete(c);let e;b=null==(e=this.model())?void 0:ef(e,a);void 0!==b?(this.set(d,b),Jg(this,a,b,!0)):Jg(this,a,null,!1)}else this.set(c,b),this.delete(d),Jg(this,a,b,!1)}link(a,b){var c=X+a;const d=Gg(this,Y+a);c=Gg(b,c);d.has(b.C)||(d.set(b.C,b),c.set(this.C,this),this.db.C(Ef.Hj,this.C,a,Y,b.C),this.db.C(Ef.Hj,b.C,a,X,this.C),this.e&&b.e&&(Kg(this,a,Y,b,!0),Kg(b,a,X,this,!0)))}unlink(a,b){const c=X+a;void 0!==Hg(this,Y+a,b.C)&&(Hg(b,c,this.C),this.db.C(Ef.Pl,this.C,a,
|
|
582
|
+
Y,b.C),this.db.C(Ef.Pl,b.C,a,X,this.C),this.e&&b.e&&(Kg(this,a,Y,b,!1),Kg(b,a,X,this,!1)))}persist(){this.O=!0;return this}clear(){this.forEach((a,b)=>{const c=b[0];if(c===X||c===Y){const d=b.substring(1),e=c===X?Y:X;a.forEach(f=>{const g=f.get(e+d);g.delete(this.C);0===g.size&&f.delete(e+d)})}c===vg&&a instanceof olympe.dc.Bc&&Ig(this.db.get(a.X()))});void 0!==this.F&&this.db.get(this.F.tag).delete(vg+this.F.La)}};olympe.dc.db.ah=class a{constructor(b){this.hc=b;this.Z=this.Ja=null;this.bc=olympe.dc.ec.NONE;this.F=a.C.Vj;this.C=this.mb=this.ac=this.ba=this.properties=null}tag(){return this.hc}Ec(){return this.Z}yb(){return this.Ja}getState(){return this.F}za(b){if(null===this.Z)this.Z=b;else if(this.Z!==b)throw Error(`Try to set a model relation with another model ${b} than the one set initially ${this.Z}`);return this}O(){return this.F===a.C.zc?this.bc:olympe.dc.ec.NONE}create(b){this.F=a.C.yl;this.Ja=null!=
|
|
583
|
+
b?b:null;return this}delete(b=olympe.dc.ec.NONE){this.F=a.C.zc;this.bc=b;this.properties=null;return this}ka(b,c){if(this.F===a.C.zc)return this;this.properties||(this.properties=new Map);this.properties.set(b,c);return this}mm(b){this.F!==a.C.zc&&(this.properties||(this.properties=new Map),b.forEach((c,d)=>{this.properties.set(d,c)}))}pd(b,c){if(null!==this.ba&&this.ba!==b)throw Error('An instance should never be set as complex property of multiple instances');this.ba=b;this.ac=c}fa(b){let c;null==
|
|
584
|
+
(c=this.properties)||c.delete(b);0===this.properties.size&&(this.properties=null)}link(b,c){null===this.mb&&(this.mb=new Map);b===olympe.dc.qc.$c&&this.za(c);this.sa(this.mb,b,c,!0);return this}unlink(b,c){null===this.mb&&(this.mb=new Map);b===olympe.dc.qc.$c&&this.za(c);this.sa(this.mb,b,c,!1);return this}Kb(b,c){null===this.C&&(this.C=new Map);this.sa(this.C,b,c,!0)}Tb(b,c){null===this.C&&(this.C=new Map);this.sa(this.C,b,c,!1)}tb(b,c,d){if(c=c===olympe.dc.ua.ORIGIN?this.C:this.mb)return(b=c.get(b))&&
|
|
585
|
+
b.get(d)}L(b,c,d){const e=(c=c===olympe.dc.ua.ORIGIN?this.C:this.mb)&&c.get(b);e&&e.delete(d);e&&0===e.size&&c.delete(b)}G(){return this.F===a.C.yl}Td(){return this.F===a.C.zc}Kc(){let b=this.properties?this.properties.size:0;this.mb&&this.mb.forEach(c=>{b+=c.size});return b}T(){return null!==this.properties}Cb(){let b;return null!=(b=this.properties)?b:new Map}Ka(b){if(this.properties)return this.properties.get(b)}bb(b,c=(d,e)=>[d,e]){return function*(d){if(d=d&&d.get(b.X()))for(const [e,f]of d)yield c(e,
|
|
586
|
+
f)}(b.Ga()===olympe.dc.ua.ORIGIN?this.C:this.mb)}Pb(b){const c=b.Ga()===olympe.dc.ua.ORIGIN?this.C:this.mb;return(b=c&&c.get(b.X()))&&0!==b.size?Array.from(b.keys())[0]:null}td(b=(c,d,e)=>[c,d,e]){return this.oa(this.mb,b)}ob(b=(c,d,e)=>[c,d,e]){return this.oa(this.C,b)}jb(b=(c,d,e,f)=>[c,d,e,f]){const c=olympe.dc.ua.ORIGIN,d=olympe.dc.ua.DESTINATION;return function*(e,f,g){yield*e(f,(h,k,l)=>b(h,d,k,l));yield*e(g,(h,k,l)=>b(h,c,k,l))}(this.oa.bind(this),this.mb,this.C)}sa(b,c,d,e){if(this.F!==a.C.zc||
|
|
587
|
+
!e){var f=b.get(c);if(void 0===f)f=new Map,b.set(c,f);else if(b=f.get(d),void 0!==b&&b!==e){f.delete(d);return}f.set(d,e)}}*oa(b,c){if(null!==b)for(const [d,e]of b){b=e.entries();for(const [f,g]of b)yield c(d,f,g)}}};olympe.dc.db.ah.C={yl:0,Vj:1,zc:2};olympe.dc.db.Lt=class{constructor(a,b,c,d){this.H=a;this.view=b;this.C=c;d&&this.init()}debug(a){const b=olympe.dc.ga(a);if(this.C.has(b)){var c=this.C.get(a);a='\n[DEBUG - DATABASE]\n'+c.toString();if(!c.Fa()){const d=[];for(;null!==c&&!d.includes(c.tag());)d.push(c.tag()),c=c.model();c=this.C.get(d[d.length-1]);const e=olympe.dc.db.Database.C.mi+olympe.dc.CloudObject.nameProp.X();d.push('???');a+='\n\nThe instance <<'+b+'>> does not exists because the instance '+c.tag()+' (name: '+c.get(e)+') has no model.\nList: '+
|
|
588
|
+
d.join(' --M--\x3e ')}this.H.info(a)}else this.H.info('[DATABASE] Instance',b,'has never been created or referred by the database')}init(){const a=olympe.dc.db.Database.F.oo,b=olympe.dc.db.Database.F.bl,c=olympe.dc.db.Database.F.zc,d=olympe.dc.db.Database.F.Hj,e=olympe.dc.db.Database.F.Pl,f=olympe.dc.db.Database.F.Mn,g=olympe.dc.db.Database.F.Nn,h=()=>{};this.C.addEventListener(olympe.dc.db.Database.F.no,()=>{});this.C.addEventListener(a,()=>{});this.C.addEventListener(b,k=>{this.C.ob(()=>{$f(this.view,
|
|
589
|
+
k,h,`monitorRelations${k}`)})});this.C.addEventListener(c,k=>{this.C.ob(()=>{ag(this.view,k,`monitorRelations${k}`)})});this.C.addEventListener(d,()=>{});this.C.addEventListener(e,()=>{});this.C.addEventListener(f,()=>{});this.C.addEventListener(g,()=>{})}};olympe.dc.db.Rq=class{constructor(a,b,c,d,e){this.H=a;this.C=b;this.ia=c;this.G=d;this.L=e}write(a){if(this.G){const b=new Lg(this.ia);a.qd(b);this.H.info(b.flush())}this.C.ve();a.qd(this);this.C.Od()}Nc(a,b,c){this.C.create(a,b,c,this.L)}Xc(a,b){this.C.update(a,b)}F(a,b=olympe.dc.ec.NONE){for(const c of df(this.ia,a,b))this.C.za(c)}Ea(a,b,c){this.C.link(a,b,c)}ic(a,b,c){this.C.unlink(a,b,c)}};
|
|
590
|
+
function Mg(a,b,c){if(!b)return'';let d='';if(c&&1<c)return'...';for(const [e,f]of b)if(d+=(d?', "':'"')+e+'":',!f)d+=JSON.stringify(f);else if(f instanceof olympe.dc.Bc||f instanceof olympe.dc.CloudObject)d+='Reference("'+f.X()+'")';else if(f instanceof olympe.D.Color)d+='Color("'+f.Kg()+','+f.Hg()+','+f.Dg()+','+f.Cg()+'")';else if(f.constructor&&Object.prototype.hasOwnProperty.call(f.constructor.prototype,'toString'))d+=JSON.stringify(f.toString());else if('object'===typeof f){let g;d+=Mg(a,f,
|
|
591
|
+
(null!=(g=c)?g:0)+1)}return'{'+(d?d:'')+'}'}function Ng(a,b){let c;return'string'===typeof b?null!=(c=a.db.name(b))?c:b:''}function Og(a,b){let c;return b===olympe.dc.qc.$c?'Model':null!=(c=a.db.name(b))?c:b}
|
|
592
|
+
class Lg{constructor(a){this.db=a;this.output='Applying patch on the local database'}flush(){const a=this.output;this.output='';return a}log(a,b){this.output+=`\ndb.${a};${b?`// ${b}`:''}`}Nc(a,b,c,d){this.log(`createInstance(tag: ${a}, source: ${b}, ${Mg(this,c)})`,Ng(this,d))}Xc(a,b,c){this.log(`updateInstance(tag: ${a}, ${Mg(this,b)})`,Ng(this,c))}F(a,b,c){this.log(`deleteInstance("${a}", rule: ${b})`,Ng(this,c))}Ea(a,b,c){this.log(`createRelation("${a}", "${b}", "${c}")`,Og(this,a))}ic(a,b,c){this.log(`deleteRelation("${a}", "${b}", "${c}")`,
|
|
593
|
+
Og(this,a))}}olympe.dc.db.Rq.xa=[olympe.dc.Writable,olympe.dc.Writable];olympe.dc.db.R={Ca:'dc.db.Logger',fl:'dc.db.gc.Logger',Ha:'dc.db.DatabaseManager',ej:'dc.db.Database',Vk:'dc.db.DBView',xz:'dc.db.Graph',yy:'dc.db.DatabaseWriter',iA:'dc.db.PermissionProcessor',gi:'dc.db.GraphMonitor'};olympe.dc.db.U={Co:'db.garbageCollector',Do:'db.garbageCollectorDelay',gi:'db.monitor',fo:'db.debug'};
|
|
594
|
+
olympe.W.config(function(a){G(a,olympe.dc.db.U.Co,olympe.dc.db.df.C.hn);G(a,olympe.dc.db.U.Do,5E3);G(a,olympe.dc.db.U.gi,!1);G(a,olympe.dc.db.U.fo,!1);F(a,olympe.dc.db.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('db'));F(a,olympe.dc.db.R.fl,[olympe.ma.R.Ha],b=>b.Oc('gc'));F(a,olympe.dc.db.R.ej,[olympe.dc.db.R.Ca,olympe.dc.db.R.fl,new olympe.W.ja(olympe.dc.U.sg),new olympe.W.ja(olympe.dc.db.U.Co),new olympe.W.ja(olympe.dc.db.U.Do),new olympe.W.ja(olympe.dc.U.oh),new olympe.W.ja(olympe.dc.db.U.fo)],(b,c,d,e,f,g,
|
|
595
|
+
h)=>{e=g?olympe.dc.db.df.C.Zk:e;d=(new Map).set('selfTag',d).set('garbageCollector',e).set('garbageCollectorDelay',f).set('debug',h);return new olympe.dc.db.Database(b,c,d)});E(a,olympe.dc.db.R.Vk,olympe.dc.ib,olympe.dc.db.R.Ca,olympe.dc.db.R.ej);F(a,olympe.dc.db.R.gi,[olympe.dc.db.R.Ha],b=>b.hx);E(a,olympe.dc.db.R.Ha,olympe.dc.db.vs,olympe.dc.db.R.Ca,olympe.dc.db.R.ej,olympe.dc.db.R.Vk,new olympe.W.ja(olympe.dc.U.Ff),new olympe.W.ja(olympe.dc.db.U.gi))},'olympe.dc.db');
|
|
596
|
+
olympe.W.run([olympe.dc.db.R.ej,olympe.dc.db.R.gi],(a,b)=>{olympe.ge().db=a;olympe.ge().dbMonitor=b},'DC.DB debug service injection');olympe.dc.query={};function Pg(a){return(b,c)=>{const d=null===b,e=null===c;return d||e?d&&e?0:d?1:-1:a(b,c)}}
|
|
597
|
+
olympe.dc.query.$e=class{constructor(a,b,c){this.db=olympe.dc.ia();this.C=a;this.La=b;this.ei=c}ha(){return{p:this.La.X(),o:this.ei}}toString(){return'sortByQueryPart-'+this.ei+this.La.X()}Fg(){const a=this.db.Pb(this.La,olympe.dm.Property.typeRel),b=olympe.dc.ga;if(a===b(olympe.dm.String))return Pg((c,d)=>c.localeCompare(d));if(a===b(olympe.dm.Number)||a===b(olympe.dm.Boolean))return Pg((c,d)=>c-d);if(a===b(olympe.dm.DateTime))return Pg((c,d)=>c.getTime()-d.getTime());if(a===b(olympe.dm.Color))return Pg((c,
|
|
598
|
+
d)=>c.compare(d));olympe.ma.ab('dc.query').warn(`No comparator found for type with tag ${a}`);return Pg(()=>-1)}Ka(){return this.La}};function Qg(a,b){return new olympe.dc.query.ld((new olympe.dc.transaction.Aj(b)).C(a),b)}olympe.dc.query.ld=class{constructor(a,b){this.C=a;this.source=b}static Fi(a){return new olympe.dc.query.ld(new olympe.dc.db.Sc(`DataResult_${a.V()}`),a.yb())}create(a,b,c){this.C.Nc(a,this.source,c,b);return this}Ea(a,b,c){this.C.Ea(a,b,c,null,null);return this}Wb(){return this.C}ha(){const a=new olympe.dc.transaction.mg;this.C.qd(a);return{s:this.source,p:Rg(a)}}};
|
|
599
|
+
olympe.dc.query.ld.prototype.createRelation=olympe.dc.query.ld.prototype.Ea;olympe.dc.query.ld.prototype.create=olympe.dc.query.ld.prototype.create;olympe.dc.query.ld.fromQuery=olympe.dc.query.ld.Fi;olympe.dc.Fe=class{X(){}};olympe.dc.Fe.prototype.getTag=olympe.dc.Fe.prototype.X;olympe.dc.Az=olympe.dc.Fe;function Sg(a){let b;if(null==(b=a.C)?0:b.Fh())if(a=a.L,!a.O){let c;null==(c=a.T)||c.call(a)}}function Tg(a,b,c,d,e){Sg(a);let f,g;b?null==(f=a.C)||f.Ea(c,d,e):null==(g=a.C)||g.ic(c,d,e)}
|
|
600
|
+
olympe.dc.query.Pt=class{constructor(a,b,c,d){this.H=a;this.source=b;this.F=c;this.L=d;this.C=this.G=null;this.db=olympe.dc.ia()}watch(a,b){if(this.db.source(a)===this.source){var c=`${this.F}:${a}:notif`;Fe(this.db,a,(d,e)=>{if(d){Sg(this);let f;null==(f=this.C)||f.ba(e)}else if(b&&Xf(this.db,e,c),!this.db.Fa(e)){Sg(this);let f;null==(f=this.C)||f.F(e,olympe.dc.ec.NONE)}},c);b&&Wf(this.db,a,(d,e,f)=>{Sg(this);let g;f||null!=(g=this.C)&&g.Xc(a,new Map([[d,e]]))},c)}}stop(a){Ee(this.db,a,`${this.F}:${a}:notif`)}};olympe.dc.query.Bj={ASC:'ASC',DESC:'DESC'};function Ug(a){const b=Vg(a.query),c=new Map;for(let e=b.length;0<=e;e--){const f=0<e?b[e-1].V():a.G,g=0<e?b[e-1].C:'root',h=0<e&&b[e-1].T(),k=a.C.get(f),l=new Set(k.Id()),n=new Map,p=a.L.has(f);let q=p?';':'';if(c.has(f)){const [r,t,u]=c.get(f);c.delete(f);q+=u;r.forEach((w,y)=>{for(const z of k.F(y)){let A;n.set(z,Array.from(w).map(C=>p?`${y};${C}`:C).reduce((C,M)=>C.add(M),null!=(A=n.get(z))?A:new Set))}l.delete(y)});t&&l.forEach(w=>{const y=p?`${w};${u}`:u;for(const z of k.F(w)){let A;n.set(z,
|
|
600
601
|
(null!=(A=n.get(z))?A:new Set).add(y))}})}else l.forEach(r=>{const t=p?`${r};`:'';for(const u of k.F(r))n.has(u)?n.get(u).add(t):n.set(u,(new Set).add(t))});if(0<e&&c.has(g)){const [r,t,u]=c.get(g),w=new Map;n.forEach((y,z)=>{let A;null==(A=r.get(z))||A.forEach(C=>{let M;const K=null!=(M=w.get(z))?M:new Set;y.forEach(ta=>K.add(ta+C));w.set(z,K)});n.delete(z);r.delete(z)});t&&n.forEach((y,z)=>{w.set(z,new Set(Array.from(y).map(A=>A+u)))});b[e-1].T()&&r.forEach((y,z)=>{w.set(z,new Set(Array.from(y).map(A=>
|
|
601
|
-
q+A)))});c.set(g,[w,t&&h,q+u])}else c.set(g,[n,h,q])}let d;a=null==(d=c.get('root'))?void 0:d[0].get('root');return Array.from(null!=a?a:[]).map(e=>e.slice(0,-1).split(';'))}function
|
|
602
|
-
function
|
|
603
|
-
function
|
|
604
|
-
function
|
|
605
|
-
olympe.dc.query.
|
|
606
|
-
this.C.get(b);if(null==b||!b.has(a))return!0;b.remove(a,c)&&
|
|
607
|
-
function
|
|
608
|
-
a.s,olympe.dc.
|
|
609
|
-
olympe.dc.query.Aa=class{observe(){}
|
|
610
|
-
a,b,!1,c)}static
|
|
611
|
-
return new olympe.dc.query.$.
|
|
612
|
-
olympe.dc.query.Aa.regex=olympe.dc.query.Aa.
|
|
613
|
-
function
|
|
614
|
-
b.V();for(c=a.G+1;c<a.va.length&&a.va[c].V()!==d;)c++;b=c<a.va.length?a.va:a.va.concat(b);return new olympe.dc.pa(a.F,a.source,b,c,a.
|
|
615
|
-
function
|
|
616
|
-
olympe.dc.pa=class{constructor(a,b,c=[],d=-1,e=new Set,f={max:-1,offset:0,
|
|
617
|
-
b,c){if(!olympe.dc.CloudObject.exists(b))throw new olympe.dc.query.
|
|
618
|
-
a=new olympe.dc.pa(d,a);a.C.
|
|
619
|
-
b=!1){if(!(a instanceof olympe.dc.Ma.Relation))throw new olympe.dc.query.
|
|
620
|
-
olympe.dc.query.Aa))throw new olympe.dc.query.
|
|
621
|
-
if(!olympe.dc.
|
|
622
|
-
this.va[b].C;for(b--;-1<b&&
|
|
623
|
-
this.C.
|
|
624
|
-
a.cacheId}).then(d=>{let e;return null!=(e=null==d?void 0:
|
|
625
|
-
a.
|
|
626
|
-
olympe.dc.pa.prototype.observe=olympe.dc.pa.prototype.observe;olympe.dc.pa.prototype.executeFromCache=olympe.dc.pa.prototype.
|
|
627
|
-
olympe.dc.pa.prototype.andReturn=olympe.dc.pa.prototype.
|
|
628
|
-
function
|
|
629
|
-
{const n=()=>{p&&c.
|
|
630
|
-
function
|
|
631
|
-
function
|
|
632
|
-
function
|
|
633
|
-
olympe.dc.query.
|
|
634
|
-
f===olympe.dc.Pa.SERVER)return d(),null;if(a!==olympe.dc.pa.Tc.
|
|
635
|
-
t.forEach(u=>this.C.Hc(u));g=null}d()}).catch(e)},l=c.V();k(!1);const n=
|
|
636
|
-
q=>{this.H.error(`An error occurred with the subscription ${l}: ${q}`);e(String(q))}));return()=>{h=!0;this.H.debug(`Unsubscribe to query ${l} from data source ${f}`);p.unsubscribe()}}};function
|
|
637
|
-
olympe.dc.Oa=class{constructor(){this.C=[];this.F=new Map;this.G=[];this.
|
|
638
|
-
a||void 0===a?-1:'string'===typeof a?this.C.indexOf(a):this.
|
|
639
|
-
a(this.F.get(b),c))}map(a){return this.
|
|
640
|
-
b,{Fb:c,
|
|
641
|
-
p[0])),k=new Set(a.keys()),l=[],n=[];e.forEach(([p],q)=>{!k.has(p)&&l.push(q)});k.forEach(p=>{!h.has(p)&&n.push(p)});return olympe.dc.Oa.create(e,l,n,c)}static create(a,b,c,d){const e=new olympe.dc.Oa;e.C=a.map(f=>f[0]);e.F=new Map(a);e.hash=d||olympe.Y.
|
|
642
|
-
olympe.dc.Oa.prototype.sort=olympe.dc.Oa.prototype.sort;olympe.dc.Oa.prototype.map=olympe.dc.Oa.prototype.map;olympe.dc.Oa.prototype.forEach=olympe.dc.Oa.prototype.forEach;olympe.dc.Oa.prototype.find=olympe.dc.Oa.prototype.find;olympe.dc.Oa.prototype.filter=olympe.dc.Oa.prototype.filter;olympe.dc.Oa.prototype.shift=olympe.dc.Oa.prototype.shift;olympe.dc.Oa.prototype.pop=olympe.dc.Oa.prototype.pop;olympe.dc.Oa.prototype.push=olympe.dc.Oa.prototype.push;olympe.dc.Oa.prototype.getAt=olympe.dc.Oa.prototype.
|
|
643
|
-
olympe.dc.Oa.prototype.getFirst=olympe.dc.Oa.prototype.xc;olympe.dc.Oa.prototype.get=olympe.dc.Oa.prototype.get;olympe.dc.Oa.prototype.indexOf=olympe.dc.Oa.prototype.indexOf;olympe.dc.Oa.prototype.has=olympe.dc.Oa.prototype.has;olympe.dc.Oa.prototype.size=olympe.dc.Oa.prototype.size;olympe.dc.Oa.prototype.toArray=olympe.dc.Oa.prototype.
|
|
644
|
-
olympe.dc.Oa.empty=olympe.dc.Oa.empty;function
|
|
645
|
-
olympe.dc.
|
|
646
|
-
function
|
|
647
|
-
function
|
|
648
|
-
function
|
|
649
|
-
olympe.dc.query.
|
|
650
|
-
a.F)&&this.C.Dc(a))}
|
|
651
|
-
function
|
|
652
|
-
class
|
|
653
|
-
!this.O&&this.db.Fa(a))){var c;this.C||(this.C=null==(c=this.properties)?void 0:c.some(([d,e])=>b.has(d)
|
|
654
|
-
new olympe.dc.Ma.Relation(a),c)){const d=this.G.get(
|
|
655
|
-
olympe.dc.query.Relation=class extends olympe.dc.Ma.Relation{constructor(a,b,c){super(a,b);this.recursive=c}toJSON(){let a='{ "tag": '+JSON.stringify(this.X())+', ';a+='"direction": '+JSON.stringify(this.Ga())+', ';a+='"recursive": '+JSON.stringify(this.recursive);return a+'}'}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.dc.query.Relation(b.tag,b.direction,b.recursive)}static from(a,b){return new olympe.dc.query.Relation(a.X(),a.Ga(),null!=b?b:a instanceof olympe.dc.da.
|
|
656
|
-
olympe.dc.ua.DESTINATION,b=olympe.dc.ua.ORIGIN;return new olympe.dc.query.Relation(this.tag,this.direction===a?b:a,this.recursive)}V(){return`${this.direction}${this.tag}${this.recursive?'-r':''}`}};olympe.dc.query.R={Ca:'dc.query.Logger',
|
|
657
|
-
Array(this.$.length).fill(!1);let e=null;const f=(g,h)=>{d[g]=h;g=d.every(k=>k);e!==g&&(e=g,c(g))};this.$.forEach((g,h)=>{g.observe(a,olympe.Y.
|
|
658
|
-
this.La))}observe(a,b,c){
|
|
659
|
-
c:this.C}}};olympe.dc.query.$.
|
|
660
|
-
this.La))}observe(a,b,c){
|
|
661
|
-
b:'null';return'Equals-'+this.La+'-'+c}Jc(){return{name:'EQUALS',property:this.La,value:this.C}}ha(){let a=1,b=this.C;switch(!0){case this.C instanceof Date:a=2;b=this.C.toJSON();break;case this.C instanceof olympe.dc.CloudObject:a=3;b=this.C.X();break;case this.C instanceof olympe.D.Color:a=4,b=this.C.toJSON()}return{pr:olympe.dc.query.Aa.C.
|
|
662
|
-
olympe.dc.query.$.
|
|
663
|
-
this.F&&this.C>=a.C||!this.F&&this.C<=a.C:this.C===a.C:!1}
|
|
664
|
-
typeof this.C&&
|
|
665
|
-
b){this.C.clear(a,olympe.Y.
|
|
666
|
-
k);e!==g&&(e=g,c(g))};this.$.forEach((g,h)=>{g.observe(a,olympe.Y.
|
|
667
|
-
typeof a?this.C.test(this.F?a:a.toLowerCase()):!1}toString(){return'Regex'+this.La+'-'+this.C.toString()+'-'+this.F}Jc(){return{name:'REGEX',property:this.La,pattern:this.C,caseSensitive:this.F}}ha(){return{pr:olympe.dc.query.Aa.C.
|
|
668
|
-
function
|
|
669
|
-
olympe.dc.query.va.
|
|
670
|
-
b,c,d;return`${this.C}-${this.optional}${null!=(c=null==(a=this.F)?void 0:a.toString())?c:''}${null!=(d=null==(b=this.Fb)?void 0:b.toString())?d:''}`}Jc(){}toJSON(){}ha(){const a={i:this.C,o:this.optional};null!==this.F&&(a.p=this.F.ha());null!==this.Fb&&(a.c=this.Fb.ha());return a}Z(){}
|
|
671
|
-
|
|
672
|
-
f,g)}))}};olympe.dc.query.va.lh=class extends olympe.dc.query.va.
|
|
673
|
-
c:0;this.content.set(a,b+1);return 0===b}remove(a,b){if(null===b)return this.content.delete(a);b=this.content.get(a);1<b?this.content.set(a,b-1):this.content.delete(a);return 1===b}};olympe.dc.query.va.
|
|
674
|
-
{
|
|
675
|
-
this.Fb&&(a.sort={property:this.Fb.
|
|
676
|
-
this.relation).forEach(d=>{
|
|
677
|
-
{recursive:this.G?'INCLUDE_SELF':'EXCLUDE_SELF',relation:this.relation,filter:
|
|
678
|
-
g=olympe.dm.Relation.C
|
|
679
|
-
b(f,g,e,k)};return(e,f,g,h)=>{g=olympe.Y.
|
|
680
|
-
return this}sort(){olympe.ma.ab('dc.query').warn('Should never try to sort queries with follow rules, ignore...');return this}};olympe.dc.query.va.
|
|
681
|
-
function
|
|
682
|
-
k[
|
|
683
|
-
(M.content=p);break;default:throw Error(`Data Http request type not supported ${n}`);}let K;const ta=null!=(K=k['X-Source-Origin'])?K:olympe.dc.Pa.
|
|
684
|
-
|
|
685
|
-
function
|
|
686
|
-
function fi(a,b,c){if(b===olympe.dc.Pa.SERVER){var d;return null!=(d=
|
|
687
|
-
function gi(a,b){return b instanceof olympe.net
|
|
688
|
-
function ii(a,b){var c=fi(a,b.
|
|
689
|
-
olympe.dc.sources.
|
|
690
|
-
[olympe.dc.Request.C.
|
|
691
|
-
`${f}/${b}`:`${f}?tag=${b}&model=${c}`,
|
|
692
|
-
e).then()}downloadFileContent(a){const {tag:b,model:c}=a.content,d=a.
|
|
693
|
-
{const k=h instanceof ArrayBuffer?new Uint8Array(h,0,h.byteLength):h;let l;null==(l=this.C.get(b))||l.forEach(n=>n.done(k))}).catch(h=>{let k;null==(k=this.C.get(b))||k.forEach(l=>l.zh(`${h}`))}).finally(()=>{this.C.delete(b)});return f}};olympe.dc.sources.
|
|
694
|
-
function ti(a,b){const c=b.V();null===a.F&&(a.F=new olympe.Y
|
|
695
|
-
function ui(a,b){const c=b.V();let d,e;const f=null!=(e=null==(d=a.F)?void 0:d.get(c))?e:new olympe.dc.db.Sc(c);let g;null==(g=a.F)||g.delete(c);b.
|
|
696
|
-
olympe.dc.sources.
|
|
697
|
-
for(const [f,g]of e)this.H.debug(`=> DataType: ${g.name()} (${f})`)}d&&(d=!1,b())},c))})).then(()=>this.C.init(this.G)).catch(b=>{this.H.error(`Error while initialization of DataSource ${this.C.name()} (${this.V()}): ${b}`)});return this}healthCheck(){return this.C.healthCheck().then(()=>`Data source ${this.C.name()} (${this.C.V()}) OK`)}destroy(){this.G.destroy();return this.C.destroy()}request(a){const b=a.content;var c=a.getType();switch(c){case ji:const d=olympe.dm.DataSource.
|
|
698
|
-
return this.C.healthCheck().then(()=>({s:e})).catch(g=>({s:d,r:String(g)}));case ki:return this.C.executeQuery(b);case pi:return c=b.Wb(),ti(this,c),this.
|
|
699
|
-
b.Wb());case mi:return b.content instanceof Uint8Array?this.C.uploadFileContent(b.tag,b.model,b.content).then(()=>`datasource://${b.tag}`):Promise.reject('File content is undefined');case ni:return this.C.downloadFileContent(b.tag,b.model);case oi:return this.C.deleteFileContent(b.tag,b.model);default:return Promise.reject(`Request of type ${a.getType()} is not supported by the data source`)}}fa(a){if(a.getType()===li){const b=a.content;a=a.origin;return a===olympe.dc.Pa.SELF?vi(this,b):
|
|
700
|
-
b,this.G,a,olympe.dc.pa.Tc.
|
|
701
|
-
function yi(a,b,c,d,e){if('string'!==typeof c)throw Error(`Patch: model of instance ${b} is missing. It is invalid transaction.`);return new Ai(a,b,c,d,e)}olympe.dc.sources.
|
|
702
|
-
class zi extends olympe.dc.sources.
|
|
703
|
-
olympe.dc.sources.
|
|
704
|
-
q=a.getType();var r=a.
|
|
705
|
-
Array.from(l.Wb().
|
|
706
|
-
Bi(b,t));case g:return Promise.resolve();case k:return r=a.content,p.uploadFileContent(r.tag,r.content,r.mimeType);case l:return p.downloadFileContent(a.content.tag);case n:return p.deleteFileContent(a.content.tag);default:return Promise.reject(`Messages of type ${a.getType()} is not supported by the source ${b.V()}`)}})}fa(a,b){if(!this.F.F)return this.Z(a,b);const c=olympe.dc.sources.
|
|
707
|
-
{olympe.D.
|
|
708
|
-
function Qi(a,b){b=b.uc();if(b!==olympe.dm.User.C&&a.
|
|
709
|
-
function Ri(a,b,c,d,e){return
|
|
710
|
-
g=yield d.
|
|
711
|
-
olympe.dc.sources.
|
|
602
|
+
q+A)))});c.set(g,[w,t&&h,q+u])}else c.set(g,[n,h,q])}let d;a=null==(d=c.get('root'))?void 0:d[0].get('root');return Array.from(null!=a?a:[]).map(e=>e.slice(0,-1).split(';'))}function Wg(a){if(null===a.F){const b={Fb:a.query.Fg(),zd:a.zd,max:a.query.C.max,offset:a.query.C.offset};a.F=olympe.dc.Oa.from(a.Z,Ug(a),b)}return a.F}function Xg(a,b){a.T=b}function Yg(a){if(!a.O){null!==a.F&&(a.Z=a.F);a.F=null;a.O=!0;let b;null==(b=a.T)||b.call(a)}}
|
|
603
|
+
function Zg(a,b){let c;return null!=(c=a.C.get(b).Id())?c:[]}function $g(a,b,c){let d,e;return null!=(e=null==(d=a.C.get(c))?void 0:d.has(b))?e:!1}function ah(a,b,c=a.G,d='root'){const e=a.C.get(c);if(!e)return a.H.error('Try to insert result entry to a higher level than possible'),null;const f=!e.has(b);e.G(b,d)&&Yg(a);let g;f&&(null==(g=a.ye)||g.watch(b,a.L.has(c)));return f}function bh(a,b,c,d,e,f){null!==a.ye&&(d===olympe.dc.ua.ORIGIN?Tg(a.ye,b,c,f,e):Tg(a.ye,b,c,e,f))}
|
|
604
|
+
function ch(a){a.H.C()&&a.H.debug(`Start sending notifications for query ${a.query.V()}`);const b=new olympe.dc.query.Pt(a.H,a.query.yb(),a.query.V(),a);a.C.forEach((c,d)=>{for(const e of c.Id())b.watch(e,a.L.has(d))});null!=b.C||(b.C=new olympe.dc.db.Sc);a.ye=b}function dh(a){null!==a.ye&&(a.H.C()&&a.H.debug(`Stop sending notifications for query ${a.query.V()}`),a.C.forEach(b=>{for(const c of b.Id())a.ye.stop(c)}),a.ye=null)}
|
|
605
|
+
function eh(a){a.O=!1;if(null!=(a=a.ye)){let b;const c=!(null==(b=a.C)?0:b.Fh());a.G=c?a.C:null;c&&(a.C=new olympe.dc.db.Sc,a.H.C()&&a.H.debug(`Commit notification with ${a.G.L()} operations for query ${a.F}`))}}
|
|
606
|
+
olympe.dc.query.Op=class{constructor(a,b){this.H=a;this.query=b;this.G=olympe.Y.vb(b.F);this.va=new Map;this.C=(new Map).set(this.G,new olympe.dc.query.va.Ul);this.L=new Set(b.L);this.zd=-1;this.O=!1;this.T=null;this.Z=olympe.dc.Oa.empty();this.ye=this.F=null;a=Vg(b);a.forEach(c=>{const d=c.V();this.va.set(d,c.O());this.C.set(d,c.za())});b=b.Fg();if(null!==b){b=b.C;let c=-1;for(const d of[this.G].concat(a.map(e=>e.V())))if(c+=this.L.has(d)?1:0,b===d){this.zd=c;break}}}remove(a,b=this.G,c='root'){b=
|
|
607
|
+
this.C.get(b);if(null==b||!b.has(a))return!0;b.remove(a,c)&&Yg(this);if(!b.has(a)){let d;null==(d=this.ye)||d.stop(a);return!0}return!1}Dc(a){const b=a.F,c=olympe.Y.vb(b);a=Vg(a);const d=[];for(const [f,g]of this.C){if(g.O(b))return!0;g.has(b)&&d.push(f)}const e=(new Map).set(c,d);return 0<d.length&&a.every(f=>{let g;const h=(null!=(g=e.get(f.C))?g:[]).flatMap(k=>f.ba(k,this.va.get(k))).filter(k=>{let l,n;return null!=(n=null==(l=this.va.get(k))?void 0:l.Dc(f))?n:!1});e.set(f.V(),h);return 0<h.length})}};function fh(a){if(!olympe.dc.ia().jc(a,olympe.dm.Property))throw new olympe.dc.query.Ed(`The specified property while trying to build a query predicate is invalid: ${a}`);}
|
|
608
|
+
function gh(a){var b=olympe.dc.query.Aa.C.Cq;const c=olympe.dc.query.Aa.C.po,d=olympe.dc.query.Aa.C.cj,e=olympe.dc.query.Aa.C.To,f=olympe.dc.query.Aa.C.sp,g=olympe.dc.query.Aa.C.Xp,h=olympe.dc.query.Aa.C.fn,k=olympe.dc.query.Aa.C.Dp;switch(a.pr){case b:return new olympe.dc.query.$.Zl(a.t);case c:b=a.v;switch(a.t){case 2:b=new Date(b);break;case 3:b=olympe.dc.CloudObject.get(b);break;case 4:b=olympe.D.Color.create(b.r,b.g,b.b,b.a)}return new olympe.dc.query.$.pe(a.p,b,olympe.dc.ia());case d:return new olympe.dc.query.$.af(a.p,
|
|
609
|
+
a.s,olympe.dc.ia(),a.c);case e:return new olympe.dc.query.$.bi(olympe.dc.ia(),a.p,a.b,a.l,a.s);case f:return new olympe.dc.query.$.Zd(gh(a.v));case g:return new olympe.dc.query.$.kf(a.p,new RegExp(a.r),olympe.dc.ia(),a.c);case k:return new olympe.dc.query.$.re(...a.p.map(l=>gh(l)));case h:return new olympe.dc.query.$.Ad(...a.p.map(l=>gh(l)));default:return null}}
|
|
610
|
+
olympe.dc.query.Aa=class{observe(){}lb(){}compile(){return[[this]]}jd(){return new olympe.dc.query.$.Zd(this)}Cb(){}Dc(){}clear(){}ha(){}Jc(){}toString(){}Qa(a){return this===a}static Qw(...a){return new olympe.dc.query.$.Zl(a)}static Qa(a,b){fh(a);return new olympe.dc.query.$.pe(a,b,olympe.dc.ia())}static contains(a,b,c=!0){fh(a);return new olympe.dc.query.$.af(a,b,olympe.dc.ia(),c)}static Fx(a,b,c=!0){fh(a);return new olympe.dc.query.$.kf(a,b,olympe.dc.ia(),c)}static lk(a,b,c=!0){fh(a);return new olympe.dc.query.$.bi(olympe.dc.ia(),
|
|
611
|
+
a,b,!1,c)}static Ui(a,b,c=!0){fh(a);return new olympe.dc.query.$.bi(olympe.dc.ia(),a,b,!0,c)}static and(...a){if(!a.every(b=>b instanceof olympe.dc.query.Aa))throw new olympe.dc.query.Ed(`Some specified predicates, while trying to build an AND query predicate are invalid: ${a}`);return new olympe.dc.query.$.Ad(...a)}static or(...a){if(!a.every(b=>b instanceof olympe.dc.query.Aa))throw new olympe.dc.query.Ed(`Some specified predicates, while trying to build an OR query predicate are invalid: ${a}`);
|
|
612
|
+
return new olympe.dc.query.$.re(...a)}static jd(a){if(!(a instanceof olympe.dc.query.Aa))throw new olympe.dc.query.Ed(`The specified predicate, while trying to build a NOT query predicate is invalid: ${a}`);return new olympe.dc.query.$.Zd(a)}};olympe.dc.query.Aa.not=olympe.dc.query.Aa.jd;olympe.dc.query.Aa.or=olympe.dc.query.Aa.or;olympe.dc.query.Aa.and=olympe.dc.query.Aa.and;olympe.dc.query.Aa.smallerThan=olympe.dc.query.Aa.Ui;olympe.dc.query.Aa.greaterThan=olympe.dc.query.Aa.lk;
|
|
613
|
+
olympe.dc.query.Aa.regex=olympe.dc.query.Aa.Fx;olympe.dc.query.Aa.contains=olympe.dc.query.Aa.contains;olympe.dc.query.Aa.equals=olympe.dc.query.Aa.Qa;olympe.dc.query.Aa['in']=olympe.dc.query.Aa.Qw;olympe.dc.query.Aa.C={Cq:0,po:1,cj:2,To:3,sp:4,Xp:5,Dp:6,fn:7};function Vg(a){return Array.from(a.va)}
|
|
614
|
+
function hh(a,b){var c=b.relation,d=olympe.dm.Relation.originModelRel,e=olympe.dm.Relation.destinationModelRel;d=a.db.Pb(c,c.Ga()===olympe.dc.ua.ORIGIN?e:d);if(0>a.G)e=a.C.ze;else if(e=a.va[a.G],null!==e.oa)e=e.oa;else{var f=olympe.dc.ua.ORIGIN;e=olympe.dc.ia().Pb(e.relation,e.relation.Ga()===f?olympe.dm.Relation.originModelRel:olympe.dm.Relation.destinationModelRel)}if(null===d||!a.db.Gh(d,e)&&!a.db.Gh(e,d))throw new olympe.dc.query.Ed(`The specified relation "${c}" is invalid at the current level "${a.db.name(e)} (${e})" of the Query you are building. Please make sure you did not forget a .back() or another relation.`);d=
|
|
615
|
+
b.V();for(c=a.G+1;c<a.va.length&&a.va[c].V()!==d;)c++;b=c<a.va.length?a.va:a.va.concat(b);return new olympe.dc.pa(a.F,a.source,b,c,a.L,a.C)}function ih(a,b=a.G){return 0<=b?a.va[b].V():olympe.Y.vb(a.F)}function jh(a,b,c,d={}){var e=olympe.dc.ec.Mf;const f=(null==d?0:d.Kd)?d.Kd:olympe.dc.pa.Tc.Ef;d=(null==d?0:d.$m)?'__code-as-data__':void 0;b=olympe.dc.ga(b);const g=olympe.dc.Sd().we(b);b=(new olympe.dc.pa(b,g)).ce();b.va=[new olympe.dc.query.va.Xd(ih(b),e,c)];return b.observe(a,{Kd:f,$j:d})}
|
|
616
|
+
function kh(a){const b=0===a.L.size?a.ce():a;if(null!==b.C.zd&&!b.L.has(ih(a,b.C.zd)))throw new olympe.dc.query.Ed('AndReturn was not called for the current level before sortBy operator');return b}
|
|
617
|
+
olympe.dc.pa=class{constructor(a,b,c=[],d=-1,e=new Set,f={max:-1,offset:0,zd:null,ze:null}){this.db=olympe.dc.ia();this.F=a;this.source=b;this.va=c;this.G=d;this.L=e;this.C=f;this.id=null}static from(a,b){a=olympe.dc.ga(a);if(!olympe.dc.CloudObject.exists(a))throw new olympe.dc.query.Ed(`Try to create a query from an instance that does not exist (${a}). Please try to use \`Query.fromTag()\` instead.`);b=null!=b?b:olympe.dc.Sd().we(a);b=new olympe.dc.pa(a,b);b.C.ze=olympe.dc.ia().model(a);return b}static we(a,
|
|
618
|
+
b,c){if(!olympe.dc.CloudObject.exists(b))throw new olympe.dc.query.Ed(`Try to create a query from an instance (${a}) with an explicit datatype that does not exist (${b})`);a=olympe.dc.ga(a);c=null!=c?c:olympe.dc.Sd().fromModel(b);c=new olympe.dc.pa(a,c);c.C.ze=olympe.dc.ga(b);return c}static qk(a,b=!0,c){const d=olympe.dc.ga(a);var e=olympe.dc.ia();if(!e.Hh(d))throw new olympe.dc.query.Ed(`Try to create a query to get instances of ${a}, which is not a data type or does not exist.`);a=null!=c?c:olympe.dc.Sd().fromModel(d);
|
|
619
|
+
a=new olympe.dc.pa(d,a);a.C.ze=e.model(d);b&&(a=hh(a,new olympe.dc.query.va.Kf(ih(a),olympe.dc.CloudObject.extendedByRel,!0,!1)));b=a;e=new olympe.dc.query.va.Xh(ih(a),olympe.dc.CloudObject.instancesRel,!1);e.oa=d;return hh(b,e)}static bc(a,b,c,d,e){const f=(null==e?0:e.Kd)?e.Kd:olympe.dc.pa.Tc.Ef;e=(null==e?0:e.$m)?'__code-as-data__':void 0;b=olympe.dc.ga(b);d=null!=d?d:olympe.dc.Sd().we(b);d=(new olympe.dc.pa(b,d)).ce();d.va=[new olympe.dc.query.va.Xd(ih(d),c)];return d.observe(a,{Kd:f,$j:e})}cb(a,
|
|
620
|
+
b=!1){if(!(a instanceof olympe.dc.Ma.Relation))throw new olympe.dc.query.Ed(`The relation given to follow() is invalid: ${a}`);return hh(this,new olympe.dc.query.va.Xh(ih(this),a,b))}Sf(a,b=!1,c=!1){if(!(a instanceof olympe.dc.Ma.Relation))throw new olympe.dc.query.Ed(`The relation given to followRecursively() is invalid: ${a}`);return hh(this,new olympe.dc.query.va.Kf(ih(this),a,b,c))}ce(){const a=(new Set(this.L)).add(ih(this));return new olympe.dc.pa(this.F,this.source,this.va,this.G,a,this.C)}filter(a){if(!(a instanceof
|
|
621
|
+
olympe.dc.query.Aa))throw new olympe.dc.query.Ed(`The specified predicate while trying to filter a query is invalid: ${a}`);const b=Array.from(this.va);b[this.G]=b[this.G].filter(a);return new olympe.dc.pa(this.F,this.source,b,this.G,this.L,this.C)}Ci(){return this}Mi(a,b=0){return new olympe.dc.pa(this.F,this.source,this.va,this.G,this.L,{zd:this.C.zd,max:a,offset:b,ze:this.C.ze})}yk(a,b=olympe.dc.query.Bj.ASC){if(0>this.G)throw new olympe.dc.query.Ed('You are trying to sort an empty query. Please first follow at least one relation to sort a query.');
|
|
622
|
+
if(!olympe.dc.ia().jc(a,olympe.dm.Property))throw new olympe.dc.query.Ed(`The specified property while trying to sort a query is invalid: ${a}`);const c=this.va[this.G],d={zd:this.G,max:this.C.max,offset:this.C.offset,ze:this.C.ze},e=Array.from(this.va);e[this.G]=c.sort(a,b);return new olympe.dc.pa(this.F,this.source,e,this.G,this.L,d)}Fg(){const a=this.C.zd;let b;return null!==a?null==(b=this.va[a])?void 0:b.Fg():null}back(a=1){if(0>this.G||1>a)return this;let b=this.G;for(let c=0;c<a;c++){const d=
|
|
623
|
+
this.va[b].C;for(b--;-1<b&&ih(this,b)!==d;)b--}return new olympe.dc.pa(this.F,this.source,Array.from(this.va),b,this.L,this.C)}parse(){const a=new Map,b=ih(this,-1),c={limit:this.C.max,offset:this.C.offset,returned:this.L.has(b),filter:[],optional:!1,inheritance:!1,next:[]};a.set(b,c);this.db.Hh(this.F)?c.dataType=olympe.dc.ga(this.F):(c.root=olympe.dc.ga(this.F),c.dataType=this.C.ze);this.va.forEach((d,e)=>{const f=d.V(),g=d.Jc();Object.assign(g,{returned:this.L.has(f),next:[]});a.set(f,g);g.sort&&
|
|
624
|
+
this.C.zd!==e&&delete g.sort;if(1>=e&&d instanceof olympe.dc.query.va.Xh&&d.relation.Qa(olympe.dc.CloudObject.instancesRel))Object.assign(c,g);else if(0===e&&d instanceof olympe.dc.query.va.Kf&&d.relation.Qa(olympe.dc.CloudObject.extendedByRel))Object.assign(c,g),c.inheritance=!0;else{let h;null==(h=a.get(d.C))||h.next.push(g)}});return c}lb(a){const b=(null==a?0:a.Kd)?a.Kd:olympe.dc.pa.Tc.Ll;let c;return olympe.dc.query.kk().executeQuery(kh(this),b,{wh:null!=(c=null==a?void 0:a.$j)?c:null==a?void 0:
|
|
625
|
+
a.cacheId,Uc:null==a?void 0:a.Uc}).then(d=>{let e;return null!=(e=null==d?void 0:Wg(d))?e:olympe.dc.Oa.empty()})}hd(){return Wg(lh(olympe.dc.query.kk(),kh(this)))}observe(a,b){const c=(null==b?0:b.Kd)?b.Kd:olympe.dc.pa.Tc.Ef;a='function'===typeof a.F?a.F():a;let d;return mh(olympe.dc.query.kk(),kh(this),a,olympe.dc.Pa.SELF,c,{wh:null!=(d=null==b?void 0:b.$j)?d:null==b?void 0:b.cacheId,Uc:null==b?void 0:b.Uc}).pipe(rxjs.operators.map(e=>Wg(e)),rxjs.operators.distinctUntilChanged())}V(){null===this.id&&
|
|
626
|
+
(this.id=olympe.Y.vb(this.F+Vg(this).map(a=>a.L()).join()+Array.from(new Set(this.L)).sort().toString()+this.C.zd+this.C.max+this.C.offset));return this.id}yb(){return this.source}ha(){let a;return{b:this.F,p:this.va.map(b=>b.ha()),r:Array.from(this.L),s:this.source,e:{m:this.C.max,o:this.C.offset,s:this.C.zd,rm:null!=(a=this.C.ze)?a:this.db.model(this.F)}}}toString(){return`Query: ${JSON.stringify(this)}`}toJSON(){return{origin:this.db.Fa(this.F)?olympe.dc.CloudObject.get(this.F):this.F,relations:this.va.map(a=>
|
|
627
|
+
a.toJSON())}}};olympe.dc.pa.prototype.observe=olympe.dc.pa.prototype.observe;olympe.dc.pa.prototype.executeFromCache=olympe.dc.pa.prototype.hd;olympe.dc.pa.prototype.execute=olympe.dc.pa.prototype.lb;olympe.dc.pa.prototype.parse=olympe.dc.pa.prototype.parse;olympe.dc.pa.prototype.back=olympe.dc.pa.prototype.back;olympe.dc.pa.prototype.sortBy=olympe.dc.pa.prototype.yk;olympe.dc.pa.prototype.limit=olympe.dc.pa.prototype.Mi;olympe.dc.pa.prototype.cast=olympe.dc.pa.prototype.Ci;
|
|
628
|
+
olympe.dc.pa.prototype.filter=olympe.dc.pa.prototype.filter;olympe.dc.pa.prototype.andReturn=olympe.dc.pa.prototype.ce;olympe.dc.pa.prototype.followRecursively=olympe.dc.pa.prototype.Sf;olympe.dc.pa.prototype.follow=olympe.dc.pa.prototype.cb;olympe.dc.pa.followRule=olympe.dc.pa.bc;olympe.dc.pa.instancesOf=olympe.dc.pa.qk;olympe.dc.pa.fromTag=olympe.dc.pa.we;olympe.dc.pa.from=olympe.dc.pa.from;olympe.dc.pa.Tc={Ef:1,Ll:2,Ml:3};olympe.dc.pa.C={Nk:'cacheBucketName',Zo:'isCacheable'};function lh(a,b){const c=new olympe.dc.query.Op(a.H,b);if(a.C.view.Fa(b.F)){ah(c,b.F);for(const d of Vg(b))d.lb(c)}return c}
|
|
629
|
+
function mh(a,b,c,d,e,f){const g=b.V();let h=a.F.get(g);if(!h){var k=b.yb();a.H.debug(`Create new subscription for query ${g} for subscriber ${d}, to be executed by the data source ${k}`);k=!1===f.Uc||a.L&&k===olympe.dc.Pa.SERVER?[]:Array.from(a.F.values());h=new olympe.dc.query.Up(a.H,a.C,b,a.O.bind(a,e,f));a.F.set(g,h);nh(h,l=>a.G.add(l));h.start(k)&&(null==f?0:f.wh)&&oh(a,b,e,f).catch(l=>{a.H.error(`Was not able to get the result of the subscribed query ${g} to add it to the cache: ${l}`)})}return new rxjs.Observable(l=>
|
|
630
|
+
{const n=()=>{p&&c.Pe(p);l.complete();if(q){var r=q;const u=a.F.get(g);a.H.debug(`${d} unsubscribed from ${g}`);if(null==u)r=0;else{var t=u;t.G.delete(r)&&t.H.debug(`Remove subscriber ${d} for query ${t.query.V()}, now have ${t.G.size} subscribers`);d!==olympe.dc.Pa.SELF&&(t.Z--,0===t.Z&&dh(t.C));r=0===t.G.size}r&&(a.H.debug(`No more subscriber to ${g}, remove the subscription`),a.G.delete(g),a.F.delete(g),u.destroy())}},p=c.Z(n),q=ph(h,d,l);return n})}
|
|
631
|
+
function qh(a){a.G.forEach(b=>{let c;null==(c=a.F.get(b))||rh(c)});a.G.clear()}function sh(a){a.H.debug('Send GetContext request to the orchestrator');const b=new olympe.dc.Request(olympe.dc.Request.C.fg,olympe.dc.Pa.SERVER);return a.Xb.request(b).then(c=>{a.C.Hc(c.Wb())})}
|
|
632
|
+
function th(a,b){const c=b.yb();if(c===olympe.dc.Pa.SELF||a.L&&c===olympe.dc.Pa.SERVER)return Promise.resolve(!0);a=Array.from(a.F.values()).filter(d=>d.Dc(b)).map(d=>new Promise(e=>d.wd(f=>e(!f))));return Promise.all(a).then(d=>d.some(e=>e))}function oh(a,b,c,d){return x(function*(){var e=b.yb();e=Je(Je(new olympe.dc.Request(olympe.dc.Request.C.og,e,b),olympe.dc.pa.C.Zo,c===olympe.dc.pa.Tc.Ml),olympe.dc.pa.C.Nk,null==d?void 0:d.wh);return a.Xb.request(e)})}
|
|
633
|
+
function uh(a,b,c){const d=[];for(const e of a.F.values())vh(e,b,c)&&d.push(oh(a,e.query,olympe.dc.pa.Tc.Ll,{}).then(f=>{a.C.Hc(f.Wb())}));return Promise.all(d).then(()=>{})}
|
|
634
|
+
olympe.dc.query.gu=class{constructor(a,b,c,d){this.H=a;this.C=b;this.Xb=c;this.L=d;this.F=new Map;this.G=new Set;Gf(b,()=>qh(this));Pe(c,olympe.dc.Request.C.ao,e=>{this.C.Hc(e.content)})}executeQuery(a,b,c){const d=this;return x(function*(){const e='boolean'===typeof c.Uc?c.Uc:yield th(d,a);if(!e||(null==c?0:c.wh))try{const f=yield oh(d,a,b,c);e||d.C.Hc(f.Wb())}catch(f){return d.H.error(`Error while sending a query to data source ${a.yb()}: ${f}`),null}return lh(d,a)})}O(a,b,c,d,e){const f=c.yb();
|
|
635
|
+
if(f===olympe.dc.Pa.SELF||b.Uc||this.L&&f===olympe.dc.Pa.SERVER)return d(),null;if(a!==olympe.dc.pa.Tc.Ef)return oh(this,c,a,b).then(q=>{this.C.Hc(q.Wb());d()}).catch(e),null;let g,h=!1;const k=q=>{g=[];q&&this.H.debug(`Resend subscription ${c.V()} after detection of dead subscription in the remote service`);oh(this,c,a,b).then(r=>{if(h)this.H.warn(`Received data result after query subscription ${c.V()} has been destroyed. Could happen with queries observed multiple times successively quickly.`);
|
|
636
|
+
else{this.C.Hc(r.Wb());let t;null==(t=g)||t.forEach(u=>this.C.Hc(u));g=null}d()}).catch(e)},l=c.V();k(!1);const n=Je(new olympe.dc.Request(olympe.dc.Request.C.Fj,f,c),olympe.dc.pa.C.Nk,null==b?void 0:b.wh),p=Oe(this.Xb,n,k.bind(this,!0)).pipe(olympe.N.operators.Ri(olympe.N.errors.Lo,()=>{},0)).pipe(olympe.N.operators.Ri(olympe.N.errors.Hn,(q,r)=>{this.H.debug(`Data Provider: Subscribe to topic ${q.V()} now that we are back online, after waiting for ${r}ms`);k(!0)},0)).subscribe(rxjs.Subscriber.create(q=>
|
|
637
|
+
{Array.isArray(g)?g.push(q):this.C.Hc(q)},q=>{this.H.error(`An error occurred with the subscription ${l}: ${q}`);e(String(q))}));return()=>{h=!0;this.H.debug(`Unsubscribe to query ${l} from data source ${f}`);p.unsubscribe()}}};function Me(a){return a.L.map(b=>{b=b.split('.');return 1===b.length?b[0]:b})}function Ne(a){return a.G.map(b=>a.F.get(a.C[b]))}function wh(a){const b=olympe.dc.ia();let c=!1;const d=a.k.map(e=>{const f=e.split('.').map(g=>b.Fa(g)?olympe.dc.CloudObject.get(g):(olympe.ma.ab('dc.query').error(`CloudObject with tag ${g} not present but required for deserialization`),c=!0,null));return[e,1===f.length?f[0]:f]});return c?null:olympe.dc.Oa.create(d,a.a,a.r)}
|
|
638
|
+
olympe.dc.Oa=class{constructor(){this.C=[];this.F=new Map;this.G=[];this.L=[];this.hash=''}static empty(){return new olympe.dc.Oa}[Symbol.iterator](){let a=0;return{next:()=>{var b={done:!0};a<this.C.length&&(b=this.C[a],b={value:[b,this.F.get(b)],done:!1},a++);return b}}}entries(){return this.C.map(a=>[a,this.F.get(a)])}values(){return this.F.values()}keys(){return this.C.values()}Ae(){return this.C.map(a=>this.F.get(a))}size(){return this.C.length}has(a){return this.F.has(a)||this.Ae().includes(a)}indexOf(a){return null===
|
|
639
|
+
a||void 0===a?-1:'string'===typeof a?this.C.indexOf(a):this.Ae().indexOf(a)}get(a){return(a=this.F.get(a))?a:null}xc(){return this.ee(0)}ee(a){return a<this.C.length?this.F.get(this.C[a]):null}push(...a){const b=this.Ae();b.push(...a);return b}pop(){if(0===this.C.length)return[];const a=this.Ae();a.pop();return a}shift(){if(0<this.C.length){const a=this.Ae();a.shift();return a}return[]}filter(a){return this.Ae().filter(a)}find(a){return(a=this.Ae().find(a))?a:null}forEach(a){this.C.forEach((b,c)=>
|
|
640
|
+
a(this.F.get(b),c))}map(a){return this.Ae().map(a)}sort(a){const b=this.entries().sort((c,d)=>a(c[1],d[1]));return olympe.dc.Oa.create(b,Array.from(this.G),Array.from(this.L))}reduce(a,b){return this.Ae().reduce(a,b)}concat(...a){const b=[this.entries(),...a.map(d=>d.entries())].flat();let c=Array.from(this.G);for(const d of a)c=c.concat(d.G.map(e=>e+c.length));a=this.L.concat(...a.map(d=>d.L));return olympe.dc.Oa.create(b,c,a)}toString(){return`QueryResult: ${JSON.stringify(this)}`}toJSON(){return this.Ae()}static from(a,
|
|
641
|
+
b,{Fb:c,zd:d,offset:e,max:f}={}){if(null!==c&&-1<d){const p=olympe.dc.ia(),q=c.ei===olympe.dc.query.Bj.ASC?1:-1,r=c.Fg(),t=c.Ka();b.sort((u,w)=>{w=w[d];u=p.Ka(u[d],t);w=p.Ka(w,t);return null===u?-q:null===w?q:q*r(u,w)})}else b.sort((p,q)=>p.reduce((r,t,u)=>r||t.localeCompare(q[u]),0));if(0<e||-1<f)b=b.slice(e,-1<f?e+f:void 0);c=olympe.Y.vb(b.flat().join(''));if(c===a.hash)return a;const g=p=>''===p?null:olympe.dc.CloudObject.get(p);e=b.map(p=>[p.join('.'),1===p.length?g(p[0]):p.map(g)]);const h=new Set(e.map(p=>
|
|
642
|
+
p[0])),k=new Set(a.keys()),l=[],n=[];e.forEach(([p],q)=>{!k.has(p)&&l.push(q)});k.forEach(p=>{!h.has(p)&&n.push(p)});return olympe.dc.Oa.create(e,l,n,c)}static create(a,b,c,d){const e=new olympe.dc.Oa;e.C=a.map(f=>f[0]);e.F=new Map(a);e.hash=d||olympe.Y.vb(e.C.join(''));e.G=b||e.C.map((f,g)=>g);e.L=c||[];return e}ha(a){a&&this.C.flatMap(b=>b.split('.')).forEach(a);return{k:this.C,a:this.G,r:this.L}}};olympe.dc.Oa.prototype.concat=olympe.dc.Oa.prototype.concat;olympe.dc.Oa.prototype.reduce=olympe.dc.Oa.prototype.reduce;
|
|
643
|
+
olympe.dc.Oa.prototype.sort=olympe.dc.Oa.prototype.sort;olympe.dc.Oa.prototype.map=olympe.dc.Oa.prototype.map;olympe.dc.Oa.prototype.forEach=olympe.dc.Oa.prototype.forEach;olympe.dc.Oa.prototype.find=olympe.dc.Oa.prototype.find;olympe.dc.Oa.prototype.filter=olympe.dc.Oa.prototype.filter;olympe.dc.Oa.prototype.shift=olympe.dc.Oa.prototype.shift;olympe.dc.Oa.prototype.pop=olympe.dc.Oa.prototype.pop;olympe.dc.Oa.prototype.push=olympe.dc.Oa.prototype.push;olympe.dc.Oa.prototype.getAt=olympe.dc.Oa.prototype.ee;
|
|
644
|
+
olympe.dc.Oa.prototype.getFirst=olympe.dc.Oa.prototype.xc;olympe.dc.Oa.prototype.get=olympe.dc.Oa.prototype.get;olympe.dc.Oa.prototype.indexOf=olympe.dc.Oa.prototype.indexOf;olympe.dc.Oa.prototype.has=olympe.dc.Oa.prototype.has;olympe.dc.Oa.prototype.size=olympe.dc.Oa.prototype.size;olympe.dc.Oa.prototype.toArray=olympe.dc.Oa.prototype.Ae;olympe.dc.Oa.prototype.keys=olympe.dc.Oa.prototype.keys;olympe.dc.Oa.prototype.values=olympe.dc.Oa.prototype.values;olympe.dc.Oa.prototype.entries=olympe.dc.Oa.prototype.entries;
|
|
645
|
+
olympe.dc.Oa.empty=olympe.dc.Oa.empty;function xh(a){return 1<a.size()?(olympe.ma.ab('dc').warn(`a follow() on a QuerySingle has ${a.size()} results (0 or 1 expected) -> returns null`),null):a.xc()||null}olympe.dc.bd=class{constructor(a){this.query=a}static from(a){return new olympe.dc.bd(olympe.dc.pa.from(a))}cb(a){return new olympe.dc.bd(this.query.cb(a))}Ci(){return this}lb(a){return this.query.lb(a).then(b=>xh(b))}hd(){return xh(this.query.hd())}};olympe.dc.bd.prototype.executeFromCache=olympe.dc.bd.prototype.hd;
|
|
646
|
+
olympe.dc.bd.prototype.execute=olympe.dc.bd.prototype.lb;olympe.dc.bd.prototype.cast=olympe.dc.bd.prototype.Ci;olympe.dc.bd.prototype.follow=olympe.dc.bd.prototype.cb;const yh=olympe.dc.ua.ORIGIN,zh=olympe.dc.ua.DESTINATION;function nh(a,b){Xg(a.C,()=>b(a.query.V()))}function ph(a,b,c){const d=a.ba;a.ba++;a.G.set(d,c);b===olympe.dc.Pa.SELF?a.wd(e=>e?c.error(e):c.next(a.C)):(a.Z++,1===a.Z&&a.wd(()=>ch(a.C)));a.H.debug(`Add subscriber ${b} for query ${a.query.V()}, now have ${a.G.size} subscribers`);return d}
|
|
647
|
+
function vh(a,b,c){if(a.query.yb()!==b)return!1;c.qd(a.fa);(b=a.fa.flush())&&a.H.debug(`Subscription ${a.query.V()} is considered as obsolete after the transaction ${c.V()} applied on DB`);return b}function rh(a){eh(a.C);a.G.forEach(b=>{b.next(a.C)})}function Ah(a,b,c){const d=[];let e=!1;const f=new olympe.async.Cj(olympe.D.Gg());for(const g of b)g.Dc(a.query)&&(e||(e=!0),f.add(h=>g.wd(k=>{!k&&d.push(g);h()})));yc(f,g=>c(g?d:[]));f.start();return e}
|
|
648
|
+
function Bh(a){const b=a.query.V(),c=new Map,d=q=>{const r=c.get(q);return r?1===r.size?Array.from(r)[0]:(t,u,w,y)=>r.forEach(z=>z(t,u,w,y)):()=>{}},e=Vg(a.query),f=a.C;for(let q=e.length-1;0<=q;q--){var g=e[q];const r=g.V(),t=g.C;g=g.observe(f,d(r));let u;c.set(t,(null!=(u=c.get(t))?u:new Set).add(g))}const h=a.db,k=a.query.F,l=olympe.Y.vb(k),n=Fe(h,k,(q,r)=>{q?ah(f,r):f.remove(r);d(l)(q,r,null,b)});let p;null==(p=a.T)||p.push(()=>{Ee(h,k,n)});Ch(a)}
|
|
649
|
+
function Dh(a){const b=a.oa(a.query,()=>{null===a.O||a.eb()||Bh(a)},d=>{a.eb()||(a.H.error(`Error while getting data from data source (${a.query.yb()}) to ensure coverage of the query ${a.query.V()}: ${d}`),Ch(a))});let c;b&&(null==(c=a.T)||c.push(b))}function Eh(a,b){a.L.delete(b);0===a.L.size&&(a.L=null,Promise.resolve().then(()=>{!a.eb()&&Dh(a)}))}function Ch(a){const b=a.O;a.O=null;null==b||b.forEach(c=>c())}
|
|
650
|
+
olympe.dc.query.Up=class{constructor(a,b,c,d){this.H=a;this.db=b.view;this.query=c;this.C=new olympe.dc.query.Op(this.H,c);this.Z=0;this.ba=1;this.T=[];this.G=new Map;this.O=[()=>eh(this.C)];this.oa=d;this.fa=new Fh(a,this.db,c,this.C);this.F=this.L=null}start(a){return Ah(this,a,b=>{0<b.length?(this.L=new Set(b),this.L.forEach(c=>{null===c.F&&(c.F=new Set);c.F.add(this)}),Bh(this)):Dh(this)})}Dc(a){return!this.eb()&&this.query.yb()===a.yb()&&(this.query.V()===a.V()||(null===this.O||this.query.F===
|
|
651
|
+
a.F)&&this.C.Dc(a))}wd(a){null!==this.O?this.O.push(a):a();return this}destroy(a){a?this.H.error(`Destroy subscription ${this.query.V()} after error: ${a}`):this.H.debug(`Destroy subscription ${this.query.V()}`);const b=this.T;this.T=null;this.G.forEach(e=>a?e.error(a):e.complete());let c;null==(c=this.F)||c.forEach(e=>Eh(e,this));let d;null==(d=this.L)||d.forEach(e=>{e.F.delete(this);0===e.F.size&&(e.F=null)});b.forEach(e=>e())}eb(){return null===this.T}};
|
|
652
|
+
function Gh(a,b){return a.G.has(zh+b)||a.G.has(yh+b)}
|
|
653
|
+
class Fh{constructor(a,b,c,d){this.H=a;this.db=b;this.L=d;this.T=[];this.O=-1<c.C.max||0<c.C.offset;this.G=new Map;this.C=!1;const e=new Map;for(const f of Vg(c)){a=f.V();this.T.push(a);if(f instanceof olympe.dc.query.va.lh){a=f.relation;a=`${a.Ga()}${a.X()}`;let g;b=null!=(g=this.G.get(a))?g:[];b.push(f);this.G.set(a,b)}Hh(f).forEach(g=>{let h;const k=null!=(h=e.get(g))?h:[];k.push(f.V());e.set(g,k)})}this.properties=Array.from(e.entries())}flush(){const a=this.C;this.C=!1;return a}Nc(){}Xc(a,b){if(!(this.C||
|
|
654
|
+
!this.O&&this.db.Fa(a))){var c;this.C||(this.C=null==(c=this.properties)?void 0:c.some(([d,e])=>b.has(d)&&$g(this.L,a,e)))}}F(a){this.C||this.db.Fa(a)&&!this.O||this.C||(this.C=this.T.some(b=>$g(this.L,a,b)))}Ea(a,b,c){if(!this.C&&Gh(this,a)){var d=this.db.Fa(b),e=this.db.Fa(c);if(d&&!e||!d&&e){const f=this.G.get(zh+a);a=this.G.get(yh+a);this.C||(this.C=d&&(null==f?void 0:f.some(g=>$g(this.L,b,g.C)))||e&&(null==a?void 0:a.some(g=>$g(this.L,c,g.C))))}}}ic(a,b,c){if(!this.C&&this.O&&Gh(this,a)&&this.db.wr(b,
|
|
655
|
+
new olympe.dc.Ma.Relation(a),c)){const d=this.G.get(zh+a);a=this.G.get(yh+a);const e=this.L;this.C||(this.C=(null==d?void 0:d.some(f=>$g(e,b,f.C)&&$g(e,c,f.V())))||(null==a?void 0:a.some(f=>$g(e,c,f.C)&&$g(e,b,f.V()))))}}}olympe.dc.query.Up.xa=[olympe.dc.Writable];function Ih(a){return new olympe.dc.query.Relation(a.tag,a.direction,!0)}
|
|
656
|
+
olympe.dc.query.Relation=class extends olympe.dc.Ma.Relation{constructor(a,b,c){super(a,b);this.recursive=c}toJSON(){let a='{ "tag": '+JSON.stringify(this.X())+', ';a+='"direction": '+JSON.stringify(this.Ga())+', ';a+='"recursive": '+JSON.stringify(this.recursive);return a+'}'}static Ub(a){let b;'string'===typeof a?b=JSON.parse(a):b=a;return new olympe.dc.query.Relation(b.tag,b.direction,b.recursive)}static from(a,b){return new olympe.dc.query.Relation(a.X(),a.Ga(),null!=b?b:a instanceof olympe.dc.da.se)}Vb(){const a=
|
|
657
|
+
olympe.dc.ua.DESTINATION,b=olympe.dc.ua.ORIGIN;return new olympe.dc.query.Relation(this.tag,this.direction===a?b:a,this.recursive)}V(){return`${this.direction}${this.tag}${this.recursive?'-r':''}`}};olympe.dc.query.R={Ca:'dc.query.Logger',Ej:'dc.query.QueryProcessor'};olympe.W.config(function(a){F(a,olympe.dc.query.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('query'));E(a,olympe.dc.query.R.Ej,olympe.dc.query.gu,olympe.dc.query.R.Ca,olympe.dc.db.R.Ha,olympe.dc.R.qg,new olympe.W.ja(olympe.dc.U.oh))});olympe.W.run([olympe.dc.query.R.Ej],a=>{olympe.dc.query.kk=()=>a});olympe.dc.query.Ed=class extends Error{};olympe.dc.query.$={};olympe.dc.query.$.Ad=class extends olympe.dc.query.Aa{constructor(...a){super();this.$=a}compile(){return this.$.reduce((a,b)=>{const c=[];for(const d of b.compile()){for(const e of a)d.push(...e);c.push(d)}return c},[])}jd(){return new olympe.dc.query.$.re(...this.$.map(a=>a.jd()))}Cb(){return this.$.flatMap(a=>a.Cb())}Dc(){throw Error('Should not try to check predicate coverage on And (should be removed by compiling predicates');}lb(a){return this.$.reduce((b,c)=>b&&c.lb(a),!0)}observe(a,b,c){const d=
|
|
658
|
+
Array(this.$.length).fill(!1);let e=null;const f=(g,h)=>{d[g]=h;g=d.every(k=>k);e!==g&&(e=g,c(g))};this.$.forEach((g,h)=>{g.observe(a,olympe.Y.vb('AND-'+b+a+h),f.bind(null,h))})}ha(){return{pr:olympe.dc.query.Aa.C.fn,p:this.$.map(a=>a.ha())}}Jc(){throw Error('toObject for AND predicate should not be called');}toString(){return'And-'+this.$.reduce((a,b)=>a+'-'+b.toString(),'')}clear(a,b){this.$.forEach((c,d)=>{c.clear(a,olympe.Y.vb('AND-'+b+a+d))})}};olympe.dc.query.$.af=class extends olympe.dc.query.Aa{constructor(a,b,c,d=!1){super();this.La=olympe.dc.ga(a);this.substring=b;this.db=c;this.C=d}Cb(){return[this.La]}Dc(a,b){return a instanceof olympe.dc.query.$.af&&a.La===this.La?b?a.C?a.substring.toLowerCase().includes(this.substring.toLowerCase()):a.substring.includes(this.substring):this.C?this.substring.toLowerCase().includes(a.substring.toLowerCase()):this.substring.includes(a.substring):!1}Ka(){return this.La}lb(a){return this.apply(this.db.Ka(a,
|
|
659
|
+
this.La))}observe(a,b,c){Uf(this.db,a,this.La,d=>{c(this.apply(d))},olympe.Y.vb(b+a+this.toString()))}apply(a){return'string'===typeof a?this.C?a.includes(this.substring):a.toLowerCase().includes(this.substring.toLowerCase()):!1}toString(){return'Contains'+this.La+'-'+this.substring+'-'+this.C}clear(a,b){Vf(this.db,a,this.La,olympe.Y.vb(b+a+this.toString()))}Jc(){return{name:'CONTAINS',property:this.Ka(),value:this.substring,caseSensitive:this.C}}ha(){return{pr:olympe.dc.query.Aa.C.cj,p:this.La,s:this.substring,
|
|
660
|
+
c:this.C}}};olympe.dc.query.$.pe=class extends olympe.dc.query.Aa{constructor(a,b,c){super();this.La=olympe.dc.ga(a);this.C=null!=b?b:null;this.db=c}Cb(){return[this.La]}Dc(a){if(a instanceof olympe.dc.query.$.pe&&this.La===a.La)if('object'===typeof this.C&&null!==this.C){if(this.C instanceof olympe.dc.CloudObject)return this.C.Qa(a.C);if(this.C instanceof Date)return a.C instanceof Date&&this.C.getTime()===a.C.getTime();if(this.C instanceof olympe.D.Color)return this.C.Qa(a.C)}else return this.C===a.C;return!1}lb(a){return this.apply(this.db.Ka(a,
|
|
661
|
+
this.La))}observe(a,b,c){Uf(this.db,a,this.La,d=>{c(this.apply(d))},olympe.Y.vb(b+a+this.toString()));null===this.C&&null===this.db.Ka(a,this.La)&&c(!0)}clear(a,b){Vf(this.db,a,this.La,olympe.Y.vb(b+a+this.toString()))}apply(a){return'object'===typeof a&&null!==a?a instanceof olympe.dc.CloudObject?a.Qa(this.C):a instanceof Date?this.C instanceof Date&&this.C.getTime()===a.getTime():a instanceof olympe.D.Color?a.Qa(this.C):!1:a===this.C}toString(){let a,b;const c=null!=(b=null==(a=this.C)?void 0:a.toString())?
|
|
662
|
+
b:'null';return'Equals-'+this.La+'-'+c}Jc(){return{name:'EQUALS',property:this.La,value:this.C}}ha(){let a=1,b=this.C;switch(!0){case this.C instanceof Date:a=2;b=this.C.toJSON();break;case this.C instanceof olympe.dc.CloudObject:a=3;b=this.C.X();break;case this.C instanceof olympe.D.Color:a=4,b=this.C.toJSON()}return{pr:olympe.dc.query.Aa.C.po,p:this.La,t:a,v:b}}};function Jh(a,b){return'number'===typeof a.C?a.C:a.db.Ka(b,a.C)}function Kh(a,b,c){return olympe.Y.vb(c+b+a.C+a.La)}
|
|
663
|
+
olympe.dc.query.$.bi=class extends olympe.dc.query.Aa{constructor(a,b,c,d=!0,e=!0){super();this.db=a;this.La=olympe.dc.ga(b);this.C='number'===typeof c?c:olympe.dc.ga(c);this.F=d;this.G=e}jd(){return new olympe.dc.query.$.bi(this.db,this.La,this.C,!this.F,!this.G)}Cb(){return[this.La]}Dc(a,b){if(b)throw Error('Check coverage of inequality should not happen with opposite = true');return a instanceof olympe.dc.query.$.bi&&this.La===a.La?typeof this.C!==typeof a.C||this.F!==a.F?!1:'number'===typeof this.C?
|
|
664
|
+
this.F&&this.C>=a.C||!this.F&&this.C<=a.C:this.C===a.C:!1}Ka(){return this.La}lb(a){return this.compare(this.db.Ka(a,this.La),Jh(this,a))}observe(a,b,c){'string'===typeof this.C&&Uf(this.db,a,this.C,d=>{const e=this.db.Ka(a,this.La);null!==e&&c(this.compare(e,d))},Kh(this,a,b));Uf(this.db,a,this.La,d=>{const e=Jh(this,a);c(null!==e?this.compare(d,e):!0)},Kh(this,a,b))}compare(a,b){return null===a?!1:null===b?!0:this.G?this.F?a<b:a>b:this.F?a<=b:a>=b}clear(a,b){Vf(this.db,a,this.La,Kh(this,a,b));'string'===
|
|
665
|
+
typeof this.C&&Vf(this.db,a,this.C,Kh(this,a,b))}Jc(){return{name:'INEQUALITY_OPERATOR',property:this.Ka(),operator:this.F?'<':'>',strict:this.G,value:this.C}}ha(){return{pr:olympe.dc.query.Aa.C.To,p:this.La,b:this.C,l:this.F,s:this.G}}toString(){return'GreaterThan-'+this.La+'-'+this.G+'-'+this.C}};olympe.dc.query.$.Zd=class extends olympe.dc.query.Aa{constructor(a){super();this.C=a}compile(){const a=this.C.jd();return this.Qa(a)?super.compile():a.compile()}jd(){return this.C}Cb(){return this.C.Cb()}Dc(a,b){return a instanceof olympe.dc.query.$.Zd?this.C.Dc(a.C,b):this.C.Dc(a,!b)}lb(a){return!this.C.lb(a)}observe(a,b,c){let d=null;this.C.observe(a,olympe.Y.vb('NOT'+b+a),e=>{!e!==d&&(d=!e,c(d))})}Jc(){return{name:'NOT',predicate:this.C.Jc()}}ha(){return{pr:olympe.dc.query.Aa.C.sp,v:this.C.ha()}}toString(){return`NOT-${this.C.toString()}`}clear(a,
|
|
666
|
+
b){this.C.clear(a,olympe.Y.vb('NOT'+b+a))}Qa(a){return a instanceof olympe.dc.query.$.Zd?this.C.Qa(a.C):!1}};olympe.dc.query.$.re=class extends olympe.dc.query.Aa{constructor(...a){super();this.$=a}compile(){return this.$.map(a=>a.compile()).flat()}jd(){return new olympe.dc.query.$.Ad(...this.$.map(a=>a.jd()))}Cb(){return this.$.flatMap(a=>a.Cb())}Dc(){throw Error('Should not try to check predicate coverage on And (should be removed by compiling predicates');}lb(a){return this.$.reduce((b,c)=>b||c.lb(a),!1)}observe(a,b,c){const d=Array(this.$.length).fill(!1);let e=null;const f=(g,h)=>{d[g]=h;g=d.some(k=>
|
|
667
|
+
k);e!==g&&(e=g,c(g))};this.$.forEach((g,h)=>{g.observe(a,olympe.Y.vb('OR-'+b+a+h),f.bind(null,h))})}Jc(){throw Error('toObject for OR predicate should not be called');}ha(){return{pr:olympe.dc.query.Aa.C.Dp,p:this.$.map(a=>a.ha())}}toString(){return'And-'+this.$.reduce((a,b)=>a.toString()+'-'+b.toString(),'')}clear(a,b){this.$.forEach((c,d)=>{c.clear(a,olympe.Y.vb('OR-'+b+a+d))})}};olympe.dc.query.$.kf=class extends olympe.dc.query.Aa{constructor(a,b,c,d=!0){super();this.La=olympe.dc.ga(a);this.C='string'===typeof b?new RegExp(d?b:b.toLowerCase()):d?b:new RegExp(b.source.toLowerCase());this.db=c;this.F=d}Cb(){return[this.La]}Dc(a){return a instanceof olympe.dc.query.$.kf&&this.La===a.La&&this.C.toString()===a.C.toString()}lb(a){return this.apply(this.db.Ka(a,this.La))}observe(a,b,c){Uf(this.db,a,this.La,d=>{c(this.apply(d))},olympe.Y.vb(b+a+this.toString()))}apply(a){return'string'===
|
|
668
|
+
typeof a?this.C.test(this.F?a:a.toLowerCase()):!1}toString(){return'Regex'+this.La+'-'+this.C.toString()+'-'+this.F}Jc(){return{name:'REGEX',property:this.La,pattern:this.C,caseSensitive:this.F}}ha(){return{pr:olympe.dc.query.Aa.C.Xp,p:this.La,r:this.C.source,c:this.F}}clear(a,b){Vf(this.db,a,this.La,olympe.Y.vb(b+a+this.toString()))}};olympe.dc.query.$.Zl=class extends olympe.dc.query.Aa{constructor(a){super();this.C=new Set(a.map(olympe.dc.ga))}Cb(){return[]}Dc(a){return a instanceof olympe.dc.query.$.Zl&&Array.from(a.C).every(b=>this.C.has(b))}lb(a){return this.C.has(a)}observe(a,b,c){c(this.C.has(a))}clear(){}toString(){return'Tags-'+Array.from(this.C)}Jc(){return{name:'IS',tags:Array.from(this.C)}}ha(){return{pr:olympe.dc.query.Aa.C.Cq,t:Array.from(this.C)}}};olympe.dc.query.va={};function Hh(a){let b,c;const d=new Set(null!=(c=null==(b=a.F)?void 0:b.Cb())?c:[]);let e;a.Fb&&d.add(null==(e=a.Fb)?void 0:e.Ka().X());return d}function Lh(a){if(!a.fa){let b,c;a.fa=null!=(c=null==(b=a.F)?void 0:b.compile())?c:[]}return a.fa}function Mh(a,b){for(const c of b)if(a.some(d=>d.Dc(c,!1)))return!0;return!1}
|
|
669
|
+
function Nh(a,b){if(null===a.F)return b;let c=!1;const d=a.toString();return(e,f,g,h)=>{const k=olympe.Y.vb(h+f+d);e?a.F.observe(f,k,l=>{c||b(l,f,g,k)}):(c=!0,a.F.clear(f,k),c=!1,b(!1,f,g,k))}}function Oh(a,b,c){if(null===a.Fb)return c;const d=a.toString();return(e,f,g,h)=>{const k=a.Fb.Ka();h=olympe.Y.vb(h+d);e?Uf(a.db,f,k,()=>{Yg(b)},h):Vf(a.db,f,k,h);c(e,f,g,h)}}
|
|
670
|
+
olympe.dc.query.va.Nl=class{constructor(a,b){this.db=olympe.dc.ia();this.C=a;this.optional=b;this.fa=this.Fb=this.F=this.id=null}static C(a){var b=a.i;if('string'===typeof a.f)return new olympe.dc.query.va.Xd(b,a.f);var c=a.o;const d=new olympe.dc.Ma.Relation(a.t,a.d);b='boolean'===typeof a.s?new olympe.dc.query.va.Kf(b,d,a.s,c):new olympe.dc.query.va.Xh(b,d,c);void 0!==a.p&&(b.F=gh(a.p));void 0!==a.c&&(c=b.V(),a=a.c,a=new olympe.dc.query.$e(c,new olympe.dc.Ma.Property(a.p),a.o),b.Fb=a);return b}O(){}L(){let a,
|
|
671
|
+
b,c,d;return`${this.C}-${this.optional}${null!=(c=null==(a=this.F)?void 0:a.toString())?c:''}${null!=(d=null==(b=this.Fb)?void 0:b.toString())?d:''}`}Jc(){}toJSON(){}ha(){const a={i:this.C,o:this.optional};null!==this.F&&(a.p=this.F.ha());null!==this.Fb&&(a.c=this.Fb.ha());return a}Z(){}za(){return new olympe.dc.query.va.Ul}ba(){}V(){null===this.id&&(this.id=this.Z());return this.id}T(){return this.optional}Dc(a){const b=Lh(this);if(0===b.length)return!0;a=Lh(a);if(0===a.length)return!1;for(const c of a)if(!b.some(d=>
|
|
672
|
+
Mh(d,c)))return!1;return!0}filter(a){const b=this.O(),c=b.F;null===c?b.F=a:b.F=c instanceof olympe.dc.query.$.Ad?new olympe.dc.query.$.Ad(...Array.from(c.$),a):new olympe.dc.query.$.Ad(b.F,a);return b}sort(a,b){const c=this.O();c.Fb=new olympe.dc.query.$e(this.V(),a,b);return c}Fg(){return this.Fb}lb(a){if(null!==this.F){var b=this.V();for(const c of Zg(a,b))this.F.lb(c)||a.remove(c,b,null)}}observe(a,b){const c=this.V();return Nh(this,Oh(this,a,(d,e,f,g)=>{(d?ah(a,e,c,f):a.remove(e,c,f))&&b(d,e,
|
|
673
|
+
f,g)}))}};olympe.dc.query.va.lh=class extends olympe.dc.query.va.Nl{constructor(a,b,c){super(a,c);this.relation=b;this.oa=null}};olympe.dc.query.va.Np=class{has(){}O(){}F(){}Id(){}G(){}remove(){}};olympe.dc.query.va.Xn=class{constructor(a){this.C=null;this.content=new Map;this.L=null!=a?a:null}Id(){return this.content.keys()}F(a){return this.content.has(a)&&null!==this.C?[this.C].values():[].values()}has(a){return this.content.has(a)}O(a){let b;return(null==(b=this.L)?void 0:b.call(this,a))||!1}G(a,b){if(null===this.C)this.C=b;else if(b!==this.C)throw Error('Should never try to insert multi parent in the same counter part result. To be used with FollowRulePart only');let c;b=null!=(c=this.content.get(a))?
|
|
674
|
+
c:0;this.content.set(a,b+1);return 0===b}remove(a,b){if(null===b)return this.content.delete(a);b=this.content.get(a);1<b?this.content.set(a,b-1):this.content.delete(a);return 1===b}};olympe.dc.query.va.Xn.xa=[olympe.dc.query.va.Np];olympe.dc.query.va.Xh=class extends olympe.dc.query.va.lh{constructor(a,b,c){super(a,olympe.dc.query.Relation.from(b,!1),c)}O(){const a=new olympe.dc.query.va.Xh(this.C,this.relation,this.optional);a.F=this.F;a.Fb=this.Fb;return a}Z(){return olympe.Y.vb(this.C+this.relation.V())}ba(a,b){return b instanceof olympe.dc.query.va.Xd?[a]:[a+this.relation.V(),a+Ih(this.relation).V(),a+'followRules'].map(c=>olympe.Y.vb(c))}lb(a){const b=this.V();for(const c of Zg(a,this.C))this.db.bb(c,this.relation).forEach(d=>
|
|
675
|
+
{ah(a,d,b,c)});super.lb(a)}observe(a,b){const c=super.observe(a,b),d=this.relation.X(),e=this.relation.Ga();return(f,g,h,k)=>{const l=olympe.Y.vb(k+g+this.toString());f?W(this.db,g,this.relation,(n,p)=>{bh(a,n,d,e,g,p);c(n,p,g,l)},l):this.db.F(g,this.relation,l)}}ha(){return Object.assign(super.ha(),{t:this.relation.X(),d:this.relation.Ga()})}L(){return`followPart-${this.relation.V()}-${super.L()}`}Jc(){const a={recursive:!1,relation:this.relation,filter:Lh(this).map(b=>b.map(c=>c.Jc())),optional:this.T()};
|
|
676
|
+
this.Fb&&(a.sort={property:this.Fb.Ka(),order:this.Fb.ei});return a}toString(){return`Follow Part: ${this.relation}`}toJSON(){return{type:'follow',relation:`${this.db.name(this.relation)} (${this.relation.X()})`,direction:this.relation.Ga()}}};olympe.dc.query.va.Kf=class extends olympe.dc.query.va.lh{constructor(a,b,c,d){super(a,olympe.dc.query.Relation.from(b,!0),d);this.G=c}O(){const a=new olympe.dc.query.va.Kf(this.C,this.relation,this.G,this.optional);a.F=this.F;a.Fb=this.Fb;return a}Z(){return olympe.Y.vb(this.C+this.relation.V()+this.G)}ba(a,b){return b instanceof olympe.dc.query.va.Xd?[a]:[a+this.relation.V(),a+'followRules'].map(c=>olympe.Y.vb(c))}lb(a){const b=this.V();for(const c of Zg(a,this.C))this.G&&ah(a,c,b,c),this.db.Jg(c,
|
|
677
|
+
this.relation).forEach(d=>{ah(a,d,b,c)});super.lb(a)}observe(a,b){const c=super.observe(a,b),d=this.relation.X(),e=this.relation.Ga(),f=new Set,g=(h,k,l,n,p)=>{k=olympe.Y.vb(k+h+p+l);if(this.G||0<l)0<l&&bh(a,n,d,e,h,p),c(n,p,h,k);n?f.has(p)||(f.add(p),W(this.db,p,this.relation,g.bind(this,h,k,l+1),k)):(f.delete(p),this.db.F(p,this.relation,k))};return(h,k,l,n)=>g(k,n+this.toString(),0,h,k)}ha(){return Object.assign(super.ha(),{s:this.G,t:this.relation.X(),d:this.relation.Ga()})}L(){return`followRecursivelyPart-${this.relation.V()}-${this.G}-${super.L()}`}Jc(){const a=
|
|
678
|
+
{recursive:this.G?'INCLUDE_SELF':'EXCLUDE_SELF',relation:this.relation,filter:Lh(this).map(b=>b.map(c=>c.Jc())),optional:this.T()};this.Fb&&(a.sort={property:this.Fb.Ka(),order:this.Fb.ei});return a}toString(){return`FollowRecursively Part: ${this.relation}`}toJSON(){return{type:'follow recursively',relation:`${this.db.name(this.relation)} (${this.relation.X()})`,direction:this.relation.Ga()}}};olympe.dc.query.va.Xd=class extends olympe.dc.query.va.Nl{constructor(a,b,c){super(a,!1);this.bc=b;this.G=null!=c?c:null}O(){return new olympe.dc.query.va.Xd(this.C,this.bc,this.G)}Z(){return olympe.Y.vb(this.C+'followRules')}za(){return new olympe.dc.query.va.Xn(this.G)}ba(a,b){return b instanceof olympe.dc.query.va.Xd?[a]:[olympe.Y.vb(a+'followRules')]}Dc(a){if(a instanceof olympe.dc.query.va.lh){const b=olympe.dc.ua.ORIGIN,c=olympe.dc.ua.DESTINATION,d=olympe.dc.qc.$c,e=olympe.dc.qc.Uh,f=olympe.dm.Relation.C.Rl,
|
|
679
|
+
g=olympe.dm.Relation.C.bm;a=a.relation;const h=a.Ga(),k=a.X();return h!==c||k!==d&&k!==e?!!(fg(this.db,a,this.bc)&(a.Ga()===b?f:g)):!0}return a instanceof olympe.dc.query.va.Xd?this.bc===a.bc:!1}lb(a){const b=this.V();for(const c of Zg(a,this.C))for(const d of df(this.db,c,this.bc))ah(a,d,b,c)}observe(a,b){const c=this.V(),d=(e,f,g,h)=>{const k=`${h}:${g}`;f?cg(this.db,g,this.bc,(l,n,p,q,r)=>{p&&(p=q?ah(a,r,c,e):a.remove(r,c,e),null!==n&&bh(a,q,l,n,g,r),p&&d(e,q,r,h))},k):dg(this.db,g,this.bc,k);
|
|
680
|
+
b(f,g,e,k)};return(e,f,g,h)=>{g=olympe.Y.vb(h+f+this.toString());(e?ah(a,f,c,f):a.remove(f,c,f))&&d(f,e,f,g)}}ha(){return Object.assign(super.ha(),{f:this.bc})}L(){return`followRulePart-${this.bc}-${super.L()}`}Jc(){throw Error('Try to parse a part of an implicit query. Data connectors do not support those queries.');}toString(){return`FollowRule Part: ${this.db.name(this.bc)} (${this.bc})`}toJSON(){return{type:'follow rule',rule:`${this.db.name(this.bc)} (${this.bc})`}}T(){return!1}filter(){olympe.ma.ab('dc.query').warn('Should never try to filter on queries with follow rules, ignore...');
|
|
681
|
+
return this}sort(){olympe.ma.ab('dc.query').warn('Should never try to sort queries with follow rules, ignore...');return this}};olympe.dc.query.va.Xd.F='followRules';olympe.dc.query.va.Ul=class{constructor(){this.content=new Map}Id(){return this.content.keys()}F(a){let b,c;return null!=(c=null==(b=this.content.get(a))?void 0:b.values())?c:[]}has(a){return this.content.has(a)}O(){return!1}G(a,b){let c=this.content.get(a);c||(c=new Set,this.content.set(a,c));a=c.size;c.add(b);return a<c.size}remove(a,b){if(null===b)return this.content.delete(a);const c=this.content.get(a);b=c.delete(b);0===c.size&&this.content.delete(a);return b}};olympe.dc.query.va.Ul.xa=[olympe.dc.query.va.Np];olympe.dc.sources={};olympe.dc.sources.jq=class extends Error{};olympe.dc.sources.hj=class{V(){}init(){}destroy(){}request(){return x(function*(){})}fa(){}};const Ph=olympe.net.Ba.Nd.GET,Qh=olympe.net.Ba.Nd.ih,Rh=olympe.net.Ba.Nd.zc,Sh=olympe.net.Ba.Nd.Mp,Th=olympe.net.Ba.Headers.Rh,Uh=olympe.net.Ba.Headers.tn,Vh=olympe.net.Ba.Zb.gh,Wh=olympe.net.Ba.Zb.On,Xh=olympe.net.Ba.Zb.xo,Yh=olympe.net.Ba.Zb.ni,Zh=olympe.net.Ba.Zb.Al;
|
|
682
|
+
function $h(a){const b=`/${olympe.W.getParameter(olympe.dc.sources.U.hl)}/:${'sourceId'}/:${'requestType'}`.replace(/\/+/g,'/').replace(/\/$/,'');a.T.L('_DataSourcesHTTPService',b,[Ph,Qh,Rh,Sh],(c,d,e)=>x(function*(){const f=d.get('sourceId');var g=a.G.get(d.get('sourceId'));if(!g){var h;g=null!=(h=olympe.dc.ia().name(f))?h:'name unknown';return Promise.resolve(new olympe.net.Yd(`No handler found for datasource ${f} called '${g}'`,Zh,'Invalid source id'))}h=c.method;const k=c.Ii();try{var l=yield ai(a,
|
|
683
|
+
k[Uh])}catch(r){return new olympe.net.Yd(`Invalid token ${r}`,Xh,'Access denied')}try{var n=Number(d.get('requestType')),p=c.body;const r=olympe.dc.Request.C.Jb,t=olympe.dc.Request.C.og,u=olympe.dc.Request.C.xg,w=olympe.dc.Request.C.yg,y=olympe.dc.Request.C.Tg,z=olympe.dc.Request.C.dg,A=olympe.dc.Request.C.Hf,C=olympe.dc.Request.C.Of;let M;switch(n){case r:break;case t:case u:case y:case w:M=a.F.F(p);break;case C:case z:case A:M={tag:e.get('tag'),model:e.get('model'),mimeType:k[Th]};p instanceof Uint8Array&&
|
|
684
|
+
(M.content=p);break;default:throw Error(`Data Http request type not supported ${n}`);}let K;const ta=null!=(K=k['X-Source-Origin'])?K:olympe.dc.Pa.jf;var q=Ie(new olympe.dc.Request(n,f,M,l),ta);const Ja=yield g(q);let Lc;void 0===Ja?Lc='':Ja instanceof Blob||Ja instanceof Uint8Array||Ja instanceof ArrayBuffer||'function'===typeof(null==Ja?void 0:Ja.pipe)?Lc=Ja:Lc=JSON.stringify(a.F.ha(Ja));return new olympe.net.Yd(Lc,h===Sh?Wh:Vh)}catch(r){return r instanceof olympe.dc.sources.jq?new olympe.net.Yd(`Authorization error: ${r}`,
|
|
685
|
+
Xh,'Forbidden'):new olympe.net.Yd(`Internal server error: ${r}`,Yh,'Internal server error')}})).catch(c=>a.H.error(`Error while starting the HTTP Service: ${c}`));a.H.debug(`Started HTTP service with path: ${b}`)}function bi(a){a.T.Z('_DataSourcesHTTPService').catch(b=>{a.H.error(`An error occurred while stopping the data sources http service: ${b}`)})}function ci(a,b,c){0===a.G.size&&$h(a);a.G.set(b,c);return()=>{a.G.delete(b);0===a.G.size&&bi(a)}}
|
|
686
|
+
function di(a,b,c){c=b instanceof olympe.dm.DataSource?b.xe(c):ei(b,c);null===c&&a.H.error(`Impossible to build URL for data source ${b}`);return c}
|
|
687
|
+
function fi(a,b,c){if(b===olympe.dc.Pa.SERVER){var d;return null!=(d=fd(a.L,a.fa.get(c)))?d:null}var e=a.O.get(b);if(!e){d=a.ba.yb(b);e=olympe.dc.sources.U.il;const f=olympe.dc.sources.U.Zh,g=olympe.dc.sources.U.Qo,h=olympe.dc.sources.U.hl;let k;e=`${di(a,null!=d?d:b,g)?'https':'http'}://${di(a,null!=d?d:b,e)}:${null!=(k=di(a,null!=d?d:b,f))?k:di(a,null!=d?d:b,g)?443:80}`+`/${di(a,null!=d?d:b,h)}/${b}`.replace(/\/+/g,'/').replace(/\/$/,'');a.O.set(b,e)}return`${e}/${c}`}
|
|
688
|
+
function gi(a,b){return b instanceof olympe.net.ai?hd(a.L,b,Nc(a.Z).sd()):Promise.reject('No http request to send')}function hi(a,b){var c=fi(a,b.nc(),b.getType());if(!c)return Promise.reject(`No destination URL to send the query to destination: ${b.nc()}`);const d=b.content,e=JSON.stringify(a.F.ha(d));c=P(c,Qh,e);Q(c,{['X-Source-Origin']:b.origin,[Th]:'application/json'});return gi(a,c).then(f=>'string'===typeof f?a.F.F(JSON.parse(f)):olympe.dc.query.ld.Fi(d))}
|
|
689
|
+
function ii(a,b){var c=fi(a,b.nc(),b.getType());if(!c)return Promise.reject(`No destination URL to send the transaction to destination: ${b.nc()}`);const d=JSON.stringify(a.F.ha(b.content));c=P(c,Qh,d);Q(c,{['X-Source-Origin']:b.origin,[Th]:'application/json'});return gi(a,c).then()}function ai(a,b){return'string'!==typeof b?Promise.reject('Please provide an authorization token.'):new Promise((c,d)=>{a.Z.Mg(b,(e,f)=>{e?d(e):c(f)})})}
|
|
690
|
+
olympe.dc.sources.Ks=class{constructor(a,b,c,d,e,f){this.H=a;this.T=b;this.L=c;this.Z=d;this.ba=e;this.F=f;this.G=new Map;new olympe.D.Yb('Http service of remote data provider');this.O=new Map;this.C=new Map;this.fa=new Map([[olympe.dc.Request.C.fg,olympe.N.$b.fg],[olympe.dc.Request.C.Hf,olympe.N.$b.kj],[olympe.dc.Request.C.Of,olympe.N.$b.kj],[olympe.dc.Request.C.dg,olympe.N.$b.kj],[olympe.dc.Request.C.vn,olympe.N.$b.un],[olympe.dc.Request.C.aq,olympe.N.$b.$p],[olympe.dc.Request.C.Jo,olympe.N.$b.Io],
|
|
691
|
+
[olympe.dc.Request.C.og,olympe.N.$b.Jn],[olympe.dc.Request.C.yg,olympe.N.$b.TRANSACTION]])}yc(a){var b=fi(this,a.nc(),a.getType());if(!b)return Promise.reject(`No destination URL to send the status request to destination: ${a.nc()}`);b=P(b,Ph);Q(b,{['X-Source-Origin']:a.origin});return gi(this,b)}uploadFileContent(a){const {tag:b,model:c,content:d}=a.content,e=a.nc(),f=fi(this,e,a.getType());if(!f)return Promise.reject(`No destination URL to upload the file. ${b}`);const g=P(e===olympe.dc.Pa.SERVER?
|
|
692
|
+
`${f}/${b}`:`${f}?tag=${b}&model=${c}`,Sh,d);Q(g,{[Th]:'application/octet-stream'});e!==olympe.dc.Pa.SERVER&&Q(g,{['X-Source-Origin']:a.origin});return gi(this,g).then(()=>(new URL(g.C())).pathname)}deleteFileContent(a){const {tag:b,model:c}=a.content,d=a.nc();var e=fi(this,d,a.getType());if(!e)return Promise.reject(`No destination URL to delete the file. ${b}`);e=P(d===olympe.dc.Pa.SERVER?`${e}/${b}`:`${e}?tag=${b}&model=${c}`,Rh,b);d!==olympe.dc.Pa.SERVER&&Q(e,{['X-Source-Origin']:a.origin});return gi(this,
|
|
693
|
+
e).then()}downloadFileContent(a){const {tag:b,model:c}=a.content,d=a.nc();var e=fi(this,d,a.getType());if(!e)return Promise.reject(Error(`No destination URL to download the file. ${b}`));var f;const g=null!=(f=this.C.get(b))?f:[];f=new Promise((h,k)=>{g.push({done:h,zh:k})});if(this.C.has(b))return f;this.C.set(b,g);e=P(d===olympe.dc.Pa.SERVER?`${e}/${b}`:`${e}?tag=${b}&model=${c}`,Ph,b,olympe.net.Ba.ResponseType.Fq);d!==olympe.dc.Pa.SERVER&&Q(e,{['X-Source-Origin']:a.origin});gi(this,e).then(h=>
|
|
694
|
+
{const k=h instanceof ArrayBuffer?new Uint8Array(h,0,h.byteLength):h;let l;null==(l=this.C.get(b))||l.forEach(n=>n.done(k))}).catch(h=>{let k;null==(k=this.C.get(b))||k.forEach(l=>l.zh(`${h}`))}).finally(()=>{this.C.delete(b)});return f}};olympe.dc.sources.Yo=class{constructor(a,b){this.H=a;this.Xb=b}};olympe.dc.sources.Yo.Zb={pi:0,xA:1,yA:3,Vz:4};const ji=olympe.dc.Request.C.Jb,ki=olympe.dc.Request.C.og,li=olympe.dc.Request.C.Fj,mi=olympe.dc.Request.C.Of,ni=olympe.dc.Request.C.Hf,oi=olympe.dc.Request.C.dg,pi=olympe.dc.Request.C.Ph,qi=olympe.dc.Request.C.Tg,ri=olympe.dc.Request.C.xg,si=olympe.dc.Request.C.yg;
|
|
695
|
+
function ti(a,b){const c=b.V();null===a.F&&(a.F=new olympe.Y.$l(6E4),La(a.F,(f,g)=>{a.applyTransaction(g,!1).catch(h=>{a.H.error(`Error occurred when applying burst transaction ${f} to the data source: ${h}`)})}),Ma(a.F,()=>{a.F=null}));let d;const e=null!=(d=a.F.get(c))?d:new olympe.dc.db.Sc(c);b.qd(e);Ia(a.F.C,c)||a.F.set(c,e)}
|
|
696
|
+
function ui(a,b){const c=b.V();let d,e;const f=null!=(e=null==(d=a.F)?void 0:d.get(c))?e:new olympe.dc.db.Sc(c);let g;null==(g=a.F)||g.delete(c);b.qd(f);return a.applyTransaction(f,!1).catch(h=>{a.H.error(`Error occurred when applying burst transaction ${c} to the data source: ${h}`)})}function vi(a,b){const c=rxjs.defer(()=>a.C.executeQuery(b).then(d=>d.Wb()));return 0<a.T?rxjs.interval(a.T).pipe(rxjs.operators.switchMap(()=>c)):c}
|
|
697
|
+
olympe.dc.sources.lp=class{constructor(a,b){this.H=a;this.C=b;this.Xb=null;this.O=olympe.dc.query.kk();this.L=olympe.dc.Dm();this.G=new olympe.D.Yb('Context of source '+this.V());let c;this.T=null!=(c=b.xe(olympe.dc.sources.U.Jl))?c:-1;this.F=null}V(){return this.C.V()}init(a){this.Xb=a;if(this.V()===olympe.dc.Pa.SELF)return this;(new Promise((b,c)=>{let d=!0;wi(this.C,this.G).subscribe(rxjs.Subscriber.create(e=>{if(this.H.C()){this.H.debug(`Data source ${this.C.name()} has loaded ${e.size()} data types in its cache:`);
|
|
698
|
+
for(const [f,g]of e)this.H.debug(`=> DataType: ${g.name()} (${f})`)}d&&(d=!1,b())},c))})).then(()=>this.C.init(this.G)).catch(b=>{this.H.error(`Error while initialization of DataSource ${this.C.name()} (${this.V()}): ${b}`)});return this}healthCheck(){return this.C.healthCheck().then(()=>`Data source ${this.C.name()} (${this.C.V()}) OK`)}destroy(){this.G.destroy();return this.C.destroy()}request(a){const b=a.content;var c=a.getType();switch(c){case ji:const d=olympe.dm.DataSource.Jb.Eb,e=olympe.dm.DataSource.Jb.kh;
|
|
699
|
+
return this.C.healthCheck().then(()=>({s:e})).catch(g=>({s:d,r:String(g)}));case ki:return this.C.executeQuery(b);case pi:return c=b.Wb(),ti(this,c),this.L.Hc(c),Promise.resolve();case ri:case si:const f=b.Wb();return this.applyTransaction(f,c===si).finally(()=>{if(a.origin===olympe.dc.Pa.SELF){var g=f.V();g=Ie(new olympe.dc.Request(olympe.dc.Request.C.lj,olympe.dc.Pa.SELF,{id:g,finalize:olympe.dc.transaction.lf.C.ii,error:null}),this.V());let h;null==(h=this.Xb)||h.kd(g)}});case qi:return ui(this,
|
|
700
|
+
b.Wb());case mi:return b.content instanceof Uint8Array?this.C.uploadFileContent(b.tag,b.model,b.content).then(()=>`datasource://${b.tag}`):Promise.reject('File content is undefined');case ni:return this.C.downloadFileContent(b.tag,b.model);case oi:return this.C.deleteFileContent(b.tag,b.model);default:return Promise.reject(`Request of type ${a.getType()} is not supported by the data source`)}}fa(a){if(a.getType()===li){const b=a.content;a=a.origin;return a===olympe.dc.Pa.SELF?vi(this,b):mh(this.O,
|
|
701
|
+
b,this.G,a,olympe.dc.pa.Tc.Ef,{}).pipe(rxjs.operators.map(c=>{let d,e;return null!=(e=null==(d=c.ye)?void 0:d.G)?e:null}),rxjs.operators.filter(c=>null!==c))}return rxjs.throwError(()=>Error('Subscription request not supported'))}applyTransaction(a,b){const c=this;return x(function*(){const d=xi(a);yield c.C.applyTransaction(d,{batch:b});yield uh(c.O,c.V(),a);c.L.Hc(a)})}};olympe.dc.sources.lp.xa=[olympe.dc.sources.hj];function xi(a){const b=olympe.dc.sources.Nf.C.gs,c=olympe.dc.sources.Nf.C.Ru,d=olympe.dc.sources.Nf.C.ns,e=olympe.dc.sources.Nf.C.hs,f=olympe.dc.sources.Nf.C.ps,g=[],h=[],k=[],l=[],n=[];a.zb.forEach((p,q)=>{const r=p.Ec();p.G()?g.push(yi(b,q,r,p.T()?p.Cb():null)):p.Td()?k.push(yi(d,q,r,null,p.O())):p.T()&&h.push(yi(c,q,r,p.Cb()));for(const [t,u,w]of p.td())p=a.Hd(u),w?l.push(new zi(e,t,q,u,r,p.Ec())):n.push(new zi(f,t,q,u,r,p.Ec()))});return n.concat(k,g,h,l)}
|
|
702
|
+
function yi(a,b,c,d,e){if('string'!==typeof c)throw Error(`Patch: model of instance ${b} is missing. It is invalid transaction.`);return new Ai(a,b,c,d,e)}olympe.dc.sources.Nf=class{constructor(a){this.type=a}};class Ai extends olympe.dc.sources.Nf{constructor(a,b,c,d,e){super(a);this.object=b;this.model=c;this.properties=null!=d?d:null;this.deleteRules=null!=e?e:olympe.dc.ec.NONE}}
|
|
703
|
+
class zi extends olympe.dc.sources.Nf{constructor(a,b,c,d,e,f){super(a);this.relation=b;this.from=c;this.to=d;this.fromModel=e;this.toModel=f}}olympe.dc.sources.Nf.C={gs:'CREATE',Ru:'UPDATE',ns:'DELETE',hs:'CREATE_RELATION',ps:'DELETE_RELATION'};function Bi(a,b){b=Ie(new olympe.dc.Request(olympe.dc.Request.C.lj,olympe.dc.Pa.SELF,{id:b,finalize:olympe.dc.transaction.lf.C.ii,error:null}),a.V());let c;null==(c=a.Xb)||c.kd(b)}
|
|
704
|
+
olympe.dc.sources.Qk=class{constructor(a,b){this.H=a;this.F=b;this.Xb=null}V(){}T(){}Z(){}init(a){this.Xb=a;return this}destroy(){return Promise.resolve()}request(a){const b=this;return x(function*(){if(!b.F.F)return b.T(a);var c=olympe.dc.Request.C.Jb,d=olympe.dc.Request.C.og;const e=olympe.dc.Request.C.xg,f=olympe.dc.Request.C.yg;var g=olympe.dc.Request.C.Ph;const h=olympe.dc.Request.C.Tg,k=olympe.dc.Request.C.Of;var l=olympe.dc.Request.C.Hf;const n=olympe.dc.Request.C.dg,p=olympe.dc.sources.Qd(),
|
|
705
|
+
q=a.getType();var r=a.nc();if(Ic(b.F)){q===d&&(c=a.content,(g=Ke(a).get(olympe.dc.pa.C.Nk))&&(yield Ci(p,c.V(),g)),b.H.debug(`Data Provider: Query ${c.V()} will be executed with its default Remote or Server provider`));if(q===l&&(l=a.content,'string'===typeof(null==l?void 0:l.url)&&l.url.startsWith('offline://')))return p.downloadFileContent(l.tag);l=yield b.T(a);if(q===d)d=a.content,yield Di(p,d.V(),r,l.Wb(),!0),b.H.C()&&b.H.debug(`Data Provider: Data result for query ${d.V()}`,l.Wb().zb.size,'instances',
|
|
706
|
+
Array.from(l.Wb().td()).length,'relations');else if(q===e||q===f||q===h)b.H.debug('Data Provider: Persisting graph patch in offline cache after successful transaction'),yield Di(p,null,r,a.content.Wb(),!1);return l}b.H.debug(`Data Provider: Request (type: ${q}) will be sent to the cache data provider: ${a.content}`);switch(q){case c:return{s:olympe.dm.DataSource.Jb.$d};case d:return p.executeQuery(a.content);case e:case f:case h:d=a.content;const t=d.Wb().V();return p.applyTransaction(d,r).finally(()=>
|
|
707
|
+
Bi(b,t));case g:return Promise.resolve();case k:return r=a.content,p.uploadFileContent(r.tag,r.content,r.mimeType);case l:return p.downloadFileContent(a.content.tag);case n:return p.deleteFileContent(a.content.tag);default:return Promise.reject(`Messages of type ${a.getType()} is not supported by the source ${b.V()}`)}})}fa(a,b){if(!this.F.F)return this.Z(a,b);const c=olympe.dc.sources.Qd(),d=a.content,e=a.nc();return rxjs.of(null).pipe(rxjs.operators.switchMap(()=>{if(Ic(this.F)){const f=new rxjs.Observable(h=>
|
|
708
|
+
{olympe.D.zr([this.F.Uf()],()=>{h.error(new olympe.N.errors.Lo('Go Offline',d.V()))})}),g=this.Z(a,b);return rxjs.merge(f,g)}return new rxjs.Observable(f=>{olympe.D.zr([this.F.Uf()],()=>{f.error(new olympe.N.errors.Hn('Back Online',d.V()))})})})).pipe(rxjs.operators.switchMap(f=>rxjs.from(Di(c,d.V(),e,f).then(()=>f).catch(g=>{this.H.error(`Data Provider: Cache database failed to handle the data result with message: ${g}`);throw g;}))))}};olympe.dc.sources.Qk.xa=[olympe.dc.sources.hj];const Ei=olympe.dc.Request.C.Jb,Fi=olympe.dc.Request.C.og,Gi=olympe.dc.Request.C.Fj,Hi=olympe.dc.Request.C.xg,Ii=olympe.dc.Request.C.yg,Ji=olympe.dc.Request.C.Ph,Ki=olympe.dc.Request.C.Tg,Li=olympe.dc.Request.C.Of,Mi=olympe.dc.Request.C.Hf,Ni=olympe.dc.Request.C.dg;function Oi(a,b){let c;return(null==(c=a.za.yb(b))?void 0:c.xe(olympe.dc.sources.U.Ce))!==olympe.dm.DataSource.Ce.Mo}function Pi(a,b){let c;return(null==(c=a.za.yb(b))?void 0:c.xe(olympe.dc.sources.U.Ce))!==olympe.dm.DataSource.Ce.yn}
|
|
709
|
+
function Qi(a,b){b=b.uc();if(b!==olympe.dm.User.C&&a.xe(olympe.dc.sources.U.Ql))throw a=`User ${b} has no right to access the restricted data source ${a.name()} (${a.V()}). Please use an admin account instead.`,new olympe.dc.sources.jq(a);}
|
|
710
|
+
function Ri(a,b,c,d,e){return x(function*(){var f=olympe.N.Request.pb.SEND,g=olympe.N.Request.pb.GET;const h=olympe.N.Request.pb.PUBLISH,k=olympe.N.Request.pb.SUBSCRIBE,l=d.Jh();var n=d.body();if(e!==n.uc())throw Error('Access denied: try to impersonate a user');Qi(c,n);let p;if(null==(p=a.Xb)||!p.sources.has(n.nc()))throw Error(`Try to process a message with destination data source ${n.nc()} coming from remote but not started here`);if(l===k){if(n.getType()===Gi)f=n.content.V();else throw Error('Not supported type of subscription');
|
|
711
|
+
g=yield d.Sm(f);a.ba.set(g,f);g=a.O.get(f);g||(g=new Si(a.H,f,b,Ie(n,olympe.dc.Pa.jf)),a.O.set(f,g));n=g;n.C++;n.H.debug(`Data subscription ${n.F} has ${n.C} subscribers`)}else l===g?(n=yield b.request(n),void 0!==n?yield d.kd(n):a.H.warn(`Request from ${d.source()} requires an output value, but got undefined instead.`)):l===f?(yield b.request(n),yield d.Wq()):l===h&&(yield b.request(n))})}
|
|
712
|
+
olympe.dc.sources.iq=class extends olympe.dc.sources.Qk{constructor(a,b,c,d,e,f){super(a,d);this.L=b;this.C=c;this.db=e;this.G=new olympe.D.Yb('Remote Provider Context');this.oa=new Map;this.O=new Map;this.ba=new Map;this.za=f}V(){return olympe.dc.Pa.jf}T(a){var b=olympe.N.wb;const c=a.nc(),d=a.getType();this.H.C()&&this.H.debug(`Request (type: ${d}) will be sent to remote data provider ${c}: ${a.content}`);switch(d){case Ei:const e=olympe.dm.DataSource.Jb.Eb,f=olympe.dm.DataSource.Jb.kh;b=Oi(this,
|
|
712
713
|
c)?b.get(c,a):Promise.resolve({s:f});a=Pi(this,c)?this.C.yc(a):Promise.resolve({s:f});return Promise.all([b,a]).then(([k,l])=>{if((null==k?void 0:k.s)===e||(null==l?void 0:l.s)===e){let n,p;return{s:e,r:`${null!=(n=null==k?void 0:k.r)?n:''} ${null!=(p=null==l?void 0:l.r)?p:''}`}}return{s:f}});case Fi:return Pi(this,c)?hi(this.C,a):b.get(c,a);case Hi:const g=a.content.Wb().V();return(Oi(this,c)?b.send(c,a):ii(this.C,a)).finally(()=>Bi(this,g));case Ii:const h=a.content.Wb().V();return(Pi(this,c)?ii(this.C,
|
|
713
714
|
a):b.send(c,a)).finally(()=>Bi(this,h));case Ji:return Oi(this,c)?b.publish(c,a).catch(k=>{this.H.error(`An error occurred while sending "burst transaction" to the data source ${c}: ${k}`)}):Promise.resolve();case Ki:return Oi(this,c)?b.publish(c,a).catch(k=>{this.H.error(`An error occurred while sending "burst transaction done" to the data source ${c}: ${k}`)}):ii(this.C,a);case Li:return Pi(this,c)?this.C.uploadFileContent(a):b.get(c,a);case Mi:return Pi(this,c)?this.C.downloadFileContent(a):b.get(c,
|
|
714
|
-
a);case Ni:return Pi(this,c)?this.C.deleteFileContent(a):b.send(c,a);default:return Promise.reject(`Messages of type ${a.getType()} is not supported by the source ${this.V()}`)}}Z(a,b){const c=a.
|
|
715
|
-
this.G,a,{onRetry:b}):rxjs.throwError(()=>Error(`Do not handle subscription request of type ${d}`))}init(a){super.init(a);if(a.G)return this;olympe.dc.pa.from(this.
|
|
716
|
-
(new olympe.N.
|
|
717
|
-
d.onDestroy(()=>{let l;return null==(l=e)?void 0:l()}));g!==olympe.dm.DataSource.
|
|
718
|
-
a.G.unsubscribe(),a=!0):(a.H.debug(`Data subscription ${a.F} has ${a.C} subscribers`),a=!1));a&&this.O.delete(b)}};class Si{constructor(a,b,c,d){this.H=a;this.F=b;this.C=0;this.G=
|
|
719
|
-
olympe.dc.CloudObject:return a=a.X(),this.O(a),{t:10,v:a};case a instanceof olympe.dc.pa:return{t:11,v:a.ha()};case a instanceof olympe.dc.Oa:return{t:12,v:a.ha(this.O.bind(this))};case a instanceof olympe.dc.db.Sc:const b=new olympe.dc.transaction.
|
|
720
|
-
v:a.ha()};case a instanceof olympe.dc.Bc:return{t:17,v:a.X()};default:return super.C(a)}}G(a){if('object'!==typeof a||'number'!==typeof(null==a?void 0:a.t))return super.G(a);switch(a.t){case 10:return olympe.dc.CloudObject.get(a.v);case 11:a=a.v;var b=a.p.map(olympe.dc.query.va.
|
|
721
|
-
b:void 0,
|
|
722
|
-
a)){const g=this.
|
|
723
|
-
olympe.dc.Request.C.Tg,nj=olympe.dc.Request.C
|
|
724
|
-
function tj(a,b){const c=new olympe.dc.transaction.
|
|
725
|
-
function yj(a,b){const c=b.V();a.H.C()&&a.H.debug(`Query (${c}) sent to orchestrator: ${b}`);b=wj(a,b);return qj(a,bj,b).then(d=>xj(a,d))}function uj(a,b,c,d=!0){const e=olympe.N.
|
|
726
|
-
function wj(a,b){const c=
|
|
727
|
-
function sj(a,b,c){b=
|
|
728
|
-
function xj(a,b){if(b&&'object'===typeof b){if(0<b.s)throw Error(b.info.error.reason);return
|
|
729
|
-
olympe.dc.sources.
|
|
730
|
-
{s:a}:{s:c,r:'Disconnected'});case Ui:return pj(this);case Vi:return a=new olympe.dc.transaction.
|
|
731
|
-
Yi),olympe.net.Ba.Nd.ih,JSON.stringify(c),olympe.net.Ba.ResponseType.
|
|
732
|
-
c=Promise.reject('Server is disconnected')),c;case jj:case kj:case lj:case nj:return uj(this,b,{});case gj:return this.C.downloadFileContent(a);case fj:return this.C.deleteFileContent(a);case hj:return this.C.uploadFileContent(a);default:return Promise.reject(`ServerProvider: Message of type ${b} not supported yet`)}}Z(a,b){if(a.getType()===aj){const c=a.content,d=c.V();return(new rxjs.Observable(e=>{const f=wj(this,c);this.
|
|
733
|
-
(e,f)=>{this.H.debug(`Subscribe to topic ${e.V()} now that we are back online, after waiting for ${f}ms`);b()}),rxjs.operators.finalize(()=>{uj(this,dj,{i:d}).catch(e=>{this.H.warn(`Fail to unsubscribe to graphdef ${d}: ${e}`)}).finally(()=>{this.
|
|
734
|
-
const c=olympe.dc.Request.C.
|
|
735
|
-
olympe.dc.ua.ORIGIN?1:2,v:!0,r:c.recursive,q:b.map(this.ba.bind(this,a))}}return{}}};olympe.dc.sources.
|
|
736
|
-
olympe.dc.sources.
|
|
737
|
-
!0;var a=new olympe.dc.Wa;Z(a.create(olympe.dm.DataSource,this.C).
|
|
738
|
-
olympe.dc.sources.U={
|
|
739
|
-
olympe.W.config(function(a){var b=a.getParameter(olympe.N.U.
|
|
740
|
-
|
|
741
|
-
olympe.dc.sources.R.
|
|
742
|
-
olympe.dc.R.
|
|
743
|
-
function Di(a,b,c,d,e=!1){return
|
|
744
|
-
a.hc.next(f)}finally{b&&Gj(a,'queries',b)}}))().then(()=>{})})}function Hj(){var a=olympe.dc.sources.
|
|
745
|
-
function Gj(a,b,c){const d=a.status.getValue();let e,f;null!=(f=null==(e=d[b])?void 0:e.values)&&f.delete(c)&&(d[b].processed+=1,0===d[b].values.size&&(delete d[b],('queries'===b?'files':'queries')in d||(d.processing=!1)),a.status.next(d))}function Ij(a){return
|
|
746
|
-
function Fj(a,b,c){return
|
|
747
|
-
f={tag:h,model:g.Ec(),mimeType:l};const n=new olympe.dc.Request(olympe.dc.Request.C.
|
|
748
|
-
function Kj(a){const b=[olympe.dc.ga(olympe.dm.File)];if(olympe.dc.CloudObject.exists(olympe.dm.File))b.push(...olympe.dc.pa.from(olympe.dm.File).
|
|
749
|
-
function Nj(a,b){return Array.from(a.F.values()).some(c=>c.has(b))}function Bj(a){return Array.from(a.F.keys()).filter(b=>'__code-as-data__'!==b)}function Oj(a,b){return
|
|
715
|
+
a);case Ni:return Pi(this,c)?this.C.deleteFileContent(a):b.send(c,a);default:return Promise.reject(`Messages of type ${a.getType()} is not supported by the source ${this.V()}`)}}Z(a,b){const c=a.nc(),d=a.getType();if(!Oi(this,c))return rxjs.throwError(()=>Error(`Subscription request not supported for data source ${this.db.name(c)} (${c}) which uses HTTP only.`));this.H.C()&&this.H.debug(`Subscription (type: ${d}) will be sent to remote data provider ${c}: ${a.content}`);return d===Gi?olympe.N.wb.observe(c,
|
|
716
|
+
this.G,a,{onRetry:b}):rxjs.throwError(()=>Error(`Do not handle subscription request of type ${d}`))}init(a){super.init(a);if(a.G)return this;olympe.dc.pa.from(this.L,this.L).cb(olympe.dm.DataSource.Pi).filter(olympe.dc.query.Aa.Qa(olympe.dm.DataSource.uh,!0)).filter(olympe.dc.query.Aa.Qa(olympe.dm.DataSource.fr,!0)).observe(this.G).subscribe(b=>{Ne(b).forEach(this.jb.bind(this,a));Me(b).forEach(c=>{let d;null==(d=this.oa.get(c))||d.destroy();this.oa.delete(c)})});this.db.Ka(this.L,olympe.dm.DataSource.fr)&&
|
|
717
|
+
(new olympe.N.wb(this.L,this.G)).listen().subscribe(b=>{b=b.body();b instanceof olympe.dc.Request?a.kd(b):this.H.error('Self source received something else than a data request, ignore it.')});return this}destroy(){return x(function*(){})}jb(a,b){const c=b.X(),d=new olympe.D.Yb(`Published data provider context ${c}`,this.G);this.oa.set(c,d);let e,f;Ti(b,d).subscribe(g=>{let h;null==(h=e)||h();let k;null==(k=f)||k.stop();g!==olympe.dm.DataSource.Ce.yn&&(e=ci(this.C,c,l=>{Qi(b,l);return a.request(l)}),
|
|
718
|
+
d.onDestroy(()=>{let l;return null==(l=e)?void 0:l()}));g!==olympe.dm.DataSource.Ce.Mo&&(g=new olympe.D.Yb(`Bus Service of data source ${c}`,d),f=(new olympe.N.wb(c,g)).Dr(this.Ja.bind(this)),f.listen().subscribe(l=>{l.Lh().then(n=>Ri(this,a,b,l,n)).catch(n=>{this.H.warn(`Error occurred while processing request from ${l.source()}: ${n}`);return l.zh(n instanceof Error?n:Error(n))})}))})}Ja(a){const b=this.ba.get(a);this.ba.delete(a);if(a=b)null==(a=this.O.get(b))?a=0:(0<a.C&&--a.C,0===a.C?(a.H.debug(`Data subscription ${a.F} has more subscriber: unsubscribe`),
|
|
719
|
+
a.G.unsubscribe(),a=!0):(a.H.debug(`Data subscription ${a.F} has ${a.C} subscribers`),a=!1));a&&this.O.delete(b)}};class Si{constructor(a,b,c,d){this.H=a;this.F=b;this.C=0;this.G=Oe(c,d).subscribe({next:e=>{olympe.N.wb.publish(b,e).catch(f=>a.error(`Error occurred while publishing a data notification: ${f}`))},error:e=>a.error(`Error occurred while trying to subscribe to topic ${b} for a datasource: ${e}`)})}}olympe.dc.sources.iq.xa=[olympe.dc.sources.hj];olympe.dc.sources.ug=class extends olympe.N.ug{constructor(a){super();this.db=a;this.L=new Map}ha(a){a=this.C(a);if(0<this.L.size){const b=Array.from(this.L.values());this.L.clear();return{t:0,i:b,v:a}}return a}F(a){if(0===(null==a?void 0:a.t)){const b=a.i.reduce((c,d)=>{const e=new Map(Array.from(Object.entries(d.p).map(([f,g])=>[f,this.G(g)])));c.Nc(d.t,d.s,e,d.m);d.r.forEach(f=>c.Ea(f.r,d.t,f.d));return c},new olympe.dc.db.Sc);olympe.dc.Dm().Hc(b);return this.G(a.v)}return this.G(a)}C(a){switch(!0){case a instanceof
|
|
720
|
+
olympe.dc.CloudObject:return a=a.X(),this.O(a),{t:10,v:a};case a instanceof olympe.dc.pa:return{t:11,v:a.ha()};case a instanceof olympe.dc.Oa:return{t:12,v:a.ha(this.O.bind(this))};case a instanceof olympe.dc.db.Sc:const b=new olympe.dc.transaction.mg;a.qd(b);return{t:13,i:a.V(),v:Rg(b)};case a instanceof olympe.dc.Request:return{t:14,r:a.getType(),o:a.origin,d:a.nc(),u:a.uc(),c:this.C(a.content)};case a instanceof olympe.dc.transaction.vi:return{t:15,r:a.Pg(),p:this.C(a.Wb())};case a instanceof olympe.dc.query.ld:return{t:16,
|
|
721
|
+
v:a.ha()};case a instanceof olympe.dc.Bc:return{t:17,v:a.X()};default:return super.C(a)}}G(a){if('object'!==typeof a||'number'!==typeof(null==a?void 0:a.t))return super.G(a);switch(a.t){case 10:return olympe.dc.CloudObject.get(a.v);case 11:a=a.v;var b=a.p.map(olympe.dc.query.va.Nl.C),c=a.e;return new olympe.dc.pa(a.b,a.s,b,b.length-1,new Set(a.r),{max:c.m,offset:c.o,zd:c.s,ze:c.rm});case 12:return wh(a.v);case 13:return(new olympe.dc.transaction.Aj).C(a.v,a.i);case 14:return c=null!=(b=this.G(a.c))?
|
|
722
|
+
b:void 0,Ie(new olympe.dc.Request(a.r,a.d,c,a.u),a.o);case 15:return b=this.G(a.p),new olympe.dc.transaction.vi(b,a.r);case 16:return a=a.v,new olympe.dc.query.ld((new olympe.dc.transaction.Aj).C(a.p),a.s);case 17:return new olympe.dc.Bc(a.v);default:return super.G(a)}}O(a){if(!this.L.has(a)){if(!this.db.Fa(a))throw new olympe.dc.Ep(a);var b={};this.db.Cb(a).forEach((d,e)=>{b[e]=this.C(d)});var c={t:a,m:this.db.model(a),s:this.db.source(a),p:b,r:[]};this.L.set(a,c);for(const [d,e,f]of gg(this.db,
|
|
723
|
+
a)){const g=this.L.get(f);void 0!==g&&(e===olympe.dc.ua.DESTINATION?c.r.push({r:d,d:f}):g.r.push({r:d,d:a}))}}}};const Ui=olympe.dc.Request.C.fg,Vi=olympe.dc.Request.C.xg,Wi=olympe.dc.Request.C.yg,Xi=olympe.dc.Request.C.Ph,Yi=olympe.dc.Request.C.vn,Zi=olympe.dc.Request.C.aq,$i=olympe.dc.Request.C.og,aj=olympe.dc.Request.C.Fj,bj=olympe.dc.Request.C.Jo,cj=olympe.dc.Request.C.Fs,dj=olympe.dc.Request.C.Gs,ej=olympe.dc.Request.C.Hs,fj=olympe.dc.Request.C.dg,gj=olympe.dc.Request.C.Hf,hj=olympe.dc.Request.C.Of,ij=olympe.dc.Request.C.lj,jj=olympe.dc.Request.C.Pu,kj=olympe.dc.Request.C.iu,lj=olympe.dc.Request.C.Eo,mj=
|
|
724
|
+
olympe.dc.Request.C.Tg,nj=olympe.dc.Request.C.$r,oj=olympe.dc.Request.C.Jb;function pj(a){return qj(a,olympe.dc.Request.C.fg).then(b=>{b=b.p;const c=Qg(b,a.V());a.H.C()&&a.H.debug('< Get Context result',b);a.H.O()&&a.H.log('< Get Context result has',b.length,'operations');return c})}function rj(a,b){const c=b.Wb();b=new olympe.dc.transaction.mg({xk:!0,be:!1,vh:!1});c.qd(b);return qj(a,Wi,Rg(b)).finally(()=>{sj(a,ij,{id:c.V(),finalize:olympe.dc.transaction.lf.C.ii})}).then()}
|
|
725
|
+
function tj(a,b){const c=new olympe.dc.transaction.mg({be:!1,vh:!1}),d=b.Wb();d.qd(c);return uj(a,Xi,{i:d.V(),r:b.Pg(),p:Rg(c)},!1).catch(e=>a.H.error(`Error while publishing burst transaction: ${e}`))}function vj(a,b){const c=encodeURI(Fa(olympe.Y.Se(),JSON.stringify(wj(a,b))));a.H.C()&&a.H.debug(`Static GraphDef query ${b} sent to orchestrator`);return qj(a,$i,void 0,`query=${c}&v=${a.version}`).then(d=>xj(a,d))}
|
|
726
|
+
function yj(a,b){const c=b.V();a.H.C()&&a.H.debug(`Query (${c}) sent to orchestrator: ${b}`);b=wj(a,b);return qj(a,bj,b).then(d=>xj(a,d))}function uj(a,b,c,d=!0){const e=olympe.N.He.Zn,f={c:b};Object.assign(f,c);if(d)return new Promise((g,h)=>{qd(a.G,e,f,(k,l)=>{k?h(k):g(l)})});qd(a.G,e,f);return Promise.resolve()}
|
|
727
|
+
function wj(a,b){const c=Vg(b);b={i:b.V(),b:[b.F],m:!0,v:!0};if(c[0]instanceof olympe.dc.query.va.Xd)Object.assign(b,{f:c[0].bc,q:[]});else{const d=new Map;for(let e=c.length-1;0<=e;e--){const f=c[e],g=f.C;let h;const k=(null!=(h=d.get(g))?h:new Set).add(f);if(f instanceof olympe.dc.query.va.Kf&&f.G){let l;null==(l=d.get(f.V()))||l.forEach(n=>k.add(n))}d.set(g,k)}Object.assign(b,{f:olympe.dc.ec.NONE,q:c.map(a.ba.bind(a,d))})}return b}
|
|
728
|
+
function sj(a,b,c){b=Ie(new olympe.dc.Request(b,olympe.dc.Pa.SELF,c),a.V());let d;null==(d=a.Xb)||d.kd(b)}function qj(a,b,c,d){const e=fi(a.C,a.V(),b);if('string'!==typeof e)return Promise.reject(`ServerProvider: no url for type ${b}`);b=P(`${e}${'string'===typeof d&&0<d.length?`?${d}`:''}`,void 0!==c?olympe.net.Ba.Nd.ih:olympe.net.Ba.Nd.GET,c&&JSON.stringify(c));Q(b,{[olympe.net.Ba.Headers.Rh]:'application/json'});return gi(a.C,b).then(f=>'string'===typeof f&&0<f.length?JSON.parse(f):f)}
|
|
729
|
+
function xj(a,b){if(b&&'object'===typeof b){if(0<b.s)throw Error(b.info.error.reason);return Qg(b.p,a.V())}throw Error('Data result can be created only from Object');}
|
|
730
|
+
olympe.dc.sources.wq=class extends olympe.dc.sources.Qk{constructor(a,b,c,d,e){super(a,c);this.G=b;this.C=d;this.O=new olympe.dc.transaction.Aj(this.V());this.L=new Map;this.version=e||'unknown';olympe.D.Ki(this.F.Uf(),()=>{this.L.forEach((f,g)=>{f.error(new olympe.N.errors.uj('Connection to server has been recovered',g))})})}V(){return olympe.dc.Pa.SERVER}T(a){var b=a.getType(),c=a.content,d=Ke(a);switch(b){case oj:return c=olympe.dm.DataSource.Jb.Eb,a=olympe.dm.DataSource.Jb.kh,Promise.resolve(ld(this.G)?
|
|
731
|
+
{s:a}:{s:c,r:'Disconnected'});case Ui:return pj(this);case Vi:return a=new olympe.dc.transaction.mg({be:!1,vh:!1}),b=c.Wb(),b.qd(a),uj(this,Vi,{i:b.V(),r:c.Pg(),p:Rg(a)}).then();case Wi:return rj(this,c);case Xi:return tj(this,c);case mj:return a=new olympe.dc.transaction.mg({be:!1,vh:!1}),c=c.Wb(),c.qd(a),uj(this,mj,{i:c.V(),p:Rg(a)}).then();case $i:return d.get(olympe.dc.pa.C.Zo)?vj(this,c):yj(this,c);case Yi:return ld(this.G)?(c=wj(this,olympe.dc.pa.from(c)),c.f=olympe.dc.ec.io,c=P(fi(this.C,olympe.dc.Pa.SERVER,
|
|
732
|
+
Yi),olympe.net.Ba.Nd.ih,JSON.stringify(c),olympe.net.Ba.ResponseType.Fq),Q(c,{[olympe.net.Ba.Headers.Rh]:olympe.net.Ba.Tk.JSON}),c=gi(this.C,c)):(this.H.error(`Server is disconnected, backup of instance ${c} is canceled.`),c=Promise.reject('Server is disconnected')),c;case Zi:return a=c.hD,b=c.debug,c=c.optional,ld(this.G)?(d=fi(this.C,olympe.dc.Pa.SERVER,Zi),c=P(d+`?debug=${b}&optional=${c}`,olympe.net.Ba.Nd.ih,a),Q(c,{[olympe.net.Ba.Headers.Rh]:olympe.net.Ba.Tk.Yu}),c=gi(this.C,c)):(this.H.error('Server is disconnected, restore of instance is canceled.'),
|
|
733
|
+
c=Promise.reject('Server is disconnected')),c;case jj:case kj:case lj:case nj:return uj(this,b,{});case gj:return this.C.downloadFileContent(a);case fj:return this.C.deleteFileContent(a);case hj:return this.C.uploadFileContent(a);default:return Promise.reject(`ServerProvider: Message of type ${b} not supported yet`)}}Z(a,b){if(a.getType()===aj){const c=a.content,d=c.V();return(new rxjs.Observable(e=>{const f=wj(this,c);this.L.set(d,e);uj(this,cj,f).catch(g=>e.error(g))})).pipe(olympe.N.operators.Ri(olympe.N.errors.uj,
|
|
734
|
+
(e,f)=>{this.H.debug(`Subscribe to topic ${e.V()} now that we are back online, after waiting for ${f}ms`);b()}),rxjs.operators.finalize(()=>{uj(this,dj,{i:d}).catch(e=>{this.H.warn(`Fail to unsubscribe to graphdef ${d}: ${e}`)}).finally(()=>{this.L.delete(d)})}))}return rxjs.throwError(()=>Error(`Subscription of type ${a.getType()} is not supported`))}init(a){super.init(a);jd(this.G,olympe.N.He.Zn,this.oa.bind(this));return this}destroy(){return x(function*(){})}oa(a){var b=olympe.dc.Request.C.xn;
|
|
735
|
+
const c=olympe.dc.Request.C.zl;var d=a.c;if(d===olympe.dc.Request.C.ao)a=this.O.C(a.p),sj(this,d,a);else if(d===b){var e=a.error.reason;b=this.O.C(a.p);sj(this,d,{id:a.i,rollback:b,error:e})}else d===ej?(d=a.i,a=this.O.C(a.p),null==(e=this.L.get(d))||e.next(a)):d===c&&sj(this,ij,{id:a.i,finalize:olympe.dc.transaction.lf.C.zl,error:0<a.s?a.info.error.reason:null})}ba(a,b){if(b instanceof olympe.dc.query.va.lh){const c=b.relation;let d;b=Array.from(null!=(d=a.get(b.V()))?d:[]);return{t:c.X(),d:c.Ga()===
|
|
736
|
+
olympe.dc.ua.ORIGIN?1:2,v:!0,r:c.recursive,q:b.map(this.ba.bind(this,a))}}return{}}};olympe.dc.sources.wq.xa=[olympe.dc.sources.hj];function zj(a,b,c){const d=new olympe.D.Yb(`Source solver ${b.X()}`);b.cb(olympe.dm.md.G.Vb()).cb(olympe.dm.md.F).ce().back().cb(olympe.dm.md.C).ce().observe(d,{Kd:c}).subscribe(e=>{Ne(e).forEach(([f,g])=>{a.F.set(f.X(),g.V())});Me(e).forEach(([f])=>{a.F.delete(f)})});b.cb(olympe.dm.hb.G).observe(d,{Kd:c}).subscribe(e=>{let f,g;a.G=null!=(g=null==(f=e.xc())?void 0:f.V())?g:null});d.onDestroy(()=>{a.F.clear();a.G=null})}
|
|
737
|
+
olympe.dc.sources.Sj=class{constructor(a,b,c){this.db=a;this.C=b;this.O=c;this.F=new Map;this.G=null;this.L=!1}fromModel(a){a=olympe.dc.ga(a);return this.F.has(a)?this.F.get(a):this.G&&this.T(a)?this.G:this.O}we(a){let b;return null!=(b=this.db.source(a))?b:this.O}yb(a){return a===this.C?olympe.dc.CloudObject.get(this.C):a===olympe.dc.Pa.SERVER?olympe.dc.CloudObject.get(olympe.dm.DataSource.SERVER):this.db.Fa(a)&&this.db.jc(a,olympe.dm.DataSource)?olympe.dc.CloudObject.get(a):null}T(){return!1}init(){if(!this.L){this.L=
|
|
738
|
+
!0;var a=new olympe.dc.Wa;Z(a.create(olympe.dm.DataSource,this.C).Ti(this.C),olympe.dm.DataSource.uh,!0);a.Ea(olympe.dm.DataSource.Pi,this.C,this.C);a.lb(()=>{olympe.dc.pa.from(this.C).observe(olympe.D.Gg()).subscribe(()=>{})})}}};olympe.dc.sources.R={Ca:'dc.sources.Logger',kl:'dc.sources.HTTPService',Vs:'dc.sources.IOService',Zp:'dc.sources.RemoteProvider',pq:'dc.sources.ServerProvider',Wz:'dc.sources.OfflineProvider',Me:'dc.sources.SourceSolver',ae:'dc.sources.Serializer',bo:'dc.sources.cache.Cache',co:'dc.sources.cache.DATABASE',Ok:'dc.sources.cache.Logger'};
|
|
739
|
+
olympe.dc.sources.U={il:'data.httpHost',Zh:'data.httpPort',Qo:'data.httpSSL',hl:'data.httpBasePath',Jl:'data.pollingFrequency',Ce:'data.communicationMode',Ql:'data.restrictedUse',VERSION:'version.version'};
|
|
740
|
+
olympe.W.config(function(a){var b=a.getParameter(olympe.N.U.Wk);G(a,olympe.dc.sources.U.il,b);var c=a.getParameter(olympe.dc.sources.U.il);c=(b=['localhost','127.0.0.1'].includes(c))||c.endsWith(a.getParameter(olympe.net.U.rj));G(a,olympe.dc.sources.U.Zh,b?3141:c?80:443);G(a,olympe.dc.sources.U.Qo,!c);G(a,olympe.dc.sources.U.hl,'runtime/data');G(a,olympe.dc.sources.U.Jl,null);G(a,olympe.dc.sources.U.Ce,null);G(a,olympe.dc.sources.U.Ql,null);F(a,olympe.dc.sources.R.Ca,[olympe.ma.R.Ha],d=>d.Oc('data'));
|
|
741
|
+
E(a,olympe.dc.sources.R.ae,olympe.dc.sources.ug,olympe.dc.R.bf);wa(a,olympe.N.R.ae,olympe.dc.sources.R.ae);E(a,olympe.dc.sources.R.kl,olympe.dc.sources.Ks,olympe.dc.sources.R.Ca,olympe.net.R.xi,olympe.N.R.jl,olympe.auth.R.Ha,olympe.dc.sources.R.Me,olympe.N.R.ae,new olympe.W.ja(olympe.N.U.Jk));E(a,olympe.dc.sources.R.Vs,olympe.dc.sources.Yo,olympe.dc.sources.R.Ca,olympe.dc.R.qg,olympe.net.R.Ha,olympe.auth.R.Ha);E(a,olympe.dc.sources.R.Zp,olympe.dc.sources.iq,olympe.dc.sources.R.Ca,new olympe.W.ja(olympe.dc.U.sg),
|
|
742
|
+
olympe.dc.sources.R.kl,olympe.N.R.Ze,olympe.dc.R.bf,olympe.dc.sources.R.Me);E(a,olympe.dc.sources.R.pq,olympe.dc.sources.wq,olympe.dc.sources.R.Ca,olympe.N.R.Kj,olympe.N.R.Ze,olympe.dc.sources.R.kl,new olympe.W.ja(olympe.dc.sources.U.VERSION));E(a,olympe.dc.sources.R.Me,olympe.dc.sources.Sj,olympe.dc.R.bf,new olympe.W.ja(olympe.dc.U.sg),new olympe.W.ja(olympe.dc.U.Yk));F(a,olympe.dc.sources.R.Ok,[olympe.ma.R.Ha],d=>d.Oc('datacache'));E(a,olympe.dc.sources.R.bo,olympe.dc.sources.cache.Cache,olympe.dc.sources.R.Ok,
|
|
743
|
+
olympe.dc.R.qg,olympe.dc.sources.R.co,olympe.dc.db.R.Ha,olympe.net.R.Ha,olympe.N.R.Ze,olympe.Bb.R.wl,olympe.Y.R.ag,new olympe.W.ja(olympe.net.U.Bp),new olympe.W.ja(olympe.dc.sources.U.VERSION));E(a,olympe.dc.sources.R.co,olympe.dc.sources.cache.yj,olympe.Bb.R.tg,olympe.dc.sources.R.Ok,olympe.dc.sources.R.ae,olympe.Bb.R.qj)},'olympe.dc.sources');olympe.W.run([olympe.dc.sources.R.Me,olympe.dc.sources.R.bo],(a,b)=>{olympe.dc.Sd=()=>a;olympe.dc.sources.Qd=()=>b});olympe.dc.sources.cache={};olympe.dc.sources.cache.errors={};olympe.dc.sources.cache.errors.Wl=class extends Error{constructor(a){super(a)}};olympe.dc.sources.cache.errors.ls=class extends olympe.dc.sources.cache.errors.Wl{};olympe.dc.sources.cache.errors.Mu=class extends olympe.dc.sources.cache.errors.Wl{};olympe.dc.sources.cache.errors.Vu=class extends olympe.dc.sources.cache.errors.Wl{};function Ci(a,b,c){return x(function*(){Aj(a,'queries',b);yield a.init();const d=a.F.has(c)?a.F.get(c):new Set;d.has(b)||(d.add(b),a.F.set(c,d),a.O.next(Bj(a)));return Cj(a.C,b,c)})}
|
|
744
|
+
function Di(a,b,c,d,e=!1){return x(function*(){yield a.init();a.H.debug(`Cache: handle query ${b} graph patch: ${d.V()}`);d.T(a.G);(()=>x(function*(){try{const f=null===b?[]:Array.from(a.F.entries()).filter(([,h])=>h.has(b)).map(([h])=>h),g=1===f.length&&'__code-as-data__'===f[0];if(null===b||!g||a.ba)a.H.debug('Cache: persist graph patch',d.V()),e&&b&&(Array.from(d.Id()).filter(h=>!h.Td()).map(h=>h.tag()),yield Dj(a.C)),yield Ej(a.C,d,0<f.length?b:null),Fj(a,d,c).catch(h=>{a.H.error(`Cache: Failed to download files of a graph patch: ${h}`)})}catch(f){a.H.error(`Cache: Failed to handle graph patch ${d.V()} with message: ${f}`),
|
|
745
|
+
a.hc.next(f)}finally{b&&Gj(a,'queries',b)}}))().then(()=>{})})}function Hj(){var a=olympe.dc.sources.Qd();a.ba=!0;a.tb=!0}function Aj(a,b,c){const d=a.status.getValue();b in d||(d[b]={total:0,processed:0,values:new Set});d[b].total+=1;d[b].values.add(c);d.processing=!0;a.status.next(d)}
|
|
746
|
+
function Gj(a,b,c){const d=a.status.getValue();let e,f;null!=(f=null==(e=d[b])?void 0:e.values)&&f.delete(c)&&(d[b].processed+=1,0===d[b].values.size&&(delete d[b],('queries'===b?'files':'queries')in d||(d.processing=!1)),a.status.next(d))}function Ij(a){return x(function*(){a.G=new olympe.dc.db.Sc;const b=yield Jj(a.C);for(const c of b)c.qd(a.G);a.fa.next(0<b.length)})}
|
|
747
|
+
function Fj(a,b,c){return x(function*(){const d=Kj(b),e=[];for(const g of d){const h=g.tag();if(!(yield Lj(a.C,h)))if(Aj(a,'files',h),!1===g.Ka(olympe.dm.File.C.X())&&g.Ka(olympe.dm.File.urlProp.X())){var f=g.Ka(olympe.dm.File.urlProp.X());const k=P(f);k.F=olympe.net.Ba.ResponseType.Ik;e.push(new Promise((l,n)=>{a.Kc.C(k,p=>{p=p.yc();200<=p&&300>p?l():n(`Failed to download file ${g}. Response code ${p}`);Gj(a,'files',h)})}))}else{let k;const l=null!=(k=g.Ka(olympe.dm.File.mimeTypeProp.X()))?k:'application/octet-stream';
|
|
748
|
+
f={tag:h,model:g.Ec(),mimeType:l};const n=new olympe.dc.Request(olympe.dc.Request.C.Hf,c,f);f=Ea(a.pd,()=>a.Xb.request(n).then(p=>Mj(a.C,h,p,l))).finally(()=>Gj(a,'files',h));e.push(f)}}yield Promise.allSettled(e).then(g=>{g.forEach((h,k)=>{if('rejected'===h.status){let l;a.H.warn(`Cache: File content for ${null==(l=d[k])?void 0:l.tag()} was not found`)}})})})}
|
|
749
|
+
function Kj(a){const b=[olympe.dc.ga(olympe.dm.File)];if(olympe.dc.CloudObject.exists(olympe.dm.File))b.push(...olympe.dc.pa.from(olympe.dm.File).Sf(olympe.dc.CloudObject.extendedByRel).hd().keys());else for(const c of b){let d,e;b.push(...(null!=(e=null==(d=a.Hd(c))?void 0:d.bb(olympe.dc.CloudObject.extendedByRel,f=>f))?e:[]))}return b.reduce((c,d)=>{let e,f;d=Array.from(null!=(f=null==(e=a.Hd(d))?void 0:e.bb(olympe.dc.CloudObject.instancesRel,g=>g))?f:[]).map(g=>a.Hd(g));return c.concat(d)},[])}
|
|
750
|
+
function Nj(a,b){return Array.from(a.F.values()).some(c=>c.has(b))}function Bj(a){return Array.from(a.F.keys()).filter(b=>'__code-as-data__'!==b)}function Oj(a,b){return x(function*(){yield a.init();if(b){var c,d=Array.from(null!=(c=a.F.get(b))?c:[]);a.F.delete(b);var e=Array.from(a.F.values()).reduce((f,g)=>{g.forEach(h=>f.add(h));return f},new Set);yield Pj(a.C,b);a.O.next(Bj(a));d.filter(f=>!e.has(f));yield Dj(a.C)}else yield Promise.all(Bj(a).map(f=>Oj(a,f)))})}
|
|
750
751
|
function Qj(a){if(!(2>a.length))for(let b=a.length-1;0<b;b--)for(let c=b-1;0<=c;c--)a[c].T(a[b])}
|
|
751
|
-
function Rj(a,b,c){return
|
|
752
|
-
l=yield a.Xb.request(l);b.
|
|
753
|
-
function Tj(a,b,c){return c instanceof olympe.N.errors.
|
|
754
|
-
c.message)):new olympe.dc.sources.cache.errors.
|
|
755
|
-
function Uj(){var a=olympe.dc.sources.
|
|
756
|
-
h,f),yield Wj(a.C,h)}catch(k){throw Tj(a,f,k);}d+=1;b.next([e,d])}}a.
|
|
757
|
-
function Xj(){const a=olympe.dc.sources.
|
|
758
|
-
function Zj(a){const b=olympe.dc.sources.
|
|
759
|
-
function bk(){const a=olympe.dc.sources.
|
|
760
|
-
olympe.dc.sources.cache.Cache=class{constructor(a,b,c,d,e,f,g,h,k,l){this.H=a;this.Xb=b;this.C=c;this.
|
|
761
|
-
this.T=!1;this.hc=new rxjs.Subject;this.
|
|
762
|
-
a):b.C.executeQuery(a)})}applyTransaction(a,b){const c=this;return
|
|
763
|
-
c){const d=this;return
|
|
764
|
-
function Ej(a,b,c){a.H.debug(`Offline DB: Apply patch ${b.V()} on local offline db`);Array.from(b.zb.keys());return a.db.F().then(()=>{null===c&&(b.zb.forEach((d,e)=>a.G.add(e)),a.
|
|
765
|
-
function Mj(a,b,c,d){c=new olympe.dc.sources.cache.
|
|
766
|
-
function Wj(a,b){return
|
|
767
|
-
function ak(a,b){return
|
|
768
|
-
function ek(a,b){return
|
|
769
|
-
a.H.debug(`Offline DB: Data result for query ${b.V()}`,d.Wb().zb.size,'instances',Array.from(d.Wb().
|
|
752
|
+
function Rj(a,b,c){return x(function*(){var d=olympe.dc.Request.C.xg;const e=olympe.dc.Request.C.dg,f=olympe.dc.Request.C.Of;a.H.debug('Sync Cache: Applying transaction patch to destination',c,b.V());const g=Kj(b);a.H.debug(`Sync Cache: Found ${g.length} files to send`);yield Promise.all(g.map(h=>x(function*(){const k=h.tag();var l=h.Ec();if(h.Td())l=new olympe.dc.Request(e,c,{tag:k,model:l});else{const n=yield Sj(a.C,k);l=new olympe.dc.Request(f,c,{tag:k,model:l,content:n.content,mimeType:n.C})}if(!Ic(a.ob))throw Error('Lost connection, stop syncing');
|
|
753
|
+
l=yield a.Xb.request(l);b.Xc(k,new Map([[olympe.dm.File.urlProp.X(),l]]))})));d=new olympe.dc.Request(d,c,new olympe.dc.transaction.vi(b,!1));if(!Ic(a.ob))throw Error('Lost connection, stop syncing');yield a.Xb.request(d)})}
|
|
754
|
+
function Tj(a,b,c){return c instanceof olympe.N.errors.Uj||c instanceof olympe.N.errors.Un?(a.H.error('Sync Cache: Timeout or Connection error',c),new olympe.dc.sources.cache.errors.ls('The connection has been lost. It can happen when the application loose connectivity or when the remote server is not responding correctly',c.message)):c instanceof olympe.N.errors.hq?(a.H.error(`Sync Cache: transaction has been rejected by ${b} data source`,c),new olympe.dc.sources.cache.errors.Mu('The transaction has been rejected by the datasource',
|
|
755
|
+
c.message)):new olympe.dc.sources.cache.errors.Vu('Synchronisation error',c.message)}
|
|
756
|
+
function Uj(){var a=olympe.dc.sources.Qd();if(a.T)return rxjs.throwError(()=>Error('Another synchronisation is in progress'));a.T=!0;a.H.info('Sync Cache: Start synchronising transactions');const b=new rxjs.BehaviorSubject([null,null]);(()=>x(function*(){yield a.init();const c=yield Vj(a.C);let d=0;const e=Array.from(c.values()).reduce((f,g)=>f+g.length,0);0<e&&b.next([e,d]);for(const [f,g]of c){Qj(g);for(const h of g){a.H.debug(`Sync Cache: Processing patch ${d+1}/${e} (${h.V()})`);try{yield Rj(a,
|
|
757
|
+
h,f),yield Wj(a.C,h)}catch(k){throw Tj(a,f,k);}d+=1;b.next([e,d])}}a.L=null}))().then(()=>{a.T=!1;b.complete()}).catch(c=>{b.error(c.message)}).finally(()=>{Ij(a).finally(()=>{a.T=!1})});return b.asObservable()}
|
|
758
|
+
function Xj(){const a=olympe.dc.sources.Qd();return x(function*(){var b=new Set;const c={files:[],patches:[],version:a.version};var d=Kj(a.G);for(const e of d)b.has(e.tag())||(d=yield Sj(a.C,e.tag()),c.files.push({t:e.tag(),m:d.C,c:a.za.C(d.content)}),b.add(e.tag()));b=yield Yj(a.C);c.patches.push(...b);return JSON.stringify(c)})}
|
|
759
|
+
function Zj(a){const b=olympe.dc.sources.Qd();return x(function*(){let c;try{c=JSON.parse(a)}catch(e){throw Error('Invalid pending changes, must be a JSON string');}var d=c.files;if(!Array.isArray(c.patches)||!Array.isArray(d))throw Error('Invalid pending changes, must contain a `patches` array and a `files` array');for(const e of c.files)d=b.za.G(e.c),yield Mj(b.C,e.t,d,e.m);yield ak(b.C,c.patches);yield Ij(b);b.Ja.Hc(b.G)})}
|
|
760
|
+
function bk(){const a=olympe.dc.sources.Qd();return x(function*(){yield ck(a.C);yield Ij(a)})}
|
|
761
|
+
olympe.dc.sources.cache.Cache=class{constructor(a,b,c,d,e,f,g,h,k,l){this.H=a;this.Xb=b;this.C=c;this.Ja=d;this.Kc=e;this.ob=f;this.jb=g;this.za=h;this.version=l;this.ba=this.version!==this.jb.get('__code-as-data-version__');this.Kb=this.tb=!1;this.F=new Map;this.O=new rxjs.BehaviorSubject([]);this.L=null;this.fa=new rxjs.BehaviorSubject(!1);this.G=new olympe.dc.db.Sc;this.Tb=this.ac=!1;this.oa=[];this.Z=0;this.Od=new rxjs.BehaviorSubject(!1);this.status=new rxjs.BehaviorSubject({processing:!1});
|
|
762
|
+
this.T=!1;this.hc=new rxjs.Subject;this.pd=new olympe.Y.promise.Du(k)}yc(){return this.status.asObservable()}init(){const a=this;return x(function*(){if(!a.ac)if(a.Tb)yield new Promise(b=>{a.oa.push(b)});else{a.Tb=!0;(yield dk(a.C)).forEach(b=>{a.F.set(b.name,new Set(b.C))});a.O.next(Bj(a));yield Ij(a);a.Ja.Hc(a.G);for(const b of a.oa)b();a.ac=!0;a.oa=[]}})}executeQuery(a){const b=this;return x(function*(){yield b.init();return Nj(b,a.V())&&Vg(a).some(c=>c instanceof olympe.dc.query.va.Xd)?ek(b.C,
|
|
763
|
+
a):b.C.executeQuery(a)})}applyTransaction(a,b){const c=this;return x(function*(){c.H.debug('Cache: apply transaction',a,b);yield c.init();const d=a.Wb(),e=Array.from(d.zb.keys());let f,g;const h=Array.from(null!=(g=null==(f=c.L)?void 0:f.C.zb.keys())?g:[]);let k;b!==(null==(k=c.L)?void 0:k.F)||e.some(l=>!h.includes(l))?(yield fk(c.C,d,b),c.L=new olympe.dc.sources.cache.js(d,b),c.fa.next(!0)):(d.qd(c.L.C),yield fk(c.C,c.L.C,b));d.qd(c.G);yield Ej(c.C,d,'local-transaction')})}uploadFileContent(a,b,
|
|
764
|
+
c){const d=this;return x(function*(){yield d.init();yield Mj(d.C,a,b,c);return`offline://${a}`})}downloadFileContent(a){const b=this;return x(function*(){yield b.init();return Sj(b.C,a).then(c=>c.content)})}deleteFileContent(a){const b=this;return x(function*(){yield b.init();yield gk(b.C,[a])})}};olympe.dc.sources.cache.js=class{constructor(a,b){this.C=a;this.F=b}};olympe.dc.sources.cache.Cache.F='__code-as-data-version__';olympe.dc.sources.cache.Cache.C='__code-as-data__';function dk(a){return x(function*(){return(yield a.db.G('buckets')).map(b=>olympe.dc.sources.cache.Fp.Ub(b))})}function Jj(a){return x(function*(){return(yield a.db.G('pending-transactions')).map(b=>{b=olympe.dc.sources.cache.hh.Ub(b);return a.C.F(b.C)})})}function Cj(a,b,c){return x(function*(){a.H.debug(`Offline DB: Adding query ${b} in bucket ${c}`);return a.db.F()})}function Dj(a){return x(function*(){return a.db.F()})}
|
|
765
|
+
function Ej(a,b,c){a.H.debug(`Offline DB: Apply patch ${b.V()} on local offline db`);Array.from(b.zb.keys());return a.db.F().then(()=>{null===c&&(b.zb.forEach((d,e)=>a.G.add(e)),a.L().then(()=>{}))})}function Lj(a,b){return new Promise((c,d)=>{null!==a.files?c(a.files.has(b)):a.F.push(e=>{let f;return e?d(e):c(!(null==(f=a.files)||!f.has(b)))})})}
|
|
766
|
+
function Mj(a,b,c,d){c=new olympe.dc.sources.cache.Hl(b,c,d);a.files.add(b);return a.db.set('files',c.toJSON()).then(()=>{}).catch(e=>{a.files.delete(b);throw e;})}function Pj(a,b){return x(function*(){return a.db.remove('buckets',b).then(()=>{})})}function Vj(a){return x(function*(){return(yield a.db.G('pending-transactions')).reduce((b,c)=>{c=olympe.dc.sources.cache.hh.Ub(c);const d=c.F;let e;const f=null!=(e=b.get(d))?e:[];f.push(a.C.F(c.C));b.set(d,f);return b},new Map)})}
|
|
767
|
+
function Wj(a,b){return x(function*(){return a.db.remove('pending-transactions',b.V()).then(()=>{})})}function Sj(a,b){return x(function*(){const c=yield a.db.get('files',b);if(!c)throw Error(`File ${b} not found in offline cache database`);return olympe.dc.sources.cache.Hl.Ub(c)})}function Yj(a){return x(function*(){return a.db.G('pending-transactions')})}
|
|
768
|
+
function ak(a,b){return x(function*(){const c=new Map;for(const d of b){const e=olympe.dc.sources.cache.hh.Ub(d);e&&c.set(e.C.i,d)}yield a.db.fa()})}function ck(a){return x(function*(){return a.db.clear('pending-transactions').then(()=>{})})}
|
|
769
|
+
function ek(a,b){return x(function*(){const c=b.yb();a.H.debug(`Offline DB: Executing query ${b.V()} by ID with source ${c}`);const d=olympe.dc.query.ld.Fi(b);var e=(yield a.db.L(b.V())).map(f=>olympe.dc.sources.cache.lg.Ub(f));for(const f of e){if(f.source!==c)continue;e=olympe.dc.sources.cache.yj.cc(f);const g=hk(a,f.yd);d.create(f.tag,e,g);for(const h of f.mb)if(e=h.match(/^([a-z0-9]*)(<|>)([a-z0-9]*)$/)){const [,k,l,n]=e;e='<'===l;k===olympe.dc.qc.$c&&!0===e||d.Ea(k,e?n:f.tag,e?f.tag:n)}}a.H.C()&&
|
|
770
|
+
a.H.debug(`Offline DB: Data result for query ${b.V()}`,d.Wb().zb.size,'instances',Array.from(d.Wb().td()).length,'relations');return d})}function fk(a,b,c){b=a.C.ha(b);a.H.debug(`save transaction in destination '${c}'`,JSON.stringify(b));return a.db.set('pending-transactions',(new olympe.dc.sources.cache.hh(c,b,Date.now())).toJSON())}function ik(a){return x(function*(){return a.db.O('pending-transactions')})}function gk(a,b){return x(function*(){b.forEach(c=>a.files.delete(c));yield a.db.ba()})}
|
|
770
771
|
function hk(a,b){return Object.entries(b).reduce((c,[d,e])=>c.set(d,a.C.F(e)),new Map)}
|
|
771
|
-
olympe.dc.sources.cache.
|
|
772
|
-
var f=Date.now();yield e.db.F().then(()=>{});e.H.debug(`Offline DB GC: has taken ${Date.now()-f}ms to run`)}})},5E3)}static
|
|
773
|
-
if(!g)return d;f=new Map;const h=new Set([g.tag]);d.create(g.tag,olympe.dc.sources.cache.
|
|
774
|
-
Promise.resolve([]);r.X();return b.db.
|
|
775
|
-
olympe.dc.query.va.
|
|
776
|
-
olympe.dc.sources.cache.
|
|
777
|
-
olympe.dc.sources.cache.
|
|
772
|
+
olympe.dc.sources.cache.yj=class{constructor(a,b,c,d){this.O=`Olympe_Cache_${a}`;this.H=b;this.C=c;this.db=d.F(this.O);this.G=new Set;this.F=[];this.files=null;this.db.T('files').then(e=>{this.files=new Set(e);this.F.forEach(f=>f(null))}).catch(e=>{this.F.forEach(f=>f(e))});this.L=olympe.Y.Promise.bk(()=>{const e=this;return x(function*(){if(!(0===e.G.size||0<(yield ik(e))))if(0<e.db.Z())e.L().then(()=>{}),e.H.debug('Offline DB GC: Postponing round while the stack is busy');else{e.H.debug(`Offline DB GC: Round with ${e.G.size} candidates`);
|
|
773
|
+
var f=Date.now();yield e.db.F().then(()=>{});e.H.debug(`Offline DB GC: has taken ${Date.now()-f}ms to run`)}})},5E3)}static cc(a){const b=new RegExp(`^(${olympe.dc.qc.$c})>([a-z0-9]*)$`);for(const c of a.mb)if(a=c.match(b))return a[2];return null}executeQuery(a){const b=this;return x(function*(){const c=Date.now();b.H.debug(`Offline DB: Executing query ${a.V()} with source ${a.yb()}`);const d=olympe.dc.query.ld.Fi(a),e=a.yb();var f=yield b.db.get('instances',a.F),g=olympe.dc.sources.cache.lg.Ub(f);
|
|
774
|
+
if(!g)return d;f=new Map;const h=new Set([g.tag]);d.create(g.tag,olympe.dc.sources.cache.yj.cc(g),hk(b,g.yd));for(const p of Vg(a))if(p instanceof olympe.dc.query.va.lh){var k=p.relation;g=k.Ga()===olympe.dc.ua.ORIGIN;const q=k.X(),r=k.Vb();k=new Set;f.set(p.V(),k);const t=[f.has(p.C)?new Set(f.get(p.C)):new Set([a.F])];for(const u of t){const w=new Map;var l=yield Promise.all(Array.from(u).map(y=>{if(!h.has(y))return b.H.warn(`Offline DB: Instance ${y} not found while processing query part, this should not happen`),
|
|
775
|
+
Promise.resolve([]);r.X();return b.db.L().then(z=>z.map(A=>olympe.dc.sources.cache.lg.Ub(A))).then(z=>{w.set(y,z)})})).then(()=>w);for(const [y,z]of l){p instanceof olympe.dc.query.va.Kf&&p.G&&k.add(y);for(const A of z)if(l=A.tag,A.source===e){if(p instanceof olympe.dc.query.va.Kf&&!k.has(l)){var n=t[t.length-1];n||(n=new Set,t.push(n));n.add(l)}k.add(l);h.has(l)||(h.add(l),n=olympe.dc.sources.cache.yj.cc(A),d.create(l,n,hk(b,A.yd)));q===olympe.dc.qc.$c&&!0===g||d.Ea(q,g?l:y,g?y:l)}}}}else p instanceof
|
|
776
|
+
olympe.dc.query.va.Xd&&b.H.warn(`Offline DB: Trying to execute a query ${a.V()} on the Cache DB that contains a FollowRule part. This is not supported and designed not to happen.`);b.H.C()&&(b.H.debug(`Offline DB: Data result for query ${a.V()}`,d.Wb().zb.size,'instances',Array.from(d.Wb().td()).length,'relations'),b.H.debug(`Offline DB: Data result for query ${a.V()} took ${Date.now()-c}ms to be executed`));return d})}};
|
|
777
|
+
olympe.dc.sources.cache.Fp=class{constructor(a,b){this.name=a;this.C=b}static Ub(a){return a?new olympe.dc.sources.cache.Fp(a.name,a.queryIds):null}toJSON(){return{name:this.name,queryIds:this.C}}};
|
|
778
|
+
olympe.dc.sources.cache.lg=class{constructor(a,b,c,d,e){this.tag=a;this.source=b;this.yd=null!=c?c:{};this.mb=null!=d?d:[];this.C=null!=e?e:[]}static Ub(a){return a?new olympe.dc.sources.cache.lg(a.tag,a.source,a.props,a.relations,a.queryIds):null}toJSON(){return{tag:this.tag,source:this.source,props:this.yd,relations:this.mb,queryIds:this.C}}};
|
|
778
779
|
olympe.dc.sources.cache.hh=class{constructor(a,b,c){this.F=a;this.C=b;this.timestamp=c}static Ub(a){return a?new olympe.dc.sources.cache.hh(a.destination,a.patch,a.timestamp):null}toJSON(){return{destination:this.F,patch:this.C,timestamp:this.timestamp}}};
|
|
779
|
-
olympe.dc.sources.cache.
|
|
780
|
-
olympe.dc.sources.cache.
|
|
781
|
-
olympe.dc.sources.cache.
|
|
782
|
-
e.push(this.G);let g;b=new olympe.dc.sources.cache.
|
|
783
|
-
d=null!=(f=this.C.get(c))?f:new olympe.dc.sources.cache.
|
|
784
|
-
f.
|
|
785
|
-
b,!1);this.
|
|
786
|
-
c)=>{this.O((d,e)=>{for(const f of this.Z)f.unsubscribe();d?b():c(e)})})}update(b,c,d){const e=olympe.dc.ga(b),f=olympe.dc.ga(c);void 0===e||void 0===f?olympe.dc.Eh().ab().error('Burst transaction: instance tag or property tag is undefined'):(this.F.run(()=>{olympe.D.
|
|
787
|
-
this.oa.length=0}getContext(){return this.F}V(){return this.id}Pg(){return!1}O(b){if(this.T){this.T=!1;null!==this.C&&(clearTimeout(this.C),this.C=null);this.
|
|
788
|
-
e]of Object.entries(b)){b=d;let f=typeof e;20<b.length&&b.startsWith('fd')&&(b=olympe.dc.
|
|
789
|
-
case '6':c.set(b,new Date(Date.UTC(e.y||1970,e.M&&e.M-1||0,e.d||1,e.h,e.m,e.s,e.S)));break;case '7':c.set(b,new olympe.D.Color(e.r,e.g,e.b,e.a));break;case '8':c.set(b,new olympe.dc.Bc(e.t));break;case 'untyped':null===e&&c.set(b,null)}}return c}};function mk(a,b){let c;return null!=(c=a.sources.get(b))?c:a.
|
|
780
|
+
olympe.dc.sources.cache.Ut=class extends olympe.dc.sources.cache.hh{constructor(a,b,c,d){super(a,b,c);this.error=d}static Ub(a){return a?new olympe.dc.sources.cache.Ut(a.destination,a.patch,a.timestamp,a.error):null}toJSON(){return{destination:this.F,patch:this.C,timestamp:this.timestamp,error:this.error}}};
|
|
781
|
+
olympe.dc.sources.cache.Hl=class{constructor(a,b,c){this.tag=a;this.content=b;this.C=c}static Ub(a){return a?new olympe.dc.sources.cache.Hl(a.tag,a.content,a.mimetype):null}toJSON(){return{tag:this.tag,content:this.content,mimetype:this.C}}};function jk(a,b){let c=a.O.get(b);c||(c=new Set(a.C.get(b).mb),a.O.set(b,c));return c}
|
|
782
|
+
olympe.dc.sources.cache.Ns=class{constructor(a,b,c){this.H=a;this.G=c;this.C=new Map;this.T=new Set;this.Z=new Set;this.L=b;this.O=new Map}Id(){this.T.forEach(a=>this.C.delete(a));Array.from(this.C.entries()).forEach(([a,b])=>{b||this.C.delete(a)});return this.C}Nc(a,b,c){const d=this.C.get(a);d||this.Z.add(a);var e;c=Array.from(null!=c?c:[]).reduce((h,k)=>{h[k[0]]=this.L.ha(k[1]);return h},null!=(e=null==d?void 0:d.yd)?e:{});let f;e=null!=(f=null==d?void 0:d.C)?f:[];null===this.G||e.includes(this.G)||
|
|
783
|
+
e.push(this.G);let g;b=new olympe.dc.sources.cache.lg(a,b,c,null!=(g=null==d?void 0:d.mb)?g:[],e);this.C.set(a,b)}Xc(a,b){const c=this.C.get(a);if(c){var d;c.yd=Array.from(b).reduce((e,[f,g])=>{null===g?delete e[f]:e[f]=this.L.ha(g);return e},null!=(d=c.yd)?d:{})}else this.H.warn(`Trying to update an instance (${a}) which do not exists in the cache database: ignoring.`)}F(a){this.T.add(a)}Ea(a,b,c){var d;const e=null!=(d=this.C.get(b))?d:new olympe.dc.sources.cache.lg(b,'unknown',{},[],[]);var f;
|
|
784
|
+
d=null!=(f=this.C.get(c))?f:new olympe.dc.sources.cache.lg(c,'unknown',{},[],[]);b=`${a}${olympe.dc.ua.ORIGIN}${b}`;f=(g,h)=>{this.C.set(g.tag,g);const k=jk(this,g.tag);k.has(h)||(g.mb.push(h),k.add(h));null===this.G||g.C.includes(this.G)||g.C.push(this.G)};f(e,`${a}${olympe.dc.ua.DESTINATION}${c}`);f(d,b)}ic(a,b,c){const d=this.C.get(b),e=this.C.get(c);c=`${a}${olympe.dc.ua.DESTINATION}${c}`;a=`${a}${olympe.dc.ua.ORIGIN}${b}`;b=(f,g)=>{const h=jk(this,f.tag);if(h.has(g)){const k=f.mb.indexOf(g);
|
|
785
|
+
f.mb.splice(k,1);h.delete(g)}};d&&b(d,c);e&&b(e,a)}};olympe.dc.sources.cache.Ns.xa=[olympe.dc.Writable];olympe.dc.transaction={};olympe.dc.Qh=class a{constructor(b,c){this.id=null!=b?b:olympe.Y.Fc();this.F=new olympe.D.Yb('BurstTransaction#'+this.id,c);this.tb=kk(this);this.T=!1;this.F.onDestroy(()=>this.O());this.Z=new Set;this.G=new Map;this.L=new Set;this.C=null;let d;this.jb=null!=(d=olympe.W.getParameter(olympe.dc.transaction.U.wn))?d:30;this.oa=[]}static C(b,c){return`${b},${c}`}Kb(b){for(const c of this.oa)c(b);this.stop()}Ja(){null!==this.C&&(clearTimeout(this.C),this.C=null);const b=this.fa(this.L);0<b.size&&lk(this,
|
|
786
|
+
b,!1);this.L.clear()}fa(b){const c=new Map;b.forEach(d=>{const e=d.split(',');let f=c.get(e[0]);void 0===f&&(f=new Map,c.set(e[0],f));f.set(e[1],this.G.get(d))});return c}ba(b,c,d){this.za(b,c,d);this.tb(b,c,d);null===this.C&&(this.C=setTimeout(this.Ja.bind(this),this.jb))}za(b,c,d){b=a.C(b,c);this.G.set(b,d);this.L.add(b)}ob(b,c){return this.G.get(a.C(b,c))}push(b,c){const d=olympe.dc.ga(b);b=c.subscribe(e=>{for(const [f,g]of e)e=olympe.dc.ga(f),this.ob(d,e)!==g&&this.ba(d,e,g.valueOf())});this.Z.add(b)}complete(){return new Promise((b,
|
|
787
|
+
c)=>{this.O((d,e)=>{for(const f of this.Z)f.unsubscribe();d?b():c(e)})})}update(b,c,d){const e=olympe.dc.ga(b),f=olympe.dc.ga(c);void 0===e||void 0===f?olympe.dc.Eh().ab().error('Burst transaction: instance tag or property tag is undefined'):(this.F.run(()=>{olympe.D.Vm([d],g=>{this.T=!0;if(g instanceof olympe.dc.Bc)olympe.dc.Eh().ab().error('Cannot send complex property values in burst transactions');else{var h;this.ba(e,f,null!=(h=null==g?void 0:g.valueOf())?h:null)}})}),this.F.Z(()=>{this.O()}))}stop(){this.F.destroy();
|
|
788
|
+
this.oa.length=0}getContext(){return this.F}V(){return this.id}Pg(){return!1}O(b){if(this.T){this.T=!1;null!==this.C&&(clearTimeout(this.C),this.C=null);this.L.clear();const c=this.fa(new Set(this.G.keys()));lk(this,c,!0,b)}else null==b||b(!0)}toString(){return'Burst transaction #'+this.id}};olympe.dc.Qh.prototype.complete=olympe.dc.Qh.prototype.complete;olympe.dc.Qh.prototype.push=olympe.dc.Qh.prototype.push;olympe.dc.Hp=class{C(){}toString(){}};olympe.dc.transaction.Aj=class a{constructor(b){this.F=null!=b?b:olympe.dc.Pa.SERVER}C(b,c){c=new olympe.dc.db.Sc(c);this.G(b,c);return c}G(b,c){for(const d of b)switch(d.o){case 1:b=a.C(d.p||{});let e;c.Nc(d.t,null!=(e=d.s)?e:this.F,b,d.m);break;case 2:c.Xc(d.t,a.C(d.p),d.m);break;case 3:c.F(d.t,d.f,d.m);break;case 4:c.Ea(d.m,d.l,d.r,d.lm,d.rm);break;case 5:c.ic(d.m,d.l,d.r,d.lm,d.rm);break;case 6:break;default:throw Error('Undefined patch operation: '+d.o);}}static C(b){const c=new Map;for(const [d,
|
|
789
|
+
e]of Object.entries(b)){b=d;let f=typeof e;20<b.length&&b.startsWith('fd')&&(b=olympe.dc.pj.Ee+b.substring(2));'object'===f&&(f=e&&e.c?String(e.c):'untyped');switch(f){case '1':case '2':case '3':throw Error('Complex format for primitive types not supported.');case 'string':c.set(b,String(e));break;case 'boolean':c.set(b,!!e);break;case 'number':c.set(b,Number(e));break;case '4':c.set(b,new Date(Date.UTC(e.y,e.M-1,e.d,e.h,e.m,e.s,e.S)));break;case '5':c.set(b,new Date(Date.UTC(e.y,e.M-1,e.d)));break;
|
|
790
|
+
case '6':c.set(b,new Date(Date.UTC(e.y||1970,e.M&&e.M-1||0,e.d||1,e.h,e.m,e.s,e.S)));break;case '7':c.set(b,new olympe.D.Color(e.r,e.g,e.b,e.a));break;case '8':c.set(b,new olympe.dc.Bc(e.t));break;case 'untyped':null===e&&c.set(b,null)}}return c}};function mk(a,b){let c;return null!=(c=a.sources.get(b))?c:a.L.we(b)}function nk(a,b){let c,d,e;return null!=(e=null!=(d=null==(c=a.C.Hd(b))?void 0:c.Ec())?d:a.db.model(b))?e:null}function ok(a,b){let c;return null!=(c=a.G.get(b))?c:a.db.Vf(b)||!a.db.Fa(b)}function pk(a,b){0===a.G.size?a.G=b:b.forEach((c,d)=>a.G.set(d,c))}function qk(a){return Array.from(a.C.Id()).filter(b=>!b.Td()).map(b=>b.tag())}
|
|
790
791
|
function rk(a,b,c,d){d(a.C);c&&b!==olympe.dc.Pa.SELF&&(c=a.F.get(b),c||(c=new olympe.dc.db.Sc(a.id),a.F.set(b,c)),d(c))}function sk(a,b,c){const d=mk(a,b),e=ok(a,b),f=nk(a,b);rk(a,d,e,g=>{g.F(b,c,f)})}
|
|
791
|
-
olympe.dc.transaction.
|
|
792
|
-
e=mk(this,c);var f=ok(this,b)&&ok(this,c)&&d!==olympe.dc.Pa.SELF&&e!==olympe.dc.Pa.SELF;f&&d!==e&&a!==olympe.dc.qc
|
|
793
|
-
b)&&ok(this,c)&&d!==olympe.dc.Pa.SELF&&e!==olympe.dc.Pa.SELF;f&&d!==e&&a!==olympe.dc.qc
|
|
794
|
-
class vk{constructor(){this.O=new Map}T(a){return a instanceof olympe.D.Na||a instanceof olympe.D.ea||a instanceof olympe.D.aa?a.valueOf():a instanceof Date||a instanceof olympe.D.
|
|
795
|
-
typeof a.X?{c:8,t:a.X()}:a}}function
|
|
796
|
-
olympe.dc.transaction.
|
|
797
|
-
b,c=null){b=tk(this.Z,b||null,!1);a={o:2,t:a,p:b};this.
|
|
798
|
-
if(!b)throw Error('Cannot delete relation with undefined origin');if(!c)throw Error('Cannot delete relation with undefined destination');a={o:5,m:a,l:b,r:c};this.
|
|
792
|
+
olympe.dc.transaction.bu=class{constructor(a,b,c){this.id=null!=c?c:olympe.Y.Fc();this.L=b;this.db=a;this.F=new Map;this.C=new olympe.dc.db.Sc(this.id);this.sources=new Map;this.G=new Map}Fh(){return 0===this.C.zb.size}Nc(a,b,c,d){let e;const f=null!=(e=null!=c?c:this.sources.get(a))?e:this.L.fromModel(b);c=ok(this,a);this.sources.set(a,f);rk(this,f,c,g=>{g.Nc(a,f,d,b)})}Xc(a,b){const c=mk(this,a),d=ok(this,a),e=nk(this,a);rk(this,c,d,f=>{f.Xc(a,null!=b?b:new Map,e)})}Ea(a,b,c){const d=mk(this,b),
|
|
793
|
+
e=mk(this,c);var f=ok(this,b)&&ok(this,c)&&d!==olympe.dc.Pa.SELF&&e!==olympe.dc.Pa.SELF;f&&d!==e&&a!==olympe.dc.qc.$c&&(f=g=>{let h;return null!=(h=olympe.dc.ia().name(g))?h:g},olympe.ma.ab('dc').warn(`Try to create a relation between 2 objects that have different locations: \n ${f(b)} (${b})-[${f(a)} (${a})]->${f(c)} (${c}), originSrc: ${f(d)} (${d}), destinationSrc: ${f(e)} (${e})`),f=!1);rk(this,d,f,g=>{g.Ea(a,b,c,nk(this,b),nk(this,c))})}ic(a,b,c){const d=mk(this,b),e=mk(this,c);let f=ok(this,
|
|
794
|
+
b)&&ok(this,c)&&d!==olympe.dc.Pa.SELF&&e!==olympe.dc.Pa.SELF;f&&d!==e&&a!==olympe.dc.qc.$c&&(olympe.ma.ab('dc').warn(`Try to delete a relation between 2 objects that have different locations: ${b}-[${a}]->${c}`),f=!1);rk(this,d,f,g=>{g.ic(a,b,c,nk(this,b),nk(this,c))})}};function tk(a,b,c){const d=Object.create(null);if(!b)return d;for(const f of Array.from(b.keys()).sort()){let g=f;var e=b.get(f);if(g===olympe.dc.ap.tq)if(e===olympe.dc.Pa.SELF)d[g]=olympe.dc.ia().V();else{if(e===olympe.dc.Pa.SERVER)continue}else g.startsWith(olympe.dc.pj.Ee)&&(g='fd'+g.substring(1));e=a.T(e);c&&e instanceof Object&&8===e.c?a.O.set(g,e):d[g]=e}return d}function uk(a){if(0===a.O.size)return null;const b=Object.create(null);a.O.forEach((c,d)=>{b[d]=c});a.O.clear();return b}
|
|
795
|
+
class vk{constructor(){this.O=new Map}T(a){return a instanceof olympe.D.Na||a instanceof olympe.D.ea||a instanceof olympe.D.aa?a.valueOf():a instanceof Date||a instanceof olympe.D.gb?(a=a instanceof olympe.D.gb?a.valueOf():a,{c:4,y:a.getUTCFullYear(),M:a.getUTCMonth()+1,d:a.getUTCDate(),h:a.getUTCHours(),m:a.getUTCMinutes(),s:a.getUTCSeconds(),S:a.getUTCMilliseconds(),z:0}):a instanceof olympe.D.Color?{c:7,r:a.Kg().valueOf(),g:a.Hg().valueOf(),b:a.Dg().valueOf(),a:a.Cg().valueOf()}:a&&'function'===
|
|
796
|
+
typeof a.X?{c:8,t:a.X()}:a}}function Rg(a){const b=a.L.concat(a.G).concat(a.O).concat(a.C).concat(a.T);a.O=[];a.G=[];a.C=[];a.T=[];a.L=[];return b}
|
|
797
|
+
olympe.dc.transaction.mg=class{constructor({xk:a=!1,vh:b=!0,be:c=!0}={}){this.O=[];this.G=[];this.C=[];this.T=[];this.L=[];this.xk=null!=a?a:!1;this.be=null!=c?c:!0;this.vh=null!=b?b:!0;this.Z=olympe.D?new vk:new class extends vk{T(d){return d&&'function'===typeof d.X?{c:8,t:d.X()}:d}}}flush(){return JSON.stringify(Rg(this))}Nc(a,b,c,d=null){c=tk(this.Z,null!=c?c:null,this.xk);c={o:1,t:a,p:c};this.vh&&(c.s=b);this.be&&d&&(c.m=d);this.O.push(c);this.xk&&(b=uk(this.Z))&&this.C.push({o:2,t:a,p:b})}Xc(a,
|
|
798
|
+
b,c=null){b=tk(this.Z,b||null,!1);a={o:2,t:a,p:b};this.be&&c&&(a.m=c);this.C.push(a)}F(a,b,c=null){a={o:3,t:a,f:b};this.be&&c&&(a.m=c);this.G.push(a)}Ea(a,b,c,d=null,e=null){if(!a)throw Error('Cannot create relation of undefined type');if(!b)throw Error(`Cannot create relation ${a} from undefined origin to ${c}`);if(!c)throw Error(`Cannot create relation ${a} from ${b} to undefined destination`);a={o:4,m:a,l:b,r:c};this.be&&d&&(a.lm=d);this.be&&e&&(a.rm=e);this.T.push(a)}ic(a,b,c,d=null,e=null){if(!a)throw Error('Cannot delete relation of undefined type');
|
|
799
|
+
if(!b)throw Error('Cannot delete relation with undefined origin');if(!c)throw Error('Cannot delete relation with undefined destination');a={o:5,m:a,l:b,r:c};this.be&&d&&(a.lm=d);this.be&&e&&(a.rm=e);this.L.push(a)}};olympe.dc.transaction.mg.xa=[olympe.dc.Writable];function wk(a,b){b instanceof olympe.dc.Wa&&b.F.forEach((c,d)=>a.F.set(d,c));a.Ya.push(b);return b}function xk(a,b,c,d){c=a.create(null!=c?c:olympe.dc.CloudObject,void 0);if('string'===typeof b)b=b||'',Z(c,olympe.dc.CloudObject.nameProp.X(),b);else for(const [f,g]of Object.entries(b))Z(c,f,g);b=c.X();d=null!=d?d:olympe.dc.CloudObject;const e=olympe.dc.CloudObject.extendRel.X();wk(a,new olympe.dc.transaction.Ya.ko(e,b));wk(a,new olympe.dc.transaction.Ya.Uk(e,b,d));return c}
|
|
799
800
|
function yk(a){return 0<a.length?(b,c)=>{a.forEach(d=>null==d?void 0:d(b,c))}:void 0}
|
|
800
|
-
olympe.dc.Wa=class{constructor(a){this.id=null!=a?a:olympe.Y.Fc();this.Ya=[];this.
|
|
801
|
-
olympe.dc.
|
|
802
|
-
}return this}delete(a,b=olympe.dc.
|
|
803
|
-
a,d);this.Ea(olympe.dm.Property.typeRel,d,b);this.Ea(olympe.dc.CloudObject.containsRel,a,d);return d}
|
|
804
|
-
f),olympe.dm.Relation.fa,g),olympe.dm.Relation.T,h);this.Ea(olympe.dc.CloudObject.
|
|
805
|
-
this.G=!0;a=yk([this.Z.bind(this),...this.O,a].filter(b=>'function'===typeof b));Ak(olympe.dc.Eh(),this,a,!0)}Z(a){a||(this.G=!1)}toString(){return`Transaction #${this.id}`}};olympe.dc.Wa.
|
|
806
|
-
function lk(a,b,c,d){var e=olympe.dc.Eh();const f=olympe.dc.Request.C.
|
|
807
|
-
function zk(a,b,c){var d=olympe.dc.Eh();if(c&&'function'===typeof b){const e=a.V();d.C.set(e,b);Ak(d,a,(f,g)=>{f||(d.C.delete(e),b(f,g))},!1)}else Ak(d,a,b,!1)}function Bk(a){const b=olympe.dc.Request.C.
|
|
808
|
-
function Ak(a,b,c,d=!1){c=c?olympe.D.Xa().G(c):void 0;const e=b.V(),f=new olympe.dc.transaction.
|
|
801
|
+
olympe.dc.Wa=class{constructor(a){this.id=null!=a?a:olympe.Y.Fc();this.Ya=[];this.L=new Map;this.T=!0;this.F=new Map;this.O=[];this.G=!1}V(){return this.id}model(a){let b;return null!=(b=this.L.get(olympe.dc.ga(a)))?b:olympe.dc.ia().model(a)}C(a){pk(a,this.F);for(const b of this.Ya)b.C(a)}create(a,b){b=wk(this,new olympe.dc.transaction.Ya.Yn(a,b));const c=b.X();this.L.set(c,olympe.dc.ga(a));let d;this.persist(c,null!=(d=this.F.get(c))?d:this.T);return b}persist(a,b=!0){const c=olympe.dc.ga(a);var d=
|
|
802
|
+
olympe.dc.ia();this.F.set(c,b);if(b){let f;b=null!=(f=this.L.get(c))?f:d.model(c);if(null===b)throw Error(`Try to persist an instance that does not exist: ${c}`);var e;d=null!=(e=d.source(a))?e:olympe.dc.Sd().fromModel(b);wk(this,new olympe.dc.transaction.Ya.cu(c,d))}else{if((e=d.Fa(c))&&d.Vf(c))throw Error(`Try to remove persistence of an instance already persisted: ${c}`);if(!e&&!this.L.has(c))throw Error(`Try to remove persistence of an instance that does not exist and is not part of the transaction: ${c}`);
|
|
803
|
+
}return this}delete(a,b=olympe.dc.ec.zc){wk(this,new olympe.dc.transaction.Ya.lo(a,b))}update(a,b,c){return wk(this,new olympe.dc.transaction.Ya.Wu(a,b,c))}Ea(a,b,c){wk(this,new olympe.dc.transaction.Ya.Uk(a,b,c))}ic(a,b,c){wk(this,new olympe.dc.transaction.Ya.ws(a,b,c))}wm(a,b){wk(this,new olympe.dc.transaction.Ya.ko(a,b))}defineProperty(a,b,c,d,e,f){d=this.create(olympe.dm.Property,f);Z(d,olympe.dc.CloudObject.nameProp,c||'');void 0!==e&&this.update(a,olympe.dc.pj.Ee+d.X(),e);this.Ea(olympe.dc.CloudObject.propertyRel,
|
|
804
|
+
a,d);this.Ea(olympe.dm.Property.typeRel,d,b);this.Ea(olympe.dc.CloudObject.containsRel,a,d);return d}cr(a,b,c='',{nC:d=olympe.dm.Relation.L.Qt,zC:e=olympe.dm.Relation.C.Wp,uC:f=olympe.dm.Relation.C.Ur,$C:g=olympe.dm.Relation.C.Os,kC:h=olympe.dm.Dk.NONE,ZC:k=olympe.dm.Relation.O|h}={},l=olympe.Y.Fc()){c=Z(Z(Z(Z(Z(Z(Z(Z(this.create(olympe.dm.Relation,l),olympe.dc.CloudObject.nameProp,c||''),olympe.dm.Relation.F,d),olympe.dm.Relation.G,k),olympe.dm.Relation.ba,e),olympe.dm.Relation.oa,e),olympe.dm.Relation.Z,
|
|
805
|
+
f),olympe.dm.Relation.fa,g),olympe.dm.Relation.T,h);this.Ea(olympe.dc.CloudObject.Oi,a,c);this.Ea(olympe.dm.Relation.destinationModelRel,c,b);this.Ea(olympe.dc.CloudObject.containsRel,a,c);return c}Pg(){return!1}nm(a){this.O.push(olympe.D.Xa().G(a))}lb(a,b){if(this.G)throw Error('Operation not permitted: this transaction has already been executed');this.G=!0;a=yk([this.Z.bind(this),...this.O,a].filter(c=>'function'===typeof c));zk(this,a,b)}xm(a){if(this.G)throw Error('Operation not permitted: this transaction has already been executed');
|
|
806
|
+
this.G=!0;a=yk([this.Z.bind(this),...this.O,a].filter(b=>'function'===typeof b));Ak(olympe.dc.Eh(),this,a,!0)}Z(a){a||(this.G=!1)}toString(){return`Transaction #${this.id}`}};olympe.dc.Wa.xa=[olympe.dc.Hp];function kk(a){var b=olympe.dc.Eh();const c=a.V();b.L.set(c,a);a.getContext().onDestroy(()=>{b.L.delete(c)});return(d,e,f)=>{const g=new olympe.dc.db.Sc(c);g.Xc(d,(new Map).set(e,f),b.db.model(d));b.G.Hc(g)}}
|
|
807
|
+
function lk(a,b,c,d){var e=olympe.dc.Eh();const f=olympe.dc.Request.C.Ph,g=olympe.dc.Request.C.Tg,h=a.V();a=a.Pg();const k=new Map;for(const l of b.keys()){const n=e.db.source(l);if(n===olympe.dc.Pa.SELF||!e.db.Vf(l))continue;let p=k.get(n);p||(p=new olympe.dc.db.Sc(h),k.set(n,p));p.Xc(l,b.get(l),e.db.model(l))}for(const [l,n]of k)b=new olympe.dc.Request(c?g:f,l,new olympe.dc.transaction.vi(n,a)),b=e.Xb.request(b).catch(p=>null==d?void 0:d(!1,`${p}`)),c&&b.then(()=>null==d?void 0:d(!0))}
|
|
808
|
+
function zk(a,b,c){var d=olympe.dc.Eh();if(c&&'function'===typeof b){const e=a.V();d.C.set(e,b);Ak(d,a,(f,g)=>{f||(d.C.delete(e),b(f,g))},!1)}else Ak(d,a,b,!1)}function Bk(a){const b=olympe.dc.Request.C.lj;Pe(a.Xb,olympe.dc.Request.C.xn,c=>{var d=c.content;c=d.id;var e=d.rollback;d=d.error;const f=a.L.get(c);void 0!==f&&(a.L.delete(c),f.Kb(d));a.G.Hc(e);a.H.warn(`Fast update (id=${c}) has been refused and is rolled back. Error: ${d}`)});Pe(a.Xb,b,c=>{c=c.content;Ck(a,c.id,c.finalize,c.error)})}
|
|
809
|
+
function Ak(a,b,c,d=!1){c=c?olympe.D.Xa().G(c):void 0;const e=b.V(),f=new olympe.dc.transaction.bu(a.db,a.T,e);b.C(f);if(f.Fh()){null==c||c(!0);var g;null==(g=a.C.get(e))||g(!0);a.C.delete(e)}else{a.F.set(e,[]);var h=qk(f);a.G.C.jb(h);g=h.filter(l=>ok(f,l));var k=[Ff(a.G,f.C,g),c];Dk(a,f,g).then(l=>{k.splice(1,0,l);Ek(a,e,h,f.F.size+1);return Fk(a,f.F,d,b.Pg())}).then(()=>{k.forEach(l=>null==l?void 0:l(!0,null));Ck(a,e,olympe.dc.transaction.lf.C.ii,null)}).catch(l=>{a.H.error(l);k.forEach(n=>null==
|
|
809
810
|
n?void 0:n(!1,l));Gk(a,e)})}}
|
|
810
|
-
function Dk(a,b,c){const d=b.C,e=olympe.dm.File.urlProp.X();c=c.filter(n=>{let p;return a.db.
|
|
811
|
-
else{var u=n.X(),w,y=null!=(w=n.get(olympe.dm.File.mimeTypeProp))?w:'application/data';a.Z.Z(u,t,y,z=>{const A=h.reduce((C,M)=>C||M.Hd(u),null);null!==A&&(z=(new Map).set(e,z).set(f,!0).set(g,new Date),A.
|
|
812
|
-
new olympe.dc.db.Sc);return
|
|
813
|
-
function Fk(a,b,c,d){const e=c?olympe.dc.Request.C.
|
|
814
|
-
function Hk(a,b){if(0<a.F.size){const c=olympe.D.Xa();a.O.push(()=>{!c.
|
|
815
|
-
olympe.dc.transaction.
|
|
816
|
-
olympe.W.config(function(a){
|
|
817
|
-
olympe.dc.transaction.Ya.
|
|
818
|
-
if(!this.F)throw Error('OperationError: Cannot create relation, destination tag is undefined, null or empty string');this.relation.Ga()===olympe.dc.ua.DESTINATION?a.Ea(b,olympe.dc.ga(this.origin),olympe.dc.ga(this.F)):a.Ea(b,olympe.dc.ga(this.F),olympe.dc.ga(this.origin))}toString(){return`CreateRelation('${this.relation.Ga()}${this.relation.X()}, ${olympe.dc.ga(this.origin)}, ${olympe.dc.ga(this.F)})`}};olympe.dc.transaction.Ya.
|
|
819
|
-
a.ic(b,c,f):a.ic(b,f,c)}toString(){return`DeleteAllRelations(${this.Ga()}${this.getType()})`}};olympe.dc.transaction.Ya.
|
|
820
|
-
this.relation.Ga()===olympe.dc.ua.DESTINATION?a.ic(b,c,d):a.ic(b,d,c)}toString(){return'DeleteRelation('+this.relation.Ga()+this.relation.X()+', '+olympe.dc.ga(this.origin)+', '+olympe.dc.ga(this.F)+')'}};olympe.dc.transaction.Ya.
|
|
821
|
-
for(const [e,f]of c){var d=this.
|
|
822
|
-
k)&&(h===olympe.dc.ua.ORIGIN?b.Ea(g,k,this.tag):b.Ea(g,this.tag,k))}}toString(){return`PersistOperation: tag - ${this.tag}, src - ${this.source}`}};olympe.dc.ga=function(a){let b=null;if('string'===typeof a)return a;if('function'===typeof(null==a?void 0:a.X)&&(null==a||!a.
|
|
823
|
-
olympe.dc.defineProperty=function(a){return new olympe.dc.Ma.Property(a)};olympe.dc.
|
|
824
|
-
olympe.dc.
|
|
825
|
-
olympe.dc.
|
|
826
|
-
olympe.dc.
|
|
827
|
-
olympe.dc.
|
|
828
|
-
b,'] - Unregistered');const c=a.C.get(b);if(null==c)var d=0;else 0<c.counter&&c.counter--,d=0===c.counter;d&&(c.C.release(),a.C.delete(b));this.C=null})}return this}
|
|
829
|
-
this.
|
|
830
|
-
this.
|
|
831
|
-
if(c instanceof olympe.dc.Ma.Property)throw Error(`ListDef.transform(): Properties cannot be used as transformer, unlike relations ${c}`);if(!c||'function'!==typeof c.C)break;a.push(c)}b=new olympe.dc.
|
|
832
|
-
return a}toString(){let a=this.da;a=a?', '+(a.join?a.join(', '):a.toString()):'';return'ListDef(#'+olympe.D.
|
|
833
|
-
olympe.dc.
|
|
834
|
-
olympe.dc.
|
|
835
|
-
m.
|
|
836
|
-
m.xc.
|
|
837
|
-
olympe.dc.
|
|
838
|
-
'one of the argument is not a Transformer '+d);const e=d.
|
|
839
|
-
this.valueType=a.
|
|
840
|
-
a=new olympe.dc.$.
|
|
841
|
-
'Provided argument "models" must be an array.');const b=[];for(let c=0;c<a.length;c++)b.push(Ok(a[c]));return this.
|
|
842
|
-
const c=[],d=[];a.forEach(e=>{c.push(e);d.push(e.Ga())});return this.
|
|
843
|
-
1]instanceof olympe.dc.da.
|
|
844
|
-
c&&this.da.push(new olympe.dc.da.
|
|
845
|
-
function Ok(a){return'string'===typeof a||a instanceof olympe.D.Na?a:'function'===typeof a?olympe.dc.na.
|
|
846
|
-
m.
|
|
847
|
-
function Qk(a,b){if(b.T())a.H.debug('ListProcessor: [ID:',b.V(),'] - Subscription already booted, ignoring');else{a.H.debug('ListProcessor: [ID:',b.V(),'] - Booting subscription');var c=new olympe.dc.
|
|
848
|
-
function Tk(a,b,c,d){const
|
|
849
|
-
function Uk(a,b,c,d){a.H.debug('CoverageProcessor: [ID:',c,'] - checking coverage of remote query over',b.length,'paths.');const
|
|
850
|
-
function Rk(a,b,c){const d=new olympe.dc.
|
|
811
|
+
function Dk(a,b,c){const d=b.C,e=olympe.dm.File.urlProp.X();c=c.filter(n=>{let p;return a.db.jc(n,olympe.dm.File)&&void 0!==(null==(p=d.Hd(n))?void 0:p.Ka(e))}).map(olympe.dc.CloudObject.get);if(0===c.length)return Promise.resolve(null);const f=olympe.dm.File.C.X(),g=olympe.dm.File.modificationDateProp.X(),h=Array.from(b.F.values()),k=[],l=olympe.Y.Se();return Promise.all(c.map(n=>{const p=n.get(e);if(p.startsWith('blob:'))return new Promise((q,r)=>{l.F(p,t=>{if(null===t)URL.revokeObjectURL(p),q();
|
|
812
|
+
else{var u=n.X(),w,y=null!=(w=n.get(olympe.dm.File.mimeTypeProp))?w:'application/data';a.Z.Z(u,t,y,z=>{const A=h.reduce((C,M)=>C||M.Hd(u),null);null!==A&&(z=(new Map).set(e,z).set(f,!0).set(g,new Date),A.mm(z),k.push([u,z]));URL.revokeObjectURL(p);q()},r)}},r)});2048<p.length&&a.H.error('Trying to create a file with an URL longer than 2048. It likely is a data url and should be an object url. File tag:',n.X());return Promise.resolve([])})).then(()=>{const n=k.reduce((p,[q,r])=>{p.Xc(q,r);return p},
|
|
813
|
+
new olympe.dc.db.Sc);return Ff(a.G,n)})}function Ek(a,b,c,d){const e=olympe.D.Gg(),f=new olympe.async.Cj(e);0<a.timeout&&f.en(a.timeout);const g=olympe.dc.transaction.lf.C.Mt;let h=!0;const k=a.F.get(b);for(let l=0;l<d;l++)f.add((n,p)=>{k.push(e.G((q,r)=>{h&&(h=q!==g);r?p(r):n()}))});yc(f,(l,n)=>{l||a.H.warn(`An error occurred while processing the notification of transaction (${b}): ${n}.`);h&&a.G.C.tb(c);Gk(a,b)});f.start()}
|
|
814
|
+
function Fk(a,b,c,d){const e=c?olympe.dc.Request.C.yg:olympe.dc.Request.C.xg;return Promise.all(Array.from(b).map(([f,g])=>a.Xb.request(new olympe.dc.Request(e,f,new olympe.dc.transaction.vi(g,d))))).then()}function Ck(a,b,c,d){(a=(a=a.F.get(b))&&a.pop())&&a(c,d)}function Gk(a,b){var c;null==(c=a.F.get(b))||c.forEach(d=>{d(olympe.dc.transaction.lf.C.ii,null)});a.F.delete(b);if(0===a.F.size){for(const d of a.O)d();a.O=[]}a.C.has(b)&&(c=a.C.get(b),a.C.delete(b),c(!0))}
|
|
815
|
+
function Hk(a,b){if(0<a.F.size){const c=olympe.D.Xa();a.O.push(()=>{!c.eb()&&c.run(b)})}else b()}
|
|
816
|
+
olympe.dc.transaction.lf=class{constructor(a,b,c,d,e,f){this.H=a;this.G=b;this.db=b.view;this.Xb=c;this.T=d;this.Z=e;this.timeout=f;this.L=new Map;this.F=new Map;this.O=[];this.C=new Map;Bk(this)}ab(){return this.H}ie(a){this.Xb.request(new olympe.dc.Request(olympe.dc.Request.C.Eo,olympe.dc.Pa.SERVER)).then(b=>{a(b.ids,b.undo_stack_size,b.redo_stack_size)}).catch(b=>this.H.error('Failed to process get stack request',b))}};olympe.dc.transaction.lf.C={zl:0,ii:1,Mt:2};olympe.dc.transaction.vi=class{constructor(a,b=!1){this.C=a;this.F=b}Pg(){return this.F}Wb(){return this.C}};olympe.dc.transaction.R={Ca:'dc.transaction.Logger',Ha:'dc.transaction.Manager'};olympe.dc.transaction.U={TIMEOUT:'dc.transaction.timeout',wn:'dc.transaction.burstInterval'};
|
|
817
|
+
olympe.W.config(function(a){G(a,olympe.dc.transaction.U.TIMEOUT,6E4);G(a,olympe.dc.transaction.U.wn,30);F(a,olympe.dc.transaction.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('dc'));E(a,olympe.dc.transaction.R.Ha,olympe.dc.transaction.lf,olympe.dc.transaction.R.Ca,olympe.dc.db.R.Ha,olympe.dc.R.qg,olympe.dc.sources.R.Me,olympe.dc.R.jj,new olympe.W.ja(olympe.dc.transaction.U.TIMEOUT))},'olympe.dc.transaction');olympe.dc.transaction.Ya={};function Ik(a,b){const c=new Map;for(const [d,e]of b)c.set(d,a.Ra(e));return c}olympe.dc.transaction.Ya.$f=class{constructor(){this.ia=olympe.dc.ia()}C(){throw Error('Abstract method build() not override !');}toString(){throw Error('Abstract method toString() not override !');}Ra(a){a=olympe.D.Ra(a);return void 0===a||null===a?null:olympe.D.vr(a)?a.valueOf():a}};olympe.dc.transaction.Ya.$f.xa=[olympe.dc.Hp];olympe.dc.transaction.Ya.pn=class extends olympe.dc.transaction.Ya.$f{constructor(a,b){super();this.relation=a instanceof olympe.dc.Ma.Relation?a:new olympe.dc.Ma.Relation(olympe.dc.ga(a));this.origin=this.ia.Fa(b)?olympe.dc.CloudObject.get(b):b}getType(){return this.relation.X()}Ga(){return this.relation.Ga()}C(){throw Error('Abstract method build() not override !');}toString(){throw Error('Abstract method toString() not override !');}};function Z(a,b,c){a.yd.set(olympe.dc.ga(b),c);return a}olympe.dc.transaction.Ya.Yn=class extends olympe.dc.transaction.Ya.$f{constructor(a,b){super();let c;this.tag=null!=(c=b&&olympe.dc.ga(b))?c:olympe.Y.tf();this.model=olympe.dc.ga(a);this.source=null;this.yd=new Map}X(){return this.tag}cc(){return this.model}Ti(a){this.source=a;return this}C(a){const b=this.cc(),c=this.X();if(!b)throw Error('OperationError: Cannot create instance, model tag is undefined');a.Nc(c,b,this.source,Ik(this,this.yd))}toString(){return`CreateInstance(${this.cc()}, ${this.X()})`}};
|
|
818
|
+
olympe.dc.transaction.Ya.Yn.xa=[olympe.dc.Fe];olympe.dc.transaction.Ya.Uk=class extends olympe.dc.transaction.Ya.pn{constructor(a,b,c){super(a,b);this.F=this.ia.Fa(c)?olympe.dc.CloudObject.get(c):c}C(a){const b=this.getType();if(''===b)throw Error('OperationError: Cannot create relation, type is undefined, null or empty string');if(b===olympe.dc.qc.$c)throw Error('OperationError: Cannot create the instance -> model relation');if(!this.origin)throw Error('OperationError: Cannot create relation, origin tag is undefined, null or empty string');
|
|
819
|
+
if(!this.F)throw Error('OperationError: Cannot create relation, destination tag is undefined, null or empty string');this.relation.Ga()===olympe.dc.ua.DESTINATION?a.Ea(b,olympe.dc.ga(this.origin),olympe.dc.ga(this.F)):a.Ea(b,olympe.dc.ga(this.F),olympe.dc.ga(this.origin))}toString(){return`CreateRelation('${this.relation.Ga()}${this.relation.X()}, ${olympe.dc.ga(this.origin)}, ${olympe.dc.ga(this.F)})`}};olympe.dc.transaction.Ya.Jy=class extends olympe.dc.transaction.Ya.$f{constructor(a,b=olympe.dc.ec.zc){super();this.model=a instanceof olympe.dc.CloudObject?a:olympe.dc.CloudObject.get(a);this.bc=b}C(a){for(const b of this.ia.Id(this.model))b!==olympe.dc.ga(this.model)&&(new olympe.dc.transaction.Ya.lo(b,this.bc)).C(a)}toString(){return`DeleteAllInstances(${this.model.X()}, ${this.bc})`}};olympe.dc.transaction.Ya.ko=class extends olympe.dc.transaction.Ya.pn{C(a){const b=this.getType();if(void 0===b)throw Error('OperationError: Cannot delete relation, type is undefined');if(b===olympe.dc.qc.$c)throw Error('OperationError: Cannot delete the instance -> model relation');const c=olympe.dc.ga(this.origin);if(!this.origin)throw Error('OperationError: Cannot delete relation, left tag is undefined');const d=this.Ga(),e=this.ia.bb(c,this.relation);for(const f of e)d===olympe.dc.ua.DESTINATION?
|
|
820
|
+
a.ic(b,c,f):a.ic(b,f,c)}toString(){return`DeleteAllRelations(${this.Ga()}${this.getType()})`}};olympe.dc.transaction.Ya.lo=class extends olympe.dc.transaction.Ya.$f{constructor(a,b=olympe.dc.ec.zc){super();this.tag=this.ia.Fa(a)?olympe.dc.CloudObject.get(a):a;this.bc=b}X(){return olympe.dc.ga(this.tag)}C(a){const b=this.X();if(void 0===b)throw Error('OperationError: Cannot delete instance, tag is undefined');this.ia.Fa(b)&&sk(a,b,this.bc)}toString(){return'DeleteInstance('+this.X()+', '+this.bc+')'}};olympe.dc.transaction.Ya.ws=class extends olympe.dc.transaction.Ya.Uk{C(a){const b=this.relation.X();if(void 0===b)throw Error('OperationError: Cannot delete relation, type is undefined');if(b===olympe.dc.qc.$c)throw Error('OperationError: Cannot delete the instance -> model relation');const c=olympe.dc.ga(this.origin);if(void 0===c)throw Error('OperationError: Cannot delete relation, left tag is undefined');const d=olympe.dc.ga(this.F);if(void 0===d)throw Error('OperationError: Cannot delete relation, right tag is undefined');
|
|
821
|
+
this.relation.Ga()===olympe.dc.ua.DESTINATION?a.ic(b,c,d):a.ic(b,d,c)}toString(){return'DeleteRelation('+this.relation.Ga()+this.relation.X()+', '+olympe.dc.ga(this.origin)+', '+olympe.dc.ga(this.F)+')'}};olympe.dc.transaction.Ya.Wu=class extends olympe.dc.transaction.Ya.$f{constructor(a,b,c){super();this.tag=this.ia.Fa(a)?olympe.dc.CloudObject.get(a):a;this.yd=new Map;void 0!==b&&this.yd.set(olympe.dc.ga(b),c)}X(){return olympe.dc.ga(this.tag)}C(a){const b=this.X();if(void 0===b)throw Error('OperationError: Cannot update instance, tag is undefined');var c;if(!(null!=(c=a.C.Hd(b))&&c.G()||this.ia.Fa(b)))throw Error('OperationError: Instance #'+b+' not found so it cannot be updated');c=Ik(this,this.yd);
|
|
822
|
+
for(const [e,f]of c){var d=this.ia.Ka(b,e,!0);d instanceof olympe.dc.Bc&&sk(a,d.X(),olympe.dc.ec.zc);f instanceof olympe.dc.Bc&&!ok(a,f.X())&&(d=new olympe.dc.Wa,d.persist(f.X()),d.C(a))}a.Xc(b,c)}toString(){return'UpdateInstance('+this.X()+', '+Ik(this,this.yd)+')'}};olympe.dc.transaction.Ya.cu=class a extends olympe.dc.transaction.Ya.$f{constructor(b,c){super();this.tag=b;this.source=c}C(b){const c=olympe.dc.ia();if(ok(b,this.tag)&&c.Fa(this.tag)&&!c.Vf(this.tag)){const e=c.Cb(this.tag,!0);var d;let f;null==(f=null==(d=b.C.Hd(this.tag))?void 0:d.Cb())||f.forEach((g,h)=>{e.set(h,g)});for(const g of e.values())g instanceof olympe.dc.Bc&&c.Fa(g.X())&&(new a(g.X(),this.source)).C(b);d=c.model(this.tag);b.Nc(this.tag,d,this.source,e);for(const [g,h,k]of gg(c,this.tag))ok(b,
|
|
823
|
+
k)&&(h===olympe.dc.ua.ORIGIN?b.Ea(g,k,this.tag):b.Ea(g,this.tag,k))}}toString(){return`PersistOperation: tag - ${this.tag}, src - ${this.source}`}};olympe.dc.ga=function(a){let b=null;if('string'===typeof a)return a;if('function'===typeof(null==a?void 0:a.X)&&(null==a||!a.Ag))b=a.X();else if('function'===typeof a){let d;b=null!=(d=olympe.dc.na.cc(a))?d:''}else if(olympe.D.We(a)){let d;b=olympe.dc.ga(null==(d=olympe.D.Ra(a))?void 0:d.valueOf())}let c;return null!=(c=b)?c:''};B('olympe.dc.instanceToTag',olympe.dc.ga);olympe.dc.ia=function(){return olympe.dc.Dm().view};olympe.dc.register=function(a,b){olympe.dc.na.C(a,b)};
|
|
824
|
+
olympe.dc.defineProperty=function(a){return new olympe.dc.Ma.Property(a)};olympe.dc.cr=function(a,b=olympe.dc.ua.DESTINATION,c=olympe.dc.CloudObject,d=olympe.dc.ua.DESTINATION){const e=olympe.dc.ua.DESTINATION;return b===olympe.dc.ua.ORIGIN||b===e?new olympe.dc.Ma.Relation(a,b):new olympe.dc.Ma.Relation(a,d,b,c)};olympe.dc.xv=function(a){return a.Vb()};olympe.dc.Lb={};olympe.dc.Lb.tm=a=>'string'===typeof a||'number'===typeof a||'boolean'===typeof a||a instanceof String?olympe.D.xb(a):a instanceof olympe.D.Na?a:null;olympe.dc.Lb.pm=a=>'boolean'===typeof a||a instanceof Boolean?olympe.D.Qb(a):a instanceof olympe.D.ea?a:null;olympe.dc.Lb.sm=a=>'number'===typeof a||a instanceof Number?olympe.D.ra(a):'string'===typeof a||a instanceof String?olympe.D.ra(Number.parseFloat(a.valueOf())):a instanceof olympe.D.aa?a:null;
|
|
825
|
+
olympe.dc.Lb.qm=function(a){return'number'===typeof a||a instanceof Number?Fb(a.valueOf()):'string'===typeof a||a instanceof String?new olympe.D.gb(new Date(a.valueOf().valueOf())):a instanceof Date?new olympe.D.gb(a):a instanceof olympe.D.gb?a:null};olympe.dc.Lb.Yq=function(a){return a instanceof olympe.D.Color?a:'string'===typeof a||a instanceof String?Jb(a.valueOf()):null};olympe.dc.Lb.Zq=a=>a instanceof olympe.dc.CloudObject?a:a instanceof olympe.dc.Bc?olympe.dc.CloudObject.get(a.tag):null;
|
|
826
|
+
olympe.dc.Lb.Bg=a=>a instanceof olympe.dc.Bc?olympe.dc.CloudObject.get(a.tag):a;olympe.dc.Lb.pC=a=>{switch(typeof a){case 'boolean':return olympe.D.Qb(a);case 'number':return olympe.D.ra(a);case 'string':return olympe.D.xb(a);case 'object':if(a instanceof Date)return olympe.D.mx(a)}return a};
|
|
827
|
+
olympe.dc.Lb.IC=a=>{switch(a){case olympe.D.ea:return olympe.dc.Lb.pm;case olympe.D.Na:return olympe.dc.Lb.tm;case olympe.D.aa:return olympe.dc.Lb.sm;case olympe.D.gb:return olympe.dc.Lb.qm;case olympe.D.Color:return olympe.dc.Lb.Yq;case olympe.dc.CloudObject:return olympe.dc.Lb.Zq;default:return olympe.dc.Lb.Bg}};olympe.dc.vc={};olympe.dc.$e=class{la(){}G(){}compare(){}L(){}ha(){}toString(){}};function Jk(a){let b=null;for(a=[...a.da];null===b&&0<a.length;)b=a.pop().Nb();return b}function Kk(a,b){a.T()||(a=`Calling "${b}" on subscription with id ${a.V()} while it is not ready (thus no data is available).`+'This call should be made within an onReady callback. You can also consider to use Queries API instead of ListDefs (which are deprecated)',olympe.ma.ab('dc').warn(a))}
|
|
828
|
+
olympe.dc.ya=class{constructor(a,b,c){void 0===a||null===a?olympe.ma.ab('dc').warn('attempt to create a listdef with a null or undefind basetag. This listdef is thus without effect.'):(this.F=olympe.D.ta([a],olympe.dc.ga,String),this.da=void 0!==b&&(Array.isArray(b)?b:[b])||[],this.valueType=c||Jk(this),this.C=null,this.Uc=void 0)}he(){return olympe.dc.he()}lb(){if(null===this.C){const a=olympe.dc.vc.ow();this.C=Lk(a,this,this.Uc);null!==this.valueType&&this.C.Cd(this.valueType);olympe.D.Xa().Z(()=>
|
|
829
|
+
{var b=this.C.V();a.H.debug('QueryMGR: [ID:',b,'] - Unregistered');const c=a.C.get(b);if(null==c)var d=0;else 0<c.counter&&c.counter--,d=0===c.counter;d&&(c.C.release(),a.C.delete(b));this.C=null})}return this}lc(){null===this.C&&this.lb();return this.C}Cd(a){this.valueType=a;null!==this.C&&this.C.Cd(this.valueType)}Nb(){return null!==this.C?this.C.Nb():null===this.valueType?olympe.dc.CloudObject:this.valueType}Pd(){return this.F}sl(){return this.da}wd(a,b){return this.lc().wd(a,b)}uk(a){this.lc().uk(a)}et(){return this.lc().pd()}dt(){return this.lc().T()}get(a){return this.lc().get(a)}Dh(){return this.lc().Dh()}Bh(a){const b=
|
|
830
|
+
this.lc();Kk(b,'getCurrent');return b.Bh(a)}has(a){return this.lc().has(a)}Ng(a){const b=this.lc();Kk(b,'hasCurrent');return b.Ng(a)}ee(a){return this.lc().ee(a)}nx(a){return this.ee(a).asObservable()}Te(a){const b=this.lc();Kk(b,'getCurrentAt');return b.Te(a)}Ue(a){return this.lc().Ue(a)}uf(a){const b=this.lc();Kk(b,'getCurrentKeyAt');return b.uf(a)}Rd(a){return this.lc().Rd(a)}tx(a){return this.Rd(a).asObservable()}vf(a){const b=this.lc();Kk(b,'getCurrentRank');return b.vf(a)}xc(){return this.lc().xc()}ox(){return this.xc().asObservable()}wf(){return this.lc().wf()}ef(){return this.lc().ef()}ux(){return this.ef().asObservable()}Tf(){const a=
|
|
831
|
+
this.lc();Kk(a,'getCurrentSize');return a.Tf()}forEach(a,b){this.lc().forEach(a,b)}de(a){const b=this.lc();Kk(b,'forEachCurrentValue');return b.de(a)}Ei(a,b,c,d){a=new olympe.dc.da.dh(a,b);(new olympe.dc.ya(this.F,[...this.da,a],this.valueType)).forEach(c,d)}transform(...a){var b=a;if(Array.isArray(a[0])){if(1<a.length)throw Error('ListDef.transform() should be called either with one array argument, or with ... arguments, but not both');b=a[0]}a=[...this.da];for(const c of b){if(void 0===c)throw Error('ListDef.transform(): Trying to set an undefined transformer');
|
|
832
|
+
if(c instanceof olympe.dc.Ma.Property)throw Error(`ListDef.transform(): Properties cannot be used as transformer, unlike relations ${c}`);if(!c||'function'!==typeof c.C)break;a.push(c)}b=new olympe.dc.ya(this.F,a);b.Cd(Jk(b)||this.valueType||Object);return b}zk(a){return this.transform(new olympe.dc.da.nf(a))}filter(a){return this.transform(new olympe.dc.da.cf(a))}Zj(){const a=new olympe.dc.sj(this.F,null===this.valueType?void 0:this.valueType);'boolean'===typeof this.Uc&&(a.Uc=this.Uc);let b=this.da;
|
|
833
|
+
b instanceof Array||(b=b?[b]:[]);a.transform(b);return a}toString(){let a=this.da;a=a?', '+(a.join?a.join(', '):a.toString()):'';return'ListDef(#'+olympe.D.Ra(this.F)+a+')'}ct(){return this.lc().hg()}Ic(){return olympe.D.ta([this.ef()],a=>{let b='[';for(let c=0;c<a;c++){const d=this.Te(c).toString();b=0<c&&c<a?b+(', '+d):b+d}return olympe.D.xb(b+']')},olympe.D.Na)}};olympe.dc.ya.prototype.filter=olympe.dc.ya.prototype.filter;olympe.dc.ya.prototype.union=olympe.dc.ya.prototype.zk;
|
|
834
|
+
olympe.dc.ya.prototype.transform=olympe.dc.ya.prototype.transform;olympe.dc.ya.prototype.forEachCurrentValue=olympe.dc.ya.prototype.de;olympe.dc.ya.prototype.forEach=olympe.dc.ya.prototype.forEach;olympe.dc.ya.prototype.getCurrentSize=olympe.dc.ya.prototype.Tf;olympe.dc.ya.prototype.observeSize=olympe.dc.ya.prototype.ux;olympe.dc.ya.prototype.observeFirst=olympe.dc.ya.prototype.ox;olympe.dc.ya.prototype.getCurrentRank=olympe.dc.ya.prototype.vf;olympe.dc.ya.prototype.observeRank=olympe.dc.ya.prototype.tx;
|
|
835
|
+
olympe.dc.ya.prototype.getCurrentAt=olympe.dc.ya.prototype.Te;olympe.dc.ya.prototype.observeAt=olympe.dc.ya.prototype.nx;olympe.dc.ya.prototype.offReady=olympe.dc.ya.prototype.uk;olympe.dc.ya.prototype.onReady=olympe.dc.ya.prototype.wd;olympe.dc.ya.prototype.getBaseTag=olympe.dc.ya.prototype.Pd;olympe.dc.ya.xa=[olympe.D.ed];m=olympe.dc.ya.prototype;m.he.K=olympe.D.J.C;m.lb.K=olympe.D.J.L();m.lc.K=new olympe.D.J(()=>olympe.dc.vc.Subscription,[]);m.Cd.K=new olympe.D.J(()=>{},[]);
|
|
836
|
+
m.Pd.K=new olympe.D.J(()=>String,[]);m.sl.K=new olympe.D.J(()=>Array,[]);m.wd.K=new olympe.D.J(()=>String,[]);m.uk.K=new olympe.D.J(()=>{},[]);m.et.K=olympe.D.J.O;m.dt.K=olympe.D.J.C;m.get.K=new olympe.D.J(()=>olympe.dc.CloudObject,[],'valueType');m.Dh.K=new olympe.D.J(()=>Array,[]);m.Bh.K=olympe.D.J.C;m.has.K=olympe.D.J.O;m.Ng.K=olympe.D.J.C;m.ee.K=new olympe.D.J(()=>olympe.dc.CloudObject,[],'valueType');m.Te.K=olympe.D.J.C;m.Ue.K=new olympe.D.J(()=>String,[]);m.uf.K=olympe.D.J.C;m.Rd.K=olympe.D.J.G;
|
|
837
|
+
m.vf.K=olympe.D.J.C;m.xc.K=new olympe.D.J(()=>olympe.dc.CloudObject,[],'valueType');m.wf.K=new olympe.D.J(()=>String,[]);m.ef.K=olympe.D.J.G;m.Tf.K=olympe.D.J.C;m.forEach.K=new olympe.D.J(()=>{},[]);m.de.K=olympe.D.J.C;m.Ei.K=new olympe.D.J(()=>{},[]);m.transform.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.zk.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.filter.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.Zj.K=new olympe.D.J(()=>olympe.dc.sj,[]);m.toString.K=olympe.D.J.C;m.ct.K=olympe.D.J.C;m.Ic.K=olympe.D.J.F;const Mk={Zx:'append',dl:'filter_not',vo:'filter_and',wo:'filter_or'};function Nk(a,b){a=Ok(a);a=olympe.dc.CloudObject.get(a);return(new olympe.dc.$a.qn(a,b)).F}
|
|
838
|
+
olympe.dc.sj=class{constructor(a,b){this.C=Ok(a);this.H=olympe.ma.ab('dc.query');this.valueType=void 0===b?olympe.dc.CloudObject:b;this.da=[];this.Ya=[];this.Uc=void 0}fi(){const a=new olympe.dc.ya(this.C,this.da,this.valueType);'boolean'===typeof this.Uc&&(a.Uc=this.Uc);return a}transform(a){for(let b=0,c=a.length,d;b<c;b++){d=a[b];if(void 0===d)throw new Pk('transform','Trying to set an undefined transformer');if(d instanceof olympe.dc.Ma.Property)throw new Pk('transform','Properties cannot be used as transformer, unlike relations '+
|
|
839
|
+
d);if(!d||'function'!==typeof d.C)throw new Pk('transform','one of the argument is not a Transformer '+d);const e=d.Nb();null!==e&&(this.valueType=e);this.da.push(d)}return this}zk(a){this.da.push(new olympe.dc.da.nf(a));return this}Xx(a){this.da.push(new olympe.dc.da.nf(Ok(a)));return this}gt(a){this.valueType=a;return this}cb(a){this.da.push(a);this.valueType=a.Nb()||olympe.dc.CloudObject;return this}Lv(a){for(const b of a)this.da.push(b),this.valueType=b.Nb()||olympe.dc.CloudObject;return this}Kv(a,
|
|
840
|
+
b,c){a=new olympe.dc.da.se(a,a.Ga(),b,c);this.da.push(a);this.valueType=a.Nb()||olympe.dc.CloudObject;return this}Jv(a){const b=[];let c;for(let d=0;d<a.length;d++){const e=a[d];b.push(e.X());void 0===c&&(c=e.Ga())}a=new olympe.dc.da.tj(b,c);this.da.push(a);this.valueType=a.Nb()||olympe.dc.CloudObject;return this}ft(){this.cb(olympe.dc.CloudObject.instancesRel);return this}Re(a){var b=this.Ya.pop();b===Mk.dl&&(a=new olympe.dc.$.Zd(a),b=this.Ya.pop());switch(b){case Mk.vo:b=this.da.pop().F;b instanceof
|
|
841
|
+
olympe.dc.$.Ad?(b=b.$,b.push(a),a=new olympe.dc.$.Ad(...b)):a=new olympe.dc.$.Ad(b,a);b=this.Ya.pop();break;case Mk.wo:b=this.da.pop().F,b instanceof olympe.dc.$.re?(b=b.$,b.push(a),a=new olympe.dc.$.re(...b)):a=new olympe.dc.$.re(b,a),b=this.Ya.pop()}b===Mk.dl&&(a=new olympe.dc.$.Zd(a),this.Ya.pop());this.da.push(new olympe.dc.da.cf(a));return this}Fv(a,b,c){return this.Re(new olympe.dc.$.pe(Nk(a,c),new olympe.dc.$a.De(b)))}contains(a,b,c=!1,d){return this.Re(new olympe.dc.$.af(Nk(a,d),new olympe.dc.$a.De(b),
|
|
842
|
+
c))}jc(a){if(!(a instanceof Array))throw new Pk('instanceOf','Provided argument "models" must be an array.');const b=[];for(let c=0;c<a.length;c++)b.push(Ok(a[c]));return this.Re(new olympe.dc.$.ci(b))}nk(a){return this.Re(new olympe.dc.$.pe(new olympe.dc.$a.ti,new olympe.dc.$a.De(Ok(a))))}Gv(a){if(!Array.isArray(a))throw Error('ExcludeInstances should be called with an array');if(0<a.length){this.jd().nk(a[0]);for(let b=1,c=a.length;b<c;b++)this.and().jd().nk(a[b])}return this}Pw(a,b){if(!(a instanceof
|
|
843
|
+
Array))throw new Pk('hasRelated','Provided argument "relations" must be an array.');const c=[],d=[];a.forEach(e=>{c.push(e);d.push(e.Ga())});return this.Re(new olympe.dc.$.$h(c,d,b))}lk(a,b,c){a=Nk(a,c);return this.Re(new olympe.dc.$.nj(a,new olympe.dc.$a.De(b)))}Ui(a,b,c){a=Nk(a,c);return this.Re(new olympe.dc.$.Rj(a,new olympe.dc.$a.De(b)))}ex(a,b,c,d){a=Nk(a,d);return this.Re(new olympe.dc.$.kf(a,b,c))}filter(a){const b=new class extends olympe.dc.$.Zf{C(c,d){return a(olympe.dc.CloudObject.get(d))}};
|
|
844
|
+
return this.Re(b)}jd(){this.Ya.push(Mk.dl);return this}and(){this.da[this.da.length-1]instanceof olympe.dc.da.cf&&this.Ya.push(Mk.vo);return this}or(){this.da[this.da.length-1]instanceof olympe.dc.da.cf&&this.Ya.push(Mk.wo);return this}yk(a,b,c){a=Ok(a);let d=null;switch(olympe.dc.ia().Pb(a,olympe.dm.Property.typeRel)){case olympe.dm.String.P.X():d=new olympe.dc.rc.String(new olympe.dc.$a.ri(a,c));break;case olympe.dm.Number.P.X():d=new olympe.dc.rc.Number(new olympe.dc.$a.ji(a,c));break;case olympe.dm.DateTime.P.X():d=
|
|
845
|
+
new olympe.dc.rc.DateTime(new olympe.dc.$a.Sh(a,c))}c=d;null!==c&&this.da.push(new olympe.dc.da.vg(c,b));return this}sort(a,b,c){const d=new class extends olympe.dc.rc.Zf{G(e,f){return a(olympe.dc.CloudObject.get(f))}compare(e,f){return b(e,f).valueOf()}};this.da.push(new olympe.dc.da.vg(d,c));return this}Bv(){this.da.push(new olympe.dc.da.Th);return this}Mi(a,b){this.da.push(new olympe.dc.da.dh(a,b));return this}};class Pk extends Error{constructor(a,b){super(`ListDefBuilder.${a}(): ${b}`)}}
|
|
846
|
+
function Ok(a){return'string'===typeof a||a instanceof olympe.D.Na?a:'function'===typeof a?olympe.dc.na.cc(a):olympe.D.fb(a)?a.rh===olympe.D.Na?a:olympe.D.ta([a],b=>olympe.D.xb(olympe.dc.ga(b)),olympe.D.Na):a.X()}m=olympe.dc.sj.prototype;m.fi.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.transform.K=olympe.D.J.L();m.zk.K=olympe.D.J.L();m.Xx.K=olympe.D.J.L();m.gt.K=olympe.D.J.L();m.cb.K=olympe.D.J.L();m.Lv.K=olympe.D.J.L();m.Kv.K=olympe.D.J.L();m.Jv.K=olympe.D.J.L();m.ft.K=olympe.D.J.L();m.Re.K=olympe.D.J.L();
|
|
847
|
+
m.Fv.K=olympe.D.J.L();m.contains.K=olympe.D.J.L();m.jc.K=olympe.D.J.L();m.nk.K=olympe.D.J.L();m.Gv.K=olympe.D.J.L();m.Pw.K=olympe.D.J.L();m.lk.K=olympe.D.J.L();m.Ui.K=olympe.D.J.L();m.ex.K=olympe.D.J.L();m.filter.K=olympe.D.J.L();m.jd.K=olympe.D.J.L();m.and.K=olympe.D.J.L();m.or.K=olympe.D.J.L();m.yk.K=olympe.D.J.L();m.sort.K=olympe.D.J.L();m.Bv.K=olympe.D.J.L();m.Mi.K=olympe.D.J.L();function Lk(a,b,c){const d=b.Pd();var e=new olympe.dc.query.$t;let f;f=d;olympe.D.fb(f)&&(f=e.add(d));b=(b=b.sl())?Array.isArray(b)?b:[b]:null;e=olympe.dc.vc.Subscription.G(f,b,e);let g,h,k=null!=(h=null==(g=a.C.get(e))?void 0:g.C)?h:null;null===k&&(a.H.debug('QueryMGR: new',a.F?'local':'remote','subscription "',e,'": #',`${f},`,b),k=new olympe.dc.vc.Subscription(e,d,b,a.G));k.getContext().run(()=>a.process(k,c));return k}
|
|
848
|
+
function Qk(a,b){if(b.T())a.H.debug('ListProcessor: [ID:',b.V(),'] - Subscription already booted, ignoring');else{a.H.debug('ListProcessor: [ID:',b.V(),'] - Booting subscription');var c=new olympe.dc.kc.Bq(a.db,a.H),d=b.V();olympe.D.Gc([b.Pd()],e=>{const f=olympe.dc.ga(e);a.H.debug('ListProcessor: [ID:',b.V(),'] - Booting with baseTag',f);b.ek()||b.pk();Fe(a.db,f,Rk(a,b,c),d);olympe.D.Xa().Z(()=>Ee(a.db,f,d));a.db.Fa(f.valueOf())||Sk(c);b.T()||(Sk(c),b.hc([]))})}}
|
|
849
|
+
function Tk(a,b,c,d,e){const f=[b.Pd()],g=l=>l instanceof olympe.dc.da.nf;let h;const k=(null!=(h=b.Lg())?h:[]).filter(g);for(const l of k){f.push(l.Pd());let n;k.push(...(null!=(n=l.Lg())?n:[]).filter(g))}Hk(a.O,()=>{olympe.D.Gc(f,()=>{const l=b.ve(c);Uk(a,l,b.V(),d,e)})})}
|
|
850
|
+
function Uk(a,b,c,d,e){a.H.debug('CoverageProcessor: [ID:',c,'] - checking coverage of remote query over',b.length,'paths.');const f=olympe.D.Xa(),g=new olympe.async.Cj(f);b.forEach(h=>{g.add((k,l)=>{let n=!1;mh(a.L,h,f,olympe.dc.Pa.SELF,olympe.dc.pa.Tc.Ef,{Uc:e}).subscribe(rxjs.Subscriber.create(()=>{n||(n=!0,f.run(k))},p=>f.run(()=>l(`The query ${c} is not covered by an existing graphdef, `+`and the specific graphdef id ${h.V()} has encountered an error: ${p}`))))})});yc(g,(h,k)=>d(k));g.start()}
|
|
851
|
+
function Rk(a,b,c){const d=new olympe.dc.kc.Zi;let e=!1;const f=olympe.D.Xa(),g=b.Lg(),h=[];h[g?g.length:0]=(k,l,n,p)=>{f.Wc()||f.eb()||(k?b.Ng(n)?a.H.warn('Adding the same index twice (should never happen) for sub #',b.V(),', index #',n,', tag #',l):(a.H.debug('ListProcessor: [ID:',b.V(),'] - Adding Instance',l,'to the subscription'),b.Od(n,l)):(a.H.debug('ListProcessor: [ID:',b.V(),'] - Removing Instance',l,'from the subscription'),b.mk(n)),e||(Vk(c,()=>{p.Pf();Sk(c)}),f.run(()=>p.he().Yf(b.hc.bind(b))),
|
|
851
852
|
e=!0),Wk(c,n))};if(null!==g)for(let k=g.length-1;0<=k;k--)h[k]=g[k].C(f,c,h[k+1]);return(k,l)=>{const n=b.V();c.register(n,null);const p=d.C(k,l,n,null);if(null!==p)h[0](k,l,n,Xk(p,k,l,n))}}
|
|
852
|
-
olympe.dc.vc.
|
|
853
|
-
Qk(this,a)):Tk(this,a,
|
|
854
|
-
olympe.dc.query
|
|
855
|
-
olympe.dc.
|
|
856
|
-
()=>{},olympe.D.ea)}T(){const b=this.G.Da.Db;return b&&b.valueOf()>=olympe.dc.vc.Subscription.C.kh}
|
|
857
|
-
0,d=b.length;c<d;c++)this.
|
|
858
|
-
this.
|
|
859
|
-
olympe.dc.da.
|
|
860
|
-
olympe.dc.$.
|
|
861
|
-
a.toString()).join(',')+')'}};S('olympe.dc.predicates.And',olympe.dc.$.
|
|
862
|
-
return this.
|
|
863
|
-
return'{"c":"'+this.
|
|
864
|
-
')'}};S('olympe.dc.predicates.Equals',olympe.dc.$.
|
|
865
|
-
c.getContext().
|
|
866
|
-
function dl(a,b,c,d){const e=Object.create(null);d+=olympe.Y.Ah();const f=(g,h,k)=>{k>=a.F&&c(g,h);if(!(0<=a.C&&k>=a.C)){var l=d+k;g?e[h]||(e[h]=!0,W(b,h,a,(n,p)=>{f(n,p,k+1)},l)):(delete e[h],b.F(h,a,l))}};return(g,h)=>f(g,h,0)}class cl extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.F=c;this.C=d}ha(){return`${this.X()}, ${this.Ga()}, ${this.F}, ${this.C}`}}olympe.dc
|
|
867
|
-
const g=this.
|
|
853
|
+
olympe.dc.vc.Et=class{constructor(a,b,c,d,e){this.H=a;this.db=b;this.F=e;this.O=c;this.L=d;this.C=new Map;this.G=new olympe.D.Yb('Legacy ListDef processor')}process(a,b){const c=a.V();var d=this.C.get(c);d||(d=new olympe.dc.vc.Fu(a),this.C.set(c,d));d.counter++;Yk(d)?this.H.debug('ListProcessor: [ID:',c,'] - id already processed'):(this.H.debug('ListProcessor: [ID:',c,'] - NOT processed yet.'),d=a.sf(),b||this.F&&d===olympe.dc.Pa.SERVER||d===olympe.dc.Pa.SELF?(this.H.debug('QueryMGR: [ID:',c,'] - Local subscription, no need for coverage check, booting subscription '),
|
|
854
|
+
Qk(this,a)):Tk(this,a,d,e=>{e?this.H.error(e):Qk(this,a)},b))}};function Zk(a){return olympe.D.fb(a)?'Node#'+a.Da.V():String(a)}function $k(a,b){return olympe.D.fb(b)?'{"c":"Parameter","v":"'+a.add(b)+'"}':JSON.stringify(b)}
|
|
855
|
+
olympe.dc.query.$t=class{constructor(){this.C=0;this.values=null}add(a){let b;b=olympe.D.fb(a)?'n'+a.Da.V():'p'+ ++this.C;null===this.values&&(this.values={});this.values[b]=a;return b}get(a){return this.values[a]}clear(){const a=this.values;if(null!==a)for(let b=Object.keys(a),c=b.length,d=0;d<c;d++)delete a[b[d]]}forEach(a){const b=this.values;if(null!==b)for(let c=Object.keys(b),d=c.length,e=0;e<d;e++)a(b[c[e]],c[e])}};olympe.dc.Aa=class{la(){}C(){}F(){}ha(){}toString(){}};olympe.dc.vc.Subscription=class a extends olympe.D.Yi{constructor(b,c,d,e){super(olympe.dc.CloudObject,new olympe.D.Yb('context subscription '+b,e));this.id=b;this.Kc=c;this.da=d||null;this.G=this.O.run(()=>olympe.D.Ud(olympe.dc.vc.Subscription.C.INIT));this.Tb=!1;this.ba=this.ac=null}static G(b,c,d){let e;try{e=b;if(c)for(let f=0,g=c.length;f<g;f++)e+='|'+c[f].ha(d);else e+='|null';e=olympe.Y.vb(e)}catch(f){e=olympe.Y.Fc()}return e}V(){return this.id}Pd(){return this.Kc}Lg(){return this.da}sf(){const b=
|
|
856
|
+
olympe.dc.Sd(),c=olympe.D.Ra(this.Pd());let d;return olympe.dc.CloudObject.instancesRel.Qa(null==(d=this.da)?void 0:d[0])?b.fromModel(c):b.we(c)}ek(){const b=olympe.D.Ra(this.G);return b&&b.valueOf()>=olympe.dc.vc.Subscription.C.uq}pk(){if(this.G.Da.eb())throw Error(`Cannot set destroyed subscription '${this.id}' as subscribed`);const b=this.ac;this.ac=null;for(let c in b)if(Object.prototype.hasOwnProperty.call(b,c))b[c](this);Cb(this.G,olympe.D.Ud(olympe.dc.vc.Subscription.C.uq))}pd(){return olympe.D.ta([this.G],
|
|
857
|
+
()=>{},olympe.D.ea)}T(){const b=this.G.Da.Db;return b&&b.valueOf()>=olympe.dc.vc.Subscription.C.kh}wd(b,c){this.T()?b(this):(null===this.ba&&(this.ba=new Map),void 0===c&&(c=olympe.Y.Fc()),this.ba.set(c,olympe.D.Xa().G(b)));return c||''}uk(b){null!==this.ba&&b&&this.ba.delete(b)}Kb(){const b=olympe.dc.vc.Subscription.C.kh;if(!this.G.Da.eb()&&olympe.D.Ra(this.G)!==b&&(this.qf(),Cb(this.G,b),null!==this.ba)){for(const c of this.ba.values())c(this);this.ba=null}}onDestroy(b){this.O.onDestroy(b)}release(){this.O.destroy()}hc(b){if(!this.G.Da.eb()){for(let c=
|
|
858
|
+
0,d=b.length;c<d;c++)this.im(b[c],c);if(this.T())this.qf();else{this.Tb=b=!0;for(let c in this.F)if(Object.prototype.hasOwnProperty.call(this.F,c)&&!Object.prototype.hasOwnProperty.call(this.values,c)){b=!1;break}b&&this.Kb()}}}Od(b,c){if(!this.G.Da.eb()&&(this.Yj(b,olympe.dc.CloudObject.get(c)),b=this.T(),this.Tb&&!b)){b=!0;for(let d in this.F)if(Object.prototype.hasOwnProperty.call(this.F,d)&&!Object.prototype.hasOwnProperty.call(this.values,d)){b=!1;break}b&&this.Kb()}}mk(b){this.G.Da.eb()||(this.hm(b),
|
|
859
|
+
this.Ai(b,!this.T()))}hg(){return this.T()?super.hg():'Subscription is not ready!'}ve(b){const c=olympe.D.Ra(this.Pd());return olympe.dc.vc.Subscription.F(c,b,this.Lg())}static F(b,c,d){var e=olympe.dc.pa.from(b,c).ce();if(null===d)return[e];b=[];b.push(e);for(let f=0,g=d.length;f<g;f++)if(e=d[f],e instanceof olympe.dc.da.Le){const h=olympe.dc.query.Relation.from(e);b=b.map(k=>k.cb(h,!0))}else if(e instanceof olympe.dc.da.se){const h=olympe.dc.query.Relation.from(e);b=b.map(k=>k.Sf(h,!0,!0))}else if(e instanceof
|
|
860
|
+
olympe.dc.da.nf)e=a.F(olympe.D.Ra(e.Pd()),c,e.Lg()),b.push(...e);else if(e instanceof olympe.dc.da.cf||e instanceof olympe.dc.da.vg){const h=e.G();b=b.map(k=>{for(const l of h){for(const n of l)k=n.recursive?k.Sf(n,!0,!0):k.cb(n,!0);k=k.back(l.length)}return k})}return b}};olympe.dc.vc.Subscription.C={INIT:0,uq:1,kh:2};olympe.dc.vc.Subscription.prototype.hg.K=olympe.D.J.C;function Yk(a){const b=a.F;a.F=!0;return b}olympe.dc.vc.Fu=class{constructor(a){this.counter=0;this.F=!1;this.C=a}};olympe.dc.mf=class{la(){}Nb(){}C(){}ha(){}toString(){}};olympe.dc.Qp=class{G(){}};olympe.dc.Wj=class{la(){}getValue(){}C(){}ha(){}toString(){}};olympe.dc.rc={};let al=0;olympe.dc.rc.Zf=class{constructor(){this.id=al++}la(){return'CustomLocalComparator#'+al}L(){return[]}G(){throw Error('GetComparedValue function was not implemented.');}compare(){throw Error('Compare function was not implemented.');}ha(){return`{"c":"${this.la()}"}`}toString(){return this.la()+'()'}};olympe.dc.rc.Zf.xa=[olympe.dc.$e];olympe.dc.rc.DateTime=class{constructor(a){this.C=a}la(){return T(olympe.dc.rc.DateTime)}L(){return this.C.C()}G(a,b){return this.C.getValue(a,b)}compare(a,b){if(!a)return b?-1:0;if(!b)return 1;a=a.getTime();b=b.getTime();return a!==b?a>b?1:-1:0}ha(a){return'{"c":"'+this.la()+'",a:['+this.C.ha(a)+']}'}toString(){return'Number('+this.C.toString()+')'}};S('olympe.dc.comparators.DateTime',olympe.dc.rc.DateTime);olympe.dc.rc.DateTime.xa=[olympe.dc.$e];olympe.dc.rc.Number=class{constructor(a){this.C=a}la(){return T(olympe.dc.rc.Number)}L(){return this.C.C()}G(a,b){return this.C.getValue(a,b)}compare(a,b){return a!==b?a>b?1:-1:0}ha(a){return`{"c":"${this.la()}",a:[${this.C.ha(a)}]}`}toString(){return`Number(${this.C.toString()})`}};S('olympe.dc.comparators.Number',olympe.dc.rc.Number);olympe.dc.rc.Number.xa=[olympe.dc.$e];olympe.dc.rc.String=class{constructor(a){this.C=a}la(){return T(olympe.dc.rc.String)}L(){return this.C.C()}G(a,b){return olympe.D.ta([this.C.getValue(a,b)],c=>c.toLowerCase(),olympe.D.Na)}compare(a,b){return void 0===a?void 0===b?0:1:a!==b?a>b?1:-1:0}ha(a){return`{"c":"${this.la()}",a:[${this.C.ha(a)}]}`}toString(){return`String(${this.C.toString()})`}};S('olympe.dc.comparators.String',olympe.dc.rc.String);olympe.dc.rc.String.xa=[olympe.dc.$e];olympe.dc.$={};let bl=0;olympe.dc.$.Zf=class{constructor(){this.id=bl++}la(){return'CustomLocalPredicate#'+this.id}F(){return[]}C(){throw Error('Test function was not implemented.');}ha(){return`{"c":"${this.la()}"}`}toString(){return this.la()+'()'}};olympe.dc.$.Zf.xa=[olympe.dc.Aa];olympe.dc.$.Ek=class{constructor(a,b){this.G=a;this.L=b}la(){}F(){return[this.G.C(),this.L.C()]}C(a,b){return a.run(()=>olympe.D.ta([this.G.getValue(a,b),this.L.getValue(a,b)],(c,d)=>{c=c.valueOf();d=d.valueOf();return olympe.D.Qb(this.O('string'===typeof c?c:Number(c),'string'===typeof d?d:Number(d)))},olympe.D.ea))}O(){}ha(a){return'{"c":"'+this.la()+'","a":['+this.G.ha(a)+','+this.L.ha(a)+']}'}toString(){return this.la().replace(/^.+\./,'')+'('+this.G.toString()+','+this.L.toString()+')'}};
|
|
861
|
+
olympe.dc.$.Ek.xa=[olympe.dc.Aa];olympe.dc.$.Ad=class{constructor(a){this.$=[];for(let b=arguments.length,c=0;c<b;c++)Array.isArray(arguments[c])?this.$=this.$.concat(arguments[c]):this.$.push(arguments[c])}la(){return T(olympe.dc.$.Ad)}F(){return this.$.reduce((a,b)=>a.concat(b.F()),[])}C(a,b){return a.run(()=>olympe.D.ta(this.$.map(c=>c.C(a,b)),(...c)=>olympe.D.Qb(c.every(d=>d.valueOf())),olympe.D.ea))}ha(a){const b=this.$.map(c=>c.ha(a));return'{"c":"'+this.la()+'","a":['+b.join(',')+']}'}toString(){return'And('+this.$.map(a=>
|
|
862
|
+
a.toString()).join(',')+')'}};S('olympe.dc.predicates.And',olympe.dc.$.Ad);olympe.dc.$.Ad.xa=[olympe.dc.Aa];olympe.dc.$.Mk=class{constructor(a,b){this.G=a;this.value=b}C(a,b){return a.run(()=>olympe.D.ta([this.G,this.value.getValue(a,b)],(c,d)=>{c=c.valueOf();return olympe.D.Qb((Number(c)&Number(d.valueOf()))===Number(c))},olympe.D.ea))}la(){return T(olympe.dc.$.Mk)}F(){return[this.value.C()]}ha(a){const b=olympe.D.fb(this.G)?this.G.Da.Db.valueOf():this.G.valueOf();return'{"c":"'+this.la()+'","a":['+b+','+this.value.ha(a)+']}'}toString(){const a=olympe.D.fb(this.G)?this.G.Da.Db.valueOf():this.G.valueOf();
|
|
863
|
+
return this.la().replace(/^.+\./,'')+'('+a.toString()+','+this.value.toString()+')'}};S('olympe.dc.predicates.BitMask',olympe.dc.$.Mk);olympe.dc.$.Mk.xa=[olympe.dc.Aa];olympe.dc.$.af=class{constructor(a,b,c){this.source=a;this.value=b;this.G=c?c:!1}la(){return T(olympe.dc.$.af)}F(){return[this.source.C(),this.value.C()]}yb(){return this.source}getValue(){return this.value}C(a,b){return a.run(()=>olympe.D.ta([this.source.getValue(a,b),this.value.getValue(a,b),this.G],(c,d,e)=>{c=String(c);d=String(d);e.valueOf()||(c=c.toLowerCase(),d=d.toLowerCase());return olympe.D.Qb(c.includes(d))},olympe.D.ea))}ha(a){const b=this.source.ha(a),c=this.value.ha(a);a=$k(a,this.G);
|
|
864
|
+
return'{"c":"'+this.la()+'","a":['+b+','+c+','+a+']}'}toString(){const a=Zk(this.G);return'Contains('+this.source.toString()+','+this.value.toString()+','+a+')'}};S('olympe.dc.predicates.Contains',olympe.dc.$.af);olympe.dc.$.af.xa=[olympe.dc.Aa];olympe.dc.$.pe=class{constructor(a,b){this.G=a;this.L=b}la(){return T(olympe.dc.$.pe)}F(){return[this.G.C(),this.L.C()]}C(a,b){return a.run(()=>olympe.D.ta([this.G.getValue(a,b),this.L.getValue(a,b)],(c,d)=>'object'===typeof c&&void 0!==c.vd?c.vd(d):'object'===typeof d&&void 0!==d.vd?d.vd(c):olympe.D.Qb(c.valueOf()===d.valueOf()),olympe.D.ea,'Test equal predicate'))}ha(a){return'{"c":"'+this.la()+'","a":['+this.G.ha(a)+','+this.L.ha(a)+']}'}toString(){return'Equals('+this.G.toString()+','+this.L.toString()+
|
|
865
|
+
')'}};S('olympe.dc.predicates.Equals',olympe.dc.$.pe);olympe.dc.$.pe.xa=[olympe.dc.Aa];olympe.dc.$.ys=class extends olympe.dc.$.pe{constructor(a,b){super(a,new olympe.dc.$a.De(b))}};olympe.dc.$.ys.xa=[olympe.dc.Aa];olympe.dc.$.nj=class extends olympe.dc.$.Ek{constructor(a,b){super(a,b)}la(){return T(olympe.dc.$.nj)}O(a,b){return a>b}};S('olympe.dc.predicates.Greater',olympe.dc.$.nj);olympe.dc.$.$h=class{constructor(a,b,c){this.mb=[];this.G=c instanceof Array?c:void 0!==c?[olympe.dc.ga(c)]:[];a=Array.isArray(a)?a:[a];for(let d=0,e=a.length;d<e;d++)c=a[d],c instanceof olympe.dc.da.se?this.mb.push(new cl(c.X(),c.Ga(),c.G,c.F)):this.mb.push(new cl(olympe.dc.ga(c),b[d],1,1))}la(){return T(olympe.dc.$.$h)}F(){return[this.mb.reduce((a,b)=>a.concat(b),[])]}C(a,b){const c=a.run(()=>Db(olympe.D.fc(Boolean),!1)),d=olympe.Y.Fc(),e=olympe.dc.ia();let f=0;a=(h,k)=>{0!==this.G.length&&!this.G.includes(k)||
|
|
866
|
+
c.getContext().eb()||c.getContext().Wc()||(f+=h?1:-1,c.update(0<f))};const g=this.mb;for(let h=g.length-1;0<=h;h--)a=dl(g[h],e,a,d+h);Fe(e,b,a,d);c.getContext().onDestroy(()=>{Ee(e,b,d)});return c.rb()}ha(){return'{"c":"'+this.la()+'","a":['+JSON.stringify(this.mb.map(a=>a.ha()))+(0!==this.G.length?',"'+this.G.toString():'')+'"]}'}toString(){return'HasRelated('+(0!==this.G.length?'#'+this.G.toString()+', ':'')+this.mb.map(a=>a.ha())+')'}};S('olympe.dc.predicates.HasRelated',olympe.dc.$.$h);
|
|
867
|
+
function dl(a,b,c,d){const e=Object.create(null);d+=olympe.Y.Ah();const f=(g,h,k)=>{k>=a.F&&c(g,h);if(!(0<=a.C&&k>=a.C)){var l=d+k;g?e[h]||(e[h]=!0,W(b,h,a,(n,p)=>{f(n,p,k+1)},l)):(delete e[h],b.F(h,a,l))}};return(g,h)=>f(g,h,0)}class cl extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.F=c;this.C=d}ha(){return`${this.X()}, ${this.Ga()}, ${this.F}, ${this.C}`}}olympe.dc.$.$h.xa=[olympe.dc.Aa];olympe.dc.$.ll=class{constructor(a,b,c){this.mb=[];this.G=void 0!==c?c.map(olympe.dc.ga):null;a=Array.isArray(a)?a:[a];for(let d=0,e=a.length;d<e;d++)c=a[d],c instanceof olympe.dc.da.se?this.mb.push(new el(c.X(),c.Ga(),c.G,c.F)):this.mb.push(new el(olympe.dc.ga(c),b[d],1,1))}la(){return T(olympe.dc.$.ll)}F(){return[this.mb.reduce((a,b)=>a.concat(b),[])]}C(a,b){const c=a.run(()=>Db(olympe.D.fc(Boolean),!1)),d=olympe.dc.ia(),e=olympe.Y.Ah();let f=(k,l,n)=>{l&&(null===this.G||this.G.includes(n))&&k(1)};
|
|
868
|
+
const g=this.mb;for(let k=g.length-1;0<=k;k--)f=fl(g[k],d,f,e+k);let h=0;Fe(d,b,f.bind(null,k=>{c.getContext().Wc()||c.getContext().eb()||(h+=k,c.update(0<h))}),e);a.onDestroy(()=>Ee(d,b,e));return c.rb()}ha(){return'{"c":"'+this.la()+'","a":['+JSON.stringify(this.mb.map(a=>a.ha()))+(null!==this.G?',"'+this.G.toString():'')+'"]}'}toString(){return'HasRelatedTree('+(null!==this.G?'#['+this.G.toString()+'], ':'')+this.mb.map(a=>a.ha())+')'}};S('olympe.dc.predicates.HasRelatedTree',olympe.dc.$.ll);
|
|
868
869
|
function fl(a,b,c,d){const e=a.G,f=a.O,g=new Set,h=(l,n,p)=>{f.has(n)?f.get(n).set(d+p,l):f.set(n,(new Map).set(d+p,l))},k=(l,n,p,q,r)=>{const t=olympe.Y.Ah();if(q){const u=p+r,w=y=>{const z=f.get(r);if(g.has(u))throw Error(`Try to use the predicate HasRelatedTree with recursion in a graph cluster containing a loop around instances ${p} and ${r}`);void 0!==z&&null!==z&&(g.add(u),e.set(r,(e.get(r)||0)+y),Array.from(z.values()).forEach(A=>A(y)));g.delete(u)};h(l,r,p);e.has(r)?l(e.get(r)):(n>=a.F&&c(y=>
|
|
869
|
-
{e.set(r,(e.get(r)||0)+y);l(y)},q,r),(0>a.C||n<=a.C)&&r!==p&&W(b,r,a,k.bind(a,w,n+1,r),t))}else l(-e.get(r)),f.get(r).delete(d+p),0===f.get(r).size&&(e.delete(r),f.delete(r),b.F(r,a,t))};return(l,n,p)=>k(l,0,'origin',n,p)}class el extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.F=c;this.C=d;this.O=new Map;this.G=new Map}ha(){return`${this.X()}, ${this.Ga()}, ${this.F}, ${this.C}`}}olympe.dc.$.
|
|
870
|
-
this.G.has(k)?(c.update(olympe.D.ea.F),f()):(h=new gl(k,olympe.dc.CloudObject.extendRel),e.push(h),W(d,h.tag,h.relation,g,h.id))}};a=new gl(b,olympe.dc.CloudObject.modelRel);e.push(a);W(d,a.tag,a.relation,g,a.id);c.getContext().onDestroy(f);return c.rb()}ha(){return'{"c":"'+this.
|
|
871
|
-
S('olympe.dc.predicates.InstanceOf',olympe.dc.$.
|
|
872
|
-
')'}};S('olympe.dc.predicates.Or',olympe.dc.$.
|
|
873
|
-
']}'}toString(){const a=Zk(this.G);return'Regex('+this.source.toString()+','+this.
|
|
874
|
-
[];null!==this.
|
|
875
|
-
function kl(a,b,c,d,e){const f=Object.create(null),g=a.oa,h=a.
|
|
876
|
-
olympe.dc.
|
|
877
|
-
g)}null!==e.G&&hl(e.G,this.T)}}this.ba&&this.ba(this.T)}}
|
|
878
|
-
class nl extends olympe.dc.
|
|
879
|
-
function ol(a,b){if(!b.
|
|
880
|
-
function pl(a){const b=a.oa;a.F.sort((c,d)=>b(c.
|
|
881
|
-
olympe.dc.
|
|
882
|
-
this.
|
|
883
|
-
a.position;a<c;a++)b[a]=b[a+1],b[a].position=a;b.length=c}}};olympe.dc.
|
|
884
|
-
function ul(a,b){const c=a.G[b];void 0!==c?(a.H&&a.H.debug('Set current block to',b,null!==c.G?'parent = '+c.G.V():''),a.C=c):a.H&&a.H.error('Try to set a block that does not exists:',b)}function vl(a){const b=String(++a.T),c=a.C;a.G[b]=new wl(b,c);xl(c,b);c.
|
|
885
|
-
olympe.dc.
|
|
886
|
-
class wl{constructor(a,b){this.id=a;this.G=b||null;this.C=this.T=this.
|
|
887
|
-
function Bl(a,b,c){const d=c.getContext(),e=olympe.dc.
|
|
888
|
-
olympe.dc.$a.
|
|
889
|
-
b=this.F||b;null!==this.da?Al(a,b,this.da,d=>{Bl(this,d,c)}):Bl(this,b,c);return c.rb()}ha(a){const b=$k(a,this.
|
|
890
|
-
b);break;case olympe.dm.Boolean.P.X():d=new olympe.dc.$a
|
|
891
|
-
d(g,h,k,!1),delete e[h]}}ha(a){return'{"c":"'+this.
|
|
892
|
-
u,w,f,g);c(!0,z,A,C)},y.
|
|
893
|
-
'","'+this.G.toString()+'"]}'}toString(){return'FirstRelated('+this.F.toString()+', '+this.G.toString()+')'}};S('olympe.dc.transformers.FirstRelated',olympe.dc.da.
|
|
894
|
-
this.
|
|
895
|
-
olympe.dc.da.
|
|
896
|
-
{d.F(g,l,h)})}}ha(){return'{"c":"'+this.
|
|
897
|
-
q,r,h,k||g);null===k&&b.register(y,q,r,h,f)}}},n=(p,q,r,t,u,w)=>{u&&!b.F&&l(p,t,w);p>=this.G?c(u,w,t,Xk(r,u,w,t)):tl(b,t,w,h,k);0<=this.F&&p>=this.F||(u?e[w]||(e[w]=!0,W(d,w,this,(y,z)=>{const A=p+1,C=olympe.Y.
|
|
898
|
-
S('olympe.dc.transformers.RecursiveRelated',olympe.dc.da.
|
|
899
|
-
this.
|
|
900
|
-
')'}};S('olympe.dc.transformers.Sort',olympe.dc.da.
|
|
901
|
-
olympe.dc.da.
|
|
902
|
-
u.
|
|
903
|
-
S('olympe.dc.transformers.Union',olympe.dc.da.
|
|
904
|
-
olympe.dc.CloudObject=class{constructor(a,b){this.tag=b;this.db=olympe.dc.
|
|
905
|
-
b,c){if('undefined'===typeof olympe.sc)throw Error('Method CloudObject.createWith should only be used at runtime, when sc package exists');const d=olympe.dc.
|
|
906
|
-
olympe.dc.CloudObject.propertyRel).map(a=>new olympe.dc.Ma.Property(a))}static
|
|
907
|
-
(this.model=olympe.dc.CloudObject.get(this.db.model(this)));return this.model}query(){return olympe.dc.pa.from(this)}
|
|
908
|
-
{const f=this.db.
|
|
909
|
-
this.tag,d)})}
|
|
910
|
-
d.update(f)}));d.getContext().onDestroy(()=>
|
|
911
|
-
b){a=a instanceof olympe.dc.da.
|
|
912
|
-
Object.assign({'#tag':this.X(),'#type':this.Ec().name()},this.Jc(!0,!0)):{'#tag':this.X(),'#error':'The object does not exist in the local database.'}}Jc(a=!1,b=!0){const c={};this.db.Cb(this,b).forEach((d,e)=>{this.db.Fa(e)&&(e=a?this.db.name(e):e,c[e]=d instanceof olympe.dc.Bc?
|
|
913
|
-
this.db;let c=!1;if(void 0===a||null===a)a=new olympe.dc.Wa,c=!0;const d=olympe.dc.ua.ORIGIN;for(const [e,f,g]of
|
|
914
|
-
olympe.dc.CloudObject.prototype.follow=olympe.dc.CloudObject.prototype.
|
|
915
|
-
olympe.dc.CloudObject.prototype.getModelTag=olympe.dc.CloudObject.prototype.
|
|
916
|
-
olympe.dc.CloudObject.getInstancesOf=olympe.dc.CloudObject.
|
|
917
|
-
olympe.dc.CloudObject.get=olympe.dc.CloudObject.get;olympe.dc.CloudObject.P=olympe.dc.na.C('ff021000000000000001',olympe.dc.CloudObject);olympe.dc.CloudObject.
|
|
918
|
-
olympe.dc.CloudObject.
|
|
919
|
-
olympe.dc.CloudObject.modelRel=olympe.dc.CloudObject.P.sa(olympe.dc.qc
|
|
920
|
-
olympe.dc.CloudObject.extendedByRel=U(olympe.dc.CloudObject.P,olympe.dc.CloudObject.extendRel);
|
|
921
|
-
|
|
922
|
-
m.
|
|
923
|
-
m.
|
|
924
|
-
olympe.W.config(function(a){const b='object'===typeof window;
|
|
925
|
-
|
|
926
|
-
olympe.W.run([olympe.dc.db.R.Ha,olympe.dc.transaction.R.Ha,olympe.dc.R.
|
|
927
|
-
olympe.dm.
|
|
928
|
-
|
|
929
|
-
olympe.dm.User.SAMLnameIdProp=olympe.dm.User.P.
|
|
930
|
-
m.
|
|
931
|
-
olympe.dm.BrickMetadata.
|
|
932
|
-
m.
|
|
933
|
-
function
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
{
|
|
937
|
-
})}
|
|
938
|
-
|
|
939
|
-
olympe.dm.DataSource.prototype.
|
|
940
|
-
olympe.dm.DataSource.
|
|
941
|
-
olympe.dm.
|
|
942
|
-
olympe.dm.
|
|
943
|
-
olympe.dm.
|
|
944
|
-
olympe.dm.Module.
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
olympe.dm.File.
|
|
948
|
-
olympe.dm.File.
|
|
949
|
-
olympe.dm.File.
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
olympe.dm.
|
|
954
|
-
olympe.dm.
|
|
955
|
-
|
|
956
|
-
olympe.dm.
|
|
957
|
-
olympe.dm.Relation.
|
|
958
|
-
|
|
959
|
-
olympe.dm.Enum.P=olympe.dc.na.C('016cdd861b32d56c81f7',olympe.dm.Enum);olympe.dm.Enum.rankProp=olympe.dm.Enum.P.
|
|
960
|
-
olympe.W.config(a=>{
|
|
961
|
-
'olympe.sc');olympe.W.run([olympe.sc.R.
|
|
962
|
-
olympe.sc.
|
|
963
|
-
|
|
964
|
-
olympe.sc.
|
|
965
|
-
olympe.sc.wa=class{constructor(a=olympe.sc.
|
|
966
|
-
b){this.C.set(a,b);return this}
|
|
967
|
-
d.next.bind(d),c?void 0:this.C.V(),!1);this.onDestroy(()=>{f();d.complete()});return f})}repeat(a,b){const c=Jl(this.C,a);a=b.subscribe(d=>{null!==d?this.set(c,d):this.remove(c)});this.Rg(a.unsubscribe.bind(a));return this}
|
|
968
|
-
`on the context ${this.V()}:\nStack: ${this.
|
|
969
|
-
Kl(b,0,this.
|
|
970
|
-
Nl(this.C,a);return null!==a?new olympe.sc.ui.
|
|
971
|
-
f?(e=a.model(f),`${a.name(f)||e&&a.name(e)||f} (${e})`):e.V()}).join('\n> ')}catch(c){b=`No stack available for context ${this.V()}: ${c}`,this.H.warn(b)}return b}};olympe.sc.wa.prototype.observeMany=olympe.sc.wa.prototype.
|
|
972
|
-
olympe.sc.wa.prototype.onDestroy=olympe.sc.wa.prototype.onDestroy;olympe.sc.wa.prototype.offClear=olympe.sc.wa.prototype.
|
|
973
|
-
olympe.sc.wa.prototype['throw']=olympe.sc.wa.prototype.throw;olympe.sc.wa.prototype.waitFor=olympe.sc.wa.prototype.
|
|
974
|
-
olympe.sc.wa.prototype.set=olympe.sc.wa.prototype.set;olympe.sc.wa.prototype.getClosest=olympe.sc.wa.prototype.
|
|
975
|
-
function Ll(a,b){if(null===a.
|
|
976
|
-
function Ml(a,b){if(b===a.id||a.T.has(b)||!b)return a;for(a=a.
|
|
977
|
-
function Ul(a,b){if(null===a.Za||!a.Za.has(b))return!1;const {
|
|
978
|
-
function Vl(a){a.C.Z(()=>{Tl(a,c=>c.destroy())});a.C.onDestroy(()=>{void 0!==a.
|
|
979
|
-
function Rl(a,b){if(null===a)return null;if(a.has(b))return a.get(b);for(const c of a.values())if(c.oa&&!c.id.startsWith('_')&&(a=Rl(c.F,b)))return a;return null}function Xl(a,b,...c){if(null!==a.Za)for(const {
|
|
980
|
-
function $l(a){a.
|
|
981
|
-
function Hl(a,b,c){a.O.add(b);let d,e;null==(d=a.G)||null==(e=d.get('&'+b))||e.forEach(f=>{f(c)});Tl(a,f=>{f.O.has(b)||Hl(f,b,c)});a.O.delete(b)}function Tl(a,b){let c;null==(c=a.F)||c.forEach(b)}function cm(a,b){a.data.forEach((c,d)=>b(c,d.slice(1)))}function dm(a){var b=olympe.sc.Za.
|
|
982
|
-
olympe.sc.
|
|
983
|
-
(d=this.ba)?void 0:d.get('IO#'+g))?k:g;c='$'+a;var e;d=null!=(e=this.data.get(c))?e:null;b=null!=b?b:null;if(e=!this.O.has(c)){a:{if('function'===typeof(null==b?void 0:b.
|
|
984
|
-
'*';a=bm(this,'@'+f+'.'+e,b);c=c?(c=Ml(this,f))?c.
|
|
985
|
-
b,this));null!==this.Za&&0<this.Za.size&&this.Za.forEach(({
|
|
986
|
-
else return Ol++,b=null!=b?b:String(Ol),null===this.Z&&(this.Z=new Map),this.Z.set(b,a),b;return b||'noId'}
|
|
987
|
-
t])})};b.
|
|
988
|
-
c);this.O.listen().subscribe(e=>{var f=e.body();if(f.t===olympe.sc.Md.C.
|
|
989
|
-
d){const e=[],f=olympe.dc.
|
|
990
|
-
b||void 0===b)return'<null>';const c=olympe.dc.
|
|
991
|
-
'<br> ',f+='Properties:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+' : '+c.
|
|
870
|
+
{e.set(r,(e.get(r)||0)+y);l(y)},q,r),(0>a.C||n<=a.C)&&r!==p&&W(b,r,a,k.bind(a,w,n+1,r),t))}else l(-e.get(r)),f.get(r).delete(d+p),0===f.get(r).size&&(e.delete(r),f.delete(r),b.F(r,a,t))};return(l,n,p)=>k(l,0,'origin',n,p)}class el extends olympe.dc.query.Relation{constructor(a,b,c,d){super(a,b,1!==c||1!==d);this.F=c;this.C=d;this.O=new Map;this.G=new Map}ha(){return`${this.X()}, ${this.Ga()}, ${this.F}, ${this.C}`}}olympe.dc.$.ll.xa=[olympe.dc.Aa];olympe.dc.$.ci=class{constructor(a){this.G=new Set;a instanceof Array?a.forEach(b=>{this.G.add(olympe.dc.ga(b))}):this.G.add(olympe.dc.ga(a))}la(){return T(olympe.dc.$.ci)}F(){return[]}C(a,b){const c=a.run(()=>Db(olympe.D.fc(olympe.D.ea),olympe.D.ea.C)),d=olympe.dc.ia();let e=[];const f=()=>{e.forEach(h=>{d.F(h.tag,h.relation,h.id)});e=[]},g=(h,k)=>{if(h)if(k===olympe.dc.ga(olympe.dc.CloudObject))c.update(olympe.D.Qb(this.G.has(k))),f();else{for(const l of e)if(l.tag===k)throw Error(`You should never extend a model to itself (${k})`);
|
|
871
|
+
this.G.has(k)?(c.update(olympe.D.ea.F),f()):(h=new gl(k,olympe.dc.CloudObject.extendRel),e.push(h),W(d,h.tag,h.relation,g,h.id))}};a=new gl(b,olympe.dc.CloudObject.modelRel);e.push(a);W(d,a.tag,a.relation,g,a.id);c.getContext().onDestroy(f);return c.rb()}ha(){return'{"c":"'+this.la()+'","a":['+JSON.stringify(Array.from(this.G))+']}'}toString(){return'InstanceOf('+Array.from(this.G).join(', ')+')'}};class gl{constructor(a,b){this.tag=a;this.relation=b;this.id=olympe.Y.Ah()}}
|
|
872
|
+
S('olympe.dc.predicates.InstanceOf',olympe.dc.$.ci);olympe.dc.$.ci.xa=[olympe.dc.Aa];olympe.dc.$.Zd=class{constructor(a){this.G=a}la(){return T(olympe.dc.$.Zd)}F(){return this.G.F()}C(a,b){return a.run(()=>olympe.D.ta([this.G.C(a,b)],c=>olympe.D.Qb(!c.valueOf()),olympe.D.ea))}ha(a){return`{"c":"${this.la()}","a":[${this.G.ha(a)}]}`}toString(){return'Not('+this.G.toString()+')'}};S('olympe.dc.predicates.Not',olympe.dc.$.Zd);olympe.dc.$.Zd.xa=[olympe.dc.Aa];olympe.dc.$.re=class{constructor(a){this.$=[];for(let b=arguments.length,c=0;c<b;c++)Array.isArray(arguments[c])?this.$=this.$.concat(arguments[c]):this.$.push(arguments[c])}la(){return T(olympe.dc.$.re)}F(){return this.$.reduce((a,b)=>a.concat(b.F()),[])}C(a,b){return a.run(()=>olympe.D.ta(this.$.map(c=>c.C(a,b)),(...c)=>olympe.D.Qb(c.some(d=>d.valueOf())),olympe.D.ea))}ha(a){const b=this.$.map(c=>c.ha(a));return'{"c":"'+this.la()+'","a":['+b.join(',')+']}'}toString(){return'Or('+this.$.map(a=>a.toString()).join(',')+
|
|
873
|
+
')'}};S('olympe.dc.predicates.Or',olympe.dc.$.re);olympe.dc.$.re.xa=[olympe.dc.Aa];olympe.dc.$.kf=class{constructor(a,b,c){this.source=a;this.L=b;this.G=void 0===c?!0:c}la(){return T(olympe.dc.$.kf)}F(){return[this.source.C()]}yb(){return this.source}C(a,b){return a.run(()=>olympe.D.ta([this.source.getValue(a,b),this.L,this.G],(c,d,e)=>{c=String(c);d=String(d);e.valueOf()||(c=c.toLowerCase(),d=d.toLowerCase());return olympe.D.Qb((new RegExp(d)).test(c))},olympe.D.ea))}ha(a){const b=this.source.ha(a),c=$k(a,this.L);a=$k(a,this.G);return'{"c":"'+this.la()+'","a":['+b+','+c+','+a+
|
|
874
|
+
']}'}toString(){const a=Zk(this.G);return'Regex('+this.source.toString()+','+this.L+','+a+')'}};S('olympe.dc.predicates.Regex',olympe.dc.$.kf);olympe.dc.$.kf.xa=[olympe.dc.Aa];olympe.dc.$.Rj=class extends olympe.dc.$.Ek{constructor(a,b){super(a,b)}la(){return T(olympe.dc.$.Rj)}O(a,b){return a<b}};S('olympe.dc.predicates.Smaller',olympe.dc.$.Rj);olympe.dc.kc={};olympe.dc.kc.Zi=class{constructor(){this.T=this.L=this.index=this.F=null}O(){return null!==this.F}Z(a){if(null!==this.F)throw Error('Manager already activated (depth='+this.F+')');this.F=a;this.G()}C(a,b,c){b=this.L;if(a&&null!==b)throw Error('The AutoManger handles only a single item.');a?(b=new olympe.dc.kc.ij(this),this.index=c,this.L=b):this.L=this.index=null;return b}G(){if(null===this.F)throw Error('Manager not activated, need to set a depth before updating ranks');if(null!==this.T){const a=
|
|
875
|
+
[];null!==this.L&&(0<=this.F?hl(il(this.L,this.F),a):a.push(this.index));this.T(a)}}Yf(a){this.T=a}};olympe.dc.kc.Zi.xa=[olympe.dc.kc.Ta];function Xk(a,b,c,d){b?a.O[d]=c:delete a.O[d];null===a.F&&(a.F=new olympe.dc.kc.ij(a.C,a));return a.F}function il(a,b){for(let c=0;c<b;c++)if(null!==a.F)a=a.F;else break;return a}function hl(a,b){a=a.O;if(null!==a)for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c)}olympe.dc.kc.ij=class{constructor(a,b){this.C=a;this.depth=b?b.depth+1:0;this.O=Object.create(null);this.F=null}he(){return this.C}Pf(){this.C.O()?this.C.G():this.C.Z(this.depth-1)}};class jl extends olympe.dc.kc.ij{constructor(a,b,c){super(a);this.index=b;this.tag=c;this.Z=this.T=this.L=!1;this.G=null}}
|
|
876
|
+
function kl(a,b,c,d,e){const f=Object.create(null),g=a.oa,h=a.L;let k,l,n;a.fa=!0;l=0;for(n=g.length;l<n;l++)f[g[l]]=null;g.length=0;l=c;for(n=Math.min(b.length,d);l<n;l++)k=b[l],c=h[k],void 0!==c&&(delete f[k],g.push(k),c.L||(c.L=!0,e(!0,c.tag,c.index,c)));for(k in f)Object.prototype.hasOwnProperty.call(f,k)&&(c=h[k],c.L&&(c.L=!1,e(!1,c.tag,c.index,c)),c.T&&(c.G=null,delete h[k]),delete f[k]);a.fa=!1;null!==a.F&&a.G()}
|
|
877
|
+
olympe.dc.kc.xl=class{constructor(){this.L={};this.oa=[];this.F=null;this.fa=!1;this.T=[];this.ba=null}O(){return null!==this.F}Z(a){if(null!==this.F)throw Error('Manager already activated (depth='+this.F+')');this.F=a;this.G()}G(){if(null===this.F)throw Error('Manager not activated, need to set a depth before updating ranks');if(!this.fa){var a=this.oa,b=a.length,c=this.L,d;for(d=this.T.length=0;d<b;d++){var e=c[a[d]];if(0>this.F)this.T.push(e.index);else{if(!e.Z){var f=e,g=this.F;f.Z=!0;f.G=il(f,
|
|
878
|
+
g)}null!==e.G&&hl(e.G,this.T)}}this.ba&&this.ba(this.T)}}Yf(a){this.ba=a}C(a,b,c){let d=this.L[c];a?void 0===d?(d=new jl(this,c,b),this.L[c]=d):(d.tag=b,d.T=!1):void 0!==d&&(d.T=!0);return d}};olympe.dc.kc.xl.xa=[olympe.dc.kc.Ta];olympe.dc.kc.Ta=class{constructor(){}C(){}O(){}Z(){}G(){}Yf(){}};function ll(a,b){olympe.D.We(a.value)?(a.node=olympe.D.Tm(a.value,b),jb(a.node)||b()):b()}function ml(a,b){if(olympe.D.We(a.value)){const c=olympe.D.Xa(),d=a.L;olympe.D.Gc([a.value],e=>{d!==e.valueOf()&&(c.run(()=>ll(a,b)),olympe.D.Xa().destroy())})}}
|
|
879
|
+
class nl extends olympe.dc.kc.ij{constructor(a,b,c){super(a);this.index=b;this.value=c;this.L=this.Ra();this.position=this.node=null;this.T=!1;this.G=null}Ra(){const a=olympe.D.Ra(this.value);return a?a.valueOf():a}destroy(){this.node&&(this.node.destroy(),this.node=null);this.G=this.value=null}eb(){return null===this.value}}
|
|
880
|
+
function ol(a,b){if(!b.eb()){var c=a.F;var d=a.oa,e=b.Ra(),f=0;let g=c.length,h=0,k;for(null!==b.position&&--g;g>f;){h=Math.floor((f+g)/2);k=d(c[h].L,e);if(0===k||2>g-f){0>k&&null!==b.position&&b.position<=h&&(k=d(c[g].L,e));h=0>k?g:h;break}0>k?f=h:g=h}c=h;b.L=b.Ra();if(c!==b.position){d=a.F;e=d.length;f=b.position;null===f&&(f=e);if(c<f)for(e=f;e>c;e--)d[e]=d[e-1],d[e].position=e;else for(e=f;e<c;e++)d[e]=d[e+1],d[e].position=e;d[c]=b;d[c].position=c;b.T&&a.G()}}}
|
|
881
|
+
function pl(a){const b=a.oa;a.F.sort((c,d)=>b(c.Ra(),d.Ra()))}
|
|
882
|
+
olympe.dc.kc.zq=class{constructor(a){this.oa=a;this.L=null;this.F=[];this.T=[];this.ba=null;this.fa=new Map}C(a,b,c,d){b='$'+c;const e=this.F;let f;if(a)f=new nl(this,c,d),this.fa.set(b,f),this.O()?ll(f,()=>ol(this,f)):(f.position=e.length,e.push(f));else{f=this.fa.get(b);if(void 0===f)throw Error('Trying to remove an non-registered item: "'+c+'"');this.fa.delete(b);null!==f.position&&(this.O()?this.remove(f):delete e[f.position]);f.destroy()}return f}O(){return null!==this.L}Z(a){if(null!==this.L)throw Error('Manager already activated (depth='+
|
|
883
|
+
this.L+')');this.L=a;pl(this);for(let b=0,c=this.F.length;b<c;b++){const d=this.F[b];d.position=b;ml(d,()=>ol(this,d))}this.G()}G(){if(null===this.L)throw Error('Manager not activated, need to set a depth before updating ranks');const a=this.F.length;this.T.length=0;for(let d=0;d<a;d++){let e=this.F[d];if(!e.T){var b=e,c=this.L;b.T=!0;b.G=il(b,c)}0>this.L?this.T.push(e.index):e.G&&hl(e.G,this.T)}this.ba&&this.ba(this.T)}Yf(a){this.ba=a}remove(a){const b=this.F,c=b.length-1;if(null!==a.position){for(a=
|
|
884
|
+
a.position;a<c;a++)b[a]=b[a+1],b[a].position=a;b.length=c}}};olympe.dc.kc.zq.xa=[olympe.dc.kc.Ta];function Sk(a){if(!a.F){for(let b in a.G)ql(a.G[b]);a.F=!0}a.L=null;a.O=null}function Vk(a,b,c){a.G[c||'root'].T=b}function Wk(a,b,c){a.G[c||'root'].Pf(b)}function rl(a,b,c,d){const e=a.O,f=b+d+c;let g=e[f];void 0===g&&(g=ig(a.db,b,c,d),e[f]=g);return g}function sl(a,b){a.F||a.C.Pf(b)}function tl(a,b,c,d,e){if(!a.F){let f=rl(a,c,d,e||olympe.dc.ua.DESTINATION);e||(f+=rl(a,c,d,olympe.dc.ua.ORIGIN));0===f&&sl(a,b)}}
|
|
885
|
+
function ul(a,b){const c=a.G[b];void 0!==c?(a.H&&a.H.debug('Set current block to',b,null!==c.G?'parent = '+c.G.V():''),a.C=c):a.H&&a.H.error('Try to set a block that does not exists:',b)}function vl(a){const b=String(++a.T),c=a.C;a.G[b]=new wl(b,c);xl(c,b);c.L||(c.L=()=>ul(a,c.V()));return b}function yl(a,b){const c=a.C;a.C.L=()=>{ul(a,c.V());b()}}function zl(a,b){ql(b?a.G[b]:a.C)}
|
|
886
|
+
olympe.dc.kc.Bq=class{constructor(a,b){this.db=a;this.H=b||null;this.L=Object.create(null);this.O=Object.create(null);this.F=!1;this.T=0;this.C=new wl('root');this.G=Object.create(null);this.G.root=this.C}register(a,b,c,d,e){this.F||(null!==b&&c&&d&&e?(c=rl(this,c,d,e),d=this.L[b]||0,this.L[b]=++d,this.C.C===b&&c<=d&&(this.C.C=a)):this.C.C=a)}};function xl(a,b){null===a.F&&(a.F=Object.create(null));a.F[b]=!1}function ql(a){a.O=!0;null!==a.G&&a.G.notify(a.id)}
|
|
887
|
+
class wl{constructor(a,b){this.id=a;this.G=b||null;this.C=this.T=this.L=this.F=null;this.O=!1}V(){return this.id}Pf(a){const b=this.T;if(this.O||this.C===a||null===a)b&&b(),!b&&ql(this)}notify(a){const b=this.L,c=this.F;if(this.O)b&&b();else if(!c[a]){a=c[a]=!0;for(let d in c)if(!c[d]){a=!1;break}a&&b&&b()}}};olympe.dc.$a={};function Al(a,b,c,d){const e=olympe.dc.ia(),f=new olympe.dc.kc.Zi,g=new olympe.dc.kc.Bq(e);let h=!1;const k=Object.create(null),l=q=>{if(0<q.length)for(const r in k)q[0]===r&&d(k[r])};let n=(q,r,t,u)=>{a.Wc()||a.eb()||(h||(Vk(g,()=>{u.Pf();Sk(g)}),u.he().Yf(l),h=!0),q?k[t]=r:delete k[t],Wk(g,t))};if(null!==c)for(let q=c.length-1;0<=q;q--)n=c[q].C(a,g,n);const p=olympe.Y.Fc();Fe(e,b,(q,r)=>{g.register(p,null);const t=f.C(q,b,p,null);n(q,r,p,Xk(t,q,b,p))},p);a.onDestroy(()=>{Ee(e,b,p)});e.Fa(b)||Sk(g)}
|
|
888
|
+
function Bl(a,b,c){const d=c.getContext(),e=olympe.dc.ia(),f=a.G(),g=Uf(e,b,a.L,d.G(h=>{null!==h&&(h=f(h));null===h?c.clear():c.update(h)}));d.onDestroy(()=>Vf(e,b,a.L,g))}
|
|
889
|
+
olympe.dc.$a.Nh=class{constructor(a,b,c){this.L=a&&a.X?a.X():a;this.da=b&&b.filter(d=>d instanceof olympe.dc.da.Le||d instanceof olympe.dc.da.se)||null;this.F=c||null;this.defaultValue=null}la(){}Nb(){}G(){}C(){return(this.da||[]).reduce((a,b)=>a.concat(olympe.dc.query.Relation.from(b)),[])}Sg(a){this.defaultValue=a;return this}Lg(){return this.da}Pd(){return this.F}getValue(a,b){const c=a.run(()=>olympe.D.fc(this.Nb()||Object,'AbstractProperty valueType'));null!==this.defaultValue&&Db(c,this.defaultValue);
|
|
890
|
+
b=this.F||b;null!==this.da?Al(a,b,this.da,d=>{Bl(this,d,c)}):Bl(this,b,c);return c.rb()}ha(a){const b=$k(a,this.L),c=$k(a,this.F);let d='null';this.da&&(d=this.da.map(function(e){return e.ha(a)}).join(','));return`{"c":"${this.la()}","a":["${b}",${d},${c}]}`}toString(){const a=Zk(this.L),b=this.F?','+Zk(this.F):'';let c='';this.da&&(c=','+this.da.join(','));return this.la().replace(/^.+\./,'')+'('+a+c+b+')'}};olympe.dc.$a.Nh.xa=[olympe.dc.Wj];olympe.dc.$a.qn=class{constructor(a,b){if(olympe.D.We(a))throw Error('Dataflows of Property not supported by AnyProperty');const c=a.X();var d=olympe.dc.ia();const e=d.Pb(a,olympe.dm.Property.typeRel);if(!e)throw Error('Type of property '+a+'unavailable locally, cannot proceed with AnyProperty');a=d.Jg(e,olympe.dc.CloudObject.extendRel,olympe.dm.Ke);d=null;switch(1<a.length?a[a.length-2]:e){case olympe.dm.String.P.X():d=new olympe.dc.$a.ri(c,b);break;case olympe.dm.Number.P.X():d=new olympe.dc.$a.ji(c,
|
|
891
|
+
b);break;case olympe.dm.Boolean.P.X():d=new olympe.dc.$a.$i(c,b);break;case olympe.dm.DateTime.P.X():d=new olympe.dc.$a.Sh(c,b)}this.F=d}la(){return this.F.la()}C(){return this.F.C()}getValue(a,b){return this.F.getValue(a,b)}ha(a){return this.F.ha(a)}toString(){return this.F.toString()}};olympe.dc.$a.qn.xa=[olympe.dc.Wj];olympe.dc.$a.$i=class extends olympe.dc.$a.Nh{constructor(a,b,c){super(a,b,c)}la(){return T(olympe.dc.$a.$i)}G(){return olympe.dc.Lb.pm}Nb(){return olympe.D.ea}};S('olympe.dc.valuedefs.BooleanProperty',olympe.dc.$a.$i);olympe.dc.$a.De=class{constructor(a){this.value=a}la(){return T(olympe.dc.$a.De)}C(){return[]}getValue(){return this.value}ha(a){a=$k(a,this.value);return`{"c":"${this.la()}","a":[${a}]}`}toString(){return`Constant(${Zk(this.value)})`}};S('olympe.dc.valuedefs.Constant',olympe.dc.$a.De);olympe.dc.$a.De.xa=[olympe.dc.Wj];olympe.dc.$a.Sh=class extends olympe.dc.$a.Nh{constructor(a,b,c){super(a,b,c)}la(){return T(olympe.dc.$a.Sh)}G(){return olympe.dc.Lb.qm}Nb(){return olympe.D.gb}};S('olympe.dc.valuedefs.DateTimeProperty',olympe.dc.$a.Sh);olympe.dc.$a.ji=class extends olympe.dc.$a.Nh{constructor(a,b,c){super(a,b,c)}la(){return T(olympe.dc.$a.ji)}G(){return olympe.dc.Lb.sm}Nb(){return olympe.D.aa}};S('olympe.dc.valuedefs.NumberProperty',olympe.dc.$a.ji);olympe.dc.$a.ri=class extends olympe.dc.$a.Nh{constructor(a,b,c){super(a,b,c)}la(){return T(olympe.dc.$a.ri)}G(){return olympe.dc.Lb.tm}Nb(){return olympe.D.Na}};S('olympe.dc.valuedefs.StringProperty',olympe.dc.$a.ri);olympe.dc.$a.ti=class{la(){return T(olympe.dc.$a.ti)}C(){return[]}getValue(a,b){return b}ha(){return'{"c":"'+this.la()+'","a":[]}'}toString(){return'Tag()'}};S('olympe.dc.valuedefs.Tag',olympe.dc.$a.ti);olympe.dc.$a.ti.xa=[olympe.dc.Wj];olympe.dc.da={};olympe.dc.da.Th=class{Nb(){return null}la(){return T(olympe.dc.da.Th)}C(a,b,c){const d={};return function(e,f,g,h){e?void 0===d[f]?(d[f]=1,b.C.C!==g||b.F||(b.C.C=f),c(!0,f,f,Xk(h,!0,f,f))):(d[f]++,sl(b,g)):void 0!==d[f]&&0>=--d[f]&&(delete d[f],c(!1,f,f,Xk(h,!1,f,f)))}}ha(){return'{"c":"'+this.la()+'"}'}toString(){return'Distinct()'}};S('olympe.dc.transformers.Distinct',olympe.dc.da.Th);olympe.dc.da.Th.xa=[olympe.dc.mf];olympe.dc.da.cf=class{constructor(a){this.F=a}Nb(){return null}la(){return T(olympe.dc.da.cf)}G(){return this.F.F()}C(a,b,c){function d(f,g,h,k){k=k.valueOf();!1===k&&sl(b,g);k!==!!e[g]&&(e[g]=k,c(k,f,g,Xk(h,k,f,g)))}const e={};return(f,g,h,k)=>{const l='@'+h;if(f){let n=this.F.C(a,g);olympe.D.fb(n)&&(n=n.Da);olympe.D.yf(n)?(b.F||void 0!==olympe.D.Ra(n)||sl(b,h),e[l]=n,a.run(()=>{olympe.D.Gc([n],p=>{d(g,h,k,p)},'filterResultHandler')})):d(g,h,k,n)}else void 0!==e[l]&&(e[l].destroy(),delete e[l]),
|
|
892
|
+
d(g,h,k,!1),delete e[h]}}ha(a){return'{"c":"'+this.la()+'","a":['+this.F.ha(a)+']}'}toString(){return'Filter('+this.F.toString()+')'}};S('olympe.dc.transformers.Filter',olympe.dc.da.cf);olympe.dc.da.cf.xa=[olympe.dc.mf,olympe.dc.Qp];olympe.dc.da.el=class{constructor(a,b,c,d){this.F=new olympe.dc.Ma.Relation(olympe.dc.ga(a),c||olympe.dc.ua.DESTINATION);this.G=new olympe.dc.Ma.Relation(olympe.dc.ga(b),d||olympe.dc.ua.DESTINATION)}Nb(){return $e(this.F)}la(){return T(olympe.dc.da.el)}C(a,b,c){const d=olympe.dc.ia(),e={},f=this.F.X(),g=this.F.Ga(),h=this.G.X(),k=this.G.Ga();let l=null,n=null;const p=(r,t,u,w,y,z)=>{if(y){if(y=()=>{const A=olympe.Y.vb(u+g+(f+'_'+r)+z,20),C=Xk(t,!0,z,A);l=r;n=()=>{c(!1,z,A,Xk(t,!1,z,A))};b.register(A,
|
|
893
|
+
u,w,f,g);c(!0,z,A,C)},y.tr=r,e[w]=y,null===l||r<l)n&&n(),y()}else if(l===r){n();e[w]=!0;y=Infinity;let A=null;for(let C=Object.keys(e),M=C.length,K=0;K<M;K++){let ta=e[C[K]];ta.tr<y&&(y=ta.tr,A=ta)}A&&A()}},q=(r,t,u,w,y)=>{w?e[y]||(e[y]=!0,tl(b,u,y,f,g),tl(b,u,y,h,k),W(d,y,this.F,p.bind(this,r,t,u,y),u+'_val'),W(d,y,this.G,q.bind(this,r+1,t,u),u+'_follow')):(d.F(y,this.G,u+'_follow'),d.F(y,this.F,u+'_val'),delete e[y])};return(r,t,u,w)=>q(0,w,u,r,t)}ha(){return'{"c":"'+this.la()+'","a":["'+this.F.toString()+
|
|
894
|
+
'","'+this.G.toString()+'"]}'}toString(){return'FirstRelated('+this.F.toString()+', '+this.G.toString()+')'}};S('olympe.dc.transformers.FirstRelated',olympe.dc.da.el);olympe.dc.da.el.xa=[olympe.dc.mf];olympe.dc.da.dh=class{constructor(a,b){this.start=a;this.F=b}Nb(){return null}la(){return T(olympe.dc.da.dh)}C(a,b,c){const d=new olympe.dc.kc.xl;let e,f,g,h=!1;const k=()=>{if(void 0!==f&&void 0!==g&&void 0!==e){var n=f+g;b.F||(b.C.C=e[0>n-1?0:Math.min(e.length,n)-1]);kl(d,e,f,n,c)}};a.run(()=>olympe.D.Gc([this.start,this.F],(n,p)=>{f=n.valueOf();g=p.valueOf();k()}));yl(b,k);const l=vl(b);ul(b,l);return(n,p,q,r)=>{h||(r.he().Yf(t=>{e=t;zl(b,l)}),Vk(b,()=>r.Pf(),l),h=!0);d.C(n,p,q,null);Wk(b,q,l)}}ha(a){return'{"c":"'+
|
|
895
|
+
this.la()+'","a":['+$k(a,this.start)+','+$k(a,this.F)+']}'}toString(){return`Limit(${olympe.D.Ra(this.start)},${olympe.D.Ra(this.F)})`}};S('olympe.dc.transformers.Limit',olympe.dc.da.dh);olympe.dc.da.dh.xa=[olympe.dc.mf];function Cl(a){return a.mb.map(b=>b.X())}
|
|
896
|
+
olympe.dc.da.tj=class{constructor(a,b){this.direction=b||olympe.dc.ua.DESTINATION;this.mb=a.map(c=>new olympe.dc.Ma.Relation(c,this.direction))}Nb(){return olympe.dc.CloudObject}la(){return T(olympe.dc.da.tj)}Ga(){return this.direction}C(a,b,c){const d=olympe.dc.ia(),e=(f,g,h,k)=>W(d,f,k,(l,n)=>{var p=k.X();p=olympe.Y.vb(g+k.Ga()+p+n,20);const q=Xk(h,l,n,p);l&&b.register(p,g,f,k.X(),k.Ga());c(l,n,p,q)},g);return(f,g,h,k)=>{f?this.mb.forEach(l=>{tl(b,h,g,l.X(),l.Ga());e(g,h,k,l)}):this.mb.forEach(l=>
|
|
897
|
+
{d.F(g,l,h)})}}ha(){return'{"c":"'+this.la()+'","a":['+JSON.stringify(Cl(this))+',"'+this.direction+'"]}'}toString(){return'MultiRelated('+this.Ga()+'['+Cl(this).join(',')+'])'}};S('olympe.dc.transformers.MultiRelated',olympe.dc.da.tj);olympe.dc.da.tj.xa=[olympe.dc.mf];olympe.dc.da.se=class extends olympe.dc.Ma.Relation{constructor(a,b=olympe.dc.ua.DESTINATION,c=1,d=-1){super(a,b);this.G=c;this.F=d}Nb(){return $e(this)}la(){return T(olympe.dc.da.se)}C(a,b,c){const d=olympe.dc.ia(),e=Object.create(null),f=olympe.dc.ua.ORIGIN,g=olympe.dc.ua.DESTINATION,h=this.X(),k=this.Ga(),l=(p,q,r)=>{if(!(0<=this.F&&p>=this.F)){var t=d.bb(r,this);p+=1;for(let u=0,w=t.length;u<w;u++){if(void 0!==e[t[u]]||r===t[u])continue;const y=olympe.Y.vb(q+k+(h+'_'+p)+t[u],20);b.register(y,
|
|
898
|
+
q,r,h,k||g);null===k&&b.register(y,q,r,h,f)}}},n=(p,q,r,t,u,w)=>{u&&!b.F&&l(p,t,w);p>=this.G?c(u,w,t,Xk(r,u,w,t)):tl(b,t,w,h,k);0<=this.F&&p>=this.F||(u?e[w]||(e[w]=!0,W(d,w,this,(y,z)=>{const A=p+1,C=olympe.Y.vb(t+k+(h+'_'+A)+z,20);n(A,w,r,C,y,z)},t)):(d.F(w,this,t),delete e[w]))};return(p,q,r,t)=>n(0,null,t,r,p,q)}ha(){return'{"c":"'+this.la()+'","a":["'+this.X()+'","'+this.Ga()+'",'+this.G+','+this.F+']}'}toString(){return'RecursiveRelated('+this.Ga()+this.X()+'['+this.G+'..'+this.F+'])'}};
|
|
899
|
+
S('olympe.dc.transformers.RecursiveRelated',olympe.dc.da.se);olympe.dc.da.se.xa=[olympe.dc.mf];olympe.dc.da.Le=class extends olympe.dc.Ma.Relation{constructor(a,b){super(a,b||olympe.dc.ua.DESTINATION)}Nb(){return $e(this)}la(){return T(olympe.dc.da.Le)}Vb(){return new olympe.dc.da.Le(this.tag,this.direction===olympe.dc.ua.DESTINATION?olympe.dc.ua.ORIGIN:olympe.dc.ua.DESTINATION)}C(a,b,c){const d=olympe.dc.ia(),e=this.X(),f=this.Ga();return(g,h,k,l)=>{tl(b,k,h,e,f);g?W(d,h,this,(n,p)=>{const q=olympe.Y.vb(k+f+e+p,20),r=Xk(l,n,p,q);n&&b.register(q,k,h,e,f);c(n,p,q,r)},k):d.F(h,this,k)}}ha(){return'{"c":"'+
|
|
900
|
+
this.la()+'","a":["'+this.X()+'","'+this.Ga()+'"]}'}toString(){return'Related('+this.Ga()+this.X()+')'}};S('olympe.dc.transformers.Related',olympe.dc.da.Le);olympe.dc.da.Le.xa=[olympe.dc.mf];olympe.dc.da.vg=class{constructor(a,b){this.Fb=a;this.F=void 0===b?!0:!!b}Nb(){return null}la(){return T(olympe.dc.da.vg)}Fg(){return this.Fb}G(){return[this.Fb.L()]}C(a,b,c){const d=new olympe.dc.kc.zq(a.G(this.F?this.Fb.compare.bind(this.Fb):(e,f)=>this.Fb.compare(f,e)));return(e,f,g)=>{var h=e?this.Fb.G(a,f):void 0;h=d.C(e,f,g,h);c(e,f,g,h)}}ha(a){return'{"c":"'+this.la()+'","a":['+this.Fb.ha(a)+','+JSON.stringify(this.F)+']}'}toString(){return'Sort('+this.Fb.toString()+','+JSON.stringify(this.F)+
|
|
901
|
+
')'}};S('olympe.dc.transformers.Sort',olympe.dc.da.vg);olympe.dc.da.vg.xa=[olympe.dc.mf,olympe.dc.Qp];function Dl(a,b,c,d,e,f){function g(n,p){if(l)for(var q=l.length-1;0<=q;q--)f=l[q].C(b,e,f);e.register(h,null);q=d.C(n,p,c,null);f(n,p,h,Xk(q,n,p,h))}const h=olympe.Y.Fc(),k=olympe.dc.ia(),l=a.da;b.run(()=>olympe.D.Gc([a.F],n=>{El(k,n,g,h);void 0===k.model(n)&&Sk(e)}))}function El(a,b,c,d){const e=b&&b.valueOf();e&&(Fe(a,e,c,d),olympe.D.Xa().Z(()=>Ee(a,e,d)))}
|
|
902
|
+
olympe.dc.da.nf=class{constructor(a,b){this.da=this.F=null;a instanceof olympe.dc.ya?(this.F=a.Pd(),this.da=a.sl()):(this.F=a,b&&(this.da=b))}Nb(){return null}la(){return T(olympe.dc.da.nf)||''}Lg(){return this.da}Pd(){return this.F}C(a,b,c){const d=new olympe.dc.kc.xl,e=new olympe.dc.kc.Zi;let f=[],g=[],h=!1,k=!1;const l=vl(b),n=vl(b);yl(b,()=>{const p=f.concat(g);0<p.length?b.F||(b.C.C=p[p.length-1]):zl(b);kl(d,p,0,p.length,c)});ul(b,n);Dl(this,a,this.F,e,b,(p,q,r,t)=>{const u=olympe.D.Xa();u.Wc()||
|
|
903
|
+
u.eb()||(k||(t.he().Yf(w=>{g=w;zl(b,n)}),Vk(b,()=>t.Pf(),n),k=!0),d.C(p,q,r),Wk(b,r,n))});ul(b,l);return(p,q,r,t)=>{h||(t.he().Yf(u=>{f=u;zl(b,l)}),Vk(b,()=>t.Pf(),l),h=!0);d.C(p,q,r,l);Wk(b,r,l)}}ha(a){const b=this.da?'['+this.da.map(c=>c.ha(a)).join(',')+']':'null';return'{"c":"'+this.la()+'","a":['+$k(a,this.F)+','+b+']}'}toString(){const a=olympe.D.fb(this.F)?'N:'+this.F.Da.V():this.F.valueOf(),b=this.da?','+this.da.map(c=>c.toString()).join(','):'';return'Union('+a+b+')'}};
|
|
904
|
+
S('olympe.dc.transformers.Union',olympe.dc.da.nf);olympe.dc.da.nf.xa=[olympe.dc.mf];olympe.dc.da.gq={uz:1,Qs:-1,Ps:0};olympe.dc.da.SA={$x:!0,Cy:!1};olympe.dc.vc.R={hp:'dc.legacy.listdefProcessor'};olympe.W.config(a=>{E(a,olympe.dc.vc.R.hp,olympe.dc.vc.Et,olympe.dc.query.R.Ca,olympe.dc.R.bf,olympe.dc.transaction.R.Ha,olympe.dc.query.R.Ej,new olympe.W.ja(olympe.dc.U.oh))});olympe.W.run([olympe.dc.vc.R.hp],a=>{olympe.dc.vc.ow=()=>a});function Fl(a){const b=olympe.dc.ia(),c=new Map;b.lr(a).forEach(d=>{b.bb(d,olympe.dc.CloudObject.propertyRel).forEach(e=>{const f=b.name(e);c.has(f)||c.set(f,e)})});return c}
|
|
905
|
+
olympe.dc.CloudObject=class{constructor(a,b){this.tag=b;this.db=olympe.dc.ia();this.model=null}static Nc(a,b,c,...d){b=olympe.dc.ga(b);var e=He(b);(e=e&&e.C)?e(a,c,...d):(a=a.create(b),void 0!==c&&null!==c&&Z(a,olympe.dc.CloudObject.nameProp,c),a.X())}static get(a){if(a instanceof olympe.dc.CloudObject)var b=a;else{b=olympe.dc.mr();a=olympe.dc.ga(a);var c=b.db.model(a);c=Ge(b,c);if(null===c)throw new olympe.dc.Ep(a);c=c.instantiate(a,b.F);b.C.C.jb([a]);b.Ma.register(c,a);b=c}return b}static exists(a){return olympe.dc.ia().Fa(olympe.dc.ga(a))}static wv(a,
|
|
906
|
+
b,c){if('undefined'===typeof olympe.sc)throw Error('Method CloudObject.createWith should only be used at runtime, when sc package exists');const d=olympe.dc.ia();let e=null;const f=h=>{null===e&&(e=Fl(b||this));return e.has(h)?e.get(h):null},g=new Map;a.forEach((h,k)=>{d.Fa(olympe.dc.ga(k))?g.set(k,h):(k=f(k))&&g.set(k,h)});a=new olympe.sc.Wa(!1);c=a.create(null!=b?b:this,g,c);a.lb().catch(h=>olympe.ma.ab('dc').error(`Error occurred for transaction executed by CloudObject.createWith: ${h}`));return this.get(c)}static nv(){return this.get(this)}static qk(a){return olympe.dc.pa.qk(a)}static Cb(){return olympe.dc.ia().bb(this,
|
|
907
|
+
olympe.dc.CloudObject.propertyRel).map(a=>new olympe.dc.Ma.Property(a))}static td(){const a=olympe.dc.ia();return a.bb(this,olympe.dc.CloudObject.Oi).map(b=>new olympe.dc.Ma.Relation(b)).concat(a.bb(this,olympe.dc.CloudObject.er).map(b=>new olympe.dc.Ma.Relation(b,olympe.dc.ua.ORIGIN)))}static Hd(a){return olympe.dc.CloudObject.get(a)}static kw(a){var b=Ge(olympe.dc.mr(),olympe.dc.ga(a));b=b&&b.F;return new olympe.dc.ya(olympe.dc.ga(a),olympe.dc.CloudObject.instancesRel,b)}X(){return this.tag}name(){return this.db.name(this)}la(){return this.ub(olympe.dc.CloudObject.nameProp)}Ec(){this.model||
|
|
908
|
+
(this.model=olympe.dc.CloudObject.get(this.db.model(this)));return this.model}query(){return olympe.dc.pa.from(this)}Vf(){return this.db.Vf(this)}yb(){return this.db.source(this)}lw(){return this.db.Hh(this)?olympe.dc.Sd().fromModel(this):null}kr(){return olympe.D.ta([this.la()],a=>olympe.D.xb(a),olympe.D.Na,'getDisplayName',olympe.D.xb('('+this.toString()+')'))}cc(){return this.model?this.model.X():this.db.model(this)}observe(a,b,c=!0){const d='function'===typeof a.F?a.F():a;return new rxjs.Observable(e=>
|
|
909
|
+
{const f=this.db.Ka(this.tag,b);c||null!==f||e.next(f);const g=Uf(this.db,this.tag,b,h=>{null===h||void 0===h?e.next(null):e.next(h)});d.Z(()=>{e.complete();Vf(this.db,this.tag,b,g)});return()=>Vf(this.db,this.tag,b,g)})}qx(a){const b='function'===typeof a.F?a.F():a;return new rxjs.Observable(c=>{const d=Wf(this.db,this.tag,(e,f)=>{null===f||void 0===f?c.next([new olympe.dc.Ma.Property(e),null]):c.next([new olympe.dc.Ma.Property(e),f])});b.Z(()=>{c.complete();Xf(this.db,this.tag,d)});return()=>Xf(this.db,
|
|
910
|
+
this.tag,d)})}sx(a){return this.observe(olympe.D.Xa(),a)}get(a){return this.db.Ka(this.tag,a)}Ka(a){return this.get(a)}cb(a){return olympe.dc.pa.from(this).cb(a)}ck(a){return olympe.dc.bd.from(this).cb(a)}Vv(){return this.oc(olympe.dc.CloudObject.rv,olympe.dc.CloudObject)}Cm(){return this.bb(olympe.dc.CloudObject.containsRel,olympe.dc.CloudObject)}xf(a,b,c){const d=olympe.D.fc(c,'Sync valueType'),e=Uf(this.db,this.tag,a,olympe.D.Xa().G(f=>{b&&null!==f&&void 0!==f&&(f=b(f));null===f||void 0===f?d.clear():
|
|
911
|
+
d.update(f)}));d.getContext().onDestroy(()=>Vf(this.db,this.tag,a,e));return d.getContext()}ub(a){return O(this.xf(a,olympe.dc.Lb.tm,olympe.D.Na))}Vc(a){return O(this.xf(a,olympe.dc.Lb.sm,olympe.D.aa))}Ig(a){return O(this.xf(a,olympe.dc.Lb.pm,olympe.D.ea))}Ji(a){return O(this.xf(a,olympe.dc.Lb.qm,olympe.D.gb))}rr(){return O(this.xf(olympe.dm.Color.valueProp,olympe.dc.Lb.Yq,olympe.D.Color))}sr(){return O(this.xf(olympe.sc.workflow.Transition.processRefProp,olympe.dc.Lb.Zq,olympe.dc.CloudObject))}bb(a,
|
|
912
|
+
b){a=a instanceof olympe.dc.da.Le?a:new olympe.dc.da.Le(a.X(),a.Ga());return new olympe.dc.ya(this.X(),a,b)}oc(a,b){return this.bb(a,b).xc()}hr(a,b){const c=this.db,d=olympe.Y.Fc(),e=olympe.D.Xa(),f=new Map;W(c,this.tag,a,(g,h)=>{if(g)(g=e.run(b,olympe.dc.CloudObject.get(h)))&&f.set(h,g);else{let k;null==(k=f.get(h))||k();f.delete(h)}},d);e.onDestroy(()=>{c.F(this.tag,a,d)})}Tx(){return new olympe.dc.ya(this.X(),[],Ye(this.X()))}transform(...a){return(new olympe.dc.ya(this.X(),[],this.constructor)).transform(...a)}Ic(){return this.kr()}toString(){return`CloudObject: ${JSON.stringify(this)}`}toJSON(){return this.db.Fa(this.tag)?
|
|
913
|
+
Object.assign({'#tag':this.X(),'#type':this.Ec().name()},this.Jc(!0,!0)):{'#tag':this.X(),'#error':'The object does not exist in the local database.'}}Jc(a=!1,b=!0){const c={};this.db.Cb(this,b).forEach((d,e)=>{this.db.Fa(e)&&(e=a?this.db.name(e):e,c[e]=d instanceof olympe.dc.Bc?olympe.dc.CloudObject.get(d.tag):d)});return c}Qa(a){return a instanceof olympe.dc.CloudObject?this.X()===a.X():'function'===typeof a?olympe.dc.na.cc(a)===this.X():!1}vd(a){return olympe.D.ta([a],b=>olympe.D.Qb(this.Qa(b)),
|
|
914
|
+
olympe.D.ea)}zv(a){const b=this.db;let c=!1;if(void 0===a||null===a)a=new olympe.dc.Wa,c=!0;const d=olympe.dc.ua.ORIGIN;for(const [e,f,g]of gg(b,this))f===d?a.ic(e,g,this):e!==olympe.dc.CloudObject.modelRel.X()&&a.ic(e,this,g);a.delete(this,olympe.dc.ec.NONE);c&&a.lb()}};olympe.dc.CloudObject.prototype.equals=olympe.dc.CloudObject.prototype.Qa;olympe.dc.CloudObject.prototype.toObject=olympe.dc.CloudObject.prototype.Jc;olympe.dc.CloudObject.prototype.followSingle=olympe.dc.CloudObject.prototype.ck;
|
|
915
|
+
olympe.dc.CloudObject.prototype.follow=olympe.dc.CloudObject.prototype.cb;olympe.dc.CloudObject.prototype.getProperty=olympe.dc.CloudObject.prototype.Ka;olympe.dc.CloudObject.prototype.get=olympe.dc.CloudObject.prototype.get;olympe.dc.CloudObject.prototype.observeProperty=olympe.dc.CloudObject.prototype.sx;olympe.dc.CloudObject.prototype.observeProperties=olympe.dc.CloudObject.prototype.qx;olympe.dc.CloudObject.prototype.observe=olympe.dc.CloudObject.prototype.observe;
|
|
916
|
+
olympe.dc.CloudObject.prototype.getModelTag=olympe.dc.CloudObject.prototype.cc;olympe.dc.CloudObject.prototype.getSource=olympe.dc.CloudObject.prototype.yb;olympe.dc.CloudObject.prototype.isPersisted=olympe.dc.CloudObject.prototype.Vf;olympe.dc.CloudObject.prototype.query=olympe.dc.CloudObject.prototype.query;olympe.dc.CloudObject.prototype.getModel=olympe.dc.CloudObject.prototype.Ec;olympe.dc.CloudObject.prototype.name=olympe.dc.CloudObject.prototype.name;olympe.dc.CloudObject.prototype.getTag=olympe.dc.CloudObject.prototype.X;
|
|
917
|
+
olympe.dc.CloudObject.getInstancesOf=olympe.dc.CloudObject.kw;olympe.dc.CloudObject.getInstance=olympe.dc.CloudObject.Hd;olympe.dc.CloudObject.getRelations=olympe.dc.CloudObject.td;olympe.dc.CloudObject.getProperties=olympe.dc.CloudObject.Cb;olympe.dc.CloudObject.instancesOf=olympe.dc.CloudObject.qk;olympe.dc.CloudObject.asInstance=olympe.dc.CloudObject.nv;olympe.dc.CloudObject.createWith=olympe.dc.CloudObject.wv;olympe.dc.CloudObject.exists=olympe.dc.CloudObject.exists;
|
|
918
|
+
olympe.dc.CloudObject.get=olympe.dc.CloudObject.get;olympe.dc.CloudObject.P=olympe.dc.na.C('ff021000000000000001',olympe.dc.CloudObject);olympe.dc.CloudObject.dD=olympe.dc.CloudObject.P.ka(olympe.dc.ap.VERSION);olympe.dc.CloudObject.nameProp=olympe.dc.CloudObject.P.ka('ff023000000000000011');B('olympe.dc.CloudObject.nameProp',olympe.dc.CloudObject.nameProp);olympe.dc.CloudObject.PC=olympe.dc.CloudObject.P.ka('ff023000000000000012');olympe.dc.CloudObject.Oi=olympe.dc.CloudObject.P.sa('ff02200000000000000a');
|
|
919
|
+
olympe.dc.CloudObject.er=olympe.dc.CloudObject.P.sa('ff02200000000000000b',olympe.dc.ua.ORIGIN);olympe.dc.CloudObject.wC=olympe.dc.CloudObject.P.sa('017e9c4ba4c847d71cbf');olympe.dc.CloudObject.mC=olympe.dc.CloudObject.P.sa('017ea013caf8e89cedb2');olympe.dc.CloudObject.propertyRel=olympe.dc.CloudObject.P.sa('ff02200000000000000c');B('olympe.dc.CloudObject.propertyRel',olympe.dc.CloudObject.propertyRel);olympe.dc.CloudObject.typeRel=olympe.dc.CloudObject.P.sa('ff02200000000000000d',olympe.dc.ua.ORIGIN);
|
|
920
|
+
olympe.dc.CloudObject.modelRel=olympe.dc.CloudObject.P.sa(olympe.dc.qc.$c);B('olympe.dc.CloudObject.modelRel',olympe.dc.CloudObject.modelRel);olympe.dc.CloudObject.instancesRel=U(olympe.dc.CloudObject.P,olympe.dc.CloudObject.modelRel);B('olympe.dc.CloudObject.instancesRel',olympe.dc.CloudObject.instancesRel);olympe.dc.CloudObject.extendRel=olympe.dc.CloudObject.P.sa(olympe.dc.qc.Uh);B('olympe.dc.CloudObject.extendRel',olympe.dc.CloudObject.extendRel);
|
|
921
|
+
olympe.dc.CloudObject.extendedByRel=U(olympe.dc.CloudObject.P,olympe.dc.CloudObject.extendRel);B('olympe.dc.CloudObject.extendedByRel',olympe.dc.CloudObject.extendedByRel);olympe.dc.CloudObject.containsRel=olympe.dc.CloudObject.P.sa(olympe.dc.qc.cj);B('olympe.dc.CloudObject.containsRel',olympe.dc.CloudObject.containsRel);olympe.dc.CloudObject.rv=U(olympe.dc.CloudObject.P,olympe.dc.CloudObject.containsRel);olympe.dc.CloudObject.yv=olympe.dc.CloudObject.P.sa('018282d3ac0a474a0bf4');
|
|
922
|
+
B('olympe.dc.CloudObject.deleteAlsoRel',olympe.dc.CloudObject.yv);olympe.dc.UA=olympe.dc.CloudObject;olympe.dc.CloudObject.xa=[olympe.dc.Fe];m=olympe.dc.CloudObject.prototype;m.X.K=new olympe.D.J(()=>String,[]);m.name.K=new olympe.D.J(()=>String,[]);m.la.K=olympe.D.J.F;m.Ec.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.yb.K=new olympe.D.J(()=>String,[]);m.lw.K=new olympe.D.J(()=>String,[]);m.kr.K=olympe.D.J.F;m.cc.K=new olympe.D.J(()=>String,[]);
|
|
923
|
+
m.Vv.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.Cm.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.xf.K=new olympe.D.J(()=>olympe.D.Node,[]);m.ub.K=olympe.D.J.F;m.Vc.K=olympe.D.J.G;m.Ig.K=olympe.D.J.O;m.Ji.K=new olympe.D.J(()=>olympe.D.gb,[]);m.rr.K=new olympe.D.J(()=>olympe.D.Color,[]);m.sr.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.bb.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.oc.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.hr.K=new olympe.D.J(()=>Function,[]);
|
|
924
|
+
m.Tx.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.transform.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.Ic.K=olympe.D.J.F;m.toString.K=olympe.D.J.C;m.Qa.K=olympe.D.J.C;m.vd.K=olympe.D.J.O;m.zv.K=new olympe.D.J(()=>{},[]);olympe.dc.R={bf:'dc.DBView',Xo:'dc.InstanceManager',Ca:'dc.Logger',Ku:'dc.TransactionLogger',jj:'dc.FileServiceManager',qg:'dc.Router'};olympe.dc.U={sg:'dc.tag',Ff:'dc.debug',oh:'dc.subscribeAll',Yk:'dc.defaultSource',uo:'dc.fileCache',$n:'dc.dataConsumerOnly',qo:'dc.errorOnAbstractInstantiation'};
|
|
925
|
+
olympe.W.config(function(a){const b='object'===typeof window;G(a,olympe.dc.U.Ff,!1);G(a,olympe.dc.U.oh,!1);G(a,olympe.dc.U.Yk,olympe.dc.Pa.SERVER);G(a,olympe.dc.U.$n,b);G(a,olympe.dc.U.uo,b);G(a,olympe.dc.U.qo,!0);G(a,olympe.dc.U.sg,olympe.Y.Fc());F(a,olympe.dc.R.Ca,[olympe.ma.R.Ha],c=>c.Oc('dc'));wa(a,olympe.dc.R.Ku,olympe.dc.transaction.R.Ca);wa(a,olympe.dc.R.bf,olympe.dc.db.R.Vk);E(a,olympe.dc.R.jj,olympe.dc.Ds,olympe.dc.R.Ca,olympe.dc.R.bf,olympe.net.R.Ha,olympe.dc.R.qg,olympe.Y.R.ag,new olympe.W.ja(olympe.dc.U.uo));
|
|
926
|
+
E(a,olympe.dc.R.qg,olympe.dc.nu,olympe.dc.R.Ca,olympe.dc.sources.R.Zp,olympe.dc.sources.R.pq,olympe.dc.R.bf,olympe.host.R.Je,new olympe.W.ja(olympe.dc.U.sg),new olympe.W.ja(olympe.dc.U.$n));E(a,olympe.dc.R.Xo,olympe.dc.Ws,olympe.dc.db.R.fl,olympe.dc.db.R.Ha,olympe.W.R.bg)},'olympe.dc');
|
|
927
|
+
olympe.W.run([olympe.dc.db.R.Ha,olympe.dc.transaction.R.Ha,olympe.dc.R.Xo,olympe.dc.R.jj,new olympe.W.ja(olympe.dc.U.sg)],(a,b,c,d,e)=>{olympe.dc.Dm=()=>a;olympe.dc.Eh=()=>b;olympe.dc.mr=()=>c;olympe.dc.KC=()=>d;olympe.dc.Pa.SELF=e},'DC singleton getter initialization');olympe.dm={};olympe.dm.Fd=class extends olympe.dc.CloudObject{la(){return this.ub(olympe.dc.CloudObject.nameProp)}C(){return olympe.D.Na.EMPTY}F(){return olympe.D.ea.C}};olympe.dm.Fd.P=olympe.dc.na.C('ff021000000000000002',olympe.dm.Fd);olympe.dm.Fd.O=olympe.dm.Fd.P.ka('ff023000000000000035');olympe.dm.Fd.C=olympe.dm.Fd.P.sa('ff022000000000000005');olympe.dm.Fd.G=Xe('ff011000000000000001','AUTHENTICATED_USERS');olympe.dm.Fd.L=Xe('ff011000000000000002','PROJECT_RUNNER_USERS_ROLE');
|
|
928
|
+
olympe.dm.Fd.F=Xe('014831d95f83635090ea','ADMIN_USERS_ROLE');olympe.dm.Fd.prototype.la.K=olympe.D.J.F;olympe.dm.Fd.prototype.C.K=olympe.D.J.F;olympe.dm.Fd.prototype.F.K=olympe.D.J.O;olympe.dm.Dk={NONE:0,Gy:1,qs:2,Hy:4,Dy:8,Fy:16,Ey:31,aA:32,Yz:64,bA:128,Zz:256,St:512,$z:992,vz:1023};olympe.dm.User=class extends olympe.dc.CloudObject{hw(){return this.Gm()}la(){return this.Gm()}Gm(){return this.ub(olympe.dm.User.loginProp)}it(){return this.ub(olympe.dm.User.F)}ht(){return olympe.D.Na.EMPTY}Dw(){return this.ub(olympe.dm.User.saltProp)}Mw(){return this.ub(olympe.dm.User.verifierProp)}Bw(){return this.bb(olympe.dm.User.G,olympe.dm.Fd)}};olympe.dm.User.P=olympe.dc.na.C('ff021000000000000003',olympe.dm.User);olympe.dm.User.loginProp=olympe.dm.User.P.ka('ff023000000000000001');
|
|
929
|
+
B('olympe.dm.User.loginProp',olympe.dm.User.loginProp);olympe.dm.User.F=olympe.dm.User.P.ka('ff023000000000000002');olympe.dm.User.T=olympe.dm.User.P.ka('ff023000000000000003');olympe.dm.User.saltProp=olympe.dm.User.P.ka('ff023000000000000004');B('olympe.dm.User.saltProp',olympe.dm.User.saltProp);olympe.dm.User.verifierProp=olympe.dm.User.P.ka('ff023000000000000005');B('olympe.dm.User.verifierProp',olympe.dm.User.verifierProp);olympe.dm.User.O=olympe.dm.User.P.ka('ff023000000000000020');
|
|
930
|
+
olympe.dm.User.SAMLnameIdProp=olympe.dm.User.P.ka('ff023000000000000036');B('olympe.dm.User.SAMLnameIdProp',olympe.dm.User.SAMLnameIdProp);olympe.dm.User.G=U(olympe.dm.User.P,olympe.dm.Fd.C);olympe.dm.User.Z=olympe.dm.User.P.sa('ff022000000000000002');olympe.dm.User.C=Xe('014831d95fd7d12b8568','ADMIN_USER');olympe.dm.User.L=Xe('0163d9653067b6237f62','GUEST_USER');m=olympe.dm.User.prototype;m.hw.K=olympe.D.J.F;m.la.K=olympe.D.J.F;m.Gm.K=olympe.D.J.F;m.it.K=olympe.D.J.F;m.ht.K=olympe.D.J.F;m.Dw.K=olympe.D.J.F;
|
|
931
|
+
m.Mw.K=olympe.D.J.F;m.Bw.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.If=class extends olympe.dc.CloudObject{Z(){return this.Cm()}jb(){return this.ub(olympe.dm.If.jb)}};olympe.dm.If.P=olympe.dc.na.C('01621fb84e3300000000',olympe.dm.If);olympe.dm.If.jb=olympe.dm.If.P.ka('01609de3f292e3c2c6ff');olympe.dm.If.prototype.Z.K=new olympe.D.J(()=>olympe.D.ed,[]);olympe.dm.If.prototype.jb.K=olympe.D.J.F;olympe.dm.BrickMetadata=class extends olympe.dm.If{Nw(){return this.ub(olympe.dm.BrickMetadata.ac)}yc(){return this.ub(olympe.dm.BrickMetadata.za)}getType(){return this.ub(olympe.dm.BrickMetadata.T)}Ww(){return this.Ig(olympe.dm.BrickMetadata.Kb)}le(){return null}Sv(){return this.bb(olympe.sc.Mb.Comment.C.Vb(),olympe.sc.Mb.Comment)}ik(){return this.ck(olympe.dm.BrickMetadata.oa).hd().ik()}};olympe.dm.BrickMetadata.P=bf(olympe.dc.na.C('01621fb84e3500000000',olympe.dm.BrickMetadata));
|
|
932
|
+
olympe.dm.BrickMetadata.ac=olympe.dm.BrickMetadata.P.ka('01621fb84e320000f001');olympe.dm.BrickMetadata.za=olympe.dm.BrickMetadata.P.ka('01703376c4a81c0e9d94');olympe.dm.BrickMetadata.T=olympe.dm.BrickMetadata.P.ka('01703376c4a81c0e9d00');olympe.dm.BrickMetadata.Kb=olympe.dm.BrickMetadata.P.ka('01703376c4a81c0eaea5');olympe.dm.BrickMetadata.oa=olympe.dm.BrickMetadata.P.sa('0161ae97622bb21f335b');olympe.dm.BrickMetadata.Od={jA:'private',lA:'public'};
|
|
933
|
+
olympe.dm.BrickMetadata.Zb={Oy:'experimental',zA:'stable',By:'deprecated'};olympe.dm.BrickMetadata.pd={oy:'business',VA:'technical'};m=olympe.dm.BrickMetadata.prototype;m.Nw.K=olympe.D.J.F;m.yc.K=olympe.D.J.F;m.getType.K=olympe.D.J.F;m.Ww.K=olympe.D.J.O;m.le.K=new olympe.D.J(()=>String,[]);m.Sv.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.ik.K=olympe.D.J.T;function ei(a,b){b=b.startsWith('data.')?b.split('.')[1]:b;let c;return null!=(c=olympe.W.getParameter(`${'data.'}${a}.${b}`))?c:olympe.W.getParameter(`${'data.'}${b}`)}
|
|
934
|
+
function wi(a,b){const c=a.query().cb(olympe.dm.md.C.Vb()).cb(olympe.dm.md.F);a=a.query().cb(olympe.dm.hb.G.Vb()).Sf(olympe.dm.hb.L,!0).cb(olympe.sc.Qc.C.Vb());const d=e=>e.ce().Sf(olympe.dc.CloudObject.extendRel,!0).cb(olympe.dc.CloudObject.Oi,!0).cb(olympe.dm.Relation.destinationModelRel).back(2).cb(olympe.dc.CloudObject.propertyRel,!0).cb(olympe.dm.Property.typeRel).observe(b);return rxjs.combineLatest([d(c),d(a)]).pipe(rxjs.operators.map(([e,...f])=>e.concat(...f)))}
|
|
935
|
+
function Ti(a,b){return a.observe(b,olympe.dm.DataSource.$q).pipe(rxjs.operators.map(()=>a.xe(olympe.dc.sources.U.Ce)),rxjs.operators.distinctUntilChanged())}
|
|
936
|
+
olympe.dm.DataSource=class extends olympe.dc.CloudObject{constructor(a,b,c){super(a,b);this.Xb=c;this.br=new Map([[olympe.dc.sources.U.Jl,olympe.dm.DataSource.Cx],[olympe.dc.sources.U.Ce,olympe.dm.DataSource.$q],[olympe.dc.sources.U.Ql,olympe.dm.DataSource.Gx]])}V(){return this.tag===olympe.dm.DataSource.SERVER?olympe.dc.Pa.SERVER:this.tag}xe(a){const b=a.startsWith('data.')?a.split('.')[1]:a,c=`${'data.'}${b}`;let d,e;return null!=(e=null!=(d=olympe.W.getParameter(`${'data.'}${this.name().toLowerCase().replace(/\W/g,
|
|
937
|
+
'_')}.${b}`))?d:ei(this.X(),a))?e:this.br.has(c)?this.get(this.br.get(c)):null}yc(){const a=this;return x(function*(){const b=olympe.dm.DataSource.Jb.us,c=olympe.dm.DataSource.Jb.Eb,d=new olympe.dc.Request(olympe.dc.Request.C.Jb,a.V());return a.Xb.request(d).then(e=>{let f;const g=null!=(f=null==e?void 0:e.s)?f:c;(e=null==e?void 0:e.r)&&olympe.ma.ab('dc').warn(`Source ${a.name()} (${a.V()}) has encountered issues: ${e}`);return g}).catch(e=>{const f=olympe.N.errors.zp;return e instanceof olympe.N.errors.Uj||
|
|
938
|
+
e instanceof f?b:c})})}init(){const a=this;return x(function*(){if(a.constructor===olympe.dm.DataSource)throw Error(`Data source ${a.name()} (${a.tag}) has no implementation (is the file missing ?)`);})}destroy(){return x(function*(){})}healthCheck(){return x(function*(){})}executeQuery(a){return x(function*(){return olympe.dc.query.ld.Fi(a)})}applyTransaction(){return x(function*(){})}uploadFileContent(){return x(function*(){throw Error('Should not try to upload files with SELF source');})}downloadFileContent(){return x(function*(){throw Error('Should not try to download files with SELF source');
|
|
939
|
+
})}deleteFileContent(){return x(function*(){})}};olympe.dm.DataSource.prototype.deleteFileContent=olympe.dm.DataSource.prototype.deleteFileContent;olympe.dm.DataSource.prototype.downloadFileContent=olympe.dm.DataSource.prototype.downloadFileContent;olympe.dm.DataSource.prototype.uploadFileContent=olympe.dm.DataSource.prototype.uploadFileContent;olympe.dm.DataSource.prototype.applyTransaction=olympe.dm.DataSource.prototype.applyTransaction;olympe.dm.DataSource.prototype.executeQuery=olympe.dm.DataSource.prototype.executeQuery;
|
|
940
|
+
olympe.dm.DataSource.prototype.healthCheck=olympe.dm.DataSource.prototype.healthCheck;olympe.dm.DataSource.prototype.destroy=olympe.dm.DataSource.prototype.destroy;olympe.dm.DataSource.prototype.init=olympe.dm.DataSource.prototype.init;olympe.dm.DataSource.prototype.getConfig=olympe.dm.DataSource.prototype.xe;olympe.dm.DataSource.prototype.getId=olympe.dm.DataSource.prototype.V;olympe.dm.DataSource.P=olympe.dc.na.C('ff021000000000000060',olympe.dm.DataSource,olympe.dc.R.qg);
|
|
941
|
+
olympe.dm.DataSource.uh=olympe.dm.DataSource.P.ka('ff023000000000000060');B('olympe.dm.DataSource.activatedProp',olympe.dm.DataSource.uh);olympe.dm.DataSource.sC=olympe.dm.DataSource.P.ka('ff023000000000000061');olympe.dm.DataSource.Cx=olympe.dm.DataSource.P.ka('ff023000000000000062');olympe.dm.DataSource.$q=olympe.dm.DataSource.P.ka('ff023000000000000063');olympe.dm.DataSource.fr=olympe.dm.DataSource.P.ka('ff023000000000000064');olympe.dm.DataSource.Gx=olympe.dm.DataSource.P.ka('ff023000000000000065');
|
|
942
|
+
olympe.dm.DataSource.Pi=olympe.dm.DataSource.P.sa('ff022000000000000060');olympe.dm.DataSource.SERVER=Xe('00000000000000000060','Server source');olympe.dm.DataSource.Ce={zz:'hybrid',yn:'bus',Mo:'http'};olympe.dm.DataSource.Jb={kh:'ready',Eb:'error',us:'down',$d:'offline'};olympe.dm.md=class extends olympe.dc.CloudObject{};olympe.dm.md.P=olympe.dc.na.C('ff021000000000000070',olympe.dm.md);olympe.dm.md.C=olympe.dm.md.P.sa('ff023000000000000071');olympe.dm.md.F=olympe.dm.md.P.sa('ff023000000000000072');olympe.dm.md.G=olympe.dm.md.P.sa('ff023000000000000073');olympe.dm.Ib=class extends olympe.dm.BrickMetadata{L(){return new olympe.dc.ya(this.X(),[new olympe.dc.da.se(olympe.dm.Ib.F.X(),olympe.dc.ua.DESTINATION,olympe.dc.da.gq.Ps,olympe.dc.da.gq.Qs),olympe.dm.Ib.C])}le(){return olympe.sc.ud.te.Cs}C(){return this.bb(olympe.dm.Ib.F,olympe.dm.Ib)}O(){return this.bb(olympe.dm.Ib.C)}};olympe.dm.Ib.P=olympe.dc.na.C('01612df1db9749227626',olympe.dm.Ib);olympe.dm.Ib.F=olympe.dm.Ib.P.sa('016a697ef00ce7554691');olympe.dm.Ib.Ja=U(olympe.dm.Ib.P,olympe.dm.Ib.F);
|
|
943
|
+
olympe.dm.Ib.C=olympe.dm.Ib.P.sa('016a697ef00ce7554692');U(olympe.dc.CloudObject.P,olympe.dm.Ib.C);olympe.dm.Ib.prototype.L.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.Ib.prototype.C.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.Ib.prototype.O.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.Cc=class extends olympe.dm.Ib{C(){return this.X()===olympe.dm.Cc.fa?this.bb(olympe.dm.Cc.O,olympe.dm.Ib):this.bb(olympe.dm.Cc.Z,olympe.dm.Ib)}};olympe.dm.Cc.P=olympe.dc.na.C('ff021000000000000020',olympe.dm.Cc);olympe.dm.Cc.Z=olympe.dm.Cc.P.sa('017e9c34cf48bd6965c1');olympe.dm.Cc.O=olympe.dm.Cc.P.sa('017e9c2e013e06bfffd9');olympe.dm.Cc.mk=olympe.dm.Cc.P.sa('01811f12ad77673770d4');olympe.dm.Cc.fa=Xe('10000000000000000000','ROOT_OF_ROOTS');olympe.dm.Cc.hc=Xe('10000000000000000001','OLYMPE_FOLDER');
|
|
944
|
+
olympe.dm.Cc.Tb=Xe('10000000000000000002','INTERNAL_FOLDER');olympe.dm.Cc.prototype.C.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.Module=class extends olympe.dc.CloudObject{gw(){return this.ub(olympe.dm.Module.O)}sw(){return this.Vc(olympe.dm.Module.T)}jt(){return this.ub(olympe.dm.Module.F)}ww(){return this.ub(olympe.dm.Module.Z)}Tv(){return this.ub(olympe.dm.Module.G)}tw(){return this.bb(olympe.dm.Module.L,olympe.dm.Module)}Ew(){return this.bb(olympe.dm.Module.C,olympe.dm.Bd)}};olympe.dm.Module.P=olympe.dc.na.C('ff021000000000000040',olympe.dm.Module);olympe.dm.Module.O=olympe.dm.Module.P.ka('ff023000000000000042');
|
|
945
|
+
olympe.dm.Module.T=olympe.dm.Module.P.ka('ff023000000000000043');olympe.dm.Module.F=olympe.dm.Module.P.ka('ff023000000000000044');olympe.dm.Module.Z=olympe.dm.Module.P.ka('ff023000000000000045');olympe.dm.Module.G=olympe.dm.Module.P.ka('ff023000000000000046');olympe.dm.Module.creationDateProp=olympe.dm.Module.P.ka('ff023000000000000049');olympe.dm.Module.C=olympe.dm.Module.P.sa('ff022000000000000013');olympe.dm.Module.L=olympe.dm.Module.P.sa('ff022000000000000014');
|
|
946
|
+
olympe.dm.Module.ba=Xe('016a69b9bceabd815b77','OLYMPE_SERVER_MODULE');m=olympe.dm.Module.prototype;m.gw.K=olympe.D.J.F;m.sw.K=olympe.D.J.G;m.jt.K=olympe.D.J.F;m.ww.K=olympe.D.J.F;m.Tv.K=olympe.D.J.F;m.tw.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.Ew.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.File=class extends olympe.dc.CloudObject{static F(a,b,c,d,e,f,g){e=e||'application/data';d=URL.createObjectURL(new Blob([d],{type:e}));g=null!=g?g:olympe.dc.Sd().fromModel(a);a=b.create(a,f).Ti(g);b=olympe.D.gb.now();Z(Z(Z(Z(Z(Z(a,olympe.dm.File.fileNameProp,null!=c?c:'file'),olympe.dm.File.urlProp,d),olympe.dm.File.creationDateProp,b),olympe.dm.File.modificationDateProp,b),olympe.dm.File.mimeTypeProp,e||'application/data'),olympe.dm.File.C,!1);return a.X()}constructor(a,b,c,d,e){super(a,
|
|
947
|
+
b);this.F=c;this.G=d;this.C=e}Hm(){return this.ub(olympe.dm.File.mimeTypeProp)}fk(a,b){const c=olympe.D.Xa().G(a),d=olympe.D.Xa().G(e=>null==b?void 0:b(`${e}`));(a=this.db.Ka(this,olympe.dm.File.urlProp,!0))&&a.startsWith('blob:')?this.C.F(a,e=>{e.arrayBuffer().then(c).catch(d)},d):this.F.F(this,e=>{e.arrayBuffer().then(c).catch(d)},e=>{null==d||d(e)})}Bm(a,b){this.fk(c=>{a(Ga(c))},b)}gk(a,b){const c=olympe.D.Xa().G(a),d=olympe.D.Xa().G(h=>null==b?void 0:b(`${h}`)),e=this.db.Ka(this,olympe.dm.File.C),
|
|
948
|
+
f=this.db.Ka(this,olympe.dm.File.urlProp),g=h=>{const k=this.db.Ka(this,olympe.dm.File.mimeTypeProp);h.arrayBuffer().then(l=>{c(`data:${k};base64,${this.C.C(l)}`)}).catch(d)};e&&e.valueOf()?this.F.F(this,g.bind(this),d):f&&f.startsWith('blob:')?this.C.F(f,g.bind(this),d):'string'===typeof f?a(f):b(`No content nor URL associated to the file ${this.X()}`)}rename(a,b){const c=b&&olympe.D.Xa().G(b);olympe.D.Um([a],d=>{const e=new olympe.dc.Wa;e.update(this,olympe.dc.CloudObject.nameProp,d);e.update(this,
|
|
949
|
+
olympe.dm.File.fileNameProp,d);e.lb(f=>{c&&c(f)})})}Jx(){this.G.O(this.get(olympe.dm.File.mimeTypeProp))}rl(){return this.ub(olympe.dm.File.urlProp)}bp(){return this.ub(olympe.dm.File.fileNameProp)}Xv(){return this.Ji(olympe.dm.File.creationDateProp)}rw(){return this.Ji(olympe.dm.File.modificationDateProp)}ur(){return this.Ig(olympe.dm.File.C)}};olympe.dm.File.prototype.saveAs=olympe.dm.File.prototype.Jx;olympe.dm.File.prototype.getContentUrl=olympe.dm.File.prototype.gk;
|
|
950
|
+
olympe.dm.File.prototype.getContentAsString=olympe.dm.File.prototype.Bm;olympe.dm.File.prototype.getContentAsBinary=olympe.dm.File.prototype.fk;olympe.dm.File.P=olympe.dc.na.C('ff021000000000000030',olympe.dm.File,olympe.dc.R.jj,olympe.net.R.Ha,olympe.Y.R.ag);olympe.dm.File.nameProp=olympe.dm.File.P.ka('ff023000000000000050');B('olympe.dm.File.nameProp',olympe.dm.File.nameProp);olympe.dm.File.fileNameProp=olympe.dm.File.P.ka('ff023000000000000050');B('olympe.dm.File.fileNameProp',olympe.dm.File.fileNameProp);
|
|
951
|
+
olympe.dm.File.creationDateProp=olympe.dm.File.P.ka('ff023000000000000051');B('olympe.dm.File.creationDateProp',olympe.dm.File.creationDateProp);olympe.dm.File.modificationDateProp=olympe.dm.File.P.ka('ff023000000000000055');B('olympe.dm.File.modificationDateProp',olympe.dm.File.modificationDateProp);olympe.dm.File.mimeTypeProp=olympe.dm.File.P.ka('ff023000000000000052');B('olympe.dm.File.mimeTypeProp',olympe.dm.File.mimeTypeProp);olympe.dm.File.urlProp=olympe.dm.File.P.ka('ff023000000000000053');
|
|
952
|
+
B('olympe.dm.File.urlProp',olympe.dm.File.urlProp);olympe.dm.File.C=olympe.dm.File.P.ka('ff023000000000000054');olympe.dm.File.P.C=olympe.dm.File.F.bind(null,olympe.dm.File);olympe.dm.File.O='application/data';olympe.dm.File.xa=[olympe.D.File];m=olympe.dm.File.prototype;m.Hm.K=olympe.D.J.F;m.fk.K=new olympe.D.J(()=>{},[]);m.Bm.K=new olympe.D.J(()=>{},[]);m.gk.K=new olympe.D.J(()=>{},[]);m.rename.K=olympe.D.J.C;m.rl.K=olympe.D.J.F;m.bp.K=olympe.D.J.F;m.Xv.K=new olympe.D.J(()=>olympe.D.gb,[]);
|
|
953
|
+
m.rw.K=new olympe.D.J(()=>olympe.D.gb,[]);m.ur.K=olympe.D.J.O;olympe.dm.Bd=class extends olympe.dc.CloudObject{C(){return this.ub(olympe.dm.Bd.F)}G(){return this.Vc(olympe.dm.Bd.G)}F(){return this.bb(olympe.dm.Bd.C,olympe.dm.Module)}};olympe.dm.Bd.P=olympe.dc.na.C('ff021000000000000041',olympe.dm.Bd);olympe.dm.Bd.F=olympe.dm.Bd.P.ka('ff023000000000000047');olympe.dm.Bd.G=olympe.dm.Bd.P.ka('ff023000000000000048');olympe.dm.Bd.C=olympe.dm.Module.C.Vb();olympe.dm.Bd.prototype.C.K=olympe.D.J.F;olympe.dm.Bd.prototype.G.K=olympe.D.J.G;
|
|
954
|
+
olympe.dm.Bd.prototype.F.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.hb=class extends olympe.dm.Cc{C(){return this.bb(olympe.dm.Ib.F,olympe.dm.Ib)}G(){return this.ub(olympe.dm.hb.ba)}T(){return this.ub(olympe.dm.hb.tb)}F(){return this.bb(olympe.dm.hb.L,olympe.dm.hb)}};olympe.dm.hb.P=olympe.dc.na.C('0163d9594700fcf61e54',olympe.dm.hb);olympe.dm.hb.ba=olympe.dm.hb.P.ka('017869c7d2833c9492c1');olympe.dm.hb.RC=olympe.dm.hb.P.ka('017869c7d2833c9492c2');olympe.dm.hb.ve=olympe.dm.hb.P.ka('017869c7d2833c9492c3');olympe.dm.hb.tb=olympe.dm.hb.P.ka('017869c80bb9929c76d0');
|
|
955
|
+
olympe.dm.hb.ob=olympe.dm.hb.P.sa('ff02200000000000002a');olympe.dm.hb.L=olympe.dm.hb.P.sa('ff02200000000000002b');olympe.dm.hb.sf=U(olympe.dm.hb.P,olympe.dm.hb.L);olympe.dm.hb.G=olympe.dm.hb.P.sa('ff02200000000000002c');olympe.dm.hb.ek=olympe.dm.hb.P.sa('017e9c412e2b944bc48f');olympe.dm.hb.Pe=olympe.dm.hb.P.sa('017e9c412e2b944bd590');olympe.dm.hb.QC=olympe.dm.hb.P.sa('017e9c416872a89d3415');olympe.dm.hb.pk=olympe.dm.hb.P.sa('017ebf8fe5c506662098');U(olympe.dc.CloudObject.P,olympe.dm.hb.ob);
|
|
956
|
+
olympe.dm.hb.Kc=Xe('100000000000000000dd','PRIMORDIAL');olympe.dm.hb.prototype.C.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.hb.prototype.G.K=olympe.D.J.F;olympe.dm.hb.prototype.T.K=olympe.D.J.F;olympe.dm.hb.prototype.F.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.dm.Property=class extends olympe.dc.CloudObject{C(){return this.oc(olympe.dm.Property.definingModelRel,olympe.dc.CloudObject)}getType(){return this.oc(olympe.dm.Property.typeRel,olympe.dc.CloudObject)}F(){return this.ck(olympe.dm.Property.typeRel).hd()}Ic(){return this.C().la().ar(this.la())}};olympe.dm.Property.P=olympe.dc.na.C('ff021000000000000005',olympe.dm.Property);olympe.dm.Property.definingModelRel=U(olympe.dm.Property.P,olympe.dc.CloudObject.propertyRel);
|
|
957
|
+
B('olympe.dm.Property.definingModelRel',olympe.dm.Property.definingModelRel);olympe.dm.Property.typeRel=U(olympe.dm.Property.P,olympe.dc.CloudObject.typeRel);B('olympe.dm.Property.typeRel',olympe.dm.Property.typeRel);olympe.dm.Property.prototype.C.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Property.prototype.getType.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Property.prototype.F.K=olympe.D.J.C;olympe.dm.Relation=class extends olympe.dc.CloudObject{constructor(a,b){super(a,b)}nw(){return olympe.D.Na.EMPTY}Qv(){return this.Vc(olympe.dm.Relation.F)}xw(){return this.Vc(olympe.dm.Relation.G)}jr(){return this.bb(olympe.dm.Relation.destinationModelRel,olympe.dc.CloudObject).xc()}qr(){return this.bb(olympe.dm.Relation.originModelRel,olympe.dc.CloudObject).xc()}Ic(){return this.qr().la().concat(['-',this.la(),'->',this.jr().la()])}};olympe.dm.Relation.P=olympe.dc.na.C('ff021000000000000006',olympe.dm.Relation);
|
|
958
|
+
olympe.dm.Relation.G=olympe.dm.Relation.P.ka('ff023000000000000030');olympe.dm.Relation.F=olympe.dm.Relation.P.ka('ff023000000000000034');olympe.dm.Relation.ba=olympe.dm.Relation.P.ka(olympe.dc.ec.io);olympe.dm.Relation.Z=olympe.dm.Relation.P.ka(olympe.dc.ec.zc);olympe.dm.Relation.fa=olympe.dm.Relation.P.ka(olympe.dc.ec.Mf);olympe.dm.Relation.oa=olympe.dm.Relation.P.ka(olympe.dc.ec.wu);olympe.dm.Relation.T=olympe.dm.Relation.P.ka('ff023000000000000031');
|
|
959
|
+
olympe.dm.Relation.originModelRel=U(olympe.dm.Relation.P,olympe.dc.CloudObject.Oi);B('olympe.dm.Relation.originModelRel',olympe.dm.Relation.originModelRel);olympe.dm.Relation.destinationModelRel=U(olympe.dm.Relation.P,olympe.dc.CloudObject.er);B('olympe.dm.Relation.destinationModelRel',olympe.dm.Relation.destinationModelRel);olympe.dm.Relation.C={Os:0,Ur:5,Wp:1,ku:4,bm:2,Rl:8,Ny:10,rA:6,sA:9,Ee:6,tA:9};olympe.dm.Relation.L={Xz:3,Qt:4,Kz:5,Jz:6};olympe.dm.Relation.O=olympe.dm.Dk.St+olympe.dm.Dk.qs;
|
|
960
|
+
m=olympe.dm.Relation.prototype;m.nw.K=olympe.D.J.F;m.Qv.K=olympe.D.J.G;m.xw.K=olympe.D.J.G;m.jr.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.qr.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);olympe.dm.Ke=class extends olympe.dc.CloudObject{getValue(){}};olympe.dm.Ke.P=olympe.dc.na.C('ff021000000000000019',olympe.dm.Ke);olympe.dm.String=class extends olympe.dm.Ke{getValue(){return this.ub(olympe.dm.String.valueProp)}toString(){return this.get(olympe.dm.String.valueProp)}};olympe.dm.String.P=olympe.dc.na.C('ff021000000000000011',olympe.dm.String);olympe.dm.String.valueProp=olympe.dm.String.P.ka('ff023000000000000026');B('olympe.dm.String.valueProp',olympe.dm.String.valueProp);olympe.dm.String.prototype.getValue.K=olympe.D.J.F;olympe.dm.String.prototype.toString.K=olympe.D.J.C;olympe.dm.Boolean=class extends olympe.dm.Ke{getValue(){return this.Ig(olympe.dm.Boolean.valueProp)}};olympe.dm.Boolean.P=olympe.dc.na.C('ff021000000000000012',olympe.dm.Boolean);olympe.dm.Boolean.valueProp=olympe.dm.Boolean.P.ka('ff023000000000000027');B('olympe.dm.Boolean.valueProp',olympe.dm.Boolean.valueProp);olympe.dm.Boolean.prototype.getValue.K=olympe.D.J.O;olympe.dm.Color=class extends olympe.dm.Ke{getValue(){return this.rr()}};olympe.dm.Color.P=olympe.dc.na.C('ff021000000000000017',olympe.dm.Color);olympe.dm.Color.valueProp=olympe.dm.Color.P.ka('ff023000000000000032');B('olympe.dm.Color.valueProp',olympe.dm.Color.valueProp);olympe.dm.Color.prototype.getValue.K=new olympe.D.J(()=>olympe.D.Color,[]);olympe.dm.DateTime=class extends olympe.dm.Ke{getValue(){return this.Ji(olympe.dm.DateTime.valueProp)}};olympe.dm.DateTime.P=olympe.dc.na.C('ff021000000000000014',olympe.dm.DateTime);olympe.dm.DateTime.valueProp=olympe.dm.DateTime.P.ka('ff023000000000000029');B('olympe.dm.DateTime.valueProp',olympe.dm.DateTime.valueProp);olympe.dm.DateTime.prototype.getValue.K=new olympe.D.J(()=>olympe.D.gb,[]);olympe.dm.Enum=class extends olympe.dm.String{la(){return olympe.D.ta([super.la(),super.getValue()],(a,b)=>''!==a.valueOf()?a:b,olympe.D.Na)}Rd(){return this.Vc(olympe.dm.Enum.rankProp)}};olympe.dm.Enum.P=olympe.dc.na.C('016cdd861b32d56c81f7',olympe.dm.Enum);olympe.dm.Enum.rankProp=olympe.dm.Enum.P.ka('017a7690c915975ea995');olympe.dm.Enum.prototype.Rd.K=olympe.D.J.G;olympe.dm.Jf=class extends olympe.dm.BrickMetadata{Lw(){return this.cb(olympe.dc.CloudObject.instancesRel).yk(olympe.dm.Enum.rankProp,olympe.dc.query.Bj.ASC).hd()}static create(a,b){b=a.create(olympe.dm.Jf,(new Map).set(olympe.dc.CloudObject.nameProp,b));a.Ea(olympe.dc.CloudObject.extendRel,b,olympe.dm.Enum);return b}};olympe.dm.Jf.create=olympe.dm.Jf.create;olympe.dm.Jf.prototype.getValues=olympe.dm.Jf.prototype.Lw;olympe.dm.Jf.P=olympe.dc.na.C('017a768f966fc08ebb98',olympe.dm.Jf);olympe.dm.Number=class extends olympe.dm.Ke{getValue(){return this.Vc(olympe.dm.Number.valueProp)}};olympe.dm.Number.P=olympe.dc.na.C('ff021000000000000013',olympe.dm.Number);olympe.dm.Number.valueProp=olympe.dm.Number.P.ka('ff023000000000000028');B('olympe.dm.Number.valueProp',olympe.dm.Number.valueProp);olympe.dm.Number.prototype.getValue.K=olympe.D.J.G;olympe.sc={};olympe.sc.R={Ca:'sc.Logger',Ij:'sc.RootContext',ae:'sc.Serializer'};olympe.sc.U={Be:'sc.app',Ff:'sc.debug',jn:'sc.autostartProfiler',eo:'sc.debugger',rs:'sc.disableTheme',PRODUCTION:'sc.production',Rt:'sc.onstartTimeout',Yp:'sc.remoteActionTimeout'};
|
|
961
|
+
olympe.W.config(a=>{G(a,olympe.sc.U.Be,'');G(a,olympe.sc.U.Ff,!1);G(a,olympe.sc.U.rs,!0);G(a,olympe.sc.U.PRODUCTION,!1);G(a,olympe.sc.U.Rt,2E4);G(a,olympe.sc.U.Yp,3E4);G(a,olympe.sc.U.jn,!1);F(a,olympe.sc.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('sc'));E(a,olympe.sc.R.ae,olympe.sc.ug,olympe.dc.R.bf);wa(a,olympe.dc.sources.R.ae,olympe.sc.R.ae);F(a,olympe.sc.R.Ij,[new olympe.W.ja(olympe.sc.U.PRODUCTION)],b=>{const c=new olympe.sc.cg('root','root',null);olympe.sc.Wm=c;c.set(olympe.sc.wa.C.PRODUCTION,b);return new olympe.sc.wa(c)})},
|
|
962
|
+
'olympe.sc');olympe.W.run([olympe.sc.R.Ij,new olympe.W.ja(olympe.N.U.Pk)],(a,b)=>{olympe.ge().ctx=a;olympe.ge().oVersion=()=>b});olympe.sc.Nm=()=>null!==olympe.dc.ia().Pb(void 0,olympe.sc.Runnable.C.Vb());olympe.sc.qC=(a,b,c,d)=>{c=Z(Z(a.create(olympe.sc.Rc),olympe.sc.Rc.C,c||null),olympe.sc.Rc.G,d||null);a.Ea(olympe.sc.Rc.F,c,b);a.Ea(olympe.dc.CloudObject.containsRel,b,c);return c.X()};olympe.sc.Bg=a=>{a=olympe.dc.Lb.Bg(a);return a instanceof olympe.sc.Ie?a.F():a};olympe.sc.um=a=>{a=olympe.sc.Bg(a);return a instanceof olympe.dm.Enum?a.get(olympe.dm.String.valueProp):a};
|
|
963
|
+
olympe.sc.JC=function(a){olympe.dm.Ib.C.Vb();const b=olympe.dc.CloudObject.containsRel.Vb();var c=olympe.dc.ga(a);if(void 0===c)return[];a=olympe.dc.ia();const d=[];let e=[];const f=new Set;for(;!a.jc(c,olympe.dm.Ib);){f.add(c);const g=a.Pb(c,b);if(null===g)return olympe.ma.ab('sc').warn(`Object ${c} has no container`),[];a.jc(c,olympe.sc.logic.nb)||g===a.Pb(c,olympe.sc.Runnable.C.Vb())||d.push(c);c=g;if(f.has(c))throw Error(`Instance ${c} (${a.name(c)}) is part of a cyclic contain pattern`);}e.push(c);
|
|
964
|
+
e=e.concat(a.Jg(e[0],olympe.dm.Ib.Ja));e=e.concat(a.Jg(e[e.length-1],olympe.dm.Cc.Z.Vb()));e=e.concat(a.Jg(e[e.length-1],olympe.dm.Cc.O.Vb()));return[...d,...e].reverse()};olympe.sc.LC=a=>{a=a&&a.valueOf()||'';return a.startsWith('image/')?olympe.sc.gg:a.startsWith('video/')?olympe.sc.qh:a.startsWith('font/')||a.startsWith('application/font-woff')?olympe.sc.Ac:olympe.dm.File};
|
|
965
|
+
olympe.sc.HC=a=>a instanceof olympe.sc.gg?'image/*':a instanceof olympe.sc.qh?'video/*':a instanceof olympe.sc.Ac?'font/*,application/font-woff':null;olympe.sc.Za={};function Gl(a,b){var c=olympe.sc.wa,d=a.C;a=a.F();b=olympe.dc.ga(b);let e,f=null==(e=d.F)?void 0:e.get(b);if(!f){f=d.xh(a,void 0,b);for(d=f.getParent();d&&d.oa&&!d.id.startsWith('_');)d=d.getParent();let g;null==(g=d)||Hl(g,b,f)}return new c(f)}function Il(a){let b;return null!=(b=a.Ra(olympe.sc.wa.C.PRODUCTION))?b:!1}
|
|
966
|
+
olympe.sc.wa=class{constructor(a=olympe.sc.Wm){this.C=a;this.H=olympe.ma.ab('sc');this.G=null}V(){return this.C.V()}getParent(){if(null===this.G){const a=this.C.getParent();this.G=null===a?null:new olympe.sc.wa(a)}return this.G}Rv(a){const b=olympe.dc.ia();let c=this.getParent();const d=e=>{if(e.fe()){const f=b.model(e.fe());if(f&&b.Ka(f,olympe.sc.Ua.fa)||a.modelTag&&!b.jc(e.fe(),a.modelTag))return!1}return!0};for(;c&&!d(c);)c=c.getParent();return c}fe(){return this.C.fe()}F(){return this.C.C}set(a,
|
|
967
|
+
b){this.C.set(a,b);return this}cn(a){return this.set(a,Date.now())}remove(a){this.set(a,null)}rb(a,b,c=!1){const d=olympe.dc.ga(a),e=olympe.D.fc(null!=b?b:Object,`Get context value flow source of ${d}`);e.getContext().onDestroy(this.on(a,f=>{null===f?e.clear():e.update(f)},c?this.C.V():void 0));return e.rb()}get(a,b=!1){a=this.Ra(a,b);return void 0!==a?a:null}has(a,b=!1){return this.C.has(a,b)}observe(a,b=!0,c=!1){return new rxjs.Observable(d=>{const e=this.get(a);b||null!==e||d.next(e);const f=this.on(a,
|
|
968
|
+
d.next.bind(d),c?void 0:this.C.V(),!1);this.onDestroy(()=>{f();d.complete()});return f})}repeat(a,b){const c=Jl(this.C,a);a=b.subscribe(d=>{null!==d?this.set(c,d):this.remove(c)});this.Rg(a.unsubscribe.bind(a));return this}Ix(a){a=a instanceof olympe.sc.Runnable?a:this.get(a);if(!a)return null;const b=this.xh(`Runner ${a.name()}`);a.run(b);return b}Hr(a,b=!0,c=!1){return new Promise((d,e)=>{this.observe(a,b,c).pipe(rxjs.operators.first()).subscribe(rxjs.Subscriber.create(d,f=>{let g=`An error occurred while calling \`waitFor(${olympe.dc.ga(a)})\``+
|
|
969
|
+
`on the context ${this.V()}:\nStack: ${this.ie()}\n${f}`;f instanceof rxjs.EmptyError&&(g=`The context ${this.V()} has been destroyed while a Promise `+`created from a call to \`waitFor(${olympe.dc.ga(a)})\` `+`has never received any value:\nStack: ${this.ie()}`);e(Error(g))}))})}throw(a){var b=a instanceof Error?a.message:String(a);if(a instanceof Error){var c;const d=(null==(c=a.ie)?void 0:c.call(a))||this.ie();let e,f;c=null!=(f=null==(e=a.ir)?void 0:e.call(a))?f:0;b=Kl(b,c,d);b.stack=a.stack}else b=
|
|
970
|
+
Kl(b,0,this.ie());Ll(this.C,b);return this}Kx(a){this.set(olympe.sc.wa.C.bg,a);return this}Ra(a,b=!0){return this.C.Ra(a,b)}on(a,b,c,d=!0){return this.C.on(a,b,c,d)}xh(a){return new olympe.sc.wa(this.C.xh(this.F(),a))}vk(a,b){return this.C.vk(a,c=>{b(new olympe.sc.wa(c))})}vw(a){a=Ml(this.C,a);return a===this.C?this:a&&new olympe.sc.wa(a)}destroy(){this.C.destroy()}Rg(a,b){return this.C.Rg(a,b)}tk(a){this.C.tk(a)}onDestroy(a){return this.eb()?(a(),'noId'):this.F().onDestroy(a)}zf(a){this.eb()||this.F().zf(a)}clear(){this.C.clear()}eb(){return this.F().eb()}Ka(a){a=
|
|
971
|
+
Nl(this.C,a);return null!==a?new olympe.sc.ui.uy(a,this):null}fw(a){a=Nl(this.C,a);return null!==a?new olympe.sc.ui.ty(a,this):null}px(...a){return rxjs.combineLatest(a.map(b=>{b=Nl(this.C,b);return null!==b?this.observe(b):rxjs.of(null)}))}Qa(a){return(null==a?void 0:a.constructor)!==this.constructor?!1:this.C===a.C}ie(){const a=olympe.dc.ia();let b;try{const c=[this];let d=this.getParent();for(;null!==d&&d.C!==olympe.sc.Wm;)c.push(d),d=d.getParent();b='> '+c.map(e=>{const f=e.fe();return null!==
|
|
972
|
+
f?(e=a.model(f),`${a.name(f)||e&&a.name(e)||f} (${e})`):e.V()}).join('\n> ')}catch(c){b=`No stack available for context ${this.V()}: ${c}`,this.H.warn(b)}return b}};olympe.sc.wa.prototype.observeMany=olympe.sc.wa.prototype.px;olympe.sc.wa.prototype.getEvent=olympe.sc.wa.prototype.fw;olympe.sc.wa.prototype.getProperty=olympe.sc.wa.prototype.Ka;olympe.sc.wa.prototype.isDestroyed=olympe.sc.wa.prototype.eb;olympe.sc.wa.prototype.clear=olympe.sc.wa.prototype.clear;olympe.sc.wa.prototype.offDestroy=olympe.sc.wa.prototype.zf;
|
|
973
|
+
olympe.sc.wa.prototype.onDestroy=olympe.sc.wa.prototype.onDestroy;olympe.sc.wa.prototype.offClear=olympe.sc.wa.prototype.tk;olympe.sc.wa.prototype.onClear=olympe.sc.wa.prototype.Rg;olympe.sc.wa.prototype.destroy=olympe.sc.wa.prototype.destroy;olympe.sc.wa.prototype.getOtherContext=olympe.sc.wa.prototype.vw;olympe.sc.wa.prototype.onContext=olympe.sc.wa.prototype.vk;olympe.sc.wa.prototype.createChild=olympe.sc.wa.prototype.xh;olympe.sc.wa.prototype.setParentElement=olympe.sc.wa.prototype.Kx;
|
|
974
|
+
olympe.sc.wa.prototype['throw']=olympe.sc.wa.prototype.throw;olympe.sc.wa.prototype.waitFor=olympe.sc.wa.prototype.Hr;olympe.sc.wa.prototype.runner=olympe.sc.wa.prototype.Ix;olympe.sc.wa.prototype.repeat=olympe.sc.wa.prototype.repeat;olympe.sc.wa.prototype.observe=olympe.sc.wa.prototype.observe;olympe.sc.wa.prototype.has=olympe.sc.wa.prototype.has;olympe.sc.wa.prototype.get=olympe.sc.wa.prototype.get;olympe.sc.wa.prototype.remove=olympe.sc.wa.prototype.remove;olympe.sc.wa.prototype.trigger=olympe.sc.wa.prototype.cn;
|
|
975
|
+
olympe.sc.wa.prototype.set=olympe.sc.wa.prototype.set;olympe.sc.wa.prototype.getClosest=olympe.sc.wa.prototype.Rv;olympe.sc.wa.prototype.getParent=olympe.sc.wa.prototype.getParent;olympe.sc.wa.C={PRODUCTION:'__production',EDITION:'__editionMode',TRANSACTION:'__transaction',bg:'__htmlContainer',Iy:'__dockableElement',gn:'__appHasStarted'};olympe.sc.Mq=class extends olympe.sc.wa{constructor(a){super(a);this.L=new olympe.D.Yb('SC Update Context',super.F());const b=a.Rg(()=>{b&&a.tk(b);this.L.destroy()})}F(){return this.L}Rg(a,b){return this.F().onDestroy(a,null!=b?b:olympe.Y.Fc())}};let Ol=0;function Jl(a,b){b=olympe.dc.ga(b);let c,d,e,f;return null!=(f=null!=(e=null==(c=a.ba)?void 0:c.get('I#'+b))?e:null==(d=a.ba)?void 0:d.get('IO#'+b))?f:b}
|
|
976
|
+
function Ll(a,b){if(null===a.L)a.H.error(`An error occurred in a brick: ${b.message}\nError found in:\n${b.ie()}\n\n${b.stack}`);else if(a.fa){var c=Pl(olympe.dc.CloudObject.get(a.fa));null!==c&&Ql(a,c).some(d=>{let e,f;return 0<(null==(e=a.G)?void 0:null==(f=e.get(d))?void 0:f.size)})&&!a.O.has('$'+c)?a.set(c,b):Ll(a.L,b)}else Ll(a.L,b)}
|
|
977
|
+
function Ml(a,b){if(b===a.id||a.T.has(b)||!b)return a;for(a=a.L;a;){if(b===a.V()||a.T.has(b))return a;const c=Rl(a.F,b);if(c)return c;a=a.getParent()}return null}function Sl(a,b,c=0){null===a.Za&&(a.Za=new Map);a.Za.has(b.V())||(a.Za.set(b.V(),{wk:b,depth:c}),Tl(a,d=>{(-1===b.G||c<b.G)&&Sl(d,b,c+1)}),a.onDestroy(()=>{Ul(a,b.V())}));return b.V()}
|
|
978
|
+
function Ul(a,b){if(null===a.Za||!a.Za.has(b))return!1;const {wk:c,depth:d}=a.Za.get(b);Tl(a,f=>{Ul(f,b)});0===d&&c.F();const e=a.Za.delete(b);0===a.Za.size&&(a.Za=null);return e}function Nl(a,b){let c;return(null==(c=a.ba)?void 0:c.get('IO#'+b))||null}
|
|
979
|
+
function Vl(a){a.C.Z(()=>{Tl(a,c=>c.destroy())});a.C.onDestroy(()=>{void 0!==a.Ra(olympe.sc.wa.C.TRANSACTION,!1)&&a.H.warn(`The context ${a.V()} is being destroyed but still has unreleased transactions. You probably forgot to end a transaction.`);let c;if(null!=(c=a.L)){let d;null==(d=c.F)||d.delete(a.V());let e;0===(null==(e=c.F)?void 0:e.size)&&(c.F=null)}a.T.clear()});let b;null==(b=a.L)||Wl(b,a)}
|
|
980
|
+
function Rl(a,b){if(null===a)return null;if(a.has(b))return a.get(b);for(const c of a.values())if(c.oa&&!c.id.startsWith('_')&&(a=Rl(c.F,b)))return a;return null}function Xl(a,b,...c){if(null!==a.Za)for(const {wk:d,depth:e}of a.Za.values())d.process(a,b,e,...c)}function Yl(a,b){a.fa=olympe.dc.ga(b);a.oa=b.rd().Nm();b.G().forEach(c=>{a.id===c||a.T.has(c)||(a.T.add(c),Hl(a,c,a))});a.ba=b.T();Xl(a,olympe.sc.Za.mc.C.INIT)}function Zl(a){a.za=!0;let b;null==(b=a.F)||b.forEach(c=>{Zl(c)})}
|
|
981
|
+
function $l(a){a.za=!1;let b;null==(b=a.F)||b.forEach(c=>{$l(c)})}function Ql(a,b){return['*',a.id,...a.T].map(c=>`${'@'}${c}.${b}`)}function am(a,b,c,d){c.forEach(f=>{let g,h;null==(g=a.G)||null==(h=g.get(f))||h.forEach(k=>{k(d)})});let e;null==(e=a.F)||e.forEach(f=>{!f.za&&f.data.has(b)||am(f,b,c,d)})}function bm(a,b,c){a.G||(a.G=new Map);let d=a.G.get(b);void 0===d&&(d=new Map,a.G.set(b,d));Ol++;const e=Ol;d.set(e,c);return()=>{const f=a.G.get(b);f&&(f.delete(e),0===f.size&&a.G.delete(b))}}
|
|
982
|
+
function Hl(a,b,c){a.O.add(b);let d,e;null==(d=a.G)||null==(e=d.get('&'+b))||e.forEach(f=>{f(c)});Tl(a,f=>{f.O.has(b)||Hl(f,b,c)});a.O.delete(b)}function Tl(a,b){let c;null==(c=a.F)||c.forEach(b)}function cm(a,b){a.data.forEach((c,d)=>b(c,d.slice(1)))}function dm(a){var b=olympe.sc.Za.mc.F.jf;const c=[];if(null!==a.Za)for(const {wk:d}of a.Za.values())d.getType()===b&&(c.push(d.V()),d.F(),Ul(a,d.V()))}function Wl(a,b){null===a.F&&(a.F=new Map);a.F.set(b.id,b)}
|
|
983
|
+
olympe.sc.cg=class{constructor(a,b='no name',c=olympe.sc.Wm){this.id=a;this.gd=b;this.T=new Set;this.L=c;this.C=new olympe.D.Yb('SC Context');this.data=new Map;this.fa=this.Z=this.F=this.G=null;this.oa=!1;this.O=new Set;this.za=!1;this.ba=null;this.H=olympe.ma.ab('sc');this.Za=null;Vl(this)}V(){return this.id}getParent(){return this.L}fe(){return this.fa}set(a,b){if(!this.C.Wc()&&!this.C.eb()){const g=olympe.dc.ga(a);var c,d;let h,k;a=null!=(k=null!=(h=null==(c=this.ba)?void 0:c.get('O#'+g))?h:null==
|
|
984
|
+
(d=this.ba)?void 0:d.get('IO#'+g))?k:g;c='$'+a;var e;d=null!=(e=this.data.get(c))?e:null;b=null!=b?b:null;if(e=!this.O.has(c)){a:{if('function'===typeof(null==b?void 0:b.Qa))try{var f=b.Qa(d);break a}catch(l){f=!1;break a}f=b===d}e=!f}e&&(null===b?this.data.delete(c):this.data.set(c,b),null!==this.Za&&0<this.Za.size&&Xl(this,olympe.sc.Za.mc.C.Nj,a,b),f=Ql(this,a),this.O.add(c),am(this,c,f,b),this.O.delete(c))}}on(a,b,c,d=!0){if(this.C.eb()||this.C.Wc())return()=>{};const e=Jl(this,a),f=c?olympe.dc.ga(c):
|
|
985
|
+
'*';a=bm(this,'@'+f+'.'+e,b);c=c?(c=Ml(this,f))?c.Ra(e,!1):void 0:this.Ra(e);void 0!==c&&b(c);if(d)olympe.D.Xa().onDestroy(a);return a}has(a,b=!1){a='$'+Jl(this,a);let c=this.data.has(a),d=this.getParent();if(b)for(;!c&&d;)c=d.data.has(a),d=d.getParent();return c}xh(a,b,c){const d=null!=c?c:'_'+olympe.Y.Fc();if(a.eb()||a.Wc())throw Error(`Try to create new child context in a destroyed context ${a.V()}, probably because \`runner()\` is called on a destroyed context`);const e=a.run(()=>new olympe.sc.cg(d,
|
|
986
|
+
b,this));null!==this.Za&&0<this.Za.size&&this.Za.forEach(({wk:f,depth:g})=>{(-1===f.G||g<f.G)&&Sl(e,f,g+1)});return e}vk(a,b){const c=Ml(this,a);if(c)return b(c),()=>{};const d=bm(this,'&'+a,e=>{let f;null==(f=d)||f();b(e)});return d}Ra(a,b=!0){a='$'+Jl(this,a);let c=this.data.get(a),d=this.getParent();if(b)for(;void 0===c&&null!==d;)c=d.data.get(a),d=d.getParent();return c}destroy(){this.C.Wc()||this.C.eb()||(Xl(this,olympe.sc.Za.mc.C.fj),this.C.destroy(),Xl(this,olympe.sc.Za.mc.C.Ld))}Rg(a,b){if(this.C.eb())a();
|
|
987
|
+
else return Ol++,b=null!=b?b:String(Ol),null===this.Z&&(this.Z=new Map),this.Z.set(b,a),b;return b||'noId'}tk(a){null!==this.Z&&this.Z.delete(a)}onDestroy(a){return this.eb()?(a(),'noId'):this.C.onDestroy(a)}clear(){if(!this.C.Wc()&&!this.C.eb()){Xl(this,olympe.sc.Za.mc.C.aj);let a;null==(a=this.Z)||a.forEach(b=>b());Xl(this,olympe.sc.Za.mc.C.bj)}}eb(){return this.C.eb()}};olympe.sc.cg.prototype.getParent=olympe.sc.cg.prototype.getParent;olympe.sc.cg.C={ol:'I#',Fl:'O#',Cz:'IO#'};function em(a,b,c){return(c=c.fe())?`${a}.${c}.${b}`:`${a}.${b}`}olympe.sc.Za.mc=class{constructor(a=-1){this.id=olympe.Y.tf();this.active=!0;this.G=a}F(){this.active=!1}V(){return this.id}getType(){}process(){}};olympe.sc.Za.mc.C={INIT:'INIT',Nj:'SET',aj:'CLEAR',bj:'CLEARED',fj:'DESTROY',Ld:'DESTROYED'};olympe.sc.Za.mc.F={jf:'REMOTE',yt:'LOCAL',Lf:'PROFILER'};olympe.sc.Md=class a{constructor(){this.F=this.L=this.O=null;this.T=new Map;this.G=new Map;this.C=new olympe.Y.am(1E4);Ka(this.C,b=>{dm(b)})}ba(b,c,d){const e=b.body(),f=e.c,g=this.T.get(f);switch(e.t){case olympe.sc.Md.C.Wt:c=this.G.get(e.f);b.kd(c).catch(l=>{d.error('Unable to reply with paths: ',l)});break;case olympe.sc.Md.C.Xt:const h=f+c,k=(l,n,p=0)=>{cm(l,(q,r)=>{let t;q instanceof olympe.dc.CloudObject?t=a.G(q):t=q;let u;q=null!=(u=l.fe())?u:'';0<q.length&&(q+='.');n.push([`${p}.${q}${r}`,
|
|
988
|
+
t])})};b.Sm(h).then(()=>{const l=[];k(g,l,0);Tl(g,p=>{k(p,l,1)});olympe.N.wb.publish(h,{t:olympe.sc.Md.C.Ts,v:l,ts:0}).catch(p=>{d.error('Error publishing on service : ',p)});const n=new olympe.sc.Za.mu(h);Sl(g,n);this.C.has(g)?Ia(this.C,g):this.C.add(g)}).catch(l=>{d.error('Error notifying on a contextId : ',l)});break;case olympe.sc.Md.C.Yt:void 0!==g&&this.C.has(g)&&Ia(this.C,g);break;case olympe.sc.Md.C.al:void 0!==g&&(this.C.delete(g),dm(g))}}fa(b,c,d){this.O=new olympe.N.wb('discovery_debug_id',
|
|
989
|
+
c);this.O.listen().subscribe(e=>{var f=e.body();if(f.t===olympe.sc.Md.C.ss){e=f.i;f=f.f;if(!this.G.has(f)){const g=this.Z(f,c,b);if(0!==g.length)this.G.set(f,g);else return}null===this.F&&(this.F=olympe.Y.tf(),f=new olympe.D.Yb(this.F,c.F()),this.L=new olympe.N.wb(this.F,f),this.L.listen().subscribe(g=>{this.ba(g,b,d)}));olympe.N.wb.publish(e,{t:olympe.sc.Md.C.Ir,n:olympe.W.getParameter(olympe.sc.U.eo)||'no name',a:b,s:this.F}).catch(g=>{d.error('Error publishing on draw service : '+g)})}})}Z(b,c,
|
|
990
|
+
d){const e=[],f=olympe.dc.ia(),g=(h,k)=>{Tl(h,l=>{if(null!==l.fe()){const n=olympe.dc.CloudObject.get(l.fe()).ck(olympe.sc.Runnable.L).hd();if(null!==n){const p=k+'/'+f.name(n);n.X()===b&&(e.push([p,l.V()]),this.T.set(l.V(),l));g(l,p)}}})};g(c.C,f.name(d));return e}static F(b,c,d){let e=d;d instanceof olympe.dc.CloudObject&&(e=a.G(d));olympe.N.wb.publish(b,{t:olympe.sc.Md.C.Vj,k:c,v:e,ts:Date.now()}).catch(f=>{olympe.ma.ab('Debugger').error('Error publishing on service : ',f)})}static G(b){if(null===
|
|
991
|
+
b||void 0===b)return'<null>';const c=olympe.dc.ia();if(b instanceof olympe.dc.CloudObject){var d=b.cc();if(!c.jc(d,olympe.sc.Qc))return b.toString();let f=`${b.Ec().name()} (${b.X()})`;var e=olympe.dc.CloudObject.get(d);d=olympe.dc.pa.from(e).Sf(olympe.dc.CloudObject.extendRel,!0).ce().cb(olympe.dc.CloudObject.propertyRel).ce().hd();e=olympe.dc.pa.from(e).Sf(olympe.dc.CloudObject.extendRel,!0).ce().cb(olympe.dc.CloudObject.Oi).ce().hd();d=d.filter(([g])=>g instanceof olympe.sc.Qc);0!==d.length&&(f+=
|
|
992
|
+
'<br> ',f+='Properties:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+' : '+c.Ka(b.X(),g)+'<br>'}));d=e.filter(([g])=>g instanceof olympe.sc.Qc);0!==d.length&&(f+=' ',f+='Relations:<br>',d.forEach(([,g])=>{f+=' ';f+=' - '+c.name(g)+'<br>'}));return f}return b.toString()}};olympe.sc.Md.L='discovery_debug_id';olympe.sc.Md.C={ss:0,Ir:1,Wt:2,Xt:3,Ts:4,Vj:5,Yt:6,al:7};olympe.sc.Za.Iz=class extends olympe.sc.Za.mc{constructor(a=-1){super(a);this.C=new Map}getType(){return olympe.sc.Za.mc.F.yt}process(a,b,c,...d){if(this.active&&b===olympe.sc.Za.mc.C.Nj){a=em(c,Jl(a,d[0]),a);d=d[1];let e;null==(e=this.C.get(a))||e(d)}}on(a,b){this.C.set(a,b)}};function fm(a,b,c,d=new Map){for(var e=[];b;){const n=b.fe();if(!n)break;e.push(n);b=b.getParent()}Qa(a.C,c,d.set('context',e));var f;let g;for(const n of[...e,null==(f=d)?void 0:f.get('propId'),null==(g=d)?void 0:g.get('type')])if(c=n,'string'===typeof c&&!a.L.has(c)){e=a;f=c;e.ia||(e.ia=olympe.dc.ia());d=e.ia.name(f);e=(f=e.ia.model(f))?e.ia.name(f):'';var [h,k,l]=[d,f,e];d=a.C;e=(new Map).set(c,h).set(k,l);c=(new Map).set(c,k);for(const [p,q]of e.entries())d.O.set(p,q);for(const [p,q]of c.entries())d.L.set(p,
|
|
992
993
|
q)}}
|
|
993
|
-
olympe.sc.Za.
|
|
994
|
-
fm(this,a,b?e:d?f:c,new Map([['propId',q],['value',r],['type',g]]))):d&&(e=this.
|
|
995
|
-
const gm={
|
|
996
|
-
e,f)});this.C.set(e,()=>{
|
|
997
|
-
olympe.sc.
|
|
998
|
-
olympe.sc.Ua=class extends olympe.dm.BrickMetadata{
|
|
999
|
-
olympe.sc.logic.Ab)}G(){return[olympe.sc.Ua.
|
|
1000
|
-
olympe.sc.Ua.F=olympe.sc.Ua.P.sa('01621fb84e320000f00b');olympe.sc.Ua.Kc=olympe.sc.Ua.P.sa('0171838bcfed0000e00e');olympe.sc.Ua.hc=olympe.sc.Ua.P.sa('0171838bcfed0000a00a');m=olympe.sc.Ua.prototype;m.
|
|
1001
|
-
function km(a,b){Yl(b.C,a);hm(a.
|
|
1002
|
-
function nm(a,b){var c=a.
|
|
994
|
+
olympe.sc.Za.eu=class extends olympe.sc.Za.mc{constructor(a){super();this.C=a;this.ia=olympe.dc.ia();this.L=new Set}getType(){return olympe.sc.Za.mc.F.Lf}process(a,b,c,...d){var e=gm.ol,f=gm.Fl,g=gm.Zt;const h=gm.INIT,k=gm.aj,l=gm.bj,n=gm.fj,p=gm.Ld;c=gm.Tt;if(b===olympe.sc.Za.mc.C.Nj){const [q,r]=d;b=(d=a.fe())?olympe.dc.ia().jc(d,olympe.sc.logic.Function):!1;d=d?olympe.dc.ia().jc(d,olympe.sc.ui.vA):!1;b?(g=this.ia.Pb(q,olympe.dm.Property.typeRel),b=this.ia.jc(q,olympe.sc.logic.sb),d=this.ia.jc(q,olympe.sc.logic.Ab),
|
|
995
|
+
fm(this,a,b?e:d?f:c,new Map([['propId',q],['value',r],['type',g]]))):d&&(e=this.ia.jc(q,olympe.dm.Property),f=this.ia.Pb(q,olympe.dm.Property.typeRel),fm(this,a,e?g:c,new Map([['propId',q],['value',r],['type',f]])))}else b===olympe.sc.Za.mc.C.INIT?fm(this,a,h):b===olympe.sc.Za.mc.C.aj?fm(this,a,k):b===olympe.sc.Za.mc.C.bj?fm(this,a,l):b===olympe.sc.Za.mc.C.fj?fm(this,a,n):b===olympe.sc.Za.mc.C.Ld&&fm(this,a,p)}};
|
|
996
|
+
const gm={ol:'input',Fl:'output',Zt:'prop',INIT:'init',aj:'clear',bj:'cleared',fj:'destroy',Ld:'destroyed',Tt:'other'};olympe.sc.Za.mu=class extends olympe.sc.Za.mc{constructor(a){super(1);this.L=a;this.C=new Map;this.db=olympe.dc.ia()}getType(){return olympe.sc.Za.mc.F.jf}F(){super.F();for(const a of this.C.values())a();this.C.clear()}process(a,b,c,...d){if(this.active&&b===olympe.sc.Za.mc.C.Nj&&void 0!==d[0]&&null!==d[0]){const e=em(c,Jl(a,d[0]),a),f=d[1];let g;null==(g=this.C.get(e))||g();this.C.delete(e);if(f instanceof olympe.dc.CloudObject&&f.Ec()instanceof olympe.sc.Qc){const h=Wf(this.db,f,()=>{olympe.sc.Md.F(this.L,
|
|
997
|
+
e,f)});this.C.set(e,()=>{Xf(this.db,f,h)})}olympe.sc.Md.F(this.L,e,f)}}};olympe.sc.Metadata=class extends olympe.dc.CloudObject{kt(){return this.Vc(this.Jm())}lt(){return this.Vc(this.Km())}ik(){return new olympe.D.Sb(this.Vc(this.Jm()),this.Vc(this.Km()))}Jm(){}Km(){}};olympe.sc.Metadata.P=olympe.dc.na.C('0161ae936c62f9fcd131',olympe.sc.Metadata);m=olympe.sc.Metadata.prototype;m.kt.K=olympe.D.J.G;m.lt.K=olympe.D.J.G;m.ik.K=olympe.D.J.T;m.Jm.K=olympe.D.J.C;m.Km.K=olympe.D.J.C;olympe.sc.Rc=class extends olympe.dc.CloudObject{F(){return this.ub(olympe.sc.Rc.G)}C(){return this.ub(olympe.sc.Rc.C)}};olympe.sc.Rc.P=olympe.dc.na.C('01703376c4a81c0e9d90',olympe.sc.Rc);olympe.sc.Rc.G=olympe.sc.Rc.P.ka('01703376c4a81c0e9d91');olympe.sc.Rc.C=olympe.sc.Rc.P.ka('01703376c4a81c0e9d92');olympe.sc.Rc.F=olympe.sc.Rc.P.sa('01703376c4a81c0e9d93');U(olympe.dc.CloudObject.P,olympe.sc.Rc.F);olympe.sc.Rc.prototype.F.K=olympe.D.J.F;olympe.sc.Rc.prototype.C.K=olympe.D.J.F;olympe.sc.ud={};olympe.sc.ud.te={Cs:'folders',qu:'screenflow',Nu:'ui-design',sq:'software-intelligence',Yg:'data-management',kA:'projects'};olympe.sc.cd=class extends olympe.dm.BrickMetadata{le(){return olympe.sc.ud.te.sq}C(){return this.bb(olympe.sc.cd.C,olympe.sc.logic.jh)}F(){return this.bb(olympe.sc.cd.F,olympe.sc.logic.ng)}};olympe.sc.cd.P=olympe.dc.na.C('011100000000000adef0',olympe.sc.cd);olympe.sc.cd.C=olympe.sc.cd.P.sa('016ac4f59a2917fdef01');olympe.sc.cd.F=olympe.sc.cd.P.sa('016ac4f59a2917fdef02');olympe.sc.cd.P.C=(a,b)=>xk(a,b||'New function signature',olympe.sc.cd,olympe.sc.logic.nd).X();
|
|
998
|
+
olympe.sc.cd.prototype.C.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.sc.cd.prototype.F.K=new olympe.D.J(()=>olympe.dc.ya,[]);function hm(a,b){[].forEach(c=>c.call(a,b,(d,e)=>{null===e?b.remove(d):b.set(d,e)}))}function im(a,b){b=b.filter(c=>'string'===typeof c&&a.db.jc(c,olympe.sc.logic.Rb));b.sort((c,d)=>{let e;c=null!=(e=a.db.Ka(c,olympe.sc.logic.Rb.C,!0))?e:0;let f;d=null!=(f=a.db.Ka(d,olympe.sc.logic.Rb.C,!0))?f:0;return c-d});return b}
|
|
999
|
+
olympe.sc.Ua=class extends olympe.dm.BrickMetadata{nt(a,b,c,d,e=!0){e||olympe.ma.ab('sc').error('parameter own= false ignored, investigate');return olympe.D.Sg(O(this.xf(a,olympe.dc.Lb.Bg,c)),d)}Cw(){return this.bb(olympe.sc.Ua.O,olympe.sc.Runnable)}Uv(){return this.bb(olympe.sc.Ua.Z,olympe.sc.Runnable)}Qm(){return this.db.Ka(this,olympe.sc.Ua.fa)}Nm(){return null!==this.db.Pb(this.tag,olympe.sc.Runnable.C.Vb())}mt(){return this.bb(olympe.sc.Ua.G,olympe.sc.logic.sb)}fp(){return this.bb(olympe.sc.Ua.F,
|
|
1000
|
+
olympe.sc.logic.Ab)}G(){return[olympe.sc.Ua.ob]}};olympe.sc.Ua.P=olympe.dc.na.C('0112000000000000def0',olympe.sc.Ua);olympe.sc.Ua.fa=olympe.sc.Ua.P.ka('01692aa71f3108454479');olympe.sc.Ua.tb=olympe.sc.Ua.P.ka('0166446c1f128ebc903a');olympe.sc.Ua.ob=olympe.sc.Ua.P.ka('0166446c1f128ebc904e');olympe.sc.Ua.O=olympe.sc.Ua.P.sa('01692a4af82e8984742c');olympe.sc.Ua.Z=olympe.sc.Ua.P.sa('01692a4af82e8984742d');olympe.sc.Ua.ba=olympe.sc.Ua.P.sa('01692a4af82e8984742e');olympe.sc.Ua.G=olympe.sc.Ua.P.sa('01621fb84e320000f00a');
|
|
1001
|
+
olympe.sc.Ua.F=olympe.sc.Ua.P.sa('01621fb84e320000f00b');olympe.sc.Ua.Kc=olympe.sc.Ua.P.sa('0171838bcfed0000e00e');olympe.sc.Ua.hc=olympe.sc.Ua.P.sa('0171838bcfed0000a00a');m=olympe.sc.Ua.prototype;m.nt.K=olympe.D.J.C;m.Cw.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.Uv.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.Qm.K=olympe.D.J.C;m.Nm.K=olympe.D.J.C;m.mt.K=new olympe.D.J(()=>olympe.dc.ya,[]);m.fp.K=new olympe.D.J(()=>olympe.dc.ya,[]);function Pl(a){let b;return null!=(b=a.rd().G().map(olympe.dc.ga)[0])?b:null}function jm(a){const b=new olympe.dc.Wa;a=b.create(a);b.persist(a,!1);b.lb((d,e)=>{d||olympe.ma.ab('sc').error(`Error occurred for transaction executed by createLocalRunnable: ${e}`)});const c=olympe.dc.CloudObject.get(a);olympe.D.Xa().onDestroy(()=>{const d=new olympe.dc.Wa;d.delete(c);d.lb()});return c}
|
|
1002
|
+
function km(a,b){Yl(b.C,a);hm(a.rd(),b);const c=a.O(),d=lm(b,c),e=[];c.forEach((f,g)=>{f===a.fa?e[0]=g:f===a.ba&&(e[1]=g)});void 0!==e[0]&&void 0!==e[1]&&(mm(a,b,d[e[0]],d[e[1]]),c[e[0]]=null,c[e[1]]=null);c.forEach((f,g)=>{f&&f.call(a,b,d[g])})}
|
|
1003
|
+
function nm(a,b){var c=a.cc();const d=a.db.name(c),e=`Brick ${d} successfully run`,f=`Brick ${d} successfully cleared`,g=a.C(b);c=a.setupExecution(b).pipe(rxjs.operators.map(h=>{if(!b.eb()&&(b.clear(),null!==h)){const k=Array.isArray(h)?h:[h],l=new olympe.sc.Mq(b.C);l.F().run(()=>x(function*(){try{yield a.update(l,k,g)}catch(n){l.throw(n)}}));return!0}return!1})).subscribe(rxjs.Subscriber.create(h=>h?a.H.debug(e):a.H.debug(f),h=>b.throw(h),()=>a.H.debug(`Brick ${d} completed`)));b.onDestroy(c.unsubscribe.bind(c))}
|
|
1003
1004
|
function om(a,b,c,d){const e=W(a.db,b,c,(f,g)=>{const h=Gl(d,g);f?olympe.dc.CloudObject.get(g).run(h):h.destroy()});d.F().onDestroy(a.db.F.bind(a.db,b,c,e,!0))}function lm(a,b){if(1===b.length)return[(d,e)=>{null!==e?a.set(d,e):a.remove(d)}];const c=b.map(()=>new Map);return c.map(d=>(e,f)=>{null!==f?d.set(e,f):d.delete(e);a:{for(const g of c)if(f=g.get(e),void 0!==f){a.set(e,f);break a}a.remove(e)}})}
|
|
1004
|
-
function mm(a,b,c,d){b=b.F();const e=
|
|
1005
|
-
olympe.sc.Runnable=class extends olympe.dm.BrickMetadata{constructor(a,b,c){super(a,b);this.H=c}run(a){a.F().run(()=>{km(this,a);this.init(a);a.Rg(this.clear.bind(this,a));a.onDestroy(this.destroy.bind(this,a));if(this.
|
|
1006
|
-
om(this,d,olympe.sc.Ua.O,a),this.oa()&&om(this,d,olympe.sc.Ua.
|
|
1007
|
-
this.
|
|
1008
|
-
this.
|
|
1009
|
-
U(olympe.sc.Ua.P,olympe.sc.Runnable.
|
|
1010
|
-
U(olympe.dc.CloudObject.P,olympe.sc.
|
|
1011
|
-
function tm(a,b,c){rm=a;const d=olympe.D.Xa(),e=d.G(c);olympe.dc.
|
|
1012
|
-
else olympe.ma.ab('sc').info(`No business container for application ${a}. You probably miss permissions.`),e(olympe.sc.Pc.
|
|
1013
|
-
h=new Date;c=(new Map).set(olympe.dm.File.fileNameProp,null!=c?c:'file').set(olympe.dm.File.urlProp,d).set(olympe.dm.File.modificationDateProp,h).set(olympe.dm.File.mimeTypeProp,null!=e?e:'application/data');g&&null!==f.
|
|
1014
|
-
olympe.sc.File.P=
|
|
1015
|
-
olympe.sc.Ac.P.C=(a,b,c,d)=>{c=olympe.sc.File.F(olympe.sc.Ac,a,b,c,d);a.update(c,olympe.sc.Ac.fontFamilyProp,b.split('.')[0]);return c};olympe.sc.Ac.prototype.K
|
|
1016
|
-
olympe.sc.logic.
|
|
1017
|
-
return}let n;if('<'===f)n=(p,q)=>olympe.sc.logic.
|
|
1018
|
-
olympe.sc.logic.
|
|
1019
|
-
olympe.sc.logic.na=class{constructor(){}static C(a,b,...c){if(vm[a])throw c=xm(a),Error(`Tag: ${a} - overwriting already defined function "${c.name}" with "${b.name}"`);b=new olympe.sc.logic.Ma.
|
|
1020
|
-
olympe.sc.logic.Error.prototype.getMessage=olympe.sc.logic.Error.prototype.
|
|
1021
|
-
c=>this.db.model(c)===olympe.dc.ga(a));return b?olympe.dc.CloudObject.get(b):null}};olympe.sc.logic.
|
|
1022
|
-
olympe.sc.logic.
|
|
1023
|
-
default:return a.set.bind(a,d)}})}setupExecution(a){const b=this.getInputs();return 0<b.length?rxjs.combineLatest(b.map(c=>a.observe(c))).pipe(rxjs.operators.map(c=>c.includes(null)?null:c)):rxjs.of([])}};olympe.sc.logic.Function.P=olympe.dc.na.C('0168c6f020f2a96f0000',olympe.sc.logic.Function,olympe.sc.R.Ca);olympe.sc.logic.Rb=class extends olympe.dc.CloudObject{getType(){return this.
|
|
1024
|
-
olympe.sc.logic.Rb.prototype.getType.
|
|
1025
|
-
olympe.sc.logic.sb.
|
|
1026
|
-
olympe.sc.logic.Ab.P.C=function(a,b,c,d,e,f=olympe.sc.logic.Ab){f=a.create(f);Z(f,olympe.dc.CloudObject.nameProp,b||'New output');a.Ea(olympe.sc.logic.Rb.typeRel,f,c);void 0!==e&&Z(f,olympe.sc.logic.Rb.C,e);d&&a.Ea(olympe.sc.Ua.F,d,f);return f.X()};olympe.sc.logic.Action=class extends olympe.sc.logic.Function{setupExecution(a){const b=this.
|
|
1027
|
-
olympe.sc.logic.
|
|
1028
|
-
olympe.sc.logic.
|
|
1029
|
-
function zm(a){let b=null,c=a.db.
|
|
1030
|
-
olympe.sc.logic.
|
|
1031
|
-
olympe.sc.logic.Ab)}
|
|
1032
|
-
olympe.sc.logic.
|
|
1033
|
-
U(olympe.dm.Property.P,olympe.sc.logic.
|
|
1005
|
+
function mm(a,b,c,d){b=b.F();const e=Wf(a.db,a.tag,b.G((f,g,h)=>{const k=h?d:c;null!==k&&(null===g||void 0===g?k(f,null):k(f,olympe.sc.um(g)),h&&c&&c(f,null))}));b.onDestroy(()=>{Xf(a.db,a.tag,e)})}
|
|
1006
|
+
olympe.sc.Runnable=class extends olympe.dm.BrickMetadata{constructor(a,b,c){super(a,b);this.H=c}run(a){a.F().run(()=>{km(this,a);this.init(a);a.Rg(this.clear.bind(this,a));a.onDestroy(this.destroy.bind(this,a));if(this.rd().Qm())nm(this,a);else{const b=new olympe.sc.Mq(a.C);this.update(b,[],[])}this.F(a)})}rd(){return this.Ec()}init(a){this.onInit(a)}update(a,b,c){const d=this.rd();if(d.Qm())this.onUpdate(a,b,c);else this.H.debug(`Softcoded runnable ${this.db.name(this)} with tag ${this.tag} running in context ${a.V()}`),
|
|
1007
|
+
om(this,d,olympe.sc.Ua.O,a),this.oa()&&om(this,d,olympe.sc.Ua.ba,a)}F(a){a.cn(olympe.sc.Ua.tb)}clear(){}destroy(a){this.onDestroy(a)}setupExecution(){return rxjs.of([])}C(){return[]}onInit(){}onUpdate(){const a=this.cc(),b=this.db.name(a),c=this.db.name(this.db.model(a));this.H.error(`No code was found for ${b} (${c}: ${a})\n\n`+'This is probably because the code has not yet been deployed to the environment, or because the package.json does not import the required dependencies.')}onDestroy(){}getInputs(){var a=
|
|
1008
|
+
this.rd();return im(a,a.db.bb(a.tag,olympe.sc.Ua.G))}getOutputs(){var a=this.rd();return im(a,a.db.bb(a.tag,olympe.sc.Ua.F))}G(){return[]}T(){return new Map}oa(){return!1}L(a,b,c,d){a=b.rb(a,c,!0);void 0!==d&&olympe.D.Sg(a,d);return a}ob(a,b,c,d,e){olympe.D.Vm([d],f=>{b.set(a,olympe.D.vr(f)?f.valueOf():f)});return this.L(a,b,c,e)}O(){return[this.fa,this.ba]}fa(a,b){mm(this,a,b,null)}ba(a,b){mm(this,a,null,b)}tb(a,b){const c=this.db,d=olympe.sc.logic.nb.G.Vb(),e=olympe.sc.logic.nb.F,f=olympe.sc.logic.nb.C;
|
|
1009
|
+
this.hr(d,g=>{var h=g.X();if(h=c.Pb(h,e)||c.Pb(h,f))return pm(g,a,b.bind(null,h))})}};olympe.sc.Runnable.P=bf(olympe.dc.na.C('01130000000000ca1100',olympe.sc.Runnable));olympe.sc.Runnable.L=olympe.sc.Runnable.P.sa('01692a4af82e8984742b');olympe.sc.Runnable.C=olympe.sc.Runnable.P.sa('01756a18d4921c103111');olympe.sc.Runnable.O=U(olympe.sc.Runnable.P,olympe.sc.Ua.O);olympe.sc.Runnable.T=U(olympe.sc.Runnable.P,olympe.sc.Ua.Z);olympe.sc.Runnable.Z=U(olympe.sc.Runnable.P,olympe.sc.Ua.ba);
|
|
1010
|
+
U(olympe.sc.Ua.P,olympe.sc.Runnable.L);U(olympe.sc.Ua.P,olympe.sc.Runnable.C);olympe.sc.Runnable.prototype.rd.K=new olympe.D.J(()=>olympe.sc.Ua,[]);olympe.sc.Runnable.prototype.L.K=new olympe.D.J(()=>Object,[]);olympe.sc.Runnable.prototype.ob.K=olympe.D.J.C;function qm(a){if(a){if('string'===typeof a)return a;if(a instanceof olympe.sc.Ie)return(a=a.C())?a.valueOf():null;if('function'===typeof a.X)return a.X()}return null}olympe.sc.Ie=class extends olympe.dc.CloudObject{C(){return this.db.bb(this,olympe.sc.Ie.C)[0]}F(){return olympe.dc.CloudObject.get(qm(this))}toString(){const a=qm(this);let b;a&&(b=this.db.name(a));return b||super.toString()}};olympe.sc.Ie.P=olympe.dc.na.C('0163c9ae01f2d6e9ca49',olympe.sc.Ie);olympe.sc.Ie.C=olympe.sc.Ie.P.sa('0169b5a8a33144fb0b49');
|
|
1011
|
+
U(olympe.dc.CloudObject.P,olympe.sc.Ie.C);olympe.sc.Ie.prototype.C.K=new olympe.D.J(()=>String,[]);olympe.sc.Ie.prototype.F.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);olympe.sc.jo=class extends olympe.dm.Ib{le(){return olympe.sc.ud.te.Yg}};olympe.sc.jo.P=olympe.dc.na.C('0163a68ce44f3d1fa84c',olympe.sc.jo);olympe.sc.Qc=class extends olympe.dm.BrickMetadata{};olympe.sc.Qc.P=olympe.dc.na.C('016324fde11a836f76c2',olympe.sc.Qc);olympe.sc.Qc.C=olympe.sc.Qc.P.sa('016324fde11a836087c2');olympe.sc.Qc.P.C=function(a,b){return xk(a,null!=b?b:'New type',olympe.sc.Qc).X()};let rm=null,sm=null;
|
|
1012
|
+
function tm(a,b,c){rm=a;const d=olympe.D.Xa(),e=d.G(c);olympe.dc.bd.from(a).cb(olympe.sc.qa.Lc.C).cb(olympe.sc.Pc.C.Vb()).lb({wh:'__code-as-data__'}).then(f=>{sm=f;if(null!==f)if(b){var g=olympe.dc.ia();jh(d,f,h=>{h=g.Hh(h)?h:g.model(h);return null!==h&&g.jc(h,olympe.sc.Qc)},{$m:!0}).subscribe(rxjs.Subscriber.create(()=>{e(olympe.sc.Pc.Jb.ip)},()=>{olympe.ma.ab('sc').error('Impossible to load the business container for the application',a,'maybe are you offline?');e(olympe.sc.Pc.Jb.hi)}))}else olympe.ma.ab('sc').info("Found business container but won't load it's content according to configuration."),e(olympe.sc.Pc.Jb.hi);
|
|
1013
|
+
else olympe.ma.ab('sc').info(`No business container for application ${a}. You probably miss permissions.`),e(olympe.sc.Pc.Jb.hi)}).catch(f=>{olympe.ma.ab('sc').error('Error while loading business container:',f.message);e(olympe.sc.Pc.Jb.Eb)})}olympe.sc.Pc=class extends olympe.dc.CloudObject{};olympe.sc.Pc.Jb={ip:0,hi:1,Eb:2};olympe.sc.Pc.P=olympe.dc.na.C('017b3aa8fae1e3d044dc',olympe.sc.Pc);olympe.sc.Pc.C=olympe.sc.Pc.P.sa('017b3aa8fd1659291b92');olympe.sc.Pc.F=olympe.sc.Pc.P.sa('017b3aa8fe7ec3fd52f2');olympe.sc.Map=class extends olympe.dc.CloudObject{};olympe.sc.Map.P=olympe.dc.na.C('018119241abce0e5696e',olympe.sc.Map);olympe.sc.kg=class extends olympe.sc.Map{};olympe.sc.kg.P=olympe.dc.na.C('01631aacd8276ea98490',olympe.sc.kg);olympe.sc.File=class extends olympe.dm.File{static tv(a,b,c,d,e,f){e=a.create(olympe.sc.File,new Map,e,f);olympe.sc.File.Br(a,e,b,c,d);return e}static uv(a,b,c,d,e,f){e=a.create(olympe.sc.File,new Map,e,f);olympe.sc.File.Zm(a,e,b,c,d);return e}static Br(a,b,c,d,e){e=null!=e?e:'application/data';d=URL.createObjectURL(new Blob([d],{type:e}));olympe.sc.File.Zm(a,b,c,d,e)}static Zm(a,b,c,d,e){const f=olympe.dc.ia(),g=f.Fa(b);var h;const k=null!=(h=a.model(b))?h:olympe.sc.File;if(null===k||!f.Gh(k,olympe.dm.File))throw Error(`Try to set the content of an object which is not a file: ${b}`);
|
|
1014
|
+
h=new Date;c=(new Map).set(olympe.dm.File.fileNameProp,null!=c?c:'file').set(olympe.dm.File.urlProp,d).set(olympe.dm.File.modificationDateProp,h).set(olympe.dm.File.mimeTypeProp,null!=e?e:'application/data');g&&null!==f.Ka(b,olympe.dm.File.urlProp)||c.set(olympe.dm.File.creationDateProp,h).set(olympe.dm.File.C,!1);a.yr(b,c)}};olympe.sc.File.setURLContent=olympe.sc.File.Zm;olympe.sc.File.setContent=olympe.sc.File.Br;olympe.sc.File.createFromURL=olympe.sc.File.uv;olympe.sc.File.createFromContent=olympe.sc.File.tv;
|
|
1015
|
+
olympe.sc.File.P=We(olympe.dm.File,'ff021000000000000031',olympe.sc.File);olympe.sc.gg=class extends olympe.sc.File{L(){const a=olympe.D.fc(olympe.D.Na);this.gk(b=>{a.update(olympe.D.xb(b))});return a.rb()}};olympe.sc.gg.P=We(olympe.sc.File,'01644b6297305d62fca2',olympe.sc.gg);olympe.sc.gg.P.C=olympe.sc.File.F.bind(null,olympe.sc.gg);olympe.sc.gg.prototype.L.K=olympe.D.J.F;olympe.sc.Ac=class extends olympe.sc.File{L(){return this.ub(olympe.sc.Ac.fontFamilyProp)}O(){return this.ub(olympe.sc.Ac.G)}T(){return this.Vc(olympe.sc.Ac.L)}};olympe.sc.Ac.P=We(olympe.sc.File,'01647e113043c637b541',olympe.sc.Ac);olympe.sc.Ac.fontFamilyProp=olympe.sc.Ac.P.ka('01647e35ecd24ef0b88d');olympe.sc.Ac.G=olympe.sc.Ac.P.ka('01647e677f5d1cfbdf42');olympe.sc.Ac.L=olympe.sc.Ac.P.ka('01647e6780999bf8bd25');
|
|
1016
|
+
olympe.sc.Ac.P.C=(a,b,c,d)=>{c=olympe.sc.File.F(olympe.sc.Ac,a,b,c,d);a.update(c,olympe.sc.Ac.fontFamilyProp,b.split('.')[0]);return c};olympe.sc.Ac.prototype.L.K=olympe.D.J.F;olympe.sc.Ac.prototype.O.K=olympe.D.J.F;olympe.sc.Ac.prototype.T.K=olympe.D.J.G;olympe.sc.qh=class extends olympe.sc.File{};olympe.sc.qh.P=We(olympe.sc.File,'0164643c432146a71d5c',olympe.sc.qh);olympe.sc.qh.P.C=olympe.sc.File.F.bind(null,olympe.sc.qh);olympe.sc.Oq=class extends olympe.dc.CloudObject{};olympe.sc.Oq.P=olympe.dc.na.C('016421bb3797e22d1c4e',olympe.sc.Oq);olympe.sc.logic={};olympe.sc.logic.Ko=(a,b)=>a===b?0:a>b?1:-1;
|
|
1017
|
+
olympe.sc.logic.Hz=(a,b,c,d,e,f,g)=>{const h=b.X();b=olympe.D.Ra(b.getType().X());let k,l;if(b===olympe.dc.ga(olympe.dm.String))k=c.valueOf().toLowerCase(),l=p=>p.ub(h).toLowerCase();else if(b===olympe.dc.ga(olympe.dm.Number))k=c.valueOf(),l=p=>p.Vc(h);else if(b===olympe.dc.ga(olympe.dm.DateTime))k=c.getTime(),l=p=>olympe.D.ta([p.Ji(h)],q=>q.getTime(),Number,'FilterList Date&DateTime TransformFlows');else{c=olympe.dc.ia().name(b);g.warn(`Properties of type ${c} are not supported. List will not be filtered.`);e(a);
|
|
1018
|
+
return}let n;if('<'===f)n=(p,q)=>olympe.sc.logic.Ko(q,p);else if('>'===f)n=(p,q)=>olympe.sc.logic.Ko(p,q);else{g.error(`Unknown inequality ${f}. Please use '<' or '>'`);return}e(a.Zj().filter(p=>olympe.D.ta([l(p)],q=>{q=n(q.valueOf(),k);return olympe.D.Qb(d.valueOf()?1===q:0<=q)},olympe.D.ea,'FilterList ListDefBuilder Filter TransformFlows')).fi())};
|
|
1019
|
+
olympe.sc.logic.oC=(a,b)=>{if(a instanceof olympe.D.aa)return a;if(a instanceof olympe.D.Na)return a.Er();if(a instanceof olympe.D.ea)return a.nr();if('string'===typeof a||'number'===typeof a)return olympe.D.ra(Number(a));b.error(`Could not parse provided value ${a} into a number`);return olympe.D.aa.qp};olympe.sc.logic.Ma={};function um(a){af(a.P,(b,c)=>{b=b.create(a.P.F);Z(b,olympe.dc.CloudObject.nameProp,c);return b.X()})}olympe.sc.logic.Ma.Bo=class{constructor(a,b,c){this.P=olympe.dc.na.C(a,b,...c);um(this)}X(){return this.P.X()}};olympe.sc.logic.Ma.Bo.xa=[olympe.dc.Fe];const vm=Object.create(null),wm=new Map;function xm(a){if(void 0===vm[a])throw Error(`Tag: ${a} - does not correspond to a registered function`);return Ye(a)}function ym(a,b,c=olympe.sc.logic.Function){if(wm.has(a))throw c=xm(a),Error(`Tag: ${a} - overwriting existing function definition "${c.name}" with "${b.name}"`);const d=olympe.dc.na.C(a,b,...[]);wm.set(a,{P:d,FC:b,lC:c});return d}
|
|
1020
|
+
olympe.sc.logic.na=class{constructor(){}static C(a,b,...c){if(vm[a])throw c=xm(a),Error(`Tag: ${a} - overwriting already defined function "${c.name}" with "${b.name}"`);b=new olympe.sc.logic.Ma.Bo(a,b,[olympe.sc.R.Ca].concat(c));return vm[a]=b}};olympe.sc.logic.xy=class{};olympe.sc.logic.dj=class extends olympe.dc.CloudObject{};olympe.sc.logic.dj.P=olympe.dc.na.C('01621fb84e320000cf00',olympe.sc.logic.dj);function Kl(a,b,c){return new olympe.sc.logic.Error(a,b,c)}olympe.sc.logic.Error=class extends Error{constructor(a,b,c){super(a);this.code=b;this.C=null!=c?c:null}static create(a,b){return new olympe.sc.logic.Error(a,b)}qw(){return this.message}ir(){return this.code}ie(){let a;return null!=(a=this.C)?a:''}};olympe.sc.logic.Error.prototype.getStack=olympe.sc.logic.Error.prototype.ie;olympe.sc.logic.Error.prototype.getCode=olympe.sc.logic.Error.prototype.ir;
|
|
1021
|
+
olympe.sc.logic.Error.prototype.getMessage=olympe.sc.logic.Error.prototype.qw;olympe.sc.logic.Error.create=olympe.sc.logic.Error.create;olympe.sc.logic.Wh=class extends olympe.sc.logic.dj{};olympe.sc.logic.Wh.P=olympe.dc.na.C('016eeb5ede9f3094d8f0',olympe.sc.logic.Wh);olympe.sc.logic.ad=class extends olympe.dc.CloudObject{C(){return this.oc(olympe.sc.logic.ad.C,olympe.dc.CloudObject)}};olympe.sc.logic.ad.P=olympe.dc.na.C('016ac4f59ee8ea2081ba',olympe.sc.logic.ad);olympe.sc.logic.ad.F=olympe.sc.logic.ad.P.ka('017bc044aeacce7ffc8f');olympe.sc.logic.ad.C=olympe.sc.logic.ad.P.sa('016ac4f5a0091c4790e2');U(olympe.dc.CloudObject.P,olympe.sc.logic.ad.C);olympe.sc.logic.ad.prototype.C.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);olympe.sc.logic.jh=class extends olympe.sc.logic.ad{};olympe.sc.logic.jh.P=olympe.dc.na.C('016ac4f59c592b862457',olympe.sc.logic.jh);olympe.sc.logic.jh.G=olympe.sc.cd.C.Vb();olympe.sc.logic.jh.P.C=(a,b,c,d,e)=>{b=xk(a,b||'New Predefined Input',olympe.sc.logic.jh,olympe.sc.logic.sb);Z(b,olympe.sc.logic.ad.F,e);a.Ea(olympe.sc.logic.ad.C,b,c);a.Ea(olympe.sc.cd.C,d,b);return b.X()};olympe.sc.logic.ng=class extends olympe.sc.logic.ad{};olympe.sc.logic.ng.P=olympe.dc.na.C('016ac4f59dd99f5df3e1',olympe.sc.logic.ng);olympe.sc.logic.ng.G=U(olympe.sc.logic.ng.P,olympe.sc.cd.F);olympe.sc.logic.ng.P.C=(a,b,c,d,e)=>{b=xk(a,b||'New Predefined Output',olympe.sc.logic.ng,olympe.sc.logic.Ab);Z(b,olympe.sc.logic.ad.F,e);a.Ea(olympe.sc.logic.ad.C,b,c);a.Ea(olympe.sc.cd.F,d,b);return b.X()};olympe.sc.logic.nd=class extends olympe.sc.Ua{le(){return olympe.sc.ud.te.sq}Z(){return this.Cm().Zj().jc([olympe.sc.logic.Function]).and().jd().jc([olympe.sc.logic.Yc,olympe.sc.logic.Zc]).fi()}G(){const a=olympe.dc.ga(olympe.sc.logic.Wh);return this.db.bb(this,olympe.sc.logic.nd.F).filter(b=>this.db.Pb(b,olympe.sc.logic.Rb.typeRel)===a)}C(a){const b=this.db.zm(this,[olympe.sc.Ua.G],c=>this.db.model(c)===olympe.dc.ga(a));return b?olympe.dc.CloudObject.get(b):null}F(a){const b=this.db.zm(this,[olympe.sc.Ua.F],
|
|
1022
|
+
c=>this.db.model(c)===olympe.dc.ga(a));return b?olympe.dc.CloudObject.get(b):null}};olympe.sc.logic.nd.P=ym('01621fb84e320000f000',olympe.sc.logic.nd,olympe.sc.logic.Function);olympe.sc.logic.nd.prototype.C.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.nd.prototype.F.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.logic.Df=class extends olympe.sc.logic.nd{L(){return this.C('016ac63229782039429f')}O(){return this.F('016ac6322acf67eebfe7')}T(){return this.fp().Zj().cb(olympe.sc.logic.Rb.typeRel).nk(olympe.sc.logic.Wh).fi().ef().Om(olympe.D.aa.ZERO)}};olympe.sc.logic.Df.C='016ac63229782039429f';olympe.sc.logic.Df.L='016ac6322acf67eebfe7';olympe.sc.logic.Df.P=ym('01621fb84e320000a000',olympe.sc.logic.Df,olympe.sc.logic.Action);olympe.sc.logic.Df.prototype.L.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);
|
|
1023
|
+
olympe.sc.logic.Df.prototype.O.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.logic.Df.prototype.T.K=olympe.D.J.O;olympe.sc.logic.Sn=class extends olympe.sc.logic.nd{};olympe.sc.logic.Sn.P=ym('01621fb84e320000f011',olympe.sc.logic.Sn);olympe.sc.logic.Rn=class extends olympe.sc.logic.Df{};olympe.sc.logic.Rn.P=ym('01621fb84e320000f012',olympe.sc.logic.Rn);olympe.sc.logic.Function=class extends olympe.sc.Runnable{O(){return[this.tb]}T(){const a=olympe.sc.cg.C.ol,b=olympe.sc.cg.C.Fl,c=this.db,d=new Map,e=this.cc();c.bb(e,olympe.sc.Ua.G).forEach(f=>{d.set(a+c.name(f),f)});c.bb(e,olympe.sc.Ua.F).forEach(f=>{d.set(b+c.name(f),f)});return d}C(a){const b=olympe.dc.ga(olympe.sc.logic.dj),c=olympe.dc.ga(olympe.sc.logic.Wh);return this.getOutputs().map(d=>{switch(this.db.Pb(d,olympe.sc.logic.Rb.typeRel)){case b:return a.cn.bind(a,d);case c:return a.throw.bind(a);
|
|
1024
|
+
default:return a.set.bind(a,d)}})}setupExecution(a){const b=this.getInputs();return 0<b.length?rxjs.combineLatest(b.map(c=>a.observe(c))).pipe(rxjs.operators.map(c=>c.includes(null)?null:c)):rxjs.of([])}};olympe.sc.logic.Function.P=olympe.dc.na.C('0168c6f020f2a96f0000',olympe.sc.logic.Function,olympe.sc.R.Ca);olympe.sc.logic.Rb=class extends olympe.dc.CloudObject{getType(){return this.oc(olympe.sc.logic.Rb.typeRel,olympe.dc.CloudObject)}C(){return this.Vc(olympe.sc.logic.Rb.C)}};olympe.sc.logic.Rb.P=olympe.dc.na.C('0168a431d25001540000',olympe.sc.logic.Rb);olympe.sc.logic.Rb.C=olympe.sc.logic.Rb.P.ka('01740c5d4ae4b520dd01');olympe.sc.logic.Rb.typeRel=olympe.sc.logic.Rb.P.sa('0168a431d3b9b7438424');U(olympe.dc.CloudObject.P,olympe.sc.logic.Rb.typeRel);
|
|
1025
|
+
olympe.sc.logic.Rb.prototype.getType.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);olympe.sc.logic.Rb.prototype.C.K=olympe.D.J.G;olympe.sc.logic.sb=class extends olympe.sc.logic.Rb{};olympe.sc.logic.sb.P=olympe.dc.na.C('0168a431d25001540001',olympe.sc.logic.sb);olympe.sc.logic.sb.T=olympe.sc.logic.Rb.P.ka('01740c5d4ae4b520dd02');olympe.sc.logic.sb.O=U(olympe.sc.logic.sb.P,olympe.sc.Ua.G);olympe.sc.logic.sb.F=olympe.sc.logic.sb.P.sa('0168a431d91f2578000b',olympe.dc.ua.ORIGIN);olympe.sc.logic.sb.G=olympe.sc.logic.sb.P.sa('01621fb84e32000000a1',olympe.dc.ua.ORIGIN);
|
|
1026
|
+
olympe.sc.logic.sb.L=olympe.sc.logic.sb.P.sa('01621fb84e32000000d1',olympe.dc.ua.ORIGIN);olympe.sc.logic.sb.P.C=function(a,b,c,d,e,f=olympe.sc.logic.sb){f=a.create(f);Z(f,olympe.dc.CloudObject.nameProp,b||'New input');a.Ea(olympe.sc.logic.Rb.typeRel,f,c);void 0!==e&&Z(f,olympe.sc.logic.Rb.C,e);d&&a.Ea(olympe.sc.Ua.G,d,f);return f.X()};olympe.sc.logic.Ab=class extends olympe.sc.logic.Rb{};olympe.sc.logic.Ab.P=olympe.dc.na.C('0168a431d25001540002',olympe.sc.logic.Ab);olympe.sc.logic.Ab.O=U(olympe.sc.logic.Ab.P,olympe.sc.Ua.F);olympe.sc.logic.Ab.F=olympe.sc.logic.Ab.P.sa('0168a431d91f25780003',olympe.dc.ua.ORIGIN);olympe.sc.logic.Ab.L=olympe.sc.logic.Ab.P.sa('01621fb84e32000000a2',olympe.dc.ua.ORIGIN);olympe.sc.logic.Ab.G=olympe.sc.logic.Ab.P.sa('01621fb84e32000000d2',olympe.dc.ua.ORIGIN);
|
|
1027
|
+
olympe.sc.logic.Ab.P.C=function(a,b,c,d,e,f=olympe.sc.logic.Ab){f=a.create(f);Z(f,olympe.dc.CloudObject.nameProp,b||'New output');a.Ea(olympe.sc.logic.Rb.typeRel,f,c);void 0!==e&&Z(f,olympe.sc.logic.Rb.C,e);d&&a.Ea(olympe.sc.Ua.F,d,f);return f.X()};olympe.sc.logic.Action=class extends olympe.sc.logic.Function{setupExecution(a){const b=this.rd().L().X();return a.observe(b).pipe(rxjs.operators.map(c=>null===c?null:this.getInputs().filter(d=>d!==b).map(d=>a.get(d))))}};olympe.sc.logic.Action.P=olympe.dc.na.C('0168c6f020f2a96a0000',olympe.sc.logic.Action,olympe.sc.R.Ca);olympe.sc.logic.Yc=class extends olympe.sc.logic.Function{run(a){km(this,a);const b=a.getParent(),c=this.db.Pb(this,olympe.sc.logic.Yc.G),d=this.db.Pb(this,olympe.sc.logic.Yc.F);a.on(c,e=>b.set(d,e),this.tag)}za(){return this.oc(olympe.sc.logic.Yc.G,olympe.sc.logic.sb)}Ja(){return this.oc(olympe.sc.logic.Yc.F,olympe.sc.logic.Ab)}};olympe.sc.logic.Yc.P=olympe.dc.na.C('01621fb84e32000000a0',olympe.sc.logic.Yc,olympe.sc.R.Ca);olympe.sc.logic.Yc.G=U(olympe.sc.logic.Yc.P,olympe.sc.logic.sb.G);
|
|
1028
|
+
olympe.sc.logic.Yc.F=U(olympe.sc.logic.Yc.P,olympe.sc.logic.Ab.L);olympe.sc.logic.Yc.P.C=function(a,b,c){b=a.create(olympe.sc.logic.Yc);a.Ea(olympe.sc.logic.Yc.F,b,c);return b.X()};olympe.sc.logic.Yc.prototype.za.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.Yc.prototype.Ja.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.logic.Zc=class extends olympe.sc.logic.Function{run(a){const b=a.getParent(),c=this.db.Pb(this,olympe.sc.logic.Zc.F),d=this.db.Pb(this,olympe.sc.logic.Zc.G);b.on(c,e=>a.set(d,e),b.V())}Ja(){return this.oc(olympe.sc.logic.Zc.F,olympe.sc.logic.sb)}za(){return this.oc(olympe.sc.logic.Zc.G,olympe.sc.logic.Ab)}};olympe.sc.logic.Zc.P=olympe.dc.na.C('01621fb84e32000000d0',olympe.sc.logic.Zc,olympe.sc.R.Ca);olympe.sc.logic.Zc.F=U(olympe.sc.logic.Zc.P,olympe.sc.logic.sb.L);
|
|
1029
|
+
olympe.sc.logic.Zc.G=U(olympe.sc.logic.Zc.P,olympe.sc.logic.Ab.G);olympe.sc.logic.Zc.P.C=function(a,b,c){b=a.create(olympe.sc.logic.Zc);a.Ea(olympe.sc.logic.Zc.F,b,c);return b.X()};olympe.sc.logic.Zc.prototype.Ja.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.Zc.prototype.za.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);function pm(a,b,c){var d;const e=null!=(d=a.db.Pb(a,olympe.sc.logic.nb.T))?d:a.db.Pb(a,olympe.sc.logic.nb.L),f=a.db.Pb(a,olympe.sc.logic.nb.O);if(null!==e&&null!==f){d=a.db.Gh(zm(a),olympe.dm.Ke)?new olympe.D.Yb('Pipe Context'):null;const h=a.C.bind(a,c,d);let k;const l=b.vk(f,n=>{let p;null==(p=k)||p();k=n.on(e,h,f)});return()=>{h(null);l();let n;null==(n=k)||n()}}const g=Uf(a.db,a,olympe.sc.logic.nb.valueProp,h=>c(olympe.sc.um(h)));return()=>{c(olympe.sc.um(null));Vf(a.db,a,olympe.sc.logic.nb.valueProp,
|
|
1030
|
+
g)}}function zm(a){let b=null,c=a.db.Pb(a,olympe.sc.logic.nb.F);c?b=a.db.Pb(c,olympe.dm.Property.typeRel):(c=a.db.Pb(a,olympe.sc.logic.nb.C))&&(b=a.db.Pb(c,olympe.sc.logic.Rb.typeRel));return b||olympe.dc.ga(olympe.dc.CloudObject)}
|
|
1031
|
+
olympe.sc.logic.nb=class extends olympe.dc.CloudObject{constructor(a,b,c){super(a,b);this.H=c}C(a,b,c){const d=olympe.sc.Bg(c);null==b||b.oa();b&&d instanceof olympe.dm.Ke?null==b||b.run(()=>{olympe.D.Gc([d.getValue()],e=>{a(e.valueOf())})}):a(d)}getValue(a){return this.xf(olympe.sc.logic.nb.valueProp,a||olympe.dc.Lb.Bg,Object)}getType(){const a=this.transform(olympe.sc.logic.nb.C,olympe.sc.logic.Rb.typeRel);a.Cd(olympe.dc.CloudObject);return a.xc()}Iw(){return this.oc(olympe.sc.logic.nb.O,olympe.dc.CloudObject)}Gw(){return this.oc(olympe.sc.logic.nb.T,
|
|
1032
|
+
olympe.sc.logic.Ab)}Hw(){return this.oc(olympe.sc.logic.nb.L,olympe.dm.Property)}cw(){return this.oc(olympe.sc.logic.nb.G,olympe.dc.CloudObject)}aw(){return this.oc(olympe.sc.logic.nb.C,olympe.sc.logic.sb)}bw(){return this.oc(olympe.sc.logic.nb.F,olympe.dm.Property)}};olympe.sc.logic.nb.P=olympe.dc.na.C('0168a431d91f25780000',olympe.sc.logic.nb,olympe.sc.R.Ca);olympe.sc.logic.nb.valueProp=olympe.sc.logic.nb.P.ka('0168a431d91f25780001');olympe.sc.logic.nb.O=olympe.sc.logic.nb.P.sa('0168a431d91f25780002');
|
|
1033
|
+
olympe.sc.logic.nb.T=U(olympe.sc.logic.nb.P,olympe.sc.logic.Ab.F);olympe.sc.logic.nb.L=olympe.sc.logic.nb.P.sa('0168a431d91f25780004');olympe.sc.logic.nb.G=olympe.sc.logic.nb.P.sa('0168a431d91f2578000a');olympe.sc.logic.nb.C=U(olympe.sc.logic.nb.P,olympe.sc.logic.sb.F);olympe.sc.logic.nb.F=olympe.sc.logic.nb.P.sa('0168a431d91f2578000c');U(olympe.dc.CloudObject.P,olympe.sc.logic.nb.O);U(olympe.dm.Property.P,olympe.sc.logic.nb.L);U(olympe.dc.CloudObject.P,olympe.sc.logic.nb.G);
|
|
1034
|
+
U(olympe.dm.Property.P,olympe.sc.logic.nb.F);m=olympe.sc.logic.nb.prototype;m.getType.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.Iw.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.Gw.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);m.Hw.K=new olympe.D.J(()=>olympe.dm.Property,[]);m.cw.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);m.aw.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);m.bw.K=new olympe.D.J(()=>olympe.dm.Property,[]);function Am(a,b){const c=a.rd(),d=c.tl().X(),e=c.ul().X(),f=c.vl().X();b.on(d,g=>{if(g){g=new Map(a.getInputs().map(k=>[k,b.get(k)]));const h={timeout:a.timeout};olympe.N.wb.get(a.cc(),g,h).then(k=>{for(const [l,n]of k)l!==e&&l!==f&&b.set(l,n);b.set(e,k.get(e));k=k.get(f);k instanceof olympe.sc.logic.Error&&(k=Kl(k.message,k.code,k.ie()+'\n===== Remote Call =====\n'+b.ie()),b.throw(k))}).catch(k=>{k=`RemoteAction "${a.Ec().name()}" (${a.tag}) encountered an error:\n${k}`;a.H.error(k);b.throw(olympe.sc.logic.Error.create(k,
|
|
1034
1035
|
400))})}},b.V())}
|
|
1035
|
-
function Bm(a,b,c,d,e,f){const g=n=>
|
|
1036
|
-
olympe.sc.logic.mh=class extends olympe.sc.logic.Function{constructor(a,b,c,d){super(a,b,c);this.timeout=d}run(a){let b;null!=(b=a.
|
|
1037
|
-
k.destroy()},this.timeout);Bm(this,k,f,g,n,h);super.run(k);for(const [p,q]of l)p!==e&&k.set(p,q);h.
|
|
1038
|
-
1))})},h=>{const k=this.
|
|
1039
|
-
olympe.sc.logic.na.C('0171889b060b6cd54300',olympe.sc.logic.
|
|
1040
|
-
olympe.sc.logic.
|
|
1041
|
-
b,c);a.Ea(olympe.dc.CloudObject.containsRel,b,c)}};olympe.sc.
|
|
1042
|
-
olympe.sc.
|
|
1043
|
-
olympe.sc.workflow.ObjectState.dateTimeProp=olympe.sc.workflow.ObjectState.P.
|
|
1044
|
-
olympe.sc.workflow.
|
|
1045
|
-
olympe.sc.workflow.Transition.P=olympe.dc.na.C('017ffdc633219f16beea',olympe.sc.workflow.Transition);olympe.sc.workflow.Transition.processRefProp=olympe.sc.workflow.Transition.P.
|
|
1046
|
-
olympe.sc.workflow.Transition.prototype.C.
|
|
1047
|
-
olympe.sc.workflow.Workflow.dataTypeRel=olympe.sc.workflow.Workflow.P.sa('017ffdc010e5bcc9c973');olympe.sc.workflow.Workflow.statesRel=olympe.sc.workflow.Workflow.P.sa('017ffdc010e5bcc9c974');olympe.sc.workflow.Workflow.initialStateRel=olympe.sc.workflow.Workflow.P.sa('017ffdc010e5bcc9c975');olympe.sc.workflow.Workflow.prototype.G.
|
|
1048
|
-
olympe.sc.workflow.Workflow.prototype.F.
|
|
1049
|
-
olympe.sc.qa.
|
|
1050
|
-
olympe.sc.qa.
|
|
1051
|
-
m.
|
|
1052
|
-
olympe.sc.qa.
|
|
1053
|
-
olympe.sc.Qc))if(b=null,null!==sm?b=sm:'string'===typeof rm&&(b=olympe.dc.
|
|
1054
|
-
b,c){this.C.ic(a,b,c);return this}
|
|
1055
|
-
b)=>{this.C.
|
|
1056
|
-
olympe.sc.Wa.prototype.persist=olympe.sc.Wa.prototype.persist;olympe.sc.Wa.prototype.deleteAllRelations=olympe.sc.Wa.prototype.
|
|
1057
|
-
olympe.sc.Wa.prototype.getId=olympe.sc.Wa.prototype.V;olympe.sc.Wa.process=olympe.sc.Wa.process;olympe.sc.Wa.from=olympe.sc.Wa.from;olympe.sc.
|
|
1058
|
-
olympe.tc.
|
|
1059
|
-
this.F.run()):this.H.error('No app registered under name: '+this.C)}};olympe.tc.
|
|
1060
|
-
olympe.W.run([olympe.tc.R.Ha],a=>a.run(),'olympe.hc');olympe.sc.Gb={};function Dm(a,b){if(a.fa)a.H.debug('Sending getContext request'),
|
|
1061
|
-
l&&h.
|
|
1062
|
-
d.run(f))})});e.add((f,g)=>{if(Fm(a.C)){const h=olympe.sc.Pc.
|
|
1063
|
-
function Gm(a){a.H.info('Starting application '+a.C);const b=olympe.D.fc(olympe.D.ea).update(olympe.D.ea.C),c=olympe.dc.
|
|
1064
|
-
null==(l=e)||l.cancel();b.update(olympe.D.ea.F);Hm(a)})}else a.H.error('application retrieved: not an Application with a run() method');else Im(a)}));olympe.D.Xa().onDestroy(()=>{
|
|
1065
|
-
function Hm(a){a.H.info(`Application ${olympe.dc.
|
|
1066
|
-
function Jm(a){a.Z=a.G.F(()=>
|
|
1067
|
-
olympe.sc.Gb.
|
|
1068
|
-
{switch(e){case b:case c:this.H.debug('Server session opened or working offline, start the application');a||(a=!0,Dm(this,()=>Gm(this)));break;case d:this.H.debug('Impossible to open a connection to the orchestrator and offline mode is disabled.')}})}};olympe.sc.Gb.
|
|
1069
|
-
b[olympe.net.Ba.Headers.
|
|
1070
|
-
h:h.message}`,olympe.net.Ba.Zb.
|
|
1071
|
-
typeof f)try{f=JSON.parse(f)}catch(h){d.H.warn(`Invalid manifest app config for app: ${e}`),f={}}e=Object.assign({},g,d.C,f);return new olympe.net.
|
|
1072
|
-
olympe.sc.Gb.
|
|
1073
|
-
new olympe.dc.Wa;
|
|
1074
|
-
olympe.W.config(function(a){
|
|
1075
|
-
g:d;return new Map([['offlineEnabled',f],['offlineAutoBackOnline',!f||b]])});
|
|
1076
|
-
b],['getContextMode',c],['debuggerName',d],['autostartProfiler',e],['loadBusinessContainer',f]]));
|
|
1077
|
-
olympe.net.R.
|
|
1078
|
-
d)}static
|
|
1079
|
-
b).set('password',c),olympe.auth.wc.C.SRP)}static
|
|
1080
|
-
c),olympe.auth.wc.C.
|
|
1081
|
-
olympe.public.Ia.loginToken=olympe.public.Ia
|
|
1082
|
-
olympe.public.Ia.getToken=olympe.public.Ia.
|
|
1083
|
-
olympe.public
|
|
1084
|
-
olympe.public.Process.connect=olympe.public.Process.connect;olympe.public.Process.onShutdown=olympe.public.Process.
|
|
1085
|
-
Context:olympe.sc.wa,Entry:olympe.dc.Ma.Entry,PropertyModel:olympe.dm.Property,RelationModel:olympe.dm.Relation,StringModel:olympe.dm.String,NumberModel:olympe.dm.Number,BooleanModel:olympe.dm.Boolean,DatetimeModel:olympe.dm.DateTime,ColorModel:olympe.dm.Color,File:olympe.sc.File,User:olympe.dm.User,Enum:olympe.dm.
|
|
1086
|
-
WorkflowObjectState:olympe.sc.workflow.ObjectState,Transaction:olympe.sc.Wa,BurstTransaction:olympe.dc.
|
|
1087
|
-
olympe.dc.sources.
|
|
1088
|
-
GUEST:olympe.auth.
|
|
1089
|
-
instanceToTag:olympe.dc.ga,registerSync:olympe.dc.na.C,getUniqueTag:olympe.Y.
|
|
1090
|
-
Greater:olympe.dc.$.
|
|
1036
|
+
function Bm(a,b,c,d,e,f){const g=n=>x(function*(){if(null!==n){e.cancel();let p;null==(p=k)||p();let q;null==(q=l)||q();try{const r=new Map(a.getOutputs().map(t=>[t,b.get(t)]));yield f.kd(r)}catch(r){const t=Error(`Error while trying to send the response of remote action ${a.Ec().name()} (${a.cc()}): ${r}`);f.zh(t).catch(u=>{a.H.error(`Cannot reply with an error to a remote action call ${a.Ec().name()} (${a.cc()}): ${u}`)})}finally{b.destroy()}}}),h=b.V(),k=b.on(c,g,h),l=b.on(d,g,h)}
|
|
1037
|
+
olympe.sc.logic.mh=class extends olympe.sc.logic.Function{constructor(a,b,c,d){super(a,b,c);this.timeout=d}run(a){let b;null!=(b=a.Ra(olympe.sc.wa.C.EDITION))&&b||(this.db.Ka(this,olympe.sc.logic.mh.F)?this.za(a):(km(this,a),Am(this,a)))}za(a){const b=this.cc(),c=this.rd(),d=c.gp().X(),e=c.tl().X(),f=c.ul().X(),g=c.vl().X();(new olympe.N.wb(b,a)).listen().subscribe(rxjs.Subscriber.create(h=>{const k=a.xh('remote call'),l=h.body(),n=Tb(()=>{h.zh(Error(`Timeout reached on remote action ${this.db.name(this)} (${this.tag})`));
|
|
1038
|
+
k.destroy()},this.timeout);Bm(this,k,f,g,n,h);super.run(k);for(const [p,q]of l)p!==e&&k.set(p,q);h.Lh().then(p=>{var q=k.get(d);null!==q&&olympe.dc.ga(q)!==p&&(q=this.cc(),this.H.warn(`Remote action ${this.db.name(q)} ${q}: try to run it with an input user that is not the real authenticated user.`));k.set(d,p);k.set(e,l.get(e))}).catch(p=>{const q=this.cc();this.H.warn(`Remote action ${this.db.name(q)} ${q} Triggered by unrecognized user: ${p}.`);k.set(g,olympe.sc.logic.Error.create('Unrecognized User',
|
|
1039
|
+
1))})},h=>{const k=this.cc();this.H.error(`Error while listening on remote action ${this.db.name(k)} (${k}): ${h.message}`)}))}};olympe.sc.logic.mh.P=olympe.dc.na.C('017a7b0c5dcbd8964c5d',olympe.sc.logic.mh,olympe.sc.R.Ca,new olympe.W.ja(olympe.sc.U.Yp));olympe.sc.logic.mh.F=olympe.sc.logic.mh.P.ka('017a7b0c62a02a89444f');olympe.sc.logic.controllers={};olympe.sc.logic.controllers.pl=class{constructor(a){this.db=olympe.dc.ia();this.typeRel=a}};olympe.sc.logic.controllers.pl.C={Ay:-1,Bz:1};olympe.sc.logic.controllers.pA=class extends olympe.sc.logic.controllers.pl{constructor(){super(olympe.sc.logic.ad.C)}};olympe.sc.logic.controllers.wA=class extends olympe.sc.logic.controllers.pl{constructor(){super(olympe.sc.logic.Rb.typeRel)}};olympe.sc.logic.dk={};olympe.sc.logic.dk.Eu=class extends olympe.sc.logic.Function{update(a,[b],[c]){const d=olympe.dc.ga(b);d?olympe.dc.pa.bc(a,d,olympe.dc.ec.Mf).subscribe(()=>{c(olympe.dc.CloudObject.get(d))}):this.H.warn('Cannot subscribe to an instance with no tag: '+d)}};olympe.sc.logic.na.C('0174bf4b7e006e4b788a',olympe.sc.logic.dk.Eu);olympe.sc.logic.actions={};olympe.sc.logic.dk.Ft=class extends olympe.sc.logic.Function{run(a){km(this,a);const [b,c,d]=this.C(a);let e,f=null,g=null;const h=a.getParent(),k=()=>{null===g||0===e?(this.H.warn('No list to iter upon'),this.H.info(a.V())):f<e?(b(g.Te(f)),f++,c(Date.now())):($l(h.C),d(Date.now()))};this.getInputs().forEach((l,n)=>a.on(l,p=>{if(p)switch(n){case 0:g=p;break;case 1:e=g.Tf();f=0;Zl(h.C);k();break;case 2:k();break;default:this.H.error('Unhandled input')}},this.tag))}};
|
|
1040
|
+
olympe.sc.logic.na.C('0171889b060b6cd54300',olympe.sc.logic.dk.Ft);olympe.sc.logic.Ob={};olympe.sc.logic.Ob.cl=class extends olympe.sc.logic.nd{L(){return this.C('016ac638085357047a2d')}};olympe.sc.logic.Ob.cl.P=ym('0169b6876a03f14ae61b',olympe.sc.logic.Ob.cl);olympe.sc.logic.Ob.cl.prototype.L.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.Ob.ql=class extends olympe.sc.logic.nd{L(){return this.C('016ac63808535703691c')}};olympe.sc.logic.Ob.ql.P=ym('0169b6876a03f139d50a',olympe.sc.logic.Ob.ql);olympe.sc.logic.Ob.ql.prototype.L.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.Ob.Gl=class extends olympe.sc.logic.nd{L(){return this.C('016ac63809a9a8e6db96')}O(){return this.F('016ac6380ab003363b3e')}};ym('01646ad602f933b8caaf',olympe.sc.logic.Ob.Gl);olympe.sc.logic.Ob.Gl.prototype.L.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.Ob.Gl.prototype.O.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.logic.Ob.xj=class extends olympe.sc.logic.nd{L(){return this.C('016ac6380bd98f1d91a0')}T(){return this.F('016ac63c589ae38ca3ae')}O(){return this.F('016ac63c5a377fceabaa')}};ym('0168ec42fc01747a98b6',olympe.sc.logic.Ob.xj);olympe.sc.logic.Ob.xj.prototype.L.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.logic.Ob.xj.prototype.T.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.logic.Ob.xj.prototype.O.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.logic.Ob.rg=class extends olympe.sc.logic.nd{tl(){return this.C('017a7b07b09e3b22c8b4')}gp(){return this.C('017a7b07ba05807a74b0')}ul(){return this.F('017a7b0818c12388d731')}vl(){return this.F('017a7b085146d5e69aec')}ot(){return olympe.D.ea.F}};olympe.sc.logic.Ob.rg.L='017a7b07b09e3b22c8b4';olympe.sc.logic.Ob.rg.Tb='017a7b07ba05807a74b0';olympe.sc.logic.Ob.rg.Ja='017a7b0818c12388d731';olympe.sc.logic.Ob.rg.C='017a7b085146d5e69aec';
|
|
1041
|
+
olympe.sc.logic.Ob.rg.P=ym('017a7b07a948e30508fa',olympe.sc.logic.Ob.rg,olympe.sc.logic.mh);m=olympe.sc.logic.Ob.rg.prototype;m.tl.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);m.gp.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);m.ul.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);m.vl.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);m.ot.K=olympe.D.J.O;olympe.sc.logic.Ob.xq=class extends olympe.sc.logic.nd{L(){return this.C('016ac63c5b3ed0562740')}};ym('016a9766c230916ea5ec',olympe.sc.logic.Ob.xq);olympe.sc.logic.Ob.xq.prototype.L.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);olympe.sc.query={};olympe.sc.query.sn=class extends olympe.sc.kg{};olympe.sc.query.sn.P=olympe.dc.na.C('01631aacd8276ea98491',olympe.sc.query.sn);olympe.sc.query.Ip=class extends olympe.dm.Enum{};olympe.sc.query.Ip.P=olympe.dc.na.C('01631aacd8276ea98495',olympe.sc.query.Ip);olympe.sc.query.Sp=class extends olympe.dm.Enum{};olympe.sc.query.Sp.P=olympe.dc.na.C('01631aacd8276ea98494',olympe.sc.query.Sp);olympe.sc.query.Tp=class extends olympe.sc.kg{};olympe.sc.query.Tp.P=olympe.dc.na.C('01631aacd8276ea98492',olympe.sc.query.Tp);olympe.sc.query.Tc=class extends olympe.dc.CloudObject{};olympe.sc.query.Tc.P=olympe.dc.na.C('01631aacd8276ea98493',olympe.sc.query.Tc);olympe.sc.Wn=class extends olympe.dc.CloudObject{};olympe.sc.Wn.P=olympe.dc.na.C('018312ceeb3e93618a85',olympe.sc.Wn);olympe.sc.Mb={};olympe.sc.Mb.Comment=class extends olympe.dm.BrickMetadata{getType(){return this.ub(olympe.sc.Mb.Comment.T)}F(){return this.ub(olympe.sc.Mb.Comment.G)}C(){return new olympe.D.Sb(this.Vc(olympe.sc.Mb.Comment.L),this.Vc(olympe.sc.Mb.Comment.F))}static Nc(a,b,c,...d){c=d[0];d=d[1];b=a.create(b);b.X();a.Ea(olympe.dc.CloudObject.containsRel,c,b);a.Ea(olympe.sc.Mb.Comment.C,b,c);c=a.create(olympe.sc.ui.ud.Rp);Z(c,olympe.sc.ui.ud.Rp.fD,d.cp());Z(c,olympe.sc.ui.ud.Rp.gD,d.ep());a.Ea(olympe.dm.BrickMetadata.oa,
|
|
1042
|
+
b,c);a.Ea(olympe.dc.CloudObject.containsRel,b,c)}};olympe.sc.Mb.Comment.Z=100;olympe.sc.Mb.Comment.O=66;olympe.sc.Mb.Comment.P=olympe.dc.na.C('0184bd886ee1c7adfe09',olympe.sc.Mb.Comment);olympe.sc.Mb.Comment.T=olympe.sc.Mb.Comment.P.ka('0184c80e29ed08a16c5e');olympe.sc.Mb.Comment.G=olympe.sc.Mb.Comment.P.ka('0184bd889f33359cfe75');olympe.sc.Mb.Comment.L=olympe.sc.Mb.Comment.P.ka('0184c3f9406e25a41512');olympe.sc.Mb.Comment.F=olympe.sc.Mb.Comment.P.ka('0184c3f942e4cc136ce8');
|
|
1043
|
+
olympe.sc.Mb.Comment.C=olympe.sc.Mb.Comment.P.sa('0184be3f135a83fd6cc3');olympe.sc.Mb.Comment.prototype.getType.K=olympe.D.J.F;olympe.sc.Mb.Comment.prototype.F.K=olympe.D.J.F;olympe.sc.Mb.Comment.prototype.C.K=olympe.D.J.T;olympe.sc.Mb.Sk=class extends olympe.dm.Enum{};olympe.sc.Mb.Sk.C={py:'Comment',DB:'Todo'};olympe.sc.Mb.Sk.P=olympe.dc.na.C('0184cc42e06205501bc7',olympe.sc.Mb.Sk);olympe.sc.workflow={};olympe.sc.workflow.ObjectState=class extends olympe.dc.CloudObject{};olympe.sc.workflow.ObjectState.P=olympe.dc.na.C('017ffdd8f0b1e31fe138',olympe.sc.workflow.ObjectState);olympe.sc.workflow.ObjectState.workflowProp=olympe.sc.workflow.ObjectState.P.ka('017ffdd8f0b1e31fe13e');olympe.sc.workflow.ObjectState.stateProp=olympe.sc.workflow.ObjectState.P.ka('017ffdd8f0b1e31fe139');olympe.sc.workflow.ObjectState.assigneeProp=olympe.sc.workflow.ObjectState.P.ka('017ffdd8f0b1e31fe13a');
|
|
1044
|
+
olympe.sc.workflow.ObjectState.dateTimeProp=olympe.sc.workflow.ObjectState.P.ka('017ffdd8f0b1e31fe13b');olympe.sc.workflow.ObjectState.serializedObjectProp=olympe.sc.workflow.ObjectState.P.ka('017ffdd8f0b1e31fe13d');olympe.sc.workflow.ObjectState.objectRel=olympe.sc.workflow.ObjectState.P.sa('017ffdd8f0b1e31fe13c');olympe.sc.workflow.ObjectState.currentObjectRel=olympe.sc.workflow.ObjectState.P.sa('017ffdd8f0b1e31fe13f');olympe.sc.workflow.hf=class extends olympe.sc.logic.nd{pt(){return this.C('017ffe02381f9fac5060')}st(){return this.C('017ffe02381f9fac5061')}tt(){return this.C('017ffe02381f9fac5062')}Zv(){return this.C('017ffe02381f9fac5065')}qt(){return this.F('017ffe02381f9fac5063')}rt(){return this.F('017ffe02381f9fac5064')}};olympe.sc.workflow.hf.P=ym('017ffde21f5fe0f704ce',olympe.sc.workflow.hf);olympe.sc.workflow.hf.C='017ffe02381f9fac5060';olympe.sc.workflow.hf.ve='017ffe02381f9fac5061';
|
|
1045
|
+
olympe.sc.workflow.hf.Pe='017ffe02381f9fac5062';olympe.sc.workflow.hf.Ja='017ffe02381f9fac5065';olympe.sc.workflow.hf.L='017ffe02381f9fac5063';olympe.sc.workflow.hf.Tb='017ffe02381f9fac5064';m=olympe.sc.workflow.hf.prototype;m.pt.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);m.st.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);m.tt.K=new olympe.D.J(()=>olympe.sc.logic.sb,[]);m.Zv.K=new olympe.D.J(()=>Map,[]);m.qt.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);m.rt.K=new olympe.D.J(()=>olympe.sc.logic.Ab,[]);olympe.sc.workflow.Oe=class extends olympe.dm.BrickMetadata{Ic(){return this.oc(olympe.sc.workflow.Workflow.statesRel.Vb(),olympe.sc.workflow.Workflow).la().concat(['.',this.la()])}};olympe.sc.workflow.Oe.P=olympe.dc.na.C('017ffdc2dda51d46b430',olympe.sc.workflow.Oe);olympe.sc.workflow.Transition=class extends olympe.dc.CloudObject{F(){return this.sr()}C(){return this.oc(olympe.sc.workflow.Transition.fromStateRel,olympe.sc.workflow.Oe)}G(){return this.oc(olympe.sc.workflow.Transition.toStateRel,olympe.sc.workflow.Oe)}Ic(){const a=this.oc(olympe.sc.workflow.Transition.fromStateRel,olympe.sc.workflow.Oe);return a.oc(olympe.sc.workflow.Workflow.statesRel.Vb(),olympe.sc.workflow.Workflow).la().concat(['.',a.la(),'->',this.la()])}};
|
|
1046
|
+
olympe.sc.workflow.Transition.P=olympe.dc.na.C('017ffdc633219f16beea',olympe.sc.workflow.Transition);olympe.sc.workflow.Transition.processRefProp=olympe.sc.workflow.Transition.P.ka('017ffdc633219f16beec');olympe.sc.workflow.Transition.fromStateRel=olympe.sc.workflow.Transition.P.sa('017ffdc2dda51d46b431');olympe.sc.workflow.Transition.toStateRel=olympe.sc.workflow.Transition.P.sa('017ffdc633219f16beeb');olympe.sc.workflow.Transition.prototype.F.K=new olympe.D.J(()=>olympe.dc.CloudObject,[]);
|
|
1047
|
+
olympe.sc.workflow.Transition.prototype.C.K=new olympe.D.J(()=>olympe.sc.workflow.Oe,[]);olympe.sc.workflow.Transition.prototype.G.K=new olympe.D.J(()=>olympe.sc.workflow.Oe,[]);olympe.sc.workflow.Workflow=class extends olympe.dm.BrickMetadata{le(){return olympe.sc.ud.te.Yg}G(){return this.Ig(olympe.sc.workflow.Workflow.serializationEnabledProp)}C(){return this.oc(olympe.sc.workflow.Workflow.dataTypeRel,olympe.sc.Qc)}F(){return this.oc(olympe.sc.workflow.Workflow.initialStateRel,olympe.sc.workflow.Oe)}};olympe.sc.workflow.Workflow.P=olympe.dc.na.C('017ffdc010e5bcc9c971',olympe.sc.workflow.Workflow);olympe.sc.workflow.Workflow.serializationEnabledProp=olympe.sc.workflow.Workflow.P.ka('017ffdc010e5bcc9c972');
|
|
1048
|
+
olympe.sc.workflow.Workflow.dataTypeRel=olympe.sc.workflow.Workflow.P.sa('017ffdc010e5bcc9c973');olympe.sc.workflow.Workflow.statesRel=olympe.sc.workflow.Workflow.P.sa('017ffdc010e5bcc9c974');olympe.sc.workflow.Workflow.initialStateRel=olympe.sc.workflow.Workflow.P.sa('017ffdc010e5bcc9c975');olympe.sc.workflow.Workflow.prototype.G.K=olympe.D.J.O;olympe.sc.workflow.Workflow.prototype.C.K=new olympe.D.J(()=>olympe.sc.Qc,[]);
|
|
1049
|
+
olympe.sc.workflow.Workflow.prototype.F.K=new olympe.D.J(()=>olympe.sc.workflow.Oe,[]);olympe.sc.qa={};olympe.sc.qa.Lc=class extends olympe.sc.Ua{le(){return olympe.sc.ud.te.qu}};olympe.sc.qa.Lc.P=olympe.dc.na.C('01120300000000adef00',olympe.sc.qa.Lc);olympe.sc.qa.Lc.C=olympe.sc.qa.Lc.P.sa('0171bc1f15da96dfdb89');olympe.sc.qa.Lc.Ja=olympe.sc.qa.Lc.P.sa('0171bc1f15da96dfdb90');U(olympe.dm.Cc.P,olympe.sc.qa.Lc.C);olympe.sc.qa.Oh=class extends olympe.sc.Runnable{G(){return[this.cc()]}za(){return olympe.dc.bd.from(this.cc()).cb(olympe.sc.qa.Lc.C).hd()}};olympe.sc.qa.Oh.P=bf(olympe.dc.na.C('0113030000000aca1100',olympe.sc.qa.Oh));olympe.sc.qa.Oh.prototype.za.K=new olympe.D.J(()=>olympe.dm.hb,[]);olympe.sc.qa.kb=class extends olympe.dc.CloudObject{vt(){return this.Ig(olympe.sc.qa.kb.uh)}jx(){return this.Ig(olympe.sc.qa.kb.oa)}yc(){return this.Vc(olympe.sc.qa.kb.C)}ew(){return this.ub(olympe.sc.qa.kb.L)}Aw(){return this.ub(olympe.sc.qa.kb.fa)}zw(){return this.ub(olympe.sc.qa.kb.Z)}xe(){return this.ub(olympe.sc.qa.kb.ba)}pw(){return this.ub(olympe.sc.qa.kb.O)}Pv(){return this.ub(olympe.sc.qa.kb.F)}yw(){return this.ub(olympe.sc.qa.kb.T)}ut(){return this.ub(olympe.sc.qa.kb.G)}};
|
|
1050
|
+
olympe.sc.qa.kb.P=olympe.dc.na.C('011203300000000adef5',olympe.sc.qa.kb);olympe.sc.qa.kb.uh=olympe.sc.qa.kb.P.ka('011203300000000adef6');olympe.sc.qa.kb.oa=olympe.sc.qa.kb.P.ka('011203300000000adef7');olympe.sc.qa.kb.C=olympe.sc.qa.kb.P.ka('011203300000000adef8');olympe.sc.qa.kb.L=olympe.sc.qa.kb.P.ka('011203300000000adef9');olympe.sc.qa.kb.fa=olympe.sc.qa.kb.P.ka('011203300000000adefa');olympe.sc.qa.kb.Z=olympe.sc.qa.kb.P.ka('011203300000000adefb');olympe.sc.qa.kb.F=olympe.sc.qa.kb.P.ka('011203300000000adefc');
|
|
1051
|
+
olympe.sc.qa.kb.ba=olympe.sc.qa.kb.P.ka('011203300000000adefd');olympe.sc.qa.kb.O=olympe.sc.qa.kb.P.ka('011203300000000adefe');olympe.sc.qa.kb.T=olympe.sc.qa.kb.P.ka('011203300000000adeff');olympe.sc.qa.kb.G=olympe.sc.qa.kb.P.ka('011203300000000adee0');olympe.sc.qa.kb.Jb={INIT:0,ny:1,Pj:2,Oj:3,Tl:4,QA:5,Eb:9};m=olympe.sc.qa.kb.prototype;m.vt.K=olympe.D.J.O;m.jx.K=olympe.D.J.O;m.yc.K=olympe.D.J.G;m.ew.K=olympe.D.J.F;m.Aw.K=olympe.D.J.F;m.zw.K=olympe.D.J.F;m.xe.K=olympe.D.J.F;m.pw.K=olympe.D.J.F;
|
|
1052
|
+
m.Pv.K=olympe.D.J.F;m.yw.K=olympe.D.J.F;m.ut.K=olympe.D.J.F;olympe.sc.qa.ml=class extends olympe.sc.qa.Oh{F(a){a.set(olympe.sc.wa.C.gn,!0);super.F(a)}oa(){return!0}};olympe.sc.qa.ml.P=olympe.dc.na.C('0113032000000aca1102',olympe.sc.qa.ml,olympe.sc.R.Ca);olympe.sc.qa.Ne=class extends olympe.sc.qa.Lc{C(){return(new olympe.dc.sj(this.X(),olympe.sc.qa.kb)).cb(olympe.sc.qa.Ne.L).fi().xc()}};olympe.sc.qa.Ne.P=olympe.dc.na.C('011203300000000adef3',olympe.sc.qa.Ne);olympe.sc.qa.Ne.L=olympe.sc.qa.Ne.P.sa('011203300000000adef4');U(olympe.sc.qa.kb.P,olympe.sc.qa.Ne.L);
|
|
1053
|
+
olympe.sc.qa.Ne.P.C=(a,b,c)=>{b=xk(a,b||'New Service Application model',olympe.sc.qa.Ne,olympe.sc.qa.ml);a.Ea(olympe.sc.qa.Lc.C,b,c);c=a.create(olympe.sc.qa.kb).X();a.Ea(olympe.sc.qa.Ne.L,b,c);return b.X()};olympe.sc.qa.Ne.prototype.C.K=new olympe.D.J(()=>olympe.sc.qa.kb,[]);olympe.sc.wg=class extends olympe.dc.CloudObject{static get(){return olympe.dc.CloudObject.get('011203300000000adf0f')}};olympe.sc.wg.P=olympe.dc.na.C('011203300000000adf00',olympe.sc.wg);olympe.sc.wg.F=olympe.sc.wg.P.ka('011203300000000adf01');olympe.sc.wg.C=olympe.sc.wg.P.ka('011203300000000adf02');olympe.sc.wg.G='011203300000000adf0f';olympe.sc.Vg=class extends olympe.dm.BrickMetadata{le(){return olympe.sc.ud.te.Yg}};olympe.sc.Vg.P=olympe.dc.na.C('01645fe6873aeea59e64',olympe.sc.Vg);olympe.sc.Vg.C=olympe.sc.Vg.P.sa('017ed8ac775f48d4d589');olympe.sc.Vg.F=olympe.sc.Vg.P.sa('017ed8ac775f48d4d590');olympe.sc.Tn=class extends olympe.dm.Ib{le(){return olympe.sc.ud.te.Yg}};olympe.sc.Tn.P=olympe.dc.na.C('0163a68ce44f3d1fa95d',olympe.sc.Tn);olympe.sc.Wg=class extends olympe.dm.BrickMetadata{};olympe.sc.Wg.P=olympe.dc.na.C('016324fde11a836f77d3',olympe.sc.Wg);olympe.sc.Wg.C=olympe.sc.Qc.P.sa('016324fde11a836088d3');olympe.sc.Wg.P.C=(a,b)=>xk(a,null!=b?b:'New config type',olympe.sc.Wg).X();olympe.sc.wy=class{};olympe.sc.gj=class extends olympe.dm.BrickMetadata{le(){return olympe.sc.ud.te.Yg}};olympe.sc.gj.P=olympe.dc.na.C('017dc8d6c8fd8c8bd2ff',olympe.sc.gj);olympe.sc.gj.P.C=(a,b)=>xk(a,null!=b?b:'New data connector',olympe.sc.gj,olympe.dm.DataSource).X();olympe.sc.oe=class extends olympe.sc.Runnable{Ja(){return this.bb(olympe.sc.oe.G,olympe.sc.Runnable)}za(){return this.bb(olympe.sc.oe.F,olympe.dm.Property)}};olympe.sc.oe.P=bf(olympe.dc.na.C('016c2d996d9ca27fa9d8',olympe.sc.oe));olympe.sc.oe.G=olympe.sc.oe.P.sa('016c3cb7742ec9309e0b');olympe.sc.oe.F=olympe.sc.oe.P.sa('016c42d3454636f90533');olympe.sc.oe.prototype.Ja.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.sc.oe.prototype.za.K=new olympe.D.J(()=>olympe.dc.ya,[]);olympe.sc.ro=class extends olympe.dm.Ib{le(){return olympe.sc.ud.te.Yg}};olympe.sc.ro.P=olympe.dc.na.C('017a7a9ff057958e5678',olympe.sc.ro);olympe.sc.Vh=class extends olympe.dm.Enum{static create(a,b,c,d,e){const f=olympe.dc.ia();e=void 0!==e?e:f.Fa(b)&&f.Id(b).length||0;c=(new Map).set(olympe.dm.String.valueProp,c).set(olympe.dc.CloudObject.nameProp,d||c).set(olympe.dm.Enum.rankProp,e);return a.create(b,c)}};olympe.sc.Vh.create=olympe.sc.Vh.create;olympe.sc.Vh.P=olympe.dc.na.C('016cdd861b32d56c8208',olympe.sc.Vh);olympe.sc.op=class extends olympe.dm.Ib{le(){return olympe.sc.ud.te.Nu}};olympe.sc.op.P=olympe.dc.na.C('01644b6d4543b344b857',olympe.sc.op);olympe.sc.pp=class extends olympe.dc.CloudObject{};olympe.sc.pp.P=olympe.dc.na.C('0162f672366be5ca7a86',olympe.sc.pp);olympe.sc.ug=class extends olympe.dc.sources.ug{C(a){return a instanceof olympe.sc.logic.Error?{t:20,c:a.code,m:a.message,s:a.ie()}:super.C(a)}G(a){return 20===(null==a?void 0:a.t)?Kl(a.m,a.c,a.s):super.G(a)}};olympe.sc.yq=class extends olympe.sc.oe{};olympe.sc.yq.P=olympe.dc.na.C('016d3f37610ae4fc3962',olympe.sc.yq);olympe.sc.Text=class extends olympe.dm.String{};olympe.sc.Text.P=olympe.dc.na.C('016cfca73e63f9ab5ba4',olympe.sc.Text);olympe.sc.Wa=class{constructor(a=!0){var b=new olympe.dc.Wa;b.T=a;this.C=b;this.F=[];this.source=null}static from(a){const b=olympe.sc.wa.C.TRANSACTION;return a.has(b,!0)?a.get(b,!0):new olympe.sc.Wa}static process(a,b){return a.has(olympe.sc.wa.C.TRANSACTION,!0)?Promise.resolve(!1):b.lb().then(()=>!0)}V(){return this.C.V()}create(a,b=new Map,c=this.source,d){c='string'===typeof c?c:olympe.dc.Sd().fromModel(a);d=this.C.create(a,d).Ti(c);for(const [e,f]of b)Z(d,e,f);if(c===olympe.dc.Pa.SERVER&&olympe.dc.ia().jc(a,
|
|
1054
|
+
olympe.sc.Qc))if(b=null,null!==sm?b=sm:'string'===typeof rm&&(b=olympe.dc.bd.from(rm).cb(olympe.sc.qa.Lc.C).cb(olympe.sc.Pc.C.Vb()).hd()),null!==b)this.Ea(olympe.sc.Pc.F,b,d);else throw Error('No business container for new instance of',olympe.dc.ga(a));a=d.X();this.F.push(a);return a}update(a,b,c){this.C.update(a,b,c);return this}yr(a,b){a=this.C.update(a);for(const [c,d]of b)b=d,a.yd.set(olympe.dc.ga(c),b);return this}delete(a){this.C.delete(a);return this}Ea(a,b,c){this.C.Ea(a,b,c);return this}ic(a,
|
|
1055
|
+
b,c){this.C.ic(a,b,c);return this}wm(a,b){this.C.wm(a,b);return this}persist(a,b=!0){this.C.persist(a,b);return this}Ax(a,b=!0){olympe.ma.ab('dc').warn('Transaction#persistInstance() has been deprecated. Please use Transaction#persist() instead.');return this.persist(a,b)}Ti(a){this.source=a;return this}model(a){return this.C.model(a)}merge(a){wk(this.C,a.C);return this}nm(a){this.C.nm(a);return this}lb(){return new Promise((a,b)=>{this.C.lb((c,d)=>{c?a(new olympe.sc.wi(this.F)):b(d)})})}xm(){return new Promise((a,
|
|
1056
|
+
b)=>{this.C.xm((c,d)=>{c?a(new olympe.sc.wi(this.F)):b(d)})})}};olympe.sc.Wa.prototype.executeAsLarge=olympe.sc.Wa.prototype.xm;olympe.sc.Wa.prototype.execute=olympe.sc.Wa.prototype.lb;olympe.sc.Wa.prototype.afterExecution=olympe.sc.Wa.prototype.nm;olympe.sc.Wa.prototype.merge=olympe.sc.Wa.prototype.merge;olympe.sc.Wa.prototype.model=olympe.sc.Wa.prototype.model;olympe.sc.Wa.prototype.setSource=olympe.sc.Wa.prototype.Ti;olympe.sc.Wa.prototype.persistInstance=olympe.sc.Wa.prototype.Ax;
|
|
1057
|
+
olympe.sc.Wa.prototype.persist=olympe.sc.Wa.prototype.persist;olympe.sc.Wa.prototype.deleteAllRelations=olympe.sc.Wa.prototype.wm;olympe.sc.Wa.prototype.deleteRelation=olympe.sc.Wa.prototype.ic;olympe.sc.Wa.prototype.createRelation=olympe.sc.Wa.prototype.Ea;olympe.sc.Wa.prototype['delete']=olympe.sc.Wa.prototype.delete;olympe.sc.Wa.prototype.multiUpdate=olympe.sc.Wa.prototype.yr;olympe.sc.Wa.prototype.update=olympe.sc.Wa.prototype.update;olympe.sc.Wa.prototype.create=olympe.sc.Wa.prototype.create;
|
|
1058
|
+
olympe.sc.Wa.prototype.getId=olympe.sc.Wa.prototype.V;olympe.sc.Wa.process=olympe.sc.Wa.process;olympe.sc.Wa.from=olympe.sc.Wa.from;olympe.sc.wi=class{constructor(a){this.C=a}Wv(){return this.C.map(olympe.dc.CloudObject.get)}};olympe.sc.wi.prototype.getCreatedObjects=olympe.sc.wi.prototype.Wv;olympe.tc={};olympe.tc.Qr=class{run(){}};function Cm(a,b='default'){return a.C===b}
|
|
1059
|
+
olympe.tc.Ta=class{constructor(a,b){this.C=a;this.H=b;this.F=null;this.G='';this.H.info('HC Manager will execute application registered as:',this.C)}Qi(a,b,c=''){b||(b='default');b===this.C?(null===this.F?this.H.log('Application',c,'designated to be launched'):this.H.log('OVERRIDE: Application',c,'designated to be launched'),this.F=a,this.G=c):this.H.debug('ignoring application:'+c+' as it is registered under name '+b+' and not '+this.C)}run(){null!==this.F?(this.H.info('Running application:',this.G),
|
|
1060
|
+
this.F.run()):this.H.error('No app registered under name: '+this.C)}};olympe.tc.Qi=function(a,b,c='default'){const d=a.ab();c?d.debug('Pre-registering application '+b+' under name '+c+' (use '+olympe.tc.U.Be+'='+c+' to start it)'):d.debug('Pre-registering application '+b+' as default one');a.rd(olympe.tc.R.Ha).config(c,[b],(e,f)=>f.Qi(e,c,b),e=>Cm(e,c),'olympe.hc.registerApp')};olympe.tc.R={Ha:'hc.Manager',Ca:'hc.Logger'};olympe.tc.U={Be:'hc.app',Ho:'hc.globalToken'};olympe.W.config(function(a){G(a,olympe.tc.U.Be,'default');G(a,olympe.tc.U.Ho,!1);F(a,olympe.tc.R.Ca,[olympe.ma.R.Ha],b=>b.Oc('hc'));F(a,olympe.Bb.R.tg,[new olympe.W.ja(olympe.tc.U.Be)],b=>b);F(a,olympe.auth.R.Ck,[olympe.Bb.R.tg,new olympe.W.ja(olympe.tc.U.Ho)],(b,c)=>new olympe.auth.rn(c?'':b));E(a,olympe.tc.R.Ha,olympe.tc.Ta,new olympe.W.ja(olympe.tc.U.Be),olympe.tc.R.Ca)},'olympe.hc');
|
|
1061
|
+
olympe.W.run([olympe.tc.R.Ha],a=>a.run(),'olympe.hc');olympe.sc.Gb={};function Dm(a,b){if(a.fa)a.H.debug('Sending getContext request'),sh(a.oa).then(()=>{a.H.debug('synchronisation request successful');rm=a.C;b()}).catch(c=>{a.H.error('failed to synchronise (authenticated) with server: '+c.message)});else{const c=Il(a.F);!c&&Hj();a.H.debug((c?'PULLING':'SUBSCRIBING')+' application '+a.C);const d=a.F.F(),e=new olympe.async.vq(d);e.add((f,g)=>{const h=olympe.dc.ia(),k=new olympe.D.Yb('Primordial Subscription Context',d);jh(k,a.C,l=>{l=h.Hh(l)?l:h.model(l);return null!==
|
|
1062
|
+
l&&h.jc(l,olympe.sc.Wg)},{Kd:Em(c),$m:!0}).subscribe(rxjs.Subscriber.create(d.G(()=>{h.jc(a.C,olympe.sc.qa.Lc)?(a.za.Z(a.C,c),f()):Ic(a.O)?g(`The specified application tag (${a.C}) is not an application or does not exist`):(k.destroy(),a.O.connect().catch(l=>{g(`Failed to load the app while offline, you might want to try again when online: ${l}`)}))}),l=>g(String(l))))});e.add(f=>{olympe.D.Gc([a.ba.ke()],g=>{const h=Em(c,!1);olympe.dc.pa.we(g,olympe.dm.User).observe(olympe.D.Xa(),{Kd:h,$j:'__code-as-data__'}).subscribe(()=>
|
|
1063
|
+
d.run(f))})});e.add((f,g)=>{if(Fm(a.C)){const h=olympe.sc.Pc.Jb.ip,k=olympe.sc.Pc.Jb.hi;tm(a.C,a.ob,l=>{l===h||l===k?d.run(f):d.run(()=>g('Error while loading the business container'))})}else f()});yc(e,(f,g)=>{if(g)throw Error(g);b()});e.start()}}
|
|
1064
|
+
function Gm(a){a.H.info('Starting application '+a.C);const b=olympe.D.fc(olympe.D.ea).update(olympe.D.ea.C),c=olympe.dc.ia();if(0<a.C.length){const d=Fe(c,a.C,a.F.F().G((g,h)=>{if(g)if(g=jm(h),g instanceof olympe.sc.qa.Oh){a.H.debug('application retrieved: running');h=Gl(a.F,g);const k=new olympe.sc.Za.eu(a.L);Na(a.L,()=>Sl(a.F.C,k));Oa(a.L,()=>{var l=k.V();return Ul(a.F.C,l)});a.Ja&&a.L.start();g.run(h);'string'===typeof a.jb&&(new olympe.sc.Md).fa(g.X(),h,a.H);h.Hr(olympe.sc.wa.C.gn).then(()=>{let l;
|
|
1065
|
+
null==(l=e)||l.cancel();b.update(olympe.D.ea.F);Hm(a)})}else a.H.error('application retrieved: not an Application with a run() method');else Im(a)}));olympe.D.Xa().onDestroy(()=>{Ee(c,a.C,d)});const e=Tb(()=>{a.H.warn(`requested application ${a.C} may not be available (it may not exist or the logged user may not have the correct permissions)`)},3E4);let f;null==(f=a.tb)||f.start()}Jm(a);Km(a,b)}
|
|
1066
|
+
function Hm(a){a.H.info(`Application ${olympe.dc.ia().name(a.C)} (${a.C}) started`);a=olympe.dc.sources.Qd();a.Kb=!0;a.Z+=0;a.Od.next(0<a.Z);0===a.Z&&a.ba&&a.Kb&&(a.H.debug(`Cache: set code-as-data version in local storage: ${a.version}`),a.jb.set('__code-as-data-version__',a.version),a.tb||(a.ba=!1))}function Em(a,b=!0){return a?olympe.dc.pa.Tc.Ml:b?olympe.dc.pa.Tc.Ef:olympe.dc.pa.Tc.Ll}function Im(a){a.H.info('Stop the application');Hm(a);a.F.F().oa();a.G.G(a.T);a.G.O(a.Z)}
|
|
1067
|
+
function Jm(a){a.Z=a.G.F(()=>x(function*(){return Im(a)}),'Stop application')}function Km(a,b){a.T=a.G.C(()=>olympe.D.Ra(b)===olympe.D.ea.F?Promise.resolve('The application is started'):Promise.reject('The application is not started'))}
|
|
1068
|
+
olympe.sc.Gb.Sl=class{constructor(a,b,c,d,e,f,g,h,k,l){this.H=a;this.ba=b;this.O=c;this.oa=d;this.G=e;this.Z=this.T='';this.F=f;this.za=g;this.L=h;this.tb=l;this.C=k.get('appTag');this.fa=k.get('getContextMode');let n;this.jb=null!=(n=k.get('debuggerName'))?n:null;this.Ja=k.get('autostartProfiler');this.ob=k.get('loadBusinessContainer')}run(){this.H.debug('runtime starting for app #'+this.C);let a=!1;const b=olympe.N.pc.C.li,c=olympe.N.pc.C.$d,d=olympe.N.pc.C.Wd;olympe.D.Gc([this.O.getState()],e=>
|
|
1069
|
+
{switch(e){case b:case c:this.H.debug('Server session opened or working offline, start the application');a||(a=!0,Dm(this,()=>Gm(this)));break;case d:this.H.debug('Impossible to open a connection to the orchestrator and offline mode is disabled.')}})}};olympe.sc.Gb.Sl.C='app_instance';olympe.sc.Gb.Sl.xa=[olympe.tc.Qr];olympe.sc.Gb.ou=class{constructor(a,b,c,d){this.H=a;this.G=b;this.F=c;this.L=d.get('httpManifestPath');this.C=d.get('manifestCommon');if(!this.C)this.C={};else if('string'===typeof this.C)try{this.C=JSON.parse(this.C)}catch(e){this.H.warn('Invalid manifest common config'),this.C={}}}start(){const a=b=>{const c=(new URL(b.C())).searchParams.get('origin');if(c)return c;b=b.Ii();this.H.debug('Request headers',JSON.stringify(b,null,2));return b.origin?b.origin:b.Ex?(new URL(b.Ex)).origin:b[olympe.net.Ba.Headers.zo]&&
|
|
1070
|
+
b[olympe.net.Ba.Headers.Ao]?b[olympe.net.Ba.Headers.Ao]+'://'+b[olympe.net.Ba.Headers.zo]:null};this.G.L('manifest',`${this.L}/:${'appTag'}`,[olympe.net.Ba.Nd.GET],(b,c)=>{const d=this;return x(function*(){var e=c.get('appTag');d.H.debug('Processing request to serve manifest for app',e);if(20!==e.length)return new olympe.net.Yd('Invalid appTag',olympe.net.Ba.Zb.Gk);try{var f=yield olympe.dc.pa.we(e,olympe.sc.qa.Lc).lb(d.F)}catch(h){return new olympe.net.Yd(`Something went wrong: ${'string'===typeof h?
|
|
1071
|
+
h:h.message}`,olympe.net.Ba.Zb.Gk)}if(0===f.size())return new olympe.net.Yd('App not found',olympe.net.Ba.Zb.Al);var g=a(b);f=f.xc();g={name:f.name(),short_name:f.name(),id:e,start_url:g?`${g}?hc.app=sc.runtime&sc.app=${e}`:void 0,display:'standalone',backgroundColor:'#fff',icons:g?[{src:`${g}/images/logo.svg`,sizes:'150x150',type:'image/png'},{src:`${g}/images/logo.png`,sizes:'1024x1024',type:'image/png',purpose:'maskable any'}]:void 0};f=olympe.W.getParameter(`app.manifest.${e}`);if(!f)f={};else if('string'===
|
|
1072
|
+
typeof f)try{f=JSON.parse(f)}catch(h){d.H.warn(`Invalid manifest app config for app: ${e}`),f={}}e=Object.assign({},g,d.C,f);return new olympe.net.Yd(JSON.stringify(e),olympe.net.Ba.Zb.gh,void 0,{'content-type':'application/json'})})}).catch(()=>this.H.error('Error while starting the RuntimeHTTPService'));this.H.debug('Started RuntimeHTTPService')}};function Fm(a){var b=olympe.dm.DataSource.SERVER;const c=olympe.dc.pa.from(a).cb(olympe.sc.qa.Lc.C).cb(olympe.dm.md.G.Vb()).cb(olympe.dm.md.C).hd();a=olympe.dc.pa.from(a).cb(olympe.sc.qa.Lc.C).cb(olympe.dm.hb.G).hd();return c.concat(a).has(b)}
|
|
1073
|
+
olympe.sc.Gb.Sj=class extends olympe.dc.sources.Sj{T(a){return this.db.jc(a,olympe.sc.Qc)}Z(a,b){if(!this.L){super.init();var c=olympe.dc.bd.from(a).cb(olympe.sc.qa.Lc.C).hd();if(!(c instanceof olympe.dm.hb))throw Error(`Impossible to initialize the source solver for the application ${a}: no project is linked to it`);b=b?olympe.dc.pa.Tc.Ml:olympe.dc.pa.Tc.Ef;zj(this,c,b);c=new olympe.D.Yb('deployed data sources');olympe.dc.pa.from(a).cb(olympe.sc.qa.Lc.Ja).observe(c,{Kd:b}).subscribe(d=>{const e=
|
|
1074
|
+
new olympe.dc.Wa;Ne(d).forEach(f=>{e.Ea(olympe.dm.DataSource.Pi,this.C,f)});Me(d).forEach(f=>{e.ic(olympe.dm.DataSource.Pi,this.C,f)});e.lb()})}}};olympe.sc.Gb.R={Mf:'sc.runtime.Main',Me:'sc.runtime.SourceSolver',cq:'sc.runtime.appConfig',fq:'sc.runtime.runtimeHTTPServiceConfig',eq:'sc.runtime.RuntimeHTTPService',Ap:'sc.runtime.OfflineAppConfig'};olympe.sc.Gb.U={Po:'app.httpManifestPath',np:'app.manifest.common',jp:'sc.loadBusinessContainer'};
|
|
1075
|
+
olympe.W.config(function(a){G(a,olympe.sc.Gb.U.Po,'/runtime/manifest');G(a,olympe.sc.Gb.U.np,null);G(a,olympe.sc.Gb.U.jp,!0);F(a,olympe.Bb.R.tg,[new olympe.W.ja(olympe.tc.U.Be),new olympe.W.ja(olympe.sc.U.Be)],(b,c)=>`${b}${c?'-'+c:''}`);F(a,olympe.sc.Gb.R.Ap,[new olympe.W.ja(olympe.sc.U.Be),new olympe.W.ja(olympe.net.U.ki),new olympe.W.ja(olympe.net.U.Cl)],(b,c,d)=>{let e;const f=null!=(e=a.getParameter(`offline.${b}.enabled`))?e:c;let g;b=null!=(g=a.getParameter(`offline.${b}.autoBackOnline`))?
|
|
1076
|
+
g:d;return new Map([['offlineEnabled',f],['offlineAutoBackOnline',!f||b]])});wa(a,olympe.net.R.Dl,olympe.sc.Gb.R.Ap);E(a,olympe.sc.Gb.R.Me,olympe.sc.Gb.Sj,olympe.dc.R.bf,new olympe.W.ja(olympe.dc.U.sg),new olympe.W.ja(olympe.dc.U.Yk));wa(a,olympe.dc.sources.R.Me,olympe.sc.Gb.R.Me);F(a,olympe.sc.Gb.R.cq,[new olympe.W.ja(olympe.sc.U.Be),new olympe.W.ja(olympe.dc.U.oh),new olympe.W.ja(olympe.sc.U.eo),new olympe.W.ja(olympe.sc.U.jn),new olympe.W.ja(olympe.sc.Gb.U.jp)],(b,c,d,e,f)=>new Map([['appTag',
|
|
1077
|
+
b],['getContextMode',c],['debuggerName',d],['autostartProfiler',e],['loadBusinessContainer',f]]));E(a,olympe.sc.Gb.R.Mf,olympe.sc.Gb.Sl,olympe.sc.R.Ca,olympe.auth.R.Ha,olympe.N.R.Ze,olympe.dc.query.R.Ej,olympe.host.R.Je,olympe.sc.R.Ij,olympe.sc.Gb.R.Me,olympe.Y.R.Lf,olympe.sc.Gb.R.cq,olympe.sc.Gb.R.eq);F(a,olympe.sc.Gb.R.fq,[new olympe.W.ja(olympe.sc.Gb.U.Po),new olympe.W.ja(olympe.sc.Gb.U.np)],(b,c)=>new Map([['httpManifestPath',b],['manifestCommon',c]]));E(a,olympe.sc.Gb.R.eq,olympe.sc.Gb.ou,olympe.sc.R.Ca,
|
|
1078
|
+
olympe.net.R.xi,olympe.sc.R.Ij,olympe.sc.Gb.R.fq);olympe.tc.Qi(a,olympe.sc.Gb.R.Mf,'sc.runtime');olympe.tc.Qi(a,olympe.sc.Gb.R.Mf,'sc.headless');olympe.tc.Qi(a,olympe.sc.Gb.R.Mf)},'olympe.sc.runtime');olympe.public={};olympe.public.Ia=class a{static Nv(b,c){const d=new SRPClient,e=d.generateRandomSalt();return{username:b,login:b,salt:e,verifier:d.generateVerifier(e,b,c)}}static getState(){return oe(olympe.public.Ia.get())}static rk(b){return a.F(olympe.public.Ia.get().rk(),b).pipe(rxjs.operators.map(c=>c.valueOf()))}static Yv(){return olympe.D.Ra(olympe.public.Ia.get().ke())}static vx(b){return a.F(olympe.public.Ia.get().ke(),b)}static je(){var b=olympe.D,c=b.Ra;var d=olympe.public.Ia.get().C.rb().sd();return c.call(b,
|
|
1079
|
+
d)}static Xf(){return new Promise((b,c)=>{olympe.public.Ia.get().Xf(d=>d?c(d):b())})}static jw(){return olympe.D.Ra(olympe.public.Ia.get().Ch())||void 0}static Kw(){const b=Nc(olympe.public.Ia.get());return{user:b.uc(),userTag:b.ke(),nonce:b.sd(),payload:b.di(),idpName:b.ff(),protocol:b.ig()}}static iw(){return Array.from(pe().keys())}static Xe(){olympe.public.Ia.get().Xe()}static Mg(b){return new Promise((c,d)=>{olympe.public.Ia.get().Mg(b,e=>e?d(e):c())})}static $w(b,c){return olympe.public.Ia.C((new Map).set('username',
|
|
1080
|
+
b).set('password',c),olympe.auth.wc.C.SRP)}static ax(b){const c=pe();if(0===c.size||b&&!c.has(b)){var d=0===c.size?'There are no available IDPs':`The IDP name ${b} is not valid, the valid names are ${Array.from(c.keys())}`;return Promise.reject(d)}b?(d=b,b=c.get(b)):(b=Array.from(c)[0],d=b[0],b=b[1]);return olympe.public.Ia.C((new Map).set('idpName',d),b)}static Zw(){return olympe.public.Ia.C(new Map,olympe.auth.wc.C.SAML)}static bx(b,c){return olympe.public.Ia.C((new Map).set('username',b).set('nonce',
|
|
1081
|
+
c),olympe.auth.wc.C.El)}static Yw(){return olympe.public.Ia.C(new Map,olympe.auth.wc.C.OAUTH2)}static Ih(){return olympe.public.Ia.get().Ih()}static C(b,c){const d=new olympe.auth.Request;for(const [e,f]of b)d.set(e,f);return new Promise(e=>{ne(olympe.public.Ia.get(),d,c,()=>{e()})})}static get(){return olympe.auth.he()}static F(b,c){return b.asObservable('function'===typeof c.F?c.F():c)}};olympe.public.Ia.logout=olympe.public.Ia.Ih;olympe.public.Ia.loginOpenID=olympe.public.Ia.Yw;
|
|
1082
|
+
olympe.public.Ia.loginToken=olympe.public.Ia.bx;olympe.public.Ia.loginSAML=olympe.public.Ia.Zw;olympe.public.Ia.loginSSO=olympe.public.Ia.ax;olympe.public.Ia.loginSRP=olympe.public.Ia.$w;olympe.public.Ia.getUserFromToken=olympe.public.Ia.Mg;olympe.public.Ia.sendKeepAlive=olympe.public.Ia.Xe;olympe.public.Ia.getIDPNames=olympe.public.Ia.iw;olympe.public.Ia.getUserToken=olympe.public.Ia.Kw;olympe.public.Ia.getIDPToken=olympe.public.Ia.jw;olympe.public.Ia.refreshToken=olympe.public.Ia.Xf;
|
|
1083
|
+
olympe.public.Ia.getToken=olympe.public.Ia.je;olympe.public.Ia.observeUser=olympe.public.Ia.vx;olympe.public.Ia.getCurrentUser=olympe.public.Ia.Yv;olympe.public.Ia.isAuthenticated=olympe.public.Ia.rk;olympe.public.Ia.getState=olympe.public.Ia.getState;olympe.public.Ia.generateSRPData=olympe.public.Ia.Nv;olympe.public.Aa=class{static create(a){return new class extends olympe.dc.$.Zf{C(b,c){b=a(olympe.dc.CloudObject.get(c));if('boolean'===typeof b)return b;const d=olympe.D.fc(olympe.D.ea),e=b.subscribe(f=>d.update(olympe.D.Qb(f)));olympe.D.Xa().Z(()=>e.unsubscribe());return d.rb()}}}};
|
|
1084
|
+
olympe.public.$e=class{static create(a){return new class extends olympe.dc.rc.Zf{G(b,c){return olympe.dc.CloudObject.get(c)}compare(b,c){b=a(b,c);if('number'===typeof b)return b;const d=olympe.D.fc(olympe.D.aa),e=b.subscribe(f=>d.update(olympe.D.ra(f)));olympe.D.Xa().Z(()=>e.unsubscribe());return d.rb()}}}};olympe.public.Process=class{static wx(a,b){const c=olympe.host.jk(),d=c.C(a,b);return()=>c.G(d)}static xx(a,b){const c=olympe.host.jk(),d=c.F(a,b);return()=>c.O(d)}static connect(){return olympe.N.Am().connect()}static disconnect(){return olympe.N.Am().disconnect()}static Uf(a){a='function'===typeof a.F?a.F():a;return olympe.N.Am().Uf().asObservable(a).pipe(rxjs.operators.map(b=>b.valueOf()))}};olympe.public.Process.isOnline=olympe.public.Process.Uf;olympe.public.Process.disconnect=olympe.public.Process.disconnect;
|
|
1085
|
+
olympe.public.Process.connect=olympe.public.Process.connect;olympe.public.Process.onShutdown=olympe.public.Process.xx;olympe.public.Process.onHealthCheck=olympe.public.Process.wx;'object'===typeof exports&&(exports={CloudObject:olympe.dc.CloudObject,Relation:olympe.dc.Ma.Relation,Direction:olympe.dc.ua,generateTag:olympe.Y.tf,tagToString:olympe.dc.ga,register:olympe.dc.register,defineProperty:olympe.dc.defineProperty,defineRelation:olympe.dc.cr,defineInverseRelation:olympe.dc.xv,BrickContext:olympe.sc.wa,Brick:olympe.sc.logic.Function,ActionBrick:olympe.sc.logic.Action,GlobalProperties:olympe.sc.wa.C,registerBrick:olympe.sc.logic.na.C,FunctionBrick:olympe.sc.logic.Function,
|
|
1086
|
+
Context:olympe.sc.wa,Entry:olympe.dc.Ma.Entry,PropertyModel:olympe.dm.Property,RelationModel:olympe.dm.Relation,StringModel:olympe.dm.String,NumberModel:olympe.dm.Number,BooleanModel:olympe.dm.Boolean,DatetimeModel:olympe.dm.DateTime,ColorModel:olympe.dm.Color,File:olympe.sc.File,User:olympe.dm.User,Enum:olympe.dm.Jf,EnumValue:olympe.sc.Vh,DataSource:olympe.dm.DataSource,DataResult:olympe.dc.query.ld,Workflow:olympe.sc.workflow.Workflow,WorkflowState:olympe.sc.workflow.Oe,WorkflowTransition:olympe.sc.workflow.Transition,
|
|
1087
|
+
WorkflowObjectState:olympe.sc.workflow.ObjectState,Transaction:olympe.sc.Wa,BurstTransaction:olympe.dc.Qh,TransactionResult:olympe.sc.wi,PredefinedDataSource:olympe.dc.Pa,QueryResult:olympe.dc.Oa,Query:olympe.dc.pa,QuerySingle:olympe.dc.bd,Predicate:olympe.dc.query.Aa,Order:olympe.dc.query.Bj,Config:class{static getParameter(a){return olympe.W.getParameter(a)}},Process:olympe.public.Process,Cache:{getCacheEntries:()=>olympe.dc.sources.Qd().O,clearCache:a=>Oj(olympe.dc.sources.Qd(),a),getProcessingStatus:()=>
|
|
1088
|
+
olympe.dc.sources.Qd().yc(),getProcessingErrors:()=>olympe.dc.sources.Qd().hc.asObservable(),hasPendingChanges:()=>olympe.dc.sources.Qd().fa.asObservable(),synchroniseChanges:()=>Uj(),getPendingChanges:()=>Xj(),clearPendingChanges:()=>bk(),loadPendingChanges:a=>Zj(a)},Color:olympe.D.Color,ErrorFlow:olympe.sc.logic.Error,ServiceRequestType:olympe.N.Request.pb,ServiceRequest:olympe.N.Mc,Service:olympe.N.wb,Auth:olympe.public.Ia,AuthState:{INIT:olympe.auth.Ta.C.INIT,AUTHENTICATING:olympe.auth.Ta.C.Xi,
|
|
1089
|
+
GUEST:olympe.auth.Ta.C.Yh,AUTHENTICATED:olympe.auth.Ta.C.Cf,ERROR:olympe.auth.Ta.C.Eb},AuthProtocol:olympe.auth.wc.C,Sync:olympe.dc.CloudObject,BusinessObject:olympe.dc.CloudObject,StringPrimitive:olympe.dm.String,NumberPrimitive:olympe.dm.Number,BooleanPrimitive:olympe.dm.Boolean,DatetimePrimitive:olympe.dm.DateTime,ColorPrimitive:olympe.dm.Color,PropertyPrimitive:olympe.dm.Property,RelationPrimitive:olympe.dm.Relation,DBView:class extends olympe.dc.ib{static get(){return olympe.dc.ia()}},ListDef:olympe.dc.ya,
|
|
1090
|
+
instanceToTag:olympe.dc.ga,registerSync:olympe.dc.na.C,getUniqueTag:olympe.Y.tf,onDestroy:a=>olympe.D.Xa().onDestroy(a),offDestroy:a=>olympe.D.Xa().zf(a),FollowRules:olympe.dc.ec,transformers:{Related:olympe.dc.da.Le,RecursiveRelated:olympe.dc.da.se,Distinct:olympe.dc.da.Th,Filter:olympe.dc.da.cf,Limit:olympe.dc.da.dh,Sort:olympe.dc.da.vg,Union:olympe.dc.da.nf},ListDefPredicate:olympe.public.Aa,predicates:{And:olympe.dc.$.Ad,Or:olympe.dc.$.re,Not:olympe.dc.$.Zd,Equals:olympe.dc.$.pe,Contains:olympe.dc.$.af,
|
|
1091
|
+
Greater:olympe.dc.$.nj,Smaller:olympe.dc.$.Rj,HasRelated:olympe.dc.$.$h,InstanceOf:olympe.dc.$.ci,Regex:olympe.dc.$.kf},Comparator:olympe.public.$e,comparators:{Number:olympe.dc.rc.Number,String:olympe.dc.rc.String,DateTime:olympe.dc.rc.DateTime},valuedefs:{BooleanProperty:olympe.dc.$a.$i,StringProperty:olympe.dc.$a.ri,NumberProperty:olympe.dc.$a.ji,DateTimeProperty:olympe.dc.$a.Sh,Constant:olympe.dc.$a.De,Tag:olympe.dc.$a.ti}});
|
|
1091
1092
|
|
|
1092
1093
|
|
|
1093
1094
|
}.bind(this))();
|