@push.rocks/smartstate 2.0.9 → 2.0.10

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.
@@ -5685,6 +5685,1139 @@ var require_buffer_json = __commonJS({
5685
5685
  }
5686
5686
  });
5687
5687
 
5688
+ // node_modules/.pnpm/dayjs@1.11.9/node_modules/dayjs/dayjs.min.js
5689
+ var require_dayjs_min = __commonJS({
5690
+ "node_modules/.pnpm/dayjs@1.11.9/node_modules/dayjs/dayjs.min.js"(exports, module) {
5691
+ !function(t, e) {
5692
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
5693
+ }(exports, function() {
5694
+ "use strict";
5695
+ var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
5696
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
5697
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
5698
+ } }, m = function(t2, e2, n2) {
5699
+ var r2 = String(t2);
5700
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
5701
+ }, v = { s: m, z: function(t2) {
5702
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
5703
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
5704
+ }, m: function t2(e2, n2) {
5705
+ if (e2.date() < n2.date())
5706
+ return -t2(n2, e2);
5707
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
5708
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
5709
+ }, a: function(t2) {
5710
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
5711
+ }, p: function(t2) {
5712
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
5713
+ }, u: function(t2) {
5714
+ return void 0 === t2;
5715
+ } }, g = "en", D = {};
5716
+ D[g] = M;
5717
+ var p = function(t2) {
5718
+ return t2 instanceof b;
5719
+ }, S = function t2(e2, n2, r2) {
5720
+ var i2;
5721
+ if (!e2)
5722
+ return g;
5723
+ if ("string" == typeof e2) {
5724
+ var s2 = e2.toLowerCase();
5725
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
5726
+ var u2 = e2.split("-");
5727
+ if (!i2 && u2.length > 1)
5728
+ return t2(u2[0]);
5729
+ } else {
5730
+ var a2 = e2.name;
5731
+ D[a2] = e2, i2 = a2;
5732
+ }
5733
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
5734
+ }, w = function(t2, e2) {
5735
+ if (p(t2))
5736
+ return t2.clone();
5737
+ var n2 = "object" == typeof e2 ? e2 : {};
5738
+ return n2.date = t2, n2.args = arguments, new b(n2);
5739
+ }, O = v;
5740
+ O.l = S, O.i = p, O.w = function(t2, e2) {
5741
+ return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
5742
+ };
5743
+ var b = function() {
5744
+ function M2(t2) {
5745
+ this.$L = S(t2.locale, null, true), this.parse(t2);
5746
+ }
5747
+ var m2 = M2.prototype;
5748
+ return m2.parse = function(t2) {
5749
+ this.$d = function(t3) {
5750
+ var e2 = t3.date, n2 = t3.utc;
5751
+ if (null === e2)
5752
+ return /* @__PURE__ */ new Date(NaN);
5753
+ if (O.u(e2))
5754
+ return /* @__PURE__ */ new Date();
5755
+ if (e2 instanceof Date)
5756
+ return new Date(e2);
5757
+ if ("string" == typeof e2 && !/Z$/i.test(e2)) {
5758
+ var r2 = e2.match($);
5759
+ if (r2) {
5760
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
5761
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
5762
+ }
5763
+ }
5764
+ return new Date(e2);
5765
+ }(t2), this.$x = t2.x || {}, this.init();
5766
+ }, m2.init = function() {
5767
+ var t2 = this.$d;
5768
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
5769
+ }, m2.$utils = function() {
5770
+ return O;
5771
+ }, m2.isValid = function() {
5772
+ return !(this.$d.toString() === l);
5773
+ }, m2.isSame = function(t2, e2) {
5774
+ var n2 = w(t2);
5775
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
5776
+ }, m2.isAfter = function(t2, e2) {
5777
+ return w(t2) < this.startOf(e2);
5778
+ }, m2.isBefore = function(t2, e2) {
5779
+ return this.endOf(e2) < w(t2);
5780
+ }, m2.$g = function(t2, e2, n2) {
5781
+ return O.u(t2) ? this[e2] : this.set(n2, t2);
5782
+ }, m2.unix = function() {
5783
+ return Math.floor(this.valueOf() / 1e3);
5784
+ }, m2.valueOf = function() {
5785
+ return this.$d.getTime();
5786
+ }, m2.startOf = function(t2, e2) {
5787
+ var n2 = this, r2 = !!O.u(e2) || e2, f2 = O.p(t2), l2 = function(t3, e3) {
5788
+ var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
5789
+ return r2 ? i2 : i2.endOf(a);
5790
+ }, $2 = function(t3, e3) {
5791
+ return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
5792
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
5793
+ switch (f2) {
5794
+ case h:
5795
+ return r2 ? l2(1, 0) : l2(31, 11);
5796
+ case c:
5797
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
5798
+ case o:
5799
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
5800
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
5801
+ case a:
5802
+ case d:
5803
+ return $2(v2 + "Hours", 0);
5804
+ case u:
5805
+ return $2(v2 + "Minutes", 1);
5806
+ case s:
5807
+ return $2(v2 + "Seconds", 2);
5808
+ case i:
5809
+ return $2(v2 + "Milliseconds", 3);
5810
+ default:
5811
+ return this.clone();
5812
+ }
5813
+ }, m2.endOf = function(t2) {
5814
+ return this.startOf(t2, false);
5815
+ }, m2.$set = function(t2, e2) {
5816
+ var n2, o2 = O.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
5817
+ if (o2 === c || o2 === h) {
5818
+ var y2 = this.clone().set(d, 1);
5819
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
5820
+ } else
5821
+ l2 && this.$d[l2]($2);
5822
+ return this.init(), this;
5823
+ }, m2.set = function(t2, e2) {
5824
+ return this.clone().$set(t2, e2);
5825
+ }, m2.get = function(t2) {
5826
+ return this[O.p(t2)]();
5827
+ }, m2.add = function(r2, f2) {
5828
+ var d2, l2 = this;
5829
+ r2 = Number(r2);
5830
+ var $2 = O.p(f2), y2 = function(t2) {
5831
+ var e2 = w(l2);
5832
+ return O.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
5833
+ };
5834
+ if ($2 === c)
5835
+ return this.set(c, this.$M + r2);
5836
+ if ($2 === h)
5837
+ return this.set(h, this.$y + r2);
5838
+ if ($2 === a)
5839
+ return y2(1);
5840
+ if ($2 === o)
5841
+ return y2(7);
5842
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
5843
+ return O.w(m3, this);
5844
+ }, m2.subtract = function(t2, e2) {
5845
+ return this.add(-1 * t2, e2);
5846
+ }, m2.format = function(t2) {
5847
+ var e2 = this, n2 = this.$locale();
5848
+ if (!this.isValid())
5849
+ return n2.invalidDate || l;
5850
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
5851
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
5852
+ }, d2 = function(t3) {
5853
+ return O.s(s2 % 12 || 12, t3, "0");
5854
+ }, $2 = f2 || function(t3, e3, n3) {
5855
+ var r3 = t3 < 12 ? "AM" : "PM";
5856
+ return n3 ? r3.toLowerCase() : r3;
5857
+ };
5858
+ return r2.replace(y, function(t3, r3) {
5859
+ return r3 || function(t4) {
5860
+ switch (t4) {
5861
+ case "YY":
5862
+ return String(e2.$y).slice(-2);
5863
+ case "YYYY":
5864
+ return O.s(e2.$y, 4, "0");
5865
+ case "M":
5866
+ return a2 + 1;
5867
+ case "MM":
5868
+ return O.s(a2 + 1, 2, "0");
5869
+ case "MMM":
5870
+ return h2(n2.monthsShort, a2, c2, 3);
5871
+ case "MMMM":
5872
+ return h2(c2, a2);
5873
+ case "D":
5874
+ return e2.$D;
5875
+ case "DD":
5876
+ return O.s(e2.$D, 2, "0");
5877
+ case "d":
5878
+ return String(e2.$W);
5879
+ case "dd":
5880
+ return h2(n2.weekdaysMin, e2.$W, o2, 2);
5881
+ case "ddd":
5882
+ return h2(n2.weekdaysShort, e2.$W, o2, 3);
5883
+ case "dddd":
5884
+ return o2[e2.$W];
5885
+ case "H":
5886
+ return String(s2);
5887
+ case "HH":
5888
+ return O.s(s2, 2, "0");
5889
+ case "h":
5890
+ return d2(1);
5891
+ case "hh":
5892
+ return d2(2);
5893
+ case "a":
5894
+ return $2(s2, u2, true);
5895
+ case "A":
5896
+ return $2(s2, u2, false);
5897
+ case "m":
5898
+ return String(u2);
5899
+ case "mm":
5900
+ return O.s(u2, 2, "0");
5901
+ case "s":
5902
+ return String(e2.$s);
5903
+ case "ss":
5904
+ return O.s(e2.$s, 2, "0");
5905
+ case "SSS":
5906
+ return O.s(e2.$ms, 3, "0");
5907
+ case "Z":
5908
+ return i2;
5909
+ }
5910
+ return null;
5911
+ }(t3) || i2.replace(":", "");
5912
+ });
5913
+ }, m2.utcOffset = function() {
5914
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
5915
+ }, m2.diff = function(r2, d2, l2) {
5916
+ var $2, y2 = this, M3 = O.p(d2), m3 = w(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
5917
+ return O.m(y2, m3);
5918
+ };
5919
+ switch (M3) {
5920
+ case h:
5921
+ $2 = D2() / 12;
5922
+ break;
5923
+ case c:
5924
+ $2 = D2();
5925
+ break;
5926
+ case f:
5927
+ $2 = D2() / 3;
5928
+ break;
5929
+ case o:
5930
+ $2 = (g2 - v2) / 6048e5;
5931
+ break;
5932
+ case a:
5933
+ $2 = (g2 - v2) / 864e5;
5934
+ break;
5935
+ case u:
5936
+ $2 = g2 / n;
5937
+ break;
5938
+ case s:
5939
+ $2 = g2 / e;
5940
+ break;
5941
+ case i:
5942
+ $2 = g2 / t;
5943
+ break;
5944
+ default:
5945
+ $2 = g2;
5946
+ }
5947
+ return l2 ? $2 : O.a($2);
5948
+ }, m2.daysInMonth = function() {
5949
+ return this.endOf(c).$D;
5950
+ }, m2.$locale = function() {
5951
+ return D[this.$L];
5952
+ }, m2.locale = function(t2, e2) {
5953
+ if (!t2)
5954
+ return this.$L;
5955
+ var n2 = this.clone(), r2 = S(t2, e2, true);
5956
+ return r2 && (n2.$L = r2), n2;
5957
+ }, m2.clone = function() {
5958
+ return O.w(this.$d, this);
5959
+ }, m2.toDate = function() {
5960
+ return new Date(this.valueOf());
5961
+ }, m2.toJSON = function() {
5962
+ return this.isValid() ? this.toISOString() : null;
5963
+ }, m2.toISOString = function() {
5964
+ return this.$d.toISOString();
5965
+ }, m2.toString = function() {
5966
+ return this.$d.toUTCString();
5967
+ }, M2;
5968
+ }(), _ = b.prototype;
5969
+ return w.prototype = _, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
5970
+ _[t2[1]] = function(e2) {
5971
+ return this.$g(e2, t2[0], t2[1]);
5972
+ };
5973
+ }), w.extend = function(t2, e2) {
5974
+ return t2.$i || (t2(e2, b, w), t2.$i = true), w;
5975
+ }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
5976
+ return w(1e3 * t2);
5977
+ }, w.en = D[g], w.Ls = D, w.p = {}, w;
5978
+ });
5979
+ }
5980
+ });
5981
+
5982
+ // node_modules/.pnpm/dayjs@1.11.9/node_modules/dayjs/plugin/isToday.js
5983
+ var require_isToday = __commonJS({
5984
+ "node_modules/.pnpm/dayjs@1.11.9/node_modules/dayjs/plugin/isToday.js"(exports, module) {
5985
+ !function(e, o) {
5986
+ "object" == typeof exports && "undefined" != typeof module ? module.exports = o() : "function" == typeof define && define.amd ? define(o) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isToday = o();
5987
+ }(exports, function() {
5988
+ "use strict";
5989
+ return function(e, o, t) {
5990
+ o.prototype.isToday = function() {
5991
+ var e2 = "YYYY-MM-DD", o2 = t();
5992
+ return this.format(e2) === o2.format(e2);
5993
+ };
5994
+ };
5995
+ });
5996
+ }
5997
+ });
5998
+
5999
+ // node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/SymbolTreeNode.js
6000
+ var require_SymbolTreeNode = __commonJS({
6001
+ "node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/SymbolTreeNode.js"(exports, module) {
6002
+ "use strict";
6003
+ module.exports = class SymbolTreeNode {
6004
+ constructor() {
6005
+ this.parent = null;
6006
+ this.previousSibling = null;
6007
+ this.nextSibling = null;
6008
+ this.firstChild = null;
6009
+ this.lastChild = null;
6010
+ this.childrenVersion = 0;
6011
+ this.childIndexCachedUpTo = null;
6012
+ this.cachedIndex = -1;
6013
+ this.cachedIndexVersion = NaN;
6014
+ }
6015
+ get isAttached() {
6016
+ return Boolean(this.parent || this.previousSibling || this.nextSibling);
6017
+ }
6018
+ get hasChildren() {
6019
+ return Boolean(this.firstChild);
6020
+ }
6021
+ childrenChanged() {
6022
+ this.childrenVersion = this.childrenVersion + 1 & 4294967295;
6023
+ this.childIndexCachedUpTo = null;
6024
+ }
6025
+ getCachedIndex(parentNode) {
6026
+ if (this.cachedIndexVersion !== parentNode.childrenVersion) {
6027
+ this.cachedIndexVersion = NaN;
6028
+ return -1;
6029
+ }
6030
+ return this.cachedIndex;
6031
+ }
6032
+ setCachedIndex(parentNode, index) {
6033
+ this.cachedIndexVersion = parentNode.childrenVersion;
6034
+ this.cachedIndex = index;
6035
+ }
6036
+ };
6037
+ }
6038
+ });
6039
+
6040
+ // node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/TreePosition.js
6041
+ var require_TreePosition = __commonJS({
6042
+ "node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/TreePosition.js"(exports, module) {
6043
+ "use strict";
6044
+ module.exports = Object.freeze({
6045
+ // same as DOM DOCUMENT_POSITION_
6046
+ DISCONNECTED: 1,
6047
+ PRECEDING: 2,
6048
+ FOLLOWING: 4,
6049
+ CONTAINS: 8,
6050
+ CONTAINED_BY: 16
6051
+ });
6052
+ }
6053
+ });
6054
+
6055
+ // node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/TreeIterator.js
6056
+ var require_TreeIterator = __commonJS({
6057
+ "node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/TreeIterator.js"(exports, module) {
6058
+ "use strict";
6059
+ var TREE = Symbol();
6060
+ var ROOT = Symbol();
6061
+ var NEXT = Symbol();
6062
+ var ITERATE_FUNC = Symbol();
6063
+ var TreeIterator = class {
6064
+ constructor(tree, root, firstResult, iterateFunction) {
6065
+ this[TREE] = tree;
6066
+ this[ROOT] = root;
6067
+ this[NEXT] = firstResult;
6068
+ this[ITERATE_FUNC] = iterateFunction;
6069
+ }
6070
+ next() {
6071
+ const tree = this[TREE];
6072
+ const iterateFunc = this[ITERATE_FUNC];
6073
+ const root = this[ROOT];
6074
+ if (!this[NEXT]) {
6075
+ return {
6076
+ done: true,
6077
+ value: root
6078
+ };
6079
+ }
6080
+ const value = this[NEXT];
6081
+ if (iterateFunc === 1) {
6082
+ this[NEXT] = tree._node(value).previousSibling;
6083
+ } else if (iterateFunc === 2) {
6084
+ this[NEXT] = tree._node(value).nextSibling;
6085
+ } else if (iterateFunc === 3) {
6086
+ this[NEXT] = tree._node(value).parent;
6087
+ } else if (iterateFunc === 4) {
6088
+ this[NEXT] = tree.preceding(value, { root });
6089
+ } else {
6090
+ this[NEXT] = tree.following(value, { root });
6091
+ }
6092
+ return {
6093
+ done: false,
6094
+ value
6095
+ };
6096
+ }
6097
+ };
6098
+ Object.defineProperty(TreeIterator.prototype, Symbol.iterator, {
6099
+ value: function() {
6100
+ return this;
6101
+ },
6102
+ writable: false
6103
+ });
6104
+ TreeIterator.PREV = 1;
6105
+ TreeIterator.NEXT = 2;
6106
+ TreeIterator.PARENT = 3;
6107
+ TreeIterator.PRECEDING = 4;
6108
+ TreeIterator.FOLLOWING = 5;
6109
+ Object.freeze(TreeIterator);
6110
+ Object.freeze(TreeIterator.prototype);
6111
+ module.exports = TreeIterator;
6112
+ }
6113
+ });
6114
+
6115
+ // node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/SymbolTree.js
6116
+ var require_SymbolTree = __commonJS({
6117
+ "node_modules/.pnpm/symbol-tree@3.2.4/node_modules/symbol-tree/lib/SymbolTree.js"(exports, module) {
6118
+ "use strict";
6119
+ var SymbolTreeNode = require_SymbolTreeNode();
6120
+ var TreePosition = require_TreePosition();
6121
+ var TreeIterator = require_TreeIterator();
6122
+ function returnTrue() {
6123
+ return true;
6124
+ }
6125
+ function reverseArrayIndex(array, reverseIndex) {
6126
+ return array[array.length - 1 - reverseIndex];
6127
+ }
6128
+ var SymbolTree = class {
6129
+ /**
6130
+ * @constructor
6131
+ * @alias module:symbol-tree
6132
+ * @param {string} [description='SymbolTree data'] Description used for the Symbol
6133
+ */
6134
+ constructor(description) {
6135
+ this.symbol = Symbol(description || "SymbolTree data");
6136
+ }
6137
+ /**
6138
+ * You can use this function to (optionally) initialize an object right after its creation,
6139
+ * to take advantage of V8's fast properties. Also useful if you would like to
6140
+ * freeze your object.
6141
+ *
6142
+ * `O(1)`
6143
+ *
6144
+ * @method
6145
+ * @alias module:symbol-tree#initialize
6146
+ * @param {Object} object
6147
+ * @return {Object} object
6148
+ */
6149
+ initialize(object) {
6150
+ this._node(object);
6151
+ return object;
6152
+ }
6153
+ _node(object) {
6154
+ if (!object) {
6155
+ return null;
6156
+ }
6157
+ const node = object[this.symbol];
6158
+ if (node) {
6159
+ return node;
6160
+ }
6161
+ return object[this.symbol] = new SymbolTreeNode();
6162
+ }
6163
+ /**
6164
+ * Returns `true` if the object has any children. Otherwise it returns `false`.
6165
+ *
6166
+ * * `O(1)`
6167
+ *
6168
+ * @method hasChildren
6169
+ * @memberOf module:symbol-tree#
6170
+ * @param {Object} object
6171
+ * @return {Boolean}
6172
+ */
6173
+ hasChildren(object) {
6174
+ return this._node(object).hasChildren;
6175
+ }
6176
+ /**
6177
+ * Returns the first child of the given object.
6178
+ *
6179
+ * * `O(1)`
6180
+ *
6181
+ * @method firstChild
6182
+ * @memberOf module:symbol-tree#
6183
+ * @param {Object} object
6184
+ * @return {Object}
6185
+ */
6186
+ firstChild(object) {
6187
+ return this._node(object).firstChild;
6188
+ }
6189
+ /**
6190
+ * Returns the last child of the given object.
6191
+ *
6192
+ * * `O(1)`
6193
+ *
6194
+ * @method lastChild
6195
+ * @memberOf module:symbol-tree#
6196
+ * @param {Object} object
6197
+ * @return {Object}
6198
+ */
6199
+ lastChild(object) {
6200
+ return this._node(object).lastChild;
6201
+ }
6202
+ /**
6203
+ * Returns the previous sibling of the given object.
6204
+ *
6205
+ * * `O(1)`
6206
+ *
6207
+ * @method previousSibling
6208
+ * @memberOf module:symbol-tree#
6209
+ * @param {Object} object
6210
+ * @return {Object}
6211
+ */
6212
+ previousSibling(object) {
6213
+ return this._node(object).previousSibling;
6214
+ }
6215
+ /**
6216
+ * Returns the next sibling of the given object.
6217
+ *
6218
+ * * `O(1)`
6219
+ *
6220
+ * @method nextSibling
6221
+ * @memberOf module:symbol-tree#
6222
+ * @param {Object} object
6223
+ * @return {Object}
6224
+ */
6225
+ nextSibling(object) {
6226
+ return this._node(object).nextSibling;
6227
+ }
6228
+ /**
6229
+ * Return the parent of the given object.
6230
+ *
6231
+ * * `O(1)`
6232
+ *
6233
+ * @method parent
6234
+ * @memberOf module:symbol-tree#
6235
+ * @param {Object} object
6236
+ * @return {Object}
6237
+ */
6238
+ parent(object) {
6239
+ return this._node(object).parent;
6240
+ }
6241
+ /**
6242
+ * Find the inclusive descendant that is last in tree order of the given object.
6243
+ *
6244
+ * * `O(n)` (worst case) where `n` is the depth of the subtree of `object`
6245
+ *
6246
+ * @method lastInclusiveDescendant
6247
+ * @memberOf module:symbol-tree#
6248
+ * @param {Object} object
6249
+ * @return {Object}
6250
+ */
6251
+ lastInclusiveDescendant(object) {
6252
+ let lastChild;
6253
+ let current = object;
6254
+ while (lastChild = this._node(current).lastChild) {
6255
+ current = lastChild;
6256
+ }
6257
+ return current;
6258
+ }
6259
+ /**
6260
+ * Find the preceding object (A) of the given object (B).
6261
+ * An object A is preceding an object B if A and B are in the same tree
6262
+ * and A comes before B in tree order.
6263
+ *
6264
+ * * `O(n)` (worst case)
6265
+ * * `O(1)` (amortized when walking the entire tree)
6266
+ *
6267
+ * @method preceding
6268
+ * @memberOf module:symbol-tree#
6269
+ * @param {Object} object
6270
+ * @param {Object} [options]
6271
+ * @param {Object} [options.root] If set, `root` must be an inclusive ancestor
6272
+ * of the return value (or else null is returned). This check _assumes_
6273
+ * that `root` is also an inclusive ancestor of the given `object`
6274
+ * @return {?Object}
6275
+ */
6276
+ preceding(object, options) {
6277
+ const treeRoot = options && options.root;
6278
+ if (object === treeRoot) {
6279
+ return null;
6280
+ }
6281
+ const previousSibling = this._node(object).previousSibling;
6282
+ if (previousSibling) {
6283
+ return this.lastInclusiveDescendant(previousSibling);
6284
+ }
6285
+ return this._node(object).parent;
6286
+ }
6287
+ /**
6288
+ * Find the following object (A) of the given object (B).
6289
+ * An object A is following an object B if A and B are in the same tree
6290
+ * and A comes after B in tree order.
6291
+ *
6292
+ * * `O(n)` (worst case) where `n` is the amount of objects in the entire tree
6293
+ * * `O(1)` (amortized when walking the entire tree)
6294
+ *
6295
+ * @method following
6296
+ * @memberOf module:symbol-tree#
6297
+ * @param {!Object} object
6298
+ * @param {Object} [options]
6299
+ * @param {Object} [options.root] If set, `root` must be an inclusive ancestor
6300
+ * of the return value (or else null is returned). This check _assumes_
6301
+ * that `root` is also an inclusive ancestor of the given `object`
6302
+ * @param {Boolean} [options.skipChildren=false] If set, ignore the children of `object`
6303
+ * @return {?Object}
6304
+ */
6305
+ following(object, options) {
6306
+ const treeRoot = options && options.root;
6307
+ const skipChildren = options && options.skipChildren;
6308
+ const firstChild = !skipChildren && this._node(object).firstChild;
6309
+ if (firstChild) {
6310
+ return firstChild;
6311
+ }
6312
+ let current = object;
6313
+ do {
6314
+ if (current === treeRoot) {
6315
+ return null;
6316
+ }
6317
+ const nextSibling = this._node(current).nextSibling;
6318
+ if (nextSibling) {
6319
+ return nextSibling;
6320
+ }
6321
+ current = this._node(current).parent;
6322
+ } while (current);
6323
+ return null;
6324
+ }
6325
+ /**
6326
+ * Append all children of the given object to an array.
6327
+ *
6328
+ * * `O(n)` where `n` is the amount of children of the given `parent`
6329
+ *
6330
+ * @method childrenToArray
6331
+ * @memberOf module:symbol-tree#
6332
+ * @param {Object} parent
6333
+ * @param {Object} [options]
6334
+ * @param {Object[]} [options.array=[]]
6335
+ * @param {Function} [options.filter] Function to test each object before it is added to the array.
6336
+ * Invoked with arguments (object). Should return `true` if an object
6337
+ * is to be included.
6338
+ * @param {*} [options.thisArg] Value to use as `this` when executing `filter`.
6339
+ * @return {Object[]}
6340
+ */
6341
+ childrenToArray(parent, options) {
6342
+ const array = options && options.array || [];
6343
+ const filter2 = options && options.filter || returnTrue;
6344
+ const thisArg = options && options.thisArg || void 0;
6345
+ const parentNode = this._node(parent);
6346
+ let object = parentNode.firstChild;
6347
+ let index = 0;
6348
+ while (object) {
6349
+ const node = this._node(object);
6350
+ node.setCachedIndex(parentNode, index);
6351
+ if (filter2.call(thisArg, object)) {
6352
+ array.push(object);
6353
+ }
6354
+ object = node.nextSibling;
6355
+ ++index;
6356
+ }
6357
+ return array;
6358
+ }
6359
+ /**
6360
+ * Append all inclusive ancestors of the given object to an array.
6361
+ *
6362
+ * * `O(n)` where `n` is the amount of ancestors of the given `object`
6363
+ *
6364
+ * @method ancestorsToArray
6365
+ * @memberOf module:symbol-tree#
6366
+ * @param {Object} object
6367
+ * @param {Object} [options]
6368
+ * @param {Object[]} [options.array=[]]
6369
+ * @param {Function} [options.filter] Function to test each object before it is added to the array.
6370
+ * Invoked with arguments (object). Should return `true` if an object
6371
+ * is to be included.
6372
+ * @param {*} [options.thisArg] Value to use as `this` when executing `filter`.
6373
+ * @return {Object[]}
6374
+ */
6375
+ ancestorsToArray(object, options) {
6376
+ const array = options && options.array || [];
6377
+ const filter2 = options && options.filter || returnTrue;
6378
+ const thisArg = options && options.thisArg || void 0;
6379
+ let ancestor = object;
6380
+ while (ancestor) {
6381
+ if (filter2.call(thisArg, ancestor)) {
6382
+ array.push(ancestor);
6383
+ }
6384
+ ancestor = this._node(ancestor).parent;
6385
+ }
6386
+ return array;
6387
+ }
6388
+ /**
6389
+ * Append all descendants of the given object to an array (in tree order).
6390
+ *
6391
+ * * `O(n)` where `n` is the amount of objects in the sub-tree of the given `object`
6392
+ *
6393
+ * @method treeToArray
6394
+ * @memberOf module:symbol-tree#
6395
+ * @param {Object} root
6396
+ * @param {Object} [options]
6397
+ * @param {Object[]} [options.array=[]]
6398
+ * @param {Function} [options.filter] Function to test each object before it is added to the array.
6399
+ * Invoked with arguments (object). Should return `true` if an object
6400
+ * is to be included.
6401
+ * @param {*} [options.thisArg] Value to use as `this` when executing `filter`.
6402
+ * @return {Object[]}
6403
+ */
6404
+ treeToArray(root, options) {
6405
+ const array = options && options.array || [];
6406
+ const filter2 = options && options.filter || returnTrue;
6407
+ const thisArg = options && options.thisArg || void 0;
6408
+ let object = root;
6409
+ while (object) {
6410
+ if (filter2.call(thisArg, object)) {
6411
+ array.push(object);
6412
+ }
6413
+ object = this.following(object, { root });
6414
+ }
6415
+ return array;
6416
+ }
6417
+ /**
6418
+ * Iterate over all children of the given object
6419
+ *
6420
+ * * `O(1)` for a single iteration
6421
+ *
6422
+ * @method childrenIterator
6423
+ * @memberOf module:symbol-tree#
6424
+ * @param {Object} parent
6425
+ * @param {Object} [options]
6426
+ * @param {Boolean} [options.reverse=false]
6427
+ * @return {Object} An iterable iterator (ES6)
6428
+ */
6429
+ childrenIterator(parent, options) {
6430
+ const reverse = options && options.reverse;
6431
+ const parentNode = this._node(parent);
6432
+ return new TreeIterator(
6433
+ this,
6434
+ parent,
6435
+ reverse ? parentNode.lastChild : parentNode.firstChild,
6436
+ reverse ? TreeIterator.PREV : TreeIterator.NEXT
6437
+ );
6438
+ }
6439
+ /**
6440
+ * Iterate over all the previous siblings of the given object. (in reverse tree order)
6441
+ *
6442
+ * * `O(1)` for a single iteration
6443
+ *
6444
+ * @method previousSiblingsIterator
6445
+ * @memberOf module:symbol-tree#
6446
+ * @param {Object} object
6447
+ * @return {Object} An iterable iterator (ES6)
6448
+ */
6449
+ previousSiblingsIterator(object) {
6450
+ return new TreeIterator(
6451
+ this,
6452
+ object,
6453
+ this._node(object).previousSibling,
6454
+ TreeIterator.PREV
6455
+ );
6456
+ }
6457
+ /**
6458
+ * Iterate over all the next siblings of the given object. (in tree order)
6459
+ *
6460
+ * * `O(1)` for a single iteration
6461
+ *
6462
+ * @method nextSiblingsIterator
6463
+ * @memberOf module:symbol-tree#
6464
+ * @param {Object} object
6465
+ * @return {Object} An iterable iterator (ES6)
6466
+ */
6467
+ nextSiblingsIterator(object) {
6468
+ return new TreeIterator(
6469
+ this,
6470
+ object,
6471
+ this._node(object).nextSibling,
6472
+ TreeIterator.NEXT
6473
+ );
6474
+ }
6475
+ /**
6476
+ * Iterate over all inclusive ancestors of the given object
6477
+ *
6478
+ * * `O(1)` for a single iteration
6479
+ *
6480
+ * @method ancestorsIterator
6481
+ * @memberOf module:symbol-tree#
6482
+ * @param {Object} object
6483
+ * @return {Object} An iterable iterator (ES6)
6484
+ */
6485
+ ancestorsIterator(object) {
6486
+ return new TreeIterator(
6487
+ this,
6488
+ object,
6489
+ object,
6490
+ TreeIterator.PARENT
6491
+ );
6492
+ }
6493
+ /**
6494
+ * Iterate over all descendants of the given object (in tree order).
6495
+ *
6496
+ * Where `n` is the amount of objects in the sub-tree of the given `root`:
6497
+ *
6498
+ * * `O(n)` (worst case for a single iteration)
6499
+ * * `O(n)` (amortized, when completing the iterator)
6500
+ *
6501
+ * @method treeIterator
6502
+ * @memberOf module:symbol-tree#
6503
+ * @param {Object} root
6504
+ * @param {Object} options
6505
+ * @param {Boolean} [options.reverse=false]
6506
+ * @return {Object} An iterable iterator (ES6)
6507
+ */
6508
+ treeIterator(root, options) {
6509
+ const reverse = options && options.reverse;
6510
+ return new TreeIterator(
6511
+ this,
6512
+ root,
6513
+ reverse ? this.lastInclusiveDescendant(root) : root,
6514
+ reverse ? TreeIterator.PRECEDING : TreeIterator.FOLLOWING
6515
+ );
6516
+ }
6517
+ /**
6518
+ * Find the index of the given object (the number of preceding siblings).
6519
+ *
6520
+ * * `O(n)` where `n` is the amount of preceding siblings
6521
+ * * `O(1)` (amortized, if the tree is not modified)
6522
+ *
6523
+ * @method index
6524
+ * @memberOf module:symbol-tree#
6525
+ * @param {Object} child
6526
+ * @return {Number} The number of preceding siblings, or -1 if the object has no parent
6527
+ */
6528
+ index(child) {
6529
+ const childNode = this._node(child);
6530
+ const parentNode = this._node(childNode.parent);
6531
+ if (!parentNode) {
6532
+ return -1;
6533
+ }
6534
+ let currentIndex = childNode.getCachedIndex(parentNode);
6535
+ if (currentIndex >= 0) {
6536
+ return currentIndex;
6537
+ }
6538
+ currentIndex = 0;
6539
+ let object = parentNode.firstChild;
6540
+ if (parentNode.childIndexCachedUpTo) {
6541
+ const cachedUpToNode = this._node(parentNode.childIndexCachedUpTo);
6542
+ object = cachedUpToNode.nextSibling;
6543
+ currentIndex = cachedUpToNode.getCachedIndex(parentNode) + 1;
6544
+ }
6545
+ while (object) {
6546
+ const node = this._node(object);
6547
+ node.setCachedIndex(parentNode, currentIndex);
6548
+ if (object === child) {
6549
+ break;
6550
+ }
6551
+ ++currentIndex;
6552
+ object = node.nextSibling;
6553
+ }
6554
+ parentNode.childIndexCachedUpTo = child;
6555
+ return currentIndex;
6556
+ }
6557
+ /**
6558
+ * Calculate the number of children.
6559
+ *
6560
+ * * `O(n)` where `n` is the amount of children
6561
+ * * `O(1)` (amortized, if the tree is not modified)
6562
+ *
6563
+ * @method childrenCount
6564
+ * @memberOf module:symbol-tree#
6565
+ * @param {Object} parent
6566
+ * @return {Number}
6567
+ */
6568
+ childrenCount(parent) {
6569
+ const parentNode = this._node(parent);
6570
+ if (!parentNode.lastChild) {
6571
+ return 0;
6572
+ }
6573
+ return this.index(parentNode.lastChild) + 1;
6574
+ }
6575
+ /**
6576
+ * Compare the position of an object relative to another object. A bit set is returned:
6577
+ *
6578
+ * <ul>
6579
+ * <li>DISCONNECTED : 1</li>
6580
+ * <li>PRECEDING : 2</li>
6581
+ * <li>FOLLOWING : 4</li>
6582
+ * <li>CONTAINS : 8</li>
6583
+ * <li>CONTAINED_BY : 16</li>
6584
+ * </ul>
6585
+ *
6586
+ * The semantics are the same as compareDocumentPosition in DOM, with the exception that
6587
+ * DISCONNECTED never occurs with any other bit.
6588
+ *
6589
+ * where `n` and `m` are the amount of ancestors of `left` and `right`;
6590
+ * where `o` is the amount of children of the lowest common ancestor of `left` and `right`:
6591
+ *
6592
+ * * `O(n + m + o)` (worst case)
6593
+ * * `O(n + m)` (amortized, if the tree is not modified)
6594
+ *
6595
+ * @method compareTreePosition
6596
+ * @memberOf module:symbol-tree#
6597
+ * @param {Object} left
6598
+ * @param {Object} right
6599
+ * @return {Number}
6600
+ */
6601
+ compareTreePosition(left, right) {
6602
+ if (left === right) {
6603
+ return 0;
6604
+ }
6605
+ const leftAncestors = [];
6606
+ {
6607
+ let leftAncestor = left;
6608
+ while (leftAncestor) {
6609
+ if (leftAncestor === right) {
6610
+ return TreePosition.CONTAINS | TreePosition.PRECEDING;
6611
+ }
6612
+ leftAncestors.push(leftAncestor);
6613
+ leftAncestor = this.parent(leftAncestor);
6614
+ }
6615
+ }
6616
+ const rightAncestors = [];
6617
+ {
6618
+ let rightAncestor = right;
6619
+ while (rightAncestor) {
6620
+ if (rightAncestor === left) {
6621
+ return TreePosition.CONTAINED_BY | TreePosition.FOLLOWING;
6622
+ }
6623
+ rightAncestors.push(rightAncestor);
6624
+ rightAncestor = this.parent(rightAncestor);
6625
+ }
6626
+ }
6627
+ const root = reverseArrayIndex(leftAncestors, 0);
6628
+ if (!root || root !== reverseArrayIndex(rightAncestors, 0)) {
6629
+ return TreePosition.DISCONNECTED;
6630
+ }
6631
+ let commonAncestorIndex = 0;
6632
+ const ancestorsMinLength = Math.min(leftAncestors.length, rightAncestors.length);
6633
+ for (let i = 0; i < ancestorsMinLength; ++i) {
6634
+ const leftAncestor = reverseArrayIndex(leftAncestors, i);
6635
+ const rightAncestor = reverseArrayIndex(rightAncestors, i);
6636
+ if (leftAncestor !== rightAncestor) {
6637
+ break;
6638
+ }
6639
+ commonAncestorIndex = i;
6640
+ }
6641
+ const leftIndex = this.index(reverseArrayIndex(leftAncestors, commonAncestorIndex + 1));
6642
+ const rightIndex = this.index(reverseArrayIndex(rightAncestors, commonAncestorIndex + 1));
6643
+ return rightIndex < leftIndex ? TreePosition.PRECEDING : TreePosition.FOLLOWING;
6644
+ }
6645
+ /**
6646
+ * Remove the object from this tree.
6647
+ * Has no effect if already removed.
6648
+ *
6649
+ * * `O(1)`
6650
+ *
6651
+ * @method remove
6652
+ * @memberOf module:symbol-tree#
6653
+ * @param {Object} removeObject
6654
+ * @return {Object} removeObject
6655
+ */
6656
+ remove(removeObject) {
6657
+ const removeNode = this._node(removeObject);
6658
+ const parentNode = this._node(removeNode.parent);
6659
+ const prevNode = this._node(removeNode.previousSibling);
6660
+ const nextNode = this._node(removeNode.nextSibling);
6661
+ if (parentNode) {
6662
+ if (parentNode.firstChild === removeObject) {
6663
+ parentNode.firstChild = removeNode.nextSibling;
6664
+ }
6665
+ if (parentNode.lastChild === removeObject) {
6666
+ parentNode.lastChild = removeNode.previousSibling;
6667
+ }
6668
+ }
6669
+ if (prevNode) {
6670
+ prevNode.nextSibling = removeNode.nextSibling;
6671
+ }
6672
+ if (nextNode) {
6673
+ nextNode.previousSibling = removeNode.previousSibling;
6674
+ }
6675
+ removeNode.parent = null;
6676
+ removeNode.previousSibling = null;
6677
+ removeNode.nextSibling = null;
6678
+ removeNode.cachedIndex = -1;
6679
+ removeNode.cachedIndexVersion = NaN;
6680
+ if (parentNode) {
6681
+ parentNode.childrenChanged();
6682
+ }
6683
+ return removeObject;
6684
+ }
6685
+ /**
6686
+ * Insert the given object before the reference object.
6687
+ * `newObject` is now the previous sibling of `referenceObject`.
6688
+ *
6689
+ * * `O(1)`
6690
+ *
6691
+ * @method insertBefore
6692
+ * @memberOf module:symbol-tree#
6693
+ * @param {Object} referenceObject
6694
+ * @param {Object} newObject
6695
+ * @throws {Error} If the newObject is already present in this SymbolTree
6696
+ * @return {Object} newObject
6697
+ */
6698
+ insertBefore(referenceObject, newObject) {
6699
+ const referenceNode = this._node(referenceObject);
6700
+ const prevNode = this._node(referenceNode.previousSibling);
6701
+ const newNode = this._node(newObject);
6702
+ const parentNode = this._node(referenceNode.parent);
6703
+ if (newNode.isAttached) {
6704
+ throw Error("Given object is already present in this SymbolTree, remove it first");
6705
+ }
6706
+ newNode.parent = referenceNode.parent;
6707
+ newNode.previousSibling = referenceNode.previousSibling;
6708
+ newNode.nextSibling = referenceObject;
6709
+ referenceNode.previousSibling = newObject;
6710
+ if (prevNode) {
6711
+ prevNode.nextSibling = newObject;
6712
+ }
6713
+ if (parentNode && parentNode.firstChild === referenceObject) {
6714
+ parentNode.firstChild = newObject;
6715
+ }
6716
+ if (parentNode) {
6717
+ parentNode.childrenChanged();
6718
+ }
6719
+ return newObject;
6720
+ }
6721
+ /**
6722
+ * Insert the given object after the reference object.
6723
+ * `newObject` is now the next sibling of `referenceObject`.
6724
+ *
6725
+ * * `O(1)`
6726
+ *
6727
+ * @method insertAfter
6728
+ * @memberOf module:symbol-tree#
6729
+ * @param {Object} referenceObject
6730
+ * @param {Object} newObject
6731
+ * @throws {Error} If the newObject is already present in this SymbolTree
6732
+ * @return {Object} newObject
6733
+ */
6734
+ insertAfter(referenceObject, newObject) {
6735
+ const referenceNode = this._node(referenceObject);
6736
+ const nextNode = this._node(referenceNode.nextSibling);
6737
+ const newNode = this._node(newObject);
6738
+ const parentNode = this._node(referenceNode.parent);
6739
+ if (newNode.isAttached) {
6740
+ throw Error("Given object is already present in this SymbolTree, remove it first");
6741
+ }
6742
+ newNode.parent = referenceNode.parent;
6743
+ newNode.previousSibling = referenceObject;
6744
+ newNode.nextSibling = referenceNode.nextSibling;
6745
+ referenceNode.nextSibling = newObject;
6746
+ if (nextNode) {
6747
+ nextNode.previousSibling = newObject;
6748
+ }
6749
+ if (parentNode && parentNode.lastChild === referenceObject) {
6750
+ parentNode.lastChild = newObject;
6751
+ }
6752
+ if (parentNode) {
6753
+ parentNode.childrenChanged();
6754
+ }
6755
+ return newObject;
6756
+ }
6757
+ /**
6758
+ * Insert the given object as the first child of the given reference object.
6759
+ * `newObject` is now the first child of `referenceObject`.
6760
+ *
6761
+ * * `O(1)`
6762
+ *
6763
+ * @method prependChild
6764
+ * @memberOf module:symbol-tree#
6765
+ * @param {Object} referenceObject
6766
+ * @param {Object} newObject
6767
+ * @throws {Error} If the newObject is already present in this SymbolTree
6768
+ * @return {Object} newObject
6769
+ */
6770
+ prependChild(referenceObject, newObject) {
6771
+ const referenceNode = this._node(referenceObject);
6772
+ const newNode = this._node(newObject);
6773
+ if (newNode.isAttached) {
6774
+ throw Error("Given object is already present in this SymbolTree, remove it first");
6775
+ }
6776
+ if (referenceNode.hasChildren) {
6777
+ this.insertBefore(referenceNode.firstChild, newObject);
6778
+ } else {
6779
+ newNode.parent = referenceObject;
6780
+ referenceNode.firstChild = newObject;
6781
+ referenceNode.lastChild = newObject;
6782
+ referenceNode.childrenChanged();
6783
+ }
6784
+ return newObject;
6785
+ }
6786
+ /**
6787
+ * Insert the given object as the last child of the given reference object.
6788
+ * `newObject` is now the last child of `referenceObject`.
6789
+ *
6790
+ * * `O(1)`
6791
+ *
6792
+ * @method appendChild
6793
+ * @memberOf module:symbol-tree#
6794
+ * @param {Object} referenceObject
6795
+ * @param {Object} newObject
6796
+ * @throws {Error} If the newObject is already present in this SymbolTree
6797
+ * @return {Object} newObject
6798
+ */
6799
+ appendChild(referenceObject, newObject) {
6800
+ const referenceNode = this._node(referenceObject);
6801
+ const newNode = this._node(newObject);
6802
+ if (newNode.isAttached) {
6803
+ throw Error("Given object is already present in this SymbolTree, remove it first");
6804
+ }
6805
+ if (referenceNode.hasChildren) {
6806
+ this.insertAfter(referenceNode.lastChild, newObject);
6807
+ } else {
6808
+ newNode.parent = referenceObject;
6809
+ referenceNode.firstChild = newObject;
6810
+ referenceNode.lastChild = newObject;
6811
+ referenceNode.childrenChanged();
6812
+ }
6813
+ return newObject;
6814
+ }
6815
+ };
6816
+ module.exports = SymbolTree;
6817
+ SymbolTree.TreePosition = TreePosition;
6818
+ }
6819
+ });
6820
+
5688
6821
  // node_modules/.pnpm/@push.rocks+isohash@2.0.1/node_modules/@push.rocks/isohash/dist_ts/index.js
