mobx 6.3.13 → 6.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/CHANGELOG.md +22 -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/core/reaction.d.ts +2 -2
  6. package/dist/errors.d.ts +2 -2
  7. package/dist/mobx.cjs.development.js +941 -268
  8. package/dist/mobx.cjs.development.js.map +1 -1
  9. package/dist/mobx.cjs.production.min.js +1 -1
  10. package/dist/mobx.cjs.production.min.js.map +1 -1
  11. package/dist/mobx.esm.development.js +941 -268
  12. package/dist/mobx.esm.development.js.map +1 -1
  13. package/dist/mobx.esm.js +960 -275
  14. package/dist/mobx.esm.js.map +1 -1
  15. package/dist/mobx.esm.production.min.js +1 -1
  16. package/dist/mobx.esm.production.min.js.map +1 -1
  17. package/dist/mobx.umd.development.js +941 -268
  18. package/dist/mobx.umd.development.js.map +1 -1
  19. package/dist/mobx.umd.production.min.js +1 -1
  20. package/dist/mobx.umd.production.min.js.map +1 -1
  21. package/dist/types/observablemap.d.ts +2 -2
  22. package/dist/utils/utils.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/api/action.ts +8 -3
  25. package/src/api/annotation.ts +1 -2
  26. package/src/api/autorun.ts +22 -8
  27. package/src/api/computed.ts +5 -2
  28. package/src/api/configure.ts +6 -2
  29. package/src/api/extendobservable.ts +11 -5
  30. package/src/api/extras.ts +4 -2
  31. package/src/api/flow.ts +11 -4
  32. package/src/api/intercept-read.ts +4 -2
  33. package/src/api/intercept.ts +6 -3
  34. package/src/api/iscomputed.ts +10 -4
  35. package/src/api/isobservable.ts +10 -4
  36. package/src/api/makeObservable.ts +4 -2
  37. package/src/api/object-api.ts +30 -16
  38. package/src/api/observable.ts +23 -9
  39. package/src/api/observe.ts +5 -3
  40. package/src/api/tojs.ts +7 -3
  41. package/src/api/trace.ts +6 -2
  42. package/src/api/when.ts +12 -5
  43. package/src/core/action.ts +8 -3
  44. package/src/core/computedvalue.ts +29 -9
  45. package/src/core/derivation.ts +30 -10
  46. package/src/core/globalstate.ts +18 -7
  47. package/src/core/observable.ts +14 -5
  48. package/src/core/reaction.ts +16 -7
  49. package/src/core/spy.ts +20 -7
  50. package/src/errors.ts +2 -2
  51. package/src/types/actionannotation.ts +2 -2
  52. package/src/types/dynamicobject.ts +10 -4
  53. package/src/types/flowannotation.ts +3 -1
  54. package/src/types/intercept-utils.ts +9 -3
  55. package/src/types/legacyobservablearray.ts +5 -3
  56. package/src/types/listen-utils.ts +6 -2
  57. package/src/types/modifiers.ts +39 -14
  58. package/src/types/observablearray.ts +78 -30
  59. package/src/types/observablemap.ts +60 -24
  60. package/src/types/observableobject.ts +52 -18
  61. package/src/types/observableset.ts +29 -10
  62. package/src/types/observablevalue.ts +13 -5
  63. package/src/types/type-utils.ts +33 -11
  64. package/src/utils/comparer.ts +4 -4
  65. package/src/utils/eq.ts +45 -15
  66. 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
 
@@ -734,9 +807,11 @@ function make_$2(adm, key, descriptor, source) {
734
807
 
735
808
 
736
809
  if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
737
- if (this.extend_(adm, key, descriptor, false) === null) return 0
738
- /* Cancel */
739
- ;
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)) {
@@ -1027,17 +1102,35 @@ function createObservable(v, arg2, arg3) {
1027
1102
  } // already observable - ignore
1028
1103
 
1029
1104
 
1030
- if (isObservable(v)) return v; // plain object
1105
+ if (isObservable(v)) {
1106
+ return v;
1107
+ } // plain object
1108
+
1109
+
1110
+ if (isPlainObject(v)) {
1111
+ return observable.object(v, arg2, arg3);
1112
+ } // Array
1113
+
1114
+
1115
+ if (Array.isArray(v)) {
1116
+ return observable.array(v, arg2);
1117
+ } // Map
1118
+
1031
1119
 
1032
- if (isPlainObject(v)) return observable.object(v, arg2, arg3); // Array
1120
+ if (isES6Map(v)) {
1121
+ return observable.map(v, arg2);
1122
+ } // Set
1033
1123
 
1034
- if (Array.isArray(v)) return observable.array(v, arg2); // Map
1035
1124
 
1036
- if (isES6Map(v)) return observable.map(v, arg2); // Set
1125
+ if (isES6Set(v)) {
1126
+ return observable.set(v, arg2);
1127
+ } // other object - ignore
1037
1128
 
1038
- if (isES6Set(v)) return observable.set(v, arg2); // other object - ignore
1039
1129
 
1040
- if (typeof v === "object" && v !== null) return v; // anything else
1130
+ if (typeof v === "object" && v !== null) {
1131
+ return v;
1132
+ } // anything else
1133
+
1041
1134
 
1042
1135
  return observable.box(v, arg2);
1043
1136
  }
@@ -1095,8 +1188,13 @@ var computed = function computed(arg1, arg2) {
1095
1188
 
1096
1189
 
1097
1190
  if (process.env.NODE_ENV !== "production") {
1098
- if (!isFunction(arg1)) die("First argument to `computed` should be an expression.");
1099
- 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
+ }
1100
1198
  }
1101
1199
 
1102
1200
  var opts = isPlainObject(arg2) ? arg2 : {};
@@ -1128,8 +1226,13 @@ function createAction(actionName, fn, autoAction, ref) {
1128
1226
  }
1129
1227
 
1130
1228
  if (process.env.NODE_ENV !== "production") {
1131
- if (!isFunction(fn)) die("`action` can only be invoked on functions");
1132
- 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
+ }
1133
1236
  }
1134
1237
 
1135
1238
  function res() {
@@ -1211,7 +1314,10 @@ function _endAction(runInfo) {
1211
1314
  allowStateChangesEnd(runInfo.prevAllowStateChanges_);
1212
1315
  allowStateReadsEnd(runInfo.prevAllowStateReads_);
1213
1316
  endBatch();
1214
- if (runInfo.runAsAction_) untrackedEnd(runInfo.prevDerivation_);
1317
+
1318
+ if (runInfo.runAsAction_) {
1319
+ untrackedEnd(runInfo.prevDerivation_);
1320
+ }
1215
1321
 
1216
1322
  if (process.env.NODE_ENV !== "production" && runInfo.notifySpy_) {
1217
1323
  spyReportEnd({
@@ -1291,7 +1397,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1291
1397
  var _proto = ObservableValue.prototype;
1292
1398
 
1293
1399
  _proto.dehanceValue = function dehanceValue(value) {
1294
- if (this.dehancer !== undefined) return this.dehancer(value);
1400
+ if (this.dehancer !== undefined) {
1401
+ return this.dehancer(value);
1402
+ }
1403
+
1295
1404
  return value;
1296
1405
  };
1297
1406
 
@@ -1314,7 +1423,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1314
1423
  }
1315
1424
 
1316
1425
  this.setNewValue_(newValue);
1317
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
1426
+
1427
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
1428
+ spyReportEnd();
1429
+ }
1318
1430
  }
1319
1431
  };
1320
1432
 
@@ -1327,7 +1439,11 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1327
1439
  type: UPDATE,
1328
1440
  newValue: newValue
1329
1441
  });
1330
- if (!change) return globalState.UNCHANGED;
1442
+
1443
+ if (!change) {
1444
+ return globalState.UNCHANGED;
1445
+ }
1446
+
1331
1447
  newValue = change.newValue;
1332
1448
  } // apply modifier
1333
1449
 
@@ -1361,14 +1477,17 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1361
1477
  };
1362
1478
 
1363
1479
  _proto.observe_ = function observe_(listener, fireImmediately) {
1364
- if (fireImmediately) listener({
1365
- observableKind: "value",
1366
- debugObjectName: this.name_,
1367
- object: this,
1368
- type: UPDATE,
1369
- newValue: this.value_,
1370
- oldValue: undefined
1371
- });
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
+
1372
1491
  return registerListener(this, listener);
1373
1492
  };
1374
1493
 
@@ -1463,7 +1582,11 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1463
1582
  this.keepAlive_ = void 0;
1464
1583
  this.onBOL = void 0;
1465
1584
  this.onBUOL = void 0;
1466
- if (!options.get) die(31);
1585
+
1586
+ if (!options.get) {
1587
+ die(31);
1588
+ }
1589
+
1467
1590
  this.derivation = options.get;
1468
1591
  this.name_ = options.name || (process.env.NODE_ENV !== "production" ? "ComputedValue@" + getNextId() : "ComputedValue");
1469
1592
 
@@ -1505,7 +1628,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1505
1628
  ;
1506
1629
 
1507
1630
  _proto.get = function get() {
1508
- if (this.isComputing_) die(32, this.name_, this.derivation);
1631
+ if (this.isComputing_) {
1632
+ die(32, this.name_, this.derivation);
1633
+ }
1509
1634
 
1510
1635
  if (globalState.inBatch === 0 && // !globalState.trackingDerivatpion &&
1511
1636
  this.observers_.size === 0 && !this.keepAlive_) {
@@ -1521,20 +1646,34 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1521
1646
 
1522
1647
  if (shouldCompute(this)) {
1523
1648
  var prevTrackingContext = globalState.trackingContext;
1524
- if (this.keepAlive_ && !prevTrackingContext) globalState.trackingContext = this;
1525
- 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
+
1526
1658
  globalState.trackingContext = prevTrackingContext;
1527
1659
  }
1528
1660
  }
1529
1661
 
1530
1662
  var result = this.value_;
1531
- if (isCaughtException(result)) throw result.cause;
1663
+
1664
+ if (isCaughtException(result)) {
1665
+ throw result.cause;
1666
+ }
1667
+
1532
1668
  return result;
1533
1669
  };
