mobx 6.3.11 → 6.4.1

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -0
  3. package/dist/api/intercept.d.ts +1 -1
  4. package/dist/api/observe.d.ts +1 -1
  5. package/dist/errors.d.ts +2 -2
  6. package/dist/mobx.cjs.development.js +991 -303
  7. package/dist/mobx.cjs.development.js.map +1 -1
  8. package/dist/mobx.cjs.production.min.js +1 -1
  9. package/dist/mobx.cjs.production.min.js.map +1 -1
  10. package/dist/mobx.esm.development.js +991 -303
  11. package/dist/mobx.esm.development.js.map +1 -1
  12. package/dist/mobx.esm.js +1006 -306
  13. package/dist/mobx.esm.js.map +1 -1
  14. package/dist/mobx.esm.production.min.js +1 -1
  15. package/dist/mobx.esm.production.min.js.map +1 -1
  16. package/dist/mobx.umd.development.js +991 -303
  17. package/dist/mobx.umd.development.js.map +1 -1
  18. package/dist/mobx.umd.production.min.js +1 -1
  19. package/dist/mobx.umd.production.min.js.map +1 -1
  20. package/dist/types/observablemap.d.ts +2 -2
  21. package/dist/utils/utils.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/src/api/action.ts +8 -3
  24. package/src/api/annotation.ts +1 -2
  25. package/src/api/autorun.ts +22 -8
  26. package/src/api/computed.ts +5 -2
  27. package/src/api/configure.ts +6 -2
  28. package/src/api/extendobservable.ts +11 -5
  29. package/src/api/extras.ts +4 -2
  30. package/src/api/flow.ts +11 -4
  31. package/src/api/intercept-read.ts +4 -2
  32. package/src/api/intercept.ts +6 -3
  33. package/src/api/iscomputed.ts +10 -4
  34. package/src/api/isobservable.ts +10 -4
  35. package/src/api/makeObservable.ts +4 -2
  36. package/src/api/object-api.ts +30 -16
  37. package/src/api/observable.ts +23 -9
  38. package/src/api/observe.ts +5 -3
  39. package/src/api/tojs.ts +7 -3
  40. package/src/api/trace.ts +6 -2
  41. package/src/api/when.ts +12 -5
  42. package/src/core/action.ts +8 -3
  43. package/src/core/computedvalue.ts +29 -9
  44. package/src/core/derivation.ts +25 -9
  45. package/src/core/globalstate.ts +18 -7
  46. package/src/core/observable.ts +14 -5
  47. package/src/core/reaction.ts +15 -6
  48. package/src/core/spy.ts +20 -7
  49. package/src/errors.ts +2 -2
  50. package/src/types/actionannotation.ts +2 -2
  51. package/src/types/dynamicobject.ts +10 -4
  52. package/src/types/flowannotation.ts +14 -4
  53. package/src/types/intercept-utils.ts +9 -3
  54. package/src/types/legacyobservablearray.ts +5 -3
  55. package/src/types/listen-utils.ts +6 -2
  56. package/src/types/modifiers.ts +39 -14
  57. package/src/types/observablearray.ts +78 -30
  58. package/src/types/observablemap.ts +65 -26
  59. package/src/types/observableobject.ts +52 -18
  60. package/src/types/observableset.ts +29 -10
  61. package/src/types/observablevalue.ts +13 -5
  62. package/src/types/type-utils.ts +33 -11
  63. package/src/utils/comparer.ts +4 -4
  64. package/src/utils/eq.ts +45 -15
  65. package/src/utils/utils.ts +42 -20
