mobx-state-tree 5.4.2-pre.1 → 5.4.2

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.
@@ -45,7 +45,7 @@ var Hook;
45
45
  Hook["beforeDestroy"] = "beforeDestroy";
46
46
  })(Hook || (Hook = {}));
47
47
 
48
- /******************************************************************************
48
+ /*! *****************************************************************************
49
49
  Copyright (c) Microsoft Corporation.
50
50
 
51
51
  Permission to use, copy, modify, and/or distribute this software for any
@@ -59,7 +59,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
59
59
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
60
60
  PERFORMANCE OF THIS SOFTWARE.
61
61
  ***************************************************************************** */
62
- /* global Reflect, Promise, SuppressedError, Symbol */
62
+ /* global Reflect, Promise */
63
63
 
64
64
  var extendStatics = function(d, b) {
65
65
  extendStatics = Object.setPrototypeOf ||
@@ -105,7 +105,7 @@ function __generator(thisArg, body) {
105
105
  function verb(n) { return function (v) { return step([n, v]); }; }
106
106
  function step(op) {
107
107
  if (f) throw new TypeError("Generator is already executing.");
108
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
108
+ while (_) try {
109
109
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
110
110
  if (y = 0, t) op = [op[0] & 2, t.value];
111
111
  switch (op[0]) {
@@ -156,20 +156,12 @@ function __read(o, n) {
156
156
  return ar;
157
157
  }
158
158
 
159
- function __spreadArray(to, from, pack) {
160
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
161
- if (ar || !(i in from)) {
162
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
163
- ar[i] = from[i];
164
- }
165
- }
166
- return to.concat(ar || Array.prototype.slice.call(from));
167
- }
168
-
169
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
170
- var e = new Error(message);
171
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
172
- };
159
+ /** @deprecated */
160
+ function __spread() {
161
+ for (var ar = [], i = 0; i < arguments.length; i++)
162
+ ar = ar.concat(__read(arguments[i]));
163
+ return ar;
164
+ }
173
165
 
174
166
  /**
175
167
  * Returns the _actual_ type of the given tree node. (Or throws)
@@ -467,7 +459,7 @@ function getParent(target, depth) {
467
459
  return parent.storedValue;
468
460
  parent = parent.parent;
469
461
  }
470
- throw fail("Failed to find the parent of ".concat(getStateTreeNode(target), " at depth ").concat(depth));
462
+ throw fail("Failed to find the parent of " + getStateTreeNode(target) + " at depth " + depth);
471
463
  }
472
464
  /**
473
465
  * Given a model instance, returns `true` if the object has a parent of given type, that is, is part of another object, map or array
@@ -505,7 +497,7 @@ function getParentOfType(target, type) {
505
497
  return parent.storedValue;
506
498
  parent = parent.parent;
507
499
  }
508
- throw fail("Failed to find the parent of ".concat(getStateTreeNode(target), " of a given type"));
500
+ throw fail("Failed to find the parent of " + getStateTreeNode(target) + " of a given type");
509
501
  }
510
502
  /**
511
503
  * Given an object in a model tree, returns the root object of that tree.
@@ -873,14 +865,18 @@ function getMembers(target) {
873
865
  reflected.volatile.push(key);
874
866
  return;
875
867
  }
876
- if (descriptor.value._isMSTAction === true)
877
- reflected.actions.push(key);
878
- if (descriptor.value._isFlowAction === true)
868
+ if (descriptor.value._isFlowAction === true) {
879
869
  reflected.flowActions.push(key);
880
- else if (isObservableProp(target, key))
870
+ }
871
+ if (descriptor.value._isMSTAction === true) {
872
+ reflected.actions.push(key);
873
+ }
874
+ else if (isObservableProp(target, key)) {
881
875
  reflected.volatile.push(key);
882
- else
876
+ }
877
+ else {
883
878
  reflected.views.push(key);
879
+ }
884
880
  });
885
881
  return reflected;
886
882
  }
@@ -1360,7 +1356,7 @@ var ScalarNode = /** @class */ (function (_super) {
1360
1356
  writable: true,
1361
1357
  value: function () {
1362
1358
  var path = (this.isAlive ? this.path : this.pathUponDeath) || "<root>";
1363
- return "".concat(this.type.name, "@").concat(path).concat(this.isAlive ? "" : " [dead]");
1359
+ return this.type.name + "@" + path + (this.isAlive ? "" : " [dead]");
1364
1360
  }
1365
1361
  });
1366
1362
  Object.defineProperty(ScalarNode.prototype, "die", {
@@ -1506,7 +1502,7 @@ var ObjectNode = /** @class */ (function (_super) {
1506
1502
  enumerable: true,
1507
1503
  configurable: true,
1508
1504
  writable: true,
1509
- value: 0 /* ObservableInstanceLifecycle.UNINITIALIZED */
1505
+ value: 0 /* UNINITIALIZED */
1510
1506
  });
1511
1507
  Object.defineProperty(_this, "_childNodes", {
1512
1508
  enumerable: true,
@@ -1573,7 +1569,7 @@ var ObjectNode = /** @class */ (function (_super) {
1573
1569
  }
1574
1570
  }
1575
1571
  if (typeof id !== "string" && typeof id !== "number") {
1576
- throw fail("Instance identifier '".concat(_this.identifierAttribute, "' for type '").concat(_this.type.name, "' must be a string or a number"));
1572
+ throw fail("Instance identifier '" + _this.identifierAttribute + "' for type '" + _this.type.name + "' must be a string or a number");
1577
1573
  }
1578
1574
  // normalize internal identifier to string
1579
1575
  _this.identifier = normalizeIdentifier(id);
@@ -1611,7 +1607,7 @@ var ObjectNode = /** @class */ (function (_super) {
1611
1607
  writable: true,
1612
1608
  value: function (fireHooks) {
1613
1609
  if (fireHooks === void 0) { fireHooks = true; }
1614
- if (this._observableInstanceState === 0 /* ObservableInstanceLifecycle.UNINITIALIZED */) {
1610
+ if (this._observableInstanceState === 0 /* UNINITIALIZED */) {
1615
1611
  this.createObservableInstance(fireHooks);
1616
1612
  }
1617
1613
  }
@@ -1629,7 +1625,7 @@ var ObjectNode = /** @class */ (function (_super) {
1629
1625
  throw fail("assertion failed: the creation of the observable instance must be done on the initializing phase");
1630
1626
  }
1631
1627
  }
1632
- this._observableInstanceState = 1 /* ObservableInstanceLifecycle.CREATING */;
1628
+ this._observableInstanceState = 1 /* CREATING */;
1633
1629
  // make sure the parent chain is created as well
1634
1630
  // array with parent chain from parent to child
1635
1631
  var parentChain = [];
@@ -1639,7 +1635,7 @@ var ObjectNode = /** @class */ (function (_super) {
1639
1635
  // this is done to avoid traversing the whole tree to the root when using
1640
1636
  // the same reference again
1641
1637
  while (parent &&
1642
- parent._observableInstanceState === 0 /* ObservableInstanceLifecycle.UNINITIALIZED */) {
1638
+ parent._observableInstanceState === 0 /* UNINITIALIZED */) {
1643
1639
  parentChain.unshift(parent);
1644
1640
  parent = parent.parent;
1645
1641
  }
@@ -1673,7 +1669,7 @@ var ObjectNode = /** @class */ (function (_super) {
1673
1669
  finally {
1674
1670
  this._isRunningAction = false;
1675
1671
  }
1676
- this._observableInstanceState = 2 /* ObservableInstanceLifecycle.CREATED */;
1672
+ this._observableInstanceState = 2 /* CREATED */;
1677
1673
  this._snapshotComputed.trackAndCompute();
1678
1674
  if (this.isRoot)
1679
1675
  this._addSnapshotReaction();
@@ -1756,10 +1752,10 @@ var ObjectNode = /** @class */ (function (_super) {
1756
1752
  throw fail("assertion failed: new parent expected");
1757
1753
  }
1758
1754
  if (this.parent && parentChanged) {
1759
- throw fail("A node cannot exists twice in the state tree. Failed to add ".concat(this, " to path '").concat(newParent.path, "/").concat(subpath, "'."));
1755
+ throw fail("A node cannot exists twice in the state tree. Failed to add " + this + " to path '" + newParent.path + "/" + subpath + "'.");
1760
1756
  }
1761
1757
  if (!this.parent && newParent.root === this) {
1762
- throw fail("A state tree is not allowed to contain itself. Cannot assign ".concat(this, " to path '").concat(newParent.path, "/").concat(subpath, "'"));
1758
+ throw fail("A state tree is not allowed to contain itself. Cannot assign " + this + " to path '" + newParent.path + "/" + subpath + "'");
1763
1759
  }
1764
1760
  if (!this.parent && !!this.environment && this.environment !== newParent.root.environment) {
1765
1761
  throw fail("A state tree cannot be made part of another state tree as long as their environments are different.");
@@ -1818,7 +1814,7 @@ var ObjectNode = /** @class */ (function (_super) {
1818
1814
  value: function () {
1819
1815
  if (!this.isAlive)
1820
1816
  return this._snapshotUponDeath;
1821
- return this._observableInstanceState === 2 /* ObservableInstanceLifecycle.CREATED */
1817
+ return this._observableInstanceState === 2 /* CREATED */
1822
1818
  ? this._getActualSnapshot()
1823
1819
  : this._getCachedInitialSnapshot();
1824
1820
  }
@@ -1891,9 +1887,9 @@ var ObjectNode = /** @class */ (function (_super) {
1891
1887
  if (actionContext && actionContext.name != null) {
1892
1888
  // try to use the context, and if it not available use the node one
1893
1889
  var actionPath = (actionContext && actionContext.context && getPath(actionContext.context)) || escapedPath;
1894
- actionFullPath = "".concat(actionPath, ".").concat(actionContext.name, "()");
1890
+ actionFullPath = actionPath + "." + actionContext.name + "()";
1895
1891
  }
1896
- return "You are trying to read or write to an object that is no longer part of a state tree. (Object type: '".concat(this.type.name, "', Path upon death: '").concat(escapedPath, "', Subpath: '").concat(subpath, "', Action: '").concat(actionFullPath, "'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.");
1892
+ return "You are trying to read or write to an object that is no longer part of a state tree. (Object type: '" + this.type.name + "', Path upon death: '" + escapedPath + "', Subpath: '" + subpath + "', Action: '" + actionFullPath + "'). Either detach nodes first, or don't use objects after removing / replacing them in the tree.";
1897
1893
  }
1898
1894
  });
1899
1895
  Object.defineProperty(ObjectNode.prototype, "getChildNode", {
@@ -1906,7 +1902,7 @@ var ObjectNode = /** @class */ (function (_super) {
1906
1902
  });
1907
1903
  this._autoUnbox = false;
1908
1904
  try {
1909
- return this._observableInstanceState === 2 /* ObservableInstanceLifecycle.CREATED */
1905
+ return this._observableInstanceState === 2 /* CREATED */
1910
1906
  ? this.type.getChildNode(this, subpath)
1911
1907
  : this._childNodes[subpath];
1912
1908
  }
@@ -1923,7 +1919,7 @@ var ObjectNode = /** @class */ (function (_super) {
1923
1919
  this.assertAlive(EMPTY_OBJECT);
1924
1920
  this._autoUnbox = false;
1925
1921
  try {
1926
- return this._observableInstanceState === 2 /* ObservableInstanceLifecycle.CREATED */
1922
+ return this._observableInstanceState === 2 /* CREATED */
1927
1923
  ? this.type.getChildren(this)
1928
1924
  : convertChildNodesToArray(this._childNodes);
1929
1925
  }
@@ -1954,7 +1950,7 @@ var ObjectNode = /** @class */ (function (_super) {
1954
1950
  value: function (context) {
1955
1951
  this.assertAlive(context);
1956
1952
  if (!this.isRunningAction() && this.isProtected) {
1957
- throw fail("Cannot modify '".concat(this, "', the object is protected and can only be modified by using an action."));
1953
+ throw fail("Cannot modify '" + this + "', the object is protected and can only be modified by using an action.");
1958
1954
  }
1959
1955
  }
1960
1956
  });
@@ -1986,8 +1982,8 @@ var ObjectNode = /** @class */ (function (_super) {
1986
1982
  writable: true,
1987
1983
  value: function () {
1988
1984
  var path = (this.isAlive ? this.path : this.pathUponDeath) || "<root>";
1989
- var identifier = this.identifier ? "(id: ".concat(this.identifier, ")") : "";
1990
- return "".concat(this.type.name, "@").concat(path).concat(identifier).concat(this.isAlive ? "" : " [dead]");
1985
+ var identifier = this.identifier ? "(id: " + this.identifier + ")" : "";
1986
+ return this.type.name + "@" + path + identifier + (this.isAlive ? "" : " [dead]");
1991
1987
  }
1992
1988
  });
1993
1989
  Object.defineProperty(ObjectNode.prototype, "finalizeCreation", {
@@ -2069,7 +2065,7 @@ var ObjectNode = /** @class */ (function (_super) {
2069
2065
  configurable: true,
2070
2066
  writable: true,
2071
2067
  value: function () {
2072
- if (this._observableInstanceState === 0 /* ObservableInstanceLifecycle.UNINITIALIZED */) {
2068
+ if (this._observableInstanceState === 0 /* UNINITIALIZED */) {
2073
2069
  return;
2074
2070
  }
2075
2071
  this.getChildren().forEach(function (node) {
@@ -2078,8 +2074,8 @@ var ObjectNode = /** @class */ (function (_super) {
2078
2074
  // beforeDestroy should run before the disposers since else we could end up in a situation where
2079
2075
  // a disposer added with addDisposer at this stage (beforeDestroy) is actually never released
2080
2076
  this.baseAboutToDie();
2081
- this._internalEventsEmit("dispose" /* InternalEvents.Dispose */);
2082
- this._internalEventsClear("dispose" /* InternalEvents.Dispose */);
2077
+ this._internalEventsEmit("dispose" /* Dispose */);
2078
+ this._internalEventsClear("dispose" /* Dispose */);
2083
2079
  }
2084
2080
  });
2085
2081
  Object.defineProperty(ObjectNode.prototype, "finalizeDeath", {
@@ -2105,7 +2101,7 @@ var ObjectNode = /** @class */ (function (_super) {
2105
2101
  writable: true,
2106
2102
  value: function (onChange) {
2107
2103
  this._addSnapshotReaction();
2108
- return this._internalEventsRegister("snapshot" /* InternalEvents.Snapshot */, onChange);
2104
+ return this._internalEventsRegister("snapshot" /* Snapshot */, onChange);
2109
2105
  }
2110
2106
  });
2111
2107
  Object.defineProperty(ObjectNode.prototype, "emitSnapshot", {
@@ -2113,7 +2109,7 @@ var ObjectNode = /** @class */ (function (_super) {
2113
2109
  configurable: true,
2114
2110
  writable: true,
2115
2111
  value: function (snapshot) {
2116
- this._internalEventsEmit("snapshot" /* InternalEvents.Snapshot */, snapshot);
2112
+ this._internalEventsEmit("snapshot" /* Snapshot */, snapshot);
2117
2113
  }
2118
2114
  });
2119
2115
  Object.defineProperty(ObjectNode.prototype, "onPatch", {
@@ -2121,7 +2117,7 @@ var ObjectNode = /** @class */ (function (_super) {
2121
2117
  configurable: true,
2122
2118
  writable: true,
2123
2119
  value: function (handler) {
2124
- return this._internalEventsRegister("patch" /* InternalEvents.Patch */, handler);
2120
+ return this._internalEventsRegister("patch" /* Patch */, handler);
2125
2121
  }
2126
2122
  });
2127
2123
  Object.defineProperty(ObjectNode.prototype, "emitPatch", {
@@ -2129,12 +2125,12 @@ var ObjectNode = /** @class */ (function (_super) {
2129
2125
  configurable: true,
2130
2126
  writable: true,
2131
2127
  value: function (basePatch, source) {
2132
- if (this._internalEventsHasSubscribers("patch" /* InternalEvents.Patch */)) {
2128
+ if (this._internalEventsHasSubscribers("patch" /* Patch */)) {
2133
2129
  var localizedPatch = extend({}, basePatch, {
2134
2130
  path: source.path.substr(this.path.length) + "/" + basePatch.path // calculate the relative path of the patch
2135
2131
  });
2136
2132
  var _a = __read(splitPatch(localizedPatch), 2), patch = _a[0], reversePatch = _a[1];
2137
- this._internalEventsEmit("patch" /* InternalEvents.Patch */, patch, reversePatch);
2133
+ this._internalEventsEmit("patch" /* Patch */, patch, reversePatch);
2138
2134
  }
2139
2135
  if (this.parent)
2140
2136
  this.parent.emitPatch(basePatch, source);
@@ -2145,7 +2141,7 @@ var ObjectNode = /** @class */ (function (_super) {
2145
2141
  configurable: true,
2146
2142
  writable: true,
2147
2143
  value: function (disposer) {
2148
- return this._internalEventsHas("dispose" /* InternalEvents.Dispose */, disposer);
2144
+ return this._internalEventsHas("dispose" /* Dispose */, disposer);
2149
2145
  }
2150
2146
  });
2151
2147
  Object.defineProperty(ObjectNode.prototype, "addDisposer", {
@@ -2154,7 +2150,7 @@ var ObjectNode = /** @class */ (function (_super) {
2154
2150
  writable: true,
2155
2151
  value: function (disposer) {
2156
2152
  if (!this.hasDisposer(disposer)) {
2157
- this._internalEventsRegister("dispose" /* InternalEvents.Dispose */, disposer, true);
2153
+ this._internalEventsRegister("dispose" /* Dispose */, disposer, true);
2158
2154
  return;
2159
2155
  }
2160
2156
  throw fail("cannot add a disposer when it is already registered for execution");
@@ -2165,10 +2161,10 @@ var ObjectNode = /** @class */ (function (_super) {
2165
2161
  configurable: true,
2166
2162
  writable: true,
2167
2163
  value: function (disposer) {
2168
- if (!this._internalEventsHas("dispose" /* InternalEvents.Dispose */, disposer)) {
2164
+ if (!this._internalEventsHas("dispose" /* Dispose */, disposer)) {
2169
2165
  throw fail("cannot remove a disposer which was never registered for execution");
2170
2166
  }
2171
- this._internalEventsUnregister("dispose" /* InternalEvents.Dispose */, disposer);
2167
+ this._internalEventsUnregister("dispose" /* Dispose */, disposer);
2172
2168
  }
2173
2169
  });
2174
2170
  Object.defineProperty(ObjectNode.prototype, "removeMiddleware", {
@@ -2276,7 +2272,7 @@ var ObjectNode = /** @class */ (function (_super) {
2276
2272
  args[_i - 1] = arguments[_i];
2277
2273
  }
2278
2274
  if (this._internalEvents) {
2279
- (_a = this._internalEvents).emit.apply(_a, __spreadArray([event], __read(args), false));
2275
+ (_a = this._internalEvents).emit.apply(_a, __spread([event], args));
2280
2276
  }
2281
2277
  }
2282
2278
  });
@@ -2919,11 +2915,11 @@ function serializeArgument(node, actionName, index, arg) {
2919
2915
  // We should not serialize MST nodes, even if we can, because we don't know if the receiving party can handle a raw snapshot instead of an
2920
2916
  // MST type instance. So if one wants to serialize a MST node that was pass in, either explitly pass: 1: an id, 2: a (relative) path, 3: a snapshot
2921
2917
  if (isStateTreeNode(arg))
2922
- return serializeTheUnserializable("[MSTNode: ".concat(getType(arg).name, "]"));
2918
+ return serializeTheUnserializable("[MSTNode: " + getType(arg).name + "]");
2923
2919
  if (typeof arg === "function")
2924
2920
  return serializeTheUnserializable("[function]");
2925
2921
  if (typeof arg === "object" && !isPlainObject(arg) && !isArray(arg))
2926
- return serializeTheUnserializable("[object ".concat((arg && arg.constructor && arg.constructor.name) || "Complex Object", "]"));
2922
+ return serializeTheUnserializable("[object " + ((arg && arg.constructor && arg.constructor.name) || "Complex Object") + "]");
2927
2923
  try {
2928
2924
  // Check if serializable, cycle free etc...
2929
2925
  // MWE: there must be a better way....
@@ -2964,7 +2960,7 @@ function applyAction(target, actions) {
2964
2960
  function baseApplyAction(target, action) {
2965
2961
  var resolvedTarget = tryResolve(target, action.path || "");
2966
2962
  if (!resolvedTarget)
2967
- throw fail("Invalid action path: ".concat(action.path || ""));
2963
+ throw fail("Invalid action path: " + (action.path || ""));
2968
2964
  var node = getStateTreeNode(resolvedTarget);
2969
2965
  // Reserved functions
2970
2966
  if (action.name === "@APPLY_PATCHES") {
@@ -2974,7 +2970,7 @@ function baseApplyAction(target, action) {
2974
2970
  return applySnapshot.call(null, resolvedTarget, action.args[0]);
2975
2971
  }
2976
2972
  if (!(typeof resolvedTarget[action.name] === "function"))
2977
- throw fail("Action '".concat(action.name, "' does not exist in '").concat(node.path, "'"));
2973
+ throw fail("Action '" + action.name + "' does not exist in '" + node.path + "'");
2978
2974
  return resolvedTarget[action.name].apply(resolvedTarget, action.args ? action.args.map(function (v) { return deserializeArgument(node, v); }) : []);
2979
2975
  }
2980
2976
  /**
@@ -3179,7 +3175,7 @@ function createActionInvoker(target, name, fn) {
3179
3175
  tree: getRoot(target),
3180
3176
  rootId: parentContext ? parentContext.rootId : id,
3181
3177
  parentId: parentContext ? parentContext.id : 0,
3182
- allParentIds: parentContext ? __spreadArray(__spreadArray([], __read(parentContext.allParentIds), false), [parentContext.id], false) : [],
3178
+ allParentIds: parentContext ? __spread(parentContext.allParentIds, [parentContext.id]) : [],
3183
3179
  parentEvent: parentContext,
3184
3180
  parentActionEvent: parentActionContext
3185
3181
  }, fn);
@@ -3335,11 +3331,11 @@ function runMiddleWares(node, baseCall, originalFn) {
3335
3331
  if (devMode()) {
3336
3332
  if (!nextInvoked && !abortInvoked) {
3337
3333
  var node2 = getStateTreeNode(call.tree);
3338
- throw fail("Neither the next() nor the abort() callback within the middleware ".concat(handler.name, " for the action: \"").concat(call.name, "\" on the node: ").concat(node2.type.name, " was invoked."));
3334
+ throw fail("Neither the next() nor the abort() callback within the middleware " + handler.name + " for the action: \"" + call.name + "\" on the node: " + node2.type.name + " was invoked.");
3339
3335
  }
3340
3336
  else if (nextInvoked && abortInvoked) {
3341
3337
  var node2 = getStateTreeNode(call.tree);
3342
- throw fail("The next() and abort() callback within the middleware ".concat(handler.name, " for the action: \"").concat(call.name, "\" on the node: ").concat(node2.type.name, " were invoked."));
3338
+ throw fail("The next() and abort() callback within the middleware " + handler.name + " for the action: \"" + call.name + "\" on the node: " + node2.type.name + " were invoked.");
3343
3339
  }
3344
3340
  }
3345
3341
  return result;
@@ -3389,7 +3385,7 @@ function safeStringify(value) {
3389
3385
  }
3390
3386
  catch (e) {
3391
3387
  // istanbul ignore next
3392
- return "<Unserializable: ".concat(e, ">");
3388
+ return "<Unserializable: " + e + ">";
3393
3389
  }
3394
3390
  }
3395
3391
  /**
@@ -3398,15 +3394,15 @@ function safeStringify(value) {
3398
3394
  */
3399
3395
  function prettyPrintValue(value) {
3400
3396
  return typeof value === "function"
3401
- ? "<function".concat(value.name ? " " + value.name : "", ">")
3397
+ ? "<function" + (value.name ? " " + value.name : "") + ">"
3402
3398
  : isStateTreeNode(value)
3403
- ? "<".concat(value, ">")
3404
- : "`".concat(safeStringify(value), "`");
3399
+ ? "<" + value + ">"
3400
+ : "`" + safeStringify(value) + "`";
3405
3401
  }
3406
3402
  function shortenPrintValue(valueInString) {
3407
3403
  return valueInString.length < 280
3408
3404
  ? valueInString
3409
- : "".concat(valueInString.substring(0, 272), "......").concat(valueInString.substring(valueInString.length - 8));
3405
+ : valueInString.substring(0, 272) + "......" + valueInString.substring(valueInString.length - 8);
3410
3406
  }
3411
3407
  function toErrorString(error) {
3412
3408
  var value = error.value;
@@ -3418,19 +3414,19 @@ function toErrorString(error) {
3418
3414
  })
3419
3415
  .filter(function (path) { return path.length > 0; })
3420
3416
  .join("/");
3421
- var pathPrefix = fullPath.length > 0 ? "at path \"/".concat(fullPath, "\" ") : "";
3417
+ var pathPrefix = fullPath.length > 0 ? "at path \"/" + fullPath + "\" " : "";
3422
3418
  var currentTypename = isStateTreeNode(value)
3423
- ? "value of type ".concat(getStateTreeNode(value).type.name, ":")
3419
+ ? "value of type " + getStateTreeNode(value).type.name + ":"
3424
3420
  : isPrimitive(value)
3425
3421
  ? "value"
3426
3422
  : "snapshot";
3427
3423
  var isSnapshotCompatible = type && isStateTreeNode(value) && type.is(getStateTreeNode(value).snapshot);
3428
- return ("".concat(pathPrefix).concat(currentTypename, " ").concat(prettyPrintValue(value), " is not assignable ").concat(type ? "to type: `".concat(type.name, "`") : "") +
3429
- (error.message ? " (".concat(error.message, ")") : "") +
3424
+ return ("" + pathPrefix + currentTypename + " " + prettyPrintValue(value) + " is not assignable " + (type ? "to type: `" + type.name + "`" : "") +
3425
+ (error.message ? " (" + error.message + ")" : "") +
3430
3426
  (type
3431
3427
  ? isPrimitiveType(type) || isPrimitive(value)
3432
3428
  ? "."
3433
- : ", expected an instance of `".concat(type.name, "` or a snapshot like `").concat(type.describe(), "` instead.") +
3429
+ : ", expected an instance of `" + type.name + "` or a snapshot like `" + type.describe() + "` instead." +
3434
3430
  (isSnapshotCompatible
3435
3431
  ? " (Note that a snapshot of the provided value is compatible with the targeted type)"
3436
3432
  : "")
@@ -3493,7 +3489,7 @@ function validationErrorsToString(type, value, errors) {
3493
3489
  if (errors.length === 0) {
3494
3490
  return undefined;
3495
3491
  }
3496
- return ("Error while converting ".concat(shortenPrintValue(prettyPrintValue(value)), " to `").concat(type.name, "`:\n\n ") + errors.map(toErrorString).join("\n "));
3492
+ return ("Error while converting " + shortenPrintValue(prettyPrintValue(value)) + " to `" + type.name + "`:\n\n " + errors.map(toErrorString).join("\n "));
3497
3493
  }
3498
3494
 
3499
3495
  var identifierCacheId = 0;
@@ -3541,7 +3537,7 @@ var IdentifierCache = /** @class */ (function () {
3541
3537
  writable: true,
3542
3538
  value: function (identifier) {
3543
3539
  var modificationId = this.lastCacheModificationPerId.get(identifier) || 0;
3544
- return "".concat(this.cacheId, "-").concat(modificationId);
3540
+ return this.cacheId + "-" + modificationId;
3545
3541
  }
3546
3542
  });
3547
3543
  Object.defineProperty(IdentifierCache.prototype, "addNodeToCache", {
@@ -3656,9 +3652,9 @@ var IdentifierCache = /** @class */ (function () {
3656
3652
  case 1:
3657
3653
  return matches[0];
3658
3654
  default:
3659
- throw fail("Cannot resolve a reference to type '".concat(type.name, "' with id: '").concat(identifier, "' unambigously, there are multiple candidates: ").concat(matches
3655
+ throw fail("Cannot resolve a reference to type '" + type.name + "' with id: '" + identifier + "' unambigously, there are multiple candidates: " + matches
3660
3656
  .map(function (n) { return n.path; })
3661
- .join(", ")));
3657
+ .join(", "));
3662
3658
  }
3663
3659
  }
3664
3660
  });
@@ -3674,7 +3670,7 @@ function createObjectNode(type, parent, subpath, environment, initialValue) {
3674
3670
  if (existingNode) {
3675
3671
  if (existingNode.parent) {
3676
3672
  // istanbul ignore next
3677
- throw fail("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(parent ? parent.path : "", "/").concat(subpath, "', but it lives already at '").concat(existingNode.path, "'"));
3673
+ throw fail("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '" + (parent ? parent.path : "") + "/" + subpath + "', but it lives already at '" + existingNode.path + "'");
3678
3674
  }
3679
3675
  if (parent) {
3680
3676
  existingNode.setParent(parent, subpath);
@@ -3737,7 +3733,7 @@ function assertIsStateTreeNode(value, argNumber) {
3737
3733
  function getStateTreeNode(value) {
3738
3734
  if (!isStateTreeNode(value)) {
3739
3735
  // istanbul ignore next
3740
- throw fail("Value ".concat(value, " is no MST Node"));
3736
+ throw fail("Value " + value + " is no MST Node");
3741
3737
  }
3742
3738
  return value.$treenode;
3743
3739
  }
@@ -3763,7 +3759,7 @@ var doubleDot = function (_) { return ".."; };
3763
3759
  function getRelativePathBetweenNodes(base, target) {
3764
3760
  // PRE condition target is (a child of) base!
3765
3761
  if (base.root !== target.root) {
3766
- throw fail("Cannot calculate relative path: objects '".concat(base, "' and '").concat(target, "' are not part of the same object tree"));
3762
+ throw fail("Cannot calculate relative path: objects '" + base + "' and '" + target + "' are not part of the same object tree");
3767
3763
  }
3768
3764
  var baseParts = splitJsonPath(base.path);
3769
3765
  var targetParts = splitJsonPath(target.path);
@@ -3820,7 +3816,7 @@ function resolveNodeByPathParts(base, pathParts, failIfResolveFails) {
3820
3816
  }
3821
3817
  }
3822
3818
  }
3823
- throw fail("Could not resolve '".concat(part, "' in path '").concat(joinJsonPath(pathParts.slice(0, i)) || "/", "' while resolving '").concat(joinJsonPath(pathParts), "'"));
3819
+ throw fail("Could not resolve '" + part + "' in path '" + (joinJsonPath(pathParts.slice(0, i)) || "/") + "' while resolving '" + joinJsonPath(pathParts) + "'");
3824
3820
  }
3825
3821
  }
3826
3822
  catch (e) {
@@ -4140,7 +4136,7 @@ var EventHandler = /** @class */ (function () {
4140
4136
  }
4141
4137
  // make a copy just in case it changes
4142
4138
  var handlers = this.handlers.slice();
4143
- handlers.forEach(function (f) { return f.apply(void 0, __spreadArray([], __read(args), false)); });
4139
+ handlers.forEach(function (f) { return f.apply(void 0, __spread(args)); });
4144
4140
  }
4145
4141
  });
4146
4142
  return EventHandler;
@@ -4233,7 +4229,7 @@ var EventHandlers = /** @class */ (function () {
4233
4229
  }
4234
4230
  var handler = this.eventHandlers && this.eventHandlers[event];
4235
4231
  if (handler) {
4236
- (_a = handler).emit.apply(_a, __spreadArray([], __read(args), false));
4232
+ (_a = handler).emit.apply(_a, __spread(args));
4237
4233
  }
4238
4234
  }
4239
4235
  });
@@ -4278,7 +4274,7 @@ deprecated.ids = {};
4278
4274
  * @hidden
4279
4275
  */
4280
4276
  function warnError(msg) {
4281
- console.warn(new Error("[mobx-state-tree] ".concat(msg)));
4277
+ console.warn(new Error("[mobx-state-tree] " + msg));
4282
4278
  }
4283
4279
  /**
4284
4280
  * @internal
@@ -4303,7 +4299,7 @@ function assertArg(value, fn, typeName, argNumber) {
4303
4299
  if (devMode()) {
4304
4300
  if (!fn(value)) {
4305
4301
  // istanbul ignore next
4306
- throw fail("expected ".concat(typeName, " as argument ").concat(asArray(argNumber).join(" or "), ", got ").concat(value, " instead"));
4302
+ throw fail("expected " + typeName + " as argument " + asArray(argNumber).join(" or ") + ", got " + value + " instead");
4307
4303
  }
4308
4304
  }
4309
4305
  }
@@ -4321,10 +4317,10 @@ function assertIsFunction(value, argNumber) {
4321
4317
  function assertIsNumber(value, argNumber, min, max) {
4322
4318
  assertArg(value, function (n) { return typeof n === "number"; }, "number", argNumber);
4323
4319
  if (min !== undefined) {
4324
- assertArg(value, function (n) { return n >= min; }, "number greater than ".concat(min), argNumber);
4320
+ assertArg(value, function (n) { return n >= min; }, "number greater than " + min, argNumber);
4325
4321
  }
4326
4322
  if (max !== undefined) {
4327
- assertArg(value, function (n) { return n <= max; }, "number lesser than ".concat(max), argNumber);
4323
+ assertArg(value, function (n) { return n <= max; }, "number lesser than " + max, argNumber);
4328
4324
  }
4329
4325
  }
4330
4326
  /**
@@ -4403,7 +4399,7 @@ function toGeneratorFunction(p) {
4403
4399
  }
4404
4400
  return __generator(this, function (_a) {
4405
4401
  switch (_a.label) {
4406
- case 0: return [4 /*yield*/, p.apply(void 0, __spreadArray([], __read(args), false))];
4402
+ case 0: return [4 /*yield*/, p.apply(void 0, __spread(args))];
4407
4403
  case 1: return [2 /*return*/, (_a.sent())];
4408
4404
  }
4409
4405
  });
@@ -4460,7 +4456,7 @@ function createFlowSpawner(name, generator) {
4460
4456
  tree: parentContext.tree,
4461
4457
  context: parentContext.context,
4462
4458
  parentId: parentContext.id,
4463
- allParentIds: __spreadArray(__spreadArray([], __read(parentContext.allParentIds), false), [parentContext.id], false),
4459
+ allParentIds: __spread(parentContext.allParentIds, [parentContext.id]),
4464
4460
  rootId: parentContext.rootId,
4465
4461
  parentEvent: parentContext,
4466
4462
  parentActionEvent: parentActionContext
@@ -4640,7 +4636,7 @@ function splitJsonPath(path) {
4640
4636
  stringStartsWith(path, "./") ||
4641
4637
  stringStartsWith(path, "../");
4642
4638
  if (!valid) {
4643
- throw fail("a json path must be either rooted, empty or relative, but got '".concat(path, "'"));
4639
+ throw fail("a json path must be either rooted, empty or relative, but got '" + path + "'");
4644
4640
  }
4645
4641
  // '/a/b/c' -> ["a", "b", "c"]
4646
4642
  // '../../b/c' -> ["..", "..", "b", "c"]
@@ -4686,7 +4682,7 @@ var SnapshotProcessor = /** @class */ (function (_super) {
4686
4682
  configurable: true,
4687
4683
  writable: true,
4688
4684
  value: function () {
4689
- return "snapshotProcessor(".concat(this._subtype.describe(), ")");
4685
+ return "snapshotProcessor(" + this._subtype.describe() + ")";
4690
4686
  }
4691
4687
  });
4692
4688
  Object.defineProperty(SnapshotProcessor.prototype, "preProcessSnapshot", {
@@ -5102,7 +5098,7 @@ var MapType = /** @class */ (function (_super) {
5102
5098
  if (!type.identifierAttribute)
5103
5099
  return current;
5104
5100
  if (current && current !== type.identifierAttribute) {
5105
- throw fail("The objects in a map should all have the same identifier attribute, expected '".concat(current, "', but child of type '").concat(type.name, "' declared attribute '").concat(type.identifierAttribute, "' as identifier"));
5101
+ throw fail("The objects in a map should all have the same identifier attribute, expected '" + current + "', but child of type '" + type.name + "' declared attribute '" + type.identifierAttribute + "' as identifier");
5106
5102
  }
5107
5103
  return type.identifierAttribute;
5108
5104
  }, undefined);
@@ -5226,7 +5222,7 @@ var MapType = /** @class */ (function (_super) {
5226
5222
  if (this.identifierMode === MapIdentifierMode.YES && node instanceof ObjectNode) {
5227
5223
  var identifier = node.identifier;
5228
5224
  if (identifier !== expected)
5229
- throw fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '".concat(identifier, "', but expected: '").concat(expected, "'"));
5225
+ throw fail("A map of objects containing an identifier should always store the object under their own identifier. Trying to store key '" + identifier + "', but expected: '" + expected + "'");
5230
5226
  }
5231
5227
  }
5232
5228
  });
@@ -5398,7 +5394,7 @@ MapType.prototype.applySnapshot = action(MapType.prototype.applySnapshot);
5398
5394
  * @returns
5399
5395
  */
5400
5396
  function map(subtype) {
5401
- return new MapType("Map<string, ".concat(subtype.name, ">"), subtype);
5397
+ return new MapType("Map<string, " + subtype.name + ">", subtype);
5402
5398
  }
5403
5399
  /**
5404
5400
  * Returns if a given value represents a map type.
@@ -5715,7 +5711,7 @@ ArrayType.prototype.applySnapshot = action(ArrayType.prototype.applySnapshot);
5715
5711
  */
5716
5712
  function array(subtype) {
5717
5713
  assertIsType(subtype, 1);
5718
- return new ArrayType("".concat(subtype.name, "[]"), subtype);
5714
+ return new ArrayType(subtype.name + "[]", subtype);
5719
5715
  }
5720
5716
  function reconcileArrayChildren(parent, childType, oldNodes, newValues, newPaths) {
5721
5717
  var nothingChanged = true;
@@ -5749,7 +5745,7 @@ function reconcileArrayChildren(parent, childType, oldNodes, newValues, newPaths
5749
5745
  // check if already belongs to the same parent. if so, avoid pushing item in. only swapping can occur.
5750
5746
  if (isStateTreeNode(newValue) && getStateTreeNode(newValue).parent === parent) {
5751
5747
  // this node is owned by this parent, but not in the reconcilable set, so it must be double
5752
- throw fail("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '".concat(parent.path, "/").concat(newPath, "', but it lives already at '").concat(getStateTreeNode(newValue).path, "'"));
5748
+ throw fail("Cannot add an object to a state tree if it is already part of the same or another state tree. Tried to assign an object to '" + parent.path + "/" + newPath + "', but it lives already at '" + getStateTreeNode(newValue).path + "'");
5753
5749
  }
5754
5750
  nothingChanged = false;
5755
5751
  var newNode = valueAsNode(childType, parent, newPath, newValue);
@@ -5865,7 +5861,7 @@ function toPropertiesObject(declaredProps) {
5865
5861
  var alreadySeenKeys = new Set();
5866
5862
  keysList.forEach(function (key) {
5867
5863
  if (alreadySeenKeys.has(key)) {
5868
- throw fail("".concat(key, " is declared twice in the model. Model should not contain the same keys"));
5864
+ throw fail(key + " is declared twice in the model. Model should not contain the same keys");
5869
5865
  }
5870
5866
  alreadySeenKeys.add(key);
5871
5867
  });
@@ -5873,7 +5869,7 @@ function toPropertiesObject(declaredProps) {
5873
5869
  return keysList.reduce(function (props, key) {
5874
5870
  // warn if user intended a HOOK
5875
5871
  if (key in Hook) {
5876
- throw fail("Hook '".concat(key, "' was defined as property. Hooks should be defined as part of the actions"));
5872
+ throw fail("Hook '" + key + "' was defined as property. Hooks should be defined as part of the actions");
5877
5873
  }
5878
5874
  // the user intended to use a view
5879
5875
  var descriptor = Object.getOwnPropertyDescriptor(declaredProps, key);
@@ -5900,17 +5896,17 @@ function toPropertiesObject(declaredProps) {
5900
5896
  else if (isType(value)) ;
5901
5897
  // its a function, maybe the user wanted a view?
5902
5898
  else if (devMode() && typeof value === "function") {
5903
- throw fail("Invalid type definition for property '".concat(key, "', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?"));
5899
+ throw fail("Invalid type definition for property '" + key + "', it looks like you passed a function. Did you forget to invoke it, or did you intend to declare a view / action?");
5904
5900
  }
5905
5901
  // no other complex values
5906
5902
  else if (devMode() && typeof value === "object") {
5907
- throw fail("Invalid type definition for property '".concat(key, "', it looks like you passed an object. Try passing another model type or a types.frozen."));
5903
+ throw fail("Invalid type definition for property '" + key + "', it looks like you passed an object. Try passing another model type or a types.frozen.");
5908
5904
  }
5909
5905
  else {
5910
- throw fail("Invalid type definition for property '".concat(key, "', cannot infer a type from a value like '").concat(value, "' (").concat(typeof value, ")"));
5906
+ throw fail("Invalid type definition for property '" + key + "', cannot infer a type from a value like '" + value + "' (" + typeof value + ")");
5911
5907
  }
5912
5908
  return props;
5913
- }, declaredProps);
5909
+ }, __assign({}, declaredProps));
5914
5910
  }
5915
5911
  /**
5916
5912
  * @internal
@@ -6020,7 +6016,7 @@ var ModelType = /** @class */ (function (_super) {
6020
6016
  this.forAllProps(function (propName, propType) {
6021
6017
  if (propType.flags & TypeFlags.Identifier) {
6022
6018
  if (identifierAttribute)
6023
- throw fail("Cannot define property '".concat(propName, "' as object identifier, property '").concat(identifierAttribute, "' is already defined as identifier property"));
6019
+ throw fail("Cannot define property '" + propName + "' as object identifier, property '" + identifierAttribute + "' is already defined as identifier property");
6024
6020
  identifierAttribute = propName;
6025
6021
  }
6026
6022
  });
@@ -6066,10 +6062,10 @@ var ModelType = /** @class */ (function (_super) {
6066
6062
  Object.keys(actions).forEach(function (name) {
6067
6063
  // warn if preprocessor was given
6068
6064
  if (name === PRE_PROCESS_SNAPSHOT)
6069
- throw fail("Cannot define action '".concat(PRE_PROCESS_SNAPSHOT, "', it should be defined using 'type.preProcessSnapshot(fn)' instead"));
6065
+ throw fail("Cannot define action '" + PRE_PROCESS_SNAPSHOT + "', it should be defined using 'type.preProcessSnapshot(fn)' instead");
6070
6066
  // warn if postprocessor was given
6071
6067
  if (name === POST_PROCESS_SNAPSHOT)
6072
- throw fail("Cannot define action '".concat(POST_PROCESS_SNAPSHOT, "', it should be defined using 'type.postProcessSnapshot(fn)' instead"));
6068
+ throw fail("Cannot define action '" + POST_PROCESS_SNAPSHOT + "', it should be defined using 'type.postProcessSnapshot(fn)' instead");
6073
6069
  var action2 = actions[name];
6074
6070
  // apply hook composition
6075
6071
  var baseAction = self[name];
@@ -6099,7 +6095,7 @@ var ModelType = /** @class */ (function (_super) {
6099
6095
  value: function (fn) {
6100
6096
  var _this = this;
6101
6097
  if (typeof fn !== "function") {
6102
- throw fail("You passed an ".concat(typeof fn, " to volatile state as an argument, when function is expected"));
6098
+ throw fail("You passed an " + typeof fn + " to volatile state as an argument, when function is expected");
6103
6099
  }
6104
6100
  var stateInitializer = function (self) {
6105
6101
  _this.instantiateVolatileState(self, fn(self));
@@ -6128,7 +6124,7 @@ var ModelType = /** @class */ (function (_super) {
6128
6124
  var initializer = function (self) {
6129
6125
  var _a = fn(self), actions = _a.actions, views = _a.views, state = _a.state, rest = __rest(_a, ["actions", "views", "state"]);
6130
6126
  for (var key in rest)
6131
- throw fail("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '".concat(key, "'"));
6127
+ throw fail("The `extend` function should return an object with a subset of the fields 'actions', 'views' and 'state'. Found invalid key '" + key + "'");
6132
6128
  if (state)
6133
6129
  _this.instantiateVolatileState(self, state);
6134
6130
  if (views)
@@ -6312,7 +6308,7 @@ var ModelType = /** @class */ (function (_super) {
6312
6308
  atom.reportObserved();
6313
6309
  }
6314
6310
  catch (e) {
6315
- throw fail("".concat(name, " property is declared twice"));
6311
+ throw fail(name + " property is declared twice");
6316
6312
  }
6317
6313
  res[name] = _this.getChildNode(node, name).snapshot;
6318
6314
  });
@@ -6340,7 +6336,7 @@ var ModelType = /** @class */ (function (_super) {
6340
6336
  writable: true,
6341
6337
  value: function (node, subpath, patch) {
6342
6338
  if (!(patch.op === "replace" || patch.op === "add")) {
6343
- throw fail("object does not support operation ".concat(patch.op));
6339
+ throw fail("object does not support operation " + patch.op);
6344
6340
  }
6345
6341
  node.storedValue[subpath] = patch.value;
6346
6342
  }
@@ -6572,7 +6568,7 @@ var CoreType = /** @class */ (function (_super) {
6572
6568
  return typeCheckSuccess();
6573
6569
  }
6574
6570
  var typeName = this.name === "Date" ? "Date or a unix milliseconds timestamp" : this.name;
6575
- return typeCheckFailure(context, value, "Value is not a ".concat(typeName));
6571
+ return typeCheckFailure(context, value, "Value is not a " + typeName);
6576
6572
  }
6577
6573
  });
6578
6574
  return CoreType;
@@ -6765,7 +6761,7 @@ var Literal = /** @class */ (function (_super) {
6765
6761
  if (isPrimitive(value) && value === this.value) {
6766
6762
  return typeCheckSuccess();
6767
6763
  }
6768
- return typeCheckFailure(context, value, "Value is not a literal ".concat(JSON.stringify(this.value)));
6764
+ return typeCheckFailure(context, value, "Value is not a literal " + JSON.stringify(this.value));
6769
6765
  }
6770
6766
  });
6771
6767
  return Literal;
@@ -6947,7 +6943,7 @@ function enumeration(name, options) {
6947
6943
  assertIsString(option, i + 1);
6948
6944
  });
6949
6945
  }
6950
- var type = union.apply(void 0, __spreadArray([], __read(realOptions.map(function (option) { return literal("" + option); })), false));
6946
+ var type = union.apply(void 0, __spread(realOptions.map(function (option) { return literal("" + option); })));
6951
6947
  if (typeof name === "string")
6952
6948
  type.name = name;
6953
6949
  return type;
@@ -7043,7 +7039,7 @@ var Union = /** @class */ (function (_super) {
7043
7039
  if (this._dispatcher) {
7044
7040
  return this._dispatcher(value);
7045
7041
  }
7046
- // find the most accommodating type
7042
+ // find the most accomodating type
7047
7043
  // if we are using reconciliation try the current node type first (fix for #1045)
7048
7044
  if (reconcileCurrentType) {
7049
7045
  if (reconcileCurrentType.is(value)) {
@@ -7107,7 +7103,7 @@ function union(optionsOrType) {
7107
7103
  otherTypes[_i - 1] = arguments[_i];
7108
7104
  }
7109
7105
  var options = isType(optionsOrType) ? undefined : optionsOrType;
7110
- var types = isType(optionsOrType) ? __spreadArray([optionsOrType], __read(otherTypes), false) : otherTypes;
7106
+ var types = isType(optionsOrType) ? __spread([optionsOrType], otherTypes) : otherTypes;
7111
7107
  var name = "(" + types.map(function (type) { return type.name; }).join(" | ") + ")";
7112
7108
  // check all options
7113
7109
  if (devMode()) {
@@ -7469,7 +7465,7 @@ var Late = /** @class */ (function (_super) {
7469
7465
  * @returns
7470
7466
  */
7471
7467
  function late(nameOrType, maybeType) {
7472
- var name = typeof nameOrType === "string" ? nameOrType : "late(".concat(nameOrType.toString(), ")");
7468
+ var name = typeof nameOrType === "string" ? nameOrType : "late(" + nameOrType.toString() + ")";
7473
7469
  var type = typeof nameOrType === "string" ? maybeType : nameOrType;
7474
7470
  // checks that the type is actually a late type
7475
7471
  if (devMode()) {
@@ -7541,7 +7537,7 @@ var Lazy = /** @class */ (function (_super) {
7541
7537
  node.parent.applyPatches([
7542
7538
  {
7543
7539
  op: "replace",
7544
- path: "/".concat(node.subpath),
7540
+ path: "/" + node.subpath,
7545
7541
  value: node.snapshot
7546
7542
  }
7547
7543
  ]);
@@ -7555,7 +7551,7 @@ var Lazy = /** @class */ (function (_super) {
7555
7551
  configurable: true,
7556
7552
  writable: true,
7557
7553
  value: function () {
7558
- return "<lazy ".concat(this.name, ">");
7554
+ return "<lazy " + this.name + ">";
7559
7555
  }
7560
7556
  });
7561
7557
  Object.defineProperty(Lazy.prototype, "instantiate", {
@@ -7609,7 +7605,7 @@ var Lazy = /** @class */ (function (_super) {
7609
7605
  var Frozen = /** @class */ (function (_super) {
7610
7606
  __extends(Frozen, _super);
7611
7607
  function Frozen(subType) {
7612
- var _this = _super.call(this, subType ? "frozen(".concat(subType.name, ")") : "frozen") || this;
7608
+ var _this = _super.call(this, subType ? "frozen(" + subType.name + ")" : "frozen") || this;
7613
7609
  Object.defineProperty(_this, "subType", {
7614
7610
  enumerable: true,
7615
7611
  configurable: true,
@@ -7765,7 +7761,7 @@ var StoredReference = /** @class */ (function () {
7765
7761
  this.identifier = id;
7766
7762
  }
7767
7763
  else {
7768
- throw fail("Can only store references to tree nodes or identifiers, got: '".concat(value, "'"));
7764
+ throw fail("Can only store references to tree nodes or identifiers, got: '" + value + "'");
7769
7765
  }
7770
7766
  }
7771
7767
  Object.defineProperty(StoredReference.prototype, "updateResolvedReference", {
@@ -7782,7 +7778,7 @@ var StoredReference = /** @class */ (function () {
7782
7778
  // reference was initialized with the identifier of the target
7783
7779
  var target = root.identifierCache.resolve(targetType, normalizedId);
7784
7780
  if (!target) {
7785
- throw new InvalidReferenceError("[mobx-state-tree] Failed to resolve reference '".concat(this.identifier, "' to type '").concat(this.targetType.name, "' (from node: ").concat(node.path, ")"));
7781
+ throw new InvalidReferenceError("[mobx-state-tree] Failed to resolve reference '" + this.identifier + "' to type '" + this.targetType.name + "' (from node: " + node.path + ")");
7786
7782
  }
7787
7783
  this.resolvedReference = {
7788
7784
  node: target,
@@ -7821,7 +7817,7 @@ var InvalidReferenceError = /** @class */ (function (_super) {
7821
7817
  var BaseReferenceType = /** @class */ (function (_super) {
7822
7818
  __extends(BaseReferenceType, _super);
7823
7819
  function BaseReferenceType(targetType, onInvalidated) {
7824
- var _this = _super.call(this, "reference(".concat(targetType.name, ")")) || this;
7820
+ var _this = _super.call(this, "reference(" + targetType.name + ")") || this;
7825
7821
  Object.defineProperty(_this, "targetType", {
7826
7822
  enumerable: true,
7827
7823
  configurable: true,
@@ -8246,7 +8242,7 @@ var BaseIdentifierType = /** @class */ (function (_super) {
8246
8242
  value: function (current, newValue, parent, subpath) {
8247
8243
  // we don't consider detaching here since identifier are scalar nodes, and scalar nodes cannot be detached
8248
8244
  if (current.storedValue !== newValue)
8249
- throw fail("Tried to change identifier from '".concat(current.storedValue, "' to '").concat(newValue, "'. Changing identifiers is not allowed."));
8245
+ throw fail("Tried to change identifier from '" + current.storedValue + "' to '" + newValue + "'. Changing identifiers is not allowed.");
8250
8246
  current.setParent(parent, subpath);
8251
8247
  return current;
8252
8248
  }
@@ -8257,7 +8253,7 @@ var BaseIdentifierType = /** @class */ (function (_super) {
8257
8253
  writable: true,
8258
8254
  value: function (value, context) {
8259
8255
  if (typeof value !== this.validType) {
8260
- return typeCheckFailure(context, value, "Value is not a valid ".concat(this.describe(), ", expected a ").concat(this.validType));
8256
+ return typeCheckFailure(context, value, "Value is not a valid " + this.describe() + ", expected a " + this.validType);
8261
8257
  }
8262
8258
  return typeCheckSuccess();
8263
8259
  }
@@ -8468,7 +8464,7 @@ var CustomType = /** @class */ (function (_super) {
8468
8464
  return typeCheckSuccess();
8469
8465
  var typeError = this.options.getValidationMessage(value);
8470
8466
  if (typeError) {
8471
- return typeCheckFailure(context, value, "Invalid value for type '".concat(this.name, "': ").concat(typeError));
8467
+ return typeCheckFailure(context, value, "Invalid value for type '" + this.name + "': " + typeError);
8472
8468
  }
8473
8469
  return typeCheckSuccess();
8474
8470
  }