1534
1670
 
1535
1671
  _proto.set = function set(value) {
1536
1672
  if (this.setter_) {
1537
- if (this.isRunningSetter_) die(33, this.name_);
1673
+ if (this.isRunningSetter_) {
1674
+ die(33, this.name_);
1675
+ }
1676
+
1538
1677
  this.isRunningSetter_ = true;
1539
1678
 
1540
1679
  try {
@@ -1542,7 +1681,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1542
1681
  } finally {
1543
1682
  this.isRunningSetter_ = false;
1544
1683
  }
1545
- } else die(34, this.name_);
1684
+ } else {
1685
+ die(34, this.name_);
1686
+ }
1546
1687
  };
1547
1688
 
1548
1689
  _proto.trackAndCompute = function trackAndCompute() {
@@ -1636,7 +1777,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1636
1777
  };
1637
1778
 
1638
1779
  _proto.warnAboutUntrackedRead_ = function warnAboutUntrackedRead_() {
1639
- if (!(process.env.NODE_ENV !== "production")) return;
1780
+ if (!(process.env.NODE_ENV !== "production")) {
1781
+ return;
1782
+ }
1640
1783
 
1641
1784
  if (this.isTracing_ !== TraceMode.NONE) {
1642
1785
  console.log("[mobx.trace] Computed value '" + this.name_ + "' is being read outside a reactive context. Doing a full recompute.");
@@ -1775,7 +1918,9 @@ function checkIfStateModificationsAreAllowed(atom) {
1775
1918
 
1776
1919
  var hasObservers = atom.observers_.size > 0; // Should not be possible to change observed state outside strict mode, except during initialization, see #563
1777
1920
 
1778
- 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
+ }
1779
1924
  }
1780
1925
  function checkIfStateReadsAreAllowed(observable) {
1781
1926
  if (process.env.NODE_ENV !== "production" && !globalState.allowStateReads && globalState.observableRequiresReaction) {
@@ -1820,10 +1965,15 @@ function trackDerivedFunction(derivation, f, context) {
1820
1965
  }
1821
1966
 
1822
1967
  function warnAboutDerivationWithoutDependencies(derivation) {
1823
- if (!(process.env.NODE_ENV !== "production")) return;
1824
- 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
+ }
1825
1975
 
1826
- if (globalState.reactionRequiresObservable || derivation.requiresObservable_) {
1976
+ if (typeof derivation.requiresObservable_ === "boolean" ? derivation.requiresObservable_ : globalState.reactionRequiresObservable) {
1827
1977
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
1828
1978
  }
1829
1979
  }
@@ -1850,7 +2000,11 @@ function bindDependencies(derivation) {
1850
2000
 
1851
2001
  if (dep.diffValue_ === 0) {
1852
2002
  dep.diffValue_ = 1;
1853
- if (i0 !== i) observing[i0] = dep;
2003
+
2004
+ if (i0 !== i) {
2005
+ observing[i0] = dep;
2006
+ }
2007
+
1854
2008
  i0++;
1855
2009
  } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
1856
2010
  // not hitting the condition
@@ -1942,7 +2096,10 @@ function allowStateReadsEnd(prev) {
1942
2096
  */
1943
2097
 
1944
2098
  function changeDependenciesStateTo0(derivation) {
1945
- if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) return;
2099
+ if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
2100
+ return;
2101
+ }
2102
+
1946
2103
  derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;
1947
2104
  var obs = derivation.observing_;
1948
2105
  var i = obs.length;
@@ -1986,8 +2143,14 @@ var canMergeGlobalState = true;
1986
2143
  var isolateCalled = false;
1987
2144
  var globalState = /*#__PURE__*/function () {
1988
2145
  var global = /*#__PURE__*/getGlobal();
1989
- if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;
1990
- 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
+ }
1991
2154
 
1992
2155
  if (!canMergeGlobalState) {
1993
2156
  // Because this is a IIFE we need to let isolateCalled a chance to change
@@ -2000,7 +2163,11 @@ var globalState = /*#__PURE__*/function () {
2000
2163
  return new MobXGlobals();
2001
2164
  } else if (global.__mobxGlobals) {
2002
2165
  global.__mobxInstanceCount += 1;
2003
- 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
+
2004
2171
 
2005
2172
  return global.__mobxGlobals;
2006
2173
  } else {
@@ -2009,12 +2176,19 @@ var globalState = /*#__PURE__*/function () {
2009
2176
  }
2010
2177
  }();
2011
2178
  function isolateGlobalState() {
2012
- if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) die(36);
2179
+ if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {
2180
+ die(36);
2181
+ }
2182
+
2013
2183
  isolateCalled = true;
2014
2184
 
2015
2185
  if (canMergeGlobalState) {
2016
2186
  var global = getGlobal();
2017
- if (--global.__mobxInstanceCount === 0) global.__mobxGlobals = undefined;
2187
+
2188
+ if (--global.__mobxInstanceCount === 0) {
2189
+ global.__mobxGlobals = undefined;
2190
+ }
2191
+
2018
2192
  globalState = new MobXGlobals();
2019
2193
  }
2020
2194
  }
@@ -2030,7 +2204,9 @@ function resetGlobalState() {
2030
2204
  var defaultGlobals = new MobXGlobals();
2031
2205
 
2032
2206
  for (var key in defaultGlobals) {
2033
- if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];
2207
+ if (persistentKeys.indexOf(key) === -1) {
2208
+ globalState[key] = defaultGlobals[key];
2209
+ }
2034
2210
  }
2035
2211
 
2036
2212
  globalState.allowStateChanges = !globalState.enforceActions;
@@ -2064,8 +2240,12 @@ function addObserver(observable, node) {
2064
2240
  // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
2065
2241
  // invariantObservers(observable);
2066
2242
  observable.observers_.add(node);
2067
- 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);
2068
2247
  // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
2248
+
2069
2249
  }
2070
2250
  function removeObserver(observable, node) {
2071
2251
  // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
@@ -2176,7 +2356,10 @@ function reportObserved(observable) {
2176
2356
 
2177
2357
  function propagateChanged(observable) {
2178
2358
  // invariantLOS(observable, "changed start");
2179
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2359
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2360
+ return;
2361
+ }
2362
+
2180
2363
  observable.lowestObserverState_ = IDerivationState_.STALE_; // Ideally we use for..of here, but the downcompiled version is really slow...
2181
2364
 
2182
2365
  observable.observers_.forEach(function (d) {
@@ -2194,7 +2377,10 @@ function propagateChanged(observable) {
2194
2377
 
2195
2378
  function propagateChangeConfirmed(observable) {
2196
2379
  // invariantLOS(observable, "confirmed start");
2197
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2380
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2381
+ return;
2382
+ }
2383
+
2198
2384
  observable.lowestObserverState_ = IDerivationState_.STALE_;
2199
2385
  observable.observers_.forEach(function (d) {
2200
2386
  if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {
@@ -2212,7 +2398,10 @@ function propagateChangeConfirmed(observable) {
2212
2398
 
2213
2399
  function propagateMaybeChanged(observable) {
2214
2400
  // invariantLOS(observable, "maybe start");
2215
- if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) return;
2401
+ if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {
2402
+ return;
2403
+ }
2404
+
2216
2405
  observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;
2217
2406
  observable.observers_.forEach(function (d) {
2218
2407
  if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -2240,9 +2429,12 @@ function printDepTree(tree, lines, depth) {
2240
2429
  }
2241
2430
 
2242
2431
  lines.push("" + "\t".repeat(depth - 1) + tree.name);
2243
- if (tree.dependencies) tree.dependencies.forEach(function (child) {
2244
- return printDepTree(child, lines, depth + 1);
2245
- });
2432
+
2433
+ if (tree.dependencies) {
2434
+ tree.dependencies.forEach(function (child) {
2435
+ return printDepTree(child, lines, depth + 1);
2436
+ });
2437
+ }
2246
2438
  }
2247
2439
 
2248
2440
  var Reaction = /*#__PURE__*/function () {
@@ -2252,10 +2444,6 @@ var Reaction = /*#__PURE__*/function () {
2252
2444
  name_ = process.env.NODE_ENV !== "production" ? "Reaction@" + getNextId() : "Reaction";
2253
2445
  }
2254
2446
 
2255
- if (requiresObservable_ === void 0) {
2256
- requiresObservable_ = false;
2257
- }
2258
-
2259
2447
  this.name_ = void 0;
2260
2448
  this.onInvalidate_ = void 0;
2261
2449
  this.errorHandler_ = void 0;
@@ -2360,7 +2548,9 @@ var Reaction = /*#__PURE__*/function () {
2360
2548
  clearObserving(this);
2361
2549
  }
2362
2550
 
2363
- if (isCaughtException(result)) this.reportExceptionInDerivation_(result.cause);
2551
+ if (isCaughtException(result)) {
2552
+ this.reportExceptionInDerivation_(result.cause);
2553
+ }
2364
2554
 
2365
2555
  if (process.env.NODE_ENV !== "production" && notify) {
2366
2556
  spyReportEnd({
@@ -2379,13 +2569,18 @@ var Reaction = /*#__PURE__*/function () {
2379
2569
  return;
2380
2570
  }
2381
2571
 
2382
- if (globalState.disableErrorBoundaries) throw error;
2572
+ if (globalState.disableErrorBoundaries) {
2573
+ throw error;
2574
+ }
2575
+
2383
2576
  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 + "'";
2384
2577
 
2385
2578
  if (!globalState.suppressReactionErrors) {
2386
2579
  console.error(message, error);
2387
2580
  /** If debugging brought you here, please, read the above message :-). Tnx! */
2388
- } else if (process.env.NODE_ENV !== "production") console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)"); // prettier-ignore
2581
+ } else if (process.env.NODE_ENV !== "production") {
2582
+ console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)");
2583
+ } // prettier-ignore
2389
2584
 
2390
2585
 
2391
2586
  if (process.env.NODE_ENV !== "production" && isSpyEnabled()) {
@@ -2439,7 +2634,10 @@ function onReactionError(handler) {
2439
2634
  globalState.globalReactionErrorHandlers.push(handler);
2440
2635
  return function () {
2441
2636
  var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
2442
- if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1);
2637
+
2638
+ if (idx >= 0) {
2639
+ globalState.globalReactionErrorHandlers.splice(idx, 1);
2640
+ }
2443
2641
  };
2444
2642
  }
2445
2643
  /**
@@ -2456,7 +2654,10 @@ var reactionScheduler = function reactionScheduler(f) {
2456
2654
 
2457
2655
  function runReactions() {
2458
2656
  // Trampolining, if runReactions are already running, new reactions will be picked up
2459
- if (globalState.inBatch > 0 || globalState.isRunningReactions) return;
2657
+ if (globalState.inBatch > 0 || globalState.isRunningReactions) {
2658
+ return;
2659
+ }
2660
+
2460
2661
  reactionScheduler(runReactionsHelper);
2461
2662
  }
2462
2663
 
@@ -2498,9 +2699,15 @@ function isSpyEnabled() {
2498
2699
  return process.env.NODE_ENV !== "production" && !!globalState.spyListeners.length;
2499
2700
  }
2500
2701
  function spyReport(event) {
2501
- if (!(process.env.NODE_ENV !== "production")) return; // dead code elimination can do the rest
2702
+ if (!(process.env.NODE_ENV !== "production")) {
2703
+ return;
2704
+ } // dead code elimination can do the rest
2705
+
2706
+
2707
+ if (!globalState.spyListeners.length) {
2708
+ return;
2709
+ }
2502
2710
 
2503
- if (!globalState.spyListeners.length) return;
2504
2711
  var listeners = globalState.spyListeners;
2505
2712
 
2506
2713
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -2508,7 +2715,9 @@ function spyReport(event) {
2508
2715
  }
2509
2716
  }
2510
2717
  function spyReportStart(event) {
2511
- if (!(process.env.NODE_ENV !== "production")) return;
2718
+ if (!(process.env.NODE_ENV !== "production")) {
2719
+ return;
2720
+ }
2512
2721
 
2513
2722
  var change = _extends({}, event, {
2514
2723
  spyReportStart: true
@@ -2521,11 +2730,18 @@ var END_EVENT = {
2521
2730
  spyReportEnd: true
2522
2731
  };
2523
2732
  function spyReportEnd(change) {
2524
- if (!(process.env.NODE_ENV !== "production")) return;
2525
- if (change) spyReport(_extends({}, change, {
2526
- type: "report-end",
2527
- spyReportEnd: true
2528
- }));else spyReport(END_EVENT);
2733
+ if (!(process.env.NODE_ENV !== "production")) {
2734
+ return;
2735
+ }
2736
+
2737
+ if (change) {
2738
+ spyReport(_extends({}, change, {
2739
+ type: "report-end",
2740
+ spyReportEnd: true
2741
+ }));
2742
+ } else {
2743
+ spyReport(END_EVENT);
2744
+ }
2529
2745
  }
2530
2746
  function spy(listener) {
2531
2747
  if (!(process.env.NODE_ENV !== "production")) {
@@ -2561,9 +2777,15 @@ var autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_B
2561
2777
  function createActionFactory(autoAction) {
2562
2778
  var res = function action(arg1, arg2) {
2563
2779
  // action(fn() {})
2564
- if (isFunction(arg1)) return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction); // action("name", fn() {})
2780
+ if (isFunction(arg1)) {
2781
+ return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
2782
+ } // action("name", fn() {})
2783
+
2784
+
2785
+ if (isFunction(arg2)) {
2786
+ return createAction(arg1, arg2, autoAction);
2787
+ } // @action
2565
2788
 
2566
- if (isFunction(arg2)) return createAction(arg1, arg2, autoAction); // @action
2567
2789
 
2568
2790
  if (isStringish(arg2)) {
2569
2791
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2577,7 +2799,9 @@ function createActionFactory(autoAction) {
2577
2799
  }));
2578
2800
  }
2579
2801
 
2580
- if (process.env.NODE_ENV !== "production") die("Invalid arguments for `action`");
2802
+ if (process.env.NODE_ENV !== "production") {
2803
+ die("Invalid arguments for `action`");
2804
+ }
2581
2805
  };
2582
2806
 
2583
2807
  return res;
@@ -2611,8 +2835,13 @@ function autorun(view, opts) {
2611
2835
  }
2612
2836
 
2613
2837
  if (process.env.NODE_ENV !== "production") {
2614
- if (!isFunction(view)) die("Autorun expects a function as first argument");
2615
- if (isAction(view)) die("Autorun does not accept actions since actions are untrackable");
2838
+ if (!isFunction(view)) {
2839
+ die("Autorun expects a function as first argument");
2840
+ }
2841
+
2842
+ if (isAction(view)) {
2843
+ die("Autorun does not accept actions since actions are untrackable");
2844
+ }
2616
2845
  }
2617
2846
 
2618
2847
  var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : process.env.NODE_ENV !== "production" ? view.name || "Autorun@" + getNextId() : "Autorun";
@@ -2633,7 +2862,10 @@ function autorun(view, opts) {
2633
2862
  isScheduled = true;
2634
2863
  scheduler(function () {
2635
2864
  isScheduled = false;
2636
- if (!reaction.isDisposed_) reaction.track(reactionRunner);
2865
+
2866
+ if (!reaction.isDisposed_) {
2867
+ reaction.track(reactionRunner);
2868
+ }
2637
2869
  });
2638
2870
  }
2639
2871
  }, opts.onError, opts.requiresObservable);
@@ -2665,8 +2897,13 @@ function reaction(expression, effect, opts) {
2665
2897
  }
2666
2898
 
2667
2899
  if (process.env.NODE_ENV !== "production") {
2668
- if (!isFunction(expression) || !isFunction(effect)) die("First and second argument to reaction should be functions");
2669
- if (!isPlainObject(opts)) die("Third argument of reactions should be an object");
2900
+ if (!isFunction(expression) || !isFunction(effect)) {
2901
+ die("First and second argument to reaction should be functions");
2902
+ }
2903
+
2904
+ if (!isPlainObject(opts)) {
2905
+ die("Third argument of reactions should be an object");
2906
+ }
2670
2907
  }
2671
2908
 
2672
2909
  var name = (_opts$name2 = opts.name) != null ? _opts$name2 : process.env.NODE_ENV !== "production" ? "Reaction@" + getNextId() : "Reaction";
@@ -2689,7 +2926,11 @@ function reaction(expression, effect, opts) {
2689
2926
 
2690
2927
  function reactionRunner() {
2691
2928
  isScheduled = false;
2692
- if (r.isDisposed_) return;
2929
+
2930
+ if (r.isDisposed_) {
2931
+ return;
2932
+ }
2933
+
2693
2934
  var changed = false;
2694
2935
  r.track(function () {
2695
2936
  var nextValue = allowStateChanges(false, function () {
@@ -2699,7 +2940,13 @@ function reaction(expression, effect, opts) {
2699
2940
  oldValue = value;
2700
2941
  value = nextValue;
2701
2942
  });
2702
- if (firstTime && opts.fireImmediately) effectAction(value, oldValue, r);else if (!firstTime && changed) effectAction(value, oldValue, r);
2943
+
2944
+ if (firstTime && opts.fireImmediately) {
2945
+ effectAction(value, oldValue, r);
2946
+ } else if (!firstTime && changed) {
2947
+ effectAction(value, oldValue, r);
2948
+ }
2949
+
2703
2950
  firstTime = false;
2704
2951
  }
2705
2952
 
@@ -2766,7 +3013,9 @@ function configure(options) {
2766
3013
  globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== "undefined";
2767
3014
  }
2768
3015
 
2769
- if (useProxies === "ifavailable") globalState.verifyProxies = true;
3016
+ if (useProxies === "ifavailable") {
3017
+ globalState.verifyProxies = true;
3018
+ }
2770
3019
 
2771
3020
  if (enforceActions !== undefined) {
2772
3021
  var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;
@@ -2774,7 +3023,9 @@ function configure(options) {
2774
3023
  globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;
2775
3024
  }
2776
3025
  ["computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "disableErrorBoundaries", "safeDescriptors"].forEach(function (key) {
2777
- if (key in options) globalState[key] = !!options[key];
3026
+ if (key in options) {
3027
+ globalState[key] = !!options[key];
3028
+ }
2778
3029
  });
2779
3030
  globalState.allowStateReads = !globalState.observableRequiresReaction;
2780
3031
 
@@ -2789,11 +3040,25 @@ function configure(options) {
2789
3040
 
2790
3041
  function extendObservable(target, properties, annotations, options) {
2791
3042
  if (process.env.NODE_ENV !== "production") {
2792
- if (arguments.length > 4) die("'extendObservable' expected 2-4 arguments");
2793
- if (typeof target !== "object") die("'extendObservable' expects an object as first argument");
2794
- if (isObservableMap(target)) die("'extendObservable' should not be used on maps, use map.merge instead");
2795
- if (!isPlainObject(properties)) die("'extendObservable' only accepts plain objects as second argument");
2796
- if (isObservable(properties) || isObservable(annotations)) die("Extending an object with another observable (object) is not supported");
3043
+ if (arguments.length > 4) {
3044
+ die("'extendObservable' expected 2-4 arguments");
3045
+ }
3046
+
3047
+ if (typeof target !== "object") {
3048
+ die("'extendObservable' expects an object as first argument");
3049
+ }
3050
+
3051
+ if (isObservableMap(target)) {
3052
+ die("'extendObservable' should not be used on maps, use map.merge instead");
3053
+ }
3054
+
3055
+ if (!isPlainObject(properties)) {
3056
+ die("'extendObservable' only accepts plain objects as second argument");
3057
+ }
3058
+
3059
+ if (isObservable(properties) || isObservable(annotations)) {
3060
+ die("Extending an object with another observable (object) is not supported");
3061
+ }
2797
3062
  } // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)
2798
3063
 
2799
3064
 
@@ -2821,7 +3086,11 @@ function nodeToDependencyTree(node) {
2821
3086
  var result = {
2822
3087
  name: node.name_
2823
3088
  };
2824
- if (node.observing_ && node.observing_.length > 0) result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3089
+
3090
+ if (node.observing_ && node.observing_.length > 0) {
3091
+ result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3092
+ }
3093
+
2825
3094
  return result;
2826
3095
  }
2827
3096
 
@@ -2833,7 +3102,11 @@ function nodeToObserverTree(node) {
2833
3102
  var result = {
2834
3103
  name: node.name_
2835
3104
  };
2836
- if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3105
+
3106
+ if (hasObservers(node)) {
3107
+ result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3108
+ }
3109
+
2837
3110
  return result;
2838
3111
  }
2839
3112
 
@@ -2860,7 +3133,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2860
3133
  } // flow(fn)
2861
3134
 
2862
3135
 
2863
- if (process.env.NODE_ENV !== "production" && arguments.length !== 1) die("Flow expects single argument with generator function");
3136
+ if (process.env.NODE_ENV !== "production" && arguments.length !== 1) {
3137
+ die("Flow expects single argument with generator function");
3138
+ }
3139
+
2864
3140
  var generator = arg1;
2865
3141
  var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js
2866
3142
 
@@ -2908,7 +3184,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2908
3184
  return;
2909
3185
  }
2910
3186
 
2911
- if (ret.done) return resolve(ret.value);
3187
+ if (ret.done) {
3188
+ return resolve(ret.value);
3189
+ }
3190
+
2912
3191
  pendingPromise = Promise.resolve(ret.value);
2913
3192
  return pendingPromise.then(onFulfilled, onRejected);
2914
3193
  }
@@ -2917,7 +3196,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2917
3196
  });
2918
3197
  promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
2919
3198
  try {
2920
- if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..
3199
+ if (pendingPromise) {
3200
+ cancelPromise(pendingPromise);
3201
+ } // Finally block can return (or yield) stuff..
3202
+
2921
3203
 
2922
3204
  var _res = gen["return"](undefined); // eat anything that promise would do, it's cancelled!
2923
3205
 
@@ -2941,7 +3223,9 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2941
3223
  flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
2942
3224
 
2943
3225
  function cancelPromise(promise) {
2944
- if (isFunction(promise.cancel)) promise.cancel();
3226
+ if (isFunction(promise.cancel)) {
3227
+ promise.cancel();
3228
+ }
2945
3229
  }
2946
3230
 
2947
3231
  function flowResult(result) {
@@ -2957,13 +3241,19 @@ function interceptReads(thing, propOrHandler, handler) {
2957
3241
  if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
2958
3242
  target = getAdministration(thing);
2959
3243
  } else if (isObservableObject(thing)) {
2960
- 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");
3244
+ if (process.env.NODE_ENV !== "production" && !isStringish(propOrHandler)) {
3245
+ return die("InterceptReads can only be used with a specific property, not with an object in general");
3246
+ }
3247
+
2961
3248
  target = getAdministration(thing, propOrHandler);
2962
3249
  } else if (process.env.NODE_ENV !== "production") {
2963
3250
  return die("Expected observable map, object or array as first array");
2964
3251
  }
2965
3252
 
2966
- if (process.env.NODE_ENV !== "production" && target.dehancer !== undefined) return die("An intercept reader was already established");
3253
+ if (process.env.NODE_ENV !== "production" && target.dehancer !== undefined) {
3254
+ return die("An intercept reader was already established");
3255
+ }
3256
+
2967
3257
  target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
2968
3258
  return function () {
2969
3259
  target.dehancer = undefined;
@@ -2971,7 +3261,11 @@ function interceptReads(thing, propOrHandler, handler) {
2971
3261
  }
2972
3262
 
2973
3263
  function intercept(thing, propOrHandler, handler) {
2974
- if (isFunction(handler)) return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);
3264
+ if (isFunction(handler)) {
3265
+ return interceptProperty(thing, propOrHandler, handler);
3266
+ } else {
3267
+ return interceptInterceptable(thing, propOrHandler);
3268
+ }
2975
3269
  }
2976
3270
 
2977
3271
  function interceptInterceptable(thing, handler) {
@@ -2987,25 +3281,41 @@ function _isComputed(value, property) {
2987
3281
  return isComputedValue(value);
2988
3282
  }
2989
3283
 
2990
- if (isObservableObject(value) === false) return false;
2991
- if (!value[$mobx].values_.has(property)) return false;
3284
+ if (isObservableObject(value) === false) {
3285
+ return false;
3286
+ }
3287
+
3288
+ if (!value[$mobx].values_.has(property)) {
3289
+ return false;
3290
+ }
3291
+
2992
3292
  var atom = getAtom(value, property);
2993
3293
  return isComputedValue(atom);
2994
3294
  }
2995
3295
  function isComputed(value) {
2996
- 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");
3296
+ if (process.env.NODE_ENV !== "production" && arguments.length > 1) {
3297
+ return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3298
+ }
3299
+
2997
3300
  return _isComputed(value);
2998
3301
  }
2999
3302
  function isComputedProp(value, propName) {
3000
- if (process.env.NODE_ENV !== "production" && !isStringish(propName)) return die("isComputed expected a property name as second argument");
3303
+ if (process.env.NODE_ENV !== "production" && !isStringish(propName)) {
3304
+ return die("isComputed expected a property name as second argument");
3305
+ }
3306
+
3001
3307
  return _isComputed(value, propName);
3002
3308
  }
3003
3309
 
3004
3310
  function _isObservable(value, property) {
3005
- if (!value) return false;
3006
-
3311
+ if (!value) {
3312
+ return false;
3313
+ }
3314
+
3007
3315
  if (property !== undefined) {
3008
- 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.");
3316
+ if (process.env.NODE_ENV !== "production" && (isObservableMap(value) || isObservableArray(value))) {
3317
+ return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3318
+ }
3009
3319
 
3010
3320
  if (isObservableObject(value)) {
3011
3321
  return value[$mobx].values_.has(property);
@@ -3019,11 +3329,17 @@ function _isObservable(value, property) {
3019
3329
  }
3020
3330
 
3021
3331
  function isObservable(value) {
3022
- if (process.env.NODE_ENV !== "production" && arguments.length !== 1) die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3332
+ if (process.env.NODE_ENV !== "production" && arguments.length !== 1) {
3333
+ die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3334
+ }
3335
+
3023
3336
  return _isObservable(value);
3024
3337
  }
3025
3338
  function isObservableProp(value, propName) {
3026
- if (process.env.NODE_ENV !== "production" && !isStringish(propName)) return die("expected a property name as second argument");
3339
+ if (process.env.NODE_ENV !== "production" && !isStringish(propName)) {
3340
+ return die("expected a property name as second argument");
3341
+ }
3342
+
3027
3343
  return _isObservable(value, propName);
3028
3344
  }
3029
3345
 
@@ -3115,13 +3431,25 @@ function set(obj, key, value) {
3115
3431
  } else if (isObservableSet(obj)) {
3116
3432
  obj.add(key);
3117
3433
  } else if (isObservableArray(obj)) {
3118
- if (typeof key !== "number") key = parseInt(key, 10);
3119
- if (key < 0) die("Invalid index: '" + key + "'");
3434
+ if (typeof key !== "number") {
3435
+ key = parseInt(key, 10);
3436
+ }
3437
+
3438
+ if (key < 0) {
3439
+ die("Invalid index: '" + key + "'");
3440
+ }
3441
+
3120
3442
  startBatch();
3121
- if (key >= obj.length) obj.length = key + 1;
3443
+
3444
+ if (key >= obj.length) {
3445
+ obj.length = key + 1;
3446
+ }
3447
+
3122
3448
  obj[key] = value;
3123
3449
  endBatch();
3124
- } else die(8);
3450
+ } else {
3451
+ die(8);
3452
+ }
3125
3453
  }
3126
3454
  function remove(obj, key) {
3127
3455
  if (isObservableObject(obj)) {
@@ -3131,7 +3459,10 @@ function remove(obj, key) {
3131
3459
  } else if (isObservableSet(obj)) {
3132
3460
  obj["delete"](key);
3133
3461
  } else if (isObservableArray(obj)) {
3134
- if (typeof key !== "number") key = parseInt(key, 10);
3462
+ if (typeof key !== "number") {
3463
+ key = parseInt(key, 10);
3464
+ }
3465
+
3135
3466
  obj.splice(key, 1);
3136
3467
  } else {
3137
3468
  die(9);
@@ -3151,7 +3482,9 @@ function has(obj, key) {
3151
3482
  die(10);
3152
3483
  }
3153
3484
  function get(obj, key) {
3154
- if (!has(obj, key)) return undefined;
3485
+ if (!has(obj, key)) {
3486
+ return undefined;
3487
+ }
3155
3488
 
3156
3489
  if (isObservableObject(obj)) {
3157
3490
  return obj[$mobx].get_(key);
@@ -3179,7 +3512,11 @@ function apiOwnKeys(obj) {
3179
3512
  }
3180
3513
 
3181
3514
  function observe(thing, propOrCb, cbOrFire, fireImmediately) {
3182
- if (isFunction(cbOrFire)) return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);
3515
+ if (isFunction(cbOrFire)) {
3516
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
3517
+ } else {
3518
+ return observeObservable(thing, propOrCb, cbOrFire);
3519
+ }
3183
3520
  }
3184
3521
 
3185
3522
  function observeObservable(thing, listener, fireImmediately) {
@@ -3196,8 +3533,13 @@ function cache(map, key, value) {
3196
3533
  }
3197
3534
 
3198
3535
  function toJSHelper(source, __alreadySeen) {
3199
- if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) return source;
3200
- if (isObservableValue(source) || isComputedValue(source)) return toJSHelper(source.get(), __alreadySeen);
3536
+ if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) {
3537
+ return source;
3538
+ }
3539
+
3540
+ if (isObservableValue(source) || isComputedValue(source)) {
3541
+ return toJSHelper(source.get(), __alreadySeen);
3542
+ }
3201
3543
 
3202
3544
  if (__alreadySeen.has(source)) {
3203
3545
  return __alreadySeen.get(source);
@@ -3248,19 +3590,28 @@ function toJSHelper(source, __alreadySeen) {
3248
3590
 
3249
3591
 
3250
3592
  function toJS(source, options) {
3251
- if (process.env.NODE_ENV !== "production" && options) die("toJS no longer supports options");
3593
+ if (process.env.NODE_ENV !== "production" && options) {
3594
+ die("toJS no longer supports options");
3595
+ }
3596
+
3252
3597
  return toJSHelper(source, new Map());
3253
3598
  }
3254
3599
 
3255
3600
  function trace() {
3256
- if (!(process.env.NODE_ENV !== "production")) die("trace() is not available in production builds");
3601
+ if (!(process.env.NODE_ENV !== "production")) {
3602
+ die("trace() is not available in production builds");
3603
+ }
3604
+
3257
3605
  var enterBreakPoint = false;
3258
3606
 
3259
3607
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3260
3608
  args[_key] = arguments[_key];
3261
3609
  }
3262
3610
 
3263
- if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop();
3611
+ if (typeof args[args.length - 1] === "boolean") {
3612
+ enterBreakPoint = args.pop();
3613
+ }
3614
+
3264
3615
  var derivation = getAtomFromArgs(args);
3265
3616
 
3266
3617
  if (!derivation) {
@@ -3310,7 +3661,10 @@ function transaction(action, thisArg) {
3310
3661
  }
3311
3662
 
3312
3663
  function when(predicate, arg1, arg2) {
3313
- if (arguments.length === 1 || arg1 && typeof arg1 === "object") return whenPromise(predicate, arg1);
3664
+ if (arguments.length === 1 || arg1 && typeof arg1 === "object") {
3665
+ return whenPromise(predicate, arg1);
3666
+ }
3667
+
3314
3668
  return _when(predicate, arg1, arg2 || {});
3315
3669
  }
3316
3670
 
@@ -3322,7 +3676,12 @@ function _when(predicate, effect, opts) {
3322
3676
  timeoutHandle = setTimeout(function () {
3323
3677
  if (!disposer[$mobx].isDisposed_) {
3324
3678
  disposer();
3325
- if (opts.onError) opts.onError(error);else throw error;
3679
+
3680
+ if (opts.onError) {
3681
+ opts.onError(error);
3682
+ } else {
3683
+ throw error;
3684
+ }
3326
3685
  }
3327
3686
  }, opts.timeout);
3328
3687
  }
@@ -3336,7 +3695,11 @@ function _when(predicate, effect, opts) {
3336
3695
 
3337
3696
  if (cond) {
3338
3697
  r.dispose();
3339
- if (timeoutHandle) clearTimeout(timeoutHandle);
3698
+
3699
+ if (timeoutHandle) {
3700
+ clearTimeout(timeoutHandle);
3701
+ }
3702
+
3340
3703
  effectAction();
3341
3704
  }
3342
3705
  }, opts);
@@ -3344,7 +3707,10 @@ function _when(predicate, effect, opts) {
3344
3707
  }
3345
3708
 
3346
3709
  function whenPromise(predicate, opts) {
3347
- if (process.env.NODE_ENV !== "production" && opts && opts.onError) return die("the options 'onError' and 'promise' cannot be combined");
3710
+ if (process.env.NODE_ENV !== "production" && opts && opts.onError) {
3711
+ return die("the options 'onError' and 'promise' cannot be combined");
3712
+ }
3713
+
3348
3714
  var cancel;
3349
3715
  var res = new Promise(function (resolve, reject) {
3350
3716
  var disposer = _when(predicate, resolve, _extends({}, opts, {
@@ -3368,7 +3734,10 @@ function getAdm(target) {
3368
3734
 
3369
3735
  var objectProxyTraps = {
3370
3736
  has: function has(target, name) {
3371
- if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3737
+ if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) {
3738
+ warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3739
+ }
3740
+
3372
3741
  return getAdm(target).has_(name);
3373
3742
  },
3374
3743
  get: function get(target, name) {
@@ -3377,7 +3746,9 @@ var objectProxyTraps = {
3377
3746
  set: function set(target, name, value) {
3378
3747
  var _getAdm$set_;
3379
3748
 
3380
- if (!isStringish(name)) return false;
3749
+ if (!isStringish(name)) {
3750
+ return false;
3751
+ }
3381
3752
 
3382
3753
  if (process.env.NODE_ENV !== "production" && !getAdm(target).values_.has(name)) {
3383
3754
  warnAboutProxyRequirement("add a new observable property through direct assignment. Use 'set' from 'mobx' instead.");
@@ -3393,7 +3764,10 @@ var objectProxyTraps = {
3393
3764
  warnAboutProxyRequirement("delete properties from an observable object. Use 'remove' from 'mobx' instead.");
3394
3765
  }
3395
3766
 
3396
- if (!isStringish(name)) return false; // null (intercepted) -> true (success)
3767
+ if (!isStringish(name)) {
3768
+ return false;
3769
+ } // null (intercepted) -> true (success)
3770
+
3397
3771
 
3398
3772
  return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;
3399
3773
  },
@@ -3408,7 +3782,10 @@ var objectProxyTraps = {
3408
3782
  return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;
3409
3783
  },
3410
3784
  ownKeys: function ownKeys(target) {
3411
- if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3785
+ if (process.env.NODE_ENV !== "production" && globalState.trackingDerivation) {
3786
+ warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3787
+ }
3788
+
3412
3789
  return getAdm(target).ownKeys_();
3413
3790
  },
3414
3791
  preventExtensions: function preventExtensions(target) {
@@ -3431,7 +3808,10 @@ function registerInterceptor(interceptable, handler) {
3431
3808
  interceptors.push(handler);
3432
3809
  return once(function () {
3433
3810
  var idx = interceptors.indexOf(handler);
3434
- if (idx !== -1) interceptors.splice(idx, 1);
3811
+
3812
+ if (idx !== -1) {
3813
+ interceptors.splice(idx, 1);
3814
+ }
3435
3815
  });
3436
3816
  }
3437
3817
  function interceptChange(interceptable, change) {
@@ -3443,8 +3823,14 @@ function interceptChange(interceptable, change) {
3443
3823
 
3444
3824
  for (var i = 0, l = interceptors.length; i < l; i++) {
3445
3825
  change = interceptors[i](change);
3446
- if (change && !change.type) die(14);
3447
- if (!change) break;
3826
+
3827
+ if (change && !change.type) {
3828
+ die(14);
3829
+ }
3830
+
3831
+ if (!change) {
3832
+ break;
3833
+ }
3448
3834
  }
3449
3835
 
3450
3836
  return change;
@@ -3461,13 +3847,20 @@ function registerListener(listenable, handler) {
3461
3847
  listeners.push(handler);
3462
3848
  return once(function () {
3463
3849
  var idx = listeners.indexOf(handler);
3464
- if (idx !== -1) listeners.splice(idx, 1);
3850
+
3851
+ if (idx !== -1) {
3852
+ listeners.splice(idx, 1);
3853
+ }
3465
3854
  });
3466
3855
  }
3467
3856
  function notifyListeners(listenable, change) {
3468
3857
  var prevU = untrackedStart();
3469
3858
  var listeners = listenable.changeListeners_;
3470
- if (!listeners) return;
3859
+
3860
+ if (!listeners) {
3861
+ return;
3862
+ }
3863
+
3471
3864
  listeners = listeners.slice();
3472
3865
 
3473
3866
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -3504,8 +3897,13 @@ function makeObservable(target, annotations, options) {
3504
3897
  var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
3505
3898
  function makeAutoObservable(target, overrides, options) {
3506
3899
  if (process.env.NODE_ENV !== "production") {
3507
- if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3508
- if (isObservableObject(target)) die("makeAutoObservable can only be used on objects not already made observable");
3900
+ if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {
3901
+ die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3902
+ }
3903
+
3904
+ if (isObservableObject(target)) {
3905
+ die("makeAutoObservable can only be used on objects not already made observable");
3906
+ }
3509
3907
  } // Optimization: avoid visiting protos
3510
3908
  // Assumes that annotation.make_/.extend_ works the same for plain objects
3511
3909
 
@@ -3546,8 +3944,14 @@ var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/8
3546
3944
  var arrayTraps = {
3547
3945
  get: function get(target, name) {
3548
3946
  var adm = target[$mobx];
3549
- if (name === $mobx) return adm;
3550
- if (name === "length") return adm.getArrayLength_();
3947
+
3948
+ if (name === $mobx) {
3949
+ return adm;
3950
+ }
3951
+
3952
+ if (name === "length") {
3953
+ return adm.getArrayLength_();
3954
+ }
3551
3955
 
3552
3956
  if (typeof name === "string" && !isNaN(name)) {
3553
3957
  return adm.get_(parseInt(name));
@@ -3608,12 +4012,18 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3608
4012
  var _proto = ObservableArrayAdministration.prototype;
3609
4013
 
3610
4014
  _proto.dehanceValue_ = function dehanceValue_(value) {
3611
- if (this.dehancer !== undefined) return this.dehancer(value);
4015
+ if (this.dehancer !== undefined) {
4016
+ return this.dehancer(value);
4017
+ }
4018
+
3612
4019
  return value;
3613
4020
  };
3614
4021
 
3615
4022
  _proto.dehanceValues_ = function dehanceValues_(values) {
3616
- if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer);
4023
+ if (this.dehancer !== undefined && values.length > 0) {
4024
+ return values.map(this.dehancer);
4025
+ }
4026
+
3617
4027
  return values;
3618
4028
  };
3619
4029
 
@@ -3649,9 +4059,15 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3649
4059
  };
3650
4060
 
3651
4061
  _proto.setArrayLength_ = function setArrayLength_(newLength) {
3652
- if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) die("Out of range: " + newLength);
4062
+ if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) {
4063
+ die("Out of range: " + newLength);
4064
+ }
4065
+
3653
4066
  var currentLength = this.values_.length;
3654
- if (newLength === currentLength) return;else if (newLength > currentLength) {
4067
+
4068
+ if (newLength === currentLength) {
4069
+ return;
4070
+ } else if (newLength > currentLength) {
3655
4071
  var newItems = new Array(newLength - currentLength);
3656
4072
 
3657
4073
  for (var i = 0; i < newLength - currentLength; i++) {
@@ -3660,13 +4076,21 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3660
4076
 
3661
4077
 
3662
4078
  this.spliceWithArray_(currentLength, 0, newItems);
3663
- } else this.spliceWithArray_(newLength, currentLength - newLength);
4079
+ } else {
4080
+ this.spliceWithArray_(newLength, currentLength - newLength);
4081
+ }
3664
4082
  };
3665
4083
 
3666
4084
  _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {
3667
- if (oldLength !== this.lastKnownLength_) die(16);
4085
+ if (oldLength !== this.lastKnownLength_) {
4086
+ die(16);
4087
+ }
4088
+
3668
4089
  this.lastKnownLength_ += delta;
3669
- if (this.legacyMode_ && delta > 0) reserveArrayBuffer(oldLength + delta + 1);
4090
+
4091
+ if (this.legacyMode_ && delta > 0) {
4092
+ reserveArrayBuffer(oldLength + delta + 1);
4093
+ }
3670
4094
  };
3671
4095
 
3672
4096
  _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {
@@ -3674,9 +4098,26 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3674
4098
 
3675
4099
  checkIfStateModificationsAreAllowed(this.atom_);
3676
4100
  var length = this.values_.length;
3677
- if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);
3678
- 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));
3679
- if (newItems === undefined) newItems = EMPTY_ARRAY;
4101
+
4102
+ if (index === undefined) {
4103
+ index = 0;
4104
+ } else if (index > length) {
4105
+ index = length;
4106
+ } else if (index < 0) {
4107
+ index = Math.max(0, length + index);
4108
+ }
4109
+
4110
+ if (arguments.length === 1) {
4111
+ deleteCount = length - index;
4112
+ } else if (deleteCount === undefined || deleteCount === null) {
4113
+ deleteCount = 0;
4114
+ } else {
4115
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
4116
+ }
4117
+
4118
+ if (newItems === undefined) {
4119
+ newItems = EMPTY_ARRAY;
4120
+ }
3680
4121
 
3681
4122
  if (hasInterceptors(this)) {
3682
4123
  var change = interceptChange(this, {
@@ -3686,7 +4127,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3686
4127
  removedCount: deleteCount,
3687
4128
  added: newItems
3688
4129
  });
3689
- if (!change) return EMPTY_ARRAY;
4130
+
4131
+ if (!change) {
4132
+ return EMPTY_ARRAY;
4133
+ }
4134
+
3690
4135
  deleteCount = change.removedCount;
3691
4136
  newItems = change.added;
3692
4137
  }
@@ -3701,7 +4146,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3701
4146
  }
3702
4147
 
3703
4148
  var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
3704
- if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice_(index, newItems, res);
4149
+
4150
+ if (deleteCount !== 0 || newItems.length !== 0) {
4151
+ this.notifyArraySplice_(index, newItems, res);
4152
+ }
4153
+
3705
4154
  return this.dehanceValues_(res);
3706
4155
  };
3707
4156
 
@@ -3744,10 +4193,19 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3744
4193
  } : 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
3745
4194
  // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
3746
4195
 
3747
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
4196
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4197
+ spyReportStart(change);
4198
+ }
4199
+
3748
4200
  this.atom_.reportChanged();
3749
- if (notify) notifyListeners(this, change);
3750
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4201
+
4202
+ if (notify) {
4203
+ notifyListeners(this, change);
4204
+ }
4205
+
4206
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4207
+ spyReportEnd();
4208
+ }
3751
4209
  };
3752
4210
 
3753
4211
  _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {
@@ -3764,11 +4222,20 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3764
4222
  removedCount: removed.length,
3765
4223
  addedCount: added.length
3766
4224
  } : null;
3767
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
4225
+
4226
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4227
+ spyReportStart(change);
4228
+ }
4229
+
3768
4230
  this.atom_.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
3769
4231
 
3770
- if (notify) notifyListeners(this, change);
3771
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4232
+ if (notify) {
4233
+ notifyListeners(this, change);
4234
+ }
4235
+
4236
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4237
+ spyReportEnd();
4238
+ }
3772
4239
  };
3773
4240
 
3774
4241
  _proto.get_ = function get_(index) {
@@ -3795,7 +4262,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3795
4262
  index: index,
3796
4263
  newValue: newValue
3797
4264
  });
3798
- if (!change) return;
4265
+
4266
+ if (!change) {
4267
+ return;
4268
+ }
4269
+
3799
4270
  newValue = change.newValue;
3800
4271
  }
3801
4272
 
@@ -4079,7 +4550,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4079
4550
  _proto.has = function has(key) {
4080
4551
  var _this2 = this;
4081
4552
 
4082
- if (!globalState.trackingDerivation) return this.has_(key);
4553
+ if (!globalState.trackingDerivation) {
4554
+ return this.has_(key);
4555
+ }
4556
+
4083
4557
  var entry = this.hasMap_.get(key);
4084
4558
 
4085
4559
  if (!entry) {
@@ -4103,7 +4577,11 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4103
4577
  newValue: value,
4104
4578
  name: key
4105
4579
  });
4106
- if (!change) return this;
4580
+
4581
+ if (!change) {
4582
+ return this;
4583
+ }
4584
+
4107
4585
  value = change.newValue;
4108
4586
  }
4109
4587
 
@@ -4127,7 +4605,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4127
4605
  object: this,
4128
4606
  name: key
4129
4607
  });
4130
- if (!change) return false;
4608
+
4609
+ if (!change) {
4610
+ return false;
4611
+ }
4131
4612
  }
4132
4613
 
4133
4614
  if (this.has_(key)) {
@@ -4143,7 +4624,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4143
4624
  name: key
4144
4625
  } : null;
4145
4626
 
4146
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change); // TODO fix type
4627
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4628
+ spyReportStart(_change);
4629
+ } // TODO fix type
4630
+
4147
4631
 
4148
4632
  transaction(function () {
4149
4633
  var _this3$hasMap_$get;
@@ -4158,8 +4642,15 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4158
4642
 
4159
4643
  _this3.data_["delete"](key);
4160
4644
  });
4161
- if (notify) notifyListeners(this, _change);
4162
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4645
+
4646
+ if (notify) {
4647
+ notifyListeners(this, _change);
4648
+ }
4649
+
4650
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4651
+ spyReportEnd();
4652
+ }
4653
+
4163
4654
  return true;
4164
4655
  }
4165
4656
 
@@ -4182,11 +4673,21 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4182
4673
  name: key,
4183
4674
  newValue: newValue
4184
4675
  } : null;
4185
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change); // TODO fix type
4676
+
4677
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4678
+ spyReportStart(change);
4679
+ } // TODO fix type
4680
+
4186
4681
 
4187
4682
  observable.setNewValue_(newValue);
4188
- if (notify) notifyListeners(this, change);
4189
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4683
+
4684
+ if (notify) {
4685
+ notifyListeners(this, change);
4686
+ }
4687
+
4688
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4689
+ spyReportEnd();
4690
+ }
4190
4691
  }
4191
4692
  };
4192
4693
 
@@ -4217,14 +4718,26 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4217
4718
  name: key,
4218
4719
  newValue: newValue
4219
4720
  } : null;
4220
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change); // TODO fix type
4221
4721
 
4222
- if (notify) notifyListeners(this, change);
4223
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
4722
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4723
+ spyReportStart(change);
4724
+ } // TODO fix type
4725
+
4726
+
4727
+ if (notify) {
4728
+ notifyListeners(this, change);
4729
+ }
4730
+
4731
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
4732
+ spyReportEnd();
4733
+ }
4224
4734
  };
4225
4735
 
4226
4736
  _proto.get = function get(key) {
4227
- if (this.has(key)) return this.dehanceValue_(this.data_.get(key).get());
4737
+ if (this.has(key)) {
4738
+ return this.dehanceValue_(this.data_.get(key).get());
4739
+ }
4740
+
4228
4741
  return this.dehanceValue_(undefined);
4229
4742
  };
4230
4743
 
@@ -4298,18 +4811,27 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4298
4811
  }
4299
4812
 
4300
4813
  transaction(function () {
4301
- if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) {
4302
- return _this5.set(key, other[key]);
4303
- });else if (Array.isArray(other)) other.forEach(function (_ref) {
4304
- var key = _ref[0],
4305
- value = _ref[1];
4306
- return _this5.set(key, value);
4307
- });else if (isES6Map(other)) {
4308
- if (other.constructor !== Map) die(19, other);
4814
+ if (isPlainObject(other)) {
4815
+ getPlainObjectKeys(other).forEach(function (key) {
4816
+ return _this5.set(key, other[key]);
4817
+ });
4818
+ } else if (Array.isArray(other)) {
4819
+ other.forEach(function (_ref) {
4820
+ var key = _ref[0],
4821
+ value = _ref[1];
4822
+ return _this5.set(key, value);
4823
+ });
4824
+ } else if (isES6Map(other)) {
4825
+ if (other.constructor !== Map) {
4826
+ die(19, other);
4827
+ }
4828
+
4309
4829
  other.forEach(function (value, key) {
4310
4830
  return _this5.set(key, value);
4311
4831
  });
4312
- } else if (other !== null && other !== undefined) die(20, other);
4832
+ } else if (other !== null && other !== undefined) {
4833
+ die(20, other);
4834
+ }
4313
4835
  });
4314
4836
  return this;
4315
4837
  };
@@ -4440,7 +4962,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4440
4962
  * for callback details
4441
4963
  */
4442
4964
  _proto.observe_ = function observe_(listener, fireImmediately) {
4443
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with maps.");
4965
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
4966
+ die("`observe` doesn't support fireImmediately=true in combination with maps.");
4967
+ }
4968
+
4444
4969
  return registerListener(this, listener);
4445
4970
  };
4446
4971
 
@@ -4565,8 +5090,12 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4565
5090
  object: this,
4566
5091
  newValue: value
4567
5092
  });
4568
- if (!change) return this; // ideally, value = change.value would be done here, so that values can be
5093
+
5094
+ if (!change) {
5095
+ return this;
5096
+ } // ideally, value = change.value would be done here, so that values can be
4569
5097
  // changed by interceptor. Same applies for other Set and Map api's.
5098
+
4570
5099
  }
4571
5100
 
4572
5101
  if (!this.has(value)) {
@@ -4586,9 +5115,17 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4586
5115
  newValue: value
4587
5116
  } : null;
4588
5117
 
4589
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(_change);
4590
- if (notify) notifyListeners(this, _change);
4591
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd();
5118
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5119
+ spyReportStart(_change);
5120
+ }
5121
+
5122
+ if (notify) {
5123
+ notifyListeners(this, _change);
5124
+ }
5125
+
5126
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5127
+ spyReportEnd();
5128
+ }
4592
5129
  }
4593
5130
 
4594
5131
  return this;
@@ -4603,7 +5140,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4603
5140
  object: this,
4604
5141
  oldValue: value
4605
5142
  });
4606
- if (!change) return false;
5143
+
5144
+ if (!change) {
5145
+ return false;
5146
+ }
4607
5147
  }
4608
5148
 
4609
5149
  if (this.has(value)) {
@@ -4618,14 +5158,24 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4618
5158
  oldValue: value
4619
5159
  } : null;
4620
5160
 
4621
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(_change2);
5161
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5162
+ spyReportStart(_change2);
5163
+ }
5164
+
4622
5165
  transaction(function () {
4623
5166
  _this3.atom_.reportChanged();
4624
5167
 
4625
5168
  _this3.data_["delete"](value);
4626
5169
  });
4627
- if (notify) notifyListeners(this, _change2);
4628
- if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd();
5170
+
5171
+ if (notify) {
5172
+ notifyListeners(this, _change2);
5173
+ }
5174
+
5175
+ if (notifySpy && process.env.NODE_ENV !== "production") {
5176
+ spyReportEnd();
5177
+ }
5178
+
4629
5179
  return true;
4630
5180
  }
4631
5181
 
@@ -4705,7 +5255,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4705
5255
 
4706
5256
  _proto.observe_ = function observe_(listener, fireImmediately) {
4707
5257
  // ... 'fireImmediately' could also be true?
4708
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with sets.");
5258
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
5259
+ die("`observe` doesn't support fireImmediately=true in combination with sets.");
5260
+ }
5261
+
4709
5262
  return registerListener(this, listener);
4710
5263
  };
4711
5264
 
@@ -4807,7 +5360,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4807
5360
  name: key,
4808
5361
  newValue: newValue
4809
5362
  });
