@player-ui/metrics-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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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 MetricsPlugin = 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
  });
@@ -2301,10 +2270,9 @@ var MetricsPlugin = function() {
2301
2270
  }();
2302
2271
  var SyncHook = /*#__PURE__*/ function(Hook) {
2303
2272
  _inherits(SyncHook, Hook);
2304
- var _super = _create_super(SyncHook);
2305
2273
  function SyncHook() {
2306
2274
  _class_call_check(this, SyncHook);
2307
- return _super.apply(this, arguments);
2275
+ return _call_super(this, SyncHook, arguments);
2308
2276
  }
2309
2277
  _create_class(SyncHook, [
2310
2278
  {
@@ -2337,10 +2305,9 @@ var MetricsPlugin = function() {
2337
2305
  }(Hook);
2338
2306
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2339
2307
  _inherits(SyncBailHook, Hook);
2340
- var _super = _create_super(SyncBailHook);
2341
2308
  function SyncBailHook() {
2342
2309
  _class_call_check(this, SyncBailHook);
2343
- return _super.apply(this, arguments);
2310
+ return _call_super(this, SyncBailHook, arguments);
2344
2311
  }
2345
2312
  _create_class(SyncBailHook, [
2346
2313
  {
@@ -2372,10 +2339,9 @@ var MetricsPlugin = function() {
2372
2339
  }(Hook);
2373
2340
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2374
2341
  _inherits(SyncWaterfallHook, Hook);
2375
- var _super = _create_super(SyncWaterfallHook);
2376
2342
  function SyncWaterfallHook() {
2377
2343
  _class_call_check(this, SyncWaterfallHook);
2378
- return _super.apply(this, arguments);
2344
+ return _call_super(this, SyncWaterfallHook, arguments);
2379
2345
  }
2380
2346
  _create_class(SyncWaterfallHook, [
2381
2347
  {
@@ -2407,10 +2373,9 @@ var MetricsPlugin = function() {
2407
2373
  }(Hook);
2408
2374
  var AsyncSeriesWaterfallHook = /*#__PURE__*/ function(Hook) {
2409
2375
  _inherits(AsyncSeriesWaterfallHook, Hook);
2410
- var _super = _create_super(AsyncSeriesWaterfallHook);
2411
2376
  function AsyncSeriesWaterfallHook() {
2412
2377
  _class_call_check(this, AsyncSeriesWaterfallHook);
2413
- return _super.apply(this, arguments);
2378
+ return _call_super(this, AsyncSeriesWaterfallHook, arguments);
2414
2379
  }
2415
2380
  _create_class(AsyncSeriesWaterfallHook, [
2416
2381
  {
@@ -2419,7 +2384,6 @@ var MetricsPlugin = function() {
2419
2384
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2420
2385
  args[_key] = arguments[_key];
2421
2386
  }
2422
- var _this = this;
2423
2387
  return _async_to_generator(function() {
2424
2388
  var _this_interceptions, _args, rtn, rest, ctx, tapIndex, tapValue, e;
2425
2389
  return _ts_generator(this, function(_state) {
@@ -2427,7 +2391,7 @@ var MetricsPlugin = function() {
2427
2391
  case 0:
2428
2392
  _args = _to_array(args), rtn = _args[0], rest = _args.slice(1);
2429
2393
  ctx = {};
2430
- (_this_interceptions = _this.interceptions).call.apply(_this_interceptions, [
2394
+ (_this_interceptions = this.interceptions).call.apply(_this_interceptions, [
2431
2395
  ctx
2432
2396
  ].concat(_to_consumable_array(args)));
2433
2397
  _state.label = 1;
@@ -2441,13 +2405,13 @@ var MetricsPlugin = function() {
2441
2405
  tapIndex = 0;
2442
2406
  _state.label = 2;
2443
2407
  case 2:
2444
- if (!(tapIndex < _this.taps.length)) return [
2408
+ if (!(tapIndex < this.taps.length)) return [
2445
2409
  3,
2446
2410
  5
2447
2411
  ];
2448
2412
  return [
2449
2413
  4,
2450
- callTap(_this.taps[tapIndex], [
2414
+ callTap(this.taps[tapIndex], [
2451
2415
  rtn
2452
2416
  ].concat(_to_consumable_array(rest)), ctx)
2453
2417
  ];
@@ -2470,17 +2434,17 @@ var MetricsPlugin = function() {
2470
2434
  ];
2471
2435
  case 6:
2472
2436
  e = _state.sent();
2473
- _this.interceptions.error(e);
2437
+ this.interceptions.error(e);
2474
2438
  throw e;
2475
2439
  case 7:
2476
- _this.interceptions.result(rtn);
2440
+ this.interceptions.result(rtn);
2477
2441
  return [
2478
2442
  2,
2479
2443
  rtn
2480
2444
  ];
2481
2445
  }
2482
2446
  });
2483
- })();
2447
+ }).call(this);
2484
2448
  }
2485
2449
  }
2486
2450
  ]);
@@ -2518,7 +2482,7 @@ var MetricsPlugin = function() {
2518
2482
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2519
2483
  len = _step.value;
2520
2484
  tmp = len;
2521
- if (tmp && typeof tmp === "object") {
2485
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2522
2486
  tmp = find(bar, tmp);
2523
2487
  if (!tmp) return false;
2524
2488
  }
@@ -2549,7 +2513,7 @@ var MetricsPlugin = function() {
2549
2513
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2550
2514
  len = _step1.value;
2551
2515
  tmp = len[0];
2552
- if (tmp && typeof tmp === "object") {
2516
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2553
2517
  tmp = find(bar, tmp);
2554
2518
  if (!tmp) return false;
2555
2519
  }
@@ -2588,7 +2552,7 @@ var MetricsPlugin = function() {
2588
2552
  }
2589
2553
  return len === -1;
2590
2554
  }
2591
- if (!ctor || typeof foo === "object") {
2555
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2592
2556
  len = 0;
2593
2557
  for(ctor in foo){
2594
2558
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -2621,7 +2585,7 @@ var MetricsPlugin = function() {
2621
2585
  var nestedPath = _to_consumable_array(path).concat([
2622
2586
  key
2623
2587
  ]);
2624
- if (typeof val === "object") {
2588
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2625
2589
  traverseObj(val, nestedPath, pairs);
2626
2590
  } else {
2627
2591
  pairs.set(nestedPath, val);
@@ -2662,7 +2626,7 @@ var MetricsPlugin = function() {
2662
2626
  {
2663
2627
  /** Add match -> value mapping to the registry */ key: "set",
2664
2628
  value: function set(match, value) {
2665
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2629
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2666
2630
  this.store.insert({
2667
2631
  key: match,
2668
2632
  value: value,
@@ -2825,6 +2789,7 @@ var MetricsPlugin = function() {
2825
2789
  }
2826
2790
  };
2827
2791
  var identifier = function() {
2792
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2828
2793
  if (!isIdentifierChar(ch)) {
2829
2794
  return;
2830
2795
  }
@@ -2835,6 +2800,14 @@ var MetricsPlugin = function() {
2835
2800
  }
2836
2801
  value += ch;
2837
2802
  }
2803
+ if (allowBoolValue) {
2804
+ if (value === "true") {
2805
+ return toValue(true);
2806
+ }
2807
+ if (value === "false") {
2808
+ return toValue(false);
2809
+ }
2810
+ }
2838
2811
  if (value) {
2839
2812
  var maybeNumber = Number(value);
2840
2813
  value = isNaN(maybeNumber) ? value : maybeNumber;
@@ -2883,8 +2856,9 @@ var MetricsPlugin = function() {
2883
2856
  }
2884
2857
  };
2885
2858
  var simpleSegment = function() {
2859
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2886
2860
  var _nestedPath, _ref;
2887
- return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
2861
+ return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
2888
2862
  };
2889
2863
  var segment = function() {
2890
2864
  var segments = [];
@@ -2899,6 +2873,7 @@ var MetricsPlugin = function() {
2899
2873
  return toConcatenatedNode(segments);
2900
2874
  };
2901
2875
  var optionallyQuotedSegment = function() {
2876
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2902
2877
  whitespace();
2903
2878
  if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
2904
2879
  var singleQuote = ch === SINGLE_QUOTE;
@@ -2907,7 +2882,7 @@ var MetricsPlugin = function() {
2907
2882
  next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
2908
2883
  return id;
2909
2884
  }
2910
- return simpleSegment();
2885
+ return simpleSegment(allowBoolValue);
2911
2886
  };
2912
2887
  var equals = function() {
2913
2888
  if (ch !== EQUALS) {
@@ -2927,7 +2902,7 @@ var MetricsPlugin = function() {
2927
2902
  whitespace();
2928
2903
  if (equals()) {
2929
2904
  whitespace();
2930
- var second = optionallyQuotedSegment();
2905
+ var second = optionallyQuotedSegment(true);
2931
2906
  value = toQuery(value, second);
2932
2907
  whitespace();
2933
2908
  }
@@ -3115,7 +3090,7 @@ var MetricsPlugin = function() {
3115
3090
  appendPathSegments(getValueForNode(resolvedNode));
3116
3091
  break;
3117
3092
  case "Value":
3118
- appendPathSegments(resolvedNode.value);
3093
+ appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
3119
3094
  break;
3120
3095
  case "Query":
3121
3096
  {
@@ -3191,7 +3166,7 @@ var MetricsPlugin = function() {
3191
3166
  var _this_parseCache_path;
3192
3167
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3193
3168
  this.parseCache[path] = ast;
3194
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3169
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3195
3170
  var _ast_error;
3196
3171
  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."));
3197
3172
  }
@@ -3391,14 +3366,13 @@ var MetricsPlugin = function() {
3391
3366
  }();
3392
3367
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3393
3368
  _inherits(DependencyModel, DependencyTracker);
3394
- var _super = _create_super(DependencyModel);
3395
3369
  function DependencyModel(rootModel) {
3396
3370
  _class_call_check(this, DependencyModel);
3397
3371
  var _this;
3398
- _this = _super.call(this);
3372
+ _this = _call_super(this, DependencyModel);
3399
3373
  _this.rootModel = rootModel;
3400
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3401
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3374
+ _this.set = _this.set.bind(_this);
3375
+ _this.get = _this.get.bind(_this);
3402
3376
  return _this;
3403
3377
  }
3404
3378
  _create_class(DependencyModel, [
@@ -3942,23 +3916,20 @@ var MetricsPlugin = function() {
3942
3916
  * @experimental These Player APIs are in active development and may change. Use with caution
3943
3917
  */ key: "evaluateAsync",
3944
3918
  value: function evaluateAsync(expr, options) {
3919
+ var _this = this;
3945
3920
  if (Array.isArray(expr)) {
3946
- var _this = this;
3947
- return collateAwaitable(expr.map(function() {
3948
- var _ref = _async_to_generator(function(exp) {
3921
+ return collateAwaitable(expr.map(function(exp) {
3922
+ return _async_to_generator(function() {
3949
3923
  return _ts_generator(this, function(_state) {
3950
3924
  return [
3951
3925
  2,
3952
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3926
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3953
3927
  async: true
3954
3928
  }))
3955
3929
  ];
3956
3930
  });
3957
- });
3958
- return function(exp) {
3959
- return _ref.apply(this, arguments);
3960
- };
3961
- }())).awaitableThen(function(values) {
3931
+ }).call(_this);
3932
+ })).awaitableThen(function(values) {
3962
3933
  return values.pop();
3963
3934
  });
3964
3935
  } else {
@@ -4682,23 +4653,8 @@ var MetricsPlugin = function() {
4682
4653
  function Parser() {
4683
4654
  _class_call_check(this, Parser);
4684
4655
  this.hooks = {
4685
- /**
4686
- * A hook to interact with an object _before_ parsing it into an AST
4687
- *
4688
- * @param value - The object we're are about to parse
4689
- * @returns - A new value to parse.
4690
- * If undefined, the original value is used.
4691
- * If null, we stop parsing this node.
4692
- */ onParseObject: new SyncWaterfallHook(),
4693
- /**
4694
- * A callback to interact with an AST _after_ we parse it into the AST
4695
- *
4696
- * @param value - The object we parsed
4697
- * @param node - The AST node we generated
4698
- * @returns - A new AST node to use
4699
- * If undefined, the original value is used.
4700
- * If null, we ignore this node all together
4701
- */ onCreateASTNode: new SyncWaterfallHook(),
4656
+ onParseObject: new SyncWaterfallHook(),
4657
+ onCreateASTNode: new SyncWaterfallHook(),
4702
4658
  parseNode: new SyncBailHook()
4703
4659
  };
4704
4660
  }
@@ -4736,7 +4692,7 @@ var MetricsPlugin = function() {
4736
4692
  }
4737
4693
  var parseLocalObject = function(currentValue, objToParse) {
4738
4694
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4739
- if (typeof objToParse !== "object" || objToParse === null) {
4695
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4740
4696
  return {
4741
4697
  value: objToParse,
4742
4698
  children: []
@@ -4773,7 +4729,7 @@ var MetricsPlugin = function() {
4773
4729
  if (newChildren) {
4774
4730
  var _children2;
4775
4731
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4776
- } else if (localValue && typeof localValue === "object") {
4732
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4777
4733
  var _children21;
4778
4734
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4779
4735
  localKey
@@ -4840,20 +4796,14 @@ var MetricsPlugin = function() {
4840
4796
  function Resolver(root, options) {
4841
4797
  _class_call_check(this, Resolver);
4842
4798
  this.hooks = {
4843
- /** A hook to allow skipping of the resolution tree for a specific node */ skipResolve: new SyncWaterfallHook(),
4844
- /** An event emitted before calculating the next update */ beforeUpdate: new SyncHook(),
4845
- /** An event emitted after calculating the next update */ afterUpdate: new SyncHook(),
4846
- /** The options passed to a node to resolve it to an object */ resolveOptions: new SyncWaterfallHook(),
4847
- /** A hook to transform the AST node into a new AST node before resolving it */ beforeResolve: new SyncWaterfallHook(),
4848
- /**
4849
- * A hook to transform an AST node into it's resolved value.
4850
- * This runs _before_ any children are resolved
4851
- */ resolve: new SyncWaterfallHook(),
4852
- /**
4853
- * A hook to transform the resolved value of an AST node.
4854
- * This runs _after_ all children nodes are resolved
4855
- */ afterResolve: new SyncWaterfallHook(),
4856
- /** Called at the very end of a node's tree being updated */ afterNodeUpdate: new SyncHook()
4799
+ skipResolve: new SyncWaterfallHook(),
4800
+ beforeUpdate: new SyncHook(),
4801
+ afterUpdate: new SyncHook(),
4802
+ resolveOptions: new SyncWaterfallHook(),
4803
+ beforeResolve: new SyncWaterfallHook(),
4804
+ resolve: new SyncWaterfallHook(),
4805
+ afterResolve: new SyncWaterfallHook(),
4806
+ afterNodeUpdate: new SyncHook()
4857
4807
  };
4858
4808
  this.root = root;
4859
4809
  this.options = options;
@@ -4861,6 +4811,7 @@ var MetricsPlugin = function() {
4861
4811
  this.ASTMap = /* @__PURE__ */ new Map();
4862
4812
  this.logger = options.logger;
4863
4813
  this.idCache = /* @__PURE__ */ new Set();
4814
+ this.AsyncIdMap = /* @__PURE__ */ new Map();
4864
4815
  }
4865
4816
  _create_class(Resolver, [
4866
4817
  {
@@ -4871,13 +4822,27 @@ var MetricsPlugin = function() {
4871
4822
  },
4872
4823
  {
4873
4824
  key: "update",
4874
- value: function update(changes) {
4825
+ value: function update(changes, asyncChanges) {
4826
+ var _this = this;
4875
4827
  this.hooks.beforeUpdate.call(changes);
4876
4828
  var resolveCache = /* @__PURE__ */ new Map();
4877
4829
  this.idCache.clear();
4878
4830
  var prevASTMap = new Map(this.ASTMap);
4879
4831
  this.ASTMap.clear();
4880
- var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap);
4832
+ var prevAsyncIdMap = new Map(this.AsyncIdMap);
4833
+ var nextAsyncIdMap = /* @__PURE__ */ new Map();
4834
+ asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
4835
+ var current = prevAsyncIdMap.get(id);
4836
+ while(current && prevASTMap.has(current)){
4837
+ var next = prevASTMap.get(current);
4838
+ if (next && _this.resolveCache.has(next)) {
4839
+ _this.resolveCache.delete(next);
4840
+ }
4841
+ current = current.parent;
4842
+ }
4843
+ });
4844
+ var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
4845
+ this.AsyncIdMap = nextAsyncIdMap;
4881
4846
  this.resolveCache = resolveCache;
4882
4847
  this.hooks.afterUpdate.call(updated.value);
4883
4848
  return updated.value;
@@ -4922,7 +4887,7 @@ var MetricsPlugin = function() {
4922
4887
  Object.keys(clonedNode).forEach(function(key) {
4923
4888
  if (key === "parent") return;
4924
4889
  var value = clonedNode[key];
4925
- if (typeof value === "object" && value !== null) {
4890
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
4926
4891
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
4927
4892
  }
4928
4893
  });
@@ -4931,9 +4896,8 @@ var MetricsPlugin = function() {
4931
4896
  },
4932
4897
  {
4933
4898
  key: "computeTree",
4934
- value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4899
+ value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
4935
4900
  var _this = this;
4936
- var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4937
4901
  var dependencyModel = new DependencyModel(options.data.model);
4938
4902
  dependencyModel.trackSubset("core");
4939
4903
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4952,15 +4916,6 @@ var MetricsPlugin = function() {
4952
4916
  var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
4953
4917
  var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
4954
4918
  var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
4955
- var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4956
- parent: partiallyResolvedParent
4957
- });
4958
- var _this_hooks_beforeResolve_call;
4959
- var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4960
- type: "empty"
4961
- };
4962
- 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");
4963
- 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";
4964
4919
  if (previousResult && shouldUseLastValue) {
4965
4920
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4966
4921
  updated: false
@@ -4972,6 +4927,30 @@ var MetricsPlugin = function() {
4972
4927
  updated: false
4973
4928
  });
4974
4929
  cacheUpdate.set(AST, resolvedUpdate);
4930
+ if (resolvedUpdate.node.type === "async") {
4931
+ nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
4932
+ }
4933
+ var _resolvedUpdate_node_asyncNodesResolved;
4934
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4935
+ try {
4936
+ 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){
4937
+ var key = _step.value;
4938
+ nextAsyncIdMap.set(key, resolvedUpdate.node);
4939
+ }
4940
+ } catch (err) {
4941
+ _didIteratorError = true;
4942
+ _iteratorError = err;
4943
+ } finally{
4944
+ try {
4945
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4946
+ _iterator.return();
4947
+ }
4948
+ } finally{
4949
+ if (_didIteratorError) {
4950
+ throw _iteratorError;
4951
+ }
4952
+ }
4953
+ }
4975
4954
  var handleChildNode = function(childNode) {
4976
4955
  var _prevASTMap_get;
4977
4956
  var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
@@ -4994,10 +4973,37 @@ var MetricsPlugin = function() {
4994
4973
  repopulateASTMapFromCache(previousResult, node, rawParent);
4995
4974
  return update2;
4996
4975
  }
4997
- if (isNestedMultiNodeWithAsync) {
4998
- resolvedAST.parent = partiallyResolvedParent.parent;
4999
- } else {
5000
- resolvedAST.parent = partiallyResolvedParent;
4976
+ var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4977
+ parent: partiallyResolvedParent
4978
+ });
4979
+ var _this_hooks_beforeResolve_call;
4980
+ var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4981
+ type: "empty"
4982
+ };
4983
+ resolvedAST.parent = partiallyResolvedParent;
4984
+ if (resolvedAST.type === "async") {
4985
+ nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
4986
+ }
4987
+ var _resolvedAST_asyncNodesResolved;
4988
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4989
+ try {
4990
+ for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4991
+ var id = _step.value;
4992
+ nextAsyncIdMap.set(id, resolvedAST);
4993
+ }
4994
+ } catch (err) {
4995
+ _didIteratorError = true;
4996
+ _iteratorError = err;
4997
+ } finally{
4998
+ try {
4999
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5000
+ _iterator.return();
5001
+ }
5002
+ } finally{
5003
+ if (_didIteratorError) {
5004
+ throw _iteratorError;
5005
+ }
5006
+ }
5001
5007
  }
5002
5008
  resolveOptions.node = resolvedAST;
5003
5009
  this.ASTMap.set(resolvedAST, node);
@@ -5011,7 +5017,7 @@ var MetricsPlugin = function() {
5011
5017
  if ("children" in resolvedAST) {
5012
5018
  var _resolvedAST_children;
5013
5019
  var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
5014
- var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5020
+ var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5015
5021
  var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
5016
5022
  childTreeDeps.forEach(function(binding) {
5017
5023
  return childDependencies.add(binding);
@@ -5032,40 +5038,18 @@ var MetricsPlugin = function() {
5032
5038
  resolvedAST.children = newChildren;
5033
5039
  } else if (resolvedAST.type === "multi-node") {
5034
5040
  var childValue = [];
5035
- var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
5036
- var hasAsync = resolvedAST.values.map(function(value, index) {
5037
- return value.type === "async" ? index : -1;
5038
- }).filter(function(index) {
5039
- return index !== -1;
5040
- });
5041
- var newValues = resolvedAST.values.map(function(mValue) {
5042
- var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5041
+ var rawParentToPassIn = node;
5042
+ resolvedAST.values = resolvedAST.values.map(function(mValue) {
5043
+ var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5043
5044
  if (mTree.value !== void 0 && mTree.value !== null) {
5044
- if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
5045
- unpackAndPush(mTree.value, childValue);
5046
- } else {
5047
- childValue.push(mTree.value);
5048
- }
5045
+ mTree.dependencies.forEach(function(bindingDep) {
5046
+ return childDependencies.add(bindingDep);
5047
+ });
5048
+ updated = updated || mTree.updated;
5049
+ childValue.push(mTree.value);
5049
5050
  }
5050
- mTree.dependencies.forEach(function(bindingDep) {
5051
- return childDependencies.add(bindingDep);
5052
- });
5053
- updated = updated || mTree.updated;
5054
5051
  return mTree.node;
5055
5052
  });
5056
- if (hasAsync.length > 0) {
5057
- var copy = newValues;
5058
- hasAsync.forEach(function(index) {
5059
- var _copy;
5060
- if (copy[index]) (_copy = copy).splice.apply(_copy, [
5061
- index,
5062
- 1
5063
- ].concat(_to_consumable_array(unpackNode(copy[index]))));
5064
- });
5065
- resolvedAST.values = copy;
5066
- } else {
5067
- resolvedAST.values = newValues;
5068
- }
5069
5053
  resolved = childValue;
5070
5054
  }
5071
5055
  childDependencies.forEach(function(bindingDep) {
@@ -5086,7 +5070,7 @@ var MetricsPlugin = function() {
5086
5070
  value: resolved,
5087
5071
  dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
5088
5072
  };
5089
- this.hooks.afterNodeUpdate.call(node, isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : rawParent, update);
5073
+ this.hooks.afterNodeUpdate.call(node, rawParent, update);
5090
5074
  cacheUpdate.set(node, update);
5091
5075
  return update;
5092
5076
  }
@@ -5094,15 +5078,6 @@ var MetricsPlugin = function() {
5094
5078
  ]);
5095
5079
  return Resolver;
5096
5080
  }();
5097
- function unpackAndPush(item, initial) {
5098
- if (item.asset.values && Array.isArray(item.asset.values)) {
5099
- item.asset.values.forEach(function(i) {
5100
- unpackAndPush(i, initial);
5101
- });
5102
- } else {
5103
- initial.push(item);
5104
- }
5105
- }
5106
5081
  var CrossfieldProvider = /*#__PURE__*/ function() {
5107
5082
  function CrossfieldProvider(initialView, parser, logger) {
5108
5083
  _class_call_check(this, CrossfieldProvider);
@@ -5170,9 +5145,11 @@ var MetricsPlugin = function() {
5170
5145
  _create_class(ViewInstance, [
5171
5146
  {
5172
5147
  key: "updateAsync",
5173
- value: function updateAsync() {
5148
+ value: function updateAsync(asyncNode) {
5174
5149
  var _this_resolver;
5175
- var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update();
5150
+ var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
5151
+ asyncNode
5152
+ ]));
5176
5153
  this.lastUpdate = update;
5177
5154
  this.hooks.onUpdate.call(update);
5178
5155
  }
@@ -5262,7 +5239,7 @@ var MetricsPlugin = function() {
5262
5239
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5263
5240
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5264
5241
  var flags = "g";
5265
- if (typeof expression === "object") {
5242
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5266
5243
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5267
5244
  }
5268
5245
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5411,7 +5388,7 @@ var MetricsPlugin = function() {
5411
5388
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5412
5389
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5413
5390
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5414
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5391
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5415
5392
  return node;
5416
5393
  }
5417
5394
  if (typeof node === "string") {
@@ -5424,7 +5401,7 @@ var MetricsPlugin = function() {
5424
5401
  }
5425
5402
  var val = node[key];
5426
5403
  var newVal = val;
5427
- if (typeof val === "object") {
5404
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5428
5405
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5429
5406
  } else if (typeof val === "string") {
5430
5407
  newVal = resolveString(val, resolveOptions);
@@ -5713,7 +5690,7 @@ var MetricsPlugin = function() {
5713
5690
  key: "applyParser",
5714
5691
  value: function applyParser(parser) {
5715
5692
  parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
5716
- if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
5693
+ if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
5717
5694
  var values = obj.map(function(childVal) {
5718
5695
  return parser.parseObject(childVal, "value", options);
5719
5696
  }).filter(function(child) {
@@ -5724,7 +5701,7 @@ var MetricsPlugin = function() {
5724
5701
  }
5725
5702
  var multiNode = parser.createASTNode({
5726
5703
  type: "multi-node",
5727
- override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
5704
+ override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
5728
5705
  values: values
5729
5706
  }, obj);
5730
5707
  if (!multiNode) {
@@ -5735,7 +5712,7 @@ var MetricsPlugin = function() {
5735
5712
  v.parent = multiNode;
5736
5713
  });
5737
5714
  }
5738
- return [
5715
+ return childOptions === void 0 ? multiNode : [
5739
5716
  {
5740
5717
  path: _to_consumable_array(childOptions.path).concat([
5741
5718
  childOptions.key
@@ -5765,7 +5742,7 @@ var MetricsPlugin = function() {
5765
5742
  key: "applyParser",
5766
5743
  value: function applyParser(parser) {
5767
5744
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5768
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
5745
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
5769
5746
  var assetAST = parser.parseObject(obj, "asset", options);
5770
5747
  if (!assetAST) {
5771
5748
  return [];
@@ -5965,6 +5942,7 @@ var MetricsPlugin = function() {
5965
5942
  }();
5966
5943
  var FlowInstance = /*#__PURE__*/ function() {
5967
5944
  function FlowInstance(id, flow, options) {
5945
+ var _this = this;
5968
5946
  _class_call_check(this, FlowInstance);
5969
5947
  this.isTransitioning = false;
5970
5948
  this.hooks = {
@@ -5981,60 +5959,55 @@ var MetricsPlugin = function() {
5981
5959
  this.flow = flow;
5982
5960
  this.log = options === null || options === void 0 ? void 0 : options.logger;
5983
5961
  this.history = [];
5984
- var _this = this;
5985
- this.hooks.transition.tap("startPromise", function() {
5986
- var _ref = _async_to_generator(function(_oldState, nextState) {
5962
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
5963
+ return _async_to_generator(function() {
5987
5964
  var newState;
5988
5965
  return _ts_generator(this, function(_state) {
5989
5966
  newState = nextState.value;
5990
- if (_this.flowPromise && newState.state_type === "END") {
5991
- _this.flowPromise.resolve(newState);
5967
+ if (this.flowPromise && newState.state_type === "END") {
5968
+ this.flowPromise.resolve(newState);
5992
5969
  }
5993
5970
  return [
5994
5971
  2
5995
5972
  ];
5996
5973
  });
5997
- });
5998
- return function(_oldState, nextState) {
5999
- return _ref.apply(this, arguments);
6000
- };
6001
- }());
5974
+ }).call(_this);
5975
+ });
6002
5976
  }
6003
5977
  _create_class(FlowInstance, [
6004
5978
  {
6005
5979
  key: "start",
6006
5980
  value: /** Start the state machine */ function start() {
6007
- var _this = this;
6008
5981
  return _async_to_generator(function() {
6009
5982
  var _this_log, initialState;
6010
5983
  return _ts_generator(this, function(_state) {
6011
- if (_this.flowPromise) {
5984
+ if (this.flowPromise) {
6012
5985
  ;
6013
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
5986
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6014
5987
  return [
6015
5988
  2,
6016
- _this.flowPromise.promise
5989
+ this.flowPromise.promise
6017
5990
  ];
6018
5991
  }
6019
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6020
- if (_this.flow.onStart) {
6021
- _this.hooks.onStart.call(_this.flow.onStart);
5992
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
5993
+ if (this.flow.onStart) {
5994
+ this.hooks.onStart.call(this.flow.onStart);
6022
5995
  }
6023
- initialState = _this.flow.startState;
5996
+ initialState = this.flow.startState;
6024
5997
  if (!initialState) {
6025
5998
  return [
6026
5999
  2,
6027
6000
  Promise.reject(new Error("No 'startState' defined for flow"))
6028
6001
  ];
6029
6002
  }
6030
- _this.flowPromise = (0, import_p_defer2.default)();
6031
- _this.pushHistory(initialState);
6003
+ this.flowPromise = (0, import_p_defer2.default)();
6004
+ this.pushHistory(initialState);
6032
6005
  return [
6033
6006
  2,
6034
- _this.flowPromise.promise
6007
+ this.flowPromise.promise
6035
6008
  ];
6036
6009
  });
6037
- })();
6010
+ }).call(this);
6038
6011
  }
6039
6012
  },
6040
6013
  {
@@ -6086,7 +6059,7 @@ var MetricsPlugin = function() {
6086
6059
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6087
6060
  }
6088
6061
  var nextState = this.flow[stateName];
6089
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
6062
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
6090
6063
  var _this_log;
6091
6064
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6092
6065
  return;
@@ -6146,30 +6119,30 @@ var MetricsPlugin = function() {
6146
6119
  {
6147
6120
  key: "run",
6148
6121
  value: function run(startState) {
6149
- var _this = this;
6150
6122
  return _async_to_generator(function() {
6151
- var _this_log, startFlow, flow, end, firstItem;
6123
+ var _this, _this_log, startFlow, flow, end, firstItem;
6152
6124
  return _ts_generator(this, function(_state) {
6153
6125
  switch(_state.label){
6154
6126
  case 0:
6155
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6127
+ _this = this;
6128
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6156
6129
  return [
6157
6130
  2,
6158
6131
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6159
6132
  ];
6160
6133
  }
6161
- startFlow = _this.navigation[startState];
6162
- if (startFlow === null || typeof startFlow !== "object") {
6134
+ startFlow = this.navigation[startState];
6135
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6163
6136
  return [
6164
6137
  2,
6165
6138
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6166
6139
  ];
6167
6140
  }
6168
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6141
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6169
6142
  flow = new FlowInstance(startState, startFlow, {
6170
- logger: _this.log
6143
+ logger: this.log
6171
6144
  });
6172
- _this.addNewFlow(flow);
6145
+ this.addNewFlow(flow);
6173
6146
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6174
6147
  var _flowInstance_currentState;
6175
6148
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6189,10 +6162,10 @@ var MetricsPlugin = function() {
6189
6162
  ];
6190
6163
  case 1:
6191
6164
  end = _state.sent();
6192
- _this.navStack.pop();
6193
- if (_this.navStack.length > 0) {
6165
+ this.navStack.pop();
6166
+ if (this.navStack.length > 0) {
6194
6167
  firstItem = 0;
6195
- _this.current = _this.navStack[firstItem];
6168
+ this.current = this.navStack[firstItem];
6196
6169
  }
6197
6170
  return [
6198
6171
  2,
@@ -6200,16 +6173,15 @@ var MetricsPlugin = function() {
6200
6173
  ];
6201
6174
  }
6202
6175
  });
6203
- })();
6176
+ }).call(this);
6204
6177
  }
6205
6178
  },
6206
6179
  {
6207
6180
  key: "start",
6208
6181
  value: function start() {
6209
- var _this = this;
6210
6182
  return _async_to_generator(function() {
6211
6183
  return _ts_generator(this, function(_state) {
6212
- if (!_this.navigation.BEGIN) {
6184
+ if (!this.navigation.BEGIN) {
6213
6185
  return [
6214
6186
  2,
6215
6187
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6217,10 +6189,10 @@ var MetricsPlugin = function() {
6217
6189
  }
6218
6190
  return [
6219
6191
  2,
6220
- _this.run(_this.navigation.BEGIN)
6192
+ this.run(this.navigation.BEGIN)
6221
6193
  ];
6222
6194
  });
6223
- })();
6195
+ }).call(this);
6224
6196
  }
6225
6197
  }
6226
6198
  ]);
@@ -7327,7 +7299,7 @@ var MetricsPlugin = function() {
7327
7299
  var parentBinding = resolved.parent();
7328
7300
  var property = resolved.key();
7329
7301
  var parentValue = this.get(parentBinding);
7330
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7302
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7331
7303
  this.getModel().delete(resolved, options);
7332
7304
  if (existedBeforeDelete && !this.get(resolved)) {
7333
7305
  this.trash.add(resolved);
@@ -7428,7 +7400,7 @@ var MetricsPlugin = function() {
7428
7400
  var expressionEvaluator;
7429
7401
  var handleEval = function(exp) {
7430
7402
  if (exp) {
7431
- if (typeof exp === "object" && "exp" in exp) {
7403
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7432
7404
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7433
7405
  } else {
7434
7406
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -7689,7 +7661,7 @@ var MetricsPlugin = function() {
7689
7661
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
7690
7662
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
7691
7663
  if (state.onEnd && state.transitions[computedTransitionVal]) {
7692
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
7664
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
7693
7665
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
7694
7666
  } else {
7695
7667
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -7848,12 +7820,12 @@ var MetricsPlugin = function() {
7848
7820
  {
7849
7821
  key: "start",
7850
7822
  value: function start(payload) {
7851
- var _this = this;
7852
7823
  return _async_to_generator(function() {
7853
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7824
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7854
7825
  return _ts_generator(this, function(_state) {
7855
7826
  switch(_state.label){
7856
7827
  case 0:
7828
+ _this = this;
7857
7829
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
7858
7830
  maybeUpdateState = function(newState) {
7859
7831
  if (_this.state.ref !== ref) {
@@ -7863,7 +7835,7 @@ var MetricsPlugin = function() {
7863
7835
  _this.setState(newState);
7864
7836
  return newState;
7865
7837
  };
7866
- _this.setState({
7838
+ this.setState({
7867
7839
  status: "not-started",
7868
7840
  ref: ref
7869
7841
  });
@@ -7875,8 +7847,8 @@ var MetricsPlugin = function() {
7875
7847
  ,
7876
7848
  4
7877
7849
  ]);
7878
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7879
- _this.setState(_object_spread({
7850
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7851
+ this.setState(_object_spread({
7880
7852
  ref: ref
7881
7853
  }, state));
7882
7854
  start();
@@ -7921,7 +7893,7 @@ var MetricsPlugin = function() {
7921
7893
  ];
7922
7894
  }
7923
7895
  });
7924
- })();
7896
+ }).call(this);
7925
7897
  }
7926
7898
  }
7927
7899
  ]);
@@ -8034,51 +8006,53 @@ var MetricsPlugin = function() {
8034
8006
  {
8035
8007
  key: "beacon",
8036
8008
  value: function beacon(event) {
8009
+ var _this = this;
8037
8010
  var action = event.action, element = event.element, asset = event.asset, view = event.view;
8038
8011
  var _this_beaconContext = this.beaconContext, currentView = _this_beaconContext.view;
8039
- var _this = this;
8040
- setTimeout(/*#__PURE__*/ _async_to_generator(function() {
8041
- var _event_asset_metaData, _event_asset, _this_resolveDataRefs, _this1, _this_player, unresolvedData, _this_resolveDataRefs1, data, defaultBeacon, state, hookArgs, beacon, shouldCancel, _this_logger;
8042
- return _ts_generator(this, function(_state) {
8043
- switch(_state.label){
8044
- case 0:
8045
- unresolvedData = (event === null || event === void 0 ? void 0 : event.data) || ((_event_asset = event.asset) === null || _event_asset === void 0 ? void 0 : (_event_asset_metaData = _event_asset.metaData) === null || _event_asset_metaData === void 0 ? void 0 : _event_asset_metaData.beacon);
8046
- data = (_this_resolveDataRefs1 = (_this_resolveDataRefs = (_this1 = _this).resolveDataRefs) === null || _this_resolveDataRefs === void 0 ? void 0 : _this_resolveDataRefs.call(_this1, unresolvedData)) !== null && _this_resolveDataRefs1 !== void 0 ? _this_resolveDataRefs1 : unresolvedData;
8047
- defaultBeacon = {
8048
- action: action,
8049
- element: element,
8050
- data: data,
8051
- assetId: asset === null || asset === void 0 ? void 0 : asset.id,
8052
- viewId: currentView === null || currentView === void 0 ? void 0 : currentView.id
8053
- };
8054
- state = (_this_player = _this.player) === null || _this_player === void 0 ? void 0 : _this_player.getState();
8055
- hookArgs = _object_spread_props(_object_spread({}, event), {
8056
- data: data,
8057
- state: state,
8058
- view: view !== null && view !== void 0 ? view : currentView,
8059
- logger: _this.logger
8060
- });
8061
- return [
8062
- 4,
8063
- _this.hooks.buildBeacon.call(defaultBeacon, hookArgs)
8064
- ];
8065
- case 1:
8066
- beacon = _state.sent() || defaultBeacon;
8067
- if (beacon !== defaultBeacon && _this.resolveDataRefs) {
8068
- beacon = _this.resolveDataRefs(beacon);
8069
- }
8070
- shouldCancel = _this.hooks.cancelBeacon.call(hookArgs) || false;
8071
- if (!shouldCancel) {
8072
- ;
8073
- (_this_logger = _this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.debug("Sending beacon event", beacon);
8074
- _this.hooks.publishBeacon.call(beacon);
8075
- }
8076
- return [
8077
- 2
8078
- ];
8079
- }
8080
- });
8081
- }), 0);
8012
+ setTimeout(function() {
8013
+ return _async_to_generator(function() {
8014
+ var _event_asset_metaData, _event_asset, _this_resolveDataRefs, _this, _this_player, unresolvedData, _this_resolveDataRefs1, data, defaultBeacon, state, hookArgs, beacon, shouldCancel, _this_logger;
8015
+ return _ts_generator(this, function(_state) {
8016
+ switch(_state.label){
8017
+ case 0:
8018
+ unresolvedData = (event === null || event === void 0 ? void 0 : event.data) || ((_event_asset = event.asset) === null || _event_asset === void 0 ? void 0 : (_event_asset_metaData = _event_asset.metaData) === null || _event_asset_metaData === void 0 ? void 0 : _event_asset_metaData.beacon);
8019
+ data = (_this_resolveDataRefs1 = (_this_resolveDataRefs = (_this = this).resolveDataRefs) === null || _this_resolveDataRefs === void 0 ? void 0 : _this_resolveDataRefs.call(_this, unresolvedData)) !== null && _this_resolveDataRefs1 !== void 0 ? _this_resolveDataRefs1 : unresolvedData;
8020
+ defaultBeacon = {
8021
+ action: action,
8022
+ element: element,
8023
+ data: data,
8024
+ assetId: asset === null || asset === void 0 ? void 0 : asset.id,
8025
+ viewId: currentView === null || currentView === void 0 ? void 0 : currentView.id
8026
+ };
8027
+ state = (_this_player = this.player) === null || _this_player === void 0 ? void 0 : _this_player.getState();
8028
+ hookArgs = _object_spread_props(_object_spread({}, event), {
8029
+ data: data,
8030
+ state: state,
8031
+ view: view !== null && view !== void 0 ? view : currentView,
8032
+ logger: this.logger
8033
+ });
8034
+ return [
8035
+ 4,
8036
+ this.hooks.buildBeacon.call(defaultBeacon, hookArgs)
8037
+ ];
8038
+ case 1:
8039
+ beacon = _state.sent() || defaultBeacon;
8040
+ if (beacon !== defaultBeacon && this.resolveDataRefs) {
8041
+ beacon = this.resolveDataRefs(beacon);
8042
+ }
8043
+ shouldCancel = this.hooks.cancelBeacon.call(hookArgs) || false;
8044
+ if (!shouldCancel) {
8045
+ ;
8046
+ (_this_logger = this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.debug("Sending beacon event", beacon);
8047
+ this.hooks.publishBeacon.call(beacon);
8048
+ }
8049
+ return [
8050
+ 2
8051
+ ];
8052
+ }
8053
+ });
8054
+ }).call(_this);
8055
+ }, 0);
8082
8056
  }
8083
8057
  }
8084
8058
  ]);
@@ -8138,7 +8112,6 @@ var MetricsPlugin = function() {
8138
8112
  {
8139
8113
  key: "buildContext",
8140
8114
  value: function buildContext() {
8141
- var _this = this;
8142
8115
  return _async_to_generator(function() {
8143
8116
  var _tmp;
8144
8117
  return _ts_generator(this, function(_state) {
@@ -8147,26 +8120,26 @@ var MetricsPlugin = function() {
8147
8120
  _tmp = {};
8148
8121
  return [
8149
8122
  4,
8150
- _this.getRenderTime()
8123
+ this.getRenderTime()
8151
8124
  ];
8152
8125
  case 1:
8153
8126
  return [
8154
8127
  2,
8155
- (_tmp.renderTime = _state.sent(), _tmp.requestTime = _this.getRequestTime(), _tmp)
8128
+ (_tmp.renderTime = _state.sent(), _tmp.requestTime = this.getRequestTime(), _tmp)
8156
8129
  ];
8157
8130
  }
8158
8131
  });
8159
- })();
8132
+ }).call(this);
8160
8133
  }
8161
8134
  },
8162
8135
  {
8163
8136
  key: "getRenderTime",
8164
8137
  value: function getRenderTime() {
8165
- var _this = this;
8166
8138
  return _async_to_generator(function() {
8167
- var flow, lastItem;
8139
+ var _this, flow, lastItem;
8168
8140
  return _ts_generator(this, function(_state) {
8169
- flow = _this.metricsPlugin.getMetrics().flow;
8141
+ _this = this;
8142
+ flow = this.metricsPlugin.getMetrics().flow;
8170
8143
  if (flow) {
8171
8144
  lastItem = flow.timeline[flow.timeline.length - 1];
8172
8145
  if ("render" in lastItem && lastItem.render.completed) {
@@ -8183,7 +8156,7 @@ var MetricsPlugin = function() {
8183
8156
  })
8184
8157
  ];
8185
8158
  });
8186
- })();
8159
+ }).call(this);
8187
8160
  }
8188
8161
  },
8189
8162
  {