package/dist/mobx.esm.js CHANGED
@@ -23,9 +23,9 @@ var niceErrors = {
23
23
  10: "'has()' can only be used on observable objects, arrays and maps",
24
24
  11: "'get()' can only be used on observable objects, arrays and maps",
25
25
  12: "Invalid annotation",
26
- 13: "Dynamic observable objects cannot be frozen",
26
+ 13: "Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",
27
27
  14: "Intercept handlers should return nothing or a change object",
28
- 15: "Observable arrays cannot be frozen",
28
+ 15: "Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",
29
29
  16: "Modification exception: the internal structure of an observable array was changed.",
30
30
  17: function _(index, length) {
31
31
  return "[mobx.array] Index out of bounds, " + index + " is larger than " + length;
@@ -141,7 +141,10 @@ function getNextId() {
141
141
  function once(func) {
142
142
  var invoked = false;
143
143
  return function () {
144
- if (invoked) return;
144
+ if (invoked) {
145
+ return;
146
+ }
147
+
145
148
  invoked = true;
146
149
  return func.apply(this, arguments);
147
150
  };
@@ -166,17 +169,31 @@ function isObject(value) {
166
169
  return value !== null && typeof value === "object";
167
170
  }
168
171
  function isPlainObject(value) {
169
- if (!isObject(value)) return false;
172
+ if (!isObject(value)) {
173
+ return false;
174
+ }
175
+
170
176
  var proto = Object.getPrototypeOf(value);
171
- if (proto == null) return true;
177
+
178
+ if (proto == null) {
179
+ return true;
180
+ }
181
+
172
182
  var protoConstructor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
173
183
  return typeof protoConstructor === "function" && protoConstructor.toString() === plainObjectString;
174
184
  } // https://stackoverflow.com/a/37865170
175
185
 
176
186
  function isGenerator(obj) {
177
187
  var constructor = obj == null ? void 0 : obj.constructor;
178
- if (!constructor) return false;
179
- if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) return true;
188
+
189
+ if (!constructor) {
190
+ return false;
191
+ }
192
+
193
+ if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) {
194
+ return true;
195
+ }
196
+
180
197
  return false;
181
198
  }
182
199
  function addHiddenProp(object, propName, value) {
@@ -216,9 +233,16 @@ var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefine
216
233
  function getPlainObjectKeys(object) {
217
234
  var keys = Object.keys(object); // Not supported in IE, so there are not going to be symbol props anyway...
218
235
 
219
- if (!hasGetOwnPropertySymbols) return keys;
236
+ if (!hasGetOwnPropertySymbols) {
237
+ return keys;
238
+ }
239
+
220
240
  var symbols = Object.getOwnPropertySymbols(object);
221
- if (!symbols.length) return keys;
241
+
242
+ if (!symbols.length) {
243
+ return keys;
244
+ }
245
+
222
246
  return [].concat(keys, symbols.filter(function (s) {
223
247
  return objectPrototype.propertyIsEnumerable.call(object, s);
224
248
  }));
@@ -231,8 +255,14 @@ var ownKeys = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKey
231
255
  /* istanbul ignore next */
232
256
  Object.getOwnPropertyNames;
233
257
  function stringifyKey(key) {
234
- if (typeof key === "string") return key;
235
- if (typeof key === "symbol") return key.toString();
258
+ if (typeof key === "string") {
259
+ return key;
260
+ }
261
+
262
+ if (typeof key === "symbol") {
263
+ return key.toString();
264
+ }
265
+
236
266
  return new String(key).toString();
237
267
  }
238
268
  function toPrimitive(value) {
@@ -520,7 +550,10 @@ function shallowComparer(a, b) {
520
550
  }
521
551
 
522
552
  function defaultComparer(a, b) {
523
- if (Object.is) return Object.is(a, b);
553
+ if (Object.is) {
554
+ return Object.is(a, b);
555
+ }
556
+
524
557
  return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
525
558
  }
526
559
 
@@ -533,20 +566,34 @@ var comparer = {
533
566
 
534
567
  function deepEnhancer(v, _, name) {
535
568
  // it is an observable already, done
536
- if (isObservable(v)) return v; // something that can be converted and mutated?
569
+ if (isObservable(v)) {
570
+ return v;
571
+ } // something that can be converted and mutated?
537
572
 
538
- if (Array.isArray(v)) return observable.array(v, {
539
- name: name
540
- });
541
- if (isPlainObject(v)) return observable.object(v, undefined, {
542
- name: name
543
- });
544
- if (isES6Map(v)) return observable.map(v, {
545
- name: name
546
- });
547
- if (isES6Set(v)) return observable.set(v, {
548
- name: name
549
- });
573
+
574
+ if (Array.isArray(v)) {
575
+ return observable.array(v, {
576
+ name: name
577
+ });
578
+ }
579
+
580
+ if (isPlainObject(v)) {
581
+ return observable.object(v, undefined, {
582
+ name: name
583
+ });
584
+ }
585
+
586
+ if (isES6Map(v)) {
587
+ return observable.map(v, {
588
+ name: name
589
+ });
590
+ }
591
+
592
+ if (isES6Set(v)) {
593
+ return observable.set(v, {
594
+ name: name
595
+ });
596
+ }
550
597
 
551
598
  if (typeof v === "function" && !isAction(v) && !isFlow(v)) {
552
599
  if (isGenerator(v)) {
@@ -559,33 +606,59 @@ function deepEnhancer(v, _, name) {
559
606
  return v;
560
607
  }
561
608
  function shallowEnhancer(v, _, name) {
562
- if (v === undefined || v === null) return v;
563
- if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v;
564
- if (Array.isArray(v)) return observable.array(v, {
565
- name: name,
566
- deep: false
567
- });
568
- if (isPlainObject(v)) return observable.object(v, undefined, {
569
- name: name,
570
- deep: false
571
- });
572
- if (isES6Map(v)) return observable.map(v, {
573
- name: name,
574
- deep: false
575
- });
576
- if (isES6Set(v)) return observable.set(v, {
577
- name: name,
578
- deep: false
579
- });
580
- if (process.env.NODE_ENV !== "production") die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
609
+ if (v === undefined || v === null) {
610
+ return v;
611
+ }
612
+
613
+ if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {
614
+ return v;
615
+ }
616
+
617
+ if (Array.isArray(v)) {
618
+ return observable.array(v, {
619
+ name: name,
620
+ deep: false
621
+ });
622
+ }
623
+
624
+ if (isPlainObject(v)) {
625
+ return observable.object(v, undefined, {
626
+ name: name,
627
+ deep: false
628
+ });
629
+ }
630
+
631
+ if (isES6Map(v)) {
632
+ return observable.map(v, {
633
+ name: name,
634
+ deep: false
635
+ });
636
+ }
637
+
638
+ if (isES6Set(v)) {
639
+ return observable.set(v, {
640
+ name: name,
641
+ deep: false
642
+ });
643
+ }
644
+
645
+ if (process.env.NODE_ENV !== "production") {
646
+ die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
647
+ }
581
648
  }
582
649
  function referenceEnhancer(newValue) {
583
650
  // never turn into an observable
584
651
  return newValue;
585
652
  }
586
653
  function refStructEnhancer(v, oldValue) {
587
- if (process.env.NODE_ENV !== "production" && isObservable(v)) die("observable.struct should not be used with observable values");
588
- if (deepEqual(v, oldValue)) return oldValue;
654
+ if (process.env.NODE_ENV !== "production" && isObservable(v)) {
655
+ die("observable.struct should not be used with observable values");
656
+ }
657
+
658
+ if (deepEqual(v, oldValue)) {
659
+ return oldValue;
660
+ }
661
+
589
662
  return v;
590
663
  }
591
664
 
@@ -733,10 +806,12 @@ function make_$2(adm, key, descriptor, source) {
733
806
  // bound - must annotate protos to support super.flow()
734
807
 
735
808
 
736
- if ((_this$options_ = this.options_) != null && _this$options_.bound && !isFlow(adm.target_[key])) {
737
- if (this.extend_(adm, key, descriptor, false) === null) return 0
738
- /* Cancel */
739
- ;
809
+ if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
810
+ if (this.extend_(adm, key, descriptor, false) === null) {
811
+ return 0
812
+ /* Cancel */
813
+ ;
814
+ }
740
815
  }
741
816
 
742
817
  if (isFlow(descriptor.value)) {
@@ -777,16 +852,23 @@ safeDescriptors) {
777
852
  }
778
853
 
779
854
  assertFlowDescriptor(adm, annotation, key, descriptor);
780
- var value = descriptor.value;
855
+ var value = descriptor.value; // In case of flow.bound, the descriptor can be from already annotated prototype
856
+
857
+ if (!isFlow(value)) {
858
+ value = flow(value);
859
+ }
781
860
 
782
861
  if (bound) {
783
862
  var _adm$proxy_;
784
863
 
785
- value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);
864
+ // We do not keep original function around, so we bind the existing flow
865
+ value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_); // This is normally set by `flow`, but `bind` returns new function...
866
+
867
+ value.isMobXFlow = true;
786
868
  }
787
869
 
788
870
  return {
789
- value: flow(value),
871
+ value: value,
790
872
  // Non-configurable for classes
791
873
  // prevents accidental field redefinition in subclass
792
874
  configurable: safeDescriptors ? adm.isPlainObject_ : true,
@@ -1020,17 +1102,35 @@ function createObservable(v, arg2, arg3) {
1020
1102
  } // already observable - ignore
1021
1103
 
1022
1104
 
1023
- if (isObservable(v)) return v; // plain object
1105
+ if (isObservable(v)) {
1106
+ return v;
1107
+ } // plain object
1024
1108
 
1025
- if (isPlainObject(v)) return observable.object(v, arg2, arg3); // Array
1026
1109
 
1027
- if (Array.isArray(v)) return observable.array(v, arg2); // Map
1110
+ if (isPlainObject(v)) {
1111
+ return observable.object(v, arg2, arg3);
1112
+ } // Array
1028
1113
 
1029
- if (isES6Map(v)) return observable.map(v, arg2); // Set
1030
1114
 
1031
- if (isES6Set(v)) return observable.set(v, arg2); // other object - ignore
1115
+ if (Array.isArray(v)) {
1116
+ return observable.array(v, arg2);
1117
+ } // Map
1118
+
1119
+
1120
+ if (isES6Map(v)) {
1121
+ return observable.map(v, arg2);
1122
+ } // Set
1123
+
1124
+
1125
+ if (isES6Set(v)) {
1126
+ return observable.set(v, arg2);
1127
+ } // other object - ignore
1128
+
1129
+
1130
+ if (typeof v === "object" && v !== null) {
1131
+ return v;
1132
+ } // anything else
1032
1133
 
1033
- if (typeof v === "object" && v !== null) return v; // anything else
1034
1134
 
1035
1135
  return observable.box(v, arg2);
1036
1136
  }
@@ -1088,8 +1188,13 @@ var computed = function computed(arg1, arg2) {
1088
1188
 
1089
1189
 
1090
1190
  if (process.env.NODE_ENV !== "production") {
1091
- if (!isFunction(arg1)) die("First argument to `computed` should be an expression.");
1092
- if (isFunction(arg2)) die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1191
+ if (!isFunction(arg1)) {
1192
+ die("First argument to `computed` should be an expression.");
1193
+ }
1194
+
1195
+ if (isFunction(arg2)) {
1196
+ die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1197
+ }
1093
1198
  }
1094
1199
 
1095
1200
  var opts = isPlainObject(arg2) ? arg2 : {};
@@ -1121,8 +1226,13 @@ function createAction(actionName, fn, autoAction, ref) {
1121
1226
  }
1122
1227
 
1123
1228
  if (process.env.NODE_ENV !== "production") {
1124
- if (!isFunction(fn)) die("`action` can only be invoked on functions");
1125
- if (typeof actionName !== "string" || !actionName) die("actions should have valid names, got: '" + actionName + "'");
1229
+ if (!isFunction(fn)) {
1230
+ die("`action` can only be invoked on functions");
1231
+ }
1232
+
1233
+ if (typeof actionName !== "string" || !actionName) {
1234
+ die("actions should have valid names, got: '" + actionName + "'");
1235
+ }
1126
1236
  }
1127
1237
 
1128
1238
  function res() {
@@ -1204,7 +1314,10 @@ function _endAction(runInfo) {
1204
1314
  allowStateChangesEnd(runInfo.prevAllowStateChanges_);
1205
1315
  allowStateReadsEnd(runInfo.prevAllowStateReads_);
1206
1316
  endBatch();
1207
- if (runInfo.runAsAction_) untrackedEnd(runInfo.prevDerivation_);
1317
+
1318
+ if (runInfo.runAsAction_) {
1319
+ untrackedEnd(runInfo.prevDerivation_);
1320
+ }
1208
1321
 
1209
1322
  if (process.env.NODE_ENV !== "production" && runInfo.notifySpy_) {
1210
1323
  spyReportEnd({
@@ -1284,7 +1397,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1284
1397
  var _proto = ObservableValue.prototype;
1285
1398
 
1286
1399
  _proto.dehanceValue = function dehanceValue(value) {
1287
- if (this.dehancer !== undefined) return this.dehancer(value);
1400
+ if (this.dehancer !== undefined) {
1401
+ return this.dehancer(value);
1402
+ }
1403
+
1288
1404
  return value;
1289
1405
  };
1290
1406
 
@@ -1307,7 +1423,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1307
1423
  }
1308
1424
 
1309
1425
  this.setNewValue_(newValue);
1310
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
1426
+
1427
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
1428
+ spyReportEnd();
1429
+ }
1311
1430
  }
1312
1431
  };
1313
1432
 
@@ -1320,7 +1439,11 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1320
1439
  type: UPDATE,
1321
1440
  newValue: newValue
1322
1441
  });
1323
- if (!change) return globalState.UNCHANGED;
1442
+
1443
+ if (!change) {
1444
+ return globalState.UNCHANGED;
1445
+ }
1446
+
1324
1447
  newValue = change.newValue;
1325
1448
  } // apply modifier
1326
1449
 
@@ -1354,14 +1477,17 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1354
1477
  };
1355
1478
 
1356
1479
  _proto.observe_ = function observe_(listener, fireImmediately) {
1357
- if (fireImmediately) listener({
1358
- observableKind: "value",
1359
- debugObjectName: this.name_,
1360
- object: this,
1361
- type: UPDATE,
1362
- newValue: this.value_,
1363
- oldValue: undefined
1364
- });
1480
+ if (fireImmediately) {
1481
+ listener({
1482
+ observableKind: "value",
1483
+ debugObjectName: this.name_,
1484
+ object: this,
1485
+ type: UPDATE,
1486
+ newValue: this.value_,
1487
+ oldValue: undefined
1488
+ });
1489
+ }
1490
+
1365
1491
  return registerListener(this, listener);
1366
1492
  };
1367
1493
 
@@ -1456,7 +1582,11 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1456
1582
  this.keepAlive_ = void 0;
1457
1583
  this.onBOL = void 0;
1458
1584
  this.onBUOL = void 0;
1459
- if (!options.get) die(31);
1585
+
1586
+ if (!options.get) {
1587
+ die(31);
1588
+ }
1589
+
1460
1590
  this.derivation = options.get;
1461
1591
  this.name_ = options.name || (process.env.NODE_ENV !== "production" ? "ComputedValue@" + getNextId() : "ComputedValue");
1462
1592
 
@@ -1498,7 +1628,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1498
1628
  ;
1499
1629
 
1500
1630
  _proto.get = function get() {
1501
- if (this.isComputing_) die(32, this.name_, this.derivation);
1631
+ if (this.isComputing_) {
1632
+ die(32, this.name_, this.derivation);
1633
+ }
1502
1634
 
1503
1635
  if (globalState.inBatch === 0 && // !globalState.trackingDerivatpion &&
1504
1636
  this.observers_.size === 0 && !this.keepAlive_) {
@@ -1514,20 +1646,34 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1514
1646
 
1515
1647
  if (shouldCompute(this)) {
1516
1648
  var prevTrackingContext = globalState.trackingContext;
1517
- if (this.keepAlive_ && !prevTrackingContext) globalState.trackingContext = this;
1518
- if (this.trackAndCompute()) propagateChangeConfirmed(this);
1649
+
1650
+ if (this.keepAlive_ && !prevTrackingContext) {
1651
+ globalState.trackingContext = this;
1652
+ }
1653
+
1654
+ if (this.trackAndCompute()) {
1655
+ propagateChangeConfirmed(this);
1656
+ }
1657
+
1519
1658
  globalState.trackingContext = prevTrackingContext;
1520
1659
  }
1521
1660
  }
1522
1661
 
1523
1662
  var result = this.value_;
1524
- if (isCaughtException(result)) throw result.cause;
1663
+
1664
+ if (isCaughtException(result)) {
1665
+ throw result.cause;
1666
+ }
1667
+
1525
1668
  return result;
1526
1669
  };
1527
1670
 
1528
1671
  _proto.set = function set(value) {
1529
1672
  if (this.setter_) {
1530
- if (this.isRunningSetter_) die(33, this.name_);
1673
+ if (this.isRunningSetter_) {
1674
+ die(33, this.name_);
1675
+ }
1676
+
1531
1677
  this.isRunningSetter_ = true;
1532
1678
 
1533
1679
  try {
@@ -1535,7 +1681,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1535
1681
  } finally {
1536
1682
  this.isRunningSetter_ = false;
1537
1683
  }
1538
- } else die(34, this.name_);
1684
+ } else {
1685
+ die(34, this.name_);
1686
+ }
1539
1687
  };
1540
1688
 
1541
1689
  _proto.trackAndCompute = function trackAndCompute() {
@@ -1629,7 +1777,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1629
1777
  };
1630
1778
 
1631
1779
  _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {
1632
- if (!(process.env.NODE_ENV !== "production")) return;
1780
+ if (!(process.env.NODE_ENV !== "production")) {
1781
+ return;
1782
+ }
1633
1783
 
1634
1784
  if (this.isTracing_ !== TraceMode.NONE) {
1635
1785
  console.log("[mobx.trace] Computed value '" + this.name_ + "' is being read outside a reactive context. Doing a full recompute.");
@@ -1768,7 +1918,9 @@ function checkIfStateModificationsAreAllowed(atom) {
1768
1918
 
1769
1919
  var hasObservers = atom.observers_.size > 0; // Should not be possible to change observed state outside strict mode, except during initialization, see #563
1770
1920
 
1771
- if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
1921
+ if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) {
1922
+ console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
1923
+ }
1772
1924
  }
1773
1925
  function checkIfStateReadsAreAllowed(observable) {
1774
1926
  if (process.env.NODE_ENV !== "production" && !globalState.allowStateReads && globalState.observableRequiresReaction) {
@@ -1813,8 +1965,13 @@ function trackDerivedFunction(derivation, f, context) {
1813
1965
  }
1814
1966
 
1815
1967
  function warnAboutDerivationWithoutDependencies(derivation) {
1816
- if (!(process.env.NODE_ENV !== "production")) return;
1817
- if (derivation.observing_.length !== 0) return;
1968
+ if (!(process.env.NODE_ENV !== "production")) {
1969
+ return;
1970
+ }
1971
+
1972
+ if (derivation.observing_.length !== 0) {
1973
+ return;
1974
+ }
1818
1975
 
1819
1976
  if (globalState.reactionRequiresObservable || derivation.requiresObservable_) {
1820
1977
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
@@ -1843,7 +2000,11 @@ function bindDependencies(derivation) {
1843
2000
 
1844
2001
  if (dep.diffValue_ === 0) {
1845
2002
  dep.diffValue_ = 1;
1846
- if (i0 !== i) observing[i0] = dep;
2003
+
2004
+ if (i0 !== i) {
2005
+ observing[i0] = dep;
2006
+ }
2007
+
1847
2008
  i0++;
1848
2009
  } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
1849
2010
  // not hitting the condition
@@ -1935,7 +2096,10 @@ function allowStateReadsEnd(prev) {
1935
2096
  */
1936
2097
 
1937
2098
  function changeDependenciesStateTo0(derivation) {
1938
- if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) return;
2099
+ if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
2100
+ return;
2101
+ }
2102
+
1939
2103
  derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;
1940
2104
  var obs = derivation.observing_;
1941
2105
  var i = obs.length;
@@ -1979,8 +2143,14 @@ var canMergeGlobalState = true;
1979
2143
  var isolateCalled = false;
1980
2144
  var globalState = /*#__PURE__*/function () {
1981
2145
  var global = /*#__PURE__*/getGlobal();
1982
- if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;
1983
- if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false;
2146
+
2147
+ if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {
2148
+ canMergeGlobalState = false;
2149
+ }
2150
+
2151
+ if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {
2152
+ canMergeGlobalState = false;
2153
+ }
1984
2154
 
1985
2155
  if (!canMergeGlobalState) {
1986
2156
  // Because this is a IIFE we need to let isolateCalled a chance to change
@@ -1993,7 +2163,11 @@ var globalState = /*#__PURE__*/function () {
1993
2163
  return new MobXGlobals();
1994
2164
  } else if (global.__mobxGlobals) {
1995
2165
  global.__mobxInstanceCount += 1;
1996
- if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
2166
+
2167
+ if (!global.__mobxGlobals.UNCHANGED) {
2168
+ global.__mobxGlobals.UNCHANGED = {};
2169
+ } // make merge backward compatible
2170
+
1997
2171
 
1998
2172
  return global.__mobxGlobals;
1999
2173
  } else {
@@ -2002,12 +2176,19 @@ var globalState = /*#__PURE__*/function () {
2002
2176
  }
2003
2177
  }();
2004
2178
  function isolateGlobalState() {
2005
- if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) die(36);
2179
+ if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {
2180
+ die(36);
2181
+ }
2182
+
2006
2183
  isolateCalled = true;
2007
2184
 
2008
2185
  if (canMergeGlobalState) {
2009
2186
  var global = getGlobal();
2010
- if (--global.__mobxInstanceCount === 0) global.__mobxGlobals = undefined;
2187
+
2188
+ if (--global.__mobxInstanceCount === 0) {
2189
+ global.__mobxGlobals = undefined;
2190
+ }
2191
+
2011
2192
  globalState = new MobXGlobals();
2012
2193
  }
2013
2194
  }
@@ -2023,7 +2204,9 @@ function resetGlobalState() {
2023
2204
  var defaultGlobals = new MobXGlobals();
2024
2205
 
2025
2206
  for (var key in defaultGlobals) {
2026
- if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];
2207
+ if (persistentKeys.indexOf(key) === -1) {
2208
+ globalState[key] = defaultGlobals[key];
2209
+ }
2027
2210
  }
2028
2211
 
2029
2212
  globalState.allowStateChanges = !globalState.enforceActions;
@@ -2057,8 +2240,12 @@ function addObserver(observable, node) {
2057
2240
  // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
2058
2241
  // invariantObservers(observable);
2059
2242
  observable.observers_.add(node);
2060
- if (observable.lowestObserverState_ > node.dependenciesState_) observable.lowestObserverState_ = node.dependenciesState_; // invariantObservers(observable);
2243
+
2244
+ if (observable.lowestObserverState_ > node.dependenciesState_) {
2245
+ observable.lowestObserverState_ = node.dependenciesState_;
2246
+ } // invariantObservers(observable);
2061
2247
  // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
2248
+
2062
2249
  }
2063
2250
  function removeObserver(observable, node) {
2064
2251
  // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
@@ -2169,7 +2356,10 @@ function reportObserved(observable) {
2169
2356
 
2170
2357
  function propagateChanged(observable) {
2171
2358
  // invariantLOS(observable, "changed start");
2172
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2359
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2360
+ return;
2361
+ }
2362
+
2173
2363
  observable.lowestObserverState_ = IDerivationState_.STALE_; // Ideally we use for..of here, but the downcompiled version is really slow...
2174
2364
 
2175
2365
  observable.observers_.forEach(function (d) {
@@ -2187,7 +2377,10 @@ function propagateChanged(observable) {
2187
2377
 
2188
2378
  function propagateChangeConfirmed(observable) {
2189
2379
  // invariantLOS(observable, "confirmed start");
2190
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2380
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2381
+ return;
2382
+ }
2383
+
2191
2384
  observable.lowestObserverState_ = IDerivationState_.STALE_;
2192
2385
  observable.observers_.forEach(function (d) {
2193
2386
  if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {
@@ -2205,7 +2398,10 @@ function propagateChangeConfirmed(observable) {
2205
2398
 
2206
2399
  function propagateMaybeChanged(observable) {
2207
2400
  // invariantLOS(observable, "maybe start");
2208
- if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) return;
2401
+ if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {
2402
+ return;
2403
+ }
2404
+
2209
2405
  observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;
2210
2406
  observable.observers_.forEach(function (d) {
2211
2407
  if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -2233,9 +2429,12 @@ function printDepTree(tree, lines, depth) {
2233
2429
  }
2234
2430
 
2235
2431
  lines.push("" + "\t".repeat(depth - 1) + tree.name);
2236
- if (tree.dependencies) tree.dependencies.forEach(function (child) {
2237
- return printDepTree(child, lines, depth + 1);
2238
- });
2432
+
2433
+ if (tree.dependencies) {
2434
+ tree.dependencies.forEach(function (child) {
2435
+ return printDepTree(child, lines, depth + 1);
2436
+ });
2437
+ }
2239
2438
  }
2240
2439
 
2241
2440
  var Reaction = /*#__PURE__*/function () {
@@ -2353,7 +2552,9 @@ var Reaction = /*#__PURE__*/function () {
2353
2552
  clearObserving(this);
2354
2553
  }
2355
2554
 
2356
- if (isCaughtException(result)) this.reportExceptionInDerivation_(result.cause);
2555
+ if (isCaughtException(result)) {
2556
+ this.reportExceptionInDerivation_(result.cause);
2557
+ }
2357
2558
 
2358
2559
  if (process.env.NODE_ENV !== "production" && notify) {
2359
2560
  spyReportEnd({
@@ -2372,13 +2573,18 @@ var Reaction = /*#__PURE__*/function () {
2372
2573
  return;
2373
2574
  }
2374
2575
 
2375
- if (globalState.disableErrorBoundaries) throw error;
2576
+ if (globalState.disableErrorBoundaries) {
2577
+ throw error;
2578
+ }
2579
+
2376
2580
  var message = process.env.NODE_ENV !== "production" ? "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'" : "[mobx] uncaught error in '" + this + "'";
2377
2581
 
2378
2582
  if (!globalState.suppressReactionErrors) {
2379
2583
  console.error(message, error);
2380
2584
  /** If debugging brought you here, please, read the above message :-). Tnx! */
2381
- } else if (process.env.NODE_ENV !== "production") console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)"); // prettier-ignore
2585
+ } else if (process.env.NODE_ENV !== "production") {
2586
+ console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)");
2587
+ } // prettier-ignore
2382
2588
 
2383
2589
 
2384
2590
  if (process.env.NODE_ENV !== "production" && isSpyEnabled()) {
@@ -2432,7 +2638,10 @@ function onReactionError(handler) {
2432
2638
  globalState.globalReactionErrorHandlers.push(handler);
2433
2639
  return function () {
2434
2640
  var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
2435
- if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1);
2641
+
2642
+ if (idx >= 0) {
2643
+ globalState.globalReactionErrorHandlers.splice(idx, 1);
2644
+ }
2436
2645
  };
2437
2646
  }
2438
2647
  /**
@@ -2449,7 +2658,10 @@ var reactionScheduler = function reactionScheduler(f) {
2449
2658
 
2450
2659
  function runReactions() {
2451
2660
  // Trampolining, if runReactions are already running, new reactions will be picked up
2452
- if (globalState.inBatch > 0 || globalState.isRunningReactions) return;
2661
+ if (globalState.inBatch > 0 || globalState.isRunningReactions) {
2662
+ return;
2663
+ }
2664
+
2453
2665
  reactionScheduler(runReactionsHelper);
2454
2666
  }
2455
2667
 
@@ -2491,9 +2703,15 @@ function isSpyEnabled() {
2491
2703
  return process.env.NODE_ENV !== "production" && !!globalState.spyListeners.length;
2492
2704
  }
2493
2705
  function spyReport(event) {
2494
- if (!(process.env.NODE_ENV !== "production")) return; // dead code elimination can do the rest
2706
+ if (!(process.env.NODE_ENV !== "production")) {
2707
+ return;
2708
+ } // dead code elimination can do the rest
2709
+
2710
+
2711
+ if (!globalState.spyListeners.length) {
2712
+ return;
2713
+ }
2495
2714
 
2496
- if (!globalState.spyListeners.length) return;
2497
2715
  var listeners = globalState.spyListeners;
2498
2716
 
2499
2717
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -2501,7 +2719,9 @@ function spyReport(event) {
2501
2719
  }
2502
2720
  }
2503
2721
  function spyReportStart(event) {
2504
- if (!(process.env.NODE_ENV !== "production")) return;
2722
+ if (!(process.env.NODE_ENV !== "production")) {
2723
+ return;
2724
+ }
2505
2725
 
2506
2726
  var change = _extends({}, event, {
2507
2727
  spyReportStart: true
@@ -2514,11 +2734,18 @@ var END_EVENT = {
2514
2734
  spyReportEnd: true
2515
2735
  };
2516
2736
  function spyReportEnd(change) {
2517
- if (!(process.env.NODE_ENV !== "production")) return;
2518
- if (change) spyReport(_extends({}, change, {
2519
- type: "report-end",
2520
- spyReportEnd: true
2521
- }));else spyReport(END_EVENT);
2737
+ if (!(process.env.NODE_ENV !== "production")) {
2738
+ return;
2739
+ }
2740
+
2741
+ if (change) {
2742
+ spyReport(_extends({}, change, {
2743
+ type: "report-end",
2744
+ spyReportEnd: true
2745
+ }));
2746
+ } else {
2747
+ spyReport(END_EVENT);
2748
+ }
2522
2749
  }
2523
2750
  function spy(listener) {
2524
2751
  if (!(process.env.NODE_ENV !== "production")) {
@@ -2554,9 +2781,15 @@ var autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_B
2554
2781
  function createActionFactory(autoAction) {
2555
2782
  var res = function action(arg1, arg2) {
2556
2783
  // action(fn() {})
2557
- if (isFunction(arg1)) return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction); // action("name", fn() {})
2784
+ if (isFunction(arg1)) {
2785
+ return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
2786
+ } // action("name", fn() {})
2787
+
2788
+
2789
+ if (isFunction(arg2)) {
2790
+ return createAction(arg1, arg2, autoAction);
2791
+ } // @action
2558
2792
 
2559
- if (isFunction(arg2)) return createAction(arg1, arg2, autoAction); // @action
2560
2793
 
2561
2794
  if (isStringish(arg2)) {
2562
2795
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2570,7 +2803,9 @@ function createActionFactory(autoAction) {
2570
2803
  }));
2571
2804
  }
2572
2805
 
2573
- if (process.env.NODE_ENV !== "production") die("Invalid arguments for `action`");
2806
+ if (process.env.NODE_ENV !== "production") {
2807
+ die("Invalid arguments for `action`");
2808
+ }
2574
2809
  };
2575
2810
 
2576
2811
  return res;
@@ -2604,8 +2839,13 @@ function autorun(view, opts) {
2604
2839
  }
2605
2840
 
2606
2841
  if (process.env.NODE_ENV !== "production") {
2607
- if (!isFunction(view)) die("Autorun expects a function as first argument");
2608
- if (isAction(view)) die("Autorun does not accept actions since actions are untrackable");
2842
+ if (!isFunction(view)) {
2843
+ die("Autorun expects a function as first argument");
2844
+ }
2845
+
2846
+ if (isAction(view)) {
2847
+ die("Autorun does not accept actions since actions are untrackable");
2848
+ }
2609
2849
  }
2610
2850
 
2611
2851
  var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : process.env.NODE_ENV !== "production" ? view.name || "Autorun@" + getNextId() : "Autorun";
@@ -2626,7 +2866,10 @@ function autorun(view, opts) {
2626
2866
  isScheduled = true;
2627
2867
  scheduler(function () {
2628
2868
  isScheduled = false;
2629
- if (!reaction.isDisposed_) reaction.track(reactionRunner);
2869
+
2870
+ if (!reaction.isDisposed_) {
2871
+ reaction.track(reactionRunner);
2872
+ }
2630
2873
  });
2631
2874
  }
2632
2875
  }, opts.onError, opts.requiresObservable);
@@ -2658,8 +2901,13 @@ function reaction(expression, effect, opts) {
2658
2901
  }
2659
2902
 
2660
2903
  if (process.env.NODE_ENV !== "production") {
2661
- if (!isFunction(expression) || !isFunction(effect)) die("First and second argument to reaction should be functions");
2662
- if (!isPlainObject(opts)) die("Third argument of reactions should be an object");
2904
+ if (!isFunction(expression) || !isFunction(effect)) {
2905
+ die("First and second argument to reaction should be functions");
2906
+ }
2907
+
2908
+ if (!isPlainObject(opts)) {
2909
+ die("Third argument of reactions should be an object");
2910
+ }
2663
2911
  }
2664
2912
 
2665
2913
  var name = (_opts$name2 = opts.name) != null ? _opts$name2 : process.env.NODE_ENV !== "production" ? "Reaction@" + getNextId() : "Reaction";
@@ -2682,7 +2930,11 @@ function reaction(expression, effect, opts) {
2682
2930
 
2683
2931
  function reactionRunner() {
2684
2932
  isScheduled = false;
2685
- if (r.isDisposed_) return;
2933
+
2934
+ if (r.isDisposed_) {
2935
+ return;
2936
+ }
2937
+
2686
2938
  var changed = false;
2687
2939
  r.track(function () {
2688
2940
  var nextValue = allowStateChanges(false, function () {
@@ -2692,7 +2944,13 @@ function reaction(expression, effect, opts) {
2692
2944
  oldValue = value;
2693
2945
  value = nextValue;
2694
2946
  });
2695
- if (firstTime && opts.fireImmediately) effectAction(value, oldValue, r);else if (!firstTime && changed) effectAction(value, oldValue, r);
2947
+
2948
+ if (firstTime && opts.fireImmediately) {
2949
+ effectAction(value, oldValue, r);
2950
+ } else if (!firstTime && changed) {
2951
+ effectAction(value, oldValue, r);
2952
+ }
2953
+
2696
2954
  firstTime = false;
2697
2955
  }
2698
2956
 
@@ -2759,7 +3017,9 @@ function configure(options) {
2759
3017
  globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== "undefined";
2760
3018
  }
2761
3019
 
2762
- if (useProxies === "ifavailable") globalState.verifyProxies = true;
3020
+ if (useProxies === "ifavailable") {
3021
+ globalState.verifyProxies = true;
3022
+ }
2763
3023
 
2764
3024
  if (enforceActions !== undefined) {
2765
3025
  var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;
@@ -2767,7 +3027,9 @@ function configure(options) {
2767
3027
  globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;
2768
3028
  }
2769
3029
  ["computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "disableErrorBoundaries", "safeDescriptors"].forEach(function (key) {
2770
- if (key in options) globalState[key] = !!options[key];
3030
+ if (key in options) {
3031
+ globalState[key] = !!options[key];
3032
+ }
2771
3033
  });
2772
3034
  globalState.allowStateReads = !globalState.observableRequiresReaction;
2773
3035
 
@@ -2782,11 +3044,25 @@ function configure(options) {
2782
3044
 
2783
3045
  function extendObservable(target, properties, annotations, options) {
2784
3046
  if (process.env.NODE_ENV !== "production") {
2785
- if (arguments.length > 4) die("'extendObservable' expected 2-4 arguments");
2786
- if (typeof target !== "object") die("'extendObservable' expects an object as first argument");
2787
- if (isObservableMap(target)) die("'extendObservable' should not be used on maps, use map.merge instead");
2788
- if (!isPlainObject(properties)) die("'extendObservable' only accepts plain objects as second argument");
2789
- if (isObservable(properties) || isObservable(annotations)) die("Extending an object with another observable (object) is not supported");
3047
+ if (arguments.length > 4) {
3048
+ die("'extendObservable' expected 2-4 arguments");
3049
+ }
3050
+
3051
+ if (typeof target !== "object") {
3052
+ die("'extendObservable' expects an object as first argument");
3053
+ }
3054
+
3055
+ if (isObservableMap(target)) {
3056
+ die("'extendObservable' should not be used on maps, use map.merge instead");
3057
+ }
3058
+
3059
+ if (!isPlainObject(properties)) {
3060
+ die("'extendObservable' only accepts plain objects as second argument");
3061
+ }
3062
+
3063
+ if (isObservable(properties) || isObservable(annotations)) {
3064
+ die("Extending an object with another observable (object) is not supported");
3065
+ }
2790
3066
  } // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)
2791
3067
 
2792
3068
 
@@ -2814,7 +3090,11 @@ function nodeToDependencyTree(node) {
2814
3090
  var result = {
2815
3091
  name: node.name_
2816
3092
  };
2817
- if (node.observing_ && node.observing_.length > 0) result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3093
+
3094
+ if (node.observing_ && node.observing_.length > 0) {
3095
+ result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3096
+ }
3097
+
2818
3098
  return result;
2819
3099
  }
2820
3100
 
@@ -2826,7 +3106,11 @@ function nodeToObserverTree(node) {
2826
3106
  var result = {
2827
3107
  name: node.name_
2828
3108
  };
2829
- if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3109
+
3110
+ if (hasObservers(node)) {
3111
+ result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3112
+ }
3113
+
2830
3114
  return result;
2831
3115
  }
2832
3116
 
@@ -2853,7 +3137,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2853
3137
  } // flow(fn)
2854
3138
 
2855
3139
 
2856
- if (process.env.NODE_ENV !== "production" && arguments.length !== 1) die("Flow expects single argument with generator function");
3140
+ if (process.env.NODE_ENV !== "production" && arguments.length !== 1) {
3141
+ die("Flow expects single argument with generator function");
3142
+ }
3143
+
2857
3144
  var generator = arg1;
2858
3145
  var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js
2859
3146
 
@@ -2901,7 +3188,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2901
3188
  return;
2902
3189
  }
2903
3190
 
2904
- if (ret.done) return resolve(ret.value);
3191
+ if (ret.done) {
3192
+ return resolve(ret.value);
3193
+ }
3194
+
2905
3195
  pendingPromise = Promise.resolve(ret.value);
2906
3196
  return pendingPromise.then(onFulfilled, onRejected);
2907
3197
  }
@@ -2910,7 +3200,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2910
3200
  });
2911
3201
  promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
2912
3202
  try {
2913
- if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..
3203
+ if (pendingPromise) {
3204
+ cancelPromise(pendingPromise);
3205
+ } // Finally block can return (or yield) stuff..
3206
+
2914
3207
 
2915
3208
  var _res = gen["return"](undefined); // eat anything that promise would do, it's cancelled!
2916
3209
 
@@ -2934,7 +3227,9 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2934
3227
  flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
2935
3228
 
2936
3229
  function cancelPromise(promise) {
2937
- if (isFunction(promise.cancel)) promise.cancel();
3230
+ if (isFunction(promise.cancel)) {
3231
+ promise.cancel();
3232
+ }
2938
3233
  }
2939
3234
 
2940
3235
  function flowResult(result) {
@@ -2950,13 +3245,19 @@ function interceptReads(thing, propOrHandler, handler) {
2950
3245
  if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
2951
3246
  target = getAdministration(thing);
2952
3247
  } else if (isObservableObject(thing)) {
2953
- if (process.env.NODE_ENV !== "production" && !isStringish(propOrHandler)) return die("InterceptReads can only be used with a specific property, not with an object in general");
3248
+ if (process.env.NODE_ENV !== "production" && !isStringish(propOrHandler)) {
3249
+ return die("InterceptReads can only be used with a specific property, not with an object in general");
3250
+ }
3251
+
2954
3252
  target = getAdministration(thing, propOrHandler);
2955
3253
  } else if (process.env.NODE_ENV !== "production") {
2956
3254
  return die("Expected observable map, object or array as first array");
2957
3255
  }
2958
3256
 
2959
- if (process.env.NODE_ENV !== "production" && target.dehancer !== undefined) return die("An intercept reader was already established");
3257
+ if (process.env.NODE_ENV !== "production" && target.dehancer !== undefined) {
3258
+ return die("An intercept reader was already established");
3259
+ }
3260
+
2960
3261
  target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
2961
3262
  return function () {
2962
3263
  target.dehancer = undefined;
@@ -2964,7 +3265,11 @@ function interceptReads(thing, propOrHandler, handler) {
2964
3265
  }
2965
3266
 
2966
3267
  function intercept(thing, propOrHandler, handler) {
2967
- if (isFunction(handler)) return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);
3268
+ if (isFunction(handler)) {
3269
+ return interceptProperty(thing, propOrHandler, handler);
3270
+ } else {
3271
+ return interceptInterceptable(thing, propOrHandler);
3272
+ }
2968
3273
  }
2969
3274
 
2970
3275
  function interceptInterceptable(thing, handler) {
@@ -2980,25 +3285,41 @@ function _isComputed(value, property) {
2980
3285
  return isComputedValue(value);
2981
3286
  }
2982
3287
 
2983
- if (isObservableObject(value) === false) return false;
2984
- if (!value[$mobx].values_.has(property)) return false;
3288
+ if (isObservableObject(value) === false) {
3289
+ return false;
3290
+ }
3291
+
3292
+ if (!value[$mobx].values_.has(property)) {
3293
+ return false;
3294
+ }
3295
+
2985
3296
  var atom = getAtom(value, property);
2986
3297
  return isComputedValue(atom);
2987
3298
  }
2988
3299
  function isComputed(value) {
2989
- if (process.env.NODE_ENV !== "production" && arguments.length > 1) return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3300
+ if (process.env.NODE_ENV !== "production" && arguments.length > 1) {
3301
+ return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3302
+ }
3303
+
2990
3304
  return _isComputed(value);
2991
3305
  }
2992
3306
  function isComputedProp(value, propName) {
2993
- if (process.env.NODE_ENV !== "production" && !isStringish(propName)) return die("isComputed expected a property name as second argument");
3307
+ if (process.env.NODE_ENV !== "production" && !isStringish(propName)) {
3308
+ return die("isComputed expected a property name as second argument");
3309
+ }
3310
+
2994
3311
  return _isComputed(value, propName);
2995
3312
  }
2996
3313
 
2997
3314
  function _isObservable(value, property) {
2998
- if (!value) return false;
3315
+ if (!value) {
3316
+ return false;
3317
+ }
2999
3318
 
3000
3319
  if (property !== undefined) {
3001
- if (process.env.NODE_ENV !== "production" && (isObservableMap(value) || isObservableArray(value))) return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3320
+ if (process.env.NODE_ENV !== "production" && (isObservableMap(value) || isObservableArray(value))) {
3321
+ return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3322
+ }
3002
3323
 
3003
3324
  if (isObservableObject(value)) {
3004
3325
  return value[$mobx].values_.has(property);
@@ -3012,11 +3333,17 @@ function _isObservable(value, property) {
3012
3333
  }
3013
3334
 
3014
3335
  function isObservable(value) {
3015
- if (process.env.NODE_ENV !== "production" && arguments.length !== 1) die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3336
+ if (process.env.NODE_ENV !== "production" && arguments.length !== 1) {
3337
+ die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3338
+ }
3339
+
3016
3340
  return _isObservable(value);
3017
3341
  }
3018
3342
  function isObservableProp(value, propName) {
3019
- if (process.env.NODE_ENV !== "production" && !isStringish(propName)) return die("expected a property name as second argument");
3343
+ if (process.env.NODE_ENV !== "production" && !isStringish(propName)) {
3344
+ return die("expected a property name as second argument");
3345
+ }
3346
+
3020
3347
  return _isObservable(value, propName);
3021
3348
  }
3022
3349
 
@@ -3108,13 +3435,25 @@ function set(obj, key, value) {
3108
3435
  } else if (isObservableSet(obj)) {
3109
3436
  obj.add(key);
3110
3437
  } else if (isObservableArray(obj)) {
3111
- if (typeof key !== "number") key = parseInt(key, 10);
3112
- if (key < 0) die("Invalid index: '" + key + "'");
3438
+ if (typeof key !== "number") {
3439
+ key = parseInt(key, 10);
3440
+ }
3441
+
3442
+ if (key < 0) {
3443
+ die("Invalid index: '" + key + "'");
3444
+ }
3445
+
3113
3446
  startBatch();
3114
- if (key >= obj.length) obj.length = key + 1;
3447
+
3448
+ if (key >= obj.length) {
3449
+ obj.length = key + 1;
3450
+ }
3451
+
3115
3452
  obj[key] = value;
3116
3453
  endBatch();
3117
- } else die(8);
3454
+ } else {
3455
+ die(8);
3456
+ }
3118
3457
  }
3119
3458
  function remove(obj, key) {
3120
3459
  if (isObservableObject(obj)) {
@@ -3124,7 +3463,10 @@ function remove(obj, key) {
3124
3463
  } else if (isObservableSet(obj)) {
3125
3464
  obj["delete"](key);
3126
3465
  } else if (isObservableArray(obj)) {
3127
- if (typeof key !== "number") key = parseInt(key, 10);
3466
+ if (typeof key !== "number") {
3467
+ key = parseInt(key, 10);
3468
+ }
3469
+
3128
3470
  obj.splice(key, 1);
3129
3471
  } else {
3130
3472
  die(9);
@@ -3144,7 +3486,9 @@ function has(obj, key) {
3144
3486
  die(10);
3145
3487
  }
3146
3488
  function get(obj, key) {
3147
- if (!has(obj, key)) return undefined;
3489
+ if (!has(obj, key)) {
3490
+ return undefined;
3491
+ }
3148
3492
 
3149
3493
  if (isObservableObject(obj)) {
3150
3494
  return obj[$mobx].get_(key);
@@ -3172,7 +3516,11 @@ function apiOwnKeys(obj) {
3172
3516
  }
3173
3517
 
3174
3518
  function observe(thing, propOrCb, cbOrFire, fireImmediately) {
3175
- if (isFunction(cbOrFire)) return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);
3519
+ if (isFunction(cbOrFire)) {
3520
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
3521
+ } else {
3522
+ return observeObservable(thing, propOrCb, cbOrFire);
3523
+ }
3176
3524
  }
3177
3525
 
3178
3526
  function observeObservable(thing, listener, fireImmediately) {
@@ -3189,8 +3537,13 @@ function cache(map, key, value) {
3189
3537
  }
3190
3538
 
3191
3539
  function toJSHelper(source, __alreadySeen) {
3192
- if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) return source;
3193
- if (isObservableValue(source) || isComputedValue(source)) return toJSHelper(source.get(), __alreadySeen);
3540
+ if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) {
3541
+ return source;
3542
+ }
3543
+
3544
+ if (isObservableValue(source) || isComputedValue(source)) {
3545
+ return toJSHelper(source.get(), __alreadySeen);
3546
+ }
3194
3547
 
3195
3548
  if (__alreadySeen.has(source)) {
3196
3549
  return __alreadySeen.get(source);
@@ -3241,19 +3594,28 @@ function toJSHelper(source, __alreadySeen) {
3241
3594
 
3242
3595
 
3243
3596
  function toJS(source, options) {
3244
- if (process.env.NODE_ENV !== "production" && options) die("toJS no longer supports options");
3597
+ if (process.env.NODE_ENV !== "production" && options) {
3598
+ die("toJS no longer supports options");
3599
+ }
3600
+
3245
3601
  return toJSHelper(source, new Map());
3246
3602
  }
3247
3603
 
3248
3604
  function trace() {
3249
- if (!(process.env.NODE_ENV !== "production")) die("trace() is not available in production builds");
3605
+ if (!(process.env.NODE_ENV !== "production")) {
3606
+ die("trace() is not available in production builds");
3607
+ }
3608
+
3250
3609
  var enterBreakPoint = false;
3251
3610
 
3252
3611
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3253
3612
  args[_key] = arguments[_key];
3254
3613
  }
3255
3614
 
3256
- if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop();
3615
+ if (typeof args[args.length - 1] === "boolean") {
3616
+ enterBreakPoint = args.pop();
3617
+ }
3618
+
3257
3619
  var derivation = getAtomFromArgs(args);
3258
3620
 
3259
3621
  if (!derivation) {
@@ -3303,7 +3665,10 @@ function transaction(action, thisArg) {
3303
3665
  }
3304
3666
 
3305
3667
  function when(predicate, arg1, arg2) {
3306
- if (arguments.length === 1 || arg1 && typeof arg1 === "object") return whenPromise(predicate, arg1);
3668
+ if (arguments.length === 1 || arg1 && typeof arg1 === "object") {
3669
+ return whenPromise(predicate, arg1);
3670
+ }
3671
+
3307
3672
  return _when(predicate, arg1, arg2 || {});
3308
3673
  }
3309
3674
 
@@ -3315,7 +3680,12 @@ function _when(predicate, effect, opts) {
3315
3680
  timeoutHandle = setTimeout(function () {
3316
3681
  if (!disposer[$mobx].isDisposed_) {
3317
3682
  disposer();
3318
- if (opts.onError) opts.onError(error);else throw error;
3683
+
3684
+ if (opts.onError) {
3685
+ opts.onError(error);
3686
+ } else {
3687
+ throw error;
3688
+ }
3319
3689
  }
3320
3690
  }, opts.timeout);
3321
3691
  }
@@ -3329,7 +3699,11 @@ function _when(predicate, effect, opts) {
3329
3699
 
3330
3700
  if (cond) {
3331
3701
  r.dispose();
3332
- if (timeoutHandle) clearTimeout(timeoutHandle);
3702
+
3703
+ if (timeoutHandle) {
3704
+ clearTimeout(timeoutHandle);
3705
+ }
3706
+
3333
3707
  effectAction();
3334
3708
  }
3335
3709
  }, opts);
@@ -3337,7 +3711,10 @@ function _when(predicate, effect, opts) {
3337
3711
  }
3338
3712
 
3339
3713
  function whenPromise(predicate, opts) {
3340
- if (process.env.NODE_ENV !== "production" && opts && opts.onError) return die("the options 'onError' and 'promise' cannot be combined");
3714
+ if (process.env.NODE_ENV !== "production" && opts && opts.onError) {
3715
+ return die("the options 'onError' and 'promise' cannot be combined");
3716
+ }
3717
+
3341
3718
  var cancel;
3342
3719
  var res = new Promise(function (resolve, reject) {
3343
3720
  var disposer = _when(predicate, resolve, _extends({}, opts, {
@@ -3361,7 +3738,10 @@ function getAdm(target) {
3361
3738
 
3362
3739
  var objectProxyTraps = {
3363
3740
  has: function has(target, name) {
3364
- if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3741
+ if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) {
3742
+ warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3743
+ }
3744
+
3365
3745
  return getAdm(target).has_(name);
3366
3746
  },
3367
3747
  get: function get(target, name) {
@@ -3370,7 +3750,9 @@ var objectProxyTraps = {
3370
3750
  set: function set(target, name, value) {
3371
3751
  var _getAdm$set_;
3372
3752
 
3373
- if (!isStringish(name)) return false;
3753
+ if (!isStringish(name)) {
3754
+ return false;
3755
+ }
3374
3756
 
3375
3757
  if (process.env.NODE_ENV !== "production" && !getAdm(target).values_.has(name)) {
3376
3758
  warnAboutProxyRequirement("add a new observable property through direct assignment. Use 'set' from 'mobx' instead.");
@@ -3386,7 +3768,10 @@ var objectProxyTraps = {
3386
3768
  warnAboutProxyRequirement("delete properties from an observable object. Use 'remove' from 'mobx' instead.");
3387
3769
  }
3388
3770
 
3389
- if (!isStringish(name)) return false; // null (intercepted) -> true (success)
3771
+ if (!isStringish(name)) {
3772
+ return false;
3773
+ } // null (intercepted) -> true (success)
3774
+
3390
3775
 
3391
3776
  return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;
3392
3777
  },
@@ -3401,7 +3786,10 @@ var objectProxyTraps = {
3401
3786
  return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;
3402
3787
  },
3403
3788
  ownKeys: function ownKeys(target) {
3404
- if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3789
+ if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) {
3790
+ warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3791
+ }
3792
+
3405
3793
  return getAdm(target).ownKeys_();
3406
3794
  },
3407
3795
  preventExtensions: function preventExtensions(target) {
@@ -3424,7 +3812,10 @@ function registerInterceptor(interceptable, handler) {
3424
3812
  interceptors.push(handler);
3425
3813
  return once(function () {
3426
3814
  var idx = interceptors.indexOf(handler);
3427
- if (idx !== -1) interceptors.splice(idx, 1);
3815
+
3816
+ if (idx !== -1) {
3817
+ interceptors.splice(idx, 1);
3818
+ }
3428
3819
  });
3429
3820
  }
3430
3821
  function interceptChange(interceptable, change) {
@@ -3436,8 +3827,14 @@ function interceptChange(interceptable, change) {
3436
3827
 
3437
3828
  for (var i = 0, l = interceptors.length; i < l; i++) {
3438
3829
  change = interceptors[i](change);
3439
- if (change && !change.type) die(14);
3440
- if (!change) break;
3830
+
3831
+ if (change && !change.type) {
3832
+ die(14);
3833
+ }
3834
+
3835
+ if (!change) {
3836
+ break;
3837
+ }
3441
3838
  }
3442
3839
 
3443
3840
  return change;
@@ -3454,13 +3851,20 @@ function registerListener(listenable, handler) {
3454
3851
  listeners.push(handler);
3455
3852
  return once(function () {
3456
3853
  var idx = listeners.indexOf(handler);
3457
- if (idx !== -1) listeners.splice(idx, 1);
3854
+
3855
+ if (idx !== -1) {
3856
+ listeners.splice(idx, 1);
3857
+ }
3458
3858
  });
3459
3859
  }
3460
3860
  function notifyListeners(listenable, change) {
3461
3861
  var prevU = untrackedStart();
3462
3862
  var listeners = listenable.changeListeners_;
3463
- if (!listeners) return;
3863
+
3864
+ if (!listeners) {
3865
+ return;
3866
+ }
3867
+
3464
3868
  listeners = listeners.slice();
3465
3869
 
3466
3870
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -3497,8 +3901,13 @@ function makeObservable(target, annotations, options) {
3497
3901
  var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
3498
3902
  function makeAutoObservable(target, overrides, options) {
3499
3903
  if (process.env.NODE_ENV !== "production") {
3500
- if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3501
- if (isObservableObject(target)) die("makeAutoObservable can only be used on objects not already made observable");
3904
+ if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {
3905
+ die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3906
+ }
3907
+
3908
+ if (isObservableObject(target)) {
3909
+ die("makeAutoObservable can only be used on objects not already made observable");
3910
+ }
3502
3911
  } // Optimization: avoid visiting protos
3503
3912
  // Assumes that annotation.make_/.extend_ works the same for plain objects
3504
3913
 
@@ -3539,8 +3948,14 @@ var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/8
3539
3948
  var arrayTraps = {
3540
3949
  get: function get(target, name) {
3541
3950
  var adm = target[$mobx];
3542
- if (name === $mobx) return adm;
3543
- if (name === "length") return adm.getArrayLength_();
3951
+
3952
+ if (name === $mobx) {
3953
+ return adm;
3954
+ }
3955
+
3956
+ if (name === "length") {
3957
+ return adm.getArrayLength_();
3958
+ }
3544
3959
 
3545
3960
  if (typeof name === "string" && !isNaN(name)) {
3546
3961
  return adm.get_(parseInt(name));
@@ -3601,12 +4016,18 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3601
4016
  var _proto = ObservableArrayAdministration.prototype;
3602
4017
 
3603
4018
  _proto.dehanceValue_ = function dehanceValue_(value) {
3604
- if (this.dehancer !== undefined) return this.dehancer(value);
4019
+ if (this.dehancer !== undefined) {
4020
+ return this.dehancer(value);
4021
+ }
4022
+
3605
4023
  return value;
3606
4024
  };
3607
4025
 
3608
4026
  _proto.dehanceValues_ = function dehanceValues_(values) {
3609
- if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer);
4027
+ if (this.dehancer !== undefined && values.length > 0) {
4028
+ return values.map(this.dehancer);
4029
+ }
4030
+
3610
4031
  return values;
3611
4032
  };
3612
4033
 
@@ -3642,9 +4063,15 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3642
4063
  };
3643
4064
 
3644
4065
  _proto.setArrayLength_ = function setArrayLength_(newLength) {
3645
- if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) die("Out of range: " + newLength);
4066
+ if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) {
4067
+ die("Out of range: " + newLength);
4068
+ }
4069
+
3646
4070
  var currentLength = this.values_.length;
3647
- if (newLength === currentLength) return;else if (newLength > currentLength) {
4071
+
4072
+ if (newLength === currentLength) {
4073
+ return;
4074
+ } else if (newLength > currentLength) {
3648
4075
  var newItems = new Array(newLength - currentLength);
3649
4076
 
3650
4077
  for (var i = 0; i < newLength - currentLength; i++) {
@@ -3653,13 +4080,21 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3653
4080
 
3654
4081
 
3655
4082
  this.spliceWithArray_(currentLength, 0, newItems);
3656
- } else this.spliceWithArray_(newLength, currentLength - newLength);
4083
+ } else {
4084
+ this.spliceWithArray_(newLength, currentLength - newLength);
4085
+ }
3657
4086
  };
3658
4087
 
3659
4088
  _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {
3660
- if (oldLength !== this.lastKnownLength_) die(16);
4089
+ if (oldLength !== this.lastKnownLength_) {
4090
+ die(16);
4091
+ }
4092
+
3661
4093
  this.lastKnownLength_ += delta;
3662
- if (this.legacyMode_ && delta > 0) reserveArrayBuffer(oldLength + delta + 1);
4094
+
4095
+ if (this.legacyMode_ && delta > 0) {
4096
+ reserveArrayBuffer(oldLength + delta + 1);
4097
+ }
3663
4098
  };
3664
4099
 
3665
4100
  _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {
@@ -3667,9 +4102,26 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3667
4102
 
3668
4103
  checkIfStateModificationsAreAllowed(this.atom_);
3669
4104
  var length = this.values_.length;
3670
- if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);
3671
- if (arguments.length === 1) deleteCount = length - index;else if (deleteCount === undefined || deleteCount === null) deleteCount = 0;else deleteCount = Math.max(0, Math.min(deleteCount, length - index));
3672
- if (newItems === undefined) newItems = EMPTY_ARRAY;
4105
+
4106
+ if (index === undefined) {
4107
+ index = 0;
4108
+ } else if (index > length) {
4109
+ index = length;
4110
+ } else if (index < 0) {
4111
+ index = Math.max(0, length + index);
4112
+ }
4113
+
4114
+ if (arguments.length === 1) {
4115
+ deleteCount = length - index;
4116
+ } else if (deleteCount === undefined || deleteCount === null) {
4117
+ deleteCount = 0;
4118
+ } else {
4119
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
4120
+ }
4121
+
4122
+ if (newItems === undefined) {
4123
+ newItems = EMPTY_ARRAY;
4124
+ }
3673
4125
 
3674
4126
  if (hasInterceptors(this)) {
3675
4127
  var change = interceptChange(this, {
@@ -3679,7 +4131,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3679
4131
  removedCount: deleteCount,
3680
4132
  added: newItems
3681
4133
  });
3682
- if (!change) return EMPTY_ARRAY;
4134
+
4135
+ if (!change) {
4136
+ return EMPTY_ARRAY;
4137
+ }
4138
+
3683
4139
  deleteCount = change.removedCount;
3684
4140
  newItems = change.added;
3685
4141
  }
@@ -3694,7 +4150,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3694
4150
  }
3695
4151
 
3696
4152
  var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
3697
- if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice_(index, newItems, res);
4153
+
4154
+ if (deleteCount !== 0 || newItems.length !== 0) {
4155
+ this.notifyArraySplice_(index, newItems, res);
4156
+ }
4157
+
3698
4158
  return this.dehanceValues_(res);
3699
4159
  };
3700
4160
 
@@ -3737,10 +4197,19 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3737
4197
  } : null; // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't
3738
4198
  // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
3739
4199
 
3740
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
4200
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4201
+ spyReportStart(change);
4202
+ }
4203
+
3741
4204
  this.atom_.reportChanged();
3742
- if (notify) notifyListeners(this, change);
3743
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4205
+
4206
+ if (notify) {
4207
+ notifyListeners(this, change);
4208
+ }
4209
+
4210
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4211
+ spyReportEnd();
4212
+ }
3744
4213
  };
3745
4214
 
3746
4215
  _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {
@@ -3757,11 +4226,20 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3757
4226
  removedCount: removed.length,
3758
4227
  addedCount: added.length
3759
4228
  } : null;
3760
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
4229
+
4230
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4231
+ spyReportStart(change);
4232
+ }
4233
+
3761
4234
  this.atom_.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
3762
4235
 
3763
- if (notify) notifyListeners(this, change);
3764
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4236
+ if (notify) {
4237
+ notifyListeners(this, change);
4238
+ }
4239
+
4240
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4241
+ spyReportEnd();
4242
+ }
3765
4243
  };
3766
4244
 
3767
4245
  _proto.get_ = function get_(index) {
@@ -3788,7 +4266,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3788
4266
  index: index,
3789
4267
  newValue: newValue
3790
4268
  });
3791
- if (!change) return;
4269
+
4270
+ if (!change) {
4271
+ return;
4272
+ }
4273
+
3792
4274
  newValue = change.newValue;
3793
4275
  }
3794
4276
 
@@ -4029,6 +4511,8 @@ _Symbol$toStringTag = Symbol.toStringTag;
4029
4511
  var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTag2) {
4030
4512
  // hasMap, not hashMap >-).
4031
4513
  function ObservableMap(initialData, enhancer_, name_) {
4514
+ var _this = this;
4515
+
4032
4516
  if (enhancer_ === void 0) {
4033
4517
  enhancer_ = deepEnhancer;
4034
4518
  }
@@ -4056,7 +4540,9 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4056
4540
  this.keysAtom_ = createAtom(process.env.NODE_ENV !== "production" ? this.name_ + ".keys()" : "ObservableMap.keys()");
4057
4541
  this.data_ = new Map();
4058
4542
  this.hasMap_ = new Map();
4059
- this.merge(initialData);
4543
+ allowStateChanges(true, function () {
4544
+ _this.merge(initialData);
4545
+ });
4060
4546
  }
4061
4547
 
4062
4548
  var _proto = ObservableMap.prototype;
@@ -4066,16 +4552,19 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4066
4552
  };
4067
4553
 
4068
4554
  _proto.has = function has(key) {
4069
- var _this = this;
4555
+ var _this2 = this;
4556
+
4557
+ if (!globalState.trackingDerivation) {
4558
+ return this.has_(key);
4559
+ }
4070
4560
 
4071
- if (!globalState.trackingDerivation) return this.has_(key);
4072
4561
  var entry = this.hasMap_.get(key);
4073
4562
 
4074
4563
  if (!entry) {
4075
4564
  var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, process.env.NODE_ENV !== "production" ? this.name_ + "." + stringifyKey(key) + "?" : "ObservableMap.key?", false);
4076
4565
  this.hasMap_.set(key, newEntry);
4077
4566
  onBecomeUnobserved(newEntry, function () {
4078
- return _this.hasMap_["delete"](key);
4567
+ return _this2.hasMap_["delete"](key);
4079
4568
  });
4080
4569
  }
4081
4570
 
@@ -4092,7 +4581,11 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4092
4581
  newValue: value,
4093
4582
  name: key
4094
4583
  });
4095
- if (!change) return this;
4584
+
4585
+ if (!change) {
4586
+ return this;
4587
+ }
4588
+
4096
4589
  value = change.newValue;
4097
4590
  }
4098
4591
 
@@ -4106,7 +4599,7 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4106
4599
  };
4107
4600
 
4108
4601
  _proto["delete"] = function _delete(key) {
4109
- var _this2 = this;
4602
+ var _this3 = this;
4110
4603
 
4111
4604
  checkIfStateModificationsAreAllowed(this.keysAtom_);
4112
4605
 
@@ -4116,7 +4609,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4116
4609
  object: this,
4117
4610
  name: key
4118
4611
  });
4119
- if (!change) return false;
4612
+
4613
+ if (!change) {
4614
+ return false;
4615
+ }
4120
4616
  }
4121
4617
 
4122
4618
  if (this.has_(key)) {
@@ -4132,23 +4628,33 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4132
4628
  name: key
4133
4629
  } : null;
4134
4630
 
4135
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change); // TODO fix type
4631
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4632
+ spyReportStart(_change);
4633
+ } // TODO fix type
4634
+
4136
4635
 
4137
4636
  transaction(function () {
4138
- var _this2$hasMap_$get;
4637
+ var _this3$hasMap_$get;
4139
4638
 
4140
- _this2.keysAtom_.reportChanged();
4639
+ _this3.keysAtom_.reportChanged();
4141
4640
 
4142
- (_this2$hasMap_$get = _this2.hasMap_.get(key)) == null ? void 0 : _this2$hasMap_$get.setNewValue_(false);
4641
+ (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null ? void 0 : _this3$hasMap_$get.setNewValue_(false);
4143
4642
 
4144
- var observable = _this2.data_.get(key);
4643
+ var observable = _this3.data_.get(key);
4145
4644
 
4146
4645
  observable.setNewValue_(undefined);
4147
4646
 
4148
- _this2.data_["delete"](key);
4647
+ _this3.data_["delete"](key);
4149
4648
  });
4150
- if (notify) notifyListeners(this, _change);
4151
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4649
+
4650
+ if (notify) {
4651
+ notifyListeners(this, _change);
4652
+ }
4653
+
4654
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4655
+ spyReportEnd();
4656
+ }
4657
+
4152
4658
  return true;
4153
4659
  }
4154
4660
 
@@ -4171,30 +4677,40 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4171
4677
  name: key,
4172
4678
  newValue: newValue
4173
4679
  } : null;
4174
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change); // TODO fix type
4680
+
4681
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4682
+ spyReportStart(change);
4683
+ } // TODO fix type
4684
+
4175
4685
 
4176
4686
  observable.setNewValue_(newValue);
4177
- if (notify) notifyListeners(this, change);
4178
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4687
+
4688
+ if (notify) {
4689
+ notifyListeners(this, change);
4690
+ }
4691
+
4692
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4693
+ spyReportEnd();
4694
+ }
4179
4695
  }
4180
4696
  };
4181
4697
 
4182
4698
  _proto.addValue_ = function addValue_(key, newValue) {
4183
- var _this3 = this;
4699
+ var _this4 = this;
4184
4700
 
4185
4701
  checkIfStateModificationsAreAllowed(this.keysAtom_);
4186
4702
  transaction(function () {
4187
- var _this3$hasMap_$get;
4703
+ var _this4$hasMap_$get;
4188
4704
 
4189
- var observable = new ObservableValue(newValue, _this3.enhancer_, process.env.NODE_ENV !== "production" ? _this3.name_ + "." + stringifyKey(key) : "ObservableMap.key", false);
4705
+ var observable = new ObservableValue(newValue, _this4.enhancer_, process.env.NODE_ENV !== "production" ? _this4.name_ + "." + stringifyKey(key) : "ObservableMap.key", false);
4190
4706
 
4191
- _this3.data_.set(key, observable);
4707
+ _this4.data_.set(key, observable);
4192
4708
 
4193
4709
  newValue = observable.value_; // value might have been changed
4194
4710
 
4195
- (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null ? void 0 : _this3$hasMap_$get.setNewValue_(true);
4711
+ (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null ? void 0 : _this4$hasMap_$get.setNewValue_(true);
4196
4712
 
4197
- _this3.keysAtom_.reportChanged();
4713
+ _this4.keysAtom_.reportChanged();
4198
4714
  });
4199
4715
  var notifySpy = isSpyEnabled();
4200
4716
  var notify = hasListeners(this);
@@ -4206,14 +4722,26 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4206
4722
  name: key,
4207
4723
  newValue: newValue
4208
4724
  } : null;
4209
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change); // TODO fix type
4210
4725
 
4211
- if (notify) notifyListeners(this, change);
4212
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4726
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4727
+ spyReportStart(change);
4728
+ } // TODO fix type
4729
+
4730
+
4731
+ if (notify) {
4732
+ notifyListeners(this, change);
4733
+ }
4734
+
4735
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4736
+ spyReportEnd();
4737
+ }
4213
4738
  };
4214
4739
 
4215
4740
  _proto.get = function get(key) {
4216
- if (this.has(key)) return this.dehanceValue_(this.data_.get(key).get());
4741
+ if (this.has(key)) {
4742
+ return this.dehanceValue_(this.data_.get(key).get());
4743
+ }
4744
+
4217
4745
  return this.dehanceValue_(undefined);
4218
4746
  };
4219
4747
 
@@ -4280,45 +4808,54 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4280
4808
  ;
4281
4809
 
4282
4810
  _proto.merge = function merge(other) {
4283
- var _this4 = this;
4811
+ var _this5 = this;
4284
4812
 
4285
4813
  if (isObservableMap(other)) {
4286
4814
  other = new Map(other);
4287
4815
  }
4288
4816
 
4289
4817
  transaction(function () {
4290
- if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) {
4291
- return _this4.set(key, other[key]);
4292
- });else if (Array.isArray(other)) other.forEach(function (_ref) {
4293
- var key = _ref[0],
4294
- value = _ref[1];
4295
- return _this4.set(key, value);
4296
- });else if (isES6Map(other)) {
4297
- if (other.constructor !== Map) die(19, other);
4818
+ if (isPlainObject(other)) {
4819
+ getPlainObjectKeys(other).forEach(function (key) {
4820
+ return _this5.set(key, other[key]);
4821
+ });
4822
+ } else if (Array.isArray(other)) {
4823
+ other.forEach(function (_ref) {
4824
+ var key = _ref[0],
4825
+ value = _ref[1];
4826
+ return _this5.set(key, value);
4827
+ });
4828
+ } else if (isES6Map(other)) {
4829
+ if (other.constructor !== Map) {
4830
+ die(19, other);
4831
+ }
4832
+
4298
4833
  other.forEach(function (value, key) {
4299
- return _this4.set(key, value);
4834
+ return _this5.set(key, value);
4300
4835
  });
4301
- } else if (other !== null && other !== undefined) die(20, other);
4836
+ } else if (other !== null && other !== undefined) {
4837
+ die(20, other);
4838
+ }
4302
4839
  });
4303
4840
  return this;
4304
4841
  };
4305
4842
 
4306
4843
  _proto.clear = function clear() {
4307
- var _this5 = this;
4844
+ var _this6 = this;
4308
4845
 
4309
4846
  transaction(function () {
4310
4847
  untracked(function () {
4311
- for (var _iterator2 = _createForOfIteratorHelperLoose(_this5.keys()), _step2; !(_step2 = _iterator2()).done;) {
4848
+ for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {
4312
4849
  var key = _step2.value;
4313
4850
 
4314
- _this5["delete"](key);
4851
+ _this6["delete"](key);
4315
4852
  }
4316
4853
  });
4317
4854
  });
4318
4855
  };
4319
4856
 
4320
4857
  _proto.replace = function replace(values) {
4321
- var _this6 = this;
4858
+ var _this7 = this;
4322
4859
 
4323
4860
  // Implementation requirements:
4324
4861
  // - respect ordering of replacement map
@@ -4335,13 +4872,13 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4335
4872
  // if the key deletion is prevented by interceptor
4336
4873
  // add entry at the beginning of the result map
4337
4874
 
4338
- for (var _iterator3 = _createForOfIteratorHelperLoose(_this6.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {
4875
+ for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {
4339
4876
  var key = _step3.value;
4340
4877
 
4341
4878
  // Concurrently iterating/deleting keys
4342
4879
  // iterator should handle this correctly
4343
4880
  if (!replacementMap.has(key)) {
4344
- var deleted = _this6["delete"](key); // Was the key removed?
4881
+ var deleted = _this7["delete"](key); // Was the key removed?
4345
4882
 
4346
4883
 
4347
4884
  if (deleted) {
@@ -4349,7 +4886,7 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4349
4886
  keysReportChangedCalled = true;
4350
4887
  } else {
4351
4888
  // Delete prevented by interceptor
4352
- var value = _this6.data_.get(key);
4889
+ var value = _this7.data_.get(key);
4353
4890
 
4354
4891
  orderedData.set(key, value);
4355
4892
  }
@@ -4363,17 +4900,17 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4363
4900
  _value = _step4$value[1];
4364
4901
 
4365
4902
  // We will want to know whether a new key is added
4366
- var keyExisted = _this6.data_.has(_key); // Add or update value
4903
+ var keyExisted = _this7.data_.has(_key); // Add or update value
4367
4904
 
4368
4905
 
4369
- _this6.set(_key, _value); // The addition could have been prevent by interceptor
4906
+ _this7.set(_key, _value); // The addition could have been prevent by interceptor
4370
4907
 
4371
4908
 
4372
- if (_this6.data_.has(_key)) {
4909
+ if (_this7.data_.has(_key)) {
4373
4910
  // The update could have been prevented by interceptor
4374
4911
  // and also we want to preserve existing values
4375
4912
  // so use value from _data map (instead of replacement map)
4376
- var _value2 = _this6.data_.get(_key);
4913
+ var _value2 = _this7.data_.get(_key);
4377
4914
 
4378
4915
  orderedData.set(_key, _value2); // Was a new key added?
4379
4916
 
@@ -4386,11 +4923,11 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4386
4923
 
4387
4924
 
4388
4925
  if (!keysReportChangedCalled) {
4389
- if (_this6.data_.size !== orderedData.size) {
4926
+ if (_this7.data_.size !== orderedData.size) {
4390
4927
  // If size differs, keys are definitely modified
4391
- _this6.keysAtom_.reportChanged();
4928
+ _this7.keysAtom_.reportChanged();
4392
4929
  } else {
4393
- var iter1 = _this6.data_.keys();
4930
+ var iter1 = _this7.data_.keys();
4394
4931
 
4395
4932
  var iter2 = orderedData.keys();
4396
4933
  var next1 = iter1.next();
@@ -4398,7 +4935,7 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4398
4935
 
4399
4936
  while (!next1.done) {
4400
4937
  if (next1.value !== next2.value) {
4401
- _this6.keysAtom_.reportChanged();
4938
+ _this7.keysAtom_.reportChanged();
4402
4939
 
4403
4940
  break;
4404
4941
  }
@@ -4410,7 +4947,7 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4410
4947
  } // Use correctly ordered map
4411
4948
 
4412
4949
 
4413
- _this6.data_ = orderedData;
4950
+ _this7.data_ = orderedData;
4414
4951
  });
4415
4952
  return this;
4416
4953
  };
@@ -4429,7 +4966,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4429
4966
  * for callback details
4430
4967
  */
4431
4968
  _proto.observe_ = function observe_(listener, fireImmediately) {
4432
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with maps.");
4969
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
4970
+ die("`observe` doesn't support fireImmediately=true in combination with maps.");
4971
+ }
4972
+
4433
4973
  return registerListener(this, listener);
4434
4974
  };
4435
4975
 
@@ -4554,8 +5094,12 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4554
5094
  object: this,
4555
5095
  newValue: value
4556
5096
  });
4557
- if (!change) return this; // ideally, value = change.value would be done here, so that values can be
5097
+
5098
+ if (!change) {
5099
+ return this;
5100
+ } // ideally, value = change.value would be done here, so that values can be
4558
5101
  // changed by interceptor. Same applies for other Set and Map api's.
5102
+
4559
5103
  }
4560
5104
 
4561
5105
  if (!this.has(value)) {
@@ -4575,9 +5119,17 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4575
5119
  newValue: value
4576
5120
  } : null;
4577
5121
 
4578
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(_change);
4579
- if (notify) notifyListeners(this, _change);
4580
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd();
5122
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5123
+ spyReportStart(_change);
5124
+ }
5125
+
5126
+ if (notify) {
5127
+ notifyListeners(this, _change);
5128
+ }
5129
+
5130
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5131
+ spyReportEnd();
5132
+ }
4581
5133
  }
4582
5134
 
4583
5135
  return this;
@@ -4592,7 +5144,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4592
5144
  object: this,
4593
5145
  oldValue: value
4594
5146
  });
4595
- if (!change) return false;
5147
+
5148
+ if (!change) {
5149
+ return false;
5150
+ }
4596
5151
  }
4597
5152
 
4598
5153
  if (this.has(value)) {
@@ -4607,14 +5162,24 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4607
5162
  oldValue: value
4608
5163
  } : null;
4609
5164
 
4610
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(_change2);
5165
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5166
+ spyReportStart(_change2);
5167
+ }
5168
+
4611
5169
  transaction(function () {
4612
5170
  _this3.atom_.reportChanged();
4613
5171
 
4614
5172
  _this3.data_["delete"](value);
4615
5173
  });
4616
- if (notify) notifyListeners(this, _change2);
4617
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd();
5174
+
5175
+ if (notify) {
5176
+ notifyListeners(this, _change2);
5177
+ }
5178
+
5179
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5180
+ spyReportEnd();
5181
+ }
5182
+
4618
5183
  return true;
4619
5184
  }
4620
5185
 
@@ -4694,7 +5259,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4694
5259
 
4695
5260
  _proto.observe_ = function observe_(listener, fireImmediately) {
4696
5261
  // ... 'fireImmediately' could also be true?
4697
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with sets.");
5262
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
5263
+ die("`observe` doesn't support fireImmediately=true in combination with sets.");
5264
+ }
5265
+
4698
5266
  return registerListener(this, listener);
4699
5267
  };
4700
5268
 
@@ -4796,7 +5364,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4796
5364
  name: key,
4797
5365
  newValue: newValue
4798
5366
  });
4799
- if (!change) return null;
5367
+
5368
+ if (!change) {
5369
+ return null;
5370
+ }
5371
+
4800
5372
  newValue = change.newValue;
4801
5373
  }
4802
5374
 
@@ -4816,10 +5388,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4816
5388
  newValue: newValue
4817
5389
  } : null;
4818
5390
 
4819
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change);
5391
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5392
+ spyReportStart(_change);
5393
+ }
4820
5394
  observable.setNewValue_(newValue);
4821
- if (notify) notifyListeners(this, _change);
4822
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5395
+
5396
+ if (notify) {
5397
+ notifyListeners(this, _change);
5398
+ }
5399
+
5400
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5401
+ spyReportEnd();
5402
+ }
4823
5403
  }
4824
5404
 
4825
5405
  return true;
@@ -4928,12 +5508,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4928
5508
 
4929
5509
  if (descriptor) {
4930
5510
  var outcome = annotation.make_(this, key, descriptor, source);
5511
+
4931
5512
  if (outcome === 0
4932
5513
  /* Cancel */
4933
- ) return;
5514
+ ) {
5515
+ return;
5516
+ }
5517
+
4934
5518
  if (outcome === 1
4935
5519
  /* Break */
4936
- ) break;
5520
+ ) {
5521
+ break;
5522
+ }
4937
5523
  }