4810
- if (!change) return null;
5363
+
5364
+ if (!change) {
5365
+ return null;
5366
+ }
5367
+
4811
5368
  newValue = change.newValue;
4812
5369
  }
4813
5370
 
@@ -4827,10 +5384,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4827
5384
  newValue: newValue
4828
5385
  } : null;
4829
5386
 
4830
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change);
5387
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5388
+ spyReportStart(_change);
5389
+ }
4831
5390
  observable.setNewValue_(newValue);
4832
- if (notify) notifyListeners(this, _change);
4833
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5391
+
5392
+ if (notify) {
5393
+ notifyListeners(this, _change);
5394
+ }
5395
+
5396
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5397
+ spyReportEnd();
5398
+ }
4834
5399
  }
4835
5400
 
4836
5401
  return true;
@@ -4939,12 +5504,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4939
5504
 
4940
5505
  if (descriptor) {
4941
5506
  var outcome = annotation.make_(this, key, descriptor, source);
5507
+
4942
5508
  if (outcome === 0
4943
5509
  /* Cancel */
4944
- ) return;
5510
+ ) {
5511
+ return;
5512
+ }
5513
+
4945
5514
  if (outcome === 1
4946
5515
  /* Break */
4947
- ) break;
5516
+ ) {
5517
+ break;
5518
+ }
4948
5519
  }
