@player-ui/reference-assets-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,
@@ -510,7 +494,7 @@ var ReferenceAssetsPlugin = function() {
510
494
  };
511
495
  };
512
496
  var maybeCompose = function maybeCompose(maybeFn) {
513
- if (typeof maybeFn === "object") {
497
+ if ((typeof maybeFn === "undefined" ? "undefined" : _type_of(maybeFn)) === "object") {
514
498
  return maybeFn;
515
499
  }
516
500
  return compose(maybeFn);
@@ -597,7 +581,7 @@ var ReferenceAssetsPlugin = function() {
597
581
  };
598
582
  var findInArray = function findInArray(array, key, value) {
599
583
  return array.findIndex(function(obj) {
600
- if (obj && typeof obj === "object") {
584
+ if (obj && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
601
585
  return obj[key] == value;
602
586
  }
603
587
  return false;
@@ -691,7 +675,7 @@ var ReferenceAssetsPlugin = function() {
691
675
  };
692
676
  };
693
677
  var isExpressionNode = function isExpressionNode(x) {
694
- return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
678
+ return (typeof x === "undefined" ? "undefined" : _type_of(x)) === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier;
695
679
  };
696
680
  var throwError = function throwError(message, index) {
697
681
  var err = new Error("".concat(message, " at character ").concat(index));
@@ -1279,7 +1263,7 @@ var ReferenceAssetsPlugin = function() {
1279
1263
  var isPromiseLike = function isPromiseLike(value) {
1280
1264
  var // Check for standard Promise constructor name
1281
1265
  _value_constructor;
1282
- return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1266
+ return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1283
1267
  (_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
1284
1268
  typeof value.catch === "function" && typeof value.finally === "function");
1285
1269
  };
@@ -1294,7 +1278,7 @@ var ReferenceAssetsPlugin = function() {
1294
1278
  if (isExpressionNode(expr)) {
1295
1279
  return false;
1296
1280
  }
1297
- return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1281
+ return (typeof expr === "undefined" ? "undefined" : _type_of(expr)) === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1298
1282
  };
1299
1283
  var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
1300
1284
  return function(a, b, async) {
@@ -1511,7 +1495,7 @@ var ReferenceAssetsPlugin = function() {
1511
1495
  if (!node) {
1512
1496
  return;
1513
1497
  }
1514
- if ("value" in node && typeof node.value === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1498
+ 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") {
1515
1499
  return node.value.id;
1516
1500
  }
1517
1501
  };
@@ -1546,22 +1530,6 @@ var ReferenceAssetsPlugin = function() {
1546
1530
  }
1547
1531
  });
1548
1532
  };
1549
- var unpackNode = function unpackNode(item) {
1550
- var _item_children_, _item_children, _item_children_1, _item_children1;
1551
- var unpacked = [];
1552
- 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) {
1553
- var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1554
- 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") {
1555
- var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1556
- ((_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) {
1557
- unpacked.push(value);
1558
- });
1559
- }
1560
- } else {
1561
- unpacked.push(item);
1562
- }
1563
- return unpacked;
1564
- };
1565
1533
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1566
1534
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1567
1535
  };
@@ -1639,7 +1607,7 @@ var ReferenceAssetsPlugin = function() {
1639
1607
  });
1640
1608
  };