4938
5524
 
4939
5525
  source = Object.getPrototypeOf(source);
@@ -5003,7 +5589,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5003
5589
  type: ADD,
5004
5590
  newValue: descriptor.value
5005
5591
  });
5006
- if (!change) return null;
5592
+
5593
+ if (!change) {
5594
+ return null;
5595
+ }
5596
+
5007
5597
  var newValue = change.newValue;
5008
5598
 
5009
5599
  if (descriptor.value !== newValue) {
@@ -5055,7 +5645,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5055
5645
  type: ADD,
5056
5646
  newValue: value
5057
5647
  });
5058
- if (!change) return null;
5648
+
5649
+ if (!change) {
5650
+ return null;
5651
+ }
5652
+
5059
5653
  value = change.newValue;
5060
5654
  }
5061
5655
 
@@ -5110,7 +5704,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5110
5704
  type: ADD,
5111
5705
  newValue: undefined
5112
5706
  });
5113
- if (!change) return null;
5707
+
5708
+ if (!change) {
5709
+ return null;
5710
+ }
5114
5711
  }
5115
5712
 
5116
5713
  options.name || (options.name = process.env.NODE_ENV !== "production" ? this.name_ + "." + key.toString() : "ObservableObject.key");
@@ -5166,7 +5763,9 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5166
5763
  type: REMOVE