4949
5520
 
4950
5521
  source = Object.getPrototypeOf(source);
@@ -5014,7 +5585,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5014
5585
  type: ADD,
5015
5586
  newValue: descriptor.value
5016
5587
  });
5017
- if (!change) return null;
5588
+
5589
+ if (!change) {
5590
+ return null;
5591
+ }
5592
+
5018
5593
  var newValue = change.newValue;
5019
5594
 
5020
5595
  if (descriptor.value !== newValue) {
@@ -5066,7 +5641,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5066
5641
  type: ADD,
5067
5642
  newValue: value
5068
5643
  });
5069
- if (!change) return null;
5644
+
5645
+ if (!change) {
5646
+ return null;
5647
+ }
5648
+
5070
5649
  value = change.newValue;
5071
5650
  }
5072
5651
 
@@ -5121,7 +5700,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5121
5700
  type: ADD,
5122
5701
  newValue: undefined
5123
5702
  });
5124
- if (!change) return null;
5703
+
5704
+ if (!change) {
5705
+ return null;
5706
+ }
5125
5707
  }
5126
5708
 
5127
5709
  options.name || (options.name = process.env.NODE_ENV !== "production" ? this.name_ + "." + key.toString() : "ObservableObject.key");
@@ -5177,7 +5759,9 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5177
5759
  type: REMOVE