5689
6822
  var dist_ts_exports2 = {};
5690
6823
  __export(dist_ts_exports2, {
@@ -5881,6 +7014,12 @@ __export(smartstring_create_exports, {
5881
7014
  createRandomString: () => createRandomString
5882
7015
  });
5883
7016
 
7017
+ // node_modules/.pnpm/@push.rocks+smartenv@5.0.5/node_modules/@push.rocks/smartenv/dist_ts/index.js
7018
+ var dist_ts_exports3 = {};
7019
+ __export(dist_ts_exports3, {
7020
+ Smartenv: () => Smartenv2
7021
+ });
7022
+
5884
7023
  // node_modules/.pnpm/@push.rocks+smartenv@5.0.5/node_modules/@push.rocks/smartenv/dist_ts/smartenv.plugins.js
5885
7024
  var smartpromise2 = __toESM(require_dist_ts(), 1);
5886
7025
 
@@ -8960,6 +10099,955 @@ var ObservableIntake = class {
8960
10099
  }
8961
10100
  };
8962
10101
 
10102
+ // node_modules/.pnpm/@push.rocks+webstore@2.0.13/node_modules/@push.rocks/webstore/dist_ts/index.js
10103
+ var dist_ts_exports13 = {};
10104
+ __export(dist_ts_exports13, {
10105
+ TypedrequestCache: () => TypedrequestCache,
10106
+ WebStore: () => WebStore
10107
+ });
10108
+
10109
+ // node_modules/.pnpm/croner@5.7.0/node_modules/croner/dist/croner.min.mjs
10110
+ function minitz(y, m, d, h, i, s, tz, throwOnInvalid) {
10111
+ return minitz.fromTZ(minitz.tp(y, m, d, h, i, s, tz), throwOnInvalid);
10112
+ }
10113
+ minitz.fromTZISO = (localTimeStr, tz, throwOnInvalid) => {
10114
+ return minitz.fromTZ(parseISOLocal(localTimeStr, tz), throwOnInvalid);
10115
+ };
10116
+ minitz.fromTZ = function(tp, throwOnInvalid) {
10117
+ const inDate = new Date(Date.UTC(tp.y, tp.m - 1, tp.d, tp.h, tp.i, tp.s)), offset = getTimezoneOffset(tp.tz, inDate), dateGuess = new Date(inDate.getTime() - offset), dateOffsGuess = getTimezoneOffset(tp.tz, dateGuess);
10118
+ if (dateOffsGuess - offset === 0) {
10119
+ return dateGuess;
10120
+ } else {
10121
+ const dateGuess2 = new Date(inDate.getTime() - dateOffsGuess), dateOffsGuess2 = getTimezoneOffset(tp.tz, dateGuess2);
10122
+ if (dateOffsGuess2 - dateOffsGuess === 0) {
10123
+ return dateGuess2;
10124
+ } else if (!throwOnInvalid && dateOffsGuess2 - dateOffsGuess > 0) {
10125
+ return dateGuess2;
10126
+ } else if (!throwOnInvalid) {
10127
+ return dateGuess;
10128
+ } else {
10129
+ throw new Error("Invalid date passed to fromTZ()");
10130
+ }
10131
+ }
10132
+ };
10133
+ minitz.toTZ = function(d, tzStr) {
10134
+ const td = new Date(d.toLocaleString("sv-SE", { timeZone: tzStr }));
10135
+ return { y: td.getFullYear(), m: td.getMonth() + 1, d: td.getDate(), h: td.getHours(), i: td.getMinutes(), s: td.getSeconds(), tz: tzStr };
10136
+ };
10137
+ minitz.tp = (y, m, d, h, i, s, tz) => {
10138
+ return { y, m, d, h, i, s, tz };
10139
+ };
10140
+ function getTimezoneOffset(timeZone, date = /* @__PURE__ */ new Date()) {
10141
+ const tz = date.toLocaleString("en", { timeZone, timeStyle: "long" }).split(" ").slice(-1)[0];
10142
+ const dateString = date.toLocaleString("en-US").replace(/[\u202f]/, " ");
10143
+ return Date.parse(`${dateString} GMT`) - Date.parse(`${dateString} ${tz}`);
10144
+ }
10145
+ function parseISOLocal(dtStr, tz) {
10146
+ const pd = new Date(Date.parse(dtStr));
10147
+ if (isNaN(pd)) {
10148
+ throw new Error("minitz: Invalid ISO8601 passed to parser.");
10149
+ }
10150
+ const stringEnd = dtStr.substring(9);
10151
+ if (dtStr.includes("Z") || stringEnd.includes("-") || stringEnd.includes("+")) {
10152
+ return minitz.tp(pd.getUTCFullYear(), pd.getUTCMonth() + 1, pd.getUTCDate(), pd.getUTCHours(), pd.getUTCMinutes(), pd.getUTCSeconds(), "Etc/UTC");
10153
+ } else {
10154
+ return minitz.tp(pd.getFullYear(), pd.getMonth() + 1, pd.getDate(), pd.getHours(), pd.getMinutes(), pd.getSeconds(), tz);
10155
+ }
10156
+ }
10157
+ minitz.minitz = minitz;
10158
+ function CronOptions(options) {
10159
+ if (options === void 0) {
10160
+ options = {};
10161
+ }
10162
+ delete options.name;
10163
+ options.legacyMode = options.legacyMode === void 0 ? true : options.legacyMode;
10164
+ options.paused = options.paused === void 0 ? false : options.paused;
10165
+ options.maxRuns = options.maxRuns === void 0 ? Infinity : options.maxRuns;
10166
+ options.catch = options.catch === void 0 ? false : options.catch;
10167
+ options.interval = options.interval === void 0 ? 0 : parseInt(options.interval, 10);
10168
+ options.utcOffset = options.utcOffset === void 0 ? void 0 : parseInt(options.utcOffset, 10);
10169
+ options.unref = options.unref === void 0 ? false : options.unref;
10170
+ options.kill = false;
10171
+ if (options.startAt) {
10172
+ options.startAt = new CronDate(options.startAt, options.timezone);
10173
+ }
10174
+ if (options.stopAt) {
10175
+ options.stopAt = new CronDate(options.stopAt, options.timezone);
10176
+ }
10177
+ if (options.interval !== null) {
10178
+ if (isNaN(options.interval)) {
10179
+ throw new Error("CronOptions: Supplied value for interval is not a number");
10180
+ } else if (options.interval < 0) {
10181
+ throw new Error("CronOptions: Supplied value for interval can not be negative");
10182
+ }
10183
+ }
10184
+ if (options.utcOffset !== void 0) {
10185
+ if (isNaN(options.utcOffset)) {
10186
+ throw new Error("CronOptions: Invalid value passed for utcOffset, should be number representing minutes offset from UTC.");
10187
+ } else if (options.utcOffset < -870 || options.utcOffset > 870) {
10188
+ throw new Error("CronOptions: utcOffset out of bounds.");
10189
+ }
10190
+ if (options.utcOffset !== void 0 && options.timezone) {
10191
+ throw new Error("CronOptions: Combining 'utcOffset' with 'timezone' is not allowed.");
10192
+ }
10193
+ }
10194
+ if (options.unref !== true && options.unref !== false) {
10195
+ throw new Error("CronOptions: Unref should be either true, false or undefined(false).");
10196
+ }
10197
+ return options;
10198
+ }
10199
+ var DaysOfMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
10200
+ var RecursionSteps = [["month", "year", 0], ["day", "month", -1], ["hour", "day", 0], ["minute", "hour", 0], ["second", "minute", 0]];
10201
+ function CronDate(d, tz) {
10202
+ this.tz = tz;
10203
+ if (d && d instanceof Date) {
10204
+ if (!isNaN(d)) {
10205
+ this.fromDate(d);
10206
+ } else {
10207
+ throw new TypeError("CronDate: Invalid date passed to CronDate constructor");
10208
+ }
10209
+ } else if (d === void 0) {
10210
+ this.fromDate(/* @__PURE__ */ new Date());
10211
+ } else if (d && typeof d === "string") {
10212
+ this.fromString(d);
10213
+ } else if (d instanceof CronDate) {
10214
+ this.fromCronDate(d);
10215
+ } else {
10216
+ throw new TypeError("CronDate: Invalid type (" + typeof d + ") passed to CronDate constructor");
10217
+ }
10218
+ }
10219
+ CronDate.prototype.fromDate = function(inDate) {
10220
+ if (this.tz !== void 0) {
10221
+ if (typeof this.tz === "number") {
10222
+ this.ms = inDate.getUTCMilliseconds();
10223
+ this.second = inDate.getUTCSeconds();
10224
+ this.minute = inDate.getUTCMinutes() + this.tz;
10225
+ this.hour = inDate.getUTCHours();
10226
+ this.day = inDate.getUTCDate();
10227
+ this.month = inDate.getUTCMonth();
10228
+ this.year = inDate.getUTCFullYear();
10229
+ this.apply();
10230
+ } else {
10231
+ const d = minitz.toTZ(inDate, this.tz);
10232
+ this.ms = inDate.getMilliseconds();
10233
+ this.second = d.s;
10234
+ this.minute = d.i;
10235
+ this.hour = d.h;
10236
+ this.day = d.d;
10237
+ this.month = d.m - 1;
10238
+ this.year = d.y;
10239
+ }
10240
+ } else {
10241
+ this.ms = inDate.getMilliseconds();
10242
+ this.second = inDate.getSeconds();
10243
+ this.minute = inDate.getMinutes();
10244
+ this.hour = inDate.getHours();
10245
+ this.day = inDate.getDate();
10246
+ this.month = inDate.getMonth();
10247
+ this.year = inDate.getFullYear();
10248
+ }
10249
+ };
10250
+ CronDate.prototype.fromCronDate = function(d) {
10251
+ this.tz = d.tz;
10252
+ this.year = d.year;
10253
+ this.month = d.month;
10254
+ this.day = d.day;
10255
+ this.hour = d.hour;
10256
+ this.minute = d.minute;
10257
+ this.second = d.second;
10258
+ this.ms = d.ms;
10259
+ };
10260
+ CronDate.prototype.apply = function() {
10261
+ if (this.month > 11 || this.day > DaysOfMonth[this.month] || this.hour > 59 || this.minute > 59 || this.second > 59 || this.hour < 0 || this.minute < 0 || this.second < 0) {
10262
+ const d = new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms));
10263
+ this.ms = d.getUTCMilliseconds();
10264
+ this.second = d.getUTCSeconds();
10265
+ this.minute = d.getUTCMinutes();
10266
+ this.hour = d.getUTCHours();
10267
+ this.day = d.getUTCDate();
10268
+ this.month = d.getUTCMonth();
10269
+ this.year = d.getUTCFullYear();
10270
+ return true;
10271
+ } else {
10272
+ return false;
10273
+ }
10274
+ };
10275
+ CronDate.prototype.fromString = function(str) {
10276
+ return this.fromDate(minitz.fromTZISO(str, this.tz));
10277
+ };
10278
+ CronDate.prototype.findNext = function(options, target, pattern, offset) {
10279
+ const originalTarget = this[target];
10280
+ let lastDayOfMonth;
10281
+ if (pattern.lastDayOfMonth) {
10282
+ if (this.month !== 1) {
10283
+ lastDayOfMonth = DaysOfMonth[this.month];
10284
+ } else {
10285
+ lastDayOfMonth = new Date(Date.UTC(this.year, this.month + 1, 0, 0, 0, 0, 0)).getUTCDate();
10286
+ }
10287
+ }
10288
+ const fDomWeekDay = !pattern.starDOW && target == "day" ? new Date(Date.UTC(this.year, this.month, 1, 0, 0, 0, 0)).getUTCDay() : void 0;
10289
+ for (let i = this[target] + offset; i < pattern[target].length; i++) {
10290
+ let match = pattern[target][i];
10291
+ if (target === "day" && pattern.lastDayOfMonth && i - offset == lastDayOfMonth) {
10292
+ match = true;
10293
+ }
10294
+ if (target === "day" && !pattern.starDOW) {
10295
+ const dowMatch = pattern.dow[(fDomWeekDay + (i - offset - 1)) % 7];
10296
+ if (options.legacyMode && !pattern.starDOM) {
10297
+ match = match || dowMatch;
10298
+ } else {
10299
+ match = match && dowMatch;
10300
+ }
10301
+ }
10302
+ if (match) {
10303
+ this[target] = i - offset;
10304
+ return originalTarget !== this[target] ? 2 : 1;
10305
+ }
10306
+ }
10307
+ return 3;
10308
+ };
10309
+ CronDate.prototype.recurse = function(pattern, options, doing) {
10310
+ const res = this.findNext(options, RecursionSteps[doing][0], pattern, RecursionSteps[doing][2]);
10311
+ if (res > 1) {
10312
+ let resetLevel = doing + 1;
10313
+ while (resetLevel < RecursionSteps.length) {
10314
+ this[RecursionSteps[resetLevel][0]] = -RecursionSteps[resetLevel][2];
10315
+ resetLevel++;
10316
+ }
10317
+ if (res === 3) {
10318
+ this[RecursionSteps[doing][1]]++;
10319
+ this[RecursionSteps[doing][0]] = -RecursionSteps[doing][2];
10320
+ this.apply();
10321
+ return this.recurse(pattern, options, 0);
10322
+ } else if (this.apply()) {
10323
+ return this.recurse(pattern, options, doing - 1);
10324
+ }
10325
+ }
10326
+ doing += 1;
10327
+ if (doing >= RecursionSteps.length) {
10328
+ return this;
10329
+ } else if (this.year >= 3e3) {
10330
+ return null;
10331
+ } else {
10332
+ return this.recurse(pattern, options, doing);
10333
+ }
10334
+ };
10335
+ CronDate.prototype.increment = function(pattern, options, hasPreviousRun) {
10336
+ if (options.interval > 1 && hasPreviousRun) {
10337
+ this.second += options.interval;
10338
+ } else {
10339
+ this.second += 1;
10340
+ }
10341
+ this.ms = 0;
10342
+ this.apply();
10343
+ return this.recurse(pattern, options, 0);
10344
+ };
10345
+ CronDate.prototype.getDate = function(internal) {
10346
+ if (internal || this.tz === void 0 && this.utcOffset === void 0) {
10347
+ return new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.ms);
10348
+ } else {
10349
+ if (typeof this.tz === "number") {
10350
+ return new Date(Date.UTC(this.year, this.month, this.day, this.hour, this.minute - this.tz, this.second, this.ms));
10351
+ } else {
10352
+ return minitz(this.year, this.month + 1, this.day, this.hour, this.minute, this.second, this.tz);
10353
+ }
10354
+ }
10355
+ };
10356
+ CronDate.prototype.getTime = function() {
10357
+ return this.getDate().getTime();
10358
+ };
10359
+ function CronPattern(pattern, timezone) {
10360
+ this.pattern = pattern;
10361
+ this.timezone = timezone;
10362
+ this.second = Array(60).fill(0);
10363
+ this.minute = Array(60).fill(0);
10364
+ this.hour = Array(24).fill(0);
10365
+ this.day = Array(31).fill(0);
10366
+ this.month = Array(12).fill(0);
10367
+ this.dow = Array(8).fill(0);
10368
+ this.lastDayOfMonth = false;
10369
+ this.starDOM = false;
10370
+ this.starDOW = false;
10371
+ this.parse();
10372
+ }
10373
+ CronPattern.prototype.parse = function() {
10374
+ if (!(typeof this.pattern === "string" || this.pattern.constructor === String)) {
10375
+ throw new TypeError("CronPattern: Pattern has to be of type string.");
10376
+ }
10377
+ if (this.pattern.indexOf("@") >= 0)
10378
+ this.pattern = this.handleNicknames(this.pattern).trim();
10379
+ const parts = this.pattern.replace(/\s+/g, " ").split(" ");
10380
+ if (parts.length < 5 || parts.length > 6) {
10381
+ throw new TypeError("CronPattern: invalid configuration format ('" + this.pattern + "'), exacly five or six space separated parts required.");
10382
+ }
10383
+ if (parts.length === 5) {
10384
+ parts.unshift("0");
10385
+ }
10386
+ if (parts[3].indexOf("L") >= 0) {
10387
+ parts[3] = parts[3].replace("L", "");
10388
+ this.lastDayOfMonth = true;
10389
+ }
10390
+ if (parts[3] == "*") {
10391
+ this.starDOM = true;
10392
+ }
10393
+ if (parts[4].length >= 3)
10394
+ parts[4] = this.replaceAlphaMonths(parts[4]);
10395
+ if (parts[5].length >= 3)
10396
+ parts[5] = this.replaceAlphaDays(parts[5]);
10397
+ if (parts[5] == "*") {
10398
+ this.starDOW = true;
10399
+ }
10400
+ if (this.pattern.indexOf("?") >= 0) {
10401
+ const initDate = new CronDate(/* @__PURE__ */ new Date(), this.timezone).getDate(true);
10402
+ parts[0] = parts[0].replace("?", initDate.getSeconds());
10403
+ parts[1] = parts[1].replace("?", initDate.getMinutes());
10404
+ parts[2] = parts[2].replace("?", initDate.getHours());
10405
+ if (!this.starDOM)
10406
+ parts[3] = parts[3].replace("?", initDate.getDate());
10407
+ parts[4] = parts[4].replace("?", initDate.getMonth() + 1);
10408
+ if (!this.starDOW)
10409
+ parts[5] = parts[5].replace("?", initDate.getDay());
10410
+ }
10411
+ this.throwAtIllegalCharacters(parts);
10412
+ this.partToArray("second", parts[0], 0);
10413
+ this.partToArray("minute", parts[1], 0);
10414
+ this.partToArray("hour", parts[2], 0);
10415
+ this.partToArray("day", parts[3], -1);
10416
+ this.partToArray("month", parts[4], -1);
10417
+ this.partToArray("dow", parts[5], 0);
10418
+ if (this.dow[7]) {
10419
+ this.dow[0] = 1;
10420
+ }
10421
+ };
10422
+ CronPattern.prototype.partToArray = function(type, conf, valueIndexOffset) {
10423
+ const arr = this[type];
10424
+ if (conf === "*")
10425
+ return arr.fill(1);
10426
+ const split = conf.split(",");
10427
+ if (split.length > 1) {
10428
+ for (let i = 0; i < split.length; i++) {
10429
+ this.partToArray(type, split[i], valueIndexOffset);
10430
+ }
10431
+ } else if (conf.indexOf("-") !== -1 && conf.indexOf("/") !== -1) {
10432
+ this.handleRangeWithStepping(conf, type, valueIndexOffset);
10433
+ } else if (conf.indexOf("-") !== -1) {
10434
+ this.handleRange(conf, type, valueIndexOffset);
10435
+ } else if (conf.indexOf("/") !== -1) {
10436
+ this.handleStepping(conf, type, valueIndexOffset);
10437
+ } else if (conf !== "") {
10438
+ this.handleNumber(conf, type, valueIndexOffset);
10439
+ }
10440
+ };
10441
+ CronPattern.prototype.throwAtIllegalCharacters = function(parts) {
10442
+ const reValidCron = /[^/*0-9,-]+/;
10443
+ for (let i = 0; i < parts.length; i++) {
10444
+ if (reValidCron.test(parts[i])) {
10445
+ throw new TypeError("CronPattern: configuration entry " + i + " (" + parts[i] + ") contains illegal characters.");
10446
+ }
10447
+ }
10448
+ };
10449
+ CronPattern.prototype.handleNumber = function(conf, type, valueIndexOffset) {
10450
+ const i = parseInt(conf, 10) + valueIndexOffset;
10451
+ if (isNaN(i)) {
10452
+ throw new TypeError("CronPattern: " + type + " is not a number: '" + conf + "'");
10453
+ }
10454
+ if (i < 0 || i >= this[type].length) {
10455
+ throw new TypeError("CronPattern: " + type + " value out of range: '" + conf + "'");
10456
+ }
10457
+ this[type][i] = 1;
10458
+ };
10459
+ CronPattern.prototype.handleRangeWithStepping = function(conf, type, valueIndexOffset) {
10460
+ const matches = conf.match(/^(\d+)-(\d+)\/(\d+)$/);
10461
+ if (matches === null)
10462
+ throw new TypeError("CronPattern: Syntax error, illegal range with stepping: '" + conf + "'");
10463
+ let [, lower, upper, steps] = matches;
10464
+ lower = parseInt(lower, 10) + valueIndexOffset;
10465
+ upper = parseInt(upper, 10) + valueIndexOffset;
10466
+ steps = parseInt(steps, 10);
10467
+ if (isNaN(lower))
10468
+ throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");
10469
+ if (isNaN(upper))
10470
+ throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");
10471
+ if (isNaN(steps))
10472
+ throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");
10473
+ if (steps === 0)
10474
+ throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
10475
+ if (steps > this[type].length)
10476
+ throw new TypeError("CronPattern: Syntax error, steps cannot be greater than maximum value of part (" + this[type].length + ")");
10477
+ if (lower < 0 || upper >= this[type].length)
10478
+ throw new TypeError("CronPattern: Value out of range: '" + conf + "'");
10479
+ if (lower > upper)
10480
+ throw new TypeError("CronPattern: From value is larger than to value: '" + conf + "'");
10481
+ for (let i = lower; i <= upper; i += steps) {
10482
+ this[type][i] = 1;
10483
+ }
10484
+ };
10485
+ CronPattern.prototype.handleRange = function(conf, type, valueIndexOffset) {
10486
+ const split = conf.split("-");
10487
+ if (split.length !== 2) {
10488
+ throw new TypeError("CronPattern: Syntax error, illegal range: '" + conf + "'");
10489
+ }
10490
+ const lower = parseInt(split[0], 10) + valueIndexOffset, upper = parseInt(split[1], 10) + valueIndexOffset;
10491
+ if (isNaN(lower)) {
10492
+ throw new TypeError("CronPattern: Syntax error, illegal lower range (NaN)");
10493
+ } else if (isNaN(upper)) {
10494
+ throw new TypeError("CronPattern: Syntax error, illegal upper range (NaN)");
10495
+ }
10496
+ if (lower < 0 || upper >= this[type].length) {
10497
+ throw new TypeError("CronPattern: Value out of range: '" + conf + "'");
10498
+ }
10499
+ if (lower > upper) {
10500
+ throw new TypeError("CronPattern: From value is larger than to value: '" + conf + "'");
10501
+ }
10502
+ for (let i = lower; i <= upper; i++) {
10503
+ this[type][i] = 1;
10504
+ }
10505
+ };
10506
+ CronPattern.prototype.handleStepping = function(conf, type) {
10507
+ const split = conf.split("/");
10508
+ if (split.length !== 2) {
10509
+ throw new TypeError("CronPattern: Syntax error, illegal stepping: '" + conf + "'");
10510
+ }
10511
+ let start = 0;
10512
+ if (split[0] !== "*") {
10513
+ start = parseInt(split[0], 10);
10514
+ }
10515
+ const steps = parseInt(split[1], 10);
10516
+ if (isNaN(steps))
10517
+ throw new TypeError("CronPattern: Syntax error, illegal stepping: (NaN)");
10518
+ if (steps === 0)
10519
+ throw new TypeError("CronPattern: Syntax error, illegal stepping: 0");
10520
+ if (steps > this[type].length)
10521
+ throw new TypeError("CronPattern: Syntax error, max steps for part is (" + this[type].length + ")");
10522
+ for (let i = start; i < this[type].length; i += steps) {
10523
+ this[type][i] = 1;
10524
+ }
10525
+ };
10526
+ CronPattern.prototype.replaceAlphaDays = function(conf) {
10527
+ return conf.replace(/-sun/gi, "-7").replace(/sun/gi, "0").replace(/mon/gi, "1").replace(/tue/gi, "2").replace(/wed/gi, "3").replace(/thu/gi, "4").replace(/fri/gi, "5").replace(/sat/gi, "6");
10528
+ };
10529
+ CronPattern.prototype.replaceAlphaMonths = function(conf) {
10530
+ return conf.replace(/jan/gi, "1").replace(/feb/gi, "2").replace(/mar/gi, "3").replace(/apr/gi, "4").replace(/may/gi, "5").replace(/jun/gi, "6").replace(/jul/gi, "7").replace(/aug/gi, "8").replace(/sep/gi, "9").replace(/oct/gi, "10").replace(/nov/gi, "11").replace(/dec/gi, "12");
10531
+ };
10532
+ CronPattern.prototype.handleNicknames = function(pattern) {
10533
+ const cleanPattern = pattern.trim().toLowerCase();
10534
+ if (cleanPattern === "@yearly" || cleanPattern === "@annually") {
10535
+ return "0 0 1 1 *";
10536
+ } else if (cleanPattern === "@monthly") {
10537
+ return "0 0 1 * *";
10538
+ } else if (cleanPattern === "@weekly") {
10539
+ return "0 0 * * 0";
10540
+ } else if (cleanPattern === "@daily") {
10541
+ return "0 0 * * *";
10542
+ } else if (cleanPattern === "@hourly") {
10543
+ return "0 * * * *";
10544
+ } else {
10545
+ return pattern;
10546
+ }
10547
+ };
10548
+ var maxDelay = Math.pow(2, 32 - 1) - 1;
10549
+ var scheduledJobs = [];
10550
+ function isFn(v) {
10551
+ return Object.prototype.toString.call(v) === "[object Function]" || "function" === typeof v || v instanceof Function;
10552
+ }
10553
+ function unref(timer2) {
10554
+ if (typeof Deno !== "undefined" && typeof Deno.unrefTimer !== "undefined") {
10555
+ Deno.unrefTimer(timer2);
10556
+ } else if (timer2 && typeof timer2.unref !== "undefined") {
10557
+ timer2.unref();
10558
+ }
10559
+ }
10560
+ function Cron(pattern, fnOrOptions1, fnOrOptions2) {
10561
+ if (!(this instanceof Cron)) {
10562
+ return new Cron(pattern, fnOrOptions1, fnOrOptions2);
10563
+ }
10564
+ let options, func;
10565
+ if (typeof fnOrOptions1 === "function") {
10566
+ func = fnOrOptions1;
10567
+ } else if (typeof fnOrOptions1 === "object") {
10568
+ options = fnOrOptions1;
10569
+ } else if (fnOrOptions1 !== void 0) {
10570
+ throw new Error("Cron: Invalid argument passed for optionsIn. Should be one of function, or object (options).");
10571
+ }
10572
+ if (typeof fnOrOptions2 === "function") {
10573
+ func = fnOrOptions2;
10574
+ } else if (typeof fnOrOptions2 === "object") {
10575
+ options = fnOrOptions2;
10576
+ } else if (fnOrOptions2 !== void 0) {
10577
+ throw new Error("Cron: Invalid argument passed for funcIn. Should be one of function, or object (options).");
10578
+ }
10579
+ this.name = options ? options.name : void 0;
10580
+ this.options = CronOptions(options);
10581
+ this.once = void 0;
10582
+ this.pattern = void 0;
10583
+ this.blocking = false;
10584
+ this.previousrun = void 0;
10585
+ this.runstarted = void 0;
10586
+ if (pattern && (pattern instanceof Date || typeof pattern === "string" && pattern.indexOf(":") > 0)) {
10587
+ this.once = new CronDate(pattern, this.options.timezone || this.options.utcOffset);
10588
+ } else {
10589
+ this.pattern = new CronPattern(pattern, this.options.timezone);
10590
+ }
10591
+ if (func !== void 0) {
10592
+ this.fn = func;
10593
+ this.schedule();
10594
+ }
10595
+ if (this.name) {
10596
+ const existing = scheduledJobs.find((j) => j.name === this.name);
10597
+ if (existing) {
10598
+ throw new Error("Cron: Tried to initialize new named job '" + this.name + "', but name already taken.");
10599
+ } else {
10600
+ scheduledJobs.push(this);
10601
+ }
10602
+ }
10603
+ return this;
10604
+ }
10605
+ Cron.prototype.next = function(prev) {
10606
+ const next = this._next(prev);
10607
+ return next ? next.getDate() : null;
10608
+ };
10609
+ Cron.prototype.enumerate = function(n, previous) {
10610
+ if (n > this.options.maxRuns) {
10611
+ n = this.options.maxRuns;
10612
+ }
10613
+ const enumeration = [];
10614
+ let prev = previous || this.previousrun;
10615
+ while (n-- && (prev = this.next(prev))) {
10616
+ enumeration.push(prev);
10617
+ }
10618
+ return enumeration;
10619
+ };
10620
+ Cron.prototype.running = function() {
10621
+ const msLeft = this.msToNext(this.previousrun);
10622
+ const running = !this.options.paused && this.fn !== void 0;
10623
+ return msLeft !== null && running;
10624
+ };
10625
+ Cron.prototype.busy = function() {
10626
+ return this.blocking;
10627
+ };
10628
+ Cron.prototype.started = function() {
10629
+ return this.runstarted ? this.runstarted.getDate() : null;
10630
+ };
10631
+ Cron.prototype.previous = function() {
10632
+ return this.previousrun ? this.previousrun.getDate() : null;
10633
+ };
10634
+ Cron.prototype.msToNext = function(prev) {
10635
+ const next = this._next(prev);
10636
+ prev = new CronDate(prev, this.options.timezone || this.options.utcOffset);
10637
+ if (next) {
10638
+ return next.getTime(true) - prev.getTime(true);
10639
+ } else {
10640
+ return null;
10641
+ }
10642
+ };
10643
+ Cron.prototype.stop = function() {
10644
+ this.options.kill = true;
10645
+ if (this.currentTimeout) {
10646
+ clearTimeout(this.currentTimeout);
10647
+ }
10648
+ };
10649
+ Cron.prototype.pause = function() {
10650
+ return (this.options.paused = true) && !this.options.kill;
10651
+ };
10652
+ Cron.prototype.resume = function() {
10653
+ return !(this.options.paused = false) && !this.options.kill;
10654
+ };
10655
+ Cron.prototype.schedule = function(func, partial) {
10656
+ if (func && this.fn) {
10657
+ throw new Error("Cron: It is not allowed to schedule two functions using the same Croner instance.");
10658
+ } else if (func) {
10659
+ this.fn = func;
10660
+ }
10661
+ let waitMs = this.msToNext(partial ? partial : this.previousrun);
10662
+ const target = this.next(partial ? partial : this.previousrun);
10663
+ if (waitMs === null || target === null)
10664
+ return this;
10665
+ if (waitMs > maxDelay) {
10666
+ waitMs = maxDelay;
10667
+ }
10668
+ this.currentTimeout = setTimeout(() => this._checkTrigger(target), waitMs);
10669
+ if (this.currentTimeout && this.options.unref) {
10670
+ unref(this.currentTimeout);
10671
+ }
10672
+ return this;
10673
+ };
10674
+ Cron.prototype._trigger = async function(initiationDate) {
10675
+ this.blocking = true;
10676
+ this.runstarted = new CronDate(initiationDate, this.options.timezone || this.options.utcOffset);
10677
+ if (this.options.catch) {
10678
+ try {
10679
+ await this.fn(this, this.options.context);
10680
+ } catch (_e) {
10681
+ if (isFn(this.options.catch)) {
10682
+ ((inst) => inst.options.catch(_e, inst))(this);
10683
+ }
10684
+ } finally {
10685
+ this.blocking = false;
10686
+ }
10687
+ } else {
10688
+ await this.fn(this, this.options.context);
10689
+ this.blocking = false;
10690
+ }
10691
+ };
10692
+ Cron.prototype._checkTrigger = function(target) {
10693
+ const now = /* @__PURE__ */ new Date(), shouldRun = !this.options.paused && now.getTime() >= target, isBlocked = this.blocking && this.options.protect;
10694
+ if (shouldRun && !isBlocked) {
10695
+ this.options.maxRuns--;
10696
+ this._trigger();
10697
+ this.previousrun = new CronDate(void 0, this.options.timezone || this.options.utcOffset);
10698
+ this.schedule();
10699
+ } else {
10700
+ if (shouldRun && isBlocked && isFn(this.options.protect)) {
10701
+ (async (inst) => inst.options.protect(inst))(this);
10702
+ }
10703
+ this.schedule(void 0, now);
10704
+ }
10705
+ };
10706
+ Cron.prototype._next = function(prev) {
10707
+ const hasPreviousRun = prev || this.previousrun ? true : false;
10708
+ prev = new CronDate(prev, this.options.timezone || this.options.utcOffset);
10709
+ if (this.options.startAt && prev && prev.getTime() < this.options.startAt.getTime()) {
10710
+ prev = this.options.startAt;
10711
+ }
10712
+ const nextRun = this.once || new CronDate(prev, this.options.timezone || this.options.utcOffset).increment(this.pattern, this.options, hasPreviousRun);
10713
+ if (this.once && this.once.getTime() <= prev.getTime()) {
10714
+ return null;
10715
+ } else if (nextRun === null || this.options.maxRuns <= 0 || this.options.kill || this.options.stopAt && nextRun.getTime() >= this.options.stopAt.getTime()) {
10716
+ return null;
10717
+ } else {
10718
+ return nextRun;
10719
+ }
10720
+ };
10721
+ Cron.Cron = Cron;
10722
+ Cron.scheduledJobs = scheduledJobs;
10723
+
10724
+ // node_modules/.pnpm/@push.rocks+smarttime@4.0.5/node_modules/@push.rocks/smarttime/dist_ts/smarttime.plugins.js
10725
+ var import_dayjs = __toESM(require_dayjs_min(), 1);
10726
+ var import_isToday = __toESM(require_isToday(), 1);
10727
+ import_dayjs.default.extend(import_isToday.default);
10728
+
10729
+ // node_modules/.pnpm/@push.rocks+lik@6.0.5/node_modules/@push.rocks/lik/dist_ts/lik.plugins.js
10730
+ var import_symbol_tree = __toESM(require_SymbolTree(), 1);
10731
+
10732
+ // node_modules/.pnpm/idb@7.1.1/node_modules/idb/build/index.js
10733
+ var build_exports = {};
10734
+ __export(build_exports, {
10735
+ deleteDB: () => deleteDB,
10736
+ openDB: () => openDB,
10737
+ unwrap: () => unwrap,
10738
+ wrap: () => wrap
10739
+ });
10740
+
10741
+ // node_modules/.pnpm/idb@7.1.1/node_modules/idb/build/wrap-idb-value.js
10742
+ var instanceOfAny = (object, constructors) => constructors.some((c) => object instanceof c);
10743
+ var idbProxyableTypes;
10744
+ var cursorAdvanceMethods;
10745
+ function getIdbProxyableTypes() {
10746
+ return idbProxyableTypes || (idbProxyableTypes = [
10747
+ IDBDatabase,
10748
+ IDBObjectStore,
10749
+ IDBIndex,
10750
+ IDBCursor,
10751
+ IDBTransaction
10752
+ ]);
10753
+ }
10754
+ function getCursorAdvanceMethods() {
10755
+ return cursorAdvanceMethods || (cursorAdvanceMethods = [
10756
+ IDBCursor.prototype.advance,
10757
+ IDBCursor.prototype.continue,
10758
+ IDBCursor.prototype.continuePrimaryKey
10759
+ ]);
10760
+ }
10761
+ var cursorRequestMap = /* @__PURE__ */ new WeakMap();
10762
+ var transactionDoneMap = /* @__PURE__ */ new WeakMap();
10763
+ var transactionStoreNamesMap = /* @__PURE__ */ new WeakMap();
10764
+ var transformCache = /* @__PURE__ */ new WeakMap();
10765
+ var reverseTransformCache = /* @__PURE__ */ new WeakMap();
10766
+ function promisifyRequest(request) {
10767
+ const promise = new Promise((resolve, reject) => {
10768
+ const unlisten = () => {
10769
+ request.removeEventListener("success", success);
10770
+ request.removeEventListener("error", error);
10771
+ };
10772
+ const success = () => {
10773
+ resolve(wrap(request.result));
10774
+ unlisten();
10775
+ };
10776
+ const error = () => {
10777
+ reject(request.error);
10778
+ unlisten();
10779
+ };
10780
+ request.addEventListener("success", success);
10781
+ request.addEventListener("error", error);
10782
+ });
10783
+ promise.then((value) => {
10784
+ if (value instanceof IDBCursor) {
10785
+ cursorRequestMap.set(value, request);
10786
+ }
10787
+ }).catch(() => {
10788
+ });
10789
+ reverseTransformCache.set(promise, request);
10790
+ return promise;
10791
+ }
10792
+ function cacheDonePromiseForTransaction(tx) {
10793
+ if (transactionDoneMap.has(tx))
10794
+ return;
10795
+ const done = new Promise((resolve, reject) => {
10796
+ const unlisten = () => {
10797
+ tx.removeEventListener("complete", complete);
10798
+ tx.removeEventListener("error", error);
10799
+ tx.removeEventListener("abort", error);
10800
+ };
10801
+ const complete = () => {
10802
+ resolve();
10803
+ unlisten();
10804
+ };
10805
+ const error = () => {
10806
+ reject(tx.error || new DOMException("AbortError", "AbortError"));
10807
+ unlisten();
10808
+ };
10809
+ tx.addEventListener("complete", complete);
10810
+ tx.addEventListener("error", error);
10811
+ tx.addEventListener("abort", error);
10812
+ });
10813
+ transactionDoneMap.set(tx, done);
10814
+ }
10815
+ var idbProxyTraps = {
10816
+ get(target, prop, receiver) {
10817
+ if (target instanceof IDBTransaction) {
10818
+ if (prop === "done")
10819
+ return transactionDoneMap.get(target);
10820
+ if (prop === "objectStoreNames") {
10821
+ return target.objectStoreNames || transactionStoreNamesMap.get(target);
10822
+ }
10823
+ if (prop === "store") {
10824
+ return receiver.objectStoreNames[1] ? void 0 : receiver.objectStore(receiver.objectStoreNames[0]);
10825
+ }
10826
+ }
10827
+ return wrap(target[prop]);
10828
+ },
10829
+ set(target, prop, value) {
10830
+ target[prop] = value;
10831
+ return true;
10832
+ },
10833
+ has(target, prop) {
10834
+ if (target instanceof IDBTransaction && (prop === "done" || prop === "store")) {
10835
+ return true;
10836
+ }
10837
+ return prop in target;
10838
+ }
10839
+ };
10840
+ function replaceTraps(callback) {
10841
+ idbProxyTraps = callback(idbProxyTraps);
10842
+ }
10843
+ function wrapFunction(func) {
10844
+ if (func === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype)) {
10845
+ return function(storeNames, ...args) {
10846
+ const tx = func.call(unwrap(this), storeNames, ...args);
10847
+ transactionStoreNamesMap.set(tx, storeNames.sort ? storeNames.sort() : [storeNames]);
10848
+ return wrap(tx);
10849
+ };
10850
+ }
10851
+ if (getCursorAdvanceMethods().includes(func)) {
10852
+ return function(...args) {
10853
+ func.apply(unwrap(this), args);
10854
+ return wrap(cursorRequestMap.get(this));
10855
+ };
10856
+ }
10857
+ return function(...args) {
10858
+ return wrap(func.apply(unwrap(this), args));
10859
+ };
10860
+ }
10861
+ function transformCachableValue(value) {
10862
+ if (typeof value === "function")
10863
+ return wrapFunction(value);
10864
+ if (value instanceof IDBTransaction)
10865
+ cacheDonePromiseForTransaction(value);
10866
+ if (instanceOfAny(value, getIdbProxyableTypes()))
10867
+ return new Proxy(value, idbProxyTraps);
10868
+ return value;
10869
+ }
10870
+ function wrap(value) {
10871
+ if (value instanceof IDBRequest)
10872
+ return promisifyRequest(value);
10873
+ if (transformCache.has(value))
10874
+ return transformCache.get(value);
10875
+ const newValue = transformCachableValue(value);
10876
+ if (newValue !== value) {
10877
+ transformCache.set(value, newValue);
10878
+ reverseTransformCache.set(newValue, value);
10879
+ }
10880
+ return newValue;
10881
+ }
10882
+ var unwrap = (value) => reverseTransformCache.get(value);
10883
+
10884
+ // node_modules/.pnpm/idb@7.1.1/node_modules/idb/build/index.js
10885
+ function openDB(name, version2, { blocked, upgrade, blocking, terminated } = {}) {
10886
+ const request = indexedDB.open(name, version2);
10887
+ const openPromise = wrap(request);
10888
+ if (upgrade) {
10889
+ request.addEventListener("upgradeneeded", (event) => {
10890
+ upgrade(wrap(request.result), event.oldVersion, event.newVersion, wrap(request.transaction), event);
10891
+ });
10892
+ }
10893
+ if (blocked) {
10894
+ request.addEventListener("blocked", (event) => blocked(
10895
+ // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
10896
+ event.oldVersion,
10897
+ event.newVersion,
10898
+ event
10899
+ ));
10900
+ }
10901
+ openPromise.then((db) => {
10902
+ if (terminated)
10903
+ db.addEventListener("close", () => terminated());
10904
+ if (blocking) {
10905
+ db.addEventListener("versionchange", (event) => blocking(event.oldVersion, event.newVersion, event));
10906
+ }
10907
+ }).catch(() => {
10908
+ });
10909
+ return openPromise;
10910
+ }
10911
+ function deleteDB(name, { blocked } = {}) {
10912
+ const request = indexedDB.deleteDatabase(name);
10913
+ if (blocked) {
10914
+ request.addEventListener("blocked", (event) => blocked(
10915
+ // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
10916
+ event.oldVersion,
10917
+ event
10918
+ ));
10919
+ }
10920
+ return wrap(request).then(() => void 0);
10921
+ }
10922
+ var readMethods = ["get", "getKey", "getAll", "getAllKeys", "count"];
10923
+ var writeMethods = ["put", "add", "delete", "clear"];
10924
+ var cachedMethods = /* @__PURE__ */ new Map();
10925
+ function getMethod(target, prop) {
10926
+ if (!(target instanceof IDBDatabase && !(prop in target) && typeof prop === "string")) {
10927
+ return;
10928
+ }
10929
+ if (cachedMethods.get(prop))
10930
+ return cachedMethods.get(prop);
10931
+ const targetFuncName = prop.replace(/FromIndex$/, "");
10932
+ const useIndex = prop !== targetFuncName;
10933
+ const isWrite = writeMethods.includes(targetFuncName);
10934
+ if (
10935
+ // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
10936
+ !(targetFuncName in (useIndex ? IDBIndex : IDBObjectStore).prototype) || !(isWrite || readMethods.includes(targetFuncName))
10937
+ ) {
10938
+ return;
10939
+ }
10940
+ const method = async function(storeName, ...args) {
10941
+ const tx = this.transaction(storeName, isWrite ? "readwrite" : "readonly");
10942
+ let target2 = tx.store;
10943
+ if (useIndex)
10944
+ target2 = target2.index(args.shift());
10945
+ return (await Promise.all([
10946
+ target2[targetFuncName](...args),
10947
+ isWrite && tx.done
10948
+ ]))[0];
10949
+ };
10950
+ cachedMethods.set(prop, method);
10951
+ return method;
10952
+ }
10953
+ replaceTraps((oldTraps) => ({
10954
+ ...oldTraps,
10955
+ get: (target, prop, receiver) => getMethod(target, prop) || oldTraps.get(target, prop, receiver),
10956
+ has: (target, prop) => !!getMethod(target, prop) || oldTraps.has(target, prop)
10957
+ }));
10958
+
10959
+ // node_modules/.pnpm/@push.rocks+webstore@2.0.13/node_modules/@push.rocks/webstore/dist_ts/webstore.classes.webstore.js
10960
+ var WebStore = class {
10961
+ constructor(optionsArg) {
10962
+ this.initCalled = false;
10963
+ this.readyDeferred = dist_ts_exports6.defer();
10964
+ this.options = optionsArg;
10965
+ }
10966
+ async init() {
10967
+ if (this.initCalled) {
10968
+ await this.readyDeferred.promise;
10969
+ return;
10970
+ }
10971
+ this.initCalled = true;
10972
+ const smartenv = new dist_ts_exports3.Smartenv();
10973
+ if (!smartenv.isBrowser && !globalThis.indexedDB) {
10974
+ console.log("hey");
10975
+ console.log(globalThis.indexedDB);
10976
+ await smartenv.getSafeNodeModule("fake-indexeddb/auto");
10977
+ if (!globalThis.indexedDB) {
10978
+ const mod = await smartenv.getSafeNodeModule("fake-indexeddb");
10979
+ globalThis.indexedDB = new mod.IDBFactory();
10980
+ }
10981
+ }
10982
+ this.db = await build_exports.openDB(this.options.dbName, 1, {
10983
+ upgrade: (db) => {
10984
+ db.createObjectStore(this.options.storeName);
10985
+ }
10986
+ });
10987
+ this.readyDeferred.resolve();
10988
+ return;
10989
+ }
10990
+ async get(key) {
10991
+ await this.init();
10992
+ return this.db.get(this.options.storeName, key);
10993
+ }
10994
+ async check(keyArg) {
10995
+ await this.init();
10996
+ const result = await this.get(keyArg);
10997
+ return !!result;
10998
+ }
10999
+ async set(key, val) {
11000
+ await this.init();
11001
+ return this.db.put(this.options.storeName, val, key);
11002
+ }
11003
+ async delete(key) {
11004
+ await this.init();
11005
+ return this.db.delete(this.options.storeName, key);
11006
+ }
11007
+ async clear() {
11008
+ await this.init();
11009
+ return this.db.clear(this.options.storeName);
11010
+ }
11011
+ async keys() {
11012
+ await this.init();
11013
+ return this.db.getAllKeys(this.options.storeName);
11014
+ }
11015
+ };
11016
+
11017
+ // node_modules/.pnpm/@push.rocks+webstore@2.0.13/node_modules/@push.rocks/webstore/dist_ts/webstore.classes.typedrequestcache.js
11018
+ var TypedrequestCache = class {
11019
+ constructor(domainArg = "default") {
11020
+ this.webstore = new WebStore({
11021
+ dbName: "trStore",
11022
+ storeName: `trStore-${domainArg}`
11023
+ });
11024
+ }
11025
+ buildKey(requestArg) {
11026
+ return dist_ts_exports5.stringify({
11027
+ method: requestArg.method,
11028
+ request: requestArg.request
11029
+ });
11030
+ }
11031
+ /**
11032
+ * stores by request
11033
+ * @param typedrequestarg
11034
+ */
11035
+ async setByRequest(typedrequestArg) {
11036
+ if (!typedrequestArg.response) {
11037
+ throw new Error("You cannot store requests without a response present");
11038
+ }
11039
+ await this.webstore.set(this.buildKey(typedrequestArg), typedrequestArg);
11040
+ }
11041
+ /**
11042
+ * get by full tyoedrequest by partial typedrequest
11043
+ * @param typedrequestarg
11044
+ */
11045
+ async getByRequest(typedrequestArg) {
11046
+ const result = await this.webstore.get(this.buildKey(typedrequestArg));
11047
+ return result;
11048
+ }
11049
+ };
11050
+
8963
11051
  // ts/smartstate.classes.stateaction.ts