5167
5764
  }); // Cancelled
5168
5765
 
5169
- if (!change) return null;
5766
+ if (!change) {
5767
+ return null;
5768
+ }
5170
5769
  } // Delete
5171
5770
 
5172
5771
 
@@ -5227,9 +5826,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5227
5826
  oldValue: value,
5228
5827
  name: key
5229
5828
  };
5230
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change2);
5231
- if (notify) notifyListeners(this, _change2);
5232
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5829
+
5830
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5831
+ spyReportStart(_change2);
5832
+ }
5833
+
5834
+ if (notify) {
5835
+ notifyListeners(this, _change2);
5836
+ }
5837
+
5838
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5839
+ spyReportEnd();
5840
+ }
5233
5841
  }
5234
5842
  } finally {
5235
5843
  endBatch();
@@ -5245,7 +5853,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5245
5853
  ;
5246
5854
 
5247
5855
  _proto.observe_ = function observe_(callback, fireImmediately) {
5248
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support the fire immediately property for observable objects.");
5856
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
5857
+ die("`observe` doesn't support the fire immediately property for observable objects.");
5858
+ }
5859
+
5249
5860
  return registerListener(this, callback);
5250
5861
  };
5251
5862
 
@@ -5268,9 +5879,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5268
5879
  name: key,