5178
5760
  }); // Cancelled
5179
5761
 
5180
- if (!change) return null;
5762
+ if (!change) {
5763
+ return null;
5764
+ }
5181
5765
  } // Delete
5182
5766
 
5183
5767
 
@@ -5238,9 +5822,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5238
5822
  oldValue: value,
5239
5823
  name: key
5240
5824
  };
5241
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(_change2);
5242
- if (notify) notifyListeners(this, _change2);
5243
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5825
+
5826
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5827
+ spyReportStart(_change2);
5828
+ }
5829
+
5830
+ if (notify) {
5831
+ notifyListeners(this, _change2);
5832
+ }
5833
+
5834
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5835
+ spyReportEnd();
5836
+ }
5244
5837
  }
5245
5838
  } finally {
5246
5839
  endBatch();
@@ -5256,7 +5849,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5256
5849
  ;
5257
5850
 
5258
5851
  _proto.observe_ = function observe_(callback, fireImmediately) {
5259
- if (process.env.NODE_ENV !== "production" && fireImmediately === true) die("`observe` doesn't support the fire immediately property for observable objects.");
5852
+ if (process.env.NODE_ENV !== "production" && fireImmediately === true) {
5853
+ die("`observe` doesn't support the fire immediately property for observable objects.");
5854
+ }
5855
+
5260
5856
  return registerListener(this, callback);
5261
5857
  };
5262
5858
 
@@ -5279,9 +5875,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5279
5875
  name: key,
5280
5876
  newValue: value
5281
5877
  } : null;
