@player-ui/stage-revert-data-plugin 0.13.0 → 0.14.0-next.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.
@@ -45,6 +45,10 @@ function _async_to_generator(fn) {
45
45
  });
46
46
  };
47
47
  }
48
+ function _call_super(_this, derived, args) {
49
+ derived = _get_prototype_of(derived);
50
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
51
+ }
48
52
  function _class_call_check(instance, Constructor) {
49
53
  if (!(instance instanceof Constructor)) {
50
54
  throw new TypeError("Cannot call a class as a function");
@@ -283,31 +287,15 @@ function _wrap_native_super(Class) {
283
287
  return _wrap_native_super(Class);
284
288
  }
285
289
  function _is_native_reflect_construct() {
286
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
287
- if (Reflect.construct.sham) return false;
288
- if (typeof Proxy === "function") return true;
289
290
  try {
290
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
291
- return true;
292
- } catch (e) {
293
- return false;
294
- }
295
- }
296
- function _create_super(Derived) {
297
- var hasNativeReflectConstruct = _is_native_reflect_construct();
298
- return function _createSuperInternal() {
299
- var Super = _get_prototype_of(Derived), result;
300
- if (hasNativeReflectConstruct) {
301
- var NewTarget = _get_prototype_of(this).constructor;
302
- result = Reflect.construct(Super, arguments, NewTarget);
303
- } else {
304
- result = Super.apply(this, arguments);
305
- }
306
- return _possible_constructor_return(this, result);
307
- };
291
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
292
+ } catch (_) {}
293
+ return (_is_native_reflect_construct = function() {
294
+ return !!result;
295
+ })();
308
296
  }
309
297
  function _ts_generator(thisArg, body) {
310
- var f, y, t, g, _ = {
298
+ var f, y, t, _ = {
311
299
  label: 0,
312
300
  sent: function() {
313
301
  if (t[0] & 1) throw t[1];
@@ -315,12 +303,8 @@ function _ts_generator(thisArg, body) {
315
303
  },
316
304
  trys: [],
317
305
  ops: []
318
- };
319
- return g = {
320
- next: verb(0),
321
- "throw": verb(1),
322
- "return": verb(2)
323
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
306
+ }, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
307
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
324
308
  return this;
325
309
  }), g;
326
310
  function verb(n) {
@@ -333,7 +317,7 @@ function _ts_generator(thisArg, body) {
333
317
  }
334
318
  function step(op) {
335
319
  if (f) throw new TypeError("Generator is already executing.");
336
- while(_)try {
320
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
337
321
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
338
322
  if (y = 0, t) op = [
339
323
  op[0] & 2,
@@ -505,7 +489,7 @@ var StageRevertDataPlugin = function() {
505
489
  };
506
490
  var findInArray = function findInArray(array, key, value) {
507
491
  return array.findIndex(function(obj) {
508
- if (obj && typeof obj === "object") {
492
+ if (obj && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
509
493
  return obj[key] == value;
510
494
  }
511
495
  return false;
@@ -599,7 +583,7 @@ var StageRevertDataPlugin = function() {
599
583
  };
600
584
  };
601
585
  var isExpressionNode = function isExpressionNode(x) {
602
- return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
586
+ return (typeof x === "undefined" ? "undefined" : _type_of(x)) === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
603
587
  };
604
588
  var throwError = function throwError(message, index) {
605
589
  var err = new Error("".concat(message, " at character ").concat(index));
@@ -1187,7 +1171,7 @@ var StageRevertDataPlugin = function() {
1187
1171
  var isPromiseLike = function isPromiseLike(value) {
1188
1172
  var // Check for standard Promise constructor name
1189
1173
  _value_constructor;
1190
- return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1174
+ return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1191
1175
  (_instanceof(value, Promise) || ((_value_constructor = value.constructor) === null || _value_constructor === void 0 ? void 0 : _value_constructor.name) === "Promise" || // Verify it has other Promise-like methods to reduce false positives
1192
1176
  typeof value.catch === "function" && typeof value.finally === "function");
1193
1177
  };
@@ -1202,7 +1186,7 @@ var StageRevertDataPlugin = function() {
1202
1186
  if (isExpressionNode(expr)) {
1203
1187
  return false;
1204
1188
  }
1205
- return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1189
+ return (typeof expr === "undefined" ? "undefined" : _type_of(expr)) === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1206
1190
  };
1207
1191
  var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
1208
1192
  return function(a, b, async) {
@@ -1419,7 +1403,7 @@ var StageRevertDataPlugin = function() {
1419
1403
  if (!node) {
1420
1404
  return;
1421
1405
  }
1422
- if ("value" in node && typeof node.value === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1406
+ if ("value" in node && _type_of(node.value) === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1423
1407
  return node.value.id;
1424
1408
  }
1425
1409
  };
@@ -1454,22 +1438,6 @@ var StageRevertDataPlugin = function() {
1454
1438
  }
1455
1439
  });
1456
1440
  };
1457
- var unpackNode = function unpackNode(item) {
1458
- var _item_children_, _item_children, _item_children_1, _item_children1;
1459
- var unpacked = [];
1460
- if ("children" in item && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.value.type) === "asset" && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : (_item_children_1 = _item_children1[0]) === null || _item_children_1 === void 0 ? void 0 : _item_children_1.value).children) {
1461
- var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1462
- if (((_item_children__value_children = ((_item_children2 = item.children) === null || _item_children2 === void 0 ? void 0 : (_item_children_2 = _item_children2[0]) === null || _item_children_2 === void 0 ? void 0 : _item_children_2.value).children) === null || _item_children__value_children === void 0 ? void 0 : (_item_children__value_children_ = _item_children__value_children[0]) === null || _item_children__value_children_ === void 0 ? void 0 : _item_children__value_children_.value.type) === "multi-node") {
1463
- var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1464
- ((_item_children__value_children1 = ((_item_children3 = item.children) === null || _item_children3 === void 0 ? void 0 : (_item_children_3 = _item_children3[0]) === null || _item_children_3 === void 0 ? void 0 : _item_children_3.value).children) === null || _item_children__value_children1 === void 0 ? void 0 : (_item_children__value_children_1 = _item_children__value_children1[0]) === null || _item_children__value_children_1 === void 0 ? void 0 : _item_children__value_children_1.value).values.forEach(function(value) {
1465
- unpacked.push(value);
1466
- });
1467
- }
1468
- } else {
1469
- unpacked.push(item);
1470
- }
1471
- return unpacked;
1472
- };
1473
1441
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1474
1442
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1475
1443
  };
@@ -1547,7 +1515,7 @@ var StageRevertDataPlugin = function() {
1547
1515
  });
1548
1516
  };
1549
1517
  var __copyProps = function(to, from, except, desc) {
1550
- if (from && typeof from === "object" || typeof from === "function") {
1518
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1551
1519
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1552
1520
  try {
1553
1521
  var _loop = function() {
@@ -1602,15 +1570,16 @@ var StageRevertDataPlugin = function() {
1602
1570
  exports.toError = exports.NestedError = void 0;
1603
1571
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1604
1572
  _inherits(_NestedError, Error1);
1605
- var _super = _create_super(_NestedError);
1606
1573
  function _NestedError(message) {
1607
1574
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1608
1575
  innerErrors[_key - 1] = arguments[_key];
1609
1576
  }
1610
1577
  _class_call_check(this, _NestedError);
1611
1578
  var _this;
1612
- _this = _super.call(this, message);
1613
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1579
+ _this = _call_super(this, _NestedError, [
1580
+ message
1581
+ ]);
1582
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1614
1583
  if (innerErrors.length === 1) {
1615
1584
  var innerError = toError(innerErrors[0]);
1616
1585
  _this.innerErrors = [
@@ -1746,7 +1715,7 @@ var StageRevertDataPlugin = function() {
1746
1715
  return out;
1747
1716
  }
1748
1717
  function isObject(o) {
1749
- return o != null && typeof o === "object";
1718
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1750
1719
  }
1751
1720
  function addLast2(array, val) {
1752
1721
  if (Array.isArray(val)) return array.concat(val);
@@ -2089,7 +2058,7 @@ var StageRevertDataPlugin = function() {
2089
2058
  else return 0;
2090
2059
  }
2091
2060
  }();
2092
- if (typeof module === "object") module.exports = SortedArray2;
2061
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
2093
2062
  if (typeof define === "function" && define.amd) define(function() {
2094
2063
  return SortedArray2;
2095
2064
  });
@@ -2286,10 +2255,9 @@ var StageRevertDataPlugin = function() {
2286
2255
  }();
2287
2256
  var SyncHook = /*#__PURE__*/ function(Hook) {
2288
2257
  _inherits(SyncHook, Hook);
2289
- var _super = _create_super(SyncHook);
2290
2258
  function SyncHook() {
2291
2259
  _class_call_check(this, SyncHook);
2292
- return _super.apply(this, arguments);
2260
+ return _call_super(this, SyncHook, arguments);
2293
2261
  }
2294
2262
  _create_class(SyncHook, [
2295
2263
  {
@@ -2322,10 +2290,9 @@ var StageRevertDataPlugin = function() {
2322
2290
  }(Hook);
2323
2291
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2324
2292
  _inherits(SyncBailHook, Hook);
2325
- var _super = _create_super(SyncBailHook);
2326
2293
  function SyncBailHook() {
2327
2294
  _class_call_check(this, SyncBailHook);
2328
- return _super.apply(this, arguments);
2295
+ return _call_super(this, SyncBailHook, arguments);
2329
2296
  }
2330
2297
  _create_class(SyncBailHook, [
2331
2298
  {
@@ -2357,10 +2324,9 @@ var StageRevertDataPlugin = function() {
2357
2324
  }(Hook);
2358
2325
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2359
2326
  _inherits(SyncWaterfallHook, Hook);
2360
- var _super = _create_super(SyncWaterfallHook);
2361
2327
  function SyncWaterfallHook() {
2362
2328
  _class_call_check(this, SyncWaterfallHook);
2363
- return _super.apply(this, arguments);
2329
+ return _call_super(this, SyncWaterfallHook, arguments);
2364
2330
  }
2365
2331
  _create_class(SyncWaterfallHook, [
2366
2332
  {
@@ -2422,7 +2388,7 @@ var StageRevertDataPlugin = function() {
2422
2388
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2423
2389
  len = _step.value;
2424
2390
  tmp = len;
2425
- if (tmp && typeof tmp === "object") {
2391
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2426
2392
  tmp = find(bar, tmp);
2427
2393
  if (!tmp) return false;
2428
2394
  }
@@ -2453,7 +2419,7 @@ var StageRevertDataPlugin = function() {
2453
2419
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2454
2420
  len = _step1.value;
2455
2421
  tmp = len[0];
2456
- if (tmp && typeof tmp === "object") {
2422
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2457
2423
  tmp = find(bar, tmp);
2458
2424
  if (!tmp) return false;
2459
2425
  }
@@ -2492,7 +2458,7 @@ var StageRevertDataPlugin = function() {
2492
2458
  }
2493
2459
  return len === -1;
2494
2460
  }
2495
- if (!ctor || typeof foo === "object") {
2461
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2496
2462
  len = 0;
2497
2463
  for(ctor in foo){
2498
2464
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -2525,7 +2491,7 @@ var StageRevertDataPlugin = function() {
2525
2491
  var nestedPath = _to_consumable_array(path).concat([
2526
2492
  key
2527
2493
  ]);
2528
- if (typeof val === "object") {
2494
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2529
2495
  traverseObj(val, nestedPath, pairs);
2530
2496
  } else {
2531
2497
  pairs.set(nestedPath, val);
@@ -2566,7 +2532,7 @@ var StageRevertDataPlugin = function() {
2566
2532
  {
2567
2533
  /** Add match -> value mapping to the registry */ key: "set",
2568
2534
  value: function set(match, value) {
2569
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2535
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2570
2536
  this.store.insert({
2571
2537
  key: match,
2572
2538
  value: value,
@@ -2729,6 +2695,7 @@ var StageRevertDataPlugin = function() {
2729
2695
  }
2730
2696
  };
2731
2697
  var identifier = function() {
2698
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2732
2699
  if (!isIdentifierChar(ch)) {
2733
2700
  return;
2734
2701
  }
@@ -2739,6 +2706,14 @@ var StageRevertDataPlugin = function() {
2739
2706
  }
2740
2707
  value += ch;
2741
2708
  }
2709
+ if (allowBoolValue) {
2710
+ if (value === "true") {
2711
+ return toValue(true);
2712
+ }
2713
+ if (value === "false") {
2714
+ return toValue(false);
2715
+ }
2716
+ }
2742
2717
  if (value) {
2743
2718
  var maybeNumber = Number(value);
2744
2719
  value = isNaN(maybeNumber) ? value : maybeNumber;
@@ -2787,8 +2762,9 @@ var StageRevertDataPlugin = function() {
2787
2762
  }
2788
2763
  };
2789
2764
  var simpleSegment = function() {
2765
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2790
2766
  var _nestedPath, _ref;
2791
- return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
2767
+ return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
2792
2768
  };
2793
2769
  var segment = function() {
2794
2770
  var segments = [];
@@ -2803,6 +2779,7 @@ var StageRevertDataPlugin = function() {
2803
2779
  return toConcatenatedNode(segments);
2804
2780
  };
2805
2781
  var optionallyQuotedSegment = function() {
2782
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2806
2783
  whitespace();
2807
2784
  if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
2808
2785
  var singleQuote = ch === SINGLE_QUOTE;
@@ -2811,7 +2788,7 @@ var StageRevertDataPlugin = function() {
2811
2788
  next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
2812
2789
  return id;
2813
2790
  }
2814
- return simpleSegment();
2791
+ return simpleSegment(allowBoolValue);
2815
2792
  };
2816
2793
  var equals = function() {
2817
2794
  if (ch !== EQUALS) {
@@ -2831,7 +2808,7 @@ var StageRevertDataPlugin = function() {
2831
2808
  whitespace();
2832
2809
  if (equals()) {
2833
2810
  whitespace();
2834
- var second = optionallyQuotedSegment();
2811
+ var second = optionallyQuotedSegment(true);
2835
2812
  value = toQuery(value, second);
2836
2813
  whitespace();
2837
2814
  }
@@ -3019,7 +2996,7 @@ var StageRevertDataPlugin = function() {
3019
2996
  appendPathSegments(getValueForNode(resolvedNode));
3020
2997
  break;
3021
2998
  case "Value":
3022
- appendPathSegments(resolvedNode.value);
2999
+ appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
3023
3000
  break;
3024
3001
  case "Query":
3025
3002
  {
@@ -3095,7 +3072,7 @@ var StageRevertDataPlugin = function() {
3095
3072
  var _this_parseCache_path;
3096
3073
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3097
3074
  this.parseCache[path] = ast;
3098
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3075
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3099
3076
  var _ast_error;
3100
3077
  throw new TypeError('Cannot normalize path "'.concat(path, '": ').concat((_ast_error = ast === null || ast === void 0 ? void 0 : ast.error) !== null && _ast_error !== void 0 ? _ast_error : "Unknown Error."));
3101
3078
  }
@@ -3295,14 +3272,13 @@ var StageRevertDataPlugin = function() {
3295
3272
  }();
3296
3273
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3297
3274
  _inherits(DependencyModel, DependencyTracker);
3298
- var _super = _create_super(DependencyModel);
3299
3275
  function DependencyModel(rootModel) {
3300
3276
  _class_call_check(this, DependencyModel);
3301
3277
  var _this;
3302
- _this = _super.call(this);
3278
+ _this = _call_super(this, DependencyModel);
3303
3279
  _this.rootModel = rootModel;
3304
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3305
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3280
+ _this.set = _this.set.bind(_this);
3281
+ _this.get = _this.get.bind(_this);
3306
3282
  return _this;
3307
3283
  }
3308
3284
  _create_class(DependencyModel, [
@@ -3846,23 +3822,20 @@ var StageRevertDataPlugin = function() {
3846
3822
  * @experimental These Player APIs are in active development and may change. Use with caution
3847
3823
  */ key: "evaluateAsync",
3848
3824
  value: function evaluateAsync(expr, options) {
3825
+ var _this = this;
3849
3826
  if (Array.isArray(expr)) {
3850
- var _this = this;
3851
- return collateAwaitable(expr.map(function() {
3852
- var _ref = _async_to_generator(function(exp) {
3827
+ return collateAwaitable(expr.map(function(exp) {
3828
+ return _async_to_generator(function() {
3853
3829
  return _ts_generator(this, function(_state) {
3854
3830
  return [
3855
3831
  2,
3856
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3832
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3857
3833
  async: true
3858
3834
  }))
3859
3835
  ];
3860
3836
  });
3861
- });
3862
- return function(exp) {
3863
- return _ref.apply(this, arguments);
3864
- };
3865
- }())).awaitableThen(function(values) {
3837
+ }).call(_this);
3838
+ })).awaitableThen(function(values) {
3866
3839
  return values.pop();
3867
3840
  });
3868
3841
  } else {
@@ -4586,23 +4559,8 @@ var StageRevertDataPlugin = function() {
4586
4559
  function Parser() {
4587
4560
  _class_call_check(this, Parser);
4588
4561
  this.hooks = {
4589
- /**
4590
- * A hook to interact with an object _before_ parsing it into an AST
4591
- *
4592
- * @param value - The object we're are about to parse
4593
- * @returns - A new value to parse.
4594
- * If undefined, the original value is used.
4595
- * If null, we stop parsing this node.
4596
- */ onParseObject: new SyncWaterfallHook(),
4597
- /**
4598
- * A callback to interact with an AST _after_ we parse it into the AST
4599
- *
4600
- * @param value - The object we parsed
4601
- * @param node - The AST node we generated
4602
- * @returns - A new AST node to use
4603
- * If undefined, the original value is used.
4604
- * If null, we ignore this node all together
4605
- */ onCreateASTNode: new SyncWaterfallHook(),
4562
+ onParseObject: new SyncWaterfallHook(),
4563
+ onCreateASTNode: new SyncWaterfallHook(),
4606
4564
  parseNode: new SyncBailHook()
4607
4565
  };
4608
4566
  }
@@ -4640,7 +4598,7 @@ var StageRevertDataPlugin = function() {
4640
4598
  }
4641
4599
  var parseLocalObject = function(currentValue, objToParse) {
4642
4600
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4643
- if (typeof objToParse !== "object" || objToParse === null) {
4601
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4644
4602
  return {
4645
4603
  value: objToParse,
4646
4604
  children: []
@@ -4677,7 +4635,7 @@ var StageRevertDataPlugin = function() {
4677
4635
  if (newChildren) {
4678
4636
  var _children2;
4679
4637
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4680
- } else if (localValue && typeof localValue === "object") {
4638
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4681
4639
  var _children21;
4682
4640
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4683
4641
  localKey
@@ -4744,20 +4702,14 @@ var StageRevertDataPlugin = function() {
4744
4702
  function Resolver(root, options) {
4745
4703
  _class_call_check(this, Resolver);
4746
4704
  this.hooks = {
4747
- /** A hook to allow skipping of the resolution tree for a specific node */ skipResolve: new SyncWaterfallHook(),
4748
- /** An event emitted before calculating the next update */ beforeUpdate: new SyncHook(),
4749
- /** An event emitted after calculating the next update */ afterUpdate: new SyncHook(),
4750
- /** The options passed to a node to resolve it to an object */ resolveOptions: new SyncWaterfallHook(),
4751
- /** A hook to transform the AST node into a new AST node before resolving it */ beforeResolve: new SyncWaterfallHook(),
4752
- /**
4753
- * A hook to transform an AST node into it's resolved value.
4754
- * This runs _before_ any children are resolved
4755
- */ resolve: new SyncWaterfallHook(),
4756
- /**
4757
- * A hook to transform the resolved value of an AST node.
4758
- * This runs _after_ all children nodes are resolved
4759
- */ afterResolve: new SyncWaterfallHook(),
4760
- /** Called at the very end of a node's tree being updated */ afterNodeUpdate: new SyncHook()
4705
+ skipResolve: new SyncWaterfallHook(),
4706
+ beforeUpdate: new SyncHook(),
4707
+ afterUpdate: new SyncHook(),
4708
+ resolveOptions: new SyncWaterfallHook(),
4709
+ beforeResolve: new SyncWaterfallHook(),
4710
+ resolve: new SyncWaterfallHook(),
4711
+ afterResolve: new SyncWaterfallHook(),
4712
+ afterNodeUpdate: new SyncHook()
4761
4713
  };
4762
4714
  this.root = root;
4763
4715
  this.options = options;
@@ -4765,6 +4717,7 @@ var StageRevertDataPlugin = function() {
4765
4717
  this.ASTMap = /* @__PURE__ */ new Map();
4766
4718
  this.logger = options.logger;
4767
4719
  this.idCache = /* @__PURE__ */ new Set();
4720
+ this.AsyncIdMap = /* @__PURE__ */ new Map();
4768
4721
  }
4769
4722
  _create_class(Resolver, [
4770
4723
  {
@@ -4775,13 +4728,27 @@ var StageRevertDataPlugin = function() {
4775
4728
  },
4776
4729
  {
4777
4730
  key: "update",
4778
- value: function update(changes) {
4731
+ value: function update(changes, asyncChanges) {
4732
+ var _this = this;
4779
4733
  this.hooks.beforeUpdate.call(changes);
4780
4734
  var resolveCache = /* @__PURE__ */ new Map();
4781
4735
  this.idCache.clear();
4782
4736
  var prevASTMap = new Map(this.ASTMap);
4783
4737
  this.ASTMap.clear();
4784
- var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap);
4738
+ var prevAsyncIdMap = new Map(this.AsyncIdMap);
4739
+ var nextAsyncIdMap = /* @__PURE__ */ new Map();
4740
+ asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
4741
+ var current = prevAsyncIdMap.get(id);
4742
+ while(current && prevASTMap.has(current)){
4743
+ var next = prevASTMap.get(current);
4744
+ if (next && _this.resolveCache.has(next)) {
4745
+ _this.resolveCache.delete(next);
4746
+ }
4747
+ current = current.parent;
4748
+ }
4749
+ });
4750
+ var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
4751
+ this.AsyncIdMap = nextAsyncIdMap;
4785
4752
  this.resolveCache = resolveCache;
4786
4753
  this.hooks.afterUpdate.call(updated.value);
4787
4754
  return updated.value;
@@ -4826,7 +4793,7 @@ var StageRevertDataPlugin = function() {
4826
4793
  Object.keys(clonedNode).forEach(function(key) {
4827
4794
  if (key === "parent") return;
4828
4795
  var value = clonedNode[key];
4829
- if (typeof value === "object" && value !== null) {
4796
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
4830
4797
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
4831
4798
  }
4832
4799
  });
@@ -4835,9 +4802,8 @@ var StageRevertDataPlugin = function() {
4835
4802
  },
4836
4803
  {
4837
4804
  key: "computeTree",
4838
- value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4805
+ value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
4839
4806
  var _this = this;
4840
- var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4841
4807
  var dependencyModel = new DependencyModel(options.data.model);
4842
4808
  dependencyModel.trackSubset("core");
4843
4809
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4856,15 +4822,6 @@ var StageRevertDataPlugin = function() {
4856
4822
  var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
4857
4823
  var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
4858
4824
  var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
4859
- var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4860
- parent: partiallyResolvedParent
4861
- });
4862
- var _this_hooks_beforeResolve_call;
4863
- var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4864
- type: "empty"
4865
- };
4866
- var isNestedMultiNodeWithAsync = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : (_partiallyResolvedParent_parent_parent = _partiallyResolvedParent_parent.parent) === null || _partiallyResolvedParent_parent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent_parent.type) === "multi-node" && partiallyResolvedParent.parent.type === "value" && ((_resolvedAST_parent = resolvedAST.parent) === null || _resolvedAST_parent === void 0 ? void 0 : _resolvedAST_parent.type) === "asset" && resolvedAST.parent.value.id.includes("async");
4867
- var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent1 = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent1 === void 0 ? void 0 : _partiallyResolvedParent_parent1.type) === "multi-node" && partiallyResolvedParent.type === "value";
4868
4825
  if (previousResult && shouldUseLastValue) {
4869
4826
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4870
4827
  updated: false
@@ -4876,6 +4833,30 @@ var StageRevertDataPlugin = function() {
4876
4833
  updated: false
4877
4834
  });
4878
4835
  cacheUpdate.set(AST, resolvedUpdate);
4836
+ if (resolvedUpdate.node.type === "async") {
4837
+ nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
4838
+ }
4839
+ var _resolvedUpdate_node_asyncNodesResolved;
4840
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4841
+ try {
4842
+ for(var _iterator = ((_resolvedUpdate_node_asyncNodesResolved = resolvedUpdate.node.asyncNodesResolved) !== null && _resolvedUpdate_node_asyncNodesResolved !== void 0 ? _resolvedUpdate_node_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4843
+ var key = _step.value;
4844
+ nextAsyncIdMap.set(key, resolvedUpdate.node);
4845
+ }
4846
+ } catch (err) {
4847
+ _didIteratorError = true;
4848
+ _iteratorError = err;
4849
+ } finally{
4850
+ try {
4851
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4852
+ _iterator.return();
4853
+ }
4854
+ } finally{
4855
+ if (_didIteratorError) {
4856
+ throw _iteratorError;
4857
+ }
4858
+ }
4859
+ }
4879
4860
  var handleChildNode = function(childNode) {
4880
4861
  var _prevASTMap_get;
4881
4862
  var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
@@ -4898,10 +4879,37 @@ var StageRevertDataPlugin = function() {
4898
4879
  repopulateASTMapFromCache(previousResult, node, rawParent);
4899
4880
  return update2;
4900
4881
  }
4901
- if (isNestedMultiNodeWithAsync) {
4902
- resolvedAST.parent = partiallyResolvedParent.parent;
4903
- } else {
4904
- resolvedAST.parent = partiallyResolvedParent;
4882
+ var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4883
+ parent: partiallyResolvedParent
4884
+ });
4885
+ var _this_hooks_beforeResolve_call;
4886
+ var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4887
+ type: "empty"
4888
+ };
4889
+ resolvedAST.parent = partiallyResolvedParent;
4890
+ if (resolvedAST.type === "async") {
4891
+ nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
4892
+ }
4893
+ var _resolvedAST_asyncNodesResolved;
4894
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4895
+ try {
4896
+ for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4897
+ var id = _step.value;
4898
+ nextAsyncIdMap.set(id, resolvedAST);
4899
+ }
4900
+ } catch (err) {
4901
+ _didIteratorError = true;
4902
+ _iteratorError = err;
4903
+ } finally{
4904
+ try {
4905
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4906
+ _iterator.return();
4907
+ }
4908
+ } finally{
4909
+ if (_didIteratorError) {
4910
+ throw _iteratorError;
4911
+ }
4912
+ }
4905
4913
  }
4906
4914
  resolveOptions.node = resolvedAST;
4907
4915
  this.ASTMap.set(resolvedAST, node);
@@ -4915,7 +4923,7 @@ var StageRevertDataPlugin = function() {
4915
4923
  if ("children" in resolvedAST) {
4916
4924
  var _resolvedAST_children;
4917
4925
  var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
4918
- var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4926
+ var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
4919
4927
  var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
4920
4928
  childTreeDeps.forEach(function(binding) {
4921
4929
  return childDependencies.add(binding);
@@ -4936,40 +4944,18 @@ var StageRevertDataPlugin = function() {
4936
4944
  resolvedAST.children = newChildren;
4937
4945
  } else if (resolvedAST.type === "multi-node") {
4938
4946
  var childValue = [];
4939
- var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
4940
- var hasAsync = resolvedAST.values.map(function(value, index) {
4941
- return value.type === "async" ? index : -1;
4942
- }).filter(function(index) {
4943
- return index !== -1;
4944
- });
4945
- var newValues = resolvedAST.values.map(function(mValue) {
4946
- var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
4947
+ var rawParentToPassIn = node;
4948
+ resolvedAST.values = resolvedAST.values.map(function(mValue) {
4949
+ var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
4947
4950
  if (mTree.value !== void 0 && mTree.value !== null) {
4948
- if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
4949
- unpackAndPush(mTree.value, childValue);
4950
- } else {
4951
- childValue.push(mTree.value);
4952
- }
4951
+ mTree.dependencies.forEach(function(bindingDep) {
4952
+ return childDependencies.add(bindingDep);
4953
+ });
4954
+ updated = updated || mTree.updated;
4955
+ childValue.push(mTree.value);
4953
4956
  }
4954
- mTree.dependencies.forEach(function(bindingDep) {
4955
- return childDependencies.add(bindingDep);
4956
- });
4957
- updated = updated || mTree.updated;
4958
4957
  return mTree.node;
4959
4958
  });
4960
- if (hasAsync.length > 0) {
4961
- var copy = newValues;
4962
- hasAsync.forEach(function(index) {
4963
- var _copy;
4964
- if (copy[index]) (_copy = copy).splice.apply(_copy, [
4965
- index,
4966
- 1
4967
- ].concat(_to_consumable_array(unpackNode(copy[index]))));
4968
- });
4969
- resolvedAST.values = copy;
4970
- } else {
4971
- resolvedAST.values = newValues;
4972
- }
4973
4959
  resolved = childValue;
4974
4960
  }
4975
4961
  childDependencies.forEach(function(bindingDep) {
@@ -4990,7 +4976,7 @@ var StageRevertDataPlugin = function() {
4990
4976
  value: resolved,
4991
4977
  dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
4992
4978
  };
4993
- this.hooks.afterNodeUpdate.call(node, isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : rawParent, update);
4979
+ this.hooks.afterNodeUpdate.call(node, rawParent, update);
4994
4980
  cacheUpdate.set(node, update);
4995
4981
  return update;
4996
4982
  }
@@ -4998,15 +4984,6 @@ var StageRevertDataPlugin = function() {
4998
4984
  ]);
4999
4985
  return Resolver;
5000
4986
  }();
5001
- function unpackAndPush(item, initial) {
5002
- if (item.asset.values && Array.isArray(item.asset.values)) {
5003
- item.asset.values.forEach(function(i) {
5004
- unpackAndPush(i, initial);
5005
- });
5006
- } else {
5007
- initial.push(item);
5008
- }
5009
- }
5010
4987
  var CrossfieldProvider = /*#__PURE__*/ function() {
5011
4988
  function CrossfieldProvider(initialView, parser, logger) {
5012
4989
  _class_call_check(this, CrossfieldProvider);
@@ -5074,9 +5051,11 @@ var StageRevertDataPlugin = function() {
5074
5051
  _create_class(ViewInstance, [
5075
5052
  {
5076
5053
  key: "updateAsync",
5077
- value: function updateAsync() {
5054
+ value: function updateAsync(asyncNode) {
5078
5055
  var _this_resolver;
5079
- var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update();
5056
+ var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
5057
+ asyncNode
5058
+ ]));
5080
5059
  this.lastUpdate = update;
5081
5060
  this.hooks.onUpdate.call(update);
5082
5061
  }
@@ -5166,7 +5145,7 @@ var StageRevertDataPlugin = function() {
5166
5145
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5167
5146
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5168
5147
  var flags = "g";
5169
- if (typeof expression === "object") {
5148
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5170
5149
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5171
5150
  }
5172
5151
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5315,7 +5294,7 @@ var StageRevertDataPlugin = function() {
5315
5294
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5316
5295
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5317
5296
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5318
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5297
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5319
5298
  return node;
5320
5299
  }
5321
5300
  if (typeof node === "string") {
@@ -5328,7 +5307,7 @@ var StageRevertDataPlugin = function() {
5328
5307
  }
5329
5308
  var val = node[key];
5330
5309
  var newVal = val;
5331
- if (typeof val === "object") {
5310
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5332
5311
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5333
5312
  } else if (typeof val === "string") {
5334
5313
  newVal = resolveString(val, resolveOptions);
@@ -5617,7 +5596,7 @@ var StageRevertDataPlugin = function() {
5617
5596
  key: "applyParser",
5618
5597
  value: function applyParser(parser) {
5619
5598
  parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
5620
- if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
5599
+ if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
5621
5600
  var values = obj.map(function(childVal) {
5622
5601
  return parser.parseObject(childVal, "value", options);
5623
5602
  }).filter(function(child) {
@@ -5628,7 +5607,7 @@ var StageRevertDataPlugin = function() {
5628
5607
  }
5629
5608
  var multiNode = parser.createASTNode({
5630
5609
  type: "multi-node",
5631
- override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
5610
+ override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
5632
5611
  values: values
5633
5612
  }, obj);
5634
5613
  if (!multiNode) {
@@ -5639,7 +5618,7 @@ var StageRevertDataPlugin = function() {
5639
5618
  v.parent = multiNode;
5640
5619
  });
5641
5620
  }
5642
- return [
5621
+ return childOptions === void 0 ? multiNode : [
5643
5622
  {
5644
5623
  path: _to_consumable_array(childOptions.path).concat([
5645
5624
  childOptions.key
@@ -5669,7 +5648,7 @@ var StageRevertDataPlugin = function() {
5669
5648
  key: "applyParser",
5670
5649
  value: function applyParser(parser) {
5671
5650
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5672
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
5651
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
5673
5652
  var assetAST = parser.parseObject(obj, "asset", options);
5674
5653
  if (!assetAST) {
5675
5654
  return [];
@@ -5869,6 +5848,7 @@ var StageRevertDataPlugin = function() {
5869
5848
  }();
5870
5849
  var FlowInstance = /*#__PURE__*/ function() {
5871
5850
  function FlowInstance(id, flow, options) {
5851
+ var _this = this;
5872
5852
  _class_call_check(this, FlowInstance);
5873
5853
  this.isTransitioning = false;
5874
5854
  this.hooks = {
@@ -5885,60 +5865,55 @@ var StageRevertDataPlugin = function() {
5885
5865
  this.flow = flow;
5886
5866
  this.log = options === null || options === void 0 ? void 0 : options.logger;
5887
5867
  this.history = [];
5888
- var _this = this;
5889
- this.hooks.transition.tap("startPromise", function() {
5890
- var _ref = _async_to_generator(function(_oldState, nextState) {
5868
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
5869
+ return _async_to_generator(function() {
5891
5870
  var newState;
5892
5871
  return _ts_generator(this, function(_state) {
5893
5872
  newState = nextState.value;
5894
- if (_this.flowPromise && newState.state_type === "END") {
5895
- _this.flowPromise.resolve(newState);
5873
+ if (this.flowPromise && newState.state_type === "END") {
5874
+ this.flowPromise.resolve(newState);
5896
5875
  }
5897
5876
  return [
5898
5877
  2
5899
5878
  ];
5900
5879
  });
5901
- });
5902
- return function(_oldState, nextState) {
5903
- return _ref.apply(this, arguments);
5904
- };
5905
- }());
5880
+ }).call(_this);
5881
+ });
5906
5882
  }
5907
5883
  _create_class(FlowInstance, [
5908
5884
  {
5909
5885
  key: "start",
5910
5886
  value: /** Start the state machine */ function start() {
5911
- var _this = this;
5912
5887
  return _async_to_generator(function() {
5913
5888
  var _this_log, initialState;
5914
5889
  return _ts_generator(this, function(_state) {
5915
- if (_this.flowPromise) {
5890
+ if (this.flowPromise) {
5916
5891
  ;
5917
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
5892
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
5918
5893
  return [
5919
5894
  2,
5920
- _this.flowPromise.promise
5895
+ this.flowPromise.promise
5921
5896
  ];
5922
5897
  }
5923
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
5924
- if (_this.flow.onStart) {
5925
- _this.hooks.onStart.call(_this.flow.onStart);
5898
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
5899
+ if (this.flow.onStart) {
5900
+ this.hooks.onStart.call(this.flow.onStart);
5926
5901
  }
5927
- initialState = _this.flow.startState;
5902
+ initialState = this.flow.startState;
5928
5903
  if (!initialState) {
5929
5904
  return [
5930
5905
  2,
5931
5906
  Promise.reject(new Error("No 'startState' defined for flow"))
5932
5907
  ];
5933
5908
  }
5934
- _this.flowPromise = (0, import_p_defer2.default)();
5935
- _this.pushHistory(initialState);
5909
+ this.flowPromise = (0, import_p_defer2.default)();
5910
+ this.pushHistory(initialState);
5936
5911
  return [
5937
5912
  2,
5938
- _this.flowPromise.promise
5913
+ this.flowPromise.promise
5939
5914
  ];
5940
5915
  });
5941
- })();
5916
+ }).call(this);
5942
5917
  }
5943
5918
  },
5944
5919
  {
@@ -5990,7 +5965,7 @@ var StageRevertDataPlugin = function() {
5990
5965
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
5991
5966
  }
5992
5967
  var nextState = this.flow[stateName];
5993
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
5968
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
5994
5969
  var _this_log;
5995
5970
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
5996
5971
  return;
@@ -6050,30 +6025,30 @@ var StageRevertDataPlugin = function() {
6050
6025
  {
6051
6026
  key: "run",
6052
6027
  value: function run(startState) {
6053
- var _this = this;
6054
6028
  return _async_to_generator(function() {
6055
- var _this_log, startFlow, flow, end, firstItem;
6029
+ var _this, _this_log, startFlow, flow, end, firstItem;
6056
6030
  return _ts_generator(this, function(_state) {
6057
6031
  switch(_state.label){
6058
6032
  case 0:
6059
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6033
+ _this = this;
6034
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6060
6035
  return [
6061
6036
  2,
6062
6037
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6063
6038
  ];
6064
6039
  }
6065
- startFlow = _this.navigation[startState];
6066
- if (startFlow === null || typeof startFlow !== "object") {
6040
+ startFlow = this.navigation[startState];
6041
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6067
6042
  return [
6068
6043
  2,
6069
6044
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6070
6045
  ];
6071
6046
  }
6072
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6047
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6073
6048
  flow = new FlowInstance(startState, startFlow, {
6074
- logger: _this.log
6049
+ logger: this.log
6075
6050
  });
6076
- _this.addNewFlow(flow);
6051
+ this.addNewFlow(flow);
6077
6052
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6078
6053
  var _flowInstance_currentState;
6079
6054
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6093,10 +6068,10 @@ var StageRevertDataPlugin = function() {
6093
6068
  ];
6094
6069
  case 1:
6095
6070
  end = _state.sent();
6096
- _this.navStack.pop();
6097
- if (_this.navStack.length > 0) {
6071
+ this.navStack.pop();
6072
+ if (this.navStack.length > 0) {
6098
6073
  firstItem = 0;
6099
- _this.current = _this.navStack[firstItem];
6074
+ this.current = this.navStack[firstItem];
6100
6075
  }
6101
6076
  return [
6102
6077
  2,
@@ -6104,16 +6079,15 @@ var StageRevertDataPlugin = function() {
6104
6079
  ];
6105
6080
  }
6106
6081
  });
6107
- })();
6082
+ }).call(this);
6108
6083
  }
6109
6084
  },
6110
6085
  {
6111
6086
  key: "start",
6112
6087
  value: function start() {
6113
- var _this = this;
6114
6088
  return _async_to_generator(function() {
6115
6089
  return _ts_generator(this, function(_state) {
6116
- if (!_this.navigation.BEGIN) {
6090
+ if (!this.navigation.BEGIN) {
6117
6091
  return [
6118
6092
  2,
6119
6093
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6121,10 +6095,10 @@ var StageRevertDataPlugin = function() {
6121
6095
  }
6122
6096
  return [
6123
6097
  2,
6124
- _this.run(_this.navigation.BEGIN)
6098
+ this.run(this.navigation.BEGIN)
6125
6099
  ];
6126
6100
  });
6127
- })();
6101
+ }).call(this);
6128
6102
  }
6129
6103
  }
6130
6104
  ]);
@@ -7231,7 +7205,7 @@ var StageRevertDataPlugin = function() {
7231
7205
  var parentBinding = resolved.parent();
7232
7206
  var property = resolved.key();
7233
7207
  var parentValue = this.get(parentBinding);
7234
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7208
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7235
7209
  this.getModel().delete(resolved, options);
7236
7210
  if (existedBeforeDelete && !this.get(resolved)) {
7237
7211
  this.trash.add(resolved);
@@ -7332,7 +7306,7 @@ var StageRevertDataPlugin = function() {
7332
7306
  var expressionEvaluator;
7333
7307
  var handleEval = function(exp) {
7334
7308
  if (exp) {
7335
- if (typeof exp === "object" && "exp" in exp) {
7309
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7336
7310
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7337
7311
  } else {
7338
7312
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -7593,7 +7567,7 @@ var StageRevertDataPlugin = function() {
7593
7567
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
7594
7568
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
7595
7569
  if (state.onEnd && state.transitions[computedTransitionVal]) {
7596
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
7570
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
7597
7571
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
7598
7572
  } else {
7599
7573
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -7752,12 +7726,12 @@ var StageRevertDataPlugin = function() {
7752
7726
  {
7753
7727
  key: "start",
7754
7728
  value: function start(payload) {
7755
- var _this = this;
7756
7729
  return _async_to_generator(function() {
7757
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7730
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7758
7731
  return _ts_generator(this, function(_state) {
7759
7732
  switch(_state.label){
7760
7733
  case 0:
7734
+ _this = this;
7761
7735
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
7762
7736
  maybeUpdateState = function(newState) {
7763
7737
  if (_this.state.ref !== ref) {
@@ -7767,7 +7741,7 @@ var StageRevertDataPlugin = function() {
7767
7741
  _this.setState(newState);
7768
7742
  return newState;
7769
7743
  };
7770
- _this.setState({
7744
+ this.setState({
7771
7745
  status: "not-started",
7772
7746
  ref: ref
7773
7747
  });
@@ -7779,8 +7753,8 @@ var StageRevertDataPlugin = function() {
7779
7753
  ,
7780
7754
  4
7781
7755
  ]);
7782
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7783
- _this.setState(_object_spread({
7756
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7757
+ this.setState(_object_spread({
7784
7758
  ref: ref
7785
7759
  }, state));
7786
7760
  start();
@@ -7825,7 +7799,7 @@ var StageRevertDataPlugin = function() {
7825
7799
  ];
7826
7800
  }
7827
7801
  });
7828
- })();
7802
+ }).call(this);
7829
7803
  }
7830
7804
  }
7831
7805
  ]);