5269
5880
  newValue: value
5270
5881
  } : null;
5271
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
5272
- if (notify) notifyListeners(this, change);
5273
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5882
+
5883
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5884
+ spyReportStart(change);
5885
+ }
5886
+
5887
+ if (notify) {
5888
+ notifyListeners(this, change);
5889
+ }
5890
+
5891
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5892
+ spyReportEnd();
5893
+ }
5274
5894
  }
5275
5895
 
5276
5896
  (_this$pendingKeys_2 = this.pendingKeys_) == null ? void 0 : (_this$pendingKeys_2$g = _this$pendingKeys_2.get(key)) == null ? void 0 : _this$pendingKeys_2$g.set(true); // Notify "keys/entries/values" observers
@@ -5311,7 +5931,10 @@ function asObservableObject(target, options) {
5311
5931
  return target;
5312
5932
  }
5313
5933
 
5314
- if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) die("Cannot make the designated object observable; it is not extensible");
5934
+ if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) {
5935
+ die("Cannot make the designated object observable; it is not extensible");
5936
+ }
5937
+
5315
5938
  var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : process.env.NODE_ENV !== "production" ? (isPlainObject(target) ? "ObservableObject" : target.constructor.name) + "@" + getNextId() : "ObservableObject";
5316
5939
  var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