8964
11052
  var StateAction = class {
8965
11053
  constructor(statePartRef, actionDef) {
@@ -8973,10 +11061,29 @@ var StateAction = class {
8973
11061
 
8974
11062
  // ts/smartstate.classes.statepart.ts
8975
11063
  var StatePart2 = class {
8976
- constructor(nameArg) {
11064
+ // Add WebStore instance
11065
+ constructor(nameArg, webStoreOptions) {
8977
11066
  this.state = new dist_ts_exports7.rxjs.Subject();
8978
11067
  this.cumulativeDeferred = dist_ts_exports6.cumulativeDefer();
11068
+ this.webStore = null;
8979
11069
  this.name = nameArg;
11070
+ if (webStoreOptions) {
11071
+ this.webStore = new dist_ts_exports13.WebStore(webStoreOptions);
11072
+ this.initWebStore();
11073
+ }
11074
+ }
11075
+ /**
11076
+ * initializes the webstore
11077
+ */
11078
+ async initWebStore() {
11079
+ if (this.webStore) {
11080
+ await this.webStore.init();
11081
+ const storedState = await this.webStore.get(String(this.name));
11082
+ if (storedState) {
11083
+ this.stateStore = storedState;
11084
+ this.notifyChange();
11085
+ }
11086
+ }
8980
11087
  }
8981
11088
  /**
8982
11089
  * gets the state from the state store
@@ -8988,9 +11095,12 @@ var StatePart2 = class {
8988
11095
  * sets the stateStore to the new state
8989
11096
  * @param newStateArg
8990
11097
  */
8991
- setState(newStateArg) {
11098
+ async setState(newStateArg) {
8992
11099
  this.stateStore = newStateArg;
8993
11100
  this.notifyChange();
11101
+ if (this.webStore) {
11102
+ await this.webStore.set(String(this.name), newStateArg);
11103
+ }
8994
11104
  }
8995
11105
  /**
8996
11106
  * notifies of a change on the state