@player-ui/metrics-plugin 0.14.0-next.0 → 0.14.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,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
  };
@@ -1531,7 +1515,7 @@ var MetricsPlugin = function() {
1531
1515
  });
1532
1516
  };
1533
1517
  var __copyProps = function(to, from, except, desc) {
1534
- if (from && typeof from === "object" || typeof from === "function") {
1518
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1535
1519
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1536
1520
  try {
1537
1521
  var _loop = function() {
@@ -1586,15 +1570,16 @@ var MetricsPlugin = function() {
1586
1570
  exports.toError = exports.NestedError = void 0;
1587
1571
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1588
1572
  _inherits(_NestedError, Error1);
1589
- var _super = _create_super(_NestedError);
1590
1573
  function _NestedError(message) {
1591
1574
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1592
1575
  innerErrors[_key - 1] = arguments[_key];
1593
1576
  }
1594
1577
  _class_call_check(this, _NestedError);
1595
1578
  var _this;
1596
- _this = _super.call(this, message);
1597
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1579
+ _this = _call_super(this, _NestedError, [
1580
+ message
1581
+ ]);
1582
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1598
1583
  if (innerErrors.length === 1) {
1599
1584
  var innerError = toError(innerErrors[0]);
1600
1585
  _this.innerErrors = [
@@ -1730,7 +1715,7 @@ var MetricsPlugin = function() {
1730
1715
  return out;
1731
1716
  }
1732
1717
  function isObject(o) {
1733
- return o != null && typeof o === "object";
1718
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1734
1719
  }
1735
1720
  function addLast2(array, val) {
1736
1721
  if (Array.isArray(val)) return array.concat(val);
@@ -2073,7 +2058,7 @@ var MetricsPlugin = function() {
2073
2058
  else return 0;
2074
2059
  }
2075
2060
  }();
2076
- if (typeof module === "object") module.exports = SortedArray2;
2061
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
2077
2062
  if (typeof define === "function" && define.amd) define(function() {
2078
2063
  return SortedArray2;
2079
2064
  });
@@ -2285,10 +2270,9 @@ var MetricsPlugin = function() {
2285
2270
  }();
2286
2271
  var SyncHook = /*#__PURE__*/ function(Hook) {
2287
2272
  _inherits(SyncHook, Hook);
2288
- var _super = _create_super(SyncHook);
2289
2273
  function SyncHook() {
2290
2274
  _class_call_check(this, SyncHook);
2291
- return _super.apply(this, arguments);
2275
+ return _call_super(this, SyncHook, arguments);
2292
2276
  }
2293
2277
  _create_class(SyncHook, [
2294
2278
  {
@@ -2321,10 +2305,9 @@ var MetricsPlugin = function() {
2321
2305
  }(Hook);
2322
2306
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2323
2307
  _inherits(SyncBailHook, Hook);
2324
- var _super = _create_super(SyncBailHook);
2325
2308
  function SyncBailHook() {
2326
2309
  _class_call_check(this, SyncBailHook);
2327
- return _super.apply(this, arguments);
2310
+ return _call_super(this, SyncBailHook, arguments);
2328
2311
  }
2329
2312
  _create_class(SyncBailHook, [
2330
2313
  {
@@ -2356,10 +2339,9 @@ var MetricsPlugin = function() {
2356
2339
  }(Hook);
2357
2340
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2358
2341
  _inherits(SyncWaterfallHook, Hook);
2359
- var _super = _create_super(SyncWaterfallHook);
2360
2342
  function SyncWaterfallHook() {
2361
2343
  _class_call_check(this, SyncWaterfallHook);
2362
- return _super.apply(this, arguments);
2344
+ return _call_super(this, SyncWaterfallHook, arguments);
2363
2345
  }
2364
2346
  _create_class(SyncWaterfallHook, [
2365
2347
  {
@@ -2391,10 +2373,9 @@ var MetricsPlugin = function() {
2391
2373
  }(Hook);
2392
2374
  var AsyncSeriesWaterfallHook = /*#__PURE__*/ function(Hook) {
2393
2375
  _inherits(AsyncSeriesWaterfallHook, Hook);
2394
- var _super = _create_super(AsyncSeriesWaterfallHook);
2395
2376
  function AsyncSeriesWaterfallHook() {
2396
2377
  _class_call_check(this, AsyncSeriesWaterfallHook);
2397
- return _super.apply(this, arguments);
2378
+ return _call_super(this, AsyncSeriesWaterfallHook, arguments);
2398
2379
  }
2399
2380
  _create_class(AsyncSeriesWaterfallHook, [
2400
2381
  {
@@ -2403,7 +2384,6 @@ var MetricsPlugin = function() {
2403
2384
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2404
2385
  args[_key] = arguments[_key];
2405
2386
  }
2406
- var _this = this;
2407
2387
  return _async_to_generator(function() {
2408
2388
  var _this_interceptions, _args, rtn, rest, ctx, tapIndex, tapValue, e;
2409
2389
  return _ts_generator(this, function(_state) {
@@ -2411,7 +2391,7 @@ var MetricsPlugin = function() {
2411
2391
  case 0:
2412
2392
  _args = _to_array(args), rtn = _args[0], rest = _args.slice(1);
2413
2393
  ctx = {};
2414
- (_this_interceptions = _this.interceptions).call.apply(_this_interceptions, [
2394
+ (_this_interceptions = this.interceptions).call.apply(_this_interceptions, [
2415
2395
  ctx
2416
2396
  ].concat(_to_consumable_array(args)));
2417
2397
  _state.label = 1;
@@ -2425,13 +2405,13 @@ var MetricsPlugin = function() {
2425
2405
  tapIndex = 0;
2426
2406
  _state.label = 2;
2427
2407
  case 2:
2428
- if (!(tapIndex < _this.taps.length)) return [
2408
+ if (!(tapIndex < this.taps.length)) return [
2429
2409
  3,
2430
2410
  5
2431
2411
  ];
2432
2412
  return [
2433
2413
  4,
2434
- callTap(_this.taps[tapIndex], [
2414
+ callTap(this.taps[tapIndex], [
2435
2415
  rtn
2436
2416
  ].concat(_to_consumable_array(rest)), ctx)
2437
2417
  ];
@@ -2454,17 +2434,17 @@ var MetricsPlugin = function() {
2454
2434
  ];
2455
2435
  case 6:
2456
2436
  e = _state.sent();
2457
- _this.interceptions.error(e);
2437
+ this.interceptions.error(e);
2458
2438
  throw e;
2459
2439
  case 7:
2460
- _this.interceptions.result(rtn);
2440
+ this.interceptions.result(rtn);
2461
2441
  return [
2462
2442
  2,
2463
2443
  rtn
2464
2444
  ];
2465
2445
  }
2466
2446
  });
2467
- })();
2447
+ }).call(this);
2468
2448
  }
2469
2449
  }
2470
2450
  ]);
@@ -2502,7 +2482,7 @@ var MetricsPlugin = function() {
2502
2482
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2503
2483
  len = _step.value;
2504
2484
  tmp = len;
2505
- if (tmp && typeof tmp === "object") {
2485
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2506
2486
  tmp = find(bar, tmp);
2507
2487
  if (!tmp) return false;
2508
2488
  }
@@ -2533,7 +2513,7 @@ var MetricsPlugin = function() {
2533
2513
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2534
2514
  len = _step1.value;
2535
2515
  tmp = len[0];
2536
- if (tmp && typeof tmp === "object") {
2516
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2537
2517
  tmp = find(bar, tmp);
2538
2518
  if (!tmp) return false;
2539
2519
  }
@@ -2572,7 +2552,7 @@ var MetricsPlugin = function() {
2572
2552
  }
2573
2553
  return len === -1;
2574
2554
  }
2575
- if (!ctor || typeof foo === "object") {
2555
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2576
2556
  len = 0;
2577
2557
  for(ctor in foo){
2578
2558
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -2605,7 +2585,7 @@ var MetricsPlugin = function() {
2605
2585
  var nestedPath = _to_consumable_array(path).concat([
2606
2586
  key
2607
2587
  ]);
2608
- if (typeof val === "object") {
2588
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2609
2589
  traverseObj(val, nestedPath, pairs);
2610
2590
  } else {
2611
2591
  pairs.set(nestedPath, val);
@@ -2646,7 +2626,7 @@ var MetricsPlugin = function() {
2646
2626
  {
2647
2627
  /** Add match -> value mapping to the registry */ key: "set",
2648
2628
  value: function set(match, value) {
2649
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2629
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2650
2630
  this.store.insert({
2651
2631
  key: match,
2652
2632
  value: value,
@@ -3186,7 +3166,7 @@ var MetricsPlugin = function() {
3186
3166
  var _this_parseCache_path;
3187
3167
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3188
3168
  this.parseCache[path] = ast;
3189
- 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)) {
3190
3170
  var _ast_error;
3191
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."));
3192
3172
  }
@@ -3386,14 +3366,13 @@ var MetricsPlugin = function() {
3386
3366
  }();
3387
3367
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3388
3368
  _inherits(DependencyModel, DependencyTracker);
3389
- var _super = _create_super(DependencyModel);
3390
3369
  function DependencyModel(rootModel) {
3391
3370
  _class_call_check(this, DependencyModel);
3392
3371
  var _this;
3393
- _this = _super.call(this);
3372
+ _this = _call_super(this, DependencyModel);
3394
3373
  _this.rootModel = rootModel;
3395
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3396
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3374
+ _this.set = _this.set.bind(_this);
3375
+ _this.get = _this.get.bind(_this);
3397
3376
  return _this;
3398
3377
  }
3399
3378
  _create_class(DependencyModel, [
@@ -3937,23 +3916,20 @@ var MetricsPlugin = function() {
3937
3916
  * @experimental These Player APIs are in active development and may change. Use with caution
3938
3917
  */ key: "evaluateAsync",
3939
3918
  value: function evaluateAsync(expr, options) {
3919
+ var _this = this;
3940
3920
  if (Array.isArray(expr)) {
3941
- var _this = this;
3942
- return collateAwaitable(expr.map(function() {
3943
- var _ref = _async_to_generator(function(exp) {
3921
+ return collateAwaitable(expr.map(function(exp) {
3922
+ return _async_to_generator(function() {
3944
3923
  return _ts_generator(this, function(_state) {
3945
3924
  return [
3946
3925
  2,
3947
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3926
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3948
3927
  async: true
3949
3928
  }))
3950
3929
  ];
3951
3930
  });
3952
- });
3953
- return function(exp) {
3954
- return _ref.apply(this, arguments);
3955
- };
3956
- }())).awaitableThen(function(values) {
3931
+ }).call(_this);
3932
+ })).awaitableThen(function(values) {
3957
3933
  return values.pop();
3958
3934
  });
3959
3935
  } else {
@@ -4716,7 +4692,7 @@ var MetricsPlugin = function() {
4716
4692
  }
4717
4693
  var parseLocalObject = function(currentValue, objToParse) {
4718
4694
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4719
- if (typeof objToParse !== "object" || objToParse === null) {
4695
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4720
4696
  return {
4721
4697
  value: objToParse,
4722
4698
  children: []
@@ -4753,7 +4729,7 @@ var MetricsPlugin = function() {
4753
4729
  if (newChildren) {
4754
4730
  var _children2;
4755
4731
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4756
- } else if (localValue && typeof localValue === "object") {
4732
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4757
4733
  var _children21;
4758
4734
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4759
4735
  localKey
@@ -4911,7 +4887,7 @@ var MetricsPlugin = function() {
4911
4887
  Object.keys(clonedNode).forEach(function(key) {
4912
4888
  if (key === "parent") return;
4913
4889
  var value = clonedNode[key];
4914
- if (typeof value === "object" && value !== null) {
4890
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
4915
4891
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
4916
4892
  }
4917
4893
  });
@@ -5263,7 +5239,7 @@ var MetricsPlugin = function() {
5263
5239
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5264
5240
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5265
5241
  var flags = "g";
5266
- if (typeof expression === "object") {
5242
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5267
5243
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5268
5244
  }
5269
5245
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5412,7 +5388,7 @@ var MetricsPlugin = function() {
5412
5388
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5413
5389
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5414
5390
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5415
- 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") {
5416
5392
  return node;
5417
5393
  }
5418
5394
  if (typeof node === "string") {
@@ -5425,7 +5401,7 @@ var MetricsPlugin = function() {
5425
5401
  }
5426
5402
  var val = node[key];
5427
5403
  var newVal = val;
5428
- if (typeof val === "object") {
5404
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5429
5405
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5430
5406
  } else if (typeof val === "string") {
5431
5407
  newVal = resolveString(val, resolveOptions);
@@ -5766,7 +5742,7 @@ var MetricsPlugin = function() {
5766
5742
  key: "applyParser",
5767
5743
  value: function applyParser(parser) {
5768
5744
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5769
- 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") {
5770
5746
  var assetAST = parser.parseObject(obj, "asset", options);
5771
5747
  if (!assetAST) {
5772
5748
  return [];
@@ -5966,6 +5942,7 @@ var MetricsPlugin = function() {
5966
5942
  }();
5967
5943
  var FlowInstance = /*#__PURE__*/ function() {
5968
5944
  function FlowInstance(id, flow, options) {
5945
+ var _this = this;
5969
5946
  _class_call_check(this, FlowInstance);
5970
5947
  this.isTransitioning = false;
5971
5948
  this.hooks = {
@@ -5982,60 +5959,55 @@ var MetricsPlugin = function() {
5982
5959
  this.flow = flow;
5983
5960
  this.log = options === null || options === void 0 ? void 0 : options.logger;
5984
5961
  this.history = [];
5985
- var _this = this;
5986
- this.hooks.transition.tap("startPromise", function() {
5987
- var _ref = _async_to_generator(function(_oldState, nextState) {
5962
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
5963
+ return _async_to_generator(function() {
5988
5964
  var newState;
5989
5965
  return _ts_generator(this, function(_state) {
5990
5966
  newState = nextState.value;
5991
- if (_this.flowPromise && newState.state_type === "END") {
5992
- _this.flowPromise.resolve(newState);
5967
+ if (this.flowPromise && newState.state_type === "END") {
5968
+ this.flowPromise.resolve(newState);
5993
5969
  }
5994
5970
  return [
5995
5971
  2
5996
5972
  ];
5997
5973
  });
5998
- });
5999
- return function(_oldState, nextState) {
6000
- return _ref.apply(this, arguments);
6001
- };
6002
- }());
5974
+ }).call(_this);
5975
+ });
6003
5976
  }
6004
5977
  _create_class(FlowInstance, [
6005
5978
  {
6006
5979
  key: "start",
6007
5980
  value: /** Start the state machine */ function start() {
6008
- var _this = this;
6009
5981
  return _async_to_generator(function() {
6010
5982
  var _this_log, initialState;
6011
5983
  return _ts_generator(this, function(_state) {
6012
- if (_this.flowPromise) {
5984
+ if (this.flowPromise) {
6013
5985
  ;
6014
- (_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");
6015
5987
  return [
6016
5988
  2,
6017
- _this.flowPromise.promise
5989
+ this.flowPromise.promise
6018
5990
  ];
6019
5991
  }
6020
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6021
- if (_this.flow.onStart) {
6022
- _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);
6023
5995
  }
6024
- initialState = _this.flow.startState;
5996
+ initialState = this.flow.startState;
6025
5997
  if (!initialState) {
6026
5998
  return [
6027
5999
  2,
6028
6000
  Promise.reject(new Error("No 'startState' defined for flow"))
6029
6001
  ];
6030
6002
  }
6031
- _this.flowPromise = (0, import_p_defer2.default)();
6032
- _this.pushHistory(initialState);
6003
+ this.flowPromise = (0, import_p_defer2.default)();
6004
+ this.pushHistory(initialState);
6033
6005
  return [
6034
6006
  2,
6035
- _this.flowPromise.promise
6007
+ this.flowPromise.promise
6036
6008
  ];
6037
6009
  });
6038
- })();
6010
+ }).call(this);
6039
6011
  }
6040
6012
  },
6041
6013
  {
@@ -6087,7 +6059,7 @@ var MetricsPlugin = function() {
6087
6059
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6088
6060
  }
6089
6061
  var nextState = this.flow[stateName];
6090
- 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)) {
6091
6063
  var _this_log;
6092
6064
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6093
6065
  return;
@@ -6147,30 +6119,30 @@ var MetricsPlugin = function() {
6147
6119
  {
6148
6120
  key: "run",
6149
6121
  value: function run(startState) {
6150
- var _this = this;
6151
6122
  return _async_to_generator(function() {
6152
- var _this_log, startFlow, flow, end, firstItem;
6123
+ var _this, _this_log, startFlow, flow, end, firstItem;
6153
6124
  return _ts_generator(this, function(_state) {
6154
6125
  switch(_state.label){
6155
6126
  case 0:
6156
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6127
+ _this = this;
6128
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6157
6129
  return [
6158
6130
  2,
6159
6131
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6160
6132
  ];
6161
6133
  }
6162
- startFlow = _this.navigation[startState];
6163
- if (startFlow === null || typeof startFlow !== "object") {
6134
+ startFlow = this.navigation[startState];
6135
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6164
6136
  return [
6165
6137
  2,
6166
6138
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6167
6139
  ];
6168
6140
  }
6169
- (_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));
6170
6142
  flow = new FlowInstance(startState, startFlow, {
6171
- logger: _this.log
6143
+ logger: this.log
6172
6144
  });
6173
- _this.addNewFlow(flow);
6145
+ this.addNewFlow(flow);
6174
6146
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6175
6147
  var _flowInstance_currentState;
6176
6148
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6190,10 +6162,10 @@ var MetricsPlugin = function() {
6190
6162
  ];
6191
6163
  case 1:
6192
6164
  end = _state.sent();
6193
- _this.navStack.pop();
6194
- if (_this.navStack.length > 0) {
6165
+ this.navStack.pop();
6166
+ if (this.navStack.length > 0) {
6195
6167
  firstItem = 0;
6196
- _this.current = _this.navStack[firstItem];
6168
+ this.current = this.navStack[firstItem];
6197
6169
  }
6198
6170
  return [
6199
6171
  2,
@@ -6201,16 +6173,15 @@ var MetricsPlugin = function() {
6201
6173
  ];
6202
6174
  }
6203
6175
  });
6204
- })();
6176
+ }).call(this);
6205
6177
  }
6206
6178
  },
6207
6179
  {
6208
6180
  key: "start",
6209
6181
  value: function start() {
6210
- var _this = this;
6211
6182
  return _async_to_generator(function() {
6212
6183
  return _ts_generator(this, function(_state) {
6213
- if (!_this.navigation.BEGIN) {
6184
+ if (!this.navigation.BEGIN) {
6214
6185
  return [
6215
6186
  2,
6216
6187
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6218,10 +6189,10 @@ var MetricsPlugin = function() {
6218
6189
  }
6219
6190
  return [
6220
6191
  2,
6221
- _this.run(_this.navigation.BEGIN)
6192
+ this.run(this.navigation.BEGIN)
6222
6193
  ];
6223
6194
  });
6224
- })();
6195
+ }).call(this);
6225
6196
  }
6226
6197
  }
6227
6198
  ]);
@@ -7328,7 +7299,7 @@ var MetricsPlugin = function() {
7328
7299
  var parentBinding = resolved.parent();
7329
7300
  var property = resolved.key();
7330
7301
  var parentValue = this.get(parentBinding);
7331
- 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);
7332
7303
  this.getModel().delete(resolved, options);
7333
7304
  if (existedBeforeDelete && !this.get(resolved)) {
7334
7305
  this.trash.add(resolved);
@@ -7429,7 +7400,7 @@ var MetricsPlugin = function() {
7429
7400
  var expressionEvaluator;
7430
7401
  var handleEval = function(exp) {
7431
7402
  if (exp) {
7432
- if (typeof exp === "object" && "exp" in exp) {
7403
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7433
7404
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7434
7405
  } else {
7435
7406
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -7690,7 +7661,7 @@ var MetricsPlugin = function() {
7690
7661
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
7691
7662
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
7692
7663
  if (state.onEnd && state.transitions[computedTransitionVal]) {
7693
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
7664
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
7694
7665
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
7695
7666
  } else {
7696
7667
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -7849,12 +7820,12 @@ var MetricsPlugin = function() {
7849
7820
  {
7850
7821
  key: "start",
7851
7822
  value: function start(payload) {
7852
- var _this = this;
7853
7823
  return _async_to_generator(function() {
7854
- 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;
7855
7825
  return _ts_generator(this, function(_state) {
7856
7826
  switch(_state.label){
7857
7827
  case 0:
7828
+ _this = this;
7858
7829
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
7859
7830
  maybeUpdateState = function(newState) {
7860
7831
  if (_this.state.ref !== ref) {
@@ -7864,7 +7835,7 @@ var MetricsPlugin = function() {
7864
7835
  _this.setState(newState);
7865
7836
  return newState;
7866
7837
  };
7867
- _this.setState({
7838
+ this.setState({
7868
7839
  status: "not-started",
7869
7840
  ref: ref
7870
7841
  });
@@ -7876,8 +7847,8 @@ var MetricsPlugin = function() {
7876
7847
  ,
7877
7848
  4
7878
7849
  ]);
7879
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7880
- _this.setState(_object_spread({
7850
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7851
+ this.setState(_object_spread({
7881
7852
  ref: ref
7882
7853
  }, state));
7883
7854
  start();
@@ -7922,7 +7893,7 @@ var MetricsPlugin = function() {
7922
7893
  ];
7923
7894
  }
7924
7895
  });
7925
- })();
7896
+ }).call(this);
7926
7897
  }
7927
7898
  }
7928
7899
  ]);
@@ -8035,51 +8006,53 @@ var MetricsPlugin = function() {
8035
8006
  {
8036
8007
  key: "beacon",
8037
8008
  value: function beacon(event) {
8009
+ var _this = this;
8038
8010
  var action = event.action, element = event.element, asset = event.asset, view = event.view;
8039
8011
  var _this_beaconContext = this.beaconContext, currentView = _this_beaconContext.view;
8040
- var _this = this;
8041
- setTimeout(/*#__PURE__*/ _async_to_generator(function() {
8042
- var _event_asset_metaData, _event_asset, _this_resolveDataRefs, _this1, _this_player, unresolvedData, _this_resolveDataRefs1, data, defaultBeacon, state, hookArgs, beacon, shouldCancel, _this_logger;
8043
- return _ts_generator(this, function(_state) {
8044
- switch(_state.label){
8045
- case 0:
8046
- 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);
8047
- 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;
8048
- defaultBeacon = {
8049
- action: action,
8050
- element: element,
8051
- data: data,
8052
- assetId: asset === null || asset === void 0 ? void 0 : asset.id,
8053
- viewId: currentView === null || currentView === void 0 ? void 0 : currentView.id
8054
- };
8055
- state = (_this_player = _this.player) === null || _this_player === void 0 ? void 0 : _this_player.getState();
8056
- hookArgs = _object_spread_props(_object_spread({}, event), {
8057
- data: data,
8058
- state: state,
8059
- view: view !== null && view !== void 0 ? view : currentView,
8060
- logger: _this.logger
8061
- });
8062
- return [
8063
- 4,
8064
- _this.hooks.buildBeacon.call(defaultBeacon, hookArgs)
8065
- ];
8066
- case 1:
8067
- beacon = _state.sent() || defaultBeacon;
8068
- if (beacon !== defaultBeacon && _this.resolveDataRefs) {
8069
- beacon = _this.resolveDataRefs(beacon);
8070
- }
8071
- shouldCancel = _this.hooks.cancelBeacon.call(hookArgs) || false;
8072
- if (!shouldCancel) {
8073
- ;
8074
- (_this_logger = _this.logger) === null || _this_logger === void 0 ? void 0 : _this_logger.debug("Sending beacon event", beacon);
8075
- _this.hooks.publishBeacon.call(beacon);
8076
- }
8077
- return [
8078
- 2
8079
- ];
8080
- }
8081
- });
8082
- }), 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);
8083
8056
  }
8084
8057
  }
8085
8058
  ]);
@@ -8139,7 +8112,6 @@ var MetricsPlugin = function() {
8139
8112
  {
8140
8113
  key: "buildContext",
8141
8114
  value: function buildContext() {
8142
- var _this = this;
8143
8115
  return _async_to_generator(function() {
8144
8116
  var _tmp;
8145
8117
  return _ts_generator(this, function(_state) {
@@ -8148,26 +8120,26 @@ var MetricsPlugin = function() {
8148
8120
  _tmp = {};
8149
8121
  return [
8150
8122
  4,
8151
- _this.getRenderTime()
8123
+ this.getRenderTime()
8152
8124
  ];
8153
8125
  case 1:
8154
8126
  return [
8155
8127
  2,
8156
- (_tmp.renderTime = _state.sent(), _tmp.requestTime = _this.getRequestTime(), _tmp)
8128
+ (_tmp.renderTime = _state.sent(), _tmp.requestTime = this.getRequestTime(), _tmp)
8157
8129
  ];
8158
8130
  }
8159
8131
  });
8160
- })();
8132
+ }).call(this);
8161
8133
  }
8162
8134
  },
8163
8135
  {
8164
8136
  key: "getRenderTime",
8165
8137
  value: function getRenderTime() {
8166
- var _this = this;
8167
8138
  return _async_to_generator(function() {
8168
- var flow, lastItem;
8139
+ var _this, flow, lastItem;
8169
8140
  return _ts_generator(this, function(_state) {
8170
- flow = _this.metricsPlugin.getMetrics().flow;
8141
+ _this = this;
8142
+ flow = this.metricsPlugin.getMetrics().flow;
8171
8143
  if (flow) {
8172
8144
  lastItem = flow.timeline[flow.timeline.length - 1];
8173
8145
  if ("render" in lastItem && lastItem.render.completed) {
@@ -8184,7 +8156,7 @@ var MetricsPlugin = function() {
8184
8156
  })
8185
8157
  ];
8186
8158
  });
8187
- })();
8159
+ }).call(this);
8188
8160
  }
8189
8161
  },
8190
8162
  {