1641
1609
  var __copyProps = function(to, from, except, desc) {
1642
- if (from && typeof from === "object" || typeof from === "function") {
1610
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1643
1611
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1644
1612
  try {
1645
1613
  var _loop = function() {
@@ -1759,7 +1727,7 @@ var ReferenceAssetsPlugin = function() {
1759
1727
  else return 0;
1760
1728
  }
1761
1729
  }();
1762
- if (typeof module === "object") module.exports = SortedArray2;
1730
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
1763
1731
  if (typeof define === "function" && define.amd) define(function() {
1764
1732
  return SortedArray2;
1765
1733
  });
@@ -1775,15 +1743,16 @@ var ReferenceAssetsPlugin = function() {
1775
1743
  exports.toError = exports.NestedError = void 0;
1776
1744
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1777
1745
  _inherits(_NestedError, Error1);
1778
- var _super = _create_super(_NestedError);
1779
1746
  function _NestedError(message) {
1780
1747
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1781
1748
  innerErrors[_key - 1] = arguments[_key];
1782
1749
  }
1783
1750
  _class_call_check(this, _NestedError);
1784
1751
  var _this;
1785
- _this = _super.call(this, message);
1786
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1752
+ _this = _call_super(this, _NestedError, [
1753
+ message
1754
+ ]);
1755
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1787
1756
  if (innerErrors.length === 1) {
1788
1757
  var innerError = toError(innerErrors[0]);
1789
1758
  _this.innerErrors = [
@@ -1891,7 +1860,7 @@ var ReferenceAssetsPlugin = function() {
1891
1860
  exports.merge = merge;
1892
1861
  exports.mergeDeep = mergeDeep;
1893
1862
  exports.mergeIn = mergeIn;
1894
- exports.omit = omit4;
1863
+ exports.omit = omit3;
1895
1864
  exports.addDefaults = addDefaults;
1896
1865
  exports.default = void 0;
1897
1866
  var INVALID_ARGS = "INVALID_ARGS";
@@ -1919,7 +1888,7 @@ var ReferenceAssetsPlugin = function() {
1919
1888
  return out;
1920
1889
  }
1921
1890
  function isObject(o) {
1922
- return o != null && typeof o === "object";
1891
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1923
1892
  }
1924
1893
  function addLast2(array, val) {
1925
1894
  if (Array.isArray(val)) return array.concat(val);
@@ -2065,7 +2034,7 @@ var ReferenceAssetsPlugin = function() {
2065
2034
  }
2066
2035
  return setIn8(a, path, nextVal);
2067
2036
  }
2068
- function omit4(obj, attrs) {
2037
+ function omit3(obj, attrs) {
2069
2038
  var omitList = Array.isArray(attrs) ? attrs : [
2070
2039
  attrs
2071
2040
  ];
@@ -2151,7 +2120,7 @@ var ReferenceAssetsPlugin = function() {
2151
2120
  merge: merge,
2152
2121
  mergeDeep: mergeDeep,
2153
2122
  mergeIn: mergeIn,
2154
- omit: omit4,
2123
+ omit: omit3,
2155
2124
  addDefaults: addDefaults
2156
2125
  };
2157
2126
  var _default = timm;
@@ -2267,7 +2236,7 @@ var ReferenceAssetsPlugin = function() {
2267
2236
  var nestedPath = _to_consumable_array(path).concat([
2268
2237
  key
2269
2238
  ]);
2270
- if (typeof val === "object") {
2239
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2271
2240
  traverseObj(val, nestedPath, pairs);
2272
2241
  } else {
2273
2242
  pairs.set(nestedPath, val);
@@ -2308,7 +2277,7 @@ var ReferenceAssetsPlugin = function() {
2308
2277
  {
2309
2278
  /** Add match -> value mapping to the registry */ key: "set",
2310
2279
  value: function set(match, value) {
2311
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2280
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2312
2281
  this.store.insert({
2313
2282
  key: match,
2314
2283
  value: value,
@@ -2711,10 +2680,9 @@ var ReferenceAssetsPlugin = function() {
2711
2680
  }();
2712
2681
  var SyncHook = /*#__PURE__*/ function(Hook) {
2713
2682
  _inherits(SyncHook, Hook);
2714
- var _super = _create_super(SyncHook);
2715
2683
  function SyncHook() {
2716
2684
  _class_call_check(this, SyncHook);
2717
- return _super.apply(this, arguments);
2685
+ return _call_super(this, SyncHook, arguments);
2718
2686
  }
2719
2687
  _create_class(SyncHook, [
2720
2688
  {
@@ -2747,10 +2715,9 @@ var ReferenceAssetsPlugin = function() {
2747
2715
  }(Hook);
2748
2716
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2749
2717
  _inherits(SyncBailHook, Hook);
2750
- var _super = _create_super(SyncBailHook);
2751
2718
  function SyncBailHook() {
2752
2719
  _class_call_check(this, SyncBailHook);
2753
- return _super.apply(this, arguments);
2720
+ return _call_super(this, SyncBailHook, arguments);
2754
2721
  }
2755
2722
  _create_class(SyncBailHook, [
2756
2723
  {
@@ -2782,10 +2749,9 @@ var ReferenceAssetsPlugin = function() {
2782
2749
  }(Hook);
2783
2750
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2784
2751
  _inherits(SyncWaterfallHook, Hook);
2785
- var _super = _create_super(SyncWaterfallHook);
2786
2752
  function SyncWaterfallHook() {
2787
2753
  _class_call_check(this, SyncWaterfallHook);
2788
- return _super.apply(this, arguments);
2754
+ return _call_super(this, SyncWaterfallHook, arguments);
2789
2755
  }
2790
2756
  _create_class(SyncWaterfallHook, [
2791
2757
  {
@@ -2817,10 +2783,9 @@ var ReferenceAssetsPlugin = function() {
2817
2783
  }(Hook);
2818
2784
  var AsyncParallelBailHook = /*#__PURE__*/ function(Hook) {
2819
2785
  _inherits(AsyncParallelBailHook, Hook);
2820
- var _super = _create_super(AsyncParallelBailHook);
2821
2786
  function AsyncParallelBailHook() {
2822
2787
  _class_call_check(this, AsyncParallelBailHook);
2823
- return _super.apply(this, arguments);
2788
+ return _call_super(this, AsyncParallelBailHook, arguments);
2824
2789
  }
2825
2790
  _create_class(AsyncParallelBailHook, [
2826
2791
  {
@@ -2829,14 +2794,13 @@ var ReferenceAssetsPlugin = function() {
2829
2794
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2830
2795
  args[_key] = arguments[_key];
2831
2796
  }
2832
- var _this = this;
2833
2797
  return _async_to_generator(function() {
2834
2798
  var _this_interceptions, ctx, rtn, e;
2835
2799
  return _ts_generator(this, function(_state) {
2836
2800
  switch(_state.label){
2837
2801
  case 0:
2838
2802
  ctx = {};
2839
- (_this_interceptions = _this.interceptions).call.apply(_this_interceptions, [
2803
+ (_this_interceptions = this.interceptions).call.apply(_this_interceptions, [
2840
2804
  ctx
2841
2805
  ].concat(_to_consumable_array(args)));
2842
2806
  _state.label = 1;
@@ -2849,20 +2813,20 @@ var ReferenceAssetsPlugin = function() {
2849
2813
  ]);
2850
2814
  return [
2851
2815
  4,
2852
- Promise.race(_this.taps.map(function(tap) {
2816
+ Promise.race(this.taps.map(function(tap) {
2853
2817
  return callTap(tap, args, ctx);
2854
2818
  }))
2855
2819
  ];
2856
2820
  case 2:
2857
2821
  rtn = _state.sent();
2858
- _this.interceptions.result(rtn);
2822
+ this.interceptions.result(rtn);
2859
2823
  return [
2860
2824
  2,
2861
2825
  rtn
2862
2826
  ];
2863
2827
  case 3:
2864
2828
  e = _state.sent();
2865
- _this.interceptions.error(e);
2829
+ this.interceptions.error(e);
2866
2830
  throw e;
2867
2831
  case 4:
2868
2832
  return [
@@ -2870,7 +2834,7 @@ var ReferenceAssetsPlugin = function() {
2870
2834
  ];
2871
2835
  }
2872
2836
  });
2873
- })();
2837
+ }).call(this);
2874
2838
  }
2875
2839
  }
2876
2840
  ]);
@@ -2907,7 +2871,7 @@ var ReferenceAssetsPlugin = function() {
2907
2871
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2908
2872
  len = _step.value;
2909
2873
  tmp = len;
2910
- if (tmp && typeof tmp === "object") {
2874
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2911
2875
  tmp = find(bar, tmp);
2912
2876
  if (!tmp) return false;
2913
2877
  }
@@ -2938,7 +2902,7 @@ var ReferenceAssetsPlugin = function() {
2938
2902
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2939
2903
  len = _step1.value;
2940
2904
  tmp = len[0];
2941
- if (tmp && typeof tmp === "object") {
2905
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2942
2906
  tmp = find(bar, tmp);
2943
2907
  if (!tmp) return false;
2944
2908
  }
@@ -2977,7 +2941,7 @@ var ReferenceAssetsPlugin = function() {
2977
2941
  }
2978
2942
  return len === -1;
2979
2943
  }
2980
- if (!ctor || typeof foo === "object") {
2944
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2981
2945
  len = 0;
2982
2946
  for(ctor in foo){
2983
2947
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -3085,6 +3049,7 @@ var ReferenceAssetsPlugin = function() {
3085
3049
  }
3086
3050
  };
3087
3051
  var identifier = function() {
3052
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
3088
3053
  if (!isIdentifierChar(ch)) {
3089
3054
  return;
3090
3055
  }
@@ -3095,6 +3060,14 @@ var ReferenceAssetsPlugin = function() {
3095
3060
  }
3096
3061
  value += ch;
3097
3062
  }
3063
+ if (allowBoolValue) {
3064
+ if (value === "true") {
3065
+ return toValue(true);
3066
+ }
3067
+ if (value === "false") {
3068
+ return toValue(false);
3069
+ }
3070
+ }
3098
3071
  if (value) {
3099
3072
  var maybeNumber = Number(value);
3100
3073
  value = isNaN(maybeNumber) ? value : maybeNumber;
@@ -3143,8 +3116,9 @@ var ReferenceAssetsPlugin = function() {
3143
3116
  }
3144
3117
  };
3145
3118
  var simpleSegment = function() {
3119
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
3146
3120
  var _nestedPath, _ref;
3147
- return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
3121
+ return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
3148
3122
  };
3149
3123
  var segment = function() {
3150
3124
  var segments = [];
@@ -3159,6 +3133,7 @@ var ReferenceAssetsPlugin = function() {
3159
3133
  return toConcatenatedNode(segments);
3160
3134
  };
3161
3135
  var optionallyQuotedSegment = function() {
3136
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
3162
3137
  whitespace();
3163
3138
  if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
3164
3139
  var singleQuote = ch === SINGLE_QUOTE;
@@ -3167,7 +3142,7 @@ var ReferenceAssetsPlugin = function() {
3167
3142
  next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
3168
3143
  return id;
3169
3144
  }
3170
- return simpleSegment();
3145
+ return simpleSegment(allowBoolValue);
3171
3146
  };
3172
3147
  var equals = function() {
3173
3148
  if (ch !== EQUALS) {
@@ -3187,7 +3162,7 @@ var ReferenceAssetsPlugin = function() {
3187
3162
  whitespace();
3188
3163
  if (equals()) {
3189
3164
  whitespace();
3190
- var second = optionallyQuotedSegment();
3165
+ var second = optionallyQuotedSegment(true);
3191
3166
  value = toQuery(value, second);
3192
3167
  whitespace();
3193
3168
  }
@@ -3375,7 +3350,7 @@ var ReferenceAssetsPlugin = function() {
3375
3350
  appendPathSegments(getValueForNode(resolvedNode));
3376
3351
  break;
3377
3352
  case "Value":
3378
- appendPathSegments(resolvedNode.value);
3353
+ appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
3379
3354
  break;
3380
3355
  case "Query":
3381
3356
  {
@@ -3451,7 +3426,7 @@ var ReferenceAssetsPlugin = function() {
3451
3426
  var _this_parseCache_path;
3452
3427
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3453
3428
  this.parseCache[path] = ast;
3454
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3429
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3455
3430
  var _ast_error;
3456
3431
  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."));
3457
3432
  }
@@ -3651,14 +3626,13 @@ var ReferenceAssetsPlugin = function() {
3651
3626
  }();
3652
3627
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3653
3628
  _inherits(DependencyModel, DependencyTracker);
3654
- var _super = _create_super(DependencyModel);
3655
3629
  function DependencyModel(rootModel) {
3656
3630
  _class_call_check(this, DependencyModel);
3657
3631
  var _this;
3658
- _this = _super.call(this);
3632
+ _this = _call_super(this, DependencyModel);
3659
3633
  _this.rootModel = rootModel;
3660
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3661
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3634
+ _this.set = _this.set.bind(_this);
3635
+ _this.get = _this.get.bind(_this);
3662
3636
  return _this;
3663
3637
  }
3664
3638
  _create_class(DependencyModel, [
@@ -4202,23 +4176,20 @@ var ReferenceAssetsPlugin = function() {
4202
4176
  * @experimental These Player APIs are in active development and may change. Use with caution
4203
4177
  */ key: "evaluateAsync",
4204
4178
  value: function evaluateAsync(expr, options) {
4179
+ var _this = this;
4205
4180
  if (Array.isArray(expr)) {
4206
- var _this = this;
4207
- return collateAwaitable(expr.map(function() {
4208
- var _ref = _async_to_generator(function(exp) {
4181
+ return collateAwaitable(expr.map(function(exp) {
4182
+ return _async_to_generator(function() {
4209
4183
  return _ts_generator(this, function(_state) {
4210
4184
  return [
4211
4185
  2,
4212
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
4186
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
4213
4187
  async: true
4214
4188
  }))
4215
4189
  ];
4216
4190
  });
4217
- });
4218
- return function(exp) {
4219
- return _ref.apply(this, arguments);
4220
- };
4221
- }())).awaitableThen(function(values) {
4191
+ }).call(_this);
4192
+ })).awaitableThen(function(values) {
4222
4193
  return values.pop();
4223
4194
  });
4224
4195
  } else {
@@ -4955,23 +4926,8 @@ var ReferenceAssetsPlugin = function() {
4955
4926
  function Parser() {
4956
4927
  _class_call_check(this, Parser);
4957
4928
  this.hooks = {
4958
- /**
4959
- * A hook to interact with an object _before_ parsing it into an AST
4960
- *
4961
- * @param value - The object we're are about to parse
4962
- * @returns - A new value to parse.
4963
- * If undefined, the original value is used.
4964
- * If null, we stop parsing this node.
4965
- */ onParseObject: new SyncWaterfallHook(),
4966
- /**
4967
- * A callback to interact with an AST _after_ we parse it into the AST
4968
- *
4969
- * @param value - The object we parsed
4970
- * @param node - The AST node we generated
4971
- * @returns - A new AST node to use
4972
- * If undefined, the original value is used.
4973
- * If null, we ignore this node all together
4974
- */ onCreateASTNode: new SyncWaterfallHook(),
4929
+ onParseObject: new SyncWaterfallHook(),
4930
+ onCreateASTNode: new SyncWaterfallHook(),
4975
4931
  parseNode: new SyncBailHook()
4976
4932
  };
4977
4933
  }
@@ -5009,7 +4965,7 @@ var ReferenceAssetsPlugin = function() {
5009
4965
  }
5010
4966
  var parseLocalObject = function(currentValue, objToParse) {
5011
4967
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
5012
- if (typeof objToParse !== "object" || objToParse === null) {
4968
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
5013
4969
  return {
5014
4970
  value: objToParse,
5015
4971
  children: []
@@ -5046,7 +5002,7 @@ var ReferenceAssetsPlugin = function() {
5046
5002
  if (newChildren) {
5047
5003
  var _children2;
5048
5004
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
5049
- } else if (localValue && typeof localValue === "object") {
5005
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
5050
5006
  var _children21;
5051
5007
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
5052
5008
  localKey
@@ -5113,20 +5069,14 @@ var ReferenceAssetsPlugin = function() {
5113
5069
  function Resolver(root, options) {
5114
5070
  _class_call_check(this, Resolver);
5115
5071
  this.hooks = {
5116
- /** A hook to allow skipping of the resolution tree for a specific node */ skipResolve: new SyncWaterfallHook(),
5117
- /** An event emitted before calculating the next update */ beforeUpdate: new SyncHook(),
5118
- /** An event emitted after calculating the next update */ afterUpdate: new SyncHook(),
5119
- /** The options passed to a node to resolve it to an object */ resolveOptions: new SyncWaterfallHook(),
5120
- /** A hook to transform the AST node into a new AST node before resolving it */ beforeResolve: new SyncWaterfallHook(),
5121
- /**
5122
- * A hook to transform an AST node into it's resolved value.
5123
- * This runs _before_ any children are resolved
5124
- */ resolve: new SyncWaterfallHook(),
5125
- /**
5126
- * A hook to transform the resolved value of an AST node.
5127
- * This runs _after_ all children nodes are resolved
5128
- */ afterResolve: new SyncWaterfallHook(),
5129
- /** Called at the very end of a node's tree being updated */ afterNodeUpdate: new SyncHook()
5072
+ skipResolve: new SyncWaterfallHook(),
5073
+ beforeUpdate: new SyncHook(),
5074
+ afterUpdate: new SyncHook(),
5075
+ resolveOptions: new SyncWaterfallHook(),
5076
+ beforeResolve: new SyncWaterfallHook(),
5077
+ resolve: new SyncWaterfallHook(),
5078
+ afterResolve: new SyncWaterfallHook(),
5079
+ afterNodeUpdate: new SyncHook()
5130
5080
  };
5131
5081
  this.root = root;
5132
5082
  this.options = options;
@@ -5134,6 +5084,7 @@ var ReferenceAssetsPlugin = function() {
5134
5084
  this.ASTMap = /* @__PURE__ */ new Map();
5135
5085
  this.logger = options.logger;
5136
5086
  this.idCache = /* @__PURE__ */ new Set();
5087
+ this.AsyncIdMap = /* @__PURE__ */ new Map();
5137
5088
  }
5138
5089
  _create_class(Resolver, [
5139
5090
  {
@@ -5144,13 +5095,27 @@ var ReferenceAssetsPlugin = function() {
5144
5095
  },
5145
5096
  {
5146
5097
  key: "update",
5147
- value: function update(changes) {
5098
+ value: function update(changes, asyncChanges) {
5099
+ var _this = this;
5148
5100
  this.hooks.beforeUpdate.call(changes);
5149
5101
  var resolveCache = /* @__PURE__ */ new Map();
5150
5102
  this.idCache.clear();
5151
5103
  var prevASTMap = new Map(this.ASTMap);
5152
5104
  this.ASTMap.clear();
5153
- var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap);
5105
+ var prevAsyncIdMap = new Map(this.AsyncIdMap);
5106
+ var nextAsyncIdMap = /* @__PURE__ */ new Map();
5107
+ asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
5108
+ var current = prevAsyncIdMap.get(id);
5109
+ while(current && prevASTMap.has(current)){
5110
+ var next = prevASTMap.get(current);
5111
+ if (next && _this.resolveCache.has(next)) {
5112
+ _this.resolveCache.delete(next);
5113
+ }
5114
+ current = current.parent;
5115
+ }
5116
+ });
5117
+ var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
5118
+ this.AsyncIdMap = nextAsyncIdMap;
5154
5119
  this.resolveCache = resolveCache;
5155
5120
  this.hooks.afterUpdate.call(updated.value);
5156
5121
  return updated.value;
@@ -5195,7 +5160,7 @@ var ReferenceAssetsPlugin = function() {
5195
5160
  Object.keys(clonedNode).forEach(function(key) {
5196
5161
  if (key === "parent") return;
5197
5162
  var value = clonedNode[key];
5198
- if (typeof value === "object" && value !== null) {
5163
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
5199
5164
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
5200
5165
  }
5201
5166
  });
@@ -5204,9 +5169,8 @@ var ReferenceAssetsPlugin = function() {
5204
5169
  },
5205
5170
  {
5206
5171
  key: "computeTree",
5207
- value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
5172
+ value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
5208
5173
  var _this = this;
5209
- var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
5210
5174
  var dependencyModel = new DependencyModel(options.data.model);
5211
5175
  dependencyModel.trackSubset("core");
5212
5176
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -5225,15 +5189,6 @@ var ReferenceAssetsPlugin = function() {
5225
5189
  var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
5226
5190
  var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
5227
5191
  var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
5228
- var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
5229
- parent: partiallyResolvedParent
5230
- });
5231
- var _this_hooks_beforeResolve_call;
5232
- var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
5233
- type: "empty"
5234
- };
5235
- 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");
5236
- 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";
5237
5192
  if (previousResult && shouldUseLastValue) {
5238
5193
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
5239
5194
  updated: false
@@ -5245,6 +5200,30 @@ var ReferenceAssetsPlugin = function() {
5245
5200
  updated: false
5246
5201
  });
5247
5202
  cacheUpdate.set(AST, resolvedUpdate);
5203
+ if (resolvedUpdate.node.type === "async") {
5204
+ nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
5205
+ }
5206
+ var _resolvedUpdate_node_asyncNodesResolved;
5207
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5208
+ try {
5209
+ 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){
5210
+ var key = _step.value;
5211
+ nextAsyncIdMap.set(key, resolvedUpdate.node);
5212
+ }
5213
+ } catch (err) {
5214
+ _didIteratorError = true;
5215
+ _iteratorError = err;
5216
+ } finally{
5217
+ try {
5218
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5219
+ _iterator.return();
5220
+ }
5221
+ } finally{
5222
+ if (_didIteratorError) {
5223
+ throw _iteratorError;
5224
+ }
5225
+ }
5226
+ }
5248
5227
  var handleChildNode = function(childNode) {
5249
5228
  var _prevASTMap_get;
5250
5229
  var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
@@ -5267,10 +5246,37 @@ var ReferenceAssetsPlugin = function() {
5267
5246
  repopulateASTMapFromCache(previousResult, node, rawParent);
5268
5247
  return update2;
5269
5248
  }
5270
- if (isNestedMultiNodeWithAsync) {
5271
- resolvedAST.parent = partiallyResolvedParent.parent;
5272
- } else {
5273
- resolvedAST.parent = partiallyResolvedParent;
5249
+ var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
5250
+ parent: partiallyResolvedParent
5251
+ });
5252
+ var _this_hooks_beforeResolve_call;
5253
+ var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
5254
+ type: "empty"
5255
+ };
5256
+ resolvedAST.parent = partiallyResolvedParent;
5257
+ if (resolvedAST.type === "async") {
5258
+ nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
5259
+ }
5260
+ var _resolvedAST_asyncNodesResolved;
5261
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5262
+ try {
5263
+ for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5264
+ var id = _step.value;
5265
+ nextAsyncIdMap.set(id, resolvedAST);
5266
+ }
5267
+ } catch (err) {
5268
+ _didIteratorError = true;
5269
+ _iteratorError = err;
5270
+ } finally{
5271
+ try {
5272
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
5273
+ _iterator.return();
5274
+ }
5275
+ } finally{
5276
+ if (_didIteratorError) {
5277
+ throw _iteratorError;
5278
+ }
5279
+ }
5274
5280
  }
5275
5281
  resolveOptions.node = resolvedAST;
5276
5282
  this.ASTMap.set(resolvedAST, node);
@@ -5284,7 +5290,7 @@ var ReferenceAssetsPlugin = function() {
5284
5290
  if ("children" in resolvedAST) {
5285
5291
  var _resolvedAST_children;
5286
5292
  var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
5287
- var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5293
+ var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5288
5294
  var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
5289
5295
  childTreeDeps.forEach(function(binding) {
5290
5296
  return childDependencies.add(binding);
@@ -5305,40 +5311,18 @@ var ReferenceAssetsPlugin = function() {
5305
5311
  resolvedAST.children = newChildren;
5306
5312
  } else if (resolvedAST.type === "multi-node") {
5307
5313
  var childValue = [];
5308
- var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
5309
- var hasAsync = resolvedAST.values.map(function(value, index) {
5310
- return value.type === "async" ? index : -1;
5311
- }).filter(function(index) {
5312
- return index !== -1;
5313
- });
5314
- var newValues = resolvedAST.values.map(function(mValue) {
5315
- var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5314
+ var rawParentToPassIn = node;
5315
+ resolvedAST.values = resolvedAST.values.map(function(mValue) {
5316
+ var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5316
5317
  if (mTree.value !== void 0 && mTree.value !== null) {
5317
- if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
5318
- unpackAndPush(mTree.value, childValue);
5319
- } else {
5320
- childValue.push(mTree.value);
5321
- }
5318
+ mTree.dependencies.forEach(function(bindingDep) {
5319
+ return childDependencies.add(bindingDep);
5320
+ });
5321
+ updated = updated || mTree.updated;
5322
+ childValue.push(mTree.value);
5322
5323
  }
5323
- mTree.dependencies.forEach(function(bindingDep) {
5324
- return childDependencies.add(bindingDep);
5325
- });
5326
- updated = updated || mTree.updated;
5327
5324
  return mTree.node;
5328
5325
  });
5329
- if (hasAsync.length > 0) {
5330
- var copy = newValues;
5331
- hasAsync.forEach(function(index) {
5332
- var _copy;
5333
- if (copy[index]) (_copy = copy).splice.apply(_copy, [
5334
- index,
5335
- 1
5336
- ].concat(_to_consumable_array(unpackNode(copy[index]))));
5337
- });
5338
- resolvedAST.values = copy;
5339
- } else {
5340
- resolvedAST.values = newValues;
5341
- }
5342
5326
  resolved = childValue;
5343
5327
  }
5344
5328
  childDependencies.forEach(function(bindingDep) {
@@ -5359,7 +5343,7 @@ var ReferenceAssetsPlugin = function() {
5359
5343
  value: resolved,
5360
5344
  dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
5361
5345
  };
5362
- this.hooks.afterNodeUpdate.call(node, isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : rawParent, update);
5346
+ this.hooks.afterNodeUpdate.call(node, rawParent, update);
5363
5347
  cacheUpdate.set(node, update);
5364
5348
  return update;
5365
5349
  }
@@ -5367,15 +5351,6 @@ var ReferenceAssetsPlugin = function() {
5367
5351
  ]);
5368
5352
  return Resolver;
5369
5353
  }();
5370
- function unpackAndPush(item, initial) {
5371
- if (item.asset.values && Array.isArray(item.asset.values)) {
5372
- item.asset.values.forEach(function(i) {
5373
- unpackAndPush(i, initial);
5374
- });
5375
- } else {
5376
- initial.push(item);
5377
- }
5378
- }
5379
5354
  var CrossfieldProvider = /*#__PURE__*/ function() {
5380
5355
  function CrossfieldProvider(initialView, parser, logger) {
5381
5356
  _class_call_check(this, CrossfieldProvider);
@@ -5443,9 +5418,11 @@ var ReferenceAssetsPlugin = function() {
5443
5418
  _create_class(ViewInstance, [
5444
5419
  {
5445
5420
  key: "updateAsync",
5446
- value: function updateAsync() {
5421
+ value: function updateAsync(asyncNode) {
5447
5422
  var _this_resolver;
5448
- var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update();
5423
+ var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
5424
+ asyncNode
5425
+ ]));
5449
5426
  this.lastUpdate = update;
5450
5427
  this.hooks.onUpdate.call(update);
5451
5428
  }
@@ -5563,11 +5540,12 @@ var ReferenceAssetsPlugin = function() {
5563
5540
  *
5564
5541
  * @param id - the id of async node. It should be identical for each async node
5565
5542
  */ function asyncNode(id) {
5566
- var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
5543
+ var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true, onValueReceived = arguments.length > 2 ? arguments[2] : void 0;
5567
5544
  return {
5568
5545
  id: id,
5569
5546
  type: "async",
5570
5547
  flatten: flatten2,
5548
+ onValueReceived: onValueReceived,
5571
5549
  value: {
5572
5550
  type: "value",
5573
5551
  value: {
@@ -5662,7 +5640,7 @@ var ReferenceAssetsPlugin = function() {
5662
5640
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5663
5641
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5664
5642
  var flags = "g";
5665
- if (typeof expression === "object") {
5643
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5666
5644
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5667
5645
  }
5668
5646
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5811,7 +5789,7 @@ var ReferenceAssetsPlugin = function() {
5811
5789
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5812
5790
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5813
5791
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5814
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5792
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5815
5793
  return node;
5816
5794
  }
5817
5795
  if (typeof node === "string") {
@@ -5824,7 +5802,7 @@ var ReferenceAssetsPlugin = function() {
5824
5802
  }
5825
5803
  var val = node[key];
5826
5804
  var newVal = val;
5827
- if (typeof val === "object") {
5805
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5828
5806
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5829
5807
  } else if (typeof val === "string") {
5830
5808
  newVal = resolveString(val, resolveOptions);
@@ -6113,7 +6091,7 @@ var ReferenceAssetsPlugin = function() {
6113
6091
  key: "applyParser",
6114
6092
  value: function applyParser(parser) {
6115
6093
  parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
6116
- if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
6094
+ if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
6117
6095
  var values = obj.map(function(childVal) {
6118
6096
  return parser.parseObject(childVal, "value", options);
6119
6097
  }).filter(function(child) {
@@ -6124,7 +6102,7 @@ var ReferenceAssetsPlugin = function() {
6124
6102
  }
6125
6103
  var multiNode = parser.createASTNode({
6126
6104
  type: "multi-node",
6127
- override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
6105
+ override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
6128
6106
  values: values
6129
6107
  }, obj);
6130
6108
  if (!multiNode) {
@@ -6135,7 +6113,7 @@ var ReferenceAssetsPlugin = function() {
6135
6113
  v.parent = multiNode;
6136
6114
  });
6137
6115
  }
6138
- return [
6116
+ return childOptions === void 0 ? multiNode : [
6139
6117
  {
6140
6118
  path: _to_consumable_array(childOptions.path).concat([
6141
6119
  childOptions.key
@@ -6165,7 +6143,7 @@ var ReferenceAssetsPlugin = function() {
6165
6143
  key: "applyParser",
6166
6144
  value: function applyParser(parser) {
6167
6145
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
6168
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
6146
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
6169
6147
  var assetAST = parser.parseObject(obj, "asset", options);
6170
6148
  if (!assetAST) {
6171
6149
  return [];
@@ -6365,6 +6343,7 @@ var ReferenceAssetsPlugin = function() {
6365
6343
  }();
6366
6344
  var FlowInstance = /*#__PURE__*/ function() {
6367
6345
  function FlowInstance(id, flow, options) {
6346
+ var _this = this;
6368
6347
  _class_call_check(this, FlowInstance);
6369
6348
  this.isTransitioning = false;
6370
6349
  this.hooks = {
@@ -6381,60 +6360,55 @@ var ReferenceAssetsPlugin = function() {
6381
6360
  this.flow = flow;
6382
6361
  this.log = options === null || options === void 0 ? void 0 : options.logger;
6383
6362
  this.history = [];
6384
- var _this = this;
6385
- this.hooks.transition.tap("startPromise", function() {
6386
- var _ref = _async_to_generator(function(_oldState, nextState) {
6363
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
6364
+ return _async_to_generator(function() {
6387
6365
  var newState;
6388
6366
  return _ts_generator(this, function(_state) {
6389
6367
  newState = nextState.value;
6390
- if (_this.flowPromise && newState.state_type === "END") {
6391
- _this.flowPromise.resolve(newState);
6368
+ if (this.flowPromise && newState.state_type === "END") {
6369
+ this.flowPromise.resolve(newState);
6392
6370
  }
6393
6371
  return [
6394
6372
  2
6395
6373
  ];
6396
6374
  });
6397
- });
6398
- return function(_oldState, nextState) {
6399
- return _ref.apply(this, arguments);
6400
- };
6401
- }());
6375
+ }).call(_this);
6376
+ });
6402
6377
  }
6403
6378
  _create_class(FlowInstance, [
6404
6379
  {
6405
6380
  key: "start",
6406
6381
  value: /** Start the state machine */ function start() {
6407
- var _this = this;
6408
6382
  return _async_to_generator(function() {
6409
6383
  var _this_log, initialState;
6410
6384
  return _ts_generator(this, function(_state) {
6411
- if (_this.flowPromise) {
6385
+ if (this.flowPromise) {
6412
6386
  ;
6413
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6387
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6414
6388
  return [
6415
6389
  2,
6416
- _this.flowPromise.promise
6390
+ this.flowPromise.promise
6417
6391
  ];
6418
6392
  }
6419
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6420
- if (_this.flow.onStart) {
6421
- _this.hooks.onStart.call(_this.flow.onStart);
6393
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
6394
+ if (this.flow.onStart) {
6395
+ this.hooks.onStart.call(this.flow.onStart);
6422
6396
  }
6423
- initialState = _this.flow.startState;
6397
+ initialState = this.flow.startState;
6424
6398
  if (!initialState) {
6425
6399
  return [
6426
6400
  2,
6427
6401
  Promise.reject(new Error("No 'startState' defined for flow"))
6428
6402
  ];
6429
6403
  }
6430
- _this.flowPromise = (0, import_p_defer2.default)();
6431
- _this.pushHistory(initialState);
6404
+ this.flowPromise = (0, import_p_defer2.default)();
6405
+ this.pushHistory(initialState);
6432
6406
  return [
6433
6407
  2,
6434
- _this.flowPromise.promise
6408
+ this.flowPromise.promise
6435
6409
  ];
6436
6410
  });
6437
- })();
6411
+ }).call(this);
6438
6412
  }
6439
6413
  },
6440
6414
  {
@@ -6486,7 +6460,7 @@ var ReferenceAssetsPlugin = function() {
6486
6460
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6487
6461
  }
6488
6462
  var nextState = this.flow[stateName];
6489
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
6463
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
6490
6464
  var _this_log;
6491
6465
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6492
6466
  return;
@@ -6546,30 +6520,30 @@ var ReferenceAssetsPlugin = function() {
6546
6520
  {
6547
6521
  key: "run",
6548
6522
  value: function run(startState) {
6549
- var _this = this;
6550
6523
  return _async_to_generator(function() {
6551
- var _this_log, startFlow, flow, end, firstItem;
6524
+ var _this, _this_log, startFlow, flow, end, firstItem;
6552
6525
  return _ts_generator(this, function(_state) {
6553
6526
  switch(_state.label){
6554
6527
  case 0:
6555
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6528
+ _this = this;
6529
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6556
6530
  return [
6557
6531
  2,
6558
6532
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6559
6533
  ];
6560
6534
  }
6561
- startFlow = _this.navigation[startState];
6562
- if (startFlow === null || typeof startFlow !== "object") {
6535
+ startFlow = this.navigation[startState];
6536
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6563
6537
  return [
6564
6538
  2,
6565
6539
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6566
6540
  ];
6567
6541
  }
6568
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6542
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6569
6543
  flow = new FlowInstance(startState, startFlow, {
6570
- logger: _this.log
6544
+ logger: this.log
6571
6545
  });
6572
- _this.addNewFlow(flow);
6546
+ this.addNewFlow(flow);
6573
6547
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6574
6548
  var _flowInstance_currentState;
6575
6549
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6589,10 +6563,10 @@ var ReferenceAssetsPlugin = function() {
6589
6563
  ];
6590
6564
  case 1:
6591
6565
  end = _state.sent();
6592
- _this.navStack.pop();
6593
- if (_this.navStack.length > 0) {
6566
+ this.navStack.pop();
6567
+ if (this.navStack.length > 0) {
6594
6568
  firstItem = 0;
6595
- _this.current = _this.navStack[firstItem];
6569
+ this.current = this.navStack[firstItem];
6596
6570
  }
6597
6571
  return [
6598
6572
  2,
@@ -6600,16 +6574,15 @@ var ReferenceAssetsPlugin = function() {
6600
6574
  ];
6601
6575
  }
6602
6576
  });
6603
- })();
6577
+ }).call(this);
6604
6578
  }
6605
6579
  },
6606
6580
  {
6607
6581
  key: "start",
6608
6582
  value: function start() {
6609
- var _this = this;
6610
6583
  return _async_to_generator(function() {
6611
6584
  return _ts_generator(this, function(_state) {
6612
- if (!_this.navigation.BEGIN) {
6585
+ if (!this.navigation.BEGIN) {
6613
6586
  return [
6614
6587
  2,
6615
6588
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6617,10 +6590,10 @@ var ReferenceAssetsPlugin = function() {
6617
6590
  }
6618
6591
  return [
6619
6592
  2,
6620
- _this.run(_this.navigation.BEGIN)
6593
+ this.run(this.navigation.BEGIN)
6621
6594
  ];
6622
6595
  });
6623
- })();
6596
+ }).call(this);
6624
6597
  }
6625
6598
  }
6626
6599
  ]);
@@ -7727,7 +7700,7 @@ var ReferenceAssetsPlugin = function() {
7727
7700
  var parentBinding = resolved.parent();
7728
7701
  var property = resolved.key();
7729
7702
  var parentValue = this.get(parentBinding);
7730
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7703
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7731
7704
  this.getModel().delete(resolved, options);
7732
7705
  if (existedBeforeDelete && !this.get(resolved)) {
7733
7706
  this.trash.add(resolved);
@@ -7828,7 +7801,7 @@ var ReferenceAssetsPlugin = function() {
7828
7801
  var expressionEvaluator;
7829
7802
  var handleEval = function(exp) {
7830
7803
  if (exp) {
7831
- if (typeof exp === "object" && "exp" in exp) {
7804
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7832
7805
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7833
7806
  } else {
7834
7807
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -8089,7 +8062,7 @@ var ReferenceAssetsPlugin = function() {
8089
8062
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
8090
8063
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
8091
8064
  if (state.onEnd && state.transitions[computedTransitionVal]) {
8092
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
8065
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
8093
8066
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
8094
8067
  } else {
8095
8068
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -8248,12 +8221,12 @@ var ReferenceAssetsPlugin = function() {
8248
8221
  {
8249
8222
  key: "start",
8250
8223
  value: function start(payload) {
8251
- var _this = this;
8252
8224
  return _async_to_generator(function() {
8253
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8225
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
8254
8226
  return _ts_generator(this, function(_state) {
8255
8227
  switch(_state.label){
8256
8228
  case 0:
8229
+ _this = this;
8257
8230
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
8258
8231
  maybeUpdateState = function(newState) {
8259
8232
  if (_this.state.ref !== ref) {
@@ -8263,7 +8236,7 @@ var ReferenceAssetsPlugin = function() {
8263
8236
  _this.setState(newState);
8264
8237
  return newState;
8265
8238
  };
8266
- _this.setState({
8239
+ this.setState({
8267
8240
  status: "not-started",
8268
8241
  ref: ref
8269
8242
  });
@@ -8275,8 +8248,8 @@ var ReferenceAssetsPlugin = function() {
8275
8248
  ,
8276
8249
  4
8277
8250
  ]);
8278
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8279
- _this.setState(_object_spread({
8251
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
8252
+ this.setState(_object_spread({
8280
8253
  ref: ref
8281
8254
  }, state));
8282
8255
  start();
@@ -8321,7 +8294,7 @@ var ReferenceAssetsPlugin = function() {
8321
8294
  ];
8322
8295
  }
8323
8296
  });
8324
- })();
8297
+ }).call(this);
8325
8298
  }
8326
8299
  }
8327
8300
  ]);
@@ -8333,26 +8306,152 @@ var ReferenceAssetsPlugin = function() {
8333
8306
  };
8334
8307
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+async-node-plugin@0.0.0/node_modules/@player-ui/async-node-plugin/dist/index.mjs
8335
8308
  var import_queue_microtask3 = __toESM(require_queue_microtask(), 1);
8336
- var import_timm10 = __toESM(require_timm(), 1);
8337
- var asyncTransform = function(assetId, wrapperAssetType, asset, flatten2) {
8338
- var id = "async-" + assetId;
8339
- var asyncNode = Builder.asyncNode(id, flatten2);
8340
- var multiNode;
8341
- var assetNode;
8342
- if (asset) {
8343
- assetNode = Builder.assetWrapper(asset);
8344
- multiNode = Builder.multiNode(assetNode, asyncNode);
8345
- } else {
8346
- multiNode = Builder.multiNode(asyncNode);
8309
+ var getMatchValue = function(pathA, pathB) {
8310
+ if (pathA.length > pathB.length) {
8311
+ return 0;
8312
+ }
8313
+ var matchCount = 0;
8314
+ for(var i = 0; i < pathA.length; i++){
8315
+ if (pathA[i] === pathB[i]) {
8316
+ matchCount++;
8317
+ } else {
8318
+ return 0;
8319
+ }
8320
+ }
8321
+ return matchCount;
8322
+ };
8323
+ var extractNodeFromPath = function(node, path) {
8324
+ if (path === void 0 || path.length === 0) {
8325
+ return node;
8326
+ }
8327
+ if (!("children" in node && node.children)) {
8328
+ return void 0;
8329
+ }
8330
+ var matchResult = 0;
8331
+ var bestMatch;
8332
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8333
+ try {
8334
+ for(var _iterator = node.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8335
+ var child = _step.value;
8336
+ var matchValue = getMatchValue(child.path, path);
8337
+ if (matchValue > matchResult) {
8338
+ matchResult = matchValue;
8339
+ bestMatch = child;
8340
+ }
8341
+ }
8342
+ } catch (err) {
8343
+ _didIteratorError = true;
8344
+ _iteratorError = err;
8345
+ } finally{
8346
+ try {
8347
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
8348
+ _iterator.return();
8349
+ }
8350
+ } finally{
8351
+ if (_didIteratorError) {
8352
+ throw _iteratorError;
8353
+ }
8354
+ }
8355
+ }
8356
+ if (!bestMatch) {
8357
+ return void 0;
8358
+ }
8359
+ if (matchResult >= path.length) {
8360
+ return bestMatch.value;
8361
+ }
8362
+ return extractNodeFromPath(bestMatch.value, path.slice(matchResult));
8363
+ };
8364
+ var traverseAndReplace = function(node, replaceFn) {
8365
+ if (node.type === NodeType.MultiNode) {
8366
+ var index = 0;
8367
+ while(index < node.values.length){
8368
+ var child = node.values[index];
8369
+ if (!child) {
8370
+ index++;
8371
+ continue;
8372
+ }
8373
+ var result = replaceFn(child);
8374
+ if (result.type === NodeType.MultiNode) {
8375
+ node.values = _to_consumable_array(node.values.slice(0, index)).concat(_to_consumable_array(result.values), _to_consumable_array(node.values.slice(index + 1)));
8376
+ } else {
8377
+ node.values[index] = result;
8378
+ index++;
8379
+ }
8380
+ }
8381
+ return node;
8382
+ }
8383
+ return replaceFn(node);
8384
+ };
8385
+ var unwrapAsset = function(node) {
8386
+ var _node_children;
8387
+ if (node.type !== NodeType.Value) {
8388
+ return node;
8347
8389
  }
8348
- var wrapperAsset = Builder.asset({
8349
- id: wrapperAssetType + "-" + id,
8350
- type: wrapperAssetType
8390
+ var child = (_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children.find(function(x) {
8391
+ return x.path.length === 1 && x.path[0] === "asset";
8351
8392
  });
8352
- Builder.addChild(wrapperAsset, [
8393
+ if (!child) {
8394
+ return node;
8395
+ }
8396
+ return child.value;
8397
+ };
8398
+ var requiresAssetWrapper = function(node) {
8399
+ if (node.type === NodeType.Asset) {
8400
+ return true;
8401
+ }
8402
+ if (node.type !== NodeType.Applicability) {
8403
+ return false;
8404
+ }
8405
+ return node.value.type === NodeType.Asset;
8406
+ };
8407
+ var defaultGetNodeId = function(node) {
8408
+ return "async-".concat(node.value.id);
8409
+ };
8410
+ var createAsyncTransform = function(options) {
8411
+ var transformAssetType = options.transformAssetType, wrapperAssetType = options.wrapperAssetType, getNestedAsset = options.getNestedAsset, _options_getAsyncNodeId = options.getAsyncNodeId, getAsyncNodeId = _options_getAsyncNodeId === void 0 ? defaultGetNodeId : _options_getAsyncNodeId, _options_path = options.path, path = _options_path === void 0 ? [
8353
8412
  "values"
8354
- ], multiNode);
8355
- return wrapperAsset;
8413
+ ] : _options_path, tmp = options.flatten, flatten2 = tmp === void 0 ? true : tmp;
8414
+ var replaceNode = function(node) {
8415
+ var unwrapped = unwrapAsset(node);
8416
+ if (unwrapped.type !== NodeType.Asset || unwrapped.value.type !== transformAssetType) {
8417
+ return node;
8418
+ }
8419
+ var transformed = asyncTransform2(unwrapped);
8420
+ var _extractNodeFromPath;
8421
+ return (_extractNodeFromPath = extractNodeFromPath(transformed, path)) !== null && _extractNodeFromPath !== void 0 ? _extractNodeFromPath : node;
8422
+ };
8423
+ var replacer = function(node) {
8424
+ return traverseAndReplace(node, replaceNode);
8425
+ };
8426
+ var asyncTransform2 = function(node) {
8427
+ var id = getAsyncNodeId(node);
8428
+ var asset = getNestedAsset === null || getNestedAsset === void 0 ? void 0 : getNestedAsset(node);
8429
+ var replaceFunction = flatten2 ? replacer : void 0;
8430
+ var asyncNode = Builder.asyncNode(id, flatten2, replaceFunction);
8431
+ var multiNode;
8432
+ if (asset) {
8433
+ if (requiresAssetWrapper(asset)) {
8434
+ var assetWrappedNode = Builder.assetWrapper(asset);
8435
+ multiNode = Builder.multiNode(assetWrappedNode, asyncNode);
8436
+ } else if (asset.type === NodeType.MultiNode) {
8437
+ var _Builder;
8438
+ multiNode = (_Builder = Builder).multiNode.apply(_Builder, _to_consumable_array(asset.values).concat([
8439
+ asyncNode
8440
+ ]));
8441
+ } else {
8442
+ multiNode = Builder.multiNode(asset, asyncNode);
8443
+ }
8444
+ } else {
8445
+ multiNode = Builder.multiNode(asyncNode);
8446
+ }
8447
+ var wrapperAsset = Builder.asset({
8448
+ id: wrapperAssetType + "-" + id,
8449
+ type: wrapperAssetType
8450
+ });
8451
+ Builder.addChild(wrapperAsset, path, multiNode);
8452
+ return wrapperAsset;
8453
+ };
8454
+ return asyncTransform2;
8356
8455
  };
8357
8456
  var AsyncNodePluginSymbol = Symbol.for("AsyncNodePlugin");
8358
8457
  var _AsyncNodePlugin = /*#__PURE__*/ function() {
@@ -8372,8 +8471,8 @@ var ReferenceAssetsPlugin = function() {
8372
8471
  });
8373
8472
  }
8374
8473
  if (asyncHandler) {
8375
- this.hooks.onAsyncNode.tap("async", function() {
8376
- var _ref = _async_to_generator(function(node, callback) {
8474
+ this.hooks.onAsyncNode.tap("async", function(node, callback) {
8475
+ return _async_to_generator(function() {
8377
8476
  return _ts_generator(this, function(_state) {
8378
8477
  switch(_state.label){
8379
8478
  case 0:
@@ -8388,11 +8487,8 @@ var ReferenceAssetsPlugin = function() {
8388
8487
  ];
8389
8488
  }
8390
8489
  });
8391
- });
8392
- return function(node, callback) {
8393
- return _ref.apply(this, arguments);
8394
- };
8395
- }());
8490
+ })();
8491
+ });
8396
8492
  }
8397
8493
  }
8398
8494
  _create_class(_AsyncNodePlugin2, [
@@ -8439,6 +8535,9 @@ var ReferenceAssetsPlugin = function() {
8439
8535
  */ key: "parseNodeAndUpdate",
8440
8536
  value: function parseNodeAndUpdate(node, context, result, options) {
8441
8537
  var parsedNode = options.parseNode && result ? options.parseNode(result) : void 0;
8538
+ if (parsedNode && node.onValueReceived) {
8539
+ parsedNode = node.onValueReceived(parsedNode);
8540
+ }
8442
8541
  this.handleAsyncUpdate(node, context, parsedNode);
8443
8542
  }
8444
8543
  },
@@ -8456,10 +8555,17 @@ var ReferenceAssetsPlugin = function() {
8456
8555
  var nodeResolveCache = context.nodeResolveCache, view = context.view;
8457
8556
  if (nodeResolveCache.get(node.id) !== newNode) {
8458
8557
  nodeResolveCache.set(node.id, newNode ? newNode : node);
8459
- view.updateAsync();
8558
+ view.updateAsync(node.id);
8460
8559
  }
8461
8560
  }
8462
8561
  },
8562
+ {
8563
+ key: "hasValidMapping",
8564
+ value: function hasValidMapping(node, context) {
8565
+ var nodeResolveCache = context.nodeResolveCache;
8566
+ return nodeResolveCache.has(node.id) && nodeResolveCache.get(node.id) !== node;
8567
+ }
8568
+ },
8463
8569
  {
8464
8570
  /**
8465
8571
  * Handles the asynchronous API integration for resolving nodes.
@@ -8471,11 +8577,11 @@ var ReferenceAssetsPlugin = function() {
8471
8577
  var _this = this;
8472
8578
  resolver.hooks.beforeResolve.tap(this.name, function(node, options) {
8473
8579
  if (!_this.isAsync(node)) {
8474
- return node;
8580
+ return node === null ? node : _this.resolveAsyncChildren(node, context);
8475
8581
  }
8476
8582
  var resolvedNode = context.nodeResolveCache.get(node.id);
8477
8583
  if (resolvedNode !== void 0) {
8478
- return resolvedNode;
8584
+ return _this.resolveAsyncChildren(resolvedNode, context);
8479
8585
  }
8480
8586
  if (context.inProgressNodes.has(node.id)) {
8481
8587
  return node;
@@ -8488,42 +8594,90 @@ var ReferenceAssetsPlugin = function() {
8488
8594
  });
8489
8595
  }
8490
8596
  },
8597
+ {
8598
+ /**
8599
+ * Replaces child async nodes with their resolved content and flattens when necessary. Resolving the children directly helps manage the `parent` reference without needing as much work within the resolver itself.
8600
+ * Handles async node chains as well to make sure all applicable nodes can get flattened.
8601
+ * @param node - The node whose children need to be resolved.
8602
+ * @param context - the async plugin context needed to reach into the cache
8603
+ * @returns The same node but with async node children mapped to their resolved AST.
8604
+ */ key: "resolveAsyncChildren",
8605
+ value: function resolveAsyncChildren(node, context) {
8606
+ var _this = this;
8607
+ var _node_asyncNodesResolved;
8608
+ var asyncNodesResolved = (_node_asyncNodesResolved = node.asyncNodesResolved) !== null && _node_asyncNodesResolved !== void 0 ? _node_asyncNodesResolved : [];
8609
+ node.asyncNodesResolved = asyncNodesResolved;
8610
+ if (node.type === NodeType.MultiNode) {
8611
+ var index = 0;
8612
+ while(index < node.values.length){
8613
+ var childNode = node.values[index];
8614
+ if ((childNode === null || childNode === void 0 ? void 0 : childNode.type) !== NodeType.Async || !this.hasValidMapping(childNode, context)) {
8615
+ index++;
8616
+ continue;
8617
+ }
8618
+ var mappedNode = context.nodeResolveCache.get(childNode.id);
8619
+ asyncNodesResolved.push(childNode.id);
8620
+ if (mappedNode.type === NodeType.MultiNode && childNode.flatten) {
8621
+ mappedNode.values.forEach(function(v) {
8622
+ return v.parent = node;
8623
+ });
8624
+ node.values = _to_consumable_array(node.values.slice(0, index)).concat(_to_consumable_array(mappedNode.values), _to_consumable_array(node.values.slice(index + 1)));
8625
+ } else {
8626
+ node.values[index] = mappedNode;
8627
+ mappedNode.parent = node;
8628
+ }
8629
+ }
8630
+ } else if ("children" in node) {
8631
+ var _node_children;
8632
+ (_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children.forEach(function(c) {
8633
+ while(c.value.type === NodeType.Async && _this.hasValidMapping(c.value, context)){
8634
+ asyncNodesResolved.push(c.value.id);
8635
+ c.value = context.nodeResolveCache.get(c.value.id);
8636
+ c.value.parent = node;
8637
+ }
8638
+ });
8639
+ }
8640
+ return node;
8641
+ }
8642
+ },
8491
8643
  {
8492
8644
  key: "runAsyncNode",
8493
8645
  value: function runAsyncNode(node, context, options) {
8494
- var _this = this;
8495
8646
  return _async_to_generator(function() {
8496
- var _this_basePlugin, result, e, _this_basePlugin1, _options_logger, error, result1, _this_basePlugin_getPlayerInstance, _this_basePlugin2, playerState;
8647
+ var _this, _this_basePlugin, result, e, _this_basePlugin1, _options_logger, error, result1, _this_basePlugin_getPlayerInstance, _this_basePlugin2, playerState;
8497
8648
  return _ts_generator(this, function(_state) {
8498
8649
  switch(_state.label){
8499
8650
  case 0:
8651
+ _this = this;
8652
+ _state.label = 1;
8653
+ case 1:
8500
8654
  _state.trys.push([
8501
- 0,
8502
- 2,
8655
+ 1,
8656
+ 3,
8503
8657
  ,
8504
- 3
8658
+ 4
8505
8659
  ]);
8506
8660
  return [
8507
8661
  4,
8508
- (_this_basePlugin = _this.basePlugin) === null || _this_basePlugin === void 0 ? void 0 : _this_basePlugin.hooks.onAsyncNode.call(node, function(result2) {
8662
+ (_this_basePlugin = this.basePlugin) === null || _this_basePlugin === void 0 ? void 0 : _this_basePlugin.hooks.onAsyncNode.call(node, function(result2) {
8509
8663
  _this.parseNodeAndUpdate(node, context, result2, options);
8510
8664
  })
8511
8665
  ];
8512
- case 1:
8666
+ case 2:
8513
8667
  result = _state.sent();
8514
8668
  context.inProgressNodes.delete(node.id);
8515
- _this.parseNodeAndUpdate(node, context, result, options);
8669
+ this.parseNodeAndUpdate(node, context, result, options);
8516
8670
  return [
8517
8671
  3,
8518
- 3
8672
+ 4
8519
8673
  ];
8520
- case 2:
8674
+ case 3:
8521
8675
  e = _state.sent();
8522
8676
  error = _instanceof(e, Error) ? e : new Error(String(e));
8523
- result1 = (_this_basePlugin1 = _this.basePlugin) === null || _this_basePlugin1 === void 0 ? void 0 : _this_basePlugin1.hooks.onAsyncNodeError.call(error, node);
8677
+ result1 = (_this_basePlugin1 = this.basePlugin) === null || _this_basePlugin1 === void 0 ? void 0 : _this_basePlugin1.hooks.onAsyncNodeError.call(error, node);
8524
8678
  if (result1 === void 0) {
8525
8679
  ;
8526
- playerState = (_this_basePlugin2 = _this.basePlugin) === null || _this_basePlugin2 === void 0 ? void 0 : (_this_basePlugin_getPlayerInstance = _this_basePlugin2.getPlayerInstance()) === null || _this_basePlugin_getPlayerInstance === void 0 ? void 0 : _this_basePlugin_getPlayerInstance.getState();
8680
+ playerState = (_this_basePlugin2 = this.basePlugin) === null || _this_basePlugin2 === void 0 ? void 0 : (_this_basePlugin_getPlayerInstance = _this_basePlugin2.getPlayerInstance()) === null || _this_basePlugin_getPlayerInstance === void 0 ? void 0 : _this_basePlugin_getPlayerInstance.getState();
8527
8681
  if ((playerState === null || playerState === void 0 ? void 0 : playerState.status) === "in-progress") {
8528
8682
  playerState.fail(error);
8529
8683
  }
@@ -8533,18 +8687,18 @@ var ReferenceAssetsPlugin = function() {
8533
8687
  }
8534
8688
  (_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.error("Async node handling failed and resolved with a fallback. Error:", error);
8535
8689
  context.inProgressNodes.delete(node.id);
8536
- _this.parseNodeAndUpdate(node, context, result1, options);
8690
+ this.parseNodeAndUpdate(node, context, result1, options);
8537
8691
  return [
8538
8692
  3,
8539
- 3
8693
+ 4
8540
8694
  ];
8541
- case 3:
8695
+ case 4:
8542
8696
  return [
8543
8697
  2
8544
8698
  ];
8545
8699
  }
8546
8700
  });
8547
- })();
8701
+ }).call(this);
8548
8702
  }
8549
8703
  },
8550
8704
  {
@@ -8556,7 +8710,7 @@ var ReferenceAssetsPlugin = function() {
8556
8710
  {
8557
8711
  key: "isDeterminedAsync",
8558
8712
  value: function isDeterminedAsync(obj) {
8559
- return obj && Object.prototype.hasOwnProperty.call(obj, "async");
8713
+ return (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, "async");
8560
8714
  }
8561
8715
  },
8562
8716
  {
@@ -8565,7 +8719,11 @@ var ReferenceAssetsPlugin = function() {
8565
8719
  var _this = this;
8566
8720
  parser.hooks.parseNode.tap(this.name, function(obj, nodeType, options, childOptions) {
8567
8721
  if (_this.isDeterminedAsync(obj)) {
8568
- var parsedAsync = parser.parseObject((0, import_timm10.omit)(obj, "async"), nodeType, options);
8722
+ var async = obj.async, flatten2 = obj.flatten, rest = _object_without_properties(obj, [
8723
+ "async",
8724
+ "flatten"
8725
+ ]);
8726
+ var parsedAsync = parser.parseObject(rest, nodeType, options);
8569
8727
  var parsedNodeId = getNodeID(parsedAsync);
8570
8728
  if (parsedAsync === null || !parsedNodeId) {
8571
8729
  return childOptions ? [] : null;
@@ -8573,7 +8731,8 @@ var ReferenceAssetsPlugin = function() {
8573
8731
  var asyncAST = parser.createASTNode({
8574
8732
  id: parsedNodeId,
8575
8733
  type: NodeType.Async,
8576
- value: parsedAsync
8734
+ value: parsedAsync,
8735
+ flatten: flatten2
8577
8736
  }, obj);
8578
8737
  if (childOptions) {
8579
8738
  return asyncAST ? [
@@ -8615,14 +8774,14 @@ var ReferenceAssetsPlugin = function() {
8615
8774
  return AsyncNodePluginPlugin;
8616
8775
  }();
8617
8776
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/reference-assets/core/src/assets/chat-message/transform.ts
8618
- var transform2 = function(asset) {
8619
- var _asset_children_, _asset_children;
8620
- var newAsset = (_asset_children = asset.children) === null || _asset_children === void 0 ? void 0 : (_asset_children_ = _asset_children[0]) === null || _asset_children_ === void 0 ? void 0 : _asset_children_.value;
8621
- if (!newAsset) {
8622
- return asyncTransform(asset.value.id, "collection");
8777
+ var transform2 = createAsyncTransform({
8778
+ transformAssetType: "chat-message",
8779
+ wrapperAssetType: "collection",
8780
+ getNestedAsset: function(node) {
8781
+ var _node_children_, _node_children;
8782
+ return (_node_children = node.children) === null || _node_children === void 0 ? void 0 : (_node_children_ = _node_children[0]) === null || _node_children_ === void 0 ? void 0 : _node_children_.value;
8623
8783
  }
8624
- return asyncTransform(asset.value.id, "collection", newAsset);
8625
- };
8784
+ });
8626
8785
  var chatMessageTransform = compose(composeBefore(transform2));
8627
8786
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+meta-plugin@0.0.0/node_modules/@player-ui/meta-plugin/dist/index.mjs
8628
8787
  var MetaPlugin = /*#__PURE__*/ function() {