@yuneta/gobj-js 7.16.5 → 7.21.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/dist/gobj-js.cjs.js +73 -14
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +535 -518
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +73 -15
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +291 -273
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +73 -14
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +658 -641
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +73 -14
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +765 -748
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.umd.min.js
CHANGED
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
};
|
|
22
22
|
function n(e) {
|
|
23
23
|
return function(e, r) {
|
|
24
|
-
var o,
|
|
25
|
-
for (
|
|
26
|
-
else if ("object" == typeof e[
|
|
27
|
-
if ((s = e[
|
|
28
|
-
if (null == o) throw new Error(n("[sprintf] Cannot access property \"%s\" of undefined value \"%s\"", s.keys[
|
|
29
|
-
o = o[s.keys[
|
|
24
|
+
var o, i, l, s, _, a, u, c, f, g = 1, d = e.length, b = "";
|
|
25
|
+
for (i = 0; i < d; i++) if ("string" == typeof e[i]) b += e[i];
|
|
26
|
+
else if ("object" == typeof e[i]) {
|
|
27
|
+
if ((s = e[i]).keys) for (o = r[g], l = 0; l < s.keys.length; l++) {
|
|
28
|
+
if (null == o) throw new Error(n("[sprintf] Cannot access property \"%s\" of undefined value \"%s\"", s.keys[l], s.keys[l - 1]));
|
|
29
|
+
o = o[s.keys[l]];
|
|
30
30
|
}
|
|
31
31
|
else o = s.param_no ? r[s.param_no] : r[g++];
|
|
32
32
|
if (t.not_type.test(s.type) && t.not_primitive.test(s.type) && o instanceof Function && (o = o()), t.numeric_arg.test(s.type) && "number" != typeof o && isNaN(o)) throw new TypeError(n("[sprintf] expecting number but found %T", o));
|
|
@@ -81,14 +81,14 @@
|
|
|
81
81
|
return b;
|
|
82
82
|
}(function(e) {
|
|
83
83
|
if (r[e]) return r[e];
|
|
84
|
-
let n, o = e,
|
|
84
|
+
let n, o = e, i = [], l = 0;
|
|
85
85
|
for (; o;) {
|
|
86
|
-
if (null !== (n = t.text.exec(o)))
|
|
87
|
-
else if (null !== (n = t.modulo.exec(o)))
|
|
86
|
+
if (null !== (n = t.text.exec(o))) i.push(n[0]);
|
|
87
|
+
else if (null !== (n = t.modulo.exec(o))) i.push("%");
|
|
88
88
|
else {
|
|
89
89
|
if (null === (n = t.placeholder.exec(o))) throw new SyntaxError("[sprintf] unexpected placeholder");
|
|
90
90
|
if (n[2]) {
|
|
91
|
-
|
|
91
|
+
l |= 1;
|
|
92
92
|
var s = [], _ = n[2], a = [];
|
|
93
93
|
if (null === (a = t.key.exec(_))) throw new SyntaxError("[sprintf] failed to parse named argument key");
|
|
94
94
|
for (s.push(a[1]); "" !== (_ = _.substring(a[0].length));) if (null !== (a = t.key_access.exec(_))) s.push(a[1]);
|
|
@@ -97,9 +97,9 @@
|
|
|
97
97
|
s.push(a[1]);
|
|
98
98
|
}
|
|
99
99
|
n[2] = s;
|
|
100
|
-
} else
|
|
101
|
-
if (3 ===
|
|
102
|
-
|
|
100
|
+
} else l |= 2;
|
|
101
|
+
if (3 === l) throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");
|
|
102
|
+
i.push({
|
|
103
103
|
placeholder: n[0],
|
|
104
104
|
param_no: n[1],
|
|
105
105
|
keys: n[2],
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
o = o.substring(n[0].length);
|
|
115
115
|
}
|
|
116
|
-
return r[e] =
|
|
116
|
+
return r[e] = i;
|
|
117
117
|
}(e), arguments);
|
|
118
118
|
}
|
|
119
119
|
var r = Object.create(null);
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
data: o || []
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function i(e, t, n, r, o) {
|
|
129
129
|
return {
|
|
130
130
|
result: t,
|
|
131
131
|
comment: n || {},
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
data: o || []
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
var
|
|
136
|
+
var l = "7.0.0a", s = null, _ = null, a = null, u = null, c = null, f = null, g = [], d = Object.create(null), b = {}, p = null, m = null, E = 0, h = Object.freeze({
|
|
137
137
|
DTP_STRING: 1,
|
|
138
138
|
DTP_BOOLEAN: 2,
|
|
139
139
|
DTP_INTEGER: 3,
|
|
@@ -143,8 +143,8 @@
|
|
|
143
143
|
DTP_JSON: 7,
|
|
144
144
|
DTP_POINTER: 8
|
|
145
145
|
});
|
|
146
|
-
|
|
147
|
-
var
|
|
146
|
+
h.DTP_POINTER;
|
|
147
|
+
var T = Object.freeze({
|
|
148
148
|
SDF_NOTACCESS: 1,
|
|
149
149
|
SDF_RD: 2,
|
|
150
150
|
SDF_WR: 4,
|
|
@@ -167,16 +167,16 @@
|
|
|
167
167
|
SDF_AUTHZ_S: 524288,
|
|
168
168
|
SDF_AUTHZ_RS: 1048576
|
|
169
169
|
});
|
|
170
|
-
|
|
170
|
+
T.SDF_RD, T.SDF_WR, T.SDF_STATS, T.SDF_PERSIST, T.SDF_VOLATIL, T.SDF_RSTATS, T.SDF_PSTATS, T.SDF_WR, T.SDF_PERSIST;
|
|
171
171
|
var y = class {
|
|
172
|
-
constructor(e, t, n = 0, r = null, o = "",
|
|
173
|
-
this.type = e, this.name = t, this.alias =
|
|
172
|
+
constructor(e, t, n = 0, r = null, o = "", i = null, l = null, s = 0, _ = null, a = null, u = null) {
|
|
173
|
+
this.type = e, this.name = t, this.alias = i, this.flag = n, this.default_value = r, this.header = l, this.fillspace = s, this.description = o, this.json_fn = _, this.schema = a, this.authpth = u;
|
|
174
174
|
}
|
|
175
|
-
}, j = () => new y(0, null), v = (e, t, n, r, o) => new y(e, t, n, r, o),
|
|
176
|
-
constructor(e, t, n, r, o,
|
|
177
|
-
this.gclass_name = e, this.dl_states = [], this.dl_events = [], this.gmt = t, this.lmt = n, this.attrs_table = r, this.priv = o, this.authz_table =
|
|
175
|
+
}, j = () => new y(0, null), v = (e, t, n, r, o) => new y(e, t, n, r, o), O = class {
|
|
176
|
+
constructor(e, t, n, r, o, i, l, s, _) {
|
|
177
|
+
this.gclass_name = e, this.dl_states = [], this.dl_events = [], this.gmt = t, this.lmt = n, this.attrs_table = r, this.priv = o, this.authz_table = i, this.command_table = l, this.s_user_trace_level = s, this.gclass_flag = Number(_) || 0, this.instances = 0, this.trace_level = 0, this.no_trace_level = 0, this.jn_trace_filter = null, this.fsm_checked = !1;
|
|
178
178
|
}
|
|
179
|
-
},
|
|
179
|
+
}, S = class {
|
|
180
180
|
constructor(e, t, n, r, o) {
|
|
181
181
|
this.__refs__ = 0, this.gclass = t, this.parent = null, this.dl_children = [], this.dl_subscriptions = [], this.dl_subscribings = [], this.current_state = t.dl_states[0], this.last_state = null, this.obflag = 0, this.gobj_flag = Number(o) || 0, this.gobj_name = e, this.jn_attrs = null, this.jn_stats = {}, this.jn_user_data = {}, this.full_name = null, this.short_name = null, this.priv = en(t.priv), this.running = !1, this.playing = !1, this.disabled = !1, this.bottom_gobj = null, this.trace_level = 0, this.no_trace_level = 0;
|
|
182
182
|
}
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
]
|
|
321
321
|
], F = 0, G = 0, V = 0;
|
|
322
322
|
function M(e, t) {
|
|
323
|
-
if (
|
|
323
|
+
if (On(e)) return 268369920;
|
|
324
324
|
if (/^[0-9]+$/.test(String(e))) {
|
|
325
325
|
const t = Number(e);
|
|
326
326
|
if (t) return t;
|
|
@@ -328,7 +328,7 @@
|
|
|
328
328
|
return function(e) {
|
|
329
329
|
for (const [t, n] of U) if (t === e) return n;
|
|
330
330
|
return 0;
|
|
331
|
-
}(String(e)) || (
|
|
331
|
+
}(String(e)) || (qt(`${t}: trace level NOT FOUND: ${e}`), 0);
|
|
332
332
|
}
|
|
333
333
|
function W(e) {
|
|
334
334
|
if (V) return 4294967295;
|
|
@@ -343,10 +343,10 @@
|
|
|
343
343
|
if (!p || !p.jn_attrs) return 0;
|
|
344
344
|
let e = 0;
|
|
345
345
|
if (ot(p, "tracing")) {
|
|
346
|
-
const t = Number(
|
|
346
|
+
const t = Number(it(p, "tracing")) || 0;
|
|
347
347
|
t >= 1 && (e |= P.TRACE_MACHINE), t >= 2 && (e |= P.TRACE_EV_KW);
|
|
348
348
|
}
|
|
349
|
-
return ot(p, "trace_timer") &&
|
|
349
|
+
return ot(p, "trace_timer") && it(p, "trace_timer") && (e |= P.TRACE_TIMER), ot(p, "trace_creation") && it(p, "trace_creation") && (e |= P.TRACE_CREATE_DELETE), ot(p, "trace_start_stop") && it(p, "trace_start_stop") && (e |= P.TRACE_START_STOP), e;
|
|
350
350
|
}
|
|
351
351
|
function Y(e) {
|
|
352
352
|
return (W(e) | x()) & P.TRACE_CREATE_DELETE;
|
|
@@ -360,15 +360,15 @@
|
|
|
360
360
|
const n = W(e) | x();
|
|
361
361
|
return !!(n & P.TRACE_MACHINE || n & P.TRACE_TIMER_PERIODIC && "EV_TIMEOUT_PERIODIC" === t || n & P.TRACE_TIMER && "EV_TIMEOUT" === t);
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function H(e, t) {
|
|
364
364
|
if (V > 1) return !1;
|
|
365
365
|
if (!e) return !0;
|
|
366
366
|
const n = K(e);
|
|
367
367
|
return !!(n & P.TRACE_MACHINE || n & P.TRACE_TIMER_PERIODIC && "EV_TIMEOUT_PERIODIC" === t || n & P.TRACE_TIMER && "EV_TIMEOUT" === t);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function q(e, t) {
|
|
370
370
|
let n = {};
|
|
371
|
-
if (!mn(t)) return
|
|
371
|
+
if (!mn(t)) return qt("sdata_desc MUST be an array"), Zt(t), n;
|
|
372
372
|
for (let r = 0; r < t.length; r++) {
|
|
373
373
|
const o = t[r];
|
|
374
374
|
o.name && z(e, n, o);
|
|
@@ -378,52 +378,52 @@
|
|
|
378
378
|
function z(e, t, n) {
|
|
379
379
|
let r, o = n.default_value;
|
|
380
380
|
switch (n.type) {
|
|
381
|
-
case
|
|
381
|
+
case h.DTP_STRING:
|
|
382
382
|
r = String(o);
|
|
383
383
|
break;
|
|
384
|
-
case
|
|
385
|
-
r =
|
|
384
|
+
case h.DTP_BOOLEAN:
|
|
385
|
+
r = Sn(o);
|
|
386
386
|
break;
|
|
387
|
-
case
|
|
388
|
-
r = parseInt(o), isNaN(r) &&
|
|
387
|
+
case h.DTP_INTEGER:
|
|
388
|
+
r = parseInt(o), isNaN(r) && qt(`${Ve(e)}: attr NaN: ${n.name}`);
|
|
389
389
|
break;
|
|
390
|
-
case
|
|
391
|
-
r = Number(o), isNaN(r) &&
|
|
390
|
+
case h.DTP_REAL:
|
|
391
|
+
r = Number(o), isNaN(r) && qt(`${Ve(e)}: attr NaN: ${n.name}`);
|
|
392
392
|
break;
|
|
393
|
-
case
|
|
393
|
+
case h.DTP_LIST:
|
|
394
394
|
if (En(o)) try {
|
|
395
395
|
r = JSON.parse(o);
|
|
396
396
|
} catch (e) {
|
|
397
|
-
|
|
397
|
+
qt(`JSON parse error: ${e.message}`);
|
|
398
398
|
}
|
|
399
399
|
else r = o;
|
|
400
400
|
mn(r) || (r = []);
|
|
401
401
|
break;
|
|
402
|
-
case
|
|
402
|
+
case h.DTP_DICT:
|
|
403
403
|
if (En(o)) try {
|
|
404
404
|
r = JSON.parse(o);
|
|
405
405
|
} catch (e) {
|
|
406
|
-
|
|
406
|
+
qt(`JSON parse error: ${e.message}`);
|
|
407
407
|
}
|
|
408
408
|
else r = o;
|
|
409
409
|
pn(r) || (r = {});
|
|
410
410
|
break;
|
|
411
|
-
case
|
|
411
|
+
case h.DTP_JSON:
|
|
412
412
|
if (En(o)) try {
|
|
413
413
|
r = JSON.parse(o);
|
|
414
414
|
} catch (e) {
|
|
415
|
-
|
|
415
|
+
qt(`JSON parse error: ${e.message}`);
|
|
416
416
|
}
|
|
417
417
|
else r = o;
|
|
418
418
|
break;
|
|
419
|
-
case
|
|
419
|
+
case h.DTP_POINTER: r = o;
|
|
420
420
|
}
|
|
421
|
-
return void 0 === r && (
|
|
421
|
+
return void 0 === r && (qt(`default_value WRONG, it: ${n.name}, value: ${n.default_value}`), r = null), t[n.name] = r, 0;
|
|
422
422
|
}
|
|
423
423
|
function Q(e, t, n, r) {
|
|
424
424
|
let o;
|
|
425
425
|
switch (n.type) {
|
|
426
|
-
case
|
|
426
|
+
case h.DTP_STRING:
|
|
427
427
|
if (null == r) o = "";
|
|
428
428
|
else if (En(r)) o = String(r);
|
|
429
429
|
else {
|
|
@@ -431,84 +431,84 @@
|
|
|
431
431
|
e && (o = String(e));
|
|
432
432
|
}
|
|
433
433
|
break;
|
|
434
|
-
case
|
|
435
|
-
o =
|
|
434
|
+
case h.DTP_BOOLEAN:
|
|
435
|
+
o = Sn(r);
|
|
436
436
|
break;
|
|
437
|
-
case
|
|
438
|
-
o = parseInt(r), isNaN(o) &&
|
|
437
|
+
case h.DTP_INTEGER:
|
|
438
|
+
o = parseInt(r), isNaN(o) && qt(`${Ve(e)}: attr NaN: ${n.name}`);
|
|
439
439
|
break;
|
|
440
|
-
case
|
|
441
|
-
o = Number(r), isNaN(o) &&
|
|
440
|
+
case h.DTP_REAL:
|
|
441
|
+
o = Number(r), isNaN(o) && qt(`${Ve(e)}: attr NaN: ${n.name}`);
|
|
442
442
|
break;
|
|
443
|
-
case
|
|
443
|
+
case h.DTP_LIST:
|
|
444
444
|
if (En(r)) try {
|
|
445
445
|
o = JSON.parse(r);
|
|
446
446
|
} catch (e) {
|
|
447
|
-
|
|
447
|
+
qt(`JSON parse error: ${e.message}`);
|
|
448
448
|
}
|
|
449
449
|
else o = r;
|
|
450
|
-
if (!mn(o)) return
|
|
450
|
+
if (!mn(o)) return qt(`attr must be an array: ${n.name}`), -1;
|
|
451
451
|
break;
|
|
452
|
-
case
|
|
452
|
+
case h.DTP_DICT:
|
|
453
453
|
if (En(r)) try {
|
|
454
454
|
o = JSON.parse(r);
|
|
455
455
|
} catch (e) {
|
|
456
|
-
|
|
456
|
+
qt(`JSON parse error: ${e.message}`);
|
|
457
457
|
}
|
|
458
458
|
else o = r;
|
|
459
|
-
if (!pn(o)) return
|
|
459
|
+
if (!pn(o)) return qt(`attr must be an object: ${n.name}`), -1;
|
|
460
460
|
break;
|
|
461
|
-
case
|
|
461
|
+
case h.DTP_JSON:
|
|
462
462
|
if (En(r)) try {
|
|
463
463
|
o = JSON.parse(r);
|
|
464
464
|
} catch (e) {
|
|
465
|
-
|
|
465
|
+
qt(`JSON parse error: ${e.message}`);
|
|
466
466
|
}
|
|
467
467
|
else o = r;
|
|
468
|
-
if (!mn(o) && !pn(o)) return
|
|
468
|
+
if (!mn(o) && !pn(o)) return qt(`attr must be a json dict/list: ${n.name}`), -1;
|
|
469
469
|
break;
|
|
470
|
-
case
|
|
470
|
+
case h.DTP_POINTER: o = r;
|
|
471
471
|
}
|
|
472
|
-
return void 0 === o &&
|
|
472
|
+
return void 0 === o && qt(`${Ve(e)}: attr undefined: ${n.name}`), t[n.name] = o, pn(e.priv) && e.priv.hasOwnProperty(n.name) && (e.priv[n.name] = o), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, n.name), 0;
|
|
473
473
|
}
|
|
474
474
|
function X(e) {
|
|
475
475
|
return e.jn_attrs;
|
|
476
476
|
}
|
|
477
477
|
function Z(e, t, n) {
|
|
478
|
-
return ot(e, t) ? X(e) : e && e.bottom_gobj ? Z(e.bottom_gobj, t, n) : (n &&
|
|
478
|
+
return ot(e, t) ? X(e) : e && e.bottom_gobj ? Z(e.bottom_gobj, t, n) : (n && qt(`GClass Attribute NOT FOUND: ${Ve(e)}, attr ${t}`), null);
|
|
479
479
|
}
|
|
480
480
|
function ee(e, t, n) {
|
|
481
|
-
if (!(e && e instanceof
|
|
481
|
+
if (!(e && e instanceof O)) return n && qt("gclass NULL"), null;
|
|
482
482
|
if (!t) return e.attrs_table;
|
|
483
483
|
for (let n = 0; n < e.attrs_table.length; n++) {
|
|
484
484
|
const r = e.attrs_table[n];
|
|
485
485
|
if (r.name && r.name === t) return r;
|
|
486
486
|
}
|
|
487
|
-
return n &&
|
|
487
|
+
return n && qt(`${e.gclass_name}: GClass Attribute NOT FOUND: ${t}`), null;
|
|
488
488
|
}
|
|
489
|
-
function te(e, t, n, r, o,
|
|
490
|
-
if (
|
|
491
|
-
if (e.includes("`") || e.includes("^") || e.includes(".")) return
|
|
492
|
-
if (ce(e)) return
|
|
493
|
-
let c = new
|
|
489
|
+
function te(e, t, n, r, o, i, l, s, _, a, u) {
|
|
490
|
+
if (On(e)) return qt("gclass_name EMPTY"), null;
|
|
491
|
+
if (e.includes("`") || e.includes("^") || e.includes(".")) return qt(`GClass name CANNOT have '.' or '^' or '\`' char: ${e}`), null;
|
|
492
|
+
if (ce(e)) return qt(`GClass ALREADY exists: ${e}`), null;
|
|
493
|
+
let c = new O(e, r, o, i, l, s, _, a, u);
|
|
494
494
|
(function(e, t) {
|
|
495
|
-
e && e instanceof
|
|
495
|
+
e && e instanceof O ? t ? d[t] ? qt(`gclass ALREADY REGISTERED: ${t}`) : d[t] = e : qt("gclass_name undefined") : qt("gclass undefined");
|
|
496
496
|
})(c, e);
|
|
497
497
|
const f = n.length;
|
|
498
498
|
for (let e = 0; e < f; e++) {
|
|
499
499
|
let t = n[e][0], r = n[e][1];
|
|
500
|
-
if (
|
|
501
|
-
if (
|
|
500
|
+
if (On(t)) continue;
|
|
501
|
+
if (ie(c, t) < 0) return ne(c), null;
|
|
502
502
|
const o = r.length;
|
|
503
503
|
for (let e = 0; e < o; e++) {
|
|
504
|
-
let n = r[e][0], o = r[e][1],
|
|
505
|
-
|
|
504
|
+
let n = r[e][0], o = r[e][1], i = r[e][2];
|
|
505
|
+
On(n) || le(c, t, n, o, i);
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
for (let e = 0; e < t.length; e++) {
|
|
509
509
|
let n = t[e][0], r = t[e][1];
|
|
510
|
-
if (!
|
|
511
|
-
if (ae(c, n)) return
|
|
510
|
+
if (!On(n)) {
|
|
511
|
+
if (ae(c, n)) return qt(`SMachine: event repeated in input_events: ${n}`), ne(c), null;
|
|
512
512
|
_e(c, n, r);
|
|
513
513
|
}
|
|
514
514
|
}
|
|
@@ -522,11 +522,11 @@
|
|
|
522
522
|
let t;
|
|
523
523
|
if (En(e)) t = e;
|
|
524
524
|
else {
|
|
525
|
-
if (!(e instanceof
|
|
525
|
+
if (!(e instanceof O)) return qt("Cannot unregister gclass, type unknown"), -1;
|
|
526
526
|
t = e.gclass_name;
|
|
527
527
|
}
|
|
528
528
|
let n = d[t];
|
|
529
|
-
return n ? n.instances > 0 ? (
|
|
529
|
+
return n ? n.instances > 0 ? (qt(`Cannot unregister gclass, instances in use: ${t}`), -1) : (delete d[t], 0) : (qt(`Cannot unregister gclass, not found: ${t}`), -1);
|
|
530
530
|
}
|
|
531
531
|
function re(e, t) {
|
|
532
532
|
const n = e.dl_states.length, r = e.dl_states;
|
|
@@ -544,23 +544,23 @@
|
|
|
544
544
|
}
|
|
545
545
|
return null;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
548
|
-
return e instanceof
|
|
547
|
+
function ie(e, t) {
|
|
548
|
+
return e instanceof O ? re(e, t) ? (qt(`state already exists: ${t}`), -1) : (e.dl_states.push(new I(t)), 0) : (qt("Cannot add state, typeof not GClass"), -1);
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
if (!(e instanceof
|
|
552
|
-
if (
|
|
553
|
-
let
|
|
554
|
-
return
|
|
550
|
+
function le(e, t, n, r, o) {
|
|
551
|
+
if (!(e instanceof O)) return qt("Cannot add state, typeof not GClass"), -1;
|
|
552
|
+
if (On(t)) return qt("state_name EMPTY"), -1;
|
|
553
|
+
let i = re(e, t);
|
|
554
|
+
return i ? oe(i, n) ? (qt(`event already exists: gclass ${e.gclass_name}, state ${t}, event ${n}`), -1) : (i.dl_actions.push(new k(n, r, o)), 0) : (qt(`state not found: ${t}`), -1);
|
|
555
555
|
}
|
|
556
556
|
function se(e, t, n) {
|
|
557
|
-
|
|
557
|
+
On(t) || e.push(new $(t, n));
|
|
558
558
|
}
|
|
559
559
|
function _e(e, t, n) {
|
|
560
|
-
return e instanceof
|
|
560
|
+
return e instanceof O ? se(e.dl_events, t, n) : (qt("Cannot add state, typeof not GClass"), -1);
|
|
561
561
|
}
|
|
562
562
|
function ae(e, t) {
|
|
563
|
-
if (!(e instanceof
|
|
563
|
+
if (!(e instanceof O)) return qt("Cannot add state, typeof not GClass"), 0;
|
|
564
564
|
const n = e.dl_events.length, r = e.dl_events;
|
|
565
565
|
for (let e = 0; e < n; e++) {
|
|
566
566
|
let n = r[e];
|
|
@@ -569,25 +569,25 @@
|
|
|
569
569
|
return null;
|
|
570
570
|
}
|
|
571
571
|
function ue(e) {
|
|
572
|
-
if (!(e instanceof
|
|
572
|
+
if (!(e instanceof O)) return qt("Cannot add state, typeof not GClass"), -1;
|
|
573
573
|
let t = 0;
|
|
574
|
-
dn(e.dl_states) || (
|
|
574
|
+
dn(e.dl_states) || (qt(`GClass without states: ${e.gclass_name}`), t += -1);
|
|
575
575
|
for (let n = 0; n < e.dl_states.length; n++) {
|
|
576
576
|
let r = e.dl_states[n];
|
|
577
|
-
if (!
|
|
577
|
+
if (!On(r.state_name)) for (let n = 0; n < r.dl_actions.length; n++) {
|
|
578
578
|
let o = r.dl_actions[n];
|
|
579
|
-
|
|
579
|
+
On(o.event_name) || (ae(e, o.event_name) || (qt(`SMachine: state's event NOT in input_events: gclass ${e.gclass_name}, state ${r.state_name}, event ${o.event_name}`), t += -1), o.next_state && (re(e, o.next_state) || (qt(`SMachine: next state NOT in state names: gclass ${e.gclass_name}, state ${r.state_name}, next_state ${o.next_state}`), t += -1)));
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
for (let n = 0; n < e.dl_events.length; n++) {
|
|
583
583
|
let r = e.dl_events[n];
|
|
584
|
-
if (!
|
|
584
|
+
if (!On(r.event_name) && (hn(r.event_flag) || (qt(`SMachine: event flag is NOT number: gclass ${e.gclass_name}, event ${r.event_name}`), t += -1), !(r.event_flag & D.EVF_OUTPUT_EVENT))) {
|
|
585
585
|
let n = !1;
|
|
586
586
|
for (let t = 0; t < e.dl_states.length; t++) {
|
|
587
587
|
let o = e.dl_states[t];
|
|
588
|
-
|
|
588
|
+
On(o.state_name) || oe(o, r.event_name) && (n = !0);
|
|
589
589
|
}
|
|
590
|
-
n || (
|
|
590
|
+
n || (qt(`SMachine: input_list's event NOT in state: gclass ${e.gclass_name}, event ${r.event_name}`), t += -1);
|
|
591
591
|
}
|
|
592
592
|
}
|
|
593
593
|
return t;
|
|
@@ -597,85 +597,85 @@
|
|
|
597
597
|
try {
|
|
598
598
|
n = d[e];
|
|
599
599
|
} catch (e) {}
|
|
600
|
-
return n || (t &&
|
|
600
|
+
return n || (t && qt(`gclass not found: ${e}`), null);
|
|
601
601
|
}
|
|
602
602
|
function fe() {
|
|
603
603
|
return !m || m.obflag & R.obflag_destroyed ? null : m;
|
|
604
604
|
}
|
|
605
605
|
function ge(e, t) {
|
|
606
606
|
e = e.toLowerCase();
|
|
607
|
-
return b[e] || (t &&
|
|
607
|
+
return b[e] || (t && qt(`gobj service not found: ${e}`), null);
|
|
608
608
|
}
|
|
609
609
|
function de(e) {
|
|
610
610
|
let t = Fe(e);
|
|
611
|
-
return t = t.toLowerCase(), b[t] &&
|
|
611
|
+
return t = t.toLowerCase(), b[t] && qt(`service ALREADY REGISTERED: ${t}. Will be UPDATED`), b[t] = e, 0;
|
|
612
612
|
}
|
|
613
613
|
function be(e, t) {
|
|
614
|
-
t.parent &&
|
|
614
|
+
t.parent && qt(`_add_child() ALREADY HAS PARENT: ${t.gobj_name}`), e.dl_children.push(t), t.parent = e;
|
|
615
615
|
}
|
|
616
616
|
function pe(e, t) {
|
|
617
617
|
let n = ur(e.dl_children, t);
|
|
618
618
|
n >= 0 && (fn(e.dl_children, n), t.parent = null);
|
|
619
619
|
}
|
|
620
620
|
function me(e, t) {
|
|
621
|
-
"__json_config_variables__" !== t &&
|
|
621
|
+
"__json_config_variables__" !== t && qt(`GClass Attribute NOT FOUND: ${Ve(e)}, attr ${t}`);
|
|
622
622
|
}
|
|
623
623
|
function Ee(e, t, n) {
|
|
624
624
|
let r = t;
|
|
625
625
|
(function(e, t, n, r, o) {
|
|
626
|
-
if (!e || !t) return
|
|
627
|
-
let
|
|
628
|
-
for (const [
|
|
629
|
-
const t = ee(o.gclass,
|
|
630
|
-
t ? (-1 === n || t.flag & n) && (t.flag &
|
|
626
|
+
if (!e || !t) return qt("hsdata or kw NULL"), -1;
|
|
627
|
+
let i = 0;
|
|
628
|
+
for (const [l, s] of Object.entries(t)) {
|
|
629
|
+
const t = ee(o.gclass, l, !1);
|
|
630
|
+
t ? (-1 === n || t.flag & n) && (t.flag & T.SDF_DEPRECATED && zt(`${Ve(o)}: Deprecated attribute used in gobj creation: ${l}`), i += Q(o, e, t, s)) : r && (r(o, l), i--);
|
|
631
631
|
}
|
|
632
|
-
return
|
|
633
|
-
})(X(e), r, -1, e.gclass.gclass_flag & N.gcflag_ignore_unknown_attrs ? 0 : me, e) < 0 && (
|
|
632
|
+
return i;
|
|
633
|
+
})(X(e), r, -1, e.gclass.gclass_flag & N.gcflag_ignore_unknown_attrs ? 0 : me, e) < 0 && (qt(`${Ve(e)} json2data() FAILED`), Zt(r));
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
if (
|
|
637
|
-
if (p) return
|
|
638
|
-
|
|
635
|
+
function he(e, t, r, o, i) {
|
|
636
|
+
if (i & w.gobj_flag_yuno) {
|
|
637
|
+
if (p) return qt("__yuno__ already created"), null;
|
|
638
|
+
i |= w.gobj_flag_service;
|
|
639
639
|
} else {
|
|
640
|
-
if (!o) return
|
|
641
|
-
if (!("string" == typeof o || o instanceof
|
|
640
|
+
if (!o) return qt("gobj NEEDS a parent!"), null;
|
|
641
|
+
if (!("string" == typeof o || o instanceof S)) return qt(`BAD TYPE of parent: ${o}`), null;
|
|
642
642
|
if (En(o) && !(o = ge(o))) return zt(`parent service not found: ${o}`), null;
|
|
643
643
|
}
|
|
644
|
-
if (
|
|
645
|
-
if (
|
|
646
|
-
if (m) return
|
|
647
|
-
|
|
648
|
-
}
|
|
649
|
-
if (
|
|
650
|
-
let
|
|
651
|
-
if (!
|
|
652
|
-
if (!En(e)) return
|
|
653
|
-
if (!
|
|
654
|
-
if (e.includes("`")) return
|
|
655
|
-
if (e.includes("^")) return
|
|
656
|
-
}
|
|
657
|
-
let _ = new
|
|
658
|
-
_.jn_attrs =
|
|
644
|
+
if (i & w.gobj_flag_service && ge(e, !1)) return qt(`service ALREADY registered: ${t}^${e}`), null;
|
|
645
|
+
if (i & w.gobj_flag_default_service) {
|
|
646
|
+
if (m) return qt(`default service ALREADY registered: ${t}^${e}`), null;
|
|
647
|
+
i |= w.gobj_flag_service;
|
|
648
|
+
}
|
|
649
|
+
if (On(t)) return qt("gclass_name must be a string"), null;
|
|
650
|
+
let l = ce(t, !1);
|
|
651
|
+
if (!l) return qt(`GClass not registered: ${t}^${e}`), null;
|
|
652
|
+
if (!En(e)) return qt(`gobj_name must be a string: ${t}`), null;
|
|
653
|
+
if (!On(e)) {
|
|
654
|
+
if (e.includes("`")) return qt(`gobj_name cannot contain char ': ${t}^${e}`), null;
|
|
655
|
+
if (e.includes("^")) return qt(`gobj_name cannot contain char ^: ${t}^${e}`), null;
|
|
656
|
+
}
|
|
657
|
+
let _ = new S(e, l, r, o, i);
|
|
658
|
+
_.jn_attrs = q(_, l.attrs_table);
|
|
659
659
|
for (const [e, t] of Object.entries(_.jn_attrs)) e in _.priv && (_.priv[e] = t);
|
|
660
660
|
let a = Y(_);
|
|
661
|
-
return a && L(n("💙💙⏩ creating: %s^%s",
|
|
661
|
+
return a && L(n("💙💙⏩ creating: %s^%s", l.gclass_name, e)), _.gobj_flag & w.gobj_flag_service && de(_), _.gobj_flag & w.gobj_flag_yuno && (p = _), _.gobj_flag & w.gobj_flag_default_service && (m = _), _.gobj_flag & w.gobj_flag_yuno || be(o, _), _.obflag |= R.obflag_created, _.gclass.instances++, Ee(_, r), _.gobj_flag & w.gobj_flag_service && s && s(_, null), _.gclass.gmt.mt_create2 ? _.gclass.gmt.mt_create2(_, r) : _.gclass.gmt.mt_create && _.gclass.gmt.mt_create(_), o && o.gclass.gmt.mt_child_added && (a && L(n("👦👦🔵 child_added(%s): %s", Me(o), Ve(_))), o.gclass.gmt.mt_child_added(o, _)), a && L(n("💙💙⏪ created: %s", Me(_))), _;
|
|
662
662
|
}
|
|
663
|
-
function
|
|
664
|
-
return
|
|
663
|
+
function Te(e, t, n, r) {
|
|
664
|
+
return he(e, t, n, r, w.gobj_flag_pure_child);
|
|
665
665
|
}
|
|
666
666
|
function ye(e) {
|
|
667
|
-
if (Ye(e)) return void
|
|
668
|
-
e.__refs__ > 0 &&
|
|
669
|
-
if (0 ===
|
|
670
|
-
for (let t of
|
|
671
|
-
|
|
667
|
+
if (Ye(e)) return void qt("gobj NULL or DESTROYED");
|
|
668
|
+
e.__refs__ > 0 && qt(`${Ve(e)}: gobj DESTROYING with references: ${e.__refs__}`), e.playing && (qt(`Destroying a PLAYING gobj: ${Me(e)}`), De(e)), e.running && (qt(`Destroying a RUNNING gobj: ${Me(e)}`), Se(e)), e.obflag |= R.obflag_destroying, function(e) {
|
|
669
|
+
if (0 === Tt.length) return;
|
|
670
|
+
for (let t of Tt) t.src === e && (t.src = null);
|
|
671
|
+
Tt = Tt.filter((t) => t.dst !== e);
|
|
672
672
|
}(e);
|
|
673
673
|
let t = Y(e);
|
|
674
674
|
t && L(n("💔💔⏩ destroying: %s", Me(e)));
|
|
675
675
|
let r = We(e);
|
|
676
676
|
r && r.gclass.gmt.mt_child_removed && (t && L(n("👦👦🔴 child_removed(%s): %s", Me(r), Ve(e))), r.gclass.gmt.mt_child_removed(r, e)), e.gobj_flag & w.gobj_flag_service && function(e) {
|
|
677
677
|
let t = Fe(e);
|
|
678
|
-
t = t.toLowerCase(), b[t] ? delete b[t] :
|
|
678
|
+
t = t.toLowerCase(), b[t] ? delete b[t] : qt(`"service NOT found in register": ${t}`);
|
|
679
679
|
}(e), kt(e, e.dl_subscriptions, !0), kt(e, e.dl_subscribings, !0), r && (pe(r, e), Ke(e) && (Be(r) !== e || Ye(r) || Je(r, null))), function(e) {
|
|
680
680
|
let t = e.dl_children.slice();
|
|
681
681
|
for (let e = 0; e < t.length; e++) {
|
|
@@ -685,9 +685,9 @@
|
|
|
685
685
|
}(e), e.obflag & R.obflag_created && e.gclass.gmt.mt_destroy && e.gclass.gmt.mt_destroy(e), t && L(n("💔💔⏪ destroyed: %s", Me(e))), e.obflag |= R.obflag_destroyed, e.obflag & R.obflag_created && e.gclass.instances--;
|
|
686
686
|
}
|
|
687
687
|
function je(e) {
|
|
688
|
-
if (Ye(e)) return
|
|
689
|
-
if (e.running) return
|
|
690
|
-
if (e.disabled) return
|
|
688
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), -1;
|
|
689
|
+
if (e.running) return qt(`${Ve(e)}: GObj ALREADY RUNNING`), -1;
|
|
690
|
+
if (e.disabled) return qt(`${Ve(e)}: GObj DISABLED`), -1;
|
|
691
691
|
B(e) && L(n("⏺ ⏺ start: %s", Me(e))), e.running = !0;
|
|
692
692
|
let t = 0;
|
|
693
693
|
return e.gclass.gmt.mt_start && (t = e.gclass.gmt.mt_start(e)), t;
|
|
@@ -695,28 +695,28 @@
|
|
|
695
695
|
function ve(e, t, n) {
|
|
696
696
|
return e.gclass.gclass_flag & N.gcflag_manual_start || Ye(e) || Ae(e) || ke(e) || je(e), 0;
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Oe(e, t, n) {
|
|
699
699
|
return e.gclass.gclass_flag & N.gcflag_manual_start || ke(e) ? 1 : (Ae(e) || je(e), 0);
|
|
700
700
|
}
|
|
701
|
-
function
|
|
702
|
-
if (Ye(e)) return
|
|
703
|
-
if (!e.running) return
|
|
701
|
+
function Se(e) {
|
|
702
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), -1;
|
|
703
|
+
if (!e.running) return qt(`${Ve(e)}: GObj NOT RUNNING`), -1;
|
|
704
704
|
e.playing && (zt(`${Ve(e)}: GObj stopping without previous pause`), De(e)), B(e) && L(n("⏹ ⏹ stop: %s", Me(e))), e.running = !1;
|
|
705
705
|
let t = 0;
|
|
706
706
|
return e.gclass.gmt.mt_stop && (t = e.gclass.gmt.mt_stop(e)), t;
|
|
707
707
|
}
|
|
708
708
|
function Ne(e, t, n) {
|
|
709
|
-
return Ae(e) &&
|
|
709
|
+
return Ae(e) && Se(e), 0;
|
|
710
710
|
}
|
|
711
711
|
function we(e) {
|
|
712
|
-
return Ye(e) ? (
|
|
712
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), -1) : qe(e, A.WALK_FIRST2LAST, Ne, 0, 0);
|
|
713
713
|
}
|
|
714
714
|
function Re(e) {
|
|
715
|
-
if (Ye(e)) return
|
|
716
|
-
if (e.playing) return
|
|
717
|
-
if (e.disabled) return
|
|
715
|
+
if (Ye(e)) return qt(`gobj NULL or DESTROYED: ${Ve(e)}`), -1;
|
|
716
|
+
if (e.playing) return qt(`${Ve(e)}: GObj ALREADY PLAYING`), -1;
|
|
717
|
+
if (e.disabled) return qt(`${Ve(e)}: GObj DISABLED`), -1;
|
|
718
718
|
if (!Ae(e)) {
|
|
719
|
-
if (e.gclass.gclass_flag & N.gcflag_required_start_to_play) return
|
|
719
|
+
if (e.gclass.gclass_flag & N.gcflag_required_start_to_play) return qt(`${Ve(e)}: Cannot play, start not done`), -1;
|
|
720
720
|
zt(`${Ve(e)}: GObj playing without previous start`), je(e);
|
|
721
721
|
}
|
|
722
722
|
B(e) && L(n("⏯ ⏯ play: %s", Me(e))), e.playing = !0;
|
|
@@ -724,7 +724,7 @@
|
|
|
724
724
|
return e.gclass.gmt.mt_play && (t = e.gclass.gmt.mt_play(e), (t < 0 || !1 === t) && (e.playing = !1)), t;
|
|
725
725
|
}
|
|
726
726
|
function De(e) {
|
|
727
|
-
return Ye(e) ? (
|
|
727
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), -1) : e.playing ? (B(e) && L(n("⏸ ⏸ pause: %s", Me(e))), e.playing = !1, e.gclass.gmt.mt_pause ? e.gclass.gmt.mt_pause(e) : 0) : (qt(`${Ve(e)}: GObj NOT PLAYING`), -1);
|
|
728
728
|
}
|
|
729
729
|
function Ae(e) {
|
|
730
730
|
return !Ye(e) && e.running;
|
|
@@ -754,104 +754,104 @@
|
|
|
754
754
|
return e ? at(e, "yuno_id") : "";
|
|
755
755
|
}
|
|
756
756
|
function Fe(e) {
|
|
757
|
-
return vn(e) ? e.gobj_name : (
|
|
757
|
+
return vn(e) ? e.gobj_name : (qt("gobj bad type"), null);
|
|
758
758
|
}
|
|
759
759
|
function Ge(e) {
|
|
760
|
-
return vn(e) ? e.gclass.gclass_name : (
|
|
760
|
+
return vn(e) ? e.gclass.gclass_name : (qt("gobj NULL of bad type"), null);
|
|
761
761
|
}
|
|
762
762
|
function Ve(e) {
|
|
763
|
-
return vn(e) ? e.gclass.gclass_name + "^" + Fe(e) : (
|
|
763
|
+
return vn(e) ? e.gclass.gclass_name + "^" + Fe(e) : (qt("gobj bad type"), null);
|
|
764
764
|
}
|
|
765
765
|
function Me(e) {
|
|
766
|
-
if (!vn(e)) return
|
|
766
|
+
if (!vn(e)) return qt("gobj NULL of bad type"), null;
|
|
767
767
|
let t = Ve(e), n = We(e);
|
|
768
768
|
for (; n;) t = Ve(n) + "`" + t, n = We(n);
|
|
769
769
|
return t;
|
|
770
770
|
}
|
|
771
771
|
function We(e) {
|
|
772
|
-
return vn(e) ? e.parent : (
|
|
772
|
+
return vn(e) ? e.parent : (qt("gobj NULL of bad type"), null);
|
|
773
773
|
}
|
|
774
774
|
function Ke(e) {
|
|
775
|
-
return vn(e) ? !!(e.gobj_flag & w.gobj_flag_volatil) : (
|
|
775
|
+
return vn(e) ? !!(e.gobj_flag & w.gobj_flag_volatil) : (qt("gobj NULL of bad type"), null);
|
|
776
776
|
}
|
|
777
777
|
function xe(e) {
|
|
778
|
-
return vn(e) ? !!(e.gobj_flag & w.gobj_flag_pure_child) : (
|
|
778
|
+
return vn(e) ? !!(e.gobj_flag & w.gobj_flag_pure_child) : (qt("gobj NULL of bad type"), null);
|
|
779
779
|
}
|
|
780
780
|
function Ye(e) {
|
|
781
781
|
return !vn(e) || !!(e.obflag & (R.obflag_destroyed | R.obflag_destroying));
|
|
782
782
|
}
|
|
783
783
|
function Be(e) {
|
|
784
|
-
return vn(e) ? e.bottom_gobj : (
|
|
784
|
+
return vn(e) ? e.bottom_gobj : (qt("gobj NULL of bad type"), null);
|
|
785
785
|
}
|
|
786
786
|
function Je(e, t) {
|
|
787
|
-
if (!vn(e)) return
|
|
787
|
+
if (!vn(e)) return qt("gobj NULL of bad type"), null;
|
|
788
788
|
e.bottom_gobj && zt(`${Ve(e)}: bottom_gobj already set`), e.bottom_gobj = t;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
791
|
-
return vn(e) ? t ? ee(e.gclass, t, n) : e.gclass.attrs_table : (
|
|
790
|
+
function He(e, t, n) {
|
|
791
|
+
return vn(e) ? t ? ee(e.gclass, t, n) : e.gclass.attrs_table : (qt("gobj NULL of bad type"), null);
|
|
792
792
|
}
|
|
793
|
-
function
|
|
794
|
-
return Ye(e) ? (
|
|
793
|
+
function qe(e, t, n, r, o) {
|
|
794
|
+
return Ye(e) ? (qt("gobj NULL, destroying, or bad type"), 0) : Xe(e.dl_children, t, n, r, o);
|
|
795
795
|
}
|
|
796
796
|
function ze(e, t, n, r, o) {
|
|
797
|
-
return Ye(e) ? (
|
|
797
|
+
return Ye(e) ? (qt("gobj NULL, destroying, or bad type"), 0) : et(e.dl_children, t, n, r, o);
|
|
798
798
|
}
|
|
799
799
|
function Qe(e) {
|
|
800
|
-
return "number" == typeof e && isFinite(e) ? e : (null == e ||
|
|
800
|
+
return "number" == typeof e && isFinite(e) ? e : (null == e || qt(`walk callback must return a NUMBER (-1 stop, 0 descend, >0 skip children), got ${typeof e}: taken as 0`), 0);
|
|
801
801
|
}
|
|
802
802
|
function Xe(e, t, n, r, o) {
|
|
803
|
-
let
|
|
804
|
-
if (t & A.WALK_LAST2FIRST) for (let e =
|
|
805
|
-
|
|
806
|
-
let t = Qe(n(
|
|
803
|
+
let i, l = [...e];
|
|
804
|
+
if (t & A.WALK_LAST2FIRST) for (let e = l.length; e > 0; e--) {
|
|
805
|
+
i = l[e - 1];
|
|
806
|
+
let t = Qe(n(i, r, o));
|
|
807
807
|
if (t < 0) return t;
|
|
808
808
|
}
|
|
809
|
-
else for (let e = 0; e <
|
|
810
|
-
|
|
811
|
-
let t = Qe(n(
|
|
809
|
+
else for (let e = 0; e < l.length; e++) {
|
|
810
|
+
i = l[e];
|
|
811
|
+
let t = Qe(n(i, r, o));
|
|
812
812
|
if (t < 0) return t;
|
|
813
813
|
}
|
|
814
814
|
return 0;
|
|
815
815
|
}
|
|
816
816
|
function Ze(e, t, n, r, o) {
|
|
817
|
-
let
|
|
818
|
-
if (
|
|
817
|
+
let i, l = Xe(e, t, n, r, o);
|
|
818
|
+
if (l < 0) return l;
|
|
819
819
|
if (t & A.WALK_LAST2FIRST) {
|
|
820
|
-
for (let s = e.length; s > 0; s--) if (
|
|
821
|
-
} else for (let s = 0; s < e.length; s++) if (
|
|
822
|
-
return
|
|
820
|
+
for (let s = e.length; s > 0; s--) if (i = e[s - 1], l = Ze([...i.dl_children], t, n, r, o), l < 0) return l;
|
|
821
|
+
} else for (let s = 0; s < e.length; s++) if (i = e[s], l = Ze([...i.dl_children], t, n, r, o), l < 0) return l;
|
|
822
|
+
return l;
|
|
823
823
|
}
|
|
824
824
|
function et(e, t, n, r, o) {
|
|
825
825
|
if (t & A.WALK_BYLEVEL) return Ze(e, t, n, r, o);
|
|
826
|
-
let
|
|
826
|
+
let i, l;
|
|
827
827
|
if (t & A.WALK_BOTTOM2TOP) for (let s = e.length; s > 0; s--) {
|
|
828
|
-
if (
|
|
829
|
-
if (
|
|
828
|
+
if (l = e[s - 1], i = et([...l.dl_children], t, n, r, o), i < 0) return i;
|
|
829
|
+
if (i = Qe(n(l, r, o)), i < 0) return i;
|
|
830
830
|
}
|
|
831
831
|
else for (let s = 0; s < e.length; s++) {
|
|
832
|
-
if (
|
|
833
|
-
if (0 ===
|
|
832
|
+
if (l = e[s], i = Qe(n(l, r, o)), i < 0) return i;
|
|
833
|
+
if (0 === i && (i = et([...l.dl_children], t, n, r, o), i < 0)) return i;
|
|
834
834
|
}
|
|
835
835
|
return 0;
|
|
836
836
|
}
|
|
837
837
|
function tt(e, t) {
|
|
838
|
-
if (!vn(e)) return
|
|
838
|
+
if (!vn(e)) return qt("gobj NULL of bad type"), !1;
|
|
839
839
|
let n = t.__gclass_name__, r = t.__gobj_name__, o = t.__prefix_gobj_name__;
|
|
840
840
|
t.__disabled__;
|
|
841
|
-
let
|
|
841
|
+
let i = t.__state__;
|
|
842
842
|
if (n && n !== Ge(e)) return !1;
|
|
843
843
|
if (r && r !== Fe(e)) return !1;
|
|
844
844
|
if (o) {
|
|
845
845
|
let t = o.length;
|
|
846
846
|
if (o !== Fe(e).substring(0, t)) return !1;
|
|
847
847
|
}
|
|
848
|
-
if (
|
|
849
|
-
let
|
|
850
|
-
for (const n of Object.keys(t)) if ("__gclass_name__" !== n && "__gobj_name__" !== n && "__prefix_gobj_name__" !== n && "__disabled__" !== n && "__state__" !== n && ot(e, n) &&
|
|
848
|
+
if (i && i !== pt(e)) return !1;
|
|
849
|
+
let l = e.jn_attrs;
|
|
850
|
+
for (const n of Object.keys(t)) if ("__gclass_name__" !== n && "__gobj_name__" !== n && "__prefix_gobj_name__" !== n && "__disabled__" !== n && "__state__" !== n && ot(e, n) && l[n] !== t[n]) return !1;
|
|
851
851
|
return !0;
|
|
852
852
|
}
|
|
853
853
|
function nt(e, t) {
|
|
854
|
-
if (Ye(e)) return
|
|
854
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), null;
|
|
855
855
|
const n = e.dl_children;
|
|
856
856
|
for (let e = 0; e < n.length; e++) {
|
|
857
857
|
const r = n[e];
|
|
@@ -875,27 +875,27 @@
|
|
|
875
875
|
if (1 === n.length) return e;
|
|
876
876
|
let r = n[1].split("^"), o = {};
|
|
877
877
|
1 === r.length ? o.__gobj_name__ = r : (o.__gclass_name__ = r[0], o.__gobj_name__ = r[1]);
|
|
878
|
-
let
|
|
879
|
-
return
|
|
878
|
+
let i = nt(e, o);
|
|
879
|
+
return i ? (n.splice(0, 1), n = n.join("`"), rt(i, n)) : null;
|
|
880
880
|
}
|
|
881
881
|
function ot(e, t) {
|
|
882
|
-
return !
|
|
882
|
+
return !On(t) && !!ee(e.gclass, t, !1);
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function it(e, t, n) {
|
|
885
885
|
let r = e.jn_attrs;
|
|
886
886
|
if (t in r && r.hasOwnProperty(t)) {
|
|
887
887
|
let n = r[t];
|
|
888
888
|
return e.gclass.gmt.mt_reading ? e.gclass.gmt.mt_reading(e, t, n) : n;
|
|
889
889
|
}
|
|
890
|
-
return
|
|
890
|
+
return qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), null;
|
|
891
891
|
}
|
|
892
|
-
function
|
|
892
|
+
function lt(e, t, n) {
|
|
893
893
|
let r = {}, o = e.gclass.attrs_table;
|
|
894
894
|
for (let n = 0; n < o.length; n++) {
|
|
895
|
-
const
|
|
896
|
-
if (
|
|
895
|
+
const i = o[n];
|
|
896
|
+
if (i.name && (-1 === t || i.flag & t)) {
|
|
897
897
|
let t;
|
|
898
|
-
!e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? t = ln(e.jn_attrs,
|
|
898
|
+
!e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? t = ln(e.jn_attrs, i.name) : (t = e.gclass.gmt.mt_reading(e, i.name), void 0 === t && (t = ln(e.jn_attrs, i.name))), _n(r, i.name, t);
|
|
899
899
|
}
|
|
900
900
|
}
|
|
901
901
|
return r;
|
|
@@ -908,58 +908,58 @@
|
|
|
908
908
|
if (0 === wn(t, "__service__")) return Ie(e);
|
|
909
909
|
}
|
|
910
910
|
let n = Z(e, t, !1);
|
|
911
|
-
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (
|
|
911
|
+
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), 0);
|
|
912
912
|
}
|
|
913
913
|
function _t(e, t) {
|
|
914
914
|
t && wn(t, "__trace_level__");
|
|
915
915
|
let n = Z(e, t, !1);
|
|
916
|
-
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (
|
|
916
|
+
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), 0);
|
|
917
917
|
}
|
|
918
918
|
function at(e, t) {
|
|
919
919
|
if (t && 0 === wn(t, "__state__")) return pt(e);
|
|
920
920
|
let n = Z(e, t, !1);
|
|
921
|
-
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (
|
|
921
|
+
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), 0);
|
|
922
922
|
}
|
|
923
923
|
function ut(e, t) {
|
|
924
924
|
let n = Z(e, t, !1);
|
|
925
|
-
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (
|
|
925
|
+
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? ln(n, t) : e.gclass.gmt.mt_reading(e, t) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), 0);
|
|
926
926
|
}
|
|
927
927
|
function ct(e, t, n, r) {
|
|
928
|
-
let o = X(e),
|
|
929
|
-
for (const [r,
|
|
930
|
-
let t =
|
|
931
|
-
t && (-1 === n || t.flag & n) && (
|
|
928
|
+
let o = X(e), i = 0;
|
|
929
|
+
for (const [r, l] of Object.entries(t)) {
|
|
930
|
+
let t = He(e, r, !0);
|
|
931
|
+
t && (-1 === n || t.flag & n) && (i += Q(e, o, t, l));
|
|
932
932
|
}
|
|
933
|
-
return
|
|
933
|
+
return i;
|
|
934
934
|
}
|
|
935
935
|
function ft(e, t, n) {
|
|
936
936
|
let r = Z(e, t, !1);
|
|
937
|
-
return r ? (r[t] =
|
|
937
|
+
return r ? (r[t] = Sn(n), pn(e.priv) && e.priv.hasOwnProperty(t) && (e.priv[t] = n), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, t), 0) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), -1);
|
|
938
938
|
}
|
|
939
939
|
function gt(e, t, n) {
|
|
940
940
|
let r = Z(e, t, !1);
|
|
941
|
-
return r ? (r[t] = parseInt(n), pn(e.priv) && e.priv.hasOwnProperty(t) && (e.priv[t] = n), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, t), 0) : (
|
|
941
|
+
return r ? (r[t] = parseInt(n), pn(e.priv) && e.priv.hasOwnProperty(t) && (e.priv[t] = n), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, t), 0) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), -1);
|
|
942
942
|
}
|
|
943
943
|
function dt(e, t, n) {
|
|
944
944
|
let r = Z(e, t, !1);
|
|
945
|
-
return r ? (r[t] = String(n), pn(e.priv) && e.priv.hasOwnProperty(t) && (e.priv[t] = n), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, t), 0) : (
|
|
945
|
+
return r ? (r[t] = String(n), pn(e.priv) && e.priv.hasOwnProperty(t) && (e.priv[t] = n), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, t), 0) : (qt(`${Ve(e)}: GClass Attribute NOT FOUND, attr ${t}`), -1);
|
|
946
946
|
}
|
|
947
947
|
function bt(e, t) {
|
|
948
|
-
if (Ye(e)) return
|
|
948
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), null;
|
|
949
949
|
if (e.current_state.state_name === t) return !1;
|
|
950
950
|
let r = re(e.gclass, t);
|
|
951
|
-
if (!r) return
|
|
951
|
+
if (!r) return qt(`${Ve(e)}: state unknown, state ${t}`), !1;
|
|
952
952
|
e.last_state = e.current_state, e.current_state = r;
|
|
953
|
-
let o = J(e, "EV_STATE_CHANGED"),
|
|
953
|
+
let o = J(e, "EV_STATE_CHANGED"), i = !!function(e) {
|
|
954
954
|
return W(e) & P.TRACE_STATES;
|
|
955
955
|
}(e);
|
|
956
|
-
return (o ||
|
|
956
|
+
return (o || i) && (1 === C || L(n("🔀🔀 mach(%s%s^%s), new st(%s), prev st(%s)", e.running ? "" : "!!", Ge(e), Fe(e), pt(e), e.last_state.state_name))), !0;
|
|
957
957
|
}
|
|
958
958
|
function pt(e) {
|
|
959
|
-
return vn(e) ? e.current_state.state_name : (
|
|
959
|
+
return vn(e) ? e.current_state.state_name : (qt("hgobj NULL"), "");
|
|
960
960
|
}
|
|
961
961
|
function mt(e, t, n) {
|
|
962
|
-
if (!vn(e)) return
|
|
962
|
+
if (!vn(e)) return qt("gobj NULL of bad type"), null;
|
|
963
963
|
let r = ae(e.gclass, t);
|
|
964
964
|
if (r) return r;
|
|
965
965
|
if (n) {
|
|
@@ -975,33 +975,33 @@
|
|
|
975
975
|
let r = mt(e, t, !1);
|
|
976
976
|
return !!r && !(n && !(r.event_flag & n));
|
|
977
977
|
}
|
|
978
|
-
function
|
|
978
|
+
function ht(e, t, n) {
|
|
979
979
|
let r = mt(e, t, !1);
|
|
980
980
|
return !!r && !(n && !(r.event_flag & n)) && !!(r.event_flag & D.EVF_OUTPUT_EVENT);
|
|
981
981
|
}
|
|
982
|
-
var
|
|
982
|
+
var Tt = [], yt = !1;
|
|
983
983
|
function jt() {
|
|
984
984
|
yt = !1;
|
|
985
|
-
let e =
|
|
986
|
-
|
|
985
|
+
let e = Tt;
|
|
986
|
+
Tt = [];
|
|
987
987
|
let t = 0;
|
|
988
988
|
for (let n of e) n.dst.obflag & (R.obflag_destroyed | R.obflag_destroying) || (vt(n.dst, n.event, n.kw, n.src), t++);
|
|
989
|
-
return
|
|
989
|
+
return Tt.length > 0 && !yt && (yt = !0, setTimeout(jt, 0)), t;
|
|
990
990
|
}
|
|
991
991
|
function vt(e, t, r, o) {
|
|
992
|
-
if (!(e && e instanceof
|
|
993
|
-
if (e.obflag & (R.obflag_destroyed | R.obflag_destroying)) return
|
|
994
|
-
let
|
|
995
|
-
if (!
|
|
996
|
-
let
|
|
992
|
+
if (!(e && e instanceof S)) return qt("gobj dst NULL"), -1;
|
|
993
|
+
if (e.obflag & (R.obflag_destroyed | R.obflag_destroying)) return qt("gobj dst DESTROYED"), -1;
|
|
994
|
+
let i = e.current_state;
|
|
995
|
+
if (!i) return qt(`${Ve(e)}: current_state NULL`), -1;
|
|
996
|
+
let l = J(e, t) && !H(o, t);
|
|
997
997
|
E++;
|
|
998
|
-
let s = oe(
|
|
999
|
-
if (!s) return e.gclass.gmt.mt_inject_event ? (E--,
|
|
1000
|
-
if (
|
|
1001
|
-
if (1 === C) L(n("🔄 %s %s%s %s from %s%s", t || "", e.running ? "" : "!!", Ve(e),
|
|
998
|
+
let s = oe(i, t);
|
|
999
|
+
if (!s) return e.gclass.gmt.mt_inject_event ? (E--, l && (L(1 === C ? n("🔜 %s %s%s %s", t || "", e.running ? "" : "!!", Ve(e), i.state_name) : n("🔃 mach(%s%s), st: %s, ev: %s, from(%s%s)", e.running ? "" : "!!", Ve(e), i.state_name, t || "", o && !o.running ? "!!" : "", Ve(o))), r && l > 1 && gn(r) && Zt(r)), e.gclass.gmt.mt_inject_event(e, t, r, o)) : (l && L(n("📛 mach(%s%s^%s), st: %s, ev: %s, 📛📛ERROR Event NOT DEFINED in state📛📛, from(%s%s^%s)", e.running ? "" : "!!", Ge(e), Fe(e), i.state_name, t || "", o && !o.running ? "!!" : "", Ge(o), Fe(o))), qt(`📛📛 Event NOT DEFINED in state 📛📛: ${Ve(e)}, ${i.state_name}, ${t}`), E--, -1);
|
|
1000
|
+
if (l) {
|
|
1001
|
+
if (1 === C) L(n("🔄 %s %s%s %s from %s%s", t || "", e.running ? "" : "!!", Ve(e), i.state_name, o && !o.running ? "!!" : "", Ve(o)));
|
|
1002
1002
|
else {
|
|
1003
1003
|
let r = "";
|
|
1004
|
-
s.action && (r = fr(s.action)), L(n("🔄 mach(%s%s^%s), st: %s, ev: %s%s%s, ac: %s, from(%s%s^%s)", e.running ? "" : "!!", Ge(e), Fe(e),
|
|
1004
|
+
s.action && (r = fr(s.action)), L(n("🔄 mach(%s%s^%s), st: %s, ev: %s%s%s, ac: %s, from(%s%s^%s)", e.running ? "" : "!!", Ge(e), Fe(e), i.state_name, "", t || "", "", r, o && !o.running ? "!!" : "", Ge(o), Fe(o)));
|
|
1005
1005
|
}
|
|
1006
1006
|
r && (W(e) | x()) & P.TRACE_EV_KW && gn(r) && Zt(r);
|
|
1007
1007
|
}
|
|
@@ -1010,33 +1010,33 @@
|
|
|
1010
1010
|
try {
|
|
1011
1011
|
s.action && (_ = s.action(e, t, r, o));
|
|
1012
1012
|
} finally {}
|
|
1013
|
-
return !
|
|
1013
|
+
return !l || 1 === C || e.obflag & R.obflag_destroyed || L(n("<- mach(%s%s^%s), st: %s, ev: %s, ret: %d", e.running ? "" : "!!", Ge(e), Fe(e), e.current_state.state_name, t || "", hn(_) ? _ : 0)), E--, _;
|
|
1014
1014
|
}
|
|
1015
|
-
var
|
|
1015
|
+
var Ot = Object.freeze({
|
|
1016
1016
|
__hard_subscription__: 1,
|
|
1017
1017
|
__own_event__: 2
|
|
1018
|
-
}),
|
|
1019
|
-
v(
|
|
1020
|
-
v(
|
|
1021
|
-
v(
|
|
1022
|
-
v(
|
|
1023
|
-
v(
|
|
1024
|
-
v(
|
|
1025
|
-
v(
|
|
1026
|
-
v(
|
|
1027
|
-
v(
|
|
1028
|
-
v(
|
|
1018
|
+
}), St = [
|
|
1019
|
+
v(h.DTP_POINTER, "publisher", 0, null, "publisher gobj"),
|
|
1020
|
+
v(h.DTP_POINTER, "subscriber", 0, null, "subscriber gobj"),
|
|
1021
|
+
v(h.DTP_STRING, "event", 0, "", "event name subscribed"),
|
|
1022
|
+
v(h.DTP_STRING, "renamed_event", 0, "", "rename event name"),
|
|
1023
|
+
v(h.DTP_INTEGER, "subs_flag", 0, 0, "subscription flag"),
|
|
1024
|
+
v(h.DTP_JSON, "__config__", 0, null, "subscription config"),
|
|
1025
|
+
v(h.DTP_JSON, "__global__", 0, null, "global kw, merge in publishing"),
|
|
1026
|
+
v(h.DTP_JSON, "__local__", 0, null, "local kw, remove in publishing"),
|
|
1027
|
+
v(h.DTP_JSON, "__filter__", 0, null, "filter kw, filter in publishing"),
|
|
1028
|
+
v(h.DTP_STRING, "__service__", 0, "", "subscription service"),
|
|
1029
1029
|
j()
|
|
1030
1030
|
];
|
|
1031
1031
|
function Nt(e, t, n, r, o) {
|
|
1032
|
-
let
|
|
1033
|
-
if (t && t !== Pn(null, e, "publisher", null) && (a = !1), o && o !== Pn(null, e, "subscriber", null) && (a = !1), n && n !== Ln(null, e, "event", "") && (a = !1), bn(
|
|
1032
|
+
let i = Un(t, r, "__config__", null), l = Un(t, r, "__global__", null), s = Un(t, r, "__local__", null), _ = Fn(t, r, "__filter__", null), a = !0;
|
|
1033
|
+
if (t && t !== Pn(null, e, "publisher", null) && (a = !1), o && o !== Pn(null, e, "subscriber", null) && (a = !1), n && n !== Ln(null, e, "event", "") && (a = !1), bn(i) > 0) {
|
|
1034
1034
|
let t = Un(null, e, "__config__", null);
|
|
1035
|
-
bn(t) > 0 && tn(t,
|
|
1035
|
+
bn(t) > 0 && tn(t, i) || (a = !1);
|
|
1036
1036
|
}
|
|
1037
|
-
if (bn(
|
|
1037
|
+
if (bn(l) > 0) {
|
|
1038
1038
|
let t = Un(null, e, "__global__", null);
|
|
1039
|
-
bn(t) > 0 && tn(t,
|
|
1039
|
+
bn(t) > 0 && tn(t, l) || (a = !1);
|
|
1040
1040
|
}
|
|
1041
1041
|
if (bn(s) > 0) {
|
|
1042
1042
|
let t = Un(null, e, "__local__", null);
|
|
@@ -1049,28 +1049,28 @@
|
|
|
1049
1049
|
return a;
|
|
1050
1050
|
}
|
|
1051
1051
|
function wt(e, t, n, r, o) {
|
|
1052
|
-
let
|
|
1053
|
-
for (let
|
|
1054
|
-
let s = e[
|
|
1055
|
-
Nt(s, t, n, r, o) && un(
|
|
1052
|
+
let i = [];
|
|
1053
|
+
for (let l = 0; l < e.length; l++) {
|
|
1054
|
+
let s = e[l];
|
|
1055
|
+
Nt(s, t, n, r, o) && un(i, s);
|
|
1056
1056
|
}
|
|
1057
|
-
return
|
|
1057
|
+
return i;
|
|
1058
1058
|
}
|
|
1059
1059
|
function Rt(e, t, n, r, o) {
|
|
1060
|
-
for (let
|
|
1060
|
+
for (let i = 0; i < e.length; i++) if (Nt(e[i], t, n, r, o)) return i;
|
|
1061
1061
|
return -1;
|
|
1062
1062
|
}
|
|
1063
1063
|
function Dt(e, t, r, o) {
|
|
1064
|
-
let
|
|
1065
|
-
if (!!(Cn(e, t, "subs_flag", null, Lt.KW_REQUIRED) &
|
|
1066
|
-
p && st(p, "trace_subscriptions") && (L(n("💜💜👎 unsubscribing event '%s': publisher %s, subscriber'%s'", s || "", Ve(
|
|
1067
|
-
let _ = Rt(
|
|
1068
|
-
return _ >= 0 ? fn(
|
|
1064
|
+
let i = Pn(e, t, "publisher", null, Lt.KW_REQUIRED), l = Pn(e, t, "subscriber", null, Lt.KW_REQUIRED), s = Ln(e, t, "event", "", Lt.KW_REQUIRED);
|
|
1065
|
+
if (!!(Cn(e, t, "subs_flag", null, Lt.KW_REQUIRED) & Ot.__hard_subscription__) && !r) return -1;
|
|
1066
|
+
p && st(p, "trace_subscriptions") && (L(n("💜💜👎 unsubscribing event '%s': publisher %s, subscriber'%s'", s || "", Ve(i), Ve(l))), Zt(t)), i.obflag & R.obflag_destroyed || o || i.gclass.gmt.mt_subscription_deleted && i.gclass.gmt.mt_subscription_deleted(i, t);
|
|
1067
|
+
let _ = Rt(i.dl_subscriptions, i, s, t, l);
|
|
1068
|
+
return _ >= 0 ? fn(i.dl_subscriptions, _) : (qt(`${Ve(e)}: subscription in publisher not found`), Zt(t)), _ = Rt(l.dl_subscribings, i, s, t, l), _ >= 0 ? fn(l.dl_subscribings, _) : (qt(`${Ve(e)}: subscription in subscriber not found`), Zt(t)), 0;
|
|
1069
1069
|
}
|
|
1070
1070
|
function At(e, t, r, o) {
|
|
1071
|
-
if (null == r && (r = {}), !e) return
|
|
1072
|
-
if (!o) return
|
|
1073
|
-
const
|
|
1071
|
+
if (null == r && (r = {}), !e) return qt(`publisher NULL: ev ${t}`), 0;
|
|
1072
|
+
if (!o) return qt(`subscriber NULL: ev ${t}`), 0;
|
|
1073
|
+
const i = /* @__PURE__ */ new Set([
|
|
1074
1074
|
"__config__",
|
|
1075
1075
|
"__global__",
|
|
1076
1076
|
"__local__",
|
|
@@ -1078,33 +1078,33 @@
|
|
|
1078
1078
|
"__service__"
|
|
1079
1079
|
]);
|
|
1080
1080
|
if (Object.keys(r).forEach((n) => {
|
|
1081
|
-
|
|
1082
|
-
}),
|
|
1083
|
-
else if (!(
|
|
1084
|
-
let
|
|
1085
|
-
dn(
|
|
1081
|
+
i.has(n) || qt(`${Ve(e)}: key ignored in subscription (key: ${n}, event: ${t})`);
|
|
1082
|
+
}), On(t)) t = "";
|
|
1083
|
+
else if (!(ht(e, t, D.EVF_OUTPUT_EVENT) || e.gclass.gclass_flag & N.gcflag_no_check_output_events)) return qt(`event NOT in output event list: ${Ve(e)}, ${t}`), 0;
|
|
1084
|
+
let l = wt(e.dl_subscriptions, e, t, r, o);
|
|
1085
|
+
dn(l) > 0 && (qt(`${Ve(e)}: ${dn(l)} subscription(s) REPEATED, will be deleted and override`), Zt(l, "subscription REPEATED"), kt(e, l, !1));
|
|
1086
1086
|
let s = function(e, t, n, r) {
|
|
1087
|
-
let o =
|
|
1087
|
+
let o = q(e, St);
|
|
1088
1088
|
an(o, "event", t), an(o, "subscriber", r), an(o, "publisher", e);
|
|
1089
|
-
let
|
|
1089
|
+
let i = 0;
|
|
1090
1090
|
if (n) {
|
|
1091
|
-
let t = Un(e, n, "__config__", null), r = Un(e, n, "__global__", null),
|
|
1091
|
+
let t = Un(e, n, "__config__", null), r = Un(e, n, "__global__", null), l = Un(e, n, "__local__", null), s = Fn(e, n, "__filter__", null), _ = Ln(e, n, "__service__", "");
|
|
1092
1092
|
if (bn(r) > 0 && an(o, "__global__", en(r)), bn(t) > 0) {
|
|
1093
1093
|
let n = en(t);
|
|
1094
1094
|
if (an(o, "__config__", n), An(n, "__hard_subscription__")) {
|
|
1095
1095
|
let t = $n(e, n, "__hard_subscription__", !1);
|
|
1096
|
-
sn(n, "__hard_subscription__"), t && (
|
|
1096
|
+
sn(n, "__hard_subscription__"), t && (i |= Ot.__hard_subscription__);
|
|
1097
1097
|
}
|
|
1098
1098
|
if (An(n, "__own_event__")) {
|
|
1099
1099
|
let t = $n(e, n, "__own_event__", !1);
|
|
1100
|
-
sn(n, "__own_event__"), t && (
|
|
1100
|
+
sn(n, "__own_event__"), t && (i |= Ot.__own_event__);
|
|
1101
1101
|
}
|
|
1102
1102
|
}
|
|
1103
|
-
bn(
|
|
1103
|
+
bn(l) > 0 && an(o, "__local__", en(l)), bn(s) > 0 && an(o, "__filter__", en(s)), On(_) || an(o, "__service__", _);
|
|
1104
1104
|
}
|
|
1105
|
-
return an(o, "subs_flag",
|
|
1105
|
+
return an(o, "subs_flag", i), o;
|
|
1106
1106
|
}(e, t, r, o);
|
|
1107
|
-
if (!s) return
|
|
1107
|
+
if (!s) return qt(`${Ve(e)}: _create_subscription() FAILED`), 0;
|
|
1108
1108
|
if (un(e.dl_subscriptions, s), un(o.dl_subscribings, s), p && st(p, "trace_subscriptions") && (L(n("💜💜👍 subscribing event '%s', publisher '%s', subscriber %s", t || "", Ve(e), Ve(o))), r && Zt(r)), e.gclass.gmt.mt_subscription_added) {
|
|
1109
1109
|
let t = e.gclass.gmt.mt_subscription_added(e, s);
|
|
1110
1110
|
(t < 0 || !1 === t) && (Dt(e, s, !0, !0), s = 0);
|
|
@@ -1123,18 +1123,18 @@
|
|
|
1123
1123
|
return wt(e.dl_subscribings, r, t, n, e);
|
|
1124
1124
|
}
|
|
1125
1125
|
function Ct(e, t, r) {
|
|
1126
|
-
if (pn(r) || (r = {}), !e || e.obflag & (R.obflag_destroyed | R.obflag_destroying)) return
|
|
1127
|
-
if (
|
|
1126
|
+
if (pn(r) || (r = {}), !e || e.obflag & (R.obflag_destroyed | R.obflag_destroying)) return qt("gobj NULL or DESTROYED"), -1;
|
|
1127
|
+
if (On(t)) return qt(`${Ve(e)}: event EMPTY`), -1;
|
|
1128
1128
|
let o = mt(e, t, !0);
|
|
1129
|
-
if (!(o && o.event_flag & (D.EVF_SYSTEM_EVENT | D.EVF_OUTPUT_EVENT) || e.gclass.gclass_flag & N.gcflag_no_check_output_events)) return
|
|
1130
|
-
let
|
|
1131
|
-
if (
|
|
1129
|
+
if (!(o && o.event_flag & (D.EVF_SYSTEM_EVENT | D.EVF_OUTPUT_EVENT) || e.gclass.gclass_flag & N.gcflag_no_check_output_events)) return qt(`event NOT in output event list: ${Ve(e)}, ev ${t}`), -1;
|
|
1130
|
+
let i = p && st(p, "trace_subscriptions");
|
|
1131
|
+
if (i && (L(1 === C ? n("🔝🔝 %s %s%s %s", t || "", e.running ? "" : "!!", Ve(e), e.current_state.state_name) : n("🔝🔝 mach(%s%s^%s), st: %s, ev: %s%s%s", e.running ? "" : "!!", Ge(e), Fe(e), e.current_state.state_name, "", t || "", "")), gn(r) && Zt(r)), e.gclass.gmt.mt_publish_event) {
|
|
1132
1132
|
let n = e.gclass.gmt.mt_publish_event(e, t, r);
|
|
1133
1133
|
if (n <= 0) return n;
|
|
1134
1134
|
}
|
|
1135
|
-
let
|
|
1136
|
-
for (let o = 0; o <
|
|
1137
|
-
let a =
|
|
1135
|
+
let l = [...e.dl_subscriptions], s = 0, _ = 0;
|
|
1136
|
+
for (let o = 0; o < l.length; o++) {
|
|
1137
|
+
let a = l[o];
|
|
1138
1138
|
if (e.gclass.gmt.mt_publication_pre_filter) {
|
|
1139
1139
|
let n = e.gclass.gmt.mt_publication_pre_filter(e, a, t, r);
|
|
1140
1140
|
if (n < 0) break;
|
|
@@ -1143,16 +1143,16 @@
|
|
|
1143
1143
|
let u = Pn(e, a, "subscriber", null, Lt.KW_REQUIRED);
|
|
1144
1144
|
if (!u || Ye(u)) continue;
|
|
1145
1145
|
let c = Cn(e, a, "subs_flag", 0, Lt.KW_REQUIRED), f = Ln(e, a, "event", "", Lt.KW_REQUIRED);
|
|
1146
|
-
if (
|
|
1146
|
+
if (On(f) || 0 === wn(f, t)) {
|
|
1147
1147
|
Un(e, a, "__config__", null, 0);
|
|
1148
|
-
let o = Un(e, a, "__global__", null, 0),
|
|
1149
|
-
if (e.gclass.gmt.mt_publication_filter ? d = e.gclass.gmt.mt_publication_filter(e, t, g, u) : bn(f) > 0 && (d = Wn(g, f) ? 1 : 0,
|
|
1148
|
+
let o = Un(e, a, "__global__", null, 0), l = Un(e, a, "__local__", null, 0), f = Fn(e, a, "__filter__", null, 0), g = r, d = 1;
|
|
1149
|
+
if (e.gclass.gmt.mt_publication_filter ? d = e.gclass.gmt.mt_publication_filter(e, t, g, u) : bn(f) > 0 && (d = Wn(g, f) ? 1 : 0, i && (L(n("💜💜🔄%s publishing with filter, event '%s', subscriber'%s', publisher %s", d ? "👍" : "👎", t || "", Ve(u), Ve(e))), Zt(f))), d < 0) break;
|
|
1150
1150
|
if (!d) continue;
|
|
1151
1151
|
let b = mt(u, t, !0);
|
|
1152
1152
|
if (b && b.event_flag & D.EVF_SYSTEM_EVENT && !Et(u, b.event_name, 0)) continue;
|
|
1153
|
-
|
|
1153
|
+
l && Dn(g, l), o && nn(g, o), i && (L(1 === C ? n("🔝🔄 %s (%s) %s%s", t || "", t || "", u.running ? "" : "!!", Ve(u)) : n("🔝🔄 mach(%s%s), st: %s, ev: %s, from(%s%s)", u.running ? "" : "!!", Ve(u), pt(u), t || "", e && !e.running ? "!!" : "", Ve(e))), gn(g) && Zt(g));
|
|
1154
1154
|
let p = vt(u, t, g, e);
|
|
1155
|
-
if (p < 0 && c &
|
|
1155
|
+
if (p < 0 && c & Ot.__own_event__) {
|
|
1156
1156
|
s = -1;
|
|
1157
1157
|
break;
|
|
1158
1158
|
}
|
|
@@ -1207,7 +1207,7 @@
|
|
|
1207
1207
|
function Jt(e) {
|
|
1208
1208
|
e ? (Ut = e, Ft = e) : (Ut = Pt.error, Ft = Pt.warn);
|
|
1209
1209
|
}
|
|
1210
|
-
function
|
|
1210
|
+
function Ht(e) {
|
|
1211
1211
|
const t = Array.prototype.slice.call(arguments);
|
|
1212
1212
|
let n = "";
|
|
1213
1213
|
if ("string" == typeof e) {
|
|
@@ -1229,20 +1229,20 @@
|
|
|
1229
1229
|
} else n = t.map((e) => "object" == typeof e ? JSON.stringify(e) : String(e)).join(" ");
|
|
1230
1230
|
return n;
|
|
1231
1231
|
}
|
|
1232
|
-
function
|
|
1233
|
-
let t =
|
|
1232
|
+
function qt(e) {
|
|
1233
|
+
let t = Ht(e), n = ar();
|
|
1234
1234
|
Ut && (Ut === Pt.error ? xt("error", t) && Ut("%c" + n + " ERROR: " + String(t), "color:red") : (xt("error", t) && Pt.error("%c" + n + " ERROR: " + String(t), "color:red"), Ut(`${n} ERROR: ${String(t)}`))), Bt("error", t, n);
|
|
1235
1235
|
}
|
|
1236
1236
|
function zt(e) {
|
|
1237
|
-
let t =
|
|
1237
|
+
let t = Ht(e), n = ar();
|
|
1238
1238
|
Ft && (Ft === Pt.warn ? xt("warning", t) && Ft("%c" + n + " WARNING: " + String(t), "color:yellow") : (xt("warning", t) && Pt.warn("%c" + n + " WARNING: " + String(t), "color:yellow"), Ft(`${n} WARNING: ${String(t)}`))), Bt("warning", t, n);
|
|
1239
1239
|
}
|
|
1240
1240
|
function Qt(e) {
|
|
1241
|
-
let t =
|
|
1241
|
+
let t = Ht(e), n = ar();
|
|
1242
1242
|
Vt && xt("debug", t) && Vt("%c" + n + " DEBUG: " + String(t), "color:silver"), Bt("debug", t, n);
|
|
1243
1243
|
}
|
|
1244
1244
|
function Xt(e) {
|
|
1245
|
-
let t =
|
|
1245
|
+
let t = Ht(e), n = ar();
|
|
1246
1246
|
Vt && xt("msg", t) && Vt("%c" + n + " MSG: " + String(t), "color:cyan"), Bt("msg", t, n);
|
|
1247
1247
|
}
|
|
1248
1248
|
function Zt(e, t) {
|
|
@@ -1326,10 +1326,10 @@
|
|
|
1326
1326
|
function En(e) {
|
|
1327
1327
|
return "string" == typeof e;
|
|
1328
1328
|
}
|
|
1329
|
-
function
|
|
1329
|
+
function hn(e) {
|
|
1330
1330
|
return "number" == typeof e && Number.isFinite(e);
|
|
1331
1331
|
}
|
|
1332
|
-
function
|
|
1332
|
+
function Tn(e) {
|
|
1333
1333
|
return "boolean" == typeof e;
|
|
1334
1334
|
}
|
|
1335
1335
|
function yn(e) {
|
|
@@ -1339,13 +1339,13 @@
|
|
|
1339
1339
|
return "function" == typeof e;
|
|
1340
1340
|
}
|
|
1341
1341
|
function vn(e) {
|
|
1342
|
-
return e instanceof
|
|
1342
|
+
return e instanceof S;
|
|
1343
1343
|
}
|
|
1344
|
-
function
|
|
1344
|
+
function On(e) {
|
|
1345
1345
|
return !En(e) || 0 === e.length;
|
|
1346
1346
|
}
|
|
1347
|
-
function
|
|
1348
|
-
return
|
|
1347
|
+
function Sn(e) {
|
|
1348
|
+
return hn(e) ? Boolean(e) : /^\s*(true|1|on)\s*$/i.test(e);
|
|
1349
1349
|
}
|
|
1350
1350
|
function Nn(e, t) {
|
|
1351
1351
|
return e === t ? 0 : e > t ? 1 : -1;
|
|
@@ -1356,11 +1356,11 @@
|
|
|
1356
1356
|
}
|
|
1357
1357
|
function Rn(e, t) {
|
|
1358
1358
|
if (pn(e) || pn(t) || mn(e) || mn(t)) return 0;
|
|
1359
|
-
if (
|
|
1359
|
+
if (hn(e) || hn(t)) {
|
|
1360
1360
|
let n = Number(e), r = Number(t);
|
|
1361
1361
|
return n > r ? 1 : n < r ? -1 : 0;
|
|
1362
1362
|
}
|
|
1363
|
-
if (
|
|
1363
|
+
if (Tn(e) || Tn(t)) {
|
|
1364
1364
|
let n = Number(e), r = Number(t);
|
|
1365
1365
|
return n > r ? 1 : n < r ? -1 : 0;
|
|
1366
1366
|
}
|
|
@@ -1375,176 +1375,176 @@
|
|
|
1375
1375
|
return !(!(t in e) || !e.hasOwnProperty(t));
|
|
1376
1376
|
}
|
|
1377
1377
|
function kn(e, t, n, r) {
|
|
1378
|
-
if (e && !vn(e) &&
|
|
1379
|
-
if (!En(n)) return
|
|
1378
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !pn(t) && !mn(t)) return qt(`${Ve(e)}: kw must be list or dict`), 0;
|
|
1379
|
+
if (!En(n)) return qt(`${Ve(e)}: path must be a string: ${String(n)}`), 0;
|
|
1380
1380
|
let o = n.split("`");
|
|
1381
1381
|
if (o.length <= 1) return t[n];
|
|
1382
|
-
let
|
|
1383
|
-
for (let
|
|
1382
|
+
let i = o.length;
|
|
1383
|
+
for (let l = 0; l < i; l++) if (void 0 === (t = t[o[l]])) return void (r && qt(`${Ve(e)}: path not found: ${String(n)}`));
|
|
1384
1384
|
return t;
|
|
1385
1385
|
}
|
|
1386
1386
|
function In(e, t, n) {
|
|
1387
|
-
e && !vn(e) &&
|
|
1387
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1388
1388
|
let [r, o] = function(e, t) {
|
|
1389
1389
|
let n = e.lastIndexOf(t);
|
|
1390
1390
|
return -1 === n ? [e, ""] : [e.substring(0, n), e.substring(n + 1)];
|
|
1391
1391
|
}(n, "`");
|
|
1392
|
-
return
|
|
1392
|
+
return On(o) ? sn(t, n) : sn(kn(e, t, r, !0), o), 0;
|
|
1393
1393
|
}
|
|
1394
1394
|
function $n(e, t, n, r, o) {
|
|
1395
|
-
e && !vn(e) &&
|
|
1396
|
-
let
|
|
1397
|
-
const
|
|
1398
|
-
if (void 0 ===
|
|
1395
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1396
|
+
let i = kn(e, t, n, !1);
|
|
1397
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
1398
|
+
if (void 0 === i) {
|
|
1399
1399
|
if (s) {
|
|
1400
1400
|
let o = Boolean(r);
|
|
1401
1401
|
return Gn(e, t, n, o), o;
|
|
1402
1402
|
}
|
|
1403
|
-
return
|
|
1403
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), Boolean(r);
|
|
1404
1404
|
}
|
|
1405
|
-
return _ && In(e, t, n), Boolean(
|
|
1405
|
+
return _ && In(e, t, n), Boolean(i);
|
|
1406
1406
|
}
|
|
1407
1407
|
function Cn(e, t, n, r, o) {
|
|
1408
|
-
e && !vn(e) &&
|
|
1409
|
-
let
|
|
1410
|
-
const
|
|
1411
|
-
if (void 0 ===
|
|
1408
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1409
|
+
let i = kn(e, t, n, !1);
|
|
1410
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
1411
|
+
if (void 0 === i) {
|
|
1412
1412
|
if (s) {
|
|
1413
1413
|
let o = parseInt(r);
|
|
1414
1414
|
return Gn(e, t, n, o), o;
|
|
1415
1415
|
}
|
|
1416
|
-
return
|
|
1416
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), parseInt(r);
|
|
1417
1417
|
}
|
|
1418
|
-
return _ && In(e, t, n),
|
|
1418
|
+
return _ && In(e, t, n), hn(i) ? parseInt(i) : (l && (qt(`path value MUST BE a number: ${n}`), Xt(t)), parseInt(r));
|
|
1419
1419
|
}
|
|
1420
1420
|
function Ln(e, t, n, r, o) {
|
|
1421
|
-
e && !vn(e) &&
|
|
1422
|
-
let
|
|
1423
|
-
const
|
|
1424
|
-
if (void 0 ===
|
|
1421
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1422
|
+
let i = kn(e, t, n, !1);
|
|
1423
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
1424
|
+
if (void 0 === i) {
|
|
1425
1425
|
if (s) {
|
|
1426
1426
|
let o = String(r);
|
|
1427
1427
|
return Gn(e, t, n, o), o;
|
|
1428
1428
|
}
|
|
1429
|
-
return
|
|
1429
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), String(r);
|
|
1430
1430
|
}
|
|
1431
|
-
return _ && In(e, t, n), En(
|
|
1431
|
+
return _ && In(e, t, n), En(i) ? String(i) : (l && (qt(`${Ve(e)}: path value MUST BE a string: ${n}`), Xt(t)), String(r));
|
|
1432
1432
|
}
|
|
1433
1433
|
function Pn(e, t, n, r, o) {
|
|
1434
|
-
e && !vn(e) &&
|
|
1435
|
-
let
|
|
1436
|
-
const
|
|
1437
|
-
if (void 0 ===
|
|
1434
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1435
|
+
let i = kn(e, t, n, !1);
|
|
1436
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
1437
|
+
if (void 0 === i) {
|
|
1438
1438
|
if (s) {
|
|
1439
1439
|
let o = r;
|
|
1440
1440
|
return Gn(e, t, n, o), o;
|
|
1441
1441
|
}
|
|
1442
|
-
return
|
|
1442
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), r;
|
|
1443
1443
|
}
|
|
1444
|
-
return _ && In(e, t, n),
|
|
1444
|
+
return _ && In(e, t, n), i;
|
|
1445
1445
|
}
|
|
1446
1446
|
function Un(e, t, n, r, o) {
|
|
1447
|
-
e && !vn(e) &&
|
|
1448
|
-
let
|
|
1449
|
-
const
|
|
1450
|
-
if (void 0 ===
|
|
1447
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1448
|
+
let i = kn(e, t, n, !1);
|
|
1449
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
1450
|
+
if (void 0 === i) {
|
|
1451
1451
|
if (s) {
|
|
1452
1452
|
let o = Object(r);
|
|
1453
1453
|
return Gn(e, t, n, o), o;
|
|
1454
1454
|
}
|
|
1455
|
-
return
|
|
1455
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), Object(r);
|
|
1456
1456
|
}
|
|
1457
|
-
return _ && In(e, t, n), pn(
|
|
1457
|
+
return _ && In(e, t, n), pn(i) ? Object(i) : (l && (qt(`path value MUST BE a dict: ${n}`), Xt(t)), Object(r));
|
|
1458
1458
|
}
|
|
1459
1459
|
function Fn(e, t, n, r, o) {
|
|
1460
|
-
e && !vn(e) &&
|
|
1461
|
-
let
|
|
1462
|
-
const
|
|
1463
|
-
if (void 0 ===
|
|
1460
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1461
|
+
let i = kn(e, t, n, !1);
|
|
1462
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
1463
|
+
if (void 0 === i) {
|
|
1464
1464
|
if (s) {
|
|
1465
1465
|
let o = r;
|
|
1466
1466
|
return Gn(e, t, n, o), o;
|
|
1467
1467
|
}
|
|
1468
|
-
return
|
|
1468
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), r;
|
|
1469
1469
|
}
|
|
1470
|
-
return _ && In(e, t, n),
|
|
1470
|
+
return _ && In(e, t, n), i;
|
|
1471
1471
|
}
|
|
1472
1472
|
function Gn(e, t, n, r) {
|
|
1473
|
-
if (e && !vn(e) &&
|
|
1473
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !pn(t)) return qt("kw is not an object"), -1;
|
|
1474
1474
|
let o = n.split("`");
|
|
1475
1475
|
if (o.length <= 1) return t[n] = r, 0;
|
|
1476
|
-
let
|
|
1477
|
-
for (let e = 0; e <
|
|
1476
|
+
let i = o.length;
|
|
1477
|
+
for (let e = 0; e < i; e++) {
|
|
1478
1478
|
let n = o[e];
|
|
1479
|
-
e ===
|
|
1479
|
+
e === i - 1 ? t[n] = r : (void 0 === t[n] && (t[n] = {}), t = t[n]);
|
|
1480
1480
|
}
|
|
1481
1481
|
return 0;
|
|
1482
1482
|
}
|
|
1483
1483
|
function Vn(e, t, n, r, o) {
|
|
1484
|
-
if (e && !vn(e) &&
|
|
1485
|
-
let
|
|
1486
|
-
return pn(
|
|
1484
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !pn(t)) return qt("kw is not an object"), -1;
|
|
1485
|
+
let i = Un(e, t, n, {}, !0);
|
|
1486
|
+
return pn(i) ? (i[r] = o, 0) : (qt("subdict is not an object"), -1);
|
|
1487
1487
|
}
|
|
1488
1488
|
function Mn(e, t, r) {
|
|
1489
|
-
let o = "",
|
|
1489
|
+
let o = "", i = !1;
|
|
1490
1490
|
if (mn(t)) {
|
|
1491
|
-
|
|
1492
|
-
for (let
|
|
1493
|
-
let s = t[
|
|
1494
|
-
if (o =
|
|
1491
|
+
i = !1;
|
|
1492
|
+
for (let l = 0; l < t.length; l++) {
|
|
1493
|
+
let s = t[l];
|
|
1494
|
+
if (o = On(r) ? n("%s", r) : n("%s`%d", r, l), i = Mn(e, s, o), i) break;
|
|
1495
1495
|
}
|
|
1496
1496
|
} else if (pn(t)) {
|
|
1497
|
-
|
|
1498
|
-
let
|
|
1499
|
-
for (let s = 0; s <
|
|
1500
|
-
let _ =
|
|
1501
|
-
if (o =
|
|
1502
|
-
if (
|
|
1497
|
+
i = !0;
|
|
1498
|
+
let l = Object.keys(t);
|
|
1499
|
+
for (let s = 0; s < l.length; s++) {
|
|
1500
|
+
let _ = l[s], a = t[_];
|
|
1501
|
+
if (o = On(r) ? n("%s", _) : n("%s`%s", r, _), mn(a) || pn(a)) {
|
|
1502
|
+
if (i = Mn(e, a, o), !i) break;
|
|
1503
1503
|
continue;
|
|
1504
1504
|
}
|
|
1505
1505
|
let u = Fn(0, e, o, 0, 0);
|
|
1506
1506
|
if (u || (u = ln(e, o)), !u) {
|
|
1507
|
-
|
|
1507
|
+
i = !1;
|
|
1508
1508
|
break;
|
|
1509
1509
|
}
|
|
1510
1510
|
if (0 !== Rn(u, a)) {
|
|
1511
|
-
|
|
1511
|
+
i = !1;
|
|
1512
1512
|
break;
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
1515
|
}
|
|
1516
|
-
return
|
|
1516
|
+
return i;
|
|
1517
1517
|
}
|
|
1518
1518
|
function Wn(e, t) {
|
|
1519
1519
|
return 0 === bn(t) || Mn(e, t, "");
|
|
1520
1520
|
}
|
|
1521
1521
|
function Kn(e, t, n, r) {
|
|
1522
|
-
e && !vn(e) &&
|
|
1522
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
1523
1523
|
let o = {};
|
|
1524
|
-
if (En(n) && !
|
|
1525
|
-
let
|
|
1526
|
-
t.hasOwnProperty(
|
|
1527
|
-
} else if (pn(n) && gn(n) > 0) for (let
|
|
1524
|
+
if (En(n) && !On(n)) {
|
|
1525
|
+
let i = n;
|
|
1526
|
+
t.hasOwnProperty(i) ? o[i] = t[i] : r && qt(`${Ve(e)}: key not found: ${i}`);
|
|
1527
|
+
} else if (pn(n) && gn(n) > 0) for (let i of Object.keys(n)) t.hasOwnProperty(i) ? o[i] = t[i] : r && qt(`${Ve(e)}: key not found: ${i}`);
|
|
1528
1528
|
else {
|
|
1529
1529
|
if (!(mn(n) && dn(n) > 0)) return t;
|
|
1530
|
-
for (let
|
|
1531
|
-
let
|
|
1532
|
-
t.hasOwnProperty(
|
|
1530
|
+
for (let i = 0; i < n.length; i++) {
|
|
1531
|
+
let l = n[i];
|
|
1532
|
+
t.hasOwnProperty(l) ? o[l] = t[l] : r && qt(`${Ve(e)}: key not found: ${l}`);
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
1535
|
return o;
|
|
1536
1536
|
}
|
|
1537
1537
|
function xn(e, t, n, r) {
|
|
1538
1538
|
let o = {};
|
|
1539
|
-
if (nn(o, t), En(n) && !
|
|
1540
|
-
let
|
|
1541
|
-
Fn(e, t,
|
|
1542
|
-
} else if (pn(n) && gn(n) > 0) for (let
|
|
1539
|
+
if (nn(o, t), En(n) && !On(n)) {
|
|
1540
|
+
let i = n;
|
|
1541
|
+
Fn(e, t, i, 0, 0) ? sn(o, i) : r && qt(`${Ve(e)}: key not found: ${i}`);
|
|
1542
|
+
} else if (pn(n) && gn(n) > 0) for (let i of Object.keys(n)) t.hasOwnProperty(i) ? sn(o, i) : r && qt(`${Ve(e)}: key not found: ${i}`);
|
|
1543
1543
|
else {
|
|
1544
1544
|
if (!(mn(n) && dn(n) > 0)) return {};
|
|
1545
|
-
for (let
|
|
1546
|
-
let
|
|
1547
|
-
t.hasOwnProperty(
|
|
1545
|
+
for (let i = 0; i < n.length; i++) {
|
|
1546
|
+
let l = n[i];
|
|
1547
|
+
t.hasOwnProperty(l) ? sn(o, l) : r && qt(`${Ve(e)}: key not found: ${l}`);
|
|
1548
1548
|
}
|
|
1549
1549
|
}
|
|
1550
1550
|
return o;
|
|
@@ -1559,11 +1559,11 @@
|
|
|
1559
1559
|
}
|
|
1560
1560
|
function Bn(e, t) {
|
|
1561
1561
|
if ("undefined" == typeof window || !window.localStorage) return 0;
|
|
1562
|
-
if (!e || void 0 === t) return
|
|
1562
|
+
if (!e || void 0 === t) return qt(`kw_set_local_storage_value(): invalid key or value: key=${e}`), -1;
|
|
1563
1563
|
try {
|
|
1564
1564
|
return window.localStorage.setItem(e, JSON.stringify(t)), 0;
|
|
1565
1565
|
} catch (t) {
|
|
1566
|
-
return
|
|
1566
|
+
return qt(`kw_set_local_storage_value(): cannot save "${e}" (storage full or blocked?): ${t && t.message ? t.message : t}`), -1;
|
|
1567
1567
|
}
|
|
1568
1568
|
}
|
|
1569
1569
|
function Jn(e) {
|
|
@@ -1574,7 +1574,7 @@
|
|
|
1574
1574
|
}
|
|
1575
1575
|
else window.console.warn(`Invalid key for localStorage removal: ${e}`);
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function Hn(e, t) {
|
|
1578
1578
|
if (yn(e) || yn(t)) return !0;
|
|
1579
1579
|
if (mn(e)) {
|
|
1580
1580
|
if (0 === e.length) return !0;
|
|
@@ -1585,27 +1585,27 @@
|
|
|
1585
1585
|
} else if (En(e) && e === t) return !0;
|
|
1586
1586
|
return !1;
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1589
|
-
if (e && !vn(e) &&
|
|
1588
|
+
function qn(e, t, n, r, o) {
|
|
1589
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !t) return null;
|
|
1590
1590
|
o || (o = Wn);
|
|
1591
|
-
let
|
|
1592
|
-
if (mn(t)) for (let
|
|
1593
|
-
let s, _ = t[
|
|
1591
|
+
let i = [];
|
|
1592
|
+
if (mn(t)) for (let l = 0; l < t.length; l++) {
|
|
1593
|
+
let s, _ = t[l];
|
|
1594
1594
|
if (pn(_)) s = Ln(e, _, "id", "", 0);
|
|
1595
1595
|
else {
|
|
1596
1596
|
if (!En(_)) continue;
|
|
1597
1597
|
s = _;
|
|
1598
1598
|
}
|
|
1599
|
-
|
|
1599
|
+
Hn(n, s) && o(_, r) && i.push(_);
|
|
1600
1600
|
}
|
|
1601
1601
|
else {
|
|
1602
|
-
if (!pn(t)) return
|
|
1602
|
+
if (!pn(t)) return qt("kw_collect() BAD kw parameter"), null;
|
|
1603
1603
|
for (let e of Object.keys(t)) {
|
|
1604
|
-
let
|
|
1605
|
-
|
|
1604
|
+
let l = t[e];
|
|
1605
|
+
Hn(n, e) && o(l, r) && i.push(l);
|
|
1606
1606
|
}
|
|
1607
1607
|
}
|
|
1608
|
-
return
|
|
1608
|
+
return i;
|
|
1609
1609
|
}
|
|
1610
1610
|
function zn(e, t) {
|
|
1611
1611
|
if (!e) return -1;
|
|
@@ -1613,7 +1613,7 @@
|
|
|
1613
1613
|
return -1;
|
|
1614
1614
|
}
|
|
1615
1615
|
function Qn(e, t, n) {
|
|
1616
|
-
if (!e || !t) return
|
|
1616
|
+
if (!e || !t) return qt("ERROR: str_in_list() list or str empty"), !1;
|
|
1617
1617
|
let r = e.length;
|
|
1618
1618
|
if (n) {
|
|
1619
1619
|
t = t.toLowerCase();
|
|
@@ -1637,24 +1637,24 @@
|
|
|
1637
1637
|
r || (r = {}, e.__md_iev__ = r), r[t] = n;
|
|
1638
1638
|
}
|
|
1639
1639
|
function er(e, t, n, r) {
|
|
1640
|
-
if (!vn(e)) return
|
|
1640
|
+
if (!vn(e)) return qt("gobj is not a GObj"), null;
|
|
1641
1641
|
if (!t) return;
|
|
1642
1642
|
let o = Xn(t, n);
|
|
1643
1643
|
o || (o = [], Zn(t, n, o));
|
|
1644
1644
|
try {
|
|
1645
1645
|
mn(o) && o.unshift(r);
|
|
1646
1646
|
} catch (e) {
|
|
1647
|
-
|
|
1647
|
+
qt(e);
|
|
1648
1648
|
}
|
|
1649
1649
|
}
|
|
1650
1650
|
function tr(e, t, n, r) {
|
|
1651
|
-
if (!vn(e)) return
|
|
1652
|
-
if (!pn(t)) return
|
|
1651
|
+
if (!vn(e)) return qt("gobj is not a GObj"), null;
|
|
1652
|
+
if (!pn(t)) return qt("kw is not a dict"), null;
|
|
1653
1653
|
let o = Xn(t, n);
|
|
1654
|
-
return o ? 0 === o.length ? (r &&
|
|
1654
|
+
return o ? 0 === o.length ? (r && qt(`stack empty: ${n}`), null) : o[0] : (r && qt(`stack NOT FOUND: ${n}`), null);
|
|
1655
1655
|
}
|
|
1656
1656
|
function nr(e, t, n) {
|
|
1657
|
-
return
|
|
1657
|
+
return On(n) ? In(e, t, "__md_iev__`__msg_type__") : Vn(e, t, "__md_iev__", "__msg_type__", n), 0;
|
|
1658
1658
|
}
|
|
1659
1659
|
function rr(e, t) {
|
|
1660
1660
|
return Ln(e, t, "__md_iev__`__msg_type__", "", 0);
|
|
@@ -1672,23 +1672,23 @@
|
|
|
1672
1672
|
]), pn(e[r]) && or(e[r], t, n), n = n.slice(0, -o.length);
|
|
1673
1673
|
}
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function ir(e, t, n, r) {
|
|
1676
1676
|
if (!e) return null;
|
|
1677
|
-
let o,
|
|
1678
|
-
for (o = 0; o <
|
|
1679
|
-
let
|
|
1680
|
-
if (
|
|
1681
|
-
let e =
|
|
1682
|
-
if (e && e === n) return
|
|
1683
|
-
if (r && An(
|
|
1684
|
-
let e =
|
|
1677
|
+
let o, i = e.length;
|
|
1678
|
+
for (o = 0; o < i; o++) {
|
|
1679
|
+
let i = e[o];
|
|
1680
|
+
if (i) {
|
|
1681
|
+
let e = i.id;
|
|
1682
|
+
if (e && e === n) return i;
|
|
1683
|
+
if (r && An(i, t)) {
|
|
1684
|
+
let e = ir(i[t], t, n, r);
|
|
1685
1685
|
if (e) return e;
|
|
1686
1686
|
}
|
|
1687
1687
|
}
|
|
1688
1688
|
}
|
|
1689
1689
|
return null;
|
|
1690
1690
|
}
|
|
1691
|
-
function
|
|
1691
|
+
function lr(e) {
|
|
1692
1692
|
function t(e) {
|
|
1693
1693
|
let t = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
1694
1694
|
switch (t.length % 4) {
|
|
@@ -1775,11 +1775,11 @@
|
|
|
1775
1775
|
function Er(e) {
|
|
1776
1776
|
return "persistent-attrs-" + Ve(e);
|
|
1777
1777
|
}
|
|
1778
|
-
function
|
|
1778
|
+
function hr(e, t) {
|
|
1779
1779
|
if (En(t)) {
|
|
1780
1780
|
if (-1 === t.indexOf("^")) {
|
|
1781
1781
|
let n, r, o = e.fkey;
|
|
1782
|
-
if (1 !== gn(o)) return
|
|
1782
|
+
if (1 !== gn(o)) return qt("bad fkey 1"), qt(e), qt(t), null;
|
|
1783
1783
|
for (const e of Object.keys(o)) {
|
|
1784
1784
|
n = e, r = o[e];
|
|
1785
1785
|
break;
|
|
@@ -1792,7 +1792,7 @@
|
|
|
1792
1792
|
}
|
|
1793
1793
|
{
|
|
1794
1794
|
let n = t.split("^");
|
|
1795
|
-
return 3 !== n.length ? (
|
|
1795
|
+
return 3 !== n.length ? (qt("bad fkey 2"), qt(e), qt(t), null) : {
|
|
1796
1796
|
topic_name: n[0],
|
|
1797
1797
|
id: n[1],
|
|
1798
1798
|
hook_name: n[2]
|
|
@@ -1803,9 +1803,9 @@
|
|
|
1803
1803
|
topic_name: t.topic_name,
|
|
1804
1804
|
id: t.id,
|
|
1805
1805
|
hook_name: t.hook_name
|
|
1806
|
-
} : (
|
|
1806
|
+
} : (qt("bad fkey 3"), qt(e), qt(t), null);
|
|
1807
1807
|
}
|
|
1808
|
-
var
|
|
1808
|
+
var Tr = [
|
|
1809
1809
|
"string",
|
|
1810
1810
|
"integer",
|
|
1811
1811
|
"object",
|
|
@@ -1902,21 +1902,21 @@
|
|
|
1902
1902
|
}
|
|
1903
1903
|
return t.is_file && (t.type = "file"), t;
|
|
1904
1904
|
}
|
|
1905
|
-
var
|
|
1906
|
-
v(
|
|
1907
|
-
v(
|
|
1908
|
-
v(
|
|
1905
|
+
var Or = [
|
|
1906
|
+
v(h.DTP_POINTER, "subscriber", 0, null, "Subscriber of output events"),
|
|
1907
|
+
v(h.DTP_BOOLEAN, "periodic", 0, 0, "True for periodic timeouts"),
|
|
1908
|
+
v(h.DTP_INTEGER, "msec", 0, 0, "Timeout in milliseconds"),
|
|
1909
1909
|
j()
|
|
1910
|
-
],
|
|
1910
|
+
], Sr = {
|
|
1911
1911
|
periodic: !1,
|
|
1912
1912
|
msec: 0,
|
|
1913
1913
|
timer_id: -1
|
|
1914
1914
|
}, Nr = null;
|
|
1915
1915
|
function wr(e, t, n, r) {
|
|
1916
|
-
let o = e.priv,
|
|
1916
|
+
let o = e.priv, i = o.periodic ? "EV_TIMEOUT_PERIODIC" : "EV_TIMEOUT";
|
|
1917
1917
|
return o.periodic && o.msec > 0 ? o.timer_id = setTimeout(function() {
|
|
1918
1918
|
vt(e, "EV_TIMEOUT", {}, e);
|
|
1919
|
-
}, o.msec) : o.timer_id = -1, xe(e) ? vt(We(e),
|
|
1919
|
+
}, o.msec) : o.timer_id = -1, xe(e) ? vt(We(e), i, {}, e) : Ct(e, i, {}), o.periodic || -1 !== o.timer_id || Ae(e) && Se(e), 0;
|
|
1920
1920
|
}
|
|
1921
1921
|
var Rr = {
|
|
1922
1922
|
mt_create: function(e) {
|
|
@@ -1932,7 +1932,7 @@
|
|
|
1932
1932
|
break;
|
|
1933
1933
|
case "msec": n.msec = _t(e, "msec"), -1 !== n.timer_id && (clearTimeout(n.timer_id), n.timer_id = -1), n.msec > 0 && (n.timer_id = setTimeout(function() {
|
|
1934
1934
|
vt(e, "EV_TIMEOUT", {}, e);
|
|
1935
|
-
}, n.msec)), n.msec > 0 ? Ae(e) || je(e) : Ae(e) &&
|
|
1935
|
+
}, n.msec)), n.msec > 0 ? Ae(e) || je(e) : Ae(e) && Se(e);
|
|
1936
1936
|
}
|
|
1937
1937
|
},
|
|
1938
1938
|
mt_start: function(e) {
|
|
@@ -1944,39 +1944,39 @@
|
|
|
1944
1944
|
mt_destroy: function(e) {}
|
|
1945
1945
|
};
|
|
1946
1946
|
function Dr(e, t) {
|
|
1947
|
-
return e instanceof
|
|
1947
|
+
return e instanceof S ? "C_TIMER" !== Ge(e) ? (qt("not C_TIMER GObj"), -1) : (ft(e, "periodic", !1), void gt(e, "msec", t)) : (qt("not GObj TYPE"), -1);
|
|
1948
1948
|
}
|
|
1949
1949
|
function Ar(e, t) {
|
|
1950
|
-
return e instanceof
|
|
1950
|
+
return e instanceof S ? "C_TIMER" !== Ge(e) ? (qt("not C_TIMER GObj"), -1) : (ft(e, "periodic", !0), void gt(e, "msec", t)) : (qt("not GObj TYPE"), -1);
|
|
1951
1951
|
}
|
|
1952
1952
|
function kr(e) {
|
|
1953
|
-
return e instanceof
|
|
1953
|
+
return e instanceof S ? "C_TIMER" !== Ge(e) ? (qt("not C_TIMER GObj"), -1) : void gt(e, "msec", -1) : (qt("not GObj TYPE"), -1);
|
|
1954
1954
|
}
|
|
1955
1955
|
var Ir = [
|
|
1956
|
-
v(
|
|
1957
|
-
v(
|
|
1958
|
-
v(
|
|
1959
|
-
v(
|
|
1960
|
-
v(
|
|
1961
|
-
v(
|
|
1962
|
-
v(
|
|
1963
|
-
v(
|
|
1964
|
-
v(
|
|
1965
|
-
v(
|
|
1966
|
-
v(
|
|
1967
|
-
v(
|
|
1968
|
-
v(
|
|
1969
|
-
v(
|
|
1970
|
-
v(
|
|
1971
|
-
v(
|
|
1972
|
-
v(
|
|
1973
|
-
v(
|
|
1974
|
-
v(
|
|
1975
|
-
v(
|
|
1976
|
-
v(
|
|
1977
|
-
v(
|
|
1978
|
-
v(
|
|
1979
|
-
v(
|
|
1956
|
+
v(h.DTP_BOOLEAN, "changesLost", 0, !1, "Set true to warn about leaving page"),
|
|
1957
|
+
v(h.DTP_BOOLEAN, "browser_beforeunload", 0, !1, "Set true to refreshing browser"),
|
|
1958
|
+
v(h.DTP_STRING, "__username__", 0, "", "Username"),
|
|
1959
|
+
v(h.DTP_STRING, "start_date", 0, "", "Yuno starting date"),
|
|
1960
|
+
v(h.DTP_STRING, "node_uuid", 0, "", "uuid of node"),
|
|
1961
|
+
v(h.DTP_STRING, "yuno_role", 0, "", "Yuno role"),
|
|
1962
|
+
v(h.DTP_STRING, "yuno_id", 0, "", "Yuno Id. Set by agent"),
|
|
1963
|
+
v(h.DTP_STRING, "yuno_name", 0, "", "Yuno name. Set by agent"),
|
|
1964
|
+
v(h.DTP_STRING, "yuno_tag", 0, "", "Tags of yuno. Set by agent"),
|
|
1965
|
+
v(h.DTP_STRING, "yuno_release", 0, "", "Yuno Release. Set by agent"),
|
|
1966
|
+
v(h.DTP_STRING, "yuno_version", 0, "", "Yuno version (APP_VERSION)"),
|
|
1967
|
+
v(h.DTP_STRING, "yuneta_version", 0, l, "Yuneta version"),
|
|
1968
|
+
v(h.DTP_LIST, "required_services", 0, "[]", "Required services"),
|
|
1969
|
+
v(h.DTP_INTEGER, "tracing", 0, 0, "Tracing level"),
|
|
1970
|
+
v(h.DTP_BOOLEAN, "trace_timer", 0, 0, "Trace timers"),
|
|
1971
|
+
v(h.DTP_BOOLEAN, "trace_inter_event", 0, 0, "Trace traffic"),
|
|
1972
|
+
v(h.DTP_POINTER, "trace_ievent_callback", 0, null, "Trace traffic callback"),
|
|
1973
|
+
v(h.DTP_BOOLEAN, "trace_creation", 0, 0, "Trace creation"),
|
|
1974
|
+
v(h.DTP_BOOLEAN, "trace_start_stop", 0, 0, "Trace start/stop"),
|
|
1975
|
+
v(h.DTP_BOOLEAN, "trace_subscriptions", 0, 0, "Trace subscription"),
|
|
1976
|
+
v(h.DTP_BOOLEAN, "trace_i18n", 0, 0, "Trace i18n"),
|
|
1977
|
+
v(h.DTP_BOOLEAN, "no_poll", 0, 0, "no poll"),
|
|
1978
|
+
v(h.DTP_BOOLEAN, "developer", 0, !1, "Developer mode enabled"),
|
|
1979
|
+
v(h.DTP_INTEGER, "periodic_timeout", 0, "1000", "Timeout periodic, in miliseconds."),
|
|
1980
1980
|
j()
|
|
1981
1981
|
], $r = { gobj_timer: null }, Cr = null;
|
|
1982
1982
|
function Lr(e, t, n, r) {
|
|
@@ -1985,7 +1985,7 @@
|
|
|
1985
1985
|
var Pr = {
|
|
1986
1986
|
mt_create: function(e) {
|
|
1987
1987
|
let t = e.priv;
|
|
1988
|
-
dt(e, "start_date", ar()), dt(e, "node_uuid", cr()), e.priv.gobj_timer =
|
|
1988
|
+
dt(e, "start_date", ar()), dt(e, "node_uuid", cr()), e.priv.gobj_timer = Te(Fe(e), "C_TIMER", {}, e), t.periodic_timeout = it(e, "periodic_timeout");
|
|
1989
1989
|
},
|
|
1990
1990
|
mt_writing: function(e, t) {},
|
|
1991
1991
|
mt_start: function(e) {
|
|
@@ -2004,21 +2004,21 @@
|
|
|
2004
2004
|
}
|
|
2005
2005
|
};
|
|
2006
2006
|
var Ur = "ievent_gate_stack", Fr = [
|
|
2007
|
-
v(
|
|
2008
|
-
v(
|
|
2009
|
-
v(
|
|
2010
|
-
v(
|
|
2011
|
-
v(
|
|
2012
|
-
v(
|
|
2013
|
-
v(
|
|
2014
|
-
v(
|
|
2015
|
-
v(
|
|
2016
|
-
v(
|
|
2017
|
-
v(
|
|
2018
|
-
v(
|
|
2019
|
-
v(
|
|
2020
|
-
v(
|
|
2021
|
-
v(
|
|
2007
|
+
v(h.DTP_STRING, "wanted_yuno_role", T.SDF_RD, "", "wanted yuno role"),
|
|
2008
|
+
v(h.DTP_STRING, "wanted_yuno_name", T.SDF_RD, "", "wanted yuno name"),
|
|
2009
|
+
v(h.DTP_STRING, "wanted_yuno_service", T.SDF_RD, "", "wanted yuno service"),
|
|
2010
|
+
v(h.DTP_STRING, "remote_yuno_role", T.SDF_RD, "", "confirmed remote yuno role"),
|
|
2011
|
+
v(h.DTP_STRING, "remote_yuno_name", T.SDF_RD, "", "confirmed remote yuno name"),
|
|
2012
|
+
v(h.DTP_STRING, "remote_yuno_service", T.SDF_RD, "", "confirmed remote yuno service"),
|
|
2013
|
+
v(h.DTP_STRING, "url", T.SDF_RD, "", "Url to connect"),
|
|
2014
|
+
v(h.DTP_STRING, "jwt", T.SDF_PERSIST, "", "JWT"),
|
|
2015
|
+
v(h.DTP_STRING, "cert_pem", T.SDF_PERSIST, "", "SSL server certification, PEM str format"),
|
|
2016
|
+
v(h.DTP_JSON, "extra_info", T.SDF_RD, "{}", "dict data set by user, added to the identity card msg."),
|
|
2017
|
+
v(h.DTP_LIST, "required_services", T.SDF_RD, "[]", "Services this LINK requires (identity card). Empty = the yuno's `required_services`, as before. A yuno with several links to DIFFERENT backends must set it per link: the yuno-wide list is the union, so every backend is told the service names of all the others."),
|
|
2018
|
+
v(h.DTP_INTEGER, "timeout_retry", T.SDF_RD, "5000", "First reconnect delay (ms). It BACKS OFF from here, doubling up to timeout_retry_max, and resets when a session is reached"),
|
|
2019
|
+
v(h.DTP_INTEGER, "timeout_retry_max", T.SDF_RD, "60000", "Cap of the reconnect backoff (ms). Set it equal to timeout_retry for the old fixed-interval behaviour"),
|
|
2020
|
+
v(h.DTP_INTEGER, "timeout_idack", T.SDF_RD, "5000", "timeout waiting idAck"),
|
|
2021
|
+
v(h.DTP_POINTER, "subscriber", 0, 0, "subscriber of output-events. If null then subscriber is the parent"),
|
|
2022
2022
|
j()
|
|
2023
2023
|
], Gr = {
|
|
2024
2024
|
url: null,
|
|
@@ -2032,14 +2032,14 @@
|
|
|
2032
2032
|
retry_ms: 0
|
|
2033
2033
|
}, Vr = null;
|
|
2034
2034
|
function Mr(e) {
|
|
2035
|
-
e.priv.websocket &&
|
|
2035
|
+
e.priv.websocket && qt("Websocket ALREADY setup");
|
|
2036
2036
|
const t = at(e, "url");
|
|
2037
2037
|
let n;
|
|
2038
2038
|
Qt(`====> Starting WebSocket to '${t}' (${Ve(e)})`);
|
|
2039
2039
|
try {
|
|
2040
2040
|
n = new WebSocket(t);
|
|
2041
2041
|
} catch (n) {
|
|
2042
|
-
return
|
|
2042
|
+
return qt(`${Ve(e)}: Cannot open WebSocket to '${t}', Error: ${n.message}`), null;
|
|
2043
2043
|
}
|
|
2044
2044
|
return n ? (n.onopen = () => {
|
|
2045
2045
|
vt(e, "EV_ON_OPEN", { url: t }, e);
|
|
@@ -2053,7 +2053,7 @@
|
|
|
2053
2053
|
url: t,
|
|
2054
2054
|
e: n
|
|
2055
2055
|
}, e));
|
|
2056
|
-
}, n) : (
|
|
2056
|
+
}, n) : (qt(`${Ve(e)}: Failed to initialize WebSocket.`), null);
|
|
2057
2057
|
}
|
|
2058
2058
|
function Wr(e, t = 1e3, n = "") {
|
|
2059
2059
|
let r = e.priv, o = r.websocket;
|
|
@@ -2062,7 +2062,7 @@
|
|
|
2062
2062
|
try {
|
|
2063
2063
|
o.close(t, n);
|
|
2064
2064
|
} catch (e) {
|
|
2065
|
-
|
|
2065
|
+
qt("Error closing WebSocket:", e.message);
|
|
2066
2066
|
}
|
|
2067
2067
|
} else zt("WebSocket is already closed or in the process of closing.");
|
|
2068
2068
|
}
|
|
@@ -2083,22 +2083,22 @@
|
|
|
2083
2083
|
return function(e, t) {
|
|
2084
2084
|
let n = e.priv, r = JSON.stringify(t);
|
|
2085
2085
|
if (st(Ce(), "trace_inter_event")) {
|
|
2086
|
-
let n = at(e, "url"), o = Fe(Ce()) + " ==> " + n,
|
|
2087
|
-
|
|
2086
|
+
let n = at(e, "url"), o = Fe(Ce()) + " ==> " + n, i = it(Ce(), "trace_ievent_callback");
|
|
2087
|
+
i ? i(o, t, 1, r.length) : Kr(0, o, t);
|
|
2088
2088
|
}
|
|
2089
2089
|
if (!n.websocket || n.websocket.readyState !== WebSocket.OPEN) return zt(`${Ve(e)}: send_iev(): websocket not open, message lost`), -1;
|
|
2090
2090
|
try {
|
|
2091
2091
|
n.websocket.send(r);
|
|
2092
2092
|
} catch (t) {
|
|
2093
|
-
|
|
2093
|
+
qt(`${Ve(e)}: send_iev(): ${t}`);
|
|
2094
2094
|
}
|
|
2095
2095
|
return 0;
|
|
2096
2096
|
}(e, function(e, t) {
|
|
2097
|
-
return
|
|
2097
|
+
return On(e) ? (qt("iev_create() event NULL"), null) : new xr(e, t);
|
|
2098
2098
|
}(t, n));
|
|
2099
2099
|
}
|
|
2100
2100
|
function Br(e, t, n) {
|
|
2101
|
-
return
|
|
2101
|
+
return On(n) && (n = at(e, "wanted_yuno_service")), {
|
|
2102
2102
|
dst_yuno: at(e, "wanted_yuno_name"),
|
|
2103
2103
|
dst_role: at(e, "wanted_yuno_role"),
|
|
2104
2104
|
dst_service: n,
|
|
@@ -2109,16 +2109,16 @@
|
|
|
2109
2109
|
};
|
|
2110
2110
|
}
|
|
2111
2111
|
function Jr(e) {
|
|
2112
|
-
let t = e.priv, n = $e(Ce()), r = at(Ce(), "yuno_version"), o = at(Ce(), "yuno_release"),
|
|
2113
|
-
s && s.length || (s =
|
|
2112
|
+
let t = e.priv, n = $e(Ce()), r = at(Ce(), "yuno_version"), o = at(Ce(), "yuno_release"), i = at(Ce(), "yuno_tag"), s = it(e, "required_services");
|
|
2113
|
+
s && s.length || (s = it(Ce(), "required_services"));
|
|
2114
2114
|
let _ = {
|
|
2115
2115
|
yuno_role: Pe(),
|
|
2116
2116
|
yuno_id: Ue(),
|
|
2117
2117
|
yuno_name: Le(),
|
|
2118
|
-
yuno_tag:
|
|
2118
|
+
yuno_tag: i,
|
|
2119
2119
|
yuno_version: r,
|
|
2120
2120
|
yuno_release: o,
|
|
2121
|
-
yuneta_version:
|
|
2121
|
+
yuneta_version: l,
|
|
2122
2122
|
playing: n,
|
|
2123
2123
|
pid: 0,
|
|
2124
2124
|
watcher_pid: 0,
|
|
@@ -2133,13 +2133,13 @@
|
|
|
2133
2133
|
};
|
|
2134
2134
|
return er(e, _, Ur, Br(e, Fe(We(e)), null)), nr(e, _, "__identity__"), Dr(t.gobj_timer, _t(e, "timeout_idack")), Yr(e, "EV_IDENTITY_CARD", _);
|
|
2135
2135
|
}
|
|
2136
|
-
function
|
|
2137
|
-
if (
|
|
2138
|
-
let n = {}, r = t.__global__, o = t.__config__,
|
|
2139
|
-
o && (n.__config__ = o), r && (n.__global__ = r),
|
|
2140
|
-
return er(e, n, Ur, Br(e, Fe(s),
|
|
2136
|
+
function Hr(e, t) {
|
|
2137
|
+
if (On(t.event)) return -1;
|
|
2138
|
+
let n = {}, r = t.__global__, o = t.__config__, i = t.__filter__, l = t.__service__, s = t.subscriber;
|
|
2139
|
+
o && (n.__config__ = o), r && (n.__global__ = r), i && (n.__filter__ = i);
|
|
2140
|
+
return er(e, n, Ur, Br(e, Fe(s), l)), nr(e, n, "__subscribing__"), Yr(e, t.event, n);
|
|
2141
2141
|
}
|
|
2142
|
-
function
|
|
2142
|
+
function qr(e, t, n, r) {
|
|
2143
2143
|
let o = e.priv;
|
|
2144
2144
|
return Ae(e) && (o.websocket = Mr(e)), 0;
|
|
2145
2145
|
}
|
|
@@ -2147,26 +2147,26 @@
|
|
|
2147
2147
|
return Qt("Websocket opened: " + e.priv.url), Jr(e), 0;
|
|
2148
2148
|
}
|
|
2149
2149
|
function Qr(e, t, n, r) {
|
|
2150
|
-
let o = e.priv,
|
|
2151
|
-
return Jt(), zt(`${Ve(e)}: WebSocket closed ${
|
|
2152
|
-
url:
|
|
2150
|
+
let o = e.priv, i = n.e, l = n.url;
|
|
2151
|
+
return Jt(), zt(`${Ve(e)}: WebSocket closed ${l} (Code: ${i.code}, Reason: "${i.reason}", Clean: ${i.wasClean})`), o.websocket && (o.websocket.onopen = null, o.websocket.onmessage = null, o.websocket.onerror = null, o.websocket.onclose = null, o.websocket = null), o.inform_on_close ? (o.inform_on_close = !1, Ct(e, "EV_ON_CLOSE", {
|
|
2152
|
+
url: l,
|
|
2153
2153
|
remote_yuno_name: o.remote_yuno_name,
|
|
2154
2154
|
remote_yuno_role: o.remote_yuno_role,
|
|
2155
2155
|
remote_yuno_service: o.remote_yuno_service
|
|
2156
|
-
})) : (zt(`${Ve(e)}: EV_ON_OPEN_ERROR cannot open ${
|
|
2157
|
-
url:
|
|
2156
|
+
})) : (zt(`${Ve(e)}: EV_ON_OPEN_ERROR cannot open ${l} (Code: ${i.code}, Reason: "${i.reason}", Clean: ${i.wasClean})`), Ct(e, "EV_ON_OPEN_ERROR", {
|
|
2157
|
+
url: l,
|
|
2158
2158
|
remote_yuno_name: o.remote_yuno_name,
|
|
2159
2159
|
remote_yuno_role: o.remote_yuno_role,
|
|
2160
2160
|
remote_yuno_service: o.remote_yuno_service,
|
|
2161
|
-
code:
|
|
2162
|
-
reason:
|
|
2163
|
-
was_clean:
|
|
2161
|
+
code: i.code,
|
|
2162
|
+
reason: i.reason,
|
|
2163
|
+
was_clean: i.wasClean
|
|
2164
2164
|
})), Ae(e) && Dr(o.gobj_timer, function(e) {
|
|
2165
2165
|
let t = e.priv, n = _t(e, "timeout_retry"), r = _t(e, "timeout_retry_max");
|
|
2166
2166
|
r < n && (r = n);
|
|
2167
2167
|
t.retry_ms = t.retry_ms ? Math.min(2 * t.retry_ms, r) : n;
|
|
2168
|
-
let o = .2 * t.retry_ms,
|
|
2169
|
-
return Math.max(1, Math.round(
|
|
2168
|
+
let o = .2 * t.retry_ms, i = t.retry_ms - o + 2 * Math.random() * o;
|
|
2169
|
+
return Math.max(1, Math.round(i));
|
|
2170
2170
|
}(e)), 0;
|
|
2171
2171
|
}
|
|
2172
2172
|
function Xr(e, t, n, r) {
|
|
@@ -2175,8 +2175,8 @@
|
|
|
2175
2175
|
function Zr(e, t, n, r) {
|
|
2176
2176
|
let o = e.priv;
|
|
2177
2177
|
kr(o.gobj_timer);
|
|
2178
|
-
let
|
|
2179
|
-
dt(e, "remote_yuno_name",
|
|
2178
|
+
let i = tr(e, n, Ur, !0), l = Ln(e, i, "src_yuno", ""), s = Ln(e, i, "src_role", ""), _ = Ln(e, i, "src_service", "");
|
|
2179
|
+
dt(e, "remote_yuno_name", l), dt(e, "remote_yuno_role", s), dt(e, "remote_yuno_service", _);
|
|
2180
2180
|
let a = Cn(e, n, "result", -1, 0), u = Ln(e, n, "comment", "", 0), c = Ln(e, n, "username", "", 0), f = Fn(e, n, "services_roles", {});
|
|
2181
2181
|
if (a < 0) {
|
|
2182
2182
|
Wr(e);
|
|
@@ -2185,7 +2185,7 @@
|
|
|
2185
2185
|
result: a,
|
|
2186
2186
|
comment: u,
|
|
2187
2187
|
username: c,
|
|
2188
|
-
remote_yuno_name:
|
|
2188
|
+
remote_yuno_name: l,
|
|
2189
2189
|
remote_yuno_role: s,
|
|
2190
2190
|
remote_yuno_service: _
|
|
2191
2191
|
};
|
|
@@ -2195,7 +2195,7 @@
|
|
|
2195
2195
|
o.inform_on_close = !0;
|
|
2196
2196
|
let t = {
|
|
2197
2197
|
username: c,
|
|
2198
|
-
remote_yuno_name:
|
|
2198
|
+
remote_yuno_name: l,
|
|
2199
2199
|
remote_yuno_role: s,
|
|
2200
2200
|
remote_yuno_service: _,
|
|
2201
2201
|
services_roles: f
|
|
@@ -2204,52 +2204,52 @@
|
|
|
2204
2204
|
}
|
|
2205
2205
|
o.inside_on_open = !1, function(e) {
|
|
2206
2206
|
let t = It(e, null, null, null);
|
|
2207
|
-
for (let n = 0; n < t.length; n++)
|
|
2207
|
+
for (let n = 0; n < t.length; n++) Hr(e, t[n]);
|
|
2208
2208
|
}(e);
|
|
2209
2209
|
}
|
|
2210
2210
|
return 0;
|
|
2211
2211
|
}
|
|
2212
2212
|
function eo(e, t, n, r) {
|
|
2213
|
-
let o = e.priv.url,
|
|
2213
|
+
let o = e.priv.url, i = function(e, t) {
|
|
2214
2214
|
let n;
|
|
2215
2215
|
try {
|
|
2216
2216
|
n = JSON.parse(t);
|
|
2217
2217
|
} catch (e) {
|
|
2218
|
-
return
|
|
2218
|
+
return qt("parsing inter_event json: " + e), null;
|
|
2219
2219
|
}
|
|
2220
|
-
if (!(n instanceof Object)) return
|
|
2220
|
+
if (!(n instanceof Object)) return qt("parsing inter_event: websocket data not a json object"), null;
|
|
2221
2221
|
let r = n.event;
|
|
2222
|
-
if (!r) return
|
|
2223
|
-
if ("string" != typeof r) return
|
|
2222
|
+
if (!r) return qt("parsing inter_event: no event"), null;
|
|
2223
|
+
if ("string" != typeof r) return qt("parsing inter_event: event not a string"), null;
|
|
2224
2224
|
let o = n.kw;
|
|
2225
2225
|
return o ? o instanceof Object ? {
|
|
2226
2226
|
event: r,
|
|
2227
2227
|
kw: o || {}
|
|
2228
|
-
} : (
|
|
2228
|
+
} : (qt("parsing inter_event: kw not a json object"), null) : (qt("parsing inter_kw: no kw"), null);
|
|
2229
2229
|
}(0, n.data);
|
|
2230
2230
|
if (st(Ce(), "trace_inter_event")) {
|
|
2231
|
-
let e = Fe(Ce()) + " <== " + o, t = n.data.length, r =
|
|
2232
|
-
r ? r(e,
|
|
2231
|
+
let e = Fe(Ce()) + " <== " + o, t = n.data.length, r = it(Ce(), "trace_ievent_callback");
|
|
2232
|
+
r ? r(e, i, 2, t) : Kr(0, e, i);
|
|
2233
2233
|
}
|
|
2234
|
-
let
|
|
2234
|
+
let l = i.event, s = i.kw;
|
|
2235
2235
|
if ("ST_SESSION" !== pt(e)) {
|
|
2236
|
-
if (Et(e,
|
|
2237
|
-
if (!(vt(e,
|
|
2238
|
-
} else
|
|
2236
|
+
if (Et(e, l, D.EVF_PUBLIC_EVENT)) {
|
|
2237
|
+
if (!(vt(e, l, s, e) < 0)) return 0;
|
|
2238
|
+
} else qt(`${Ve(e)}: event UNKNOWN in not-session state ${l}`);
|
|
2239
2239
|
return Wr(e), -1;
|
|
2240
2240
|
}
|
|
2241
|
-
|
|
2241
|
+
i = null;
|
|
2242
2242
|
let _ = rr(e, s), a = tr(e, s, Ur), u = Ln(e, a, "dst_role", "");
|
|
2243
|
-
if (u.toLowerCase() !== Pe().toLowerCase()) return
|
|
2243
|
+
if (u.toLowerCase() !== Pe().toLowerCase()) return qt(`"It's not my role, dst_role: ${u}, my_role: ${Pe()}`), 0;
|
|
2244
2244
|
let c = Ln(e, a, "dst_service", "");
|
|
2245
2245
|
if ("__subscribing__" === _) return -1;
|
|
2246
2246
|
if ("__unsubscribing__" === _) return -1;
|
|
2247
|
-
if (Et(e,
|
|
2248
|
-
if (!
|
|
2247
|
+
if (Et(e, l, D.EVF_PUBLIC_EVENT)) return vt(e, l, s, e), 0;
|
|
2248
|
+
if (!On(c)) {
|
|
2249
2249
|
let t = ge(c, !1);
|
|
2250
|
-
return t ? Et(t,
|
|
2250
|
+
return t ? Et(t, l, D.EVF_PUBLIC_EVENT) ? (vt(t, l, s, e), 0) : (qt(`${Ve(e)}: Service found but no event or not public, service '${Ve(t)}', ev '${l}'`), -1) : (zt(`${Ve(e)}: event for a service that is gone, DROPPED: service '${c}', ev '${l}'`), 0);
|
|
2251
2251
|
}
|
|
2252
|
-
return xe(e) ? vt(We(e),
|
|
2252
|
+
return xe(e) ? vt(We(e), l, s, e) : Ct(e, l, s), 0;
|
|
2253
2253
|
}
|
|
2254
2254
|
function to(e, t, n, r) {
|
|
2255
2255
|
return 0;
|
|
@@ -2260,7 +2260,7 @@
|
|
|
2260
2260
|
var ro = {
|
|
2261
2261
|
mt_create: function(e) {
|
|
2262
2262
|
let t = e.priv;
|
|
2263
|
-
t.gobj_timer =
|
|
2263
|
+
t.gobj_timer = Te(Fe(e), "C_TIMER", {}, e), t.url = at(e, "url"), t.remote_yuno_name = at(e, "remote_yuno_name"), t.remote_yuno_role = at(e, "remote_yuno_role"), t.remote_yuno_service = at(e, "remote_yuno_service"), dt(e, "wanted_yuno_name", t.remote_yuno_name), dt(e, "wanted_yuno_role", t.remote_yuno_role), dt(e, "wanted_yuno_service", t.remote_yuno_service);
|
|
2264
2264
|
const n = ut(e, "subscriber");
|
|
2265
2265
|
n && At(e, null, {}, n);
|
|
2266
2266
|
},
|
|
@@ -2289,21 +2289,21 @@
|
|
|
2289
2289
|
},
|
|
2290
2290
|
mt_destroy: function(e) {},
|
|
2291
2291
|
mt_stats: function(e, t, n, r) {
|
|
2292
|
-
if ("ST_SESSION" !== pt(e)) return
|
|
2292
|
+
if ("ST_SESSION" !== pt(e)) return qt("Not in session"), null;
|
|
2293
2293
|
n || (n = {});
|
|
2294
|
-
let o = Br(e, Fe(r), Ln(e, n, "service", null, 0)),
|
|
2295
|
-
return
|
|
2294
|
+
let o = Br(e, Fe(r), Ln(e, n, "service", null, 0)), i = Fn(e, n, "__md_stats__", null, Lt.KW_EXTRACT);
|
|
2295
|
+
return i || (i = {}), er(e, n, "stats_stack", {
|
|
2296
2296
|
stats: t,
|
|
2297
|
-
kw:
|
|
2297
|
+
kw: i
|
|
2298
2298
|
}), er(e, n, Ur, o), n.__stats__ = t, nr(e, n, "__stats__"), Yr(e, "EV_MT_STATS", n, r), null;
|
|
2299
2299
|
},
|
|
2300
2300
|
mt_command_parser: function(e, t, n, r) {
|
|
2301
|
-
if ("ST_SESSION" !== pt(e)) return
|
|
2301
|
+
if ("ST_SESSION" !== pt(e)) return qt("Not in session"), null;
|
|
2302
2302
|
n || (n = {});
|
|
2303
|
-
let o = Br(e, Fe(r), Ln(e, n, "service", "", 0)),
|
|
2304
|
-
return
|
|
2303
|
+
let o = Br(e, Fe(r), Ln(e, n, "service", "", 0)), i = Fn(e, n, "__md_command__", null, Lt.KW_EXTRACT);
|
|
2304
|
+
return i || (i = {}), er(e, n, "command_stack", {
|
|
2305
2305
|
command: t,
|
|
2306
|
-
kw:
|
|
2306
|
+
kw: i
|
|
2307
2307
|
}), er(e, n, Ur, o), n.__command__ = t, nr(e, n, "__command__"), Yr(e, "EV_MT_COMMAND", n, r), null;
|
|
2308
2308
|
},
|
|
2309
2309
|
mt_inject_event: function(e, t, n, r) {
|
|
@@ -2317,19 +2317,19 @@
|
|
|
2317
2317
|
},
|
|
2318
2318
|
mt_subscription_added: function(e, t) {
|
|
2319
2319
|
let n = e.priv;
|
|
2320
|
-
return "ST_SESSION" === pt(e) && n.websocket ? n.inside_on_open ? 0 :
|
|
2320
|
+
return "ST_SESSION" === pt(e) && n.websocket ? n.inside_on_open ? 0 : Hr(e, t) : 0;
|
|
2321
2321
|
},
|
|
2322
2322
|
mt_subscription_deleted: function(e, t) {
|
|
2323
2323
|
let n = e.priv;
|
|
2324
2324
|
if ("ST_SESSION" !== pt(e) || !n.websocket) return 0;
|
|
2325
2325
|
if (n.inside_on_open) return 0;
|
|
2326
|
-
if (
|
|
2327
|
-
let r = {}, o = t.__global__,
|
|
2328
|
-
|
|
2326
|
+
if (On(t.event)) return 0;
|
|
2327
|
+
let r = {}, o = t.__global__, i = t.__config__, l = t.__filter__, s = t.__service__, _ = t.subscriber;
|
|
2328
|
+
i && (r.__config__ = i), o && (r.__global__ = o), l && (r.__filter__ = l);
|
|
2329
2329
|
return er(e, r, Ur, Br(e, Fe(_), s)), nr(e, r, "__unsubscribing__"), Yr(e, t.event, r, e);
|
|
2330
2330
|
}
|
|
2331
2331
|
};
|
|
2332
|
-
e.GObj =
|
|
2332
|
+
e.GObj = S, e.SDATA = v, e.SDATAAUTHZ = (e, t, n, r, o, i) => new y(e, t, n, null, i, r, null, 0, null, o, null), e.SDATACM = (e, t, n, r, o, i) => new y(e, t, 0, null, i, n, null, 0, o, r, null), e.SDATACM2 = (e, t, n, r, o, i, l) => new y(e, t, n, null, l, r, null, 0, i, o, null), e.SDATADF = (e, t, n, r, o, i) => new y(e, t, n, null, i, null, r, o), e.SDATAPM = (e, t, n, r, o) => new y(e, t, n, r, o), e.SDATAPM0 = (e, t, n, r, o) => new y(e, t, n, null, o, null, null, 0, null, null, r), e.SDATA_END = j, e.SDataDesc = y, e.YUNETA_VERSION = l, Object.defineProperty(e, "__yuno__", {
|
|
2333
2333
|
enumerable: !0,
|
|
2334
2334
|
get: function() {
|
|
2335
2335
|
return p;
|
|
@@ -2338,25 +2338,25 @@
|
|
|
2338
2338
|
let t = "", n = 0;
|
|
2339
2339
|
for (let r of e) null != r && "" !== r && (r = String(r), r = 0 === n ? r.replace(/\/+$/, "") : r.replace(/^\/+/, "").replace(/\/+$/, ""), "" !== r && (n > 0 && (t += "/"), t += r, n++));
|
|
2340
2340
|
return t;
|
|
2341
|
-
}, e.build_stats_response =
|
|
2341
|
+
}, e.build_stats_response = i, e.clean_name = function(e) {
|
|
2342
2342
|
return e.replace(/[?# ^:]/g, "_");
|
|
2343
2343
|
}, e.clear_timeout = kr, e.cmp_two_simple_json = Rn, e.command_parser = function(e, t, n, r) {}, e.createElement2 = function e(t, n) {
|
|
2344
|
-
let [r, o,
|
|
2345
|
-
if (!r) return void
|
|
2344
|
+
let [r, o, i, l] = t;
|
|
2345
|
+
if (!r) return void qt("Tag must be a valid HTML element.");
|
|
2346
2346
|
let s = document.createElement(r), _ = "";
|
|
2347
2347
|
if (o && "object" == typeof o) for (let e of Object.keys(o)) if ("style" === e && "object" == typeof o[e]) {
|
|
2348
2348
|
let t = "";
|
|
2349
2349
|
for (const n of Object.keys(o[e])) t += `${n}: ${o[e][n]};`;
|
|
2350
2350
|
s.style.cssText = t;
|
|
2351
2351
|
} else "style" === e ? s.style.cssText = o[e] : "i18n" === e || "data-i18n" === e || "data_i18next" === e || "data-i18next" === e ? null !== o[e] && void 0 !== o[e] && (_ = o[e], s.setAttribute("data-i18n", _)) : s.setAttribute(e, o[e]);
|
|
2352
|
-
if (En(
|
|
2353
|
-
else if (n && _) s.textContent = n(_) ||
|
|
2354
|
-
else s.textContent =
|
|
2355
|
-
else if (mn(
|
|
2356
|
-
if (
|
|
2357
|
-
else for (let t of
|
|
2358
|
-
} else
|
|
2359
|
-
if (
|
|
2352
|
+
if (En(i)) if (i = i.trim(), i.length > 0 && "<" === i[0]) s.appendChild(_r(i));
|
|
2353
|
+
else if (n && _) s.textContent = n(_) || i;
|
|
2354
|
+
else s.textContent = i;
|
|
2355
|
+
else if (mn(i)) {
|
|
2356
|
+
if (i.length > 0) if (En(i[0])) s.appendChild(e(i, n));
|
|
2357
|
+
else for (let t of i) Array.isArray(t) && t.length > 0 ? s.appendChild(e(t, n)) : t instanceof HTMLElement && s.appendChild(t);
|
|
2358
|
+
} else i instanceof HTMLElement || i instanceof Text || i instanceof SVGElement ? s.appendChild(i) : null != i && (qt("content ignored"), Zt(i));
|
|
2359
|
+
if (l && "object" == typeof l) for (const e of Object.keys(l)) s.addEventListener(e, l[e]);
|
|
2360
2360
|
return s;
|
|
2361
2361
|
}, e.createOneHtml = _r, e.create_json_record = function(e, t) {
|
|
2362
2362
|
let n = en(e);
|
|
@@ -2366,38 +2366,38 @@
|
|
|
2366
2366
|
return t || (t = {}), Object.entries(e).forEach(([e, r]) => {
|
|
2367
2367
|
let o;
|
|
2368
2368
|
pn(r) && (o = r.default);
|
|
2369
|
-
let
|
|
2370
|
-
n[e] =
|
|
2369
|
+
let i = Fn(null, t, e, o);
|
|
2370
|
+
n[e] = i;
|
|
2371
2371
|
}), n;
|
|
2372
|
-
}, e.current_timestamp = ar, e.data_type_t =
|
|
2372
|
+
}, e.current_timestamp = ar, e.data_type_t = h, e.db_list_persistent_attrs = function(e, t) {
|
|
2373
2373
|
let n = Yn(Er(e), null, !1), r = {};
|
|
2374
2374
|
return n && pn(n) && (r = Kn(e, n, t, !1)), r;
|
|
2375
2375
|
}, e.db_load_persistent_attrs = function(e, t) {
|
|
2376
|
-
let n =
|
|
2376
|
+
let n = lt(e, T.SDF_PERSIST), r = Yn(Er(e), null, !1);
|
|
2377
2377
|
if (r && pn(r)) {
|
|
2378
2378
|
let o = Kn(e, r, t, !1);
|
|
2379
|
-
o = Kn(e, o, n, !1), ct(e, o,
|
|
2379
|
+
o = Kn(e, o, n, !1), ct(e, o, T.SDF_PERSIST);
|
|
2380
2380
|
}
|
|
2381
2381
|
}, e.db_remove_persistent_attrs = function(e, t) {
|
|
2382
2382
|
let n = xn(e, Yn(Er(e), null, !1), t, !1);
|
|
2383
2383
|
0 === gn(n) ? Jn(Er(e)) : Bn(Er(e), n);
|
|
2384
2384
|
}, e.db_save_persistent_attrs = function(e, t) {
|
|
2385
|
-
let n = Kn(e,
|
|
2385
|
+
let n = Kn(e, lt(e, T.SDF_PERSIST), t, !1), r = Yn(Er(e), null, !1);
|
|
2386
2386
|
return r && pn(r) && on(n, r), Bn(Er(e), n);
|
|
2387
2387
|
}, e.debounce = function(e, t = 0, n = !1) {
|
|
2388
|
-
let r = null, o = null,
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2388
|
+
let r = null, o = null, i = null;
|
|
2389
|
+
const l = (...l) => {
|
|
2390
|
+
i = this, o = l;
|
|
2391
2391
|
const s = n && !r;
|
|
2392
2392
|
clearTimeout(r), r = setTimeout(() => {
|
|
2393
|
-
r = null, n || e.apply(
|
|
2394
|
-
}, t), s && e.apply(
|
|
2393
|
+
r = null, n || e.apply(i, o);
|
|
2394
|
+
}, t), s && e.apply(i, o);
|
|
2395
2395
|
};
|
|
2396
|
-
return
|
|
2397
|
-
r && (clearTimeout(r), r = null, e.apply(
|
|
2398
|
-
},
|
|
2399
|
-
clearTimeout(r), r = null, o = null,
|
|
2400
|
-
},
|
|
2396
|
+
return l.flush = () => {
|
|
2397
|
+
r && (clearTimeout(r), r = null, e.apply(i, o));
|
|
2398
|
+
}, l.cancel = () => {
|
|
2399
|
+
clearTimeout(r), r = null, o = null, i = null;
|
|
2400
|
+
}, l;
|
|
2401
2401
|
}, e.delete_from_list = function(e, t) {
|
|
2402
2402
|
for (let n = 0; n < e.length; n++) if (t === e[n]) return e.splice(n, 1), !0;
|
|
2403
2403
|
return !1;
|
|
@@ -2410,7 +2410,7 @@
|
|
|
2410
2410
|
return t;
|
|
2411
2411
|
}, e.empty_json = function(e) {
|
|
2412
2412
|
return 0 === bn(e);
|
|
2413
|
-
}, e.empty_string =
|
|
2413
|
+
}, e.empty_string = On, e.escapeHtml = sr, e.event_flag_t = D, e.flat2json = function(e) {
|
|
2414
2414
|
if (null === e || "object" != typeof e || Array.isArray(e)) throw new Error("flat2json: a flat json is an object of id -> value");
|
|
2415
2415
|
let t = null;
|
|
2416
2416
|
for (const n of Object.keys(e)) {
|
|
@@ -2420,29 +2420,29 @@
|
|
|
2420
2420
|
const o = "number" == typeof r[0];
|
|
2421
2421
|
if (null === t) t = o ? [] : {};
|
|
2422
2422
|
else if (o !== Array.isArray(t)) throw new Error(`flat2json: '${n}' does not fit a ${Array.isArray(t) ? "array" : "object"} root`);
|
|
2423
|
-
let
|
|
2423
|
+
let i = t;
|
|
2424
2424
|
for (let t = 0; t < r.length; t++) {
|
|
2425
|
-
const o = r[t],
|
|
2426
|
-
if (
|
|
2427
|
-
if (
|
|
2425
|
+
const o = r[t], l = "number" == typeof o, s = t === r.length - 1, _ = !s && "number" == typeof r[t + 1];
|
|
2426
|
+
if (l && o > dr) throw new Error(`flat2json: array index ${o} over the limit (100000) in '${n}'`);
|
|
2427
|
+
if (l !== Array.isArray(i)) throw new Error(`flat2json: '${n}' uses a ${l ? "array index" : "key"} where the tree already has a ${Array.isArray(i) ? "array" : "object"}`);
|
|
2428
2428
|
if (s) {
|
|
2429
|
-
if (Array.isArray(
|
|
2430
|
-
for (;
|
|
2431
|
-
|
|
2429
|
+
if (Array.isArray(i)) {
|
|
2430
|
+
for (; i.length <= o;) i.push(null);
|
|
2431
|
+
i[o] = e[n];
|
|
2432
2432
|
} else {
|
|
2433
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
2434
|
-
|
|
2433
|
+
if (Object.prototype.hasOwnProperty.call(i, o)) throw new Error(`flat2json: '${n}' is written twice, or once as a value and once as a container`);
|
|
2434
|
+
i[o] = e[n];
|
|
2435
2435
|
}
|
|
2436
2436
|
break;
|
|
2437
2437
|
}
|
|
2438
2438
|
let a;
|
|
2439
|
-
if (Array.isArray(
|
|
2440
|
-
for (;
|
|
2441
|
-
a =
|
|
2442
|
-
} else a =
|
|
2439
|
+
if (Array.isArray(i)) {
|
|
2440
|
+
for (; i.length <= o;) i.push(null);
|
|
2441
|
+
a = i[o], null == a && (a = _ ? [] : {}, i[o] = a);
|
|
2442
|
+
} else a = i[o], void 0 === a && (a = _ ? [] : {}, i[o] = a);
|
|
2443
2443
|
if (null === a || "object" != typeof a) throw new Error(`flat2json: '${n}' walks through a value: the same id is a leaf and a container at once`);
|
|
2444
2444
|
if (_ !== Array.isArray(a)) throw new Error(`flat2json: '${n}' needs a ${_ ? "array" : "object"} where the tree already has a ${Array.isArray(a) ? "array" : "object"}`);
|
|
2445
|
-
|
|
2445
|
+
i = a;
|
|
2446
2446
|
}
|
|
2447
2447
|
}
|
|
2448
2448
|
return null === t ? {} : t;
|
|
@@ -2471,7 +2471,7 @@
|
|
|
2471
2471
|
return o;
|
|
2472
2472
|
}, e.flat_key_join = function(e) {
|
|
2473
2473
|
return Array.isArray(e) && 0 !== e.length ? e.map((e) => "number" == typeof e ? `[${e}]` : br(e)).join("`") : "";
|
|
2474
|
-
}, e.flat_key_split = pr, e.gclass_add_ev_action =
|
|
2474
|
+
}, e.flat_key_split = pr, e.gclass_add_ev_action = le, e.gclass_add_event_type = _e, e.gclass_add_state = ie, e.gclass_check_fsm = ue, e.gclass_create = te, e.gclass_event_type = ae, e.gclass_find_by_name = ce, e.gclass_flag_t = N, e.gclass_unregister = ne, e.getPositionRelativeToBody = function(e) {
|
|
2475
2475
|
if (!e) return {
|
|
2476
2476
|
top: 0,
|
|
2477
2477
|
left: 0,
|
|
@@ -2483,49 +2483,49 @@
|
|
|
2483
2483
|
left: 0,
|
|
2484
2484
|
width: 0,
|
|
2485
2485
|
height: 0
|
|
2486
|
-
},
|
|
2486
|
+
}, i = "undefined" != typeof window, l = i && (window.scrollY || document.documentElement?.scrollTop || document.body?.scrollTop) || 0, s = i && (window.scrollX || document.documentElement?.scrollLeft || document.body?.scrollLeft) || 0;
|
|
2487
2487
|
return {
|
|
2488
|
-
top: t +
|
|
2488
|
+
top: t + l,
|
|
2489
2489
|
left: n + s,
|
|
2490
2490
|
right: n + s + r,
|
|
2491
|
-
bottom: t +
|
|
2491
|
+
bottom: t + l + o
|
|
2492
2492
|
};
|
|
2493
2493
|
}, e.get_function_name = fr, e.get_now = function() {
|
|
2494
2494
|
return Math.floor(Date.now() / 1e3);
|
|
2495
2495
|
}, e.gobj_bottom_gobj = Be, e.gobj_change_parent = function(e, t) {
|
|
2496
|
-
return Ye(e) ? (
|
|
2497
|
-
}, e.gobj_change_state = bt, e.gobj_command = function(e, t, r,
|
|
2498
|
-
if (Ye(e)) return
|
|
2499
|
-
let
|
|
2500
|
-
return
|
|
2496
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), null) : t instanceof S ? (e.parent && e.parent.mt_child_removed && e.parent.mt_child_removed(e.parent, e), e.parent && (pe(e.parent, e), e.parent = null), be(t, e), t.mt_child_added && (Y(e) && Qt(n("👦👦🔵 child_added(%s): %s", Me(t), Ve(e))), t.mt_child_added(t, e)), 0) : (qt(`${Ve(e)}: gobj_change_parent() BAD TYPE of parent`), -1);
|
|
2497
|
+
}, e.gobj_change_state = bt, e.gobj_command = function(e, t, r, i) {
|
|
2498
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), -1;
|
|
2499
|
+
let l = p && _t(p, "tracing");
|
|
2500
|
+
return l && (L(n("🌀🌀 mach(%s%s), cmd: %s, src: %s", Ae(e) ? "" : "!!", Ve(e), t, Ve(i))), l > 1 && Zt(r)), e.gclass.gmt.mt_command_parser ? e.gclass.gmt.mt_command_parser(e, t, r, i) : e.gclass.command_table ? c ? c(e, t, r, i) : o(0, -1, n("%s: global command parser not available", Ve(e)), 0, 0) : o(0, -1, n("%s: command table not available", Ve(e)), 0, 0);
|
|
2501
2501
|
}, e.gobj_create = function(e, t, n, r) {
|
|
2502
|
-
return
|
|
2503
|
-
}, e.gobj_create2 =
|
|
2504
|
-
return
|
|
2505
|
-
}, e.gobj_create_pure_child =
|
|
2506
|
-
return
|
|
2502
|
+
return he(e, t, n, r, 0);
|
|
2503
|
+
}, e.gobj_create2 = he, e.gobj_create_default_service = function(e, t, n, r) {
|
|
2504
|
+
return he(e, t, n, r, w.gobj_flag_default_service | w.gobj_flag_autostart);
|
|
2505
|
+
}, e.gobj_create_pure_child = Te, e.gobj_create_service = function(e, t, n, r) {
|
|
2506
|
+
return he(e, t, n, r, w.gobj_flag_service);
|
|
2507
2507
|
}, e.gobj_create_volatil = function(e, t, n, r) {
|
|
2508
|
-
return
|
|
2508
|
+
return he(e, t, n, r, w.gobj_flag_volatil);
|
|
2509
2509
|
}, e.gobj_create_yuno = function(e, t, n) {
|
|
2510
|
-
return
|
|
2510
|
+
return he(e, t, n, null, w.gobj_flag_yuno);
|
|
2511
2511
|
}, e.gobj_current_state = pt, e.gobj_default_service = fe, e.gobj_deliver_posted_events = jt, e.gobj_destroy = ye, e.gobj_find_child = nt, e.gobj_find_gobj = function(e, t) {
|
|
2512
|
-
if (
|
|
2512
|
+
if (On(t)) return null;
|
|
2513
2513
|
const n = t.toLowerCase();
|
|
2514
2514
|
return "__default_service__" === n ? m : "__yuno__" === n || "__root__" === n ? p : rt(p, t);
|
|
2515
2515
|
}, e.gobj_find_service = ge, e.gobj_find_subscribings = $t, e.gobj_find_subscriptions = It, e.gobj_flag_t = w, e.gobj_full_name = Me, e.gobj_gclass_name = Ge, e.gobj_global_trace_level = function() {
|
|
2516
2516
|
return F;
|
|
2517
|
-
}, e.gobj_has_attr = ot, e.gobj_has_event = Et, e.gobj_has_output_event =
|
|
2517
|
+
}, e.gobj_has_attr = ot, e.gobj_has_event = Et, e.gobj_has_output_event = ht, e.gobj_hsdata = X, e.gobj_is_destroying = Ye, e.gobj_is_playing = $e, e.gobj_is_pure_child = xe, e.gobj_is_running = Ae, e.gobj_is_service = Ie, e.gobj_is_volatil = Ke, e.gobj_list_persistent_attrs = function(e, t) {
|
|
2518
2518
|
return u ? u(e, t) : null;
|
|
2519
2519
|
}, e.gobj_list_subscriptions = function(e) {
|
|
2520
2520
|
let t = It(e, null, null, null);
|
|
2521
2521
|
for (let n = 0; n < t.length; n++) {
|
|
2522
|
-
let r = t[n], o = Pn(e, r, "publisher", null, Lt.KW_REQUIRED),
|
|
2523
|
-
an(r, "s_event", Ln(e, r, "event", "", Lt.KW_REQUIRED)), an(r, "s_publisher", Ve(o)), an(r, "s_subscriber", Ve(
|
|
2522
|
+
let r = t[n], o = Pn(e, r, "publisher", null, Lt.KW_REQUIRED), i = Pn(e, r, "subscriber", null, Lt.KW_REQUIRED);
|
|
2523
|
+
an(r, "s_event", Ln(e, r, "event", "", Lt.KW_REQUIRED)), an(r, "s_publisher", Ve(o)), an(r, "s_subscriber", Ve(i));
|
|
2524
2524
|
}
|
|
2525
2525
|
let n = $t(e, 0, null, 0);
|
|
2526
2526
|
for (let t = 0; t < n.length; t++) {
|
|
2527
|
-
let r = n[t], o = Pn(e, r, "publisher", null, Lt.KW_REQUIRED),
|
|
2528
|
-
an(r, "s_event", Ln(e, r, "event", "", Lt.KW_REQUIRED)), an(r, "s_publisher", Ve(o)), an(r, "s_subscriber", Ve(
|
|
2527
|
+
let r = n[t], o = Pn(e, r, "publisher", null, Lt.KW_REQUIRED), i = Pn(e, r, "subscriber", null, Lt.KW_REQUIRED);
|
|
2528
|
+
an(r, "s_event", Ln(e, r, "event", "", Lt.KW_REQUIRED)), an(r, "s_publisher", Ve(o)), an(r, "s_subscriber", Ve(i));
|
|
2529
2529
|
}
|
|
2530
2530
|
return {
|
|
2531
2531
|
subscriptions: t,
|
|
@@ -2534,9 +2534,9 @@
|
|
|
2534
2534
|
total_subscribings: dn(n)
|
|
2535
2535
|
};
|
|
2536
2536
|
}, e.gobj_load_persistent_attrs = function(e, t) {
|
|
2537
|
-
return Ie(e) ? s ? s(e, t) : -1 : (
|
|
2537
|
+
return Ie(e) ? s ? s(e, t) : -1 : (qt(`${Ve(e)}: Only gobj services can load/save writable-persistent`), -1);
|
|
2538
2538
|
}, e.gobj_match_children = function(e, t) {
|
|
2539
|
-
if (Ye(e)) return
|
|
2539
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), null;
|
|
2540
2540
|
t = t || {};
|
|
2541
2541
|
let n = [];
|
|
2542
2542
|
const r = e.dl_children;
|
|
@@ -2551,21 +2551,21 @@
|
|
|
2551
2551
|
return function e(n, r) {
|
|
2552
2552
|
let o = r.dl_children;
|
|
2553
2553
|
for (let r = 0; r < o.length; r++) {
|
|
2554
|
-
let
|
|
2555
|
-
tt(
|
|
2554
|
+
let i = o[r];
|
|
2555
|
+
tt(i, t) && n.push(i), e(n, i);
|
|
2556
2556
|
}
|
|
2557
2557
|
}(n, e), n;
|
|
2558
2558
|
}, e.gobj_match_gobj = tt, e.gobj_name = Fe, e.gobj_parent = We, e.gobj_pause = De, e.gobj_play = Re, e.gobj_post_event = function(e, t, r, o) {
|
|
2559
|
-
return e && e instanceof
|
|
2559
|
+
return e && e instanceof S ? e.obflag & (R.obflag_destroyed | R.obflag_destroying) ? (qt(`gobj_post_event(): gobj dst DESTROYING, event ${t}`), -1) : On(t) ? (qt("gobj_post_event(): event EMPTY"), -1) : Et(e, t, 0) ? Tt.length >= 1e4 ? (qt(`gobj_post_event(): too many posted events, this is NOT a work queue, event ${t}, pending ${Tt.length}`), -1) : (Tt.push({
|
|
2560
2560
|
dst: e,
|
|
2561
2561
|
event: t,
|
|
2562
2562
|
kw: r,
|
|
2563
2563
|
src: o
|
|
2564
|
-
}), J(e, t) && !
|
|
2564
|
+
}), J(e, t) && !H(o, t) && L(n("📬 posted(%s%s), ev: %s, pending: %d", e.running ? "" : "!!", Ve(e), t, Tt.length)), yt || (yt = !0, setTimeout(jt, 0)), 0) : (qt(`gobj_post_event(): event NOT DEFINED in gclass ${Ge(e)}, event ${t}`), -1) : (qt(`gobj_post_event(): gobj dst NULL, event ${t}`), -1);
|
|
2565
2565
|
}, e.gobj_posted_events_size = function() {
|
|
2566
|
-
return
|
|
2567
|
-
}, e.gobj_publish_event = Ct, e.gobj_read_attr =
|
|
2568
|
-
return Ie(e) ? a ? a(e, t) : -1 : (
|
|
2566
|
+
return Tt.length;
|
|
2567
|
+
}, e.gobj_publish_event = Ct, e.gobj_read_attr = it, e.gobj_read_attrs = lt, e.gobj_read_bool_attr = st, e.gobj_read_integer_attr = _t, e.gobj_read_pointer_attr = ut, e.gobj_read_str_attr = at, e.gobj_remove_persistent_attrs = function(e, t) {
|
|
2568
|
+
return Ie(e) ? a ? a(e, t) : -1 : (qt(`${Ve(e)}: Only gobj services can load/save writable-persistent`), -1);
|
|
2569
2569
|
}, e.gobj_repr_global_trace_levels = function() {
|
|
2570
2570
|
return U.map(([e, t, n]) => ({
|
|
2571
2571
|
name: e,
|
|
@@ -2575,19 +2575,19 @@
|
|
|
2575
2575
|
}));
|
|
2576
2576
|
}, e.gobj_reset_volatil_attrs = function(e) {
|
|
2577
2577
|
return function(e, t, n) {
|
|
2578
|
-
if (Ye(e)) return
|
|
2578
|
+
if (Ye(e)) return qt("gobj NULL or DESTROYED"), -1;
|
|
2579
2579
|
let r = e.gclass.attrs_table;
|
|
2580
2580
|
for (let o = 0; o < r.length; o++) {
|
|
2581
|
-
const
|
|
2582
|
-
if (
|
|
2583
|
-
const t = z(e, e.jn_attrs,
|
|
2584
|
-
pn(e.priv) && e.priv.hasOwnProperty(
|
|
2581
|
+
const i = r[o];
|
|
2582
|
+
if (i.name && !(n && i.flag & n) && (-1 === t || i.flag & t)) {
|
|
2583
|
+
const t = z(e, e.jn_attrs, i);
|
|
2584
|
+
pn(e.priv) && e.priv.hasOwnProperty(i.name) && (e.priv[i.name] = t), e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, i.name);
|
|
2585
2585
|
}
|
|
2586
2586
|
}
|
|
2587
2587
|
return 0;
|
|
2588
|
-
}(e,
|
|
2588
|
+
}(e, T.SDF_VOLATIL, 0);
|
|
2589
2589
|
}, e.gobj_save_persistent_attrs = function(e, t) {
|
|
2590
|
-
return Ie(e) ? _ ? _(e, t) : -1 : (
|
|
2590
|
+
return Ie(e) ? _ ? _(e, t) : -1 : (qt(`${Ve(e)}: Only gobj services can load/save writable-persistent`), -1);
|
|
2591
2591
|
}, e.gobj_search_path = rt, e.gobj_send_event = vt, e.gobj_services = function() {
|
|
2592
2592
|
let e = [];
|
|
2593
2593
|
for (const t of Object.keys(b)) cn(e, t);
|
|
@@ -2596,12 +2596,12 @@
|
|
|
2596
2596
|
return V = Number(e) || 0, 0;
|
|
2597
2597
|
}, e.gobj_set_gclass_no_trace = function(e, t, n) {
|
|
2598
2598
|
const r = En(e) ? ce(e) : e;
|
|
2599
|
-
if (!r) return
|
|
2599
|
+
if (!r) return qt(`gobj_set_gclass_no_trace: gclass NOT FOUND: ${e}`), -1;
|
|
2600
2600
|
const o = M(t, "gobj_set_gclass_no_trace");
|
|
2601
2601
|
return o ? (n ? r.no_trace_level |= o : r.no_trace_level &= ~o, 0) : -1;
|
|
2602
2602
|
}, e.gobj_set_gclass_trace = function(e, t, n) {
|
|
2603
2603
|
const r = En(e) ? ce(e) : e;
|
|
2604
|
-
if (!r) return
|
|
2604
|
+
if (!r) return qt(`gobj_set_gclass_trace: gclass NOT FOUND: ${e}`), -1;
|
|
2605
2605
|
const o = M(t, "gobj_set_gclass_trace");
|
|
2606
2606
|
return o ? (n ? r.trace_level |= o : r.trace_level &= ~o, 0) : -1;
|
|
2607
2607
|
}, e.gobj_set_global_no_trace = function(e, t) {
|
|
@@ -2611,21 +2611,21 @@
|
|
|
2611
2611
|
const n = M(e, "gobj_set_global_trace");
|
|
2612
2612
|
return n ? (t ? F |= n : F &= ~n, 0) : -1;
|
|
2613
2613
|
}, e.gobj_set_gobj_no_trace = function(e, t, n) {
|
|
2614
|
-
if (!e) return
|
|
2614
|
+
if (!e) return qt("gobj_set_gobj_no_trace: gobj NULL"), -1;
|
|
2615
2615
|
const r = M(t, "gobj_set_gobj_no_trace");
|
|
2616
2616
|
return r ? (n ? e.no_trace_level |= r : e.no_trace_level &= ~r, 0) : -1;
|
|
2617
2617
|
}, e.gobj_set_gobj_trace = function(e, t, n) {
|
|
2618
|
-
if (!e) return
|
|
2618
|
+
if (!e) return qt("gobj_set_gobj_trace: gobj NULL"), -1;
|
|
2619
2619
|
const r = M(t, "gobj_set_gobj_trace");
|
|
2620
2620
|
return r ? (n ? e.trace_level |= r : e.trace_level &= ~r, 0) : -1;
|
|
2621
2621
|
}, e.gobj_set_trace_machine_format = function(e) {
|
|
2622
2622
|
C = 1 === Number(e) ? 1 : 0;
|
|
2623
2623
|
}, e.gobj_short_name = Ve, e.gobj_start = je, e.gobj_start_children = function(e) {
|
|
2624
|
-
return Ye(e) ? (
|
|
2624
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), -1) : qe(e, A.WALK_FIRST2LAST, ve, 0, 0);
|
|
2625
2625
|
}, e.gobj_start_tree = function(e) {
|
|
2626
|
-
return Ye(e) ? (
|
|
2627
|
-
}, e.gobj_start_up = function(e, t, n, r, o,
|
|
2628
|
-
s = t, _ = n, a = r, u = o, c =
|
|
2626
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), -1) : (B(e) && L(n("⏺ ⏺ ⏺ ⏺ start_tree: %s", Me(e))), e.gclass.gclass_flag & N.gcflag_manual_start || e.disabled ? 0 : (e.running || je(e), ze(e, A.WALK_TOP2BOTTOM, Oe, 0, 0)));
|
|
2627
|
+
}, e.gobj_start_up = function(e, t, n, r, o, i, l) {
|
|
2628
|
+
s = t, _ = n, a = r, u = o, c = i, f = l;
|
|
2629
2629
|
const d = [["EV_STATE_CHANGED", D.EVF_SYSTEM_EVENT | D.EVF_OUTPUT_EVENT | D.EVF_NO_WARN_SUBS], [0, 0]];
|
|
2630
2630
|
for (let e = 0; e < d.length; e++) {
|
|
2631
2631
|
let t = d[e][0], n = d[e][1];
|
|
@@ -2633,14 +2633,14 @@
|
|
|
2633
2633
|
}
|
|
2634
2634
|
return 0;
|
|
2635
2635
|
}, e.gobj_stats = function(e, t, r, o) {
|
|
2636
|
-
return Ye(e) ? (
|
|
2637
|
-
}, e.gobj_stop =
|
|
2638
|
-
return Ye(e) ? (
|
|
2636
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), -1) : e.gclass.gmt.mt_stats ? e.gclass.gmt.mt_stats(e, t, r, o) : f ? f(e, t, r, o) : i(0, -1, n("%s, stats parser not available", Ve(e)), 0, 0);
|
|
2637
|
+
}, e.gobj_stop = Se, e.gobj_stop_children = we, e.gobj_stop_tree = function(e) {
|
|
2638
|
+
return Ye(e) ? (qt("gobj NULL or DESTROYED"), -1) : (B(e) && L(n("⏹ ⏹ ⏹ ⏹ stop_tree: %s", Me(e))), Ae(e) && Se(e), ze(e, A.WALK_TOP2BOTTOM, Ne, 0, 0));
|
|
2639
2639
|
}, e.gobj_subscribe_event = At, e.gobj_trace_level = W, e.gobj_trace_machine_format = function() {
|
|
2640
2640
|
return C;
|
|
2641
2641
|
}, e.gobj_trace_no_level = K, e.gobj_unsubscribe_event = function(e, t, n, r) {
|
|
2642
|
-
if (null == n && (n = {}), !e) return
|
|
2643
|
-
if (!r) return
|
|
2642
|
+
if (null == n && (n = {}), !e) return qt(`publisher NULL: ev ${t}`), 0;
|
|
2643
|
+
if (!r) return qt(`subscriber NULL: ev ${t}`), 0;
|
|
2644
2644
|
const o = /* @__PURE__ */ new Set([
|
|
2645
2645
|
"__config__",
|
|
2646
2646
|
"__global__",
|
|
@@ -2649,59 +2649,59 @@
|
|
|
2649
2649
|
"__service__"
|
|
2650
2650
|
]);
|
|
2651
2651
|
if (Object.keys(n).forEach((n) => {
|
|
2652
|
-
o.has(n) ||
|
|
2653
|
-
}),
|
|
2654
|
-
else if (!(
|
|
2655
|
-
let
|
|
2656
|
-
for (let t = 0; t <
|
|
2657
|
-
let n =
|
|
2658
|
-
Dt(e, n, !1, !1),
|
|
2659
|
-
}
|
|
2660
|
-
return
|
|
2661
|
-
}, e.gobj_unsubscribe_list = kt, e.gobj_walk_gobj_children =
|
|
2662
|
-
if (!En(t)) return
|
|
2663
|
-
let
|
|
2652
|
+
o.has(n) || qt(`${Ve(e)}: key ignored in subscription (key: ${n}, event: ${t})`);
|
|
2653
|
+
}), On(t)) t = "";
|
|
2654
|
+
else if (!(ht(e, t, D.EVF_OUTPUT_EVENT) || e.gclass.gclass_flag & N.gcflag_no_check_output_events)) return qt(`event NOT in output event list: ${Ve(e)}, ev ${t}`), 0;
|
|
2655
|
+
let i = wt(e.dl_subscriptions, e, t, n, r), l = 0;
|
|
2656
|
+
for (let t = 0; t < i.length; t++) {
|
|
2657
|
+
let n = i[t];
|
|
2658
|
+
Dt(e, n, !1, !1), l++;
|
|
2659
|
+
}
|
|
2660
|
+
return l || (zt(`${Ve(e)}: No subscription found`), Zt(n, "No subscription found")), 0;
|
|
2661
|
+
}, e.gobj_unsubscribe_list = kt, e.gobj_walk_gobj_children = qe, e.gobj_walk_gobj_children_tree = ze, e.gobj_write_attr = function(e, t, r, o) {
|
|
2662
|
+
if (!En(t)) return qt(n("gobj_write_attr(%s): path must be a string", Ve(e))), -1;
|
|
2663
|
+
let i, l = e.jn_attrs, s = t.split("`");
|
|
2664
2664
|
if (s.length <= 1) {
|
|
2665
2665
|
let o = t;
|
|
2666
|
-
return o in
|
|
2666
|
+
return o in l && l.hasOwnProperty(o) ? (l[o] = r, pn(e.priv) && e.priv.hasOwnProperty(o) && (e.priv[o] = r), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.gclass.gmt.mt_writing && e.gclass.gmt.mt_writing(e, o), 0) : (qt(n("gobj_write_attr(%s): attr not found '%s'", Ve(e), o)), -1);
|
|
2667
2667
|
}
|
|
2668
2668
|
let _ = s.length;
|
|
2669
2669
|
for (let t = 0; t < _; t++) {
|
|
2670
|
-
|
|
2671
|
-
let n = nt(e, { __gobj_name__:
|
|
2670
|
+
i = s[t];
|
|
2671
|
+
let n = nt(e, { __gobj_name__: i });
|
|
2672
2672
|
if (n && t < _ - 1) {
|
|
2673
2673
|
e = n;
|
|
2674
2674
|
continue;
|
|
2675
2675
|
}
|
|
2676
2676
|
let o = e.jn_attrs;
|
|
2677
|
-
if (
|
|
2677
|
+
if (i in o && o.hasOwnProperty(i)) return o[i] = r, pn(e.priv) && e.priv.hasOwnProperty(i) && (e.priv[i] = r), e.obflag & R.obflag_created && !(e.obflag & R.obflag_destroyed) && e.mt_writing && e.mt_writing(e, i), 0;
|
|
2678
2678
|
break;
|
|
2679
2679
|
}
|
|
2680
|
-
return
|
|
2681
|
-
}, e.gobj_write_attrs = ct, e.gobj_write_bool_attr = ft, e.gobj_write_integer_attr = gt, e.gobj_write_str_attr = dt, e.gobj_yuno = Ce, e.gobj_yuno_id = Ue, e.gobj_yuno_name = Le, e.gobj_yuno_role = Pe, e.id_index_in_obj_list = zn, e.index_in_list = ur, e.is_array = mn, e.is_boolean =
|
|
2680
|
+
return qt(n("gobj_write_attr(%s): attr not found '%s'", Ve(e), i)), -1;
|
|
2681
|
+
}, e.gobj_write_attrs = ct, e.gobj_write_bool_attr = ft, e.gobj_write_integer_attr = gt, e.gobj_write_str_attr = dt, e.gobj_yuno = Ce, e.gobj_yuno_id = Ue, e.gobj_yuno_name = Le, e.gobj_yuno_role = Pe, e.id_index_in_obj_list = zn, e.index_in_list = ur, e.is_array = mn, e.is_boolean = Tn, e.is_date = function(e) {
|
|
2682
2682
|
return e instanceof Date && !isNaN(e);
|
|
2683
2683
|
}, e.is_function = jn, e.is_gobj = vn, e.is_metadata_key = function(e) {
|
|
2684
2684
|
if (!En(e)) return !1;
|
|
2685
2685
|
let t;
|
|
2686
2686
|
for (t = 0; t < e.length && "_" === e[t] && !(t > 2); t++);
|
|
2687
2687
|
return 2 === t;
|
|
2688
|
-
}, e.is_null = yn, e.is_number =
|
|
2688
|
+
}, e.is_null = yn, e.is_number = hn, e.is_object = pn, e.is_private_key = function(e) {
|
|
2689
2689
|
if (!En(e)) return !1;
|
|
2690
2690
|
let t;
|
|
2691
2691
|
for (t = 0; t < e.length && "_" === e[t] && !(t > 2); t++);
|
|
2692
2692
|
return 1 === t;
|
|
2693
2693
|
}, e.is_pure_number = function(e) {
|
|
2694
|
-
if (
|
|
2694
|
+
if (hn(e)) return !0;
|
|
2695
2695
|
if (!En(e)) return !1;
|
|
2696
2696
|
const t = Number(e);
|
|
2697
2697
|
return !isNaN(t) && "" !== e.trim() && !isNaN(t);
|
|
2698
2698
|
}, e.is_string = En, e.jdb_delete = function(e, t, n, r) {
|
|
2699
2699
|
let o = Fn(null, Fn(null, e, "topics", null, 0), t, null, 0);
|
|
2700
|
-
if (!o) return
|
|
2701
|
-
if (
|
|
2702
|
-
let
|
|
2703
|
-
for (; (
|
|
2704
|
-
if (0 ===
|
|
2700
|
+
if (!o) return qt("jdb_delete: topic not found: " + t), null;
|
|
2701
|
+
if (On(r.id)) return qt("jdb_delete: record without id: " + r), Xt(r), null;
|
|
2702
|
+
let i, l = n.split("`"), s = o;
|
|
2703
|
+
for (; (i = l.shift()) && !On(i) && s;) pn(s) && (s = Fn(null, s, e.hook, null, 0)), s = ir(s, null, i, !1);
|
|
2704
|
+
if (0 === l.length && s) if (mn(s)) {
|
|
2705
2705
|
let e = zn(s, r.id);
|
|
2706
2706
|
e >= 0 && s.splice(e, 1);
|
|
2707
2707
|
} else {
|
|
@@ -2711,32 +2711,32 @@
|
|
|
2711
2711
|
return o;
|
|
2712
2712
|
}, e.jdb_get = function(e, t, n, r) {
|
|
2713
2713
|
let o = Fn(null, Fn(null, e, "topics", null, 0), t, null, 0);
|
|
2714
|
-
return o ? (void 0 === r && (r = !0),
|
|
2714
|
+
return o ? (void 0 === r && (r = !0), ir(o, e.hook, n, r)) : (qt("jdb_get: topic not found: " + t), null);
|
|
2715
2715
|
}, e.jdb_get_by_idx = function(e, t, n) {
|
|
2716
2716
|
let r = Fn(null, Fn(null, e, "topics", null, 0), t, null, 0);
|
|
2717
|
-
return r ? n < r.length ? r[n] : {} : (
|
|
2717
|
+
return r ? n < r.length ? r[n] : {} : (qt("jdb_get_by_idx: topic not found: " + t), null);
|
|
2718
2718
|
}, e.jdb_get_topic = function(e, t) {
|
|
2719
2719
|
let n = Fn(null, e, "topics", null, 0);
|
|
2720
|
-
if (!n) return
|
|
2721
|
-
return Fn(null, n, t, null, 0) || (
|
|
2720
|
+
if (!n) return qt("jdb topics section not found"), Xt(e), null;
|
|
2721
|
+
return Fn(null, n, t, null, 0) || (qt("jdb topic not found: " + t), Xt(n), null);
|
|
2722
2722
|
}, e.jdb_init = function(e, t, n) {
|
|
2723
2723
|
n && (e = en(e));
|
|
2724
2724
|
let r = Fn(null, e, "type", [], 1);
|
|
2725
2725
|
Ln(null, e, "hook", "data", 1);
|
|
2726
|
-
let o = Fn(null, e, "schema", {}, 1),
|
|
2726
|
+
let o = Fn(null, e, "schema", {}, 1), i = Fn(null, e, "topics", {}, 1);
|
|
2727
2727
|
return or(o, function(e, t, n, o) {
|
|
2728
|
-
"__" !== t.substring(0, 2) && Fn(null,
|
|
2728
|
+
"__" !== t.substring(0, 2) && Fn(null, i, o, en(r), 1);
|
|
2729
2729
|
}, t), e;
|
|
2730
2730
|
}, e.jdb_update = function(e, t, n, r) {
|
|
2731
2731
|
let o = Fn(null, Fn(null, e, "topics", null, 0), t, null, 0);
|
|
2732
|
-
if (!o) return
|
|
2733
|
-
if (
|
|
2734
|
-
let
|
|
2735
|
-
for (; (
|
|
2736
|
-
if (0 ===
|
|
2732
|
+
if (!o) return qt("jdb_update: topic not found: " + t), null;
|
|
2733
|
+
if (On(r.id)) return qt("jdb_update: record without id: " + r), Xt(r), null;
|
|
2734
|
+
let i, l = n.split("`"), s = o;
|
|
2735
|
+
for (; (i = l.shift()) && !On(i) && s;) pn(s) && (s = Fn(null, s, e.hook, [], 1)), s = ir(s, null, i, !1);
|
|
2736
|
+
if (0 === l.length && s) if (mn(s)) s.push(r);
|
|
2737
2737
|
else if (s.id === r.id) Object.assign(s, r);
|
|
2738
2738
|
else {
|
|
2739
|
-
let t = Fn(null, s, e.hook, [], 1), n =
|
|
2739
|
+
let t = Fn(null, s, e.hook, [], 1), n = ir(t, e.hook, r.id, !1);
|
|
2740
2740
|
n ? Object.assign(n, r) : t.push(r);
|
|
2741
2741
|
}
|
|
2742
2742
|
return o;
|
|
@@ -2745,15 +2745,15 @@
|
|
|
2745
2745
|
if (o > gr) throw new Error("json2flat: deeper than 256");
|
|
2746
2746
|
if (null === e || "object" != typeof e || Array.isArray(e)) {
|
|
2747
2747
|
if (Array.isArray(e) && e.length > 0) return void e.forEach((e, t) => {
|
|
2748
|
-
const
|
|
2749
|
-
n(e, 0 === o ?
|
|
2748
|
+
const i = `[${t}]`;
|
|
2749
|
+
n(e, 0 === o ? i : r + "`" + i, o + 1);
|
|
2750
2750
|
});
|
|
2751
2751
|
} else {
|
|
2752
2752
|
const t = Object.keys(e);
|
|
2753
2753
|
if (t.length > 0) {
|
|
2754
|
-
for (const
|
|
2755
|
-
const t = br(
|
|
2756
|
-
n(e[
|
|
2754
|
+
for (const i of t) {
|
|
2755
|
+
const t = br(i);
|
|
2756
|
+
n(e[i], 0 === o ? t : r + "`" + t, o + 1);
|
|
2757
2757
|
}
|
|
2758
2758
|
return;
|
|
2759
2759
|
}
|
|
@@ -2765,7 +2765,7 @@
|
|
|
2765
2765
|
return t ? (Array.prototype.push.apply(e, t), e) : e;
|
|
2766
2766
|
}, e.json_array_remove = fn, e.json_array_size = dn, e.json_deep_copy = en, e.json_is_identical = tn, e.json_object_del = sn, e.json_object_get = ln, e.json_object_set = _n, e.json_object_set_new = an, e.json_object_size = gn, e.json_object_update = nn, e.json_object_update_existing = rn, e.json_object_update_missing = on, e.json_size = bn, e.jwt2json = function(e, t) {
|
|
2767
2767
|
try {
|
|
2768
|
-
let n =
|
|
2768
|
+
let n = lr(e);
|
|
2769
2769
|
switch (t) {
|
|
2770
2770
|
case "header": return JSON.parse(n.header);
|
|
2771
2771
|
case "signature": return JSON.parse(n.signature);
|
|
@@ -2774,122 +2774,133 @@
|
|
|
2774
2774
|
} catch (e) {
|
|
2775
2775
|
return null;
|
|
2776
2776
|
}
|
|
2777
|
-
}, e.jwtDecode =
|
|
2778
|
-
if (e && !vn(e) &&
|
|
2777
|
+
}, e.jwtDecode = lr, e.kw_clone_by_keys = Kn, e.kw_clone_by_not_keys = xn, e.kw_collect = function(e, t, n, r) {
|
|
2778
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !t) return null;
|
|
2779
2779
|
r || (r = Wn);
|
|
2780
2780
|
let o = [];
|
|
2781
2781
|
if (mn(t)) for (let e = 0; e < t.length; e++) {
|
|
2782
|
-
let
|
|
2783
|
-
r(
|
|
2782
|
+
let i = t[e];
|
|
2783
|
+
r(i, n) && o.push(i);
|
|
2784
2784
|
}
|
|
2785
2785
|
else {
|
|
2786
|
-
if (!pn(t)) return
|
|
2786
|
+
if (!pn(t)) return qt("kw_select() BAD kw parameter"), null;
|
|
2787
2787
|
r(t, n) && o.push(t);
|
|
2788
2788
|
}
|
|
2789
2789
|
return o;
|
|
2790
2790
|
}, e.kw_delete = In, e.kw_find_json_in_list = function(e, t, n, r) {
|
|
2791
|
-
if (!n || !mn(t)) return r &&
|
|
2791
|
+
if (!n || !mn(t)) return r && qt("item NULL or kw_list is not a list"), -1;
|
|
2792
2792
|
for (let e = 0; e < t.length; e++) if (tn(n, t[e])) return e;
|
|
2793
|
-
return r &&
|
|
2793
|
+
return r && qt("item not found in this list"), -1;
|
|
2794
2794
|
}, e.kw_find_path = kn, e.kw_flag_t = Lt, e.kw_get_bool = $n, e.kw_get_dict = Un, e.kw_get_dict_value = Fn, e.kw_get_int = Cn, e.kw_get_list = function(e, t, n, r, o) {
|
|
2795
|
-
e && !vn(e) &&
|
|
2796
|
-
let
|
|
2797
|
-
const
|
|
2798
|
-
if (void 0 ===
|
|
2795
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
2796
|
+
let i = kn(e, t, n, !1);
|
|
2797
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
2798
|
+
if (void 0 === i) {
|
|
2799
2799
|
if (s) {
|
|
2800
2800
|
let o = Array(r);
|
|
2801
2801
|
return Gn(e, t, n, o), o;
|
|
2802
2802
|
}
|
|
2803
|
-
return
|
|
2803
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), Array(r);
|
|
2804
2804
|
}
|
|
2805
|
-
return _ && In(e, t, n), mn(
|
|
2805
|
+
return _ && In(e, t, n), mn(i) ? Array(i) : (l && (qt(`path value MUST BE an array: ${n}`), Xt(t)), Array(r));
|
|
2806
2806
|
}, e.kw_get_local_storage_value = Yn, e.kw_get_pointer = Pn, e.kw_get_real = function(e, t, n, r, o) {
|
|
2807
|
-
e && !vn(e) &&
|
|
2808
|
-
let
|
|
2809
|
-
const
|
|
2810
|
-
if (void 0 ===
|
|
2807
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
2808
|
+
let i = kn(e, t, n, !1);
|
|
2809
|
+
const l = o && o & Lt.KW_REQUIRED, s = o && o & Lt.KW_CREATE, _ = o && o & Lt.KW_EXTRACT;
|
|
2810
|
+
if (void 0 === i) {
|
|
2811
2811
|
if (s) {
|
|
2812
2812
|
let o = Number(r);
|
|
2813
2813
|
return Gn(e, t, n, o), o;
|
|
2814
2814
|
}
|
|
2815
|
-
return
|
|
2815
|
+
return l && (qt(`path not found: '${n}'`), Zt(t)), Number(r);
|
|
2816
2816
|
}
|
|
2817
|
-
return _ && In(e, t, n),
|
|
2817
|
+
return _ && In(e, t, n), hn(i) ? Number(i) : (l && (qt(`path value MUST BE a number: ${n}`), Xt(t)), Number(r));
|
|
2818
2818
|
}, e.kw_get_str = Ln, e.kw_has_key = An, e.kw_match_simple = Wn, e.kw_pop = Dn, e.kw_remove_local_storage_value = Jn, e.kw_select = function(e, t, n, r) {
|
|
2819
|
-
if (e && !vn(e) &&
|
|
2819
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !t) return null;
|
|
2820
2820
|
r || (r = Wn);
|
|
2821
2821
|
let o = [];
|
|
2822
2822
|
if (mn(t)) for (let e = 0; e < t.length; e++) {
|
|
2823
|
-
let
|
|
2824
|
-
r(
|
|
2823
|
+
let i = t[e];
|
|
2824
|
+
r(i, n) && o.push(en(i));
|
|
2825
2825
|
}
|
|
2826
2826
|
else {
|
|
2827
|
-
if (!pn(t)) return
|
|
2827
|
+
if (!pn(t)) return qt("kw_select() BAD kw parameter"), null;
|
|
2828
2828
|
r(t, n) && o.push(en(t));
|
|
2829
2829
|
}
|
|
2830
2830
|
return o;
|
|
2831
|
-
}, e.kw_set_dict_value = Gn, e.kw_set_local_storage_value = Bn, e.kw_set_subdict_value = Vn, e.kwid_collect =
|
|
2832
|
-
e && !vn(e) &&
|
|
2833
|
-
let
|
|
2834
|
-
return
|
|
2831
|
+
}, e.kw_set_dict_value = Gn, e.kw_set_local_storage_value = Bn, e.kw_set_subdict_value = Vn, e.kwid_collect = qn, e.kwid_find_one_record = function(e, t, n, r, o) {
|
|
2832
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
2833
|
+
let i = qn(e, t, n, r, o);
|
|
2834
|
+
return i && 0 !== i.length ? i[0] : null;
|
|
2835
2835
|
}, e.kwid_get_ids = function(e, t) {
|
|
2836
|
-
if (e && !vn(e) &&
|
|
2836
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), !t) return [];
|
|
2837
2837
|
let n = [];
|
|
2838
2838
|
if (En(t)) n.push(t);
|
|
2839
2839
|
else if (pn(t)) for (let e in t) t.hasOwnProperty(e) && n.push(e);
|
|
2840
2840
|
else mn(t) && t.forEach(function(t) {
|
|
2841
|
-
if (En(t))
|
|
2841
|
+
if (En(t)) On(t) || n.push(t);
|
|
2842
2842
|
else if (pn(t)) {
|
|
2843
2843
|
let r = Ln(e, t, "id", 0, 0);
|
|
2844
2844
|
r && n.push(r);
|
|
2845
2845
|
}
|
|
2846
2846
|
});
|
|
2847
2847
|
return n;
|
|
2848
|
-
}, e.kwid_match_id =
|
|
2849
|
-
e && !vn(e) &&
|
|
2848
|
+
}, e.kwid_match_id = Hn, e.kwid_new_dict = function(e, t, n) {
|
|
2849
|
+
e && !vn(e) && qt("GObj bad instanceof");
|
|
2850
2850
|
let r = {};
|
|
2851
|
-
if (
|
|
2851
|
+
if (On(n) || (t = kn(e, t, n)), pn(t)) r = t;
|
|
2852
2852
|
else if (mn(t)) for (let n = 0; n < t.length; n++) {
|
|
2853
|
-
let o = t[n],
|
|
2854
|
-
|
|
2853
|
+
let o = t[n], i = Ln(e, o, "id", "", Lt.KW_REQUIRED);
|
|
2854
|
+
On(i) || (r[i] = o);
|
|
2855
2855
|
}
|
|
2856
|
-
else
|
|
2856
|
+
else qt(`${Ve(e)} kwid_new_dict: data type unknown`);
|
|
2857
2857
|
return r;
|
|
2858
|
+
}, e.kwid_new_list = function(e, t, n) {
|
|
2859
|
+
if (e && !vn(e) && qt("GObj bad instanceof"), On(n) || (t = kn(e, t, n)), mn(t)) return t;
|
|
2860
|
+
if (pn(t)) {
|
|
2861
|
+
let n = [];
|
|
2862
|
+
for (let r of Object.keys(t)) {
|
|
2863
|
+
let o = t[r];
|
|
2864
|
+
pn(o) ? (o.id = r, n.push(o)) : qt(`${Ve(e)} kwid_new_list: not a record: '${r}'`);
|
|
2865
|
+
}
|
|
2866
|
+
return n;
|
|
2867
|
+
}
|
|
2868
|
+
return qt(`${Ve(e)} kwid_new_list: wrong type for list`), [];
|
|
2858
2869
|
}, e.list2options = function(e, t, n) {
|
|
2859
2870
|
t = t || "id", n = n || "value";
|
|
2860
2871
|
let r = [];
|
|
2861
2872
|
if (mn(e)) for (let o = 0; o < e.length; o++) {
|
|
2862
|
-
let
|
|
2863
|
-
if (En(
|
|
2873
|
+
let i = e[o];
|
|
2874
|
+
if (En(i)) r.push({
|
|
2864
2875
|
id: e[o],
|
|
2865
2876
|
value: e[o]
|
|
2866
2877
|
});
|
|
2867
|
-
else if (pn(
|
|
2878
|
+
else if (pn(i)) {
|
|
2868
2879
|
let e = {};
|
|
2869
|
-
if (An(
|
|
2870
|
-
if (!An(
|
|
2871
|
-
if (!(bn(
|
|
2872
|
-
|
|
2880
|
+
if (An(i, t)) {
|
|
2881
|
+
if (!An(i, n)) {
|
|
2882
|
+
if (!(bn(i) > 0)) {
|
|
2883
|
+
qt("list2options(): object without field value: " + n);
|
|
2873
2884
|
continue;
|
|
2874
2885
|
}
|
|
2875
|
-
n = Object.keys(
|
|
2886
|
+
n = Object.keys(i)[0];
|
|
2876
2887
|
}
|
|
2877
|
-
e.id =
|
|
2888
|
+
e.id = i[t], e.value = i[n];
|
|
2878
2889
|
} else {
|
|
2879
|
-
if (!(bn(
|
|
2880
|
-
|
|
2890
|
+
if (!(bn(i) > 0)) {
|
|
2891
|
+
qt("list2options(): object without field id: " + t);
|
|
2881
2892
|
continue;
|
|
2882
2893
|
}
|
|
2883
|
-
t = Object.keys(
|
|
2894
|
+
t = Object.keys(i)[0], e.id = t, e.value = i[t];
|
|
2884
2895
|
}
|
|
2885
2896
|
r.push(e);
|
|
2886
|
-
} else
|
|
2897
|
+
} else qt("list2options(): case1 not implemented");
|
|
2887
2898
|
}
|
|
2888
2899
|
else if (pn(e)) for (let t of Object.keys(e)) r.push({
|
|
2889
2900
|
id: t,
|
|
2890
2901
|
value: t
|
|
2891
2902
|
});
|
|
2892
|
-
else
|
|
2903
|
+
else qt("list2options(): case2 not implemented");
|
|
2893
2904
|
return r;
|
|
2894
2905
|
}, e.load_json_file = function(e, t, n) {
|
|
2895
2906
|
let r = new XMLHttpRequest();
|
|
@@ -2897,36 +2908,42 @@
|
|
|
2897
2908
|
if (4 === r.readyState) if (200 === r.status || 0 === (e = r).status && e.responseText && e.responseURL.startsWith("file:")) try {
|
|
2898
2909
|
t(JSON.parse(r.responseText));
|
|
2899
2910
|
} catch (e) {
|
|
2900
|
-
n && (
|
|
2911
|
+
n && (qt(`JSON parse status ${r.status}, error: ${e.message}`), n(r.status));
|
|
2901
2912
|
}
|
|
2902
2913
|
else n && n(r.status);
|
|
2903
2914
|
var e;
|
|
2904
2915
|
}, r.send();
|
|
2905
|
-
}, e.log_debug = Qt, e.log_error =
|
|
2906
|
-
let t =
|
|
2916
|
+
}, e.log_debug = Qt, e.log_error = qt, e.log_info = function(e) {
|
|
2917
|
+
let t = Ht(e), n = ar();
|
|
2907
2918
|
Gt && xt("info", t) && Gt("%c" + n + " INFO: " + String(t), "color:cyan"), Bt("info", t, n);
|
|
2908
|
-
}, e.log_warning = zt, e.msg_iev_get_msg_type = rr, e.msg_iev_get_stack = tr, e.msg_iev_push_stack = er, e.msg_iev_read_key = Xn, e.msg_iev_set_msg_type = nr, e.msg_iev_write_key = Zn, e.node_uuid = cr, e.parseBoolean =
|
|
2919
|
+
}, e.log_warning = zt, e.msg_iev_get_msg_type = rr, e.msg_iev_get_stack = tr, e.msg_iev_push_stack = er, e.msg_iev_read_key = Xn, e.msg_iev_set_msg_type = nr, e.msg_iev_write_key = Zn, e.node_uuid = cr, e.parseBoolean = Sn, e.parseSVG = function(e) {
|
|
2909
2920
|
return new DOMParser().parseFromString(e, "image/svg+xml").firstChild;
|
|
2910
2921
|
}, e.refresh_language = function(e, t) {
|
|
2911
|
-
jn(t)
|
|
2922
|
+
if (!jn(t)) return void qt("You must supply a translation function");
|
|
2923
|
+
e || (e = document);
|
|
2924
|
+
const n = (t) => {
|
|
2925
|
+
let n = [];
|
|
2926
|
+
return "function" == typeof e.matches && e.matches(t) && n.push(e), n.push(...e.querySelectorAll(t)), n;
|
|
2927
|
+
};
|
|
2928
|
+
n("[data-i18n]").forEach(function(e) {
|
|
2912
2929
|
let n = e.getAttribute("data-i18n");
|
|
2913
2930
|
for (let r of e.childNodes) if (r.nodeType === Node.TEXT_NODE) {
|
|
2914
2931
|
n || (n = r.nodeValue), r.nodeValue = t(n);
|
|
2915
2932
|
break;
|
|
2916
2933
|
}
|
|
2917
|
-
}),
|
|
2934
|
+
}), n("[data-i18n-title]").forEach(function(e) {
|
|
2918
2935
|
let n = e.getAttribute("data-i18n-title");
|
|
2919
2936
|
n && e.setAttribute("title", t(n));
|
|
2920
|
-
}),
|
|
2937
|
+
}), n("[data-i18n-aria-label]").forEach(function(e) {
|
|
2921
2938
|
let n = e.getAttribute("data-i18n-aria-label");
|
|
2922
2939
|
n && e.setAttribute("aria-label", t(n));
|
|
2923
|
-
}),
|
|
2940
|
+
}), n("[data-i18n-placeholder]").forEach(function(e) {
|
|
2924
2941
|
let n = e.getAttribute("data-i18n-placeholder");
|
|
2925
2942
|
n && e.setAttribute("placeholder", t(n));
|
|
2926
|
-
})
|
|
2943
|
+
});
|
|
2927
2944
|
}, e.register_c_ievent_cli = function() {
|
|
2928
2945
|
return function(e) {
|
|
2929
|
-
if (Vr) return
|
|
2946
|
+
if (Vr) return qt(`GClass ALREADY created: ${e}`), -1;
|
|
2930
2947
|
const t = [
|
|
2931
2948
|
["ST_DISCONNECTED", [
|
|
2932
2949
|
[
|
|
@@ -2941,7 +2958,7 @@
|
|
|
2941
2958
|
],
|
|
2942
2959
|
[
|
|
2943
2960
|
"EV_TIMEOUT",
|
|
2944
|
-
|
|
2961
|
+
qr,
|
|
2945
2962
|
null
|
|
2946
2963
|
],
|
|
2947
2964
|
[
|
|
@@ -3021,7 +3038,7 @@
|
|
|
3021
3038
|
}("C_IEVENT_CLI");
|
|
3022
3039
|
}, e.register_c_timer = function() {
|
|
3023
3040
|
return function(e) {
|
|
3024
|
-
if (Nr) return
|
|
3041
|
+
if (Nr) return qt(`GClass ALREADY created: ${e}`), -1;
|
|
3025
3042
|
const t = [["ST_IDLE", [[
|
|
3026
3043
|
"EV_TIMEOUT",
|
|
3027
3044
|
wr,
|
|
@@ -3031,11 +3048,11 @@
|
|
|
3031
3048
|
["EV_TIMEOUT", D.EVF_OUTPUT_EVENT],
|
|
3032
3049
|
["EV_TIMEOUT_PERIODIC", D.EVF_OUTPUT_EVENT],
|
|
3033
3050
|
[0, 0]
|
|
3034
|
-
], t, Rr, 0,
|
|
3051
|
+
], t, Rr, 0, Or, Sr, 0, 0, 0, N.gcflag_manual_start)) ? 0 : -1;
|
|
3035
3052
|
}("C_TIMER");
|
|
3036
3053
|
}, e.register_c_yuno = function() {
|
|
3037
3054
|
return function(e) {
|
|
3038
|
-
if (Cr) return
|
|
3055
|
+
if (Cr) return qt(`GClass ALREADY created: ${e}`), -1;
|
|
3039
3056
|
const t = [["ST_IDLE", [[
|
|
3040
3057
|
"EV_TIMEOUT_PERIODIC",
|
|
3041
3058
|
Lr,
|
|
@@ -3047,7 +3064,7 @@
|
|
|
3047
3064
|
if (!e) return "";
|
|
3048
3065
|
const t = String(e).trim();
|
|
3049
3066
|
return /^javascript:/i.test(t) || /^data:/i.test(t) ? "" : sr(t);
|
|
3050
|
-
}, e.sdata_flag_t =
|
|
3067
|
+
}, e.sdata_flag_t = T, e.send_http_json_post = function(e, t, n) {
|
|
3051
3068
|
let r = new XMLHttpRequest();
|
|
3052
3069
|
r.open("POST", e), r.setRequestHeader("Accept", "application/json"), r.setRequestHeader("Content-Type", "application/json"), r.onreadystatechange = function() {
|
|
3053
3070
|
4 === r.readyState && n(r.status, r.responseText);
|
|
@@ -3062,8 +3079,8 @@
|
|
|
3062
3079
|
var r = (e + "").substring(0, n), o = (t + "").substring(0, n);
|
|
3063
3080
|
return r === o ? 0 : r > o ? 1 : -1;
|
|
3064
3081
|
}, e.strs_in_list = function(e, t, n) {
|
|
3065
|
-
if (!e) return
|
|
3066
|
-
if (!t) return
|
|
3082
|
+
if (!e) return qt("ERROR: strs_in_list() list empty"), !1;
|
|
3083
|
+
if (!t) return qt("ERROR: strs_in_list() str empty"), !1;
|
|
3067
3084
|
for (let r = 0; r < t.length; r++) if (Qn(e, t[r], n)) return !0;
|
|
3068
3085
|
return !1;
|
|
3069
3086
|
}, e.strstr = function(e, t, n) {
|
|
@@ -3087,7 +3104,7 @@
|
|
|
3087
3104
|
let e = t.split(".");
|
|
3088
3105
|
for (let t = 0; t < e.length; t++) {
|
|
3089
3106
|
let r = e[t];
|
|
3090
|
-
if (Qn(
|
|
3107
|
+
if (Qn(Tr, r)) n.real_type || (n.real_type = r);
|
|
3091
3108
|
else if (Qn(jr, r)) n.type || (n.type = r);
|
|
3092
3109
|
else if (Qn(yr, r)) switch (r) {
|
|
3093
3110
|
case "writable":
|
|
@@ -3106,18 +3123,18 @@
|
|
|
3106
3123
|
}, e.timeTracker = function(e = "Time Tracker", t = !1) {
|
|
3107
3124
|
const n = e, r = performance.now();
|
|
3108
3125
|
let o = r;
|
|
3109
|
-
return t && zt(`--\x3e ${n} - starting`), { mark: (e = "Intermediate",
|
|
3110
|
-
const
|
|
3111
|
-
return t && zt(`--\x3e ${n} ${e} - partial: ${s} sec, total: ${_} sec, ${
|
|
3126
|
+
return t && zt(`--\x3e ${n} - starting`), { mark: (e = "Intermediate", i = "") => {
|
|
3127
|
+
const l = performance.now(), s = (l - o) / 1e3, _ = (l - r) / 1e3;
|
|
3128
|
+
return t && zt(`--\x3e ${n} ${e} - partial: ${s} sec, total: ${_} sec, ${i}`), o = l, {
|
|
3112
3129
|
partial: s,
|
|
3113
3130
|
total: _
|
|
3114
3131
|
};
|
|
3115
3132
|
} };
|
|
3116
|
-
}, e.trace_json = Zt, e.trace_level_t = P, e.trace_msg = Xt, e.treedb_decoder_fkey =
|
|
3133
|
+
}, e.trace_json = Zt, e.trace_level_t = P, e.trace_msg = Xt, e.treedb_decoder_fkey = hr, e.treedb_decoder_hook = function(e, t) {
|
|
3117
3134
|
if (En(t)) {
|
|
3118
3135
|
if (-1 === t.indexOf("^")) {
|
|
3119
3136
|
let n, r = e.hook;
|
|
3120
|
-
if (1 !== gn(r)) return
|
|
3137
|
+
if (1 !== gn(r)) return qt("bad hook 1"), qt(e), qt(t), null;
|
|
3121
3138
|
for (let e of Object.keys(r)) {
|
|
3122
3139
|
n = e, r[e];
|
|
3123
3140
|
break;
|
|
@@ -3129,7 +3146,7 @@
|
|
|
3129
3146
|
}
|
|
3130
3147
|
{
|
|
3131
3148
|
let n = t.split("^");
|
|
3132
|
-
return 2 !== n.length ? (
|
|
3149
|
+
return 2 !== n.length ? (qt("bad hook 2"), qt(e), qt(t), null) : {
|
|
3133
3150
|
topic_name: n[0],
|
|
3134
3151
|
id: n[1]
|
|
3135
3152
|
};
|
|
@@ -3138,9 +3155,9 @@
|
|
|
3138
3155
|
return pn(t) ? {
|
|
3139
3156
|
topic_name: t.topic_name,
|
|
3140
3157
|
id: t.id
|
|
3141
|
-
} : (
|
|
3158
|
+
} : (qt("bad hook 3"), qt(e), qt(t), null);
|
|
3142
3159
|
}, e.treedb_encoder_fkey = function(e, t) {
|
|
3143
|
-
let n =
|
|
3160
|
+
let n = hr(e, t);
|
|
3144
3161
|
return n ? n.topic_name + "^" + n.id + "^" + n.hook_name : null;
|
|
3145
3162
|
}, e.treedb_get_field_desc = vr, e.treedb_hook_data_size = function(e) {
|
|
3146
3163
|
if (mn(e) && 1 === bn(e)) {
|