5317
5940
  addHiddenProp(target, $mobx, adm);
@@ -5468,7 +6091,6 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5468
6091
  var nextIndex = 0;
5469
6092
  return makeIterable({
5470
6093
  next: function next() {
5471
- // @ts-ignore
5472
6094
  return nextIndex < self.length ? {
5473
6095
  value: self[nextIndex++],
5474
6096
  done: false
@@ -5501,7 +6123,10 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5501
6123
  Object.entries(arrayExtensions).forEach(function (_ref) {
5502
6124
  var prop = _ref[0],
5503
6125
  fn = _ref[1];
5504
- if (prop !== "concat") addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6126
+
6127
+ if (prop !== "concat") {
6128
+ addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6129
+ }
5505
6130
  });
5506
6131
 
5507
6132
  function createArrayEntryDescriptor(index) {
@@ -5538,7 +6163,10 @@ function createLegacyArray(initialValues, enhancer, name) {
5538
6163
  function getAtom(thing, property) {
5539
6164
  if (typeof thing === "object" && thing !== null) {
5540
6165
  if (isObservableArray(thing)) {
5541
- if (property !== undefined) die(23);
6166
+ if (property !== undefined) {
6167
+ die(23);
6168
+ }
6169
+
5542
6170
  return thing[$mobx].atom_;
5543
6171
  }
5544
6172
 
@@ -5547,18 +6175,31 @@ function getAtom(thing, property) {
5547
6175
  }
5548
6176
 
5549
6177
  if (isObservableMap(thing)) {
5550
- if (property === undefined) return thing.keysAtom_;
6178
+ if (property === undefined) {
6179
+ return thing.keysAtom_;
6180
+ }
6181
+
5551
6182
  var observable = thing.data_.get(property) || thing.hasMap_.get(property);
5552
- if (!observable) die(25, property, getDebugName(thing));
6183
+
6184
+ if (!observable) {
6185
+ die(25, property, getDebugName(thing));
6186
+ }
6187
+
5553
6188
  return observable;
5554
6189
  }
5555
6190
 
6191
+
5556
6192
  if (isObservableObject(thing)) {
5557
- if (!property) return die(26);
6193
+ if (!property) {
6194
+ return die(26);
6195
+ }
5558
6196
 
5559
6197
  var _observable = thing[$mobx].values_.get(property);
5560
6198
 
5561
- if (!_observable) die(27, property, getDebugName(thing));
6199
+ if (!_observable) {
6200
+ die(27, property, getDebugName(thing));
6201
+ }
6202
+
5562
6203
  return _observable;
5563
6204
  }
5564
6205
 
@@ -5575,11 +6216,26 @@ function getAtom(thing, property) {
5575
6216
  die(28);
5576
6217
  }
5577
6218
  function getAdministration(thing, property) {
5578
- if (!thing) die(29);
5579
- if (property !== undefined) return getAdministration(getAtom(thing, property));
5580
- if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing;
5581
- if (isObservableMap(thing) || isObservableSet(thing)) return thing;
5582
- if (thing[$mobx]) return thing[$mobx];
6219
+ if (!thing) {
6220
+ die(29);
6221
+ }
6222
+
6223
+ if (property !== undefined) {
6224
+ return getAdministration(getAtom(thing, property));
6225
+ }
6226
+
6227
+ if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
6228
+ return thing;
6229
+ }
6230
+
6231
+ if (isObservableMap(thing) || isObservableSet(thing)) {
6232
+ return thing;
6233
+ }
6234
+
6235
+ if (thing[$mobx]) {
6236
+ return thing[$mobx];
6237
+ }
6238
+
5583
6239
  die(24, thing);
5584
6240
  }
5585
6241
  function getDebugName(thing, property) {
@@ -5612,17 +6268,33 @@ function deepEqual(a, b, depth) {
5612
6268
  function eq(a, b, depth, aStack, bStack) {
5613
6269
  // Identical objects are equal. `0 === -0`, but they aren't identical.
5614
6270
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
5615
- if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).
6271
+ if (a === b) {
6272
+ return a !== 0 || 1 / a === 1 / b;
6273
+ } // `null` or `undefined` only equal to itself (strict comparison).
6274
+
6275
+
6276
+ if (a == null || b == null) {
6277
+ return false;
6278
+ } // `NaN`s are equivalent, but non-reflexive.
6279
+
5616
6280
 
5617
- if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.
6281
+ if (a !== a) {
6282
+ return b !== b;
6283
+ } // Exhaust primitive checks
5618
6284
 
5619
- if (a !== a) return b !== b; // Exhaust primitive checks
5620
6285
 
5621
6286
  var type = typeof a;
5622
- if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
6287
+
6288
+ if (type !== "function" && type !== "object" && typeof b != "object") {
6289
+ return false;
6290
+ } // Compare `[[Class]]` names.
6291
+
5623
6292
 
5624
6293
  var className = toString.call(a);
5625
- if (className !== toString.call(b)) return false;
6294
+
6295
+ if (className !== toString.call(b)) {
6296
+ return false;
6297
+ }
5626
6298
 
5627
6299
  switch (className) {
5628
6300
  // Strings, numbers, regular expressions, dates, and booleans are compared by value.
@@ -5636,7 +6308,10 @@ function eq(a, b, depth, aStack, bStack) {
5636
6308
  case "[object Number]":
5637
6309
  // `NaN`s are equivalent, but non-reflexive.
5638
6310
  // Object(NaN) is equivalent to NaN.
5639
- if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.
6311
+ if (+a !== +a) {
6312
+ return +b !== +b;
6313
+ } // An `egal` comparison is performed for other numeric values.
6314
+
5640
6315
 
5641
6316
  return +a === 0 ? 1 / +a === 1 / b : +a === +b;
5642
6317
 
@@ -5667,9 +6342,12 @@ function eq(a, b, depth, aStack, bStack) {
5667
6342
  var areArrays = className === "[object Array]";
5668
6343
 
5669
6344
  if (!areArrays) {
5670
- if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6345
+ if (typeof a != "object" || typeof b != "object") {
6346
+ return false;
6347
+ } // Objects with different constructors are not equivalent, but `Object`s or `Array`s
5671
6348
  // from different frames are.
5672
6349
 
6350
+
5673
6351
  var aCtor = a.constructor,
5674
6352
  bCtor = b.constructor;
5675
6353
 
@@ -5695,7 +6373,9 @@ function eq(a, b, depth, aStack, bStack) {
5695
6373
  while (length--) {
5696
6374
  // Linear search. Performance is inversely proportional to the number of
5697
6375
  // unique nested structures.
5698
- if (aStack[length] === a) return bStack[length] === b;
6376
+ if (aStack[length] === a) {
6377
+ return bStack[length] === b;
6378
+ }
5699
6379
  } // Add the first object to the stack of traversed objects.
5700
6380
 
5701
6381
 
@@ -5705,10 +6385,16 @@ function eq(a, b, depth, aStack, bStack) {
5705
6385
  if (areArrays) {
5706
6386
  // Compare array lengths to determine if a deep comparison is necessary.
5707
6387
  length = a.length;
5708
- if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.
6388
+
6389
+ if (length !== b.length) {
6390
+ return false;
6391
+ } // Deep compare the contents, ignoring non-numeric properties.
6392
+
5709
6393
 
5710
6394
  while (length--) {
5711
- if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false;
6395
+ if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {
6396
+ return false;
6397
+ }
5712
6398
  }
5713
6399
  } else {
5714
6400
  // Deep compare objects.
@@ -5716,12 +6402,17 @@ function eq(a, b, depth, aStack, bStack) {
5716
6402
  var key;
5717
6403
  length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
5718
6404
 
5719
- if (Object.keys(b).length !== length) return false;
6405
+ if (Object.keys(b).length !== length) {
6406
+ return false;
6407
+ }
5720
6408
 
5721
6409
  while (length--) {
5722
6410
  // Deep compare each member
5723
6411
  key = keys[length];
5724
- if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false;
6412
+
6413
+ if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
6414
+ return false;
6415
+ }
5725
6416
  }
5726
6417
  } // Remove the first object from the stack of traversed objects.
5727
6418
 
@@ -5732,9 +6423,18 @@ function eq(a, b, depth, aStack, bStack) {
5732
6423
  }
5733
6424
 
5734
6425
  function unwrap(a) {
5735
- if (isObservableArray(a)) return a.slice();
5736
- if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries());
5737
- if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries());
6426
+ if (isObservableArray(a)) {
6427
+ return a.slice();
6428
+ }
6429
+
6430
+ if (isES6Map(a) || isObservableMap(a)) {
6431
+ return Array.from(a.entries());
6432
+ }
6433
+
6434
+ if (isES6Set(a) || isObservableSet(a)) {
6435
+ return Array.from(a.entries());
6436
+ }
6437
+
5738
6438
  return a;
5739
6439
  }
5740
6440