5282
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportStart(change);
5283
- if (notify) notifyListeners(this, change);
5284
- if (process.env.NODE_ENV !== "production" && notifySpy) spyReportEnd();
5878
+
5879
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5880
+ spyReportStart(change);
5881
+ }
5882
+
5883
+ if (notify) {
5884
+ notifyListeners(this, change);
5885
+ }
5886
+
5887
+ if (process.env.NODE_ENV !== "production" && notifySpy) {
5888
+ spyReportEnd();
5889
+ }
5285
5890
  }
5286
5891
 
5287
5892
  (_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
@@ -5322,7 +5927,10 @@ function asObservableObject(target, options) {
5322
5927
  return target;
5323
5928
  }
5324
5929
 
5325
- if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) die("Cannot make the designated object observable; it is not extensible");
5930
+ if (process.env.NODE_ENV !== "production" && !Object.isExtensible(target)) {
5931
+ die("Cannot make the designated object observable; it is not extensible");
5932
+ }
5933
+
5326
5934
  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";
5327
5935
  var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
5328
5936
  addHiddenProp(target, $mobx, adm);
@@ -5479,7 +6087,6 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5479
6087
  var nextIndex = 0;
5480
6088
  return makeIterable({
5481
6089
  next: function next() {
5482
- // @ts-ignore
5483
6090
  return nextIndex < self.length ? {
5484
6091
  value: self[nextIndex++],
5485
6092
  done: false
@@ -5512,7 +6119,10 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5512
6119
  Object.entries(arrayExtensions).forEach(function (_ref) {
5513
6120
  var prop = _ref[0],
5514
6121
  fn = _ref[1];
5515
- if (prop !== "concat") addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6122
+
6123
+ if (prop !== "concat") {
6124
+ addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6125
+ }
5516
6126
  });
5517
6127
 
5518
6128
  function createArrayEntryDescriptor(index) {
@@ -5549,7 +6159,10 @@ function createLegacyArray(initialValues, enhancer, name) {
5549
6159
  function getAtom(thing, property) {
5550
6160
  if (typeof thing === "object" && thing !== null) {
5551
6161
  if (isObservableArray(thing)) {
5552
- if (property !== undefined) die(23);
6162
+ if (property !== undefined) {
6163
+ die(23);
6164
+ }
6165
+
5553
6166
  return thing[$mobx].atom_;
5554
6167
  }
5555
6168
 
@@ -5558,18 +6171,31 @@ function getAtom(thing, property) {
5558
6171
  }
5559
6172
 
5560
6173
  if (isObservableMap(thing)) {
5561
- if (property === undefined) return thing.keysAtom_;
6174
+ if (property === undefined) {
6175
+ return thing.keysAtom_;
6176
+ }
6177
+
5562
6178
  var observable = thing.data_.get(property) || thing.hasMap_.get(property);
5563
- if (!observable) die(25, property, getDebugName(thing));
6179
+
6180
+ if (!observable) {
6181
+ die(25, property, getDebugName(thing));
6182
+ }
6183
+
5564
6184
  return observable;
5565
6185
  }
5566
6186
 
6187
+
5567
6188
  if (isObservableObject(thing)) {
5568
- if (!property) return die(26);
6189
+ if (!property) {
6190
+ return die(26);
6191
+ }
5569
6192
 
5570
6193
  var _observable = thing[$mobx].values_.get(property);
5571
6194
 
5572
- if (!_observable) die(27, property, getDebugName(thing));
6195
+ if (!_observable) {
6196
+ die(27, property, getDebugName(thing));
6197
+ }
6198
+
5573
6199
  return _observable;
5574
6200
  }
5575
6201
 
@@ -5586,11 +6212,26 @@ function getAtom(thing, property) {
5586
6212
  die(28);
5587
6213
  }
5588
6214
  function getAdministration(thing, property) {
5589
- if (!thing) die(29);
5590
- if (property !== undefined) return getAdministration(getAtom(thing, property));
5591
- if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing;
5592
- if (isObservableMap(thing) || isObservableSet(thing)) return thing;
5593
- if (thing[$mobx]) return thing[$mobx];
6215
+ if (!thing) {
6216
+ die(29);
6217
+ }
6218
+
6219
+ if (property !== undefined) {
6220
+ return getAdministration(getAtom(thing, property));
6221
+ }
6222
+
6223
+ if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
6224
+ return thing;
6225
+ }
6226
+
6227
+ if (isObservableMap(thing) || isObservableSet(thing)) {
6228
+ return thing;
6229
+ }
6230
+
6231
+ if (thing[$mobx]) {
6232
+ return thing[$mobx];
6233
+ }
6234
+
5594
6235
  die(24, thing);
5595
6236
  }
5596
6237
  function getDebugName(thing, property) {
@@ -5623,17 +6264,33 @@ function deepEqual(a, b, depth) {
5623
6264
  function eq(a, b, depth, aStack, bStack) {
5624
6265
  // Identical objects are equal. `0 === -0`, but they aren't identical.
5625
6266
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
5626
- if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).
6267
+ if (a === b) {
6268
+ return a !== 0 || 1 / a === 1 / b;
6269
+ } // `null` or `undefined` only equal to itself (strict comparison).
5627
6270
 
5628
- if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.
5629
6271
 
5630
- if (a !== a) return b !== b; // Exhaust primitive checks
6272
+ if (a == null || b == null) {
6273
+ return false;
6274
+ } // `NaN`s are equivalent, but non-reflexive.
6275
+
6276
+
6277
+ if (a !== a) {
6278
+ return b !== b;
6279
+ } // Exhaust primitive checks
6280
+
5631
6281
 
5632
6282
  var type = typeof a;
5633
- if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
6283
+
6284
+ if (type !== "function" && type !== "object" && typeof b != "object") {
6285
+ return false;
6286
+ } // Compare `[[Class]]` names.
6287
+
5634
6288
 
5635
6289
  var className = toString.call(a);
5636
- if (className !== toString.call(b)) return false;
6290
+
6291
+ if (className !== toString.call(b)) {
6292
+ return false;
6293
+ }
5637
6294
 
5638
6295
  switch (className) {
5639
6296
  // Strings, numbers, regular expressions, dates, and booleans are compared by value.
@@ -5647,7 +6304,10 @@ function eq(a, b, depth, aStack, bStack) {
5647
6304
  case "[object Number]":
5648
6305
  // `NaN`s are equivalent, but non-reflexive.
5649
6306
  // Object(NaN) is equivalent to NaN.
5650
- if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.
6307
+ if (+a !== +a) {
6308
+ return +b !== +b;
6309
+ } // An `egal` comparison is performed for other numeric values.
6310
+
5651
6311
 
5652
6312
  return +a === 0 ? 1 / +a === 1 / b : +a === +b;
5653
6313
 
@@ -5678,9 +6338,12 @@ function eq(a, b, depth, aStack, bStack) {
5678
6338
  var areArrays = className === "[object Array]";
5679
6339
 
5680
6340
  if (!areArrays) {
5681
- if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6341
+ if (typeof a != "object" || typeof b != "object") {
6342
+ return false;
6343
+ } // Objects with different constructors are not equivalent, but `Object`s or `Array`s
5682
6344
  // from different frames are.
5683
6345
 
6346
+
5684
6347
  var aCtor = a.constructor,
5685
6348
  bCtor = b.constructor;
5686
6349
 
@@ -5706,7 +6369,9 @@ function eq(a, b, depth, aStack, bStack) {
5706
6369
  while (length--) {
5707
6370
  // Linear search. Performance is inversely proportional to the number of
5708
6371
  // unique nested structures.
5709
- if (aStack[length] === a) return bStack[length] === b;
6372
+ if (aStack[length] === a) {
6373
+ return bStack[length] === b;
6374
+ }
5710
6375
  } // Add the first object to the stack of traversed objects.
5711
6376
 
5712
6377
 
@@ -5716,10 +6381,16 @@ function eq(a, b, depth, aStack, bStack) {
5716
6381
  if (areArrays) {
5717
6382
  // Compare array lengths to determine if a deep comparison is necessary.
5718
6383
  length = a.length;
5719
- if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.
6384
+
6385
+ if (length !== b.length) {
6386
+ return false;
6387
+ } // Deep compare the contents, ignoring non-numeric properties.
6388
+
5720
6389
 
5721
6390
  while (length--) {
5722
- if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false;
6391
+ if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {
6392
+ return false;
6393
+ }
5723
6394
  }
5724
6395
  } else {
5725
6396
  // Deep compare objects.
@@ -5727,12 +6398,17 @@ function eq(a, b, depth, aStack, bStack) {
5727
6398
  var key;
5728
6399
  length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
5729
6400
 
5730
- if (Object.keys(b).length !== length) return false;
6401
+ if (Object.keys(b).length !== length) {
6402
+ return false;
6403
+ }
5731
6404
 
5732
6405
  while (length--) {
5733
6406
  // Deep compare each member
5734
6407
  key = keys[length];
5735
- if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false;
6408
+
6409
+ if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
6410
+ return false;
6411
+ }
5736
6412
  }
5737
6413
  } // Remove the first object from the stack of traversed objects.
5738
6414
 
@@ -5743,9 +6419,18 @@ function eq(a, b, depth, aStack, bStack) {
5743
6419
  }
5744
6420
 
5745
6421
  function unwrap(a) {
5746
- if (isObservableArray(a)) return a.slice();
5747
- if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries());
5748
- if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries());
6422
+ if (isObservableArray(a)) {
6423
+ return a.slice();
6424
+ }
6425
+
6426
+ if (isES6Map(a) || isObservableMap(a)) {
6427
+ return Array.from(a.entries());
6428
+ }
6429
+
6430
+ if (isES6Set(a) || isObservableSet(a)) {
6431
+ return Array.from(a.entries());
6432
+ }
6433
+
5749
6434
  return a;
5750
6435
  }
5751
6436