@yuneta/gobj-js 7.25.5 → 7.25.6
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/README.md +7 -0
- package/dist/gobj-js.cjs.js +32 -16
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +72 -68
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +32 -16
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +150 -146
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +32 -16
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +67 -63
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +32 -16
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +67 -63
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.umd.min.js
CHANGED
|
@@ -203,13 +203,13 @@
|
|
|
203
203
|
EVF_OUTPUT_EVENT: 2,
|
|
204
204
|
EVF_SYSTEM_EVENT: 4,
|
|
205
205
|
EVF_PUBLIC_EVENT: 8
|
|
206
|
-
}),
|
|
206
|
+
}), $ = Object.freeze({
|
|
207
207
|
WALK_TOP2BOTTOM: 1,
|
|
208
208
|
WALK_BOTTOM2TOP: 2,
|
|
209
209
|
WALK_BYLEVEL: 4,
|
|
210
210
|
WALK_FIRST2LAST: 16,
|
|
211
211
|
WALK_LAST2FIRST: 32
|
|
212
|
-
}),
|
|
212
|
+
}), A = class {
|
|
213
213
|
constructor(e, t, n) {
|
|
214
214
|
this.event_name = e, this.action = t, this.next_state = n;
|
|
215
215
|
}
|
|
@@ -601,7 +601,7 @@
|
|
|
601
601
|
if (!(e instanceof S)) return dn("Cannot add state, typeof not GClass"), -1;
|
|
602
602
|
if (Wn(t)) return dn("state_name EMPTY"), -1;
|
|
603
603
|
let o = pe(e, t);
|
|
604
|
-
return o ? me(o, n) ? (dn(`event already exists: gclass ${e.gclass_name}, state ${t}, event ${n}`), -1) : (o.dl_actions.push(new
|
|
604
|
+
return o ? me(o, n) ? (dn(`event already exists: gclass ${e.gclass_name}, state ${t}, event ${n}`), -1) : (o.dl_actions.push(new A(n, r, l)), 0) : (dn(`state not found: ${t}`), -1);
|
|
605
605
|
}
|
|
606
606
|
function Te(e, t, n) {
|
|
607
607
|
Wn(t) || e.push(new I(t, n));
|
|
@@ -665,12 +665,12 @@
|
|
|
665
665
|
}
|
|
666
666
|
function De(e, t) {
|
|
667
667
|
let n = Rr(e.dl_children, t);
|
|
668
|
-
n >= 0 && (
|
|
668
|
+
n >= 0 && ($n(e.dl_children, n), t.parent = null);
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function $e(e, t) {
|
|
671
671
|
return Be(e) ? _ ? _(e, t) : -1 : (dn(`${et(e)}: Only gobj services can load/save writable-persistent`), -1);
|
|
672
672
|
}
|
|
673
|
-
function
|
|
673
|
+
function Ae(e, t) {
|
|
674
674
|
"__json_config_variables__" !== t && dn(`GClass Attribute NOT FOUND: ${et(e)}, attr ${t}`);
|
|
675
675
|
}
|
|
676
676
|
function ke(e, t, n) {
|
|
@@ -683,7 +683,7 @@
|
|
|
683
683
|
t ? (-1 === n || t.flag & n) && (t.flag & T.SDF_DEPRECATED && bn(`${et(l)}: Deprecated attribute used in gobj creation: ${s}`), o += ue(l, e, t, i)) : r && (r(l, s), o--);
|
|
684
684
|
}
|
|
685
685
|
return o;
|
|
686
|
-
})(ce(e), r, -1, e.gclass.gclass_flag & N.gcflag_ignore_unknown_attrs ? 0 :
|
|
686
|
+
})(ce(e), r, -1, e.gclass.gclass_flag & N.gcflag_ignore_unknown_attrs ? 0 : Ae, e) < 0 && (dn(`${et(e)} json2data() FAILED`), hn(r));
|
|
687
687
|
}
|
|
688
688
|
function Ie(e, t, r, l, o) {
|
|
689
689
|
if (o & w.gobj_flag_yuno) {
|
|
@@ -762,7 +762,7 @@
|
|
|
762
762
|
return Ke(e) && Ge(e), 0;
|
|
763
763
|
}
|
|
764
764
|
function Me(e) {
|
|
765
|
-
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : at(e,
|
|
765
|
+
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : at(e, $.WALK_FIRST2LAST, Ve, 0, 0);
|
|
766
766
|
}
|
|
767
767
|
function We(e) {
|
|
768
768
|
if (ot(e)) return dn(`gobj NULL or DESTROYED: ${et(e)}`), -1;
|
|
@@ -854,7 +854,7 @@
|
|
|
854
854
|
}
|
|
855
855
|
function ft(e, t, n, r, l) {
|
|
856
856
|
let o, s = [...e];
|
|
857
|
-
if (t &
|
|
857
|
+
if (t & $.WALK_LAST2FIRST) for (let e = s.length; e > 0; e--) {
|
|
858
858
|
o = s[e - 1];
|
|
859
859
|
let t = ct(n(o, r, l));
|
|
860
860
|
if (t < 0) return t;
|
|
@@ -869,15 +869,15 @@
|
|
|
869
869
|
function gt(e, t, n, r, l) {
|
|
870
870
|
let o, s = ft(e, t, n, r, l);
|
|
871
871
|
if (s < 0) return s;
|
|
872
|
-
if (t &
|
|
872
|
+
if (t & $.WALK_LAST2FIRST) {
|
|
873
873
|
for (let i = e.length; i > 0; i--) if (o = e[i - 1], s = gt([...o.dl_children], t, n, r, l), s < 0) return s;
|
|
874
874
|
} else for (let i = 0; i < e.length; i++) if (o = e[i], s = gt([...o.dl_children], t, n, r, l), s < 0) return s;
|
|
875
875
|
return s;
|
|
876
876
|
}
|
|
877
877
|
function dt(e, t, n, r, l) {
|
|
878
|
-
if (t &
|
|
878
|
+
if (t & $.WALK_BYLEVEL) return gt(e, t, n, r, l);
|
|
879
879
|
let o, s;
|
|
880
|
-
if (t &
|
|
880
|
+
if (t & $.WALK_BOTTOM2TOP) for (let i = e.length; i > 0; i--) {
|
|
881
881
|
if (s = e[i - 1], o = dt([...s.dl_children], t, n, r, l), o < 0) return o;
|
|
882
882
|
if (o = ct(n(s, r, l)), o < 0) return o;
|
|
883
883
|
}
|
|
@@ -898,7 +898,7 @@
|
|
|
898
898
|
let t = l.length;
|
|
899
899
|
if (l !== Xe(e).substring(0, t)) return !1;
|
|
900
900
|
}
|
|
901
|
-
if (o && o !==
|
|
901
|
+
if (o && o !== At(e)) return !1;
|
|
902
902
|
let s = e.jn_attrs;
|
|
903
903
|
for (const n of Object.keys(t)) if ("__gclass_name__" !== n && "__gobj_name__" !== n && "__prefix_gobj_name__" !== n && "__disabled__" !== n && "__state__" !== n && ht(e, n) && s[n] !== t[n]) return !1;
|
|
904
904
|
return !0;
|
|
@@ -969,7 +969,7 @@
|
|
|
969
969
|
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? Sn(n, t) : e.gclass.gmt.mt_reading(e, t) : (dn(`${et(e)}: GClass Attribute NOT FOUND, attr ${t}`), 0);
|
|
970
970
|
}
|
|
971
971
|
function jt(e, t) {
|
|
972
|
-
if (t && 0 === Yn(t, "__state__")) return
|
|
972
|
+
if (t && 0 === Yn(t, "__state__")) return At(e);
|
|
973
973
|
let n = fe(e, t, !1);
|
|
974
974
|
return n ? !e.gclass.gmt.mt_reading || e.obflag & R.obflag_destroyed ? Sn(n, t) : e.gclass.gmt.mt_reading(e, t) : (dn(`${et(e)}: GClass Attribute NOT FOUND, attr ${t}`), 0);
|
|
975
975
|
}
|
|
@@ -1018,7 +1018,7 @@
|
|
|
1018
1018
|
let r = fe(e, t, !1);
|
|
1019
1019
|
return r ? (r[t] = String(n), Cn(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) : (dn(`${et(e)}: GClass Attribute NOT FOUND, attr ${t}`), -1);
|
|
1020
1020
|
}
|
|
1021
|
-
function
|
|
1021
|
+
function $t(e, t) {
|
|
1022
1022
|
if (ot(e)) return dn("gobj NULL or DESTROYED"), null;
|
|
1023
1023
|
if (e.current_state.state_name === t) return !1;
|
|
1024
1024
|
let r = pe(e.gclass, t);
|
|
@@ -1027,9 +1027,9 @@
|
|
|
1027
1027
|
let l = q(e, "EV_STATE_CHANGED"), o = !!function(e) {
|
|
1028
1028
|
return x(e) & U.TRACE_STATES;
|
|
1029
1029
|
}(e);
|
|
1030
|
-
return (l || o) && (1 === C || L(n("🔀🔀 mach(%s%s^%s), new st(%s), prev st(%s)", e.running ? "" : "!!", Ze(e), Xe(e),
|
|
1030
|
+
return (l || o) && (1 === C || L(n("🔀🔀 mach(%s%s^%s), new st(%s), prev st(%s)", e.running ? "" : "!!", Ze(e), Xe(e), At(e), e.last_state.state_name))), !0;
|
|
1031
1031
|
}
|
|
1032
|
-
function
|
|
1032
|
+
function At(e) {
|
|
1033
1033
|
return Mn(e) ? e.current_state.state_name : (dn("hgobj NULL"), "");
|
|
1034
1034
|
}
|
|
1035
1035
|
function kt(e, t, n) {
|
|
@@ -1070,16 +1070,16 @@
|
|
|
1070
1070
|
let s = q(e, t) && !z(l, t);
|
|
1071
1071
|
h++;
|
|
1072
1072
|
let i = me(o, t);
|
|
1073
|
-
if (!i) return e.gclass.gmt.mt_inject_event ? (h--, s && (L(1 === C ? n("🔜 %s %s%s %s", t || "", e.running ? "" : "!!", et(e), o.state_name) : n("🔃 mach(%s%s), st: %s, ev: %s, from(%s%s)", e.running ? "" : "!!", et(e), o.state_name, t || "", l && !l.running ? "!!" : "", et(l))), r && H(e) &&
|
|
1073
|
+
if (!i) return e.gclass.gmt.mt_inject_event ? (h--, s && (L(1 === C ? n("🔜 %s %s%s %s", t || "", e.running ? "" : "!!", et(e), o.state_name) : n("🔃 mach(%s%s), st: %s, ev: %s, from(%s%s)", e.running ? "" : "!!", et(e), o.state_name, t || "", l && !l.running ? "!!" : "", et(l))), r && H(e) && An(r) && hn(r)), e.gclass.gmt.mt_inject_event(e, t, r, l)) : (s && L(n("📛 mach(%s%s^%s), st: %s, ev: %s, 📛📛ERROR Event NOT DEFINED in state📛📛, from(%s%s^%s)", e.running ? "" : "!!", Ze(e), Xe(e), o.state_name, t || "", l && !l.running ? "!!" : "", Ze(l), Xe(l))), dn(`📛📛 Event NOT DEFINED in state 📛📛: ${et(e)}, ${o.state_name}, ${t}`), h--, -1);
|
|
1074
1074
|
if (s) {
|
|
1075
1075
|
if (1 === C) L(n("🔄 %s %s%s %s from %s%s", t || "", e.running ? "" : "!!", et(e), o.state_name, l && !l.running ? "!!" : "", et(l)));
|
|
1076
1076
|
else {
|
|
1077
1077
|
let r = "";
|
|
1078
|
-
i.action && (r =
|
|
1078
|
+
i.action && (r = $r(i.action)), L(n("🔄 mach(%s%s^%s), st: %s, ev: %s%s%s, ac: %s, from(%s%s^%s)", e.running ? "" : "!!", Ze(e), Xe(e), o.state_name, "", t || "", "", r, l && !l.running ? "!!" : "", Ze(l), Xe(l)));
|
|
1079
1079
|
}
|
|
1080
|
-
r && H(e) &&
|
|
1080
|
+
r && H(e) && An(r) && hn(r);
|
|
1081
1081
|
}
|
|
1082
|
-
i.next_state &&
|
|
1082
|
+
i.next_state && $t(e, i.next_state);
|
|
1083
1083
|
let _ = -1;
|
|
1084
1084
|
try {
|
|
1085
1085
|
i.action && (_ = i.action(e, t, r, l));
|
|
@@ -1139,7 +1139,7 @@
|
|
|
1139
1139
|
if (!!(Xn(e, t, "subs_flag", null, zt.KW_REQUIRED) & Gt.__hard_subscription__) && !r) return -1;
|
|
1140
1140
|
(B(s) || B(o)) && (L(n("💜💜👎 unsubscribing event '%s': publisher %s, subscriber'%s'", i || "", et(o), et(s))), hn(t)), o.obflag & R.obflag_destroyed || l || o.gclass.gmt.mt_subscription_deleted && o.gclass.gmt.mt_subscription_deleted(o, t);
|
|
1141
1141
|
let _ = xt(o.dl_subscriptions, o, i, t, s);
|
|
1142
|
-
return _ >= 0 ?
|
|
1142
|
+
return _ >= 0 ? $n(o.dl_subscriptions, _) : (dn(`${et(e)}: subscription in publisher not found`), hn(t)), _ = xt(s.dl_subscribings, o, i, t, s), _ >= 0 ? $n(s.dl_subscribings, _) : (dn(`${et(e)}: subscription in subscriber not found`), hn(t)), 0;
|
|
1143
1143
|
}
|
|
1144
1144
|
function Yt(e, t, r, l) {
|
|
1145
1145
|
if (null == r && (r = {}), !e) return dn(`publisher NULL: ev ${t}`), 0;
|
|
@@ -1202,7 +1202,7 @@
|
|
|
1202
1202
|
let l = kt(e, t, !0);
|
|
1203
1203
|
if (!(l && l.event_flag & (D.EVF_SYSTEM_EVENT | D.EVF_OUTPUT_EVENT) || e.gclass.gclass_flag & N.gcflag_no_check_output_events)) return dn(`event NOT in output event list: ${et(e)}, ev ${t}`), -1;
|
|
1204
1204
|
let o = (B(e) || q(e, t)) && !z(e, t);
|
|
1205
|
-
if (o && (L(1 === C ? n("🔝🔝 %s %s%s %s", t || "", e.running ? "" : "!!", et(e), e.current_state.state_name) : n("🔝🔝 mach(%s%s^%s), st: %s, ev: %s%s%s", e.running ? "" : "!!", Ze(e), Xe(e), e.current_state.state_name, "", t || "", "")), H(e) &&
|
|
1205
|
+
if (o && (L(1 === C ? n("🔝🔝 %s %s%s %s", t || "", e.running ? "" : "!!", et(e), e.current_state.state_name) : n("🔝🔝 mach(%s%s^%s), st: %s, ev: %s%s%s", e.running ? "" : "!!", Ze(e), Xe(e), e.current_state.state_name, "", t || "", "")), H(e) && An(r) && hn(r)), e.gclass.gmt.mt_publish_event) {
|
|
1206
1206
|
let n = e.gclass.gmt.mt_publish_event(e, t, r);
|
|
1207
1207
|
if (n <= 0) return n;
|
|
1208
1208
|
}
|
|
@@ -1224,7 +1224,7 @@
|
|
|
1224
1224
|
if (!d) continue;
|
|
1225
1225
|
let b = kt(u, t, !0);
|
|
1226
1226
|
if (b && b.event_flag & D.EVF_SYSTEM_EVENT && !It(u, b.event_name, 0)) continue;
|
|
1227
|
-
s && Jn(g, s), l && yn(g, l), o && (L(1 === C ? n("🔝🔄 %s (%s) %s%s", t || "", t || "", u.running ? "" : "!!", et(u)) : n("🔝🔄 mach(%s%s), st: %s, ev: %s, from(%s%s)", u.running ? "" : "!!", et(u),
|
|
1227
|
+
s && Jn(g, s), l && yn(g, l), o && (L(1 === C ? n("🔝🔄 %s (%s) %s%s", t || "", t || "", u.running ? "" : "!!", et(u)) : n("🔝🔄 mach(%s%s), st: %s, ev: %s, from(%s%s)", u.running ? "" : "!!", et(u), At(u), t || "", e && !e.running ? "!!" : "", et(e))), H(e) && An(g) && hn(g));
|
|
1228
1228
|
let p = Ft(u, t, g, e);
|
|
1229
1229
|
if (p < 0 && c & Gt.__own_event__) {
|
|
1230
1230
|
i = -1;
|
|
@@ -1394,10 +1394,10 @@
|
|
|
1394
1394
|
function Dn(e, t) {
|
|
1395
1395
|
e.push(t);
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function $n(e, t) {
|
|
1398
1398
|
e.splice(t, 1);
|
|
1399
1399
|
}
|
|
1400
|
-
function
|
|
1400
|
+
function An(e) {
|
|
1401
1401
|
return Cn(e) ? Object.keys(e).length : 0;
|
|
1402
1402
|
}
|
|
1403
1403
|
function kn(e) {
|
|
@@ -1464,13 +1464,17 @@
|
|
|
1464
1464
|
return !(!(t in e) || !e.hasOwnProperty(t));
|
|
1465
1465
|
}
|
|
1466
1466
|
function qn(e, t, n, r) {
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
if (l
|
|
1471
|
-
let o =
|
|
1472
|
-
for (let
|
|
1473
|
-
|
|
1467
|
+
e && !Mn(e) && dn("GObj bad instanceof");
|
|
1468
|
+
const l = e ? `${et(e)}: ` : "";
|
|
1469
|
+
if (!Cn(t) && !Ln(t)) return void dn(`${l}kw must be list or dict: '${String(n)}'`);
|
|
1470
|
+
if (!Un(n)) return void dn(`${l}path must be a string: ${String(n)}`);
|
|
1471
|
+
let o = n.split("`"), s = o.length;
|
|
1472
|
+
for (let e = 0; e < s - 1; e++) {
|
|
1473
|
+
if (null == (t = t[o[e]])) return void (r && dn(`${l}path not found: '${n}'`));
|
|
1474
|
+
if (!Cn(t) && !Ln(t)) return void dn(`${l}kw must be list or dict: '${n}'`);
|
|
1475
|
+
}
|
|
1476
|
+
let i = t[o[s - 1]];
|
|
1477
|
+
return void 0 === i && r && dn(`${l}path not found: '${n}'`), i;
|
|
1474
1478
|
}
|
|
1475
1479
|
function zn(e, t, n) {
|
|
1476
1480
|
e && !Mn(e) && dn("GObj bad instanceof");
|
|
@@ -1485,7 +1489,7 @@
|
|
|
1485
1489
|
let o = qn(e, t, n, !1);
|
|
1486
1490
|
const s = l && l & zt.KW_REQUIRED, i = l && l & zt.KW_CREATE, _ = l && l & zt.KW_EXTRACT, a = l && l & zt.KW_WILD_NUMBER;
|
|
1487
1491
|
if (void 0 === o) {
|
|
1488
|
-
if (i) {
|
|
1492
|
+
if (i && t) {
|
|
1489
1493
|
let l = Boolean(r);
|
|
1490
1494
|
return rr(e, t, n, l), l;
|
|
1491
1495
|
}
|
|
@@ -1506,7 +1510,7 @@
|
|
|
1506
1510
|
let o = qn(e, t, n, !1);
|
|
1507
1511
|
const s = l && l & zt.KW_REQUIRED, i = l && l & zt.KW_CREATE, _ = l && l & zt.KW_EXTRACT, a = l && l & zt.KW_WILD_NUMBER;
|
|
1508
1512
|
if (void 0 === o) {
|
|
1509
|
-
if (i) {
|
|
1513
|
+
if (i && t) {
|
|
1510
1514
|
let l = parseInt(r);
|
|
1511
1515
|
return rr(e, t, n, l), l;
|
|
1512
1516
|
}
|
|
@@ -1534,7 +1538,7 @@
|
|
|
1534
1538
|
e && !Mn(e) && dn("GObj bad instanceof");
|
|
1535
1539
|
let o = qn(e, t, n, !1);
|
|
1536
1540
|
const s = l && l & zt.KW_REQUIRED, i = l && l & zt.KW_CREATE, _ = l && l & zt.KW_EXTRACT;
|
|
1537
|
-
return void 0 === o ? i ? (rr(e, t, n, Un(r) ? r : null), r) : (s && !function(e, t) {
|
|
1541
|
+
return void 0 === o ? i && t ? (rr(e, t, n, Un(r) ? r : null), r) : (s && !function(e, t) {
|
|
1538
1542
|
let n = Un(t) ? t.split("`") : [], r = e;
|
|
1539
1543
|
for (let e = 0; e < n.length - 1; e++) {
|
|
1540
1544
|
if (!Cn(r) && !Ln(r)) return !1;
|
|
@@ -1630,7 +1634,7 @@
|
|
|
1630
1634
|
if (Un(n) && !Wn(n)) {
|
|
1631
1635
|
let o = n;
|
|
1632
1636
|
t.hasOwnProperty(o) ? l[o] = t[o] : r && dn(`${et(e)}: key not found: ${o}`);
|
|
1633
|
-
} else if (Cn(n) &&
|
|
1637
|
+
} else if (Cn(n) && An(n) > 0) for (let o of Object.keys(n)) t.hasOwnProperty(o) ? l[o] = t[o] : r && dn(`${et(e)}: key not found: ${o}`);
|
|
1634
1638
|
else {
|
|
1635
1639
|
if (!(Ln(n) && kn(n) > 0)) return t;
|
|
1636
1640
|
for (let o = 0; o < n.length; o++) {
|
|
@@ -1645,7 +1649,7 @@
|
|
|
1645
1649
|
if (yn(l, t), Un(n) && !Wn(n)) {
|
|
1646
1650
|
let o = n;
|
|
1647
1651
|
nr(e, t, o, 0, 0) ? On(l, o) : r && dn(`${et(e)}: key not found: ${o}`);
|
|
1648
|
-
} else if (Cn(n) &&
|
|
1652
|
+
} else if (Cn(n) && An(n) > 0) for (let o of Object.keys(n)) t.hasOwnProperty(o) ? On(l, o) : r && dn(`${et(e)}: key not found: ${o}`);
|
|
1649
1653
|
else {
|
|
1650
1654
|
if (!(Ln(n) && kn(n) > 0)) return {};
|
|
1651
1655
|
for (let o = 0; o < n.length; o++) {
|
|
@@ -1845,11 +1849,11 @@
|
|
|
1845
1849
|
let e = "";
|
|
1846
1850
|
return "undefined" != typeof window && window.localStorage ? (e = window.localStorage.getItem("host_uuid"), !e && window.crypto?.randomUUID && (e = window.crypto.randomUUID(), window.localStorage.setItem("host_uuid", e))) : e = "undefined" != typeof globalThis && globalThis.crypto?.randomUUID ? globalThis.crypto.randomUUID() : "00000000-0000-0000-0000-000000000000", e;
|
|
1847
1851
|
}
|
|
1848
|
-
function
|
|
1852
|
+
function $r(e) {
|
|
1849
1853
|
let t = null;
|
|
1850
1854
|
return "function" != typeof e && "object" != typeof e || (t = ("" + e).match(/function\s*([\w\$]*)\s*\(/)), null !== t ? t[1] + "()" : "";
|
|
1851
1855
|
}
|
|
1852
|
-
var
|
|
1856
|
+
var Ar = 256, kr = 1e5;
|
|
1853
1857
|
function Ir(e) {
|
|
1854
1858
|
const t = String(e).replace(/`/g, "``");
|
|
1855
1859
|
return "[" === t[0] ? "[" + t : t;
|
|
@@ -1885,7 +1889,7 @@
|
|
|
1885
1889
|
if (Un(t)) {
|
|
1886
1890
|
if (-1 === t.indexOf("^")) {
|
|
1887
1891
|
let n, r, l = e.fkey;
|
|
1888
|
-
if (1 !==
|
|
1892
|
+
if (1 !== An(l)) return dn("bad fkey 1"), dn(e), dn(t), null;
|
|
1889
1893
|
for (const e of Object.keys(l)) {
|
|
1890
1894
|
n = e, r = l[e];
|
|
1891
1895
|
break;
|
|
@@ -2081,7 +2085,7 @@
|
|
|
2081
2085
|
], Qr = { gobj_timer: null }, Xr = null;
|
|
2082
2086
|
function Zr(e, t, n, r) {
|
|
2083
2087
|
let l = Et(e, t);
|
|
2084
|
-
return Cn(l) || (l = {}), l[n] = r, Ot(e, t, l),
|
|
2088
|
+
return Cn(l) || (l = {}), l[n] = r, Ot(e, t, l), $e(e, t);
|
|
2085
2089
|
}
|
|
2086
2090
|
function el(e) {
|
|
2087
2091
|
if (!0 === e || !1 === e) return e;
|
|
@@ -2363,7 +2367,7 @@
|
|
|
2363
2367
|
};
|
|
2364
2368
|
lt(e) ? Ft(nt(e), "EV_ON_ID_NAK", t, e) : qt(e, "EV_ON_ID_NAK", t);
|
|
2365
2369
|
} else {
|
|
2366
|
-
if (
|
|
2370
|
+
if ($t(e, "ST_SESSION"), l.inside_on_open = !0, l.retry_ms = 0, !l.inform_on_close) {
|
|
2367
2371
|
l.inform_on_close = !0;
|
|
2368
2372
|
let t = {
|
|
2369
2373
|
username: c,
|
|
@@ -2404,7 +2408,7 @@
|
|
|
2404
2408
|
r ? r(e, o, 2, t) : fl(0, e, o);
|
|
2405
2409
|
}
|
|
2406
2410
|
let s = o.event, i = o.kw;
|
|
2407
|
-
if ("ST_SESSION" !==
|
|
2411
|
+
if ("ST_SESSION" !== At(e)) {
|
|
2408
2412
|
if (It(e, s, D.EVF_PUBLIC_EVENT)) {
|
|
2409
2413
|
if (!(Ft(e, s, i, e) < 0)) return 0;
|
|
2410
2414
|
} else dn(`${et(e)}: event UNKNOWN in not-session state ${s}`);
|
|
@@ -2461,7 +2465,7 @@
|
|
|
2461
2465
|
},
|
|
2462
2466
|
mt_destroy: function(e) {},
|
|
2463
2467
|
mt_stats: function(e, t, n, r) {
|
|
2464
|
-
if ("ST_SESSION" !==
|
|
2468
|
+
if ("ST_SESSION" !== At(e)) return dn("Not in session"), null;
|
|
2465
2469
|
n || (n = {});
|
|
2466
2470
|
let l = bl(e, Xe(r), Zn(e, n, "service", null, 0)), o = nr(e, n, "__md_stats__", null, zt.KW_EXTRACT);
|
|
2467
2471
|
return o || (o = {}), hr(e, n, "stats_stack", {
|
|
@@ -2470,7 +2474,7 @@
|
|
|
2470
2474
|
}), hr(e, n, ll, l), n.__stats__ = t, Tr(e, n, "__stats__"), dl(e, "EV_MT_STATS", n, r), null;
|
|
2471
2475
|
},
|
|
2472
2476
|
mt_command_parser: function(e, t, n, r) {
|
|
2473
|
-
if ("ST_SESSION" !==
|
|
2477
|
+
if ("ST_SESSION" !== At(e)) return dn("Not in session"), null;
|
|
2474
2478
|
n || (n = {});
|
|
2475
2479
|
let l = bl(e, Xe(r), Zn(e, n, "service", "", 0)), o = nr(e, n, "__md_command__", null, zt.KW_EXTRACT);
|
|
2476
2480
|
return o || (o = {}), hr(e, n, "command_stack", {
|
|
@@ -2479,7 +2483,7 @@
|
|
|
2479
2483
|
}), hr(e, n, ll, l), n.__command__ = t, Tr(e, n, "__command__"), dl(e, "EV_MT_COMMAND", n, r), null;
|
|
2480
2484
|
},
|
|
2481
2485
|
mt_inject_event: function(e, t, n, r) {
|
|
2482
|
-
if ("ST_SESSION" !==
|
|
2486
|
+
if ("ST_SESSION" !== At(e)) return window.console.error("Not in session"), -1;
|
|
2483
2487
|
if (n || (n = {}), Er(e, n, ll));
|
|
2484
2488
|
else {
|
|
2485
2489
|
let l = bl(e, Xe(r), Zn(e, n, "__service__", 0, 0));
|
|
@@ -2489,11 +2493,11 @@
|
|
|
2489
2493
|
},
|
|
2490
2494
|
mt_subscription_added: function(e, t) {
|
|
2491
2495
|
let n = e.priv;
|
|
2492
|
-
return "ST_SESSION" ===
|
|
2496
|
+
return "ST_SESSION" === At(e) && n.websocket ? n.inside_on_open ? 0 : ml(e, t) : 0;
|
|
2493
2497
|
},
|
|
2494
2498
|
mt_subscription_deleted: function(e, t) {
|
|
2495
2499
|
let n = e.priv;
|
|
2496
|
-
if ("ST_SESSION" !==
|
|
2500
|
+
if ("ST_SESSION" !== At(e) || !n.websocket) return 0;
|
|
2497
2501
|
if (n.inside_on_open) return 0;
|
|
2498
2502
|
if (Wn(t.event)) return 0;
|
|
2499
2503
|
let r = {}, l = t.__global__, o = t.__config__, s = t.__filter__, i = t.__service__, _ = t.subscriber;
|
|
@@ -2552,7 +2556,7 @@
|
|
|
2552
2556
|
}
|
|
2553
2557
|
}, e.db_remove_persistent_attrs = function(e, t) {
|
|
2554
2558
|
let n = _r(e, ar(Ur(e), null, !1), t, !1);
|
|
2555
|
-
0 ===
|
|
2559
|
+
0 === An(n) ? cr(Ur(e)) : ur(Ur(e), n);
|
|
2556
2560
|
}, e.db_save_persistent_attrs = function(e, t) {
|
|
2557
2561
|
let n = ir(e, Tt(e, T.SDF_PERSIST), t, !1), r = ar(Ur(e), null, !1);
|
|
2558
2562
|
return r && Cn(r) && jn(n, r), ur(Ur(e), n);
|
|
@@ -2588,7 +2592,7 @@
|
|
|
2588
2592
|
for (const n of Object.keys(e)) {
|
|
2589
2593
|
const r = Cr(n);
|
|
2590
2594
|
if (!r || 0 === r.length) throw new Error(`flat2json: malformed flat id: '${n}'`);
|
|
2591
|
-
if (r.length >
|
|
2595
|
+
if (r.length > Ar) throw new Error(`flat2json: '${n}' deeper than 256`);
|
|
2592
2596
|
const l = "number" == typeof r[0];
|
|
2593
2597
|
if (null === t) t = l ? [] : {};
|
|
2594
2598
|
else if (l !== Array.isArray(t)) throw new Error(`flat2json: '${n}' does not fit a ${Array.isArray(t) ? "array" : "object"} root`);
|
|
@@ -2662,11 +2666,11 @@
|
|
|
2662
2666
|
right: n + i + r,
|
|
2663
2667
|
bottom: t + s + l
|
|
2664
2668
|
};
|
|
2665
|
-
}, e.get_function_name =
|
|
2669
|
+
}, e.get_function_name = $r, e.get_now = function() {
|
|
2666
2670
|
return Math.floor(Date.now() / 1e3);
|
|
2667
2671
|
}, e.gobj_bottom_gobj = st, e.gobj_change_parent = function(e, t) {
|
|
2668
2672
|
return ot(e) ? (dn("gobj NULL or DESTROYED"), null) : t instanceof O ? (e.parent && e.parent.mt_child_removed && e.parent.mt_child_removed(e.parent, e), e.parent && (De(e.parent, e), e.parent = null), Re(t, e), t.mt_child_added && (Y(e) && pn(n("👦👦🔵 child_added(%s): %s", tt(t), et(e))), t.mt_child_added(t, e)), 0) : (dn(`${et(e)}: gobj_change_parent() BAD TYPE of parent`), -1);
|
|
2669
|
-
}, e.gobj_change_state =
|
|
2673
|
+
}, e.gobj_change_state = $t, e.gobj_command = function(e, t, r, o) {
|
|
2670
2674
|
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : ((function(e) {
|
|
2671
2675
|
return V > 1 || !!e && !!(x(e) & U.TRACE_COMMANDS);
|
|
2672
2676
|
}(e) || q(e, null) && !z(o, null)) && (L(n("🌀🌀 mach(%s%s), cmd: %s, src: %s", Ke(e) ? "" : "!!", et(e), t, et(o))), H(e) && hn(r)), e.gclass.gmt.mt_command_parser ? e.gclass.gmt.mt_command_parser(e, t, r, o) : e.gclass.command_table ? c ? c(e, t, r, o) : l(0, -1, n("%s: global command parser not available", et(e)), 0, 0) : l(0, -1, n("%s: command table not available", et(e)), 0, 0));
|
|
@@ -2680,7 +2684,7 @@
|
|
|
2680
2684
|
return Ie(e, t, n, r, w.gobj_flag_volatil);
|
|
2681
2685
|
}, e.gobj_create_yuno = function(e, t, n) {
|
|
2682
2686
|
return Ie(e, t, n, null, w.gobj_flag_yuno);
|
|
2683
|
-
}, e.gobj_current_state =
|
|
2687
|
+
}, e.gobj_current_state = At, e.gobj_default_service = Oe, e.gobj_deliver_posted_events = Pt, e.gobj_destroy = Le, e.gobj_find_child = pt, e.gobj_find_gobj = function(e, t) {
|
|
2684
2688
|
if (Wn(t)) return null;
|
|
2685
2689
|
const n = t.toLowerCase();
|
|
2686
2690
|
return "__default_service__" === n ? m : "__yuno__" === n || "__root__" === n ? p : mt(p, t);
|
|
@@ -2760,7 +2764,7 @@
|
|
|
2760
2764
|
}
|
|
2761
2765
|
return 0;
|
|
2762
2766
|
}(e, T.SDF_VOLATIL, 0);
|
|
2763
|
-
}, e.gobj_save_persistent_attrs =
|
|
2767
|
+
}, e.gobj_save_persistent_attrs = $e, e.gobj_search_path = mt, e.gobj_send_event = Ft, e.gobj_services = function() {
|
|
2764
2768
|
let e = [];
|
|
2765
2769
|
for (const t of Object.keys(b)) Dn(e, t);
|
|
2766
2770
|
return e;
|
|
@@ -2777,9 +2781,9 @@
|
|
|
2777
2781
|
}, e.gobj_set_trace_machine_format = function(e) {
|
|
2778
2782
|
C = 1 === Number(e) ? 1 : 0;
|
|
2779
2783
|
}, e.gobj_short_name = et, e.gobj_start = Ue, e.gobj_start_children = function(e) {
|
|
2780
|
-
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : at(e,
|
|
2784
|
+
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : at(e, $.WALK_FIRST2LAST, Pe, 0, 0);
|
|
2781
2785
|
}, e.gobj_start_tree = function(e) {
|
|
2782
|
-
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : (J(e) && L(n("⏺ ⏺ ⏺ ⏺ start_tree: %s", tt(e))), e.gclass.gclass_flag & N.gcflag_manual_start || e.disabled ? 0 : (e.running || Ue(e), ut(e,
|
|
2786
|
+
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : (J(e) && L(n("⏺ ⏺ ⏺ ⏺ start_tree: %s", tt(e))), e.gclass.gclass_flag & N.gcflag_manual_start || e.disabled ? 0 : (e.running || Ue(e), ut(e, $.WALK_TOP2BOTTOM, Fe, 0, 0)));
|
|
2783
2787
|
}, e.gobj_start_up = function(e, t, n, r, l, o, s) {
|
|
2784
2788
|
i = t, _ = n, a = r, u = l, c = o, f = s;
|
|
2785
2789
|
const d = [["EV_STATE_CHANGED", D.EVF_SYSTEM_EVENT | D.EVF_OUTPUT_EVENT | D.EVF_NO_WARN_SUBS], [0, 0]];
|
|
@@ -2791,7 +2795,7 @@
|
|
|
2791
2795
|
}, e.gobj_stats = function(e, t, r, l) {
|
|
2792
2796
|
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : e.gclass.gmt.mt_stats ? e.gclass.gmt.mt_stats(e, t, r, l) : f ? f(e, t, r, l) : o(0, -1, n("%s, stats parser not available", et(e)), 0, 0);
|
|
2793
2797
|
}, e.gobj_stop = Ge, e.gobj_stop_children = Me, e.gobj_stop_tree = function(e) {
|
|
2794
|
-
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : (J(e) && L(n("⏹ ⏹ ⏹ ⏹ stop_tree: %s", tt(e))), Ke(e) && Ge(e), ut(e,
|
|
2798
|
+
return ot(e) ? (dn("gobj NULL or DESTROYED"), -1) : (J(e) && L(n("⏹ ⏹ ⏹ ⏹ stop_tree: %s", tt(e))), Ke(e) && Ge(e), ut(e, $.WALK_TOP2BOTTOM, Ve, 0, 0));
|
|
2795
2799
|
}, e.gobj_subscribe_event = Yt, e.gobj_trace_level = x, e.gobj_trace_machine_format = function() {
|
|
2796
2800
|
return C;
|
|
2797
2801
|
}, e.gobj_trace_no_level = K, e.gobj_unsubscribe_event = function(e, t, n, r) {
|
|
@@ -2878,7 +2882,7 @@
|
|
|
2878
2882
|
return l;
|
|
2879
2883
|
}, e.json2flat = function(e) {
|
|
2880
2884
|
const t = {}, n = (e, r, l) => {
|
|
2881
|
-
if (l >
|
|
2885
|
+
if (l > Ar) throw new Error("json2flat: deeper than 256");
|
|
2882
2886
|
if (null === e || "object" != typeof e || Array.isArray(e)) {
|
|
2883
2887
|
if (Array.isArray(e) && e.length > 0) return void e.forEach((e, t) => {
|
|
2884
2888
|
const o = `[${t}]`;
|
|
@@ -2899,7 +2903,7 @@
|
|
|
2899
2903
|
return null == e || n(e, "", 0), t;
|
|
2900
2904
|
}, e.json_array_append = Rn, e.json_array_append_new = Dn, e.json_array_extend = function(e, t) {
|
|
2901
2905
|
return t ? (Array.prototype.push.apply(e, t), e) : e;
|
|
2902
|
-
}, e.json_array_remove =
|
|
2906
|
+
}, e.json_array_remove = $n, e.json_array_size = kn, e.json_deep_copy = En, e.json_is_identical = Tn, e.json_object_del = On, e.json_object_get = Sn, e.json_object_set = Nn, e.json_object_set_new = wn, e.json_object_size = An, e.json_object_update = yn, e.json_object_update_existing = vn, e.json_object_update_missing = jn, e.json_size = In, e.jwt2json = function(e, t) {
|
|
2903
2907
|
try {
|
|
2904
2908
|
let n = Sr(e);
|
|
2905
2909
|
switch (t) {
|
|
@@ -2937,7 +2941,7 @@
|
|
|
2937
2941
|
let o = qn(e, t, n, !1);
|
|
2938
2942
|
const s = l && l & zt.KW_REQUIRED, i = l && l & zt.KW_CREATE, _ = l && l & zt.KW_EXTRACT, a = l && l & zt.KW_WILD_NUMBER;
|
|
2939
2943
|
if (void 0 === o) {
|
|
2940
|
-
if (i) {
|
|
2944
|
+
if (i && t) {
|
|
2941
2945
|
let l = Number(r);
|
|
2942
2946
|
return rr(e, t, n, l), l;
|
|
2943
2947
|
}
|
|
@@ -3285,7 +3289,7 @@
|
|
|
3285
3289
|
if (Un(t)) {
|
|
3286
3290
|
if (-1 === t.indexOf("^")) {
|
|
3287
3291
|
let n, r = e.hook;
|
|
3288
|
-
if (1 !==
|
|
3292
|
+
if (1 !== An(r)) return dn("bad hook 1"), dn(e), dn(t), null;
|
|
3289
3293
|
for (let e of Object.keys(r)) {
|
|
3290
3294
|
n = e, r[e];
|
|
3291
3295
|
break;
|
|
@@ -3318,7 +3322,7 @@
|
|
|
3318
3322
|
return In(e);
|
|
3319
3323
|
}, e.vsprintf = function(e, t) {
|
|
3320
3324
|
return n.apply(null, [e].concat(t || []));
|
|
3321
|
-
}, e.walk_type_t =
|
|
3325
|
+
}, e.walk_type_t = $;
|
|
3322
3326
|
});
|
|
3323
3327
|
|
|
3324
3328
|
//# sourceMappingURL=gobj-js.umd.min.js.map
|