@player-ui/async-node-plugin 0.13.0 → 0.13.1--canary.717.26597

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/AsyncNodePlugin.native.js +474 -279
  2. package/dist/AsyncNodePlugin.native.js.map +1 -1
  3. package/dist/cjs/index.cjs +222 -20
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/index.legacy-esm.js +222 -18
  6. package/dist/index.mjs +222 -18
  7. package/dist/index.mjs.map +1 -1
  8. package/package.json +2 -2
  9. package/src/__tests__/__snapshots__/transform.test.ts.snap +1 -0
  10. package/src/__tests__/createAsyncTransform.test.ts +515 -0
  11. package/src/__tests__/index.test.ts +94 -13
  12. package/src/__tests__/transform.bench.ts +177 -0
  13. package/src/createAsyncTransform.ts +110 -0
  14. package/src/index.ts +93 -13
  15. package/src/transform.ts +5 -2
  16. package/src/types.ts +1 -0
  17. package/src/utils/__tests__/extractNodeFromPath.test.ts +181 -0
  18. package/src/utils/__tests__/requiresAssetWrapper.test.ts +63 -0
  19. package/src/utils/__tests__/traverseAndReplace.test.ts +182 -0
  20. package/src/utils/__tests__/unwrapAsset.test.ts +65 -0
  21. package/src/utils/extractNodeFromPath.ts +56 -0
  22. package/src/utils/index.ts +4 -0
  23. package/src/utils/requiresAssetWrapper.ts +14 -0
  24. package/src/utils/traverseAndReplace.ts +34 -0
  25. package/src/utils/unwrapAsset.ts +16 -0
  26. package/types/createAsyncTransform.d.ts +26 -0
  27. package/types/index.d.ts +16 -1
  28. package/types/transform.d.ts +2 -1
  29. package/types/types.d.ts +1 -1
  30. package/types/utils/extractNodeFromPath.d.ts +4 -0
  31. package/types/utils/index.d.ts +5 -0
  32. package/types/utils/requiresAssetWrapper.d.ts +3 -0
  33. package/types/utils/traverseAndReplace.d.ts +4 -0
  34. package/types/utils/unwrapAsset.d.ts +3 -0
@@ -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 AsyncNodePlugin = 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 AsyncNodePlugin = 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 AsyncNodePlugin = 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 AsyncNodePlugin = 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 AsyncNodePlugin = function() {
1419
1403
  if (!node) {
1420
1404
  return;
1421
1405
  }
1422
- if ("value" in node && typeof node.value === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1406
+ if ("value" in node && _type_of(node.value) === "object" && typeof ((_node_value = node.value) === null || _node_value === void 0 ? void 0 : _node_value.id) === "string") {
1423
1407
  return node.value.id;
1424
1408
  }
1425
1409
  };
@@ -1454,22 +1438,6 @@ var AsyncNodePlugin = function() {
1454
1438
  }
1455
1439
  });
1456
1440
  };
1457
- var unpackNode = function unpackNode(item) {
1458
- var _item_children_, _item_children, _item_children_1, _item_children1;
1459
- var unpacked = [];
1460
- if ("children" in item && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.value.type) === "asset" && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : (_item_children_1 = _item_children1[0]) === null || _item_children_1 === void 0 ? void 0 : _item_children_1.value).children) {
1461
- var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
1462
- if (((_item_children__value_children = ((_item_children2 = item.children) === null || _item_children2 === void 0 ? void 0 : (_item_children_2 = _item_children2[0]) === null || _item_children_2 === void 0 ? void 0 : _item_children_2.value).children) === null || _item_children__value_children === void 0 ? void 0 : (_item_children__value_children_ = _item_children__value_children[0]) === null || _item_children__value_children_ === void 0 ? void 0 : _item_children__value_children_.value.type) === "multi-node") {
1463
- var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
1464
- ((_item_children__value_children1 = ((_item_children3 = item.children) === null || _item_children3 === void 0 ? void 0 : (_item_children_3 = _item_children3[0]) === null || _item_children_3 === void 0 ? void 0 : _item_children_3.value).children) === null || _item_children__value_children1 === void 0 ? void 0 : (_item_children__value_children_1 = _item_children__value_children1[0]) === null || _item_children__value_children_1 === void 0 ? void 0 : _item_children__value_children_1.value).values.forEach(function(value) {
1465
- unpacked.push(value);
1466
- });
1467
- }
1468
- } else {
1469
- unpacked.push(item);
1470
- }
1471
- return unpacked;
1472
- };
1473
1441
  var hasSomethingToResolve = function hasSomethingToResolve(str) {
1474
1442
  return bindingResolveLookup(str) || expressionResolveLookup(str);
1475
1443
  };
@@ -1547,7 +1515,7 @@ var AsyncNodePlugin = function() {
1547
1515
  });
1548
1516
  };
1549
1517
  var __copyProps = function(to, from, except, desc) {
1550
- if (from && typeof from === "object" || typeof from === "function") {
1518
+ if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1551
1519
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1552
1520
  try {
1553
1521
  var _loop = function() {
@@ -1602,15 +1570,16 @@ var AsyncNodePlugin = function() {
1602
1570
  exports.toError = exports.NestedError = void 0;
1603
1571
  var NestedError4 = /*#__PURE__*/ function(Error1) {
1604
1572
  _inherits(_NestedError, Error1);
1605
- var _super = _create_super(_NestedError);
1606
1573
  function _NestedError(message) {
1607
1574
  for(var _len = arguments.length, innerErrors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
1608
1575
  innerErrors[_key - 1] = arguments[_key];
1609
1576
  }
1610
1577
  _class_call_check(this, _NestedError);
1611
1578
  var _this;
1612
- _this = _super.call(this, message);
1613
- var thisErrorReport = _NestedError.getErrorReport(_assert_this_initialized(_this));
1579
+ _this = _call_super(this, _NestedError, [
1580
+ message
1581
+ ]);
1582
+ var thisErrorReport = _NestedError.getErrorReport(_this);
1614
1583
  if (innerErrors.length === 1) {
1615
1584
  var innerError = toError(innerErrors[0]);
1616
1585
  _this.innerErrors = [
@@ -1718,7 +1687,7 @@ var AsyncNodePlugin = function() {
1718
1687
  exports.merge = merge;
1719
1688
  exports.mergeDeep = mergeDeep;
1720
1689
  exports.mergeIn = mergeIn;
1721
- exports.omit = omit4;
1690
+ exports.omit = omit3;
1722
1691
  exports.addDefaults = addDefaults;
1723
1692
  exports.default = void 0;
1724
1693
  var INVALID_ARGS = "INVALID_ARGS";
@@ -1746,7 +1715,7 @@ var AsyncNodePlugin = function() {
1746
1715
  return out;
1747
1716
  }
1748
1717
  function isObject(o) {
1749
- return o != null && typeof o === "object";
1718
+ return o != null && (typeof o === "undefined" ? "undefined" : _type_of(o)) === "object";
1750
1719
  }
1751
1720
  function addLast2(array, val) {
1752
1721
  if (Array.isArray(val)) return array.concat(val);
@@ -1892,7 +1861,7 @@ var AsyncNodePlugin = function() {
1892
1861
  }
1893
1862
  return setIn8(a, path, nextVal);
1894
1863
  }
1895
- function omit4(obj, attrs) {
1864
+ function omit3(obj, attrs) {
1896
1865
  var omitList = Array.isArray(attrs) ? attrs : [
1897
1866
  attrs
1898
1867
  ];
@@ -1978,7 +1947,7 @@ var AsyncNodePlugin = function() {
1978
1947
  merge: merge,
1979
1948
  mergeDeep: mergeDeep,
1980
1949
  mergeIn: mergeIn,
1981
- omit: omit4,
1950
+ omit: omit3,
1982
1951
  addDefaults: addDefaults
1983
1952
  };
1984
1953
  var _default = timm;
@@ -2089,7 +2058,7 @@ var AsyncNodePlugin = function() {
2089
2058
  else return 0;
2090
2059
  }
2091
2060
  }();
2092
- if (typeof module === "object") module.exports = SortedArray2;
2061
+ if ((typeof module === "undefined" ? "undefined" : _type_of(module)) === "object") module.exports = SortedArray2;
2093
2062
  if (typeof define === "function" && define.amd) define(function() {
2094
2063
  return SortedArray2;
2095
2064
  });
@@ -2109,6 +2078,9 @@ var AsyncNodePlugin = function() {
2109
2078
  },
2110
2079
  asyncTransform: function() {
2111
2080
  return asyncTransform;
2081
+ },
2082
+ createAsyncTransform: function() {
2083
+ return createAsyncTransform;
2112
2084
  }
2113
2085
  });
2114
2086
  var InterceptionManager = /*#__PURE__*/ function() {
@@ -2295,10 +2267,9 @@ var AsyncNodePlugin = function() {
2295
2267
  }();
2296
2268
  var SyncHook = /*#__PURE__*/ function(Hook) {
2297
2269
  _inherits(SyncHook, Hook);
2298
- var _super = _create_super(SyncHook);
2299
2270
  function SyncHook() {
2300
2271
  _class_call_check(this, SyncHook);
2301
- return _super.apply(this, arguments);
2272
+ return _call_super(this, SyncHook, arguments);
2302
2273
  }
2303
2274
  _create_class(SyncHook, [
2304
2275
  {
@@ -2331,10 +2302,9 @@ var AsyncNodePlugin = function() {
2331
2302
  }(Hook);
2332
2303
  var SyncBailHook = /*#__PURE__*/ function(Hook) {
2333
2304
  _inherits(SyncBailHook, Hook);
2334
- var _super = _create_super(SyncBailHook);
2335
2305
  function SyncBailHook() {
2336
2306
  _class_call_check(this, SyncBailHook);
2337
- return _super.apply(this, arguments);
2307
+ return _call_super(this, SyncBailHook, arguments);
2338
2308
  }
2339
2309
  _create_class(SyncBailHook, [
2340
2310
  {
@@ -2366,10 +2336,9 @@ var AsyncNodePlugin = function() {
2366
2336
  }(Hook);
2367
2337
  var SyncWaterfallHook = /*#__PURE__*/ function(Hook) {
2368
2338
  _inherits(SyncWaterfallHook, Hook);
2369
- var _super = _create_super(SyncWaterfallHook);
2370
2339
  function SyncWaterfallHook() {
2371
2340
  _class_call_check(this, SyncWaterfallHook);
2372
- return _super.apply(this, arguments);
2341
+ return _call_super(this, SyncWaterfallHook, arguments);
2373
2342
  }
2374
2343
  _create_class(SyncWaterfallHook, [
2375
2344
  {
@@ -2401,10 +2370,9 @@ var AsyncNodePlugin = function() {
2401
2370
  }(Hook);
2402
2371
  var AsyncParallelBailHook = /*#__PURE__*/ function(Hook) {
2403
2372
  _inherits(AsyncParallelBailHook, Hook);
2404
- var _super = _create_super(AsyncParallelBailHook);
2405
2373
  function AsyncParallelBailHook() {
2406
2374
  _class_call_check(this, AsyncParallelBailHook);
2407
- return _super.apply(this, arguments);
2375
+ return _call_super(this, AsyncParallelBailHook, arguments);
2408
2376
  }
2409
2377
  _create_class(AsyncParallelBailHook, [
2410
2378
  {
@@ -2413,14 +2381,13 @@ var AsyncNodePlugin = function() {
2413
2381
  for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
2414
2382
  args[_key] = arguments[_key];
2415
2383
  }
2416
- var _this = this;
2417
2384
  return _async_to_generator(function() {
2418
2385
  var _this_interceptions, ctx, rtn, e;
2419
2386
  return _ts_generator(this, function(_state) {
2420
2387
  switch(_state.label){
2421
2388
  case 0:
2422
2389
  ctx = {};
2423
- (_this_interceptions = _this.interceptions).call.apply(_this_interceptions, [
2390
+ (_this_interceptions = this.interceptions).call.apply(_this_interceptions, [
2424
2391
  ctx
2425
2392
  ].concat(_to_consumable_array(args)));
2426
2393
  _state.label = 1;
@@ -2433,20 +2400,20 @@ var AsyncNodePlugin = function() {
2433
2400
  ]);
2434
2401
  return [
2435
2402
  4,
2436
- Promise.race(_this.taps.map(function(tap) {
2403
+ Promise.race(this.taps.map(function(tap) {
2437
2404
  return callTap(tap, args, ctx);
2438
2405
  }))
2439
2406
  ];
2440
2407
  case 2:
2441
2408
  rtn = _state.sent();
2442
- _this.interceptions.result(rtn);
2409
+ this.interceptions.result(rtn);
2443
2410
  return [
2444
2411
  2,
2445
2412
  rtn
2446
2413
  ];
2447
2414
  case 3:
2448
2415
  e = _state.sent();
2449
- _this.interceptions.error(e);
2416
+ this.interceptions.error(e);
2450
2417
  throw e;
2451
2418
  case 4:
2452
2419
  return [
@@ -2454,7 +2421,7 @@ var AsyncNodePlugin = function() {
2454
2421
  ];
2455
2422
  }
2456
2423
  });
2457
- })();
2424
+ }).call(this);
2458
2425
  }
2459
2426
  }
2460
2427
  ]);
@@ -2492,7 +2459,7 @@ var AsyncNodePlugin = function() {
2492
2459
  for(var _iterator = foo[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2493
2460
  len = _step.value;
2494
2461
  tmp = len;
2495
- if (tmp && typeof tmp === "object") {
2462
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2496
2463
  tmp = find(bar, tmp);
2497
2464
  if (!tmp) return false;
2498
2465
  }
@@ -2523,7 +2490,7 @@ var AsyncNodePlugin = function() {
2523
2490
  for(var _iterator1 = foo[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2524
2491
  len = _step1.value;
2525
2492
  tmp = len[0];
2526
- if (tmp && typeof tmp === "object") {
2493
+ if (tmp && (typeof tmp === "undefined" ? "undefined" : _type_of(tmp)) === "object") {
2527
2494
  tmp = find(bar, tmp);
2528
2495
  if (!tmp) return false;
2529
2496
  }
@@ -2562,7 +2529,7 @@ var AsyncNodePlugin = function() {
2562
2529
  }
2563
2530
  return len === -1;
2564
2531
  }
2565
- if (!ctor || typeof foo === "object") {
2532
+ if (!ctor || (typeof foo === "undefined" ? "undefined" : _type_of(foo)) === "object") {
2566
2533
  len = 0;
2567
2534
  for(ctor in foo){
2568
2535
  if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
@@ -2595,7 +2562,7 @@ var AsyncNodePlugin = function() {
2595
2562
  var nestedPath = _to_consumable_array(path).concat([
2596
2563
  key
2597
2564
  ]);
2598
- if (typeof val === "object") {
2565
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
2599
2566
  traverseObj(val, nestedPath, pairs);
2600
2567
  } else {
2601
2568
  pairs.set(nestedPath, val);
@@ -2636,7 +2603,7 @@ var AsyncNodePlugin = function() {
2636
2603
  {
2637
2604
  /** Add match -> value mapping to the registry */ key: "set",
2638
2605
  value: function set(match, value) {
2639
- var matcher = typeof match === "object" ? createMatcher(match) : createBasicMatcher(match);
2606
+ var matcher = (typeof match === "undefined" ? "undefined" : _type_of(match)) === "object" ? createMatcher(match) : createBasicMatcher(match);
2640
2607
  this.store.insert({
2641
2608
  key: match,
2642
2609
  value: value,
@@ -2799,6 +2766,7 @@ var AsyncNodePlugin = function() {
2799
2766
  }
2800
2767
  };
2801
2768
  var identifier = function() {
2769
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2802
2770
  if (!isIdentifierChar(ch)) {
2803
2771
  return;
2804
2772
  }
@@ -2809,6 +2777,14 @@ var AsyncNodePlugin = function() {
2809
2777
  }
2810
2778
  value += ch;
2811
2779
  }
2780
+ if (allowBoolValue) {
2781
+ if (value === "true") {
2782
+ return toValue(true);
2783
+ }
2784
+ if (value === "false") {
2785
+ return toValue(false);
2786
+ }
2787
+ }
2812
2788
  if (value) {
2813
2789
  var maybeNumber = Number(value);
2814
2790
  value = isNaN(maybeNumber) ? value : maybeNumber;
@@ -2857,8 +2833,9 @@ var AsyncNodePlugin = function() {
2857
2833
  }
2858
2834
  };
2859
2835
  var simpleSegment = function() {
2836
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2860
2837
  var _nestedPath, _ref;
2861
- return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier();
2838
+ return (_ref = (_nestedPath = nestedPath()) !== null && _nestedPath !== void 0 ? _nestedPath : expression()) !== null && _ref !== void 0 ? _ref : identifier(allowBoolValue);
2862
2839
  };
2863
2840
  var segment = function() {
2864
2841
  var segments = [];
@@ -2873,6 +2850,7 @@ var AsyncNodePlugin = function() {
2873
2850
  return toConcatenatedNode(segments);
2874
2851
  };
2875
2852
  var optionallyQuotedSegment = function() {
2853
+ var allowBoolValue = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
2876
2854
  whitespace();
2877
2855
  if (ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE) {
2878
2856
  var singleQuote = ch === SINGLE_QUOTE;
@@ -2881,7 +2859,7 @@ var AsyncNodePlugin = function() {
2881
2859
  next(singleQuote ? SINGLE_QUOTE : DOUBLE_QUOTE);
2882
2860
  return id;
2883
2861
  }
2884
- return simpleSegment();
2862
+ return simpleSegment(allowBoolValue);
2885
2863
  };
2886
2864
  var equals = function() {
2887
2865
  if (ch !== EQUALS) {
@@ -2901,7 +2879,7 @@ var AsyncNodePlugin = function() {
2901
2879
  whitespace();
2902
2880
  if (equals()) {
2903
2881
  whitespace();
2904
- var second = optionallyQuotedSegment();
2882
+ var second = optionallyQuotedSegment(true);
2905
2883
  value = toQuery(value, second);
2906
2884
  whitespace();
2907
2885
  }
@@ -3089,7 +3067,7 @@ var AsyncNodePlugin = function() {
3089
3067
  appendPathSegments(getValueForNode(resolvedNode));
3090
3068
  break;
3091
3069
  case "Value":
3092
- appendPathSegments(resolvedNode.value);
3070
+ appendPathSegments(typeof resolvedNode.value === "boolean" ? String(resolvedNode.value) : resolvedNode.value);
3093
3071
  break;
3094
3072
  case "Query":
3095
3073
  {
@@ -3165,7 +3143,7 @@ var AsyncNodePlugin = function() {
3165
3143
  var _this_parseCache_path;
3166
3144
  var ast = (_this_parseCache_path = this.parseCache[path]) !== null && _this_parseCache_path !== void 0 ? _this_parseCache_path : parse(path);
3167
3145
  this.parseCache[path] = ast;
3168
- if (typeof ast !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3146
+ if ((typeof ast === "undefined" ? "undefined" : _type_of(ast)) !== "object" || !(ast === null || ast === void 0 ? void 0 : ast.status)) {
3169
3147
  var _ast_error;
3170
3148
  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."));
3171
3149
  }
@@ -3365,14 +3343,13 @@ var AsyncNodePlugin = function() {
3365
3343
  }();
3366
3344
  var DependencyModel = /*#__PURE__*/ function(DependencyTracker) {
3367
3345
  _inherits(DependencyModel, DependencyTracker);
3368
- var _super = _create_super(DependencyModel);
3369
3346
  function DependencyModel(rootModel) {
3370
3347
  _class_call_check(this, DependencyModel);
3371
3348
  var _this;
3372
- _this = _super.call(this);
3349
+ _this = _call_super(this, DependencyModel);
3373
3350
  _this.rootModel = rootModel;
3374
- _this.set = _this.set.bind(_assert_this_initialized(_this));
3375
- _this.get = _this.get.bind(_assert_this_initialized(_this));
3351
+ _this.set = _this.set.bind(_this);
3352
+ _this.get = _this.get.bind(_this);
3376
3353
  return _this;
3377
3354
  }
3378
3355
  _create_class(DependencyModel, [
@@ -3916,23 +3893,20 @@ var AsyncNodePlugin = function() {
3916
3893
  * @experimental These Player APIs are in active development and may change. Use with caution
3917
3894
  */ key: "evaluateAsync",
3918
3895
  value: function evaluateAsync(expr, options) {
3896
+ var _this = this;
3919
3897
  if (Array.isArray(expr)) {
3920
- var _this = this;
3921
- return collateAwaitable(expr.map(function() {
3922
- var _ref = _async_to_generator(function(exp) {
3898
+ return collateAwaitable(expr.map(function(exp) {
3899
+ return _async_to_generator(function() {
3923
3900
  return _ts_generator(this, function(_state) {
3924
3901
  return [
3925
3902
  2,
3926
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3903
+ this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
3927
3904
  async: true
3928
3905
  }))
3929
3906
  ];
3930
3907
  });
3931
- });
3932
- return function(exp) {
3933
- return _ref.apply(this, arguments);
3934
- };
3935
- }())).awaitableThen(function(values) {
3908
+ }).call(_this);
3909
+ })).awaitableThen(function(values) {
3936
3910
  return values.pop();
3937
3911
  });
3938
3912
  } else {
@@ -4669,23 +4643,8 @@ var AsyncNodePlugin = function() {
4669
4643
  function Parser() {
4670
4644
  _class_call_check(this, Parser);
4671
4645
  this.hooks = {
4672
- /**
4673
- * A hook to interact with an object _before_ parsing it into an AST
4674
- *
4675
- * @param value - The object we're are about to parse
4676
- * @returns - A new value to parse.
4677
- * If undefined, the original value is used.
4678
- * If null, we stop parsing this node.
4679
- */ onParseObject: new SyncWaterfallHook(),
4680
- /**
4681
- * A callback to interact with an AST _after_ we parse it into the AST
4682
- *
4683
- * @param value - The object we parsed
4684
- * @param node - The AST node we generated
4685
- * @returns - A new AST node to use
4686
- * If undefined, the original value is used.
4687
- * If null, we ignore this node all together
4688
- */ onCreateASTNode: new SyncWaterfallHook(),
4646
+ onParseObject: new SyncWaterfallHook(),
4647
+ onCreateASTNode: new SyncWaterfallHook(),
4689
4648
  parseNode: new SyncBailHook()
4690
4649
  };
4691
4650
  }
@@ -4723,7 +4682,7 @@ var AsyncNodePlugin = function() {
4723
4682
  }
4724
4683
  var parseLocalObject = function(currentValue, objToParse) {
4725
4684
  var path = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
4726
- if (typeof objToParse !== "object" || objToParse === null) {
4685
+ if ((typeof objToParse === "undefined" ? "undefined" : _type_of(objToParse)) !== "object" || objToParse === null) {
4727
4686
  return {
4728
4687
  value: objToParse,
4729
4688
  children: []
@@ -4760,7 +4719,7 @@ var AsyncNodePlugin = function() {
4760
4719
  if (newChildren) {
4761
4720
  var _children2;
4762
4721
  (_children2 = children2).push.apply(_children2, _to_consumable_array(newChildren));
4763
- } else if (localValue && typeof localValue === "object") {
4722
+ } else if (localValue && (typeof localValue === "undefined" ? "undefined" : _type_of(localValue)) === "object") {
4764
4723
  var _children21;
4765
4724
  var result = parseLocalObject(accumulation.value, localValue, _to_consumable_array(path).concat([
4766
4725
  localKey
@@ -4827,20 +4786,14 @@ var AsyncNodePlugin = function() {
4827
4786
  function Resolver(root, options) {
4828
4787
  _class_call_check(this, Resolver);
4829
4788
  this.hooks = {
4830
- /** A hook to allow skipping of the resolution tree for a specific node */ skipResolve: new SyncWaterfallHook(),
4831
- /** An event emitted before calculating the next update */ beforeUpdate: new SyncHook(),
4832
- /** An event emitted after calculating the next update */ afterUpdate: new SyncHook(),
4833
- /** The options passed to a node to resolve it to an object */ resolveOptions: new SyncWaterfallHook(),
4834
- /** A hook to transform the AST node into a new AST node before resolving it */ beforeResolve: new SyncWaterfallHook(),
4835
- /**
4836
- * A hook to transform an AST node into it's resolved value.
4837
- * This runs _before_ any children are resolved
4838
- */ resolve: new SyncWaterfallHook(),
4839
- /**
4840
- * A hook to transform the resolved value of an AST node.
4841
- * This runs _after_ all children nodes are resolved
4842
- */ afterResolve: new SyncWaterfallHook(),
4843
- /** Called at the very end of a node's tree being updated */ afterNodeUpdate: new SyncHook()
4789
+ skipResolve: new SyncWaterfallHook(),
4790
+ beforeUpdate: new SyncHook(),
4791
+ afterUpdate: new SyncHook(),
4792
+ resolveOptions: new SyncWaterfallHook(),
4793
+ beforeResolve: new SyncWaterfallHook(),
4794
+ resolve: new SyncWaterfallHook(),
4795
+ afterResolve: new SyncWaterfallHook(),
4796
+ afterNodeUpdate: new SyncHook()
4844
4797
  };
4845
4798
  this.root = root;
4846
4799
  this.options = options;
@@ -4848,6 +4801,7 @@ var AsyncNodePlugin = function() {
4848
4801
  this.ASTMap = /* @__PURE__ */ new Map();
4849
4802
  this.logger = options.logger;
4850
4803
  this.idCache = /* @__PURE__ */ new Set();
4804
+ this.AsyncIdMap = /* @__PURE__ */ new Map();
4851
4805
  }
4852
4806
  _create_class(Resolver, [
4853
4807
  {
@@ -4858,13 +4812,27 @@ var AsyncNodePlugin = function() {
4858
4812
  },
4859
4813
  {
4860
4814
  key: "update",
4861
- value: function update(changes) {
4815
+ value: function update(changes, asyncChanges) {
4816
+ var _this = this;
4862
4817
  this.hooks.beforeUpdate.call(changes);
4863
4818
  var resolveCache = /* @__PURE__ */ new Map();
4864
4819
  this.idCache.clear();
4865
4820
  var prevASTMap = new Map(this.ASTMap);
4866
4821
  this.ASTMap.clear();
4867
- var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap);
4822
+ var prevAsyncIdMap = new Map(this.AsyncIdMap);
4823
+ var nextAsyncIdMap = /* @__PURE__ */ new Map();
4824
+ asyncChanges === null || asyncChanges === void 0 ? void 0 : asyncChanges.forEach(function(id) {
4825
+ var current = prevAsyncIdMap.get(id);
4826
+ while(current && prevASTMap.has(current)){
4827
+ var next = prevASTMap.get(current);
4828
+ if (next && _this.resolveCache.has(next)) {
4829
+ _this.resolveCache.delete(next);
4830
+ }
4831
+ current = current.parent;
4832
+ }
4833
+ });
4834
+ var updated = this.computeTree(this.root, void 0, changes, resolveCache, toNodeResolveOptions(this.options), void 0, prevASTMap, nextAsyncIdMap);
4835
+ this.AsyncIdMap = nextAsyncIdMap;
4868
4836
  this.resolveCache = resolveCache;
4869
4837
  this.hooks.afterUpdate.call(updated.value);
4870
4838
  return updated.value;
@@ -4909,7 +4877,7 @@ var AsyncNodePlugin = function() {
4909
4877
  Object.keys(clonedNode).forEach(function(key) {
4910
4878
  if (key === "parent") return;
4911
4879
  var value = clonedNode[key];
4912
- if (typeof value === "object" && value !== null) {
4880
+ if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && value !== null) {
4913
4881
  clonedNode[key] = Array.isArray(value) ? _to_consumable_array(value) : _object_spread({}, value);
4914
4882
  }
4915
4883
  });
@@ -4918,9 +4886,8 @@ var AsyncNodePlugin = function() {
4918
4886
  },
4919
4887
  {
4920
4888
  key: "computeTree",
4921
- value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
4889
+ value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap, nextAsyncIdMap) {
4922
4890
  var _this = this;
4923
- var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
4924
4891
  var dependencyModel = new DependencyModel(options.data.model);
4925
4892
  dependencyModel.trackSubset("core");
4926
4893
  var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
@@ -4939,15 +4906,6 @@ var AsyncNodePlugin = function() {
4939
4906
  var previousDeps = previousResult === null || previousResult === void 0 ? void 0 : previousResult.dependencies;
4940
4907
  var dataChanged = caresAboutDataChanges(dataChanges, previousDeps);
4941
4908
  var shouldUseLastValue = this.hooks.skipResolve.call(!dataChanged, node, resolveOptions);
4942
- var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4943
- parent: partiallyResolvedParent
4944
- });
4945
- var _this_hooks_beforeResolve_call;
4946
- var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4947
- type: "empty"
4948
- };
4949
- 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");
4950
- 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";
4951
4909
  if (previousResult && shouldUseLastValue) {
4952
4910
  var update2 = _object_spread_props(_object_spread({}, previousResult), {
4953
4911
  updated: false
@@ -4959,6 +4917,30 @@ var AsyncNodePlugin = function() {
4959
4917
  updated: false
4960
4918
  });
4961
4919
  cacheUpdate.set(AST, resolvedUpdate);
4920
+ if (resolvedUpdate.node.type === "async") {
4921
+ nextAsyncIdMap.set(resolvedUpdate.node.id, resolvedUpdate.node);
4922
+ }
4923
+ var _resolvedUpdate_node_asyncNodesResolved;
4924
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4925
+ try {
4926
+ 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){
4927
+ var key = _step.value;
4928
+ nextAsyncIdMap.set(key, resolvedUpdate.node);
4929
+ }
4930
+ } catch (err) {
4931
+ _didIteratorError = true;
4932
+ _iteratorError = err;
4933
+ } finally{
4934
+ try {
4935
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4936
+ _iterator.return();
4937
+ }
4938
+ } finally{
4939
+ if (_didIteratorError) {
4940
+ throw _iteratorError;
4941
+ }
4942
+ }
4943
+ }
4962
4944
  var handleChildNode = function(childNode) {
4963
4945
  var _prevASTMap_get;
4964
4946
  var originalChildNode = (_prevASTMap_get = prevASTMap.get(childNode)) !== null && _prevASTMap_get !== void 0 ? _prevASTMap_get : childNode;
@@ -4981,10 +4963,37 @@ var AsyncNodePlugin = function() {
4981
4963
  repopulateASTMapFromCache(previousResult, node, rawParent);
4982
4964
  return update2;
4983
4965
  }
4984
- if (isNestedMultiNodeWithAsync) {
4985
- resolvedAST.parent = partiallyResolvedParent.parent;
4986
- } else {
4987
- resolvedAST.parent = partiallyResolvedParent;
4966
+ var clonedNode = _object_spread_props(_object_spread({}, this.cloneNode(node)), {
4967
+ parent: partiallyResolvedParent
4968
+ });
4969
+ var _this_hooks_beforeResolve_call;
4970
+ var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
4971
+ type: "empty"
4972
+ };
4973
+ resolvedAST.parent = partiallyResolvedParent;
4974
+ if (resolvedAST.type === "async") {
4975
+ nextAsyncIdMap.set(resolvedAST.id, resolvedAST);
4976
+ }
4977
+ var _resolvedAST_asyncNodesResolved;
4978
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
4979
+ try {
4980
+ for(var _iterator = ((_resolvedAST_asyncNodesResolved = resolvedAST.asyncNodesResolved) !== null && _resolvedAST_asyncNodesResolved !== void 0 ? _resolvedAST_asyncNodesResolved : [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
4981
+ var id = _step.value;
4982
+ nextAsyncIdMap.set(id, resolvedAST);
4983
+ }
4984
+ } catch (err) {
4985
+ _didIteratorError = true;
4986
+ _iteratorError = err;
4987
+ } finally{
4988
+ try {
4989
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
4990
+ _iterator.return();
4991
+ }
4992
+ } finally{
4993
+ if (_didIteratorError) {
4994
+ throw _iteratorError;
4995
+ }
4996
+ }
4988
4997
  }
4989
4998
  resolveOptions.node = resolvedAST;
4990
4999
  this.ASTMap.set(resolvedAST, node);
@@ -4998,7 +5007,7 @@ var AsyncNodePlugin = function() {
4998
5007
  if ("children" in resolvedAST) {
4999
5008
  var _resolvedAST_children;
5000
5009
  var newChildren = (_resolvedAST_children = resolvedAST.children) === null || _resolvedAST_children === void 0 ? void 0 : _resolvedAST_children.map(function(child) {
5001
- var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5010
+ var computedChildTree = _this.computeTree(child.value, node, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5002
5011
  var childTreeDeps = computedChildTree.dependencies, childNode = computedChildTree.node, childUpdated = computedChildTree.updated, childValue = computedChildTree.value;
5003
5012
  childTreeDeps.forEach(function(binding) {
5004
5013
  return childDependencies.add(binding);
@@ -5019,40 +5028,18 @@ var AsyncNodePlugin = function() {
5019
5028
  resolvedAST.children = newChildren;
5020
5029
  } else if (resolvedAST.type === "multi-node") {
5021
5030
  var childValue = [];
5022
- var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
5023
- var hasAsync = resolvedAST.values.map(function(value, index) {
5024
- return value.type === "async" ? index : -1;
5025
- }).filter(function(index) {
5026
- return index !== -1;
5027
- });
5028
- var newValues = resolvedAST.values.map(function(mValue) {
5029
- var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
5031
+ var rawParentToPassIn = node;
5032
+ resolvedAST.values = resolvedAST.values.map(function(mValue) {
5033
+ var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap, nextAsyncIdMap);
5030
5034
  if (mTree.value !== void 0 && mTree.value !== null) {
5031
- if (mValue.type === "async" && mValue.flatten && mTree.value.asset && Array.isArray(mTree.value.asset.values)) {
5032
- unpackAndPush(mTree.value, childValue);
5033
- } else {
5034
- childValue.push(mTree.value);
5035
- }
5035
+ mTree.dependencies.forEach(function(bindingDep) {
5036
+ return childDependencies.add(bindingDep);
5037
+ });
5038
+ updated = updated || mTree.updated;
5039
+ childValue.push(mTree.value);
5036
5040
  }
5037
- mTree.dependencies.forEach(function(bindingDep) {
5038
- return childDependencies.add(bindingDep);
5039
- });
5040
- updated = updated || mTree.updated;
5041
5041
  return mTree.node;
5042
5042
  });
5043
- if (hasAsync.length > 0) {
5044
- var copy = newValues;
5045
- hasAsync.forEach(function(index) {
5046
- var _copy;
5047
- if (copy[index]) (_copy = copy).splice.apply(_copy, [
5048
- index,
5049
- 1
5050
- ].concat(_to_consumable_array(unpackNode(copy[index]))));
5051
- });
5052
- resolvedAST.values = copy;
5053
- } else {
5054
- resolvedAST.values = newValues;
5055
- }
5056
5043
  resolved = childValue;
5057
5044
  }
5058
5045
  childDependencies.forEach(function(bindingDep) {
@@ -5073,7 +5060,7 @@ var AsyncNodePlugin = function() {
5073
5060
  value: resolved,
5074
5061
  dependencies: /* @__PURE__ */ new Set(_to_consumable_array(dependencyModel.getDependencies()).concat(_to_consumable_array(childDependencies)))
5075
5062
  };
5076
- this.hooks.afterNodeUpdate.call(node, isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : rawParent, update);
5063
+ this.hooks.afterNodeUpdate.call(node, rawParent, update);
5077
5064
  cacheUpdate.set(node, update);
5078
5065
  return update;
5079
5066
  }
@@ -5081,15 +5068,6 @@ var AsyncNodePlugin = function() {
5081
5068
  ]);
5082
5069
  return Resolver;
5083
5070
  }();
5084
- function unpackAndPush(item, initial) {
5085
- if (item.asset.values && Array.isArray(item.asset.values)) {
5086
- item.asset.values.forEach(function(i) {
5087
- unpackAndPush(i, initial);
5088
- });
5089
- } else {
5090
- initial.push(item);
5091
- }
5092
- }
5093
5071
  var CrossfieldProvider = /*#__PURE__*/ function() {
5094
5072
  function CrossfieldProvider(initialView, parser, logger) {
5095
5073
  _class_call_check(this, CrossfieldProvider);
@@ -5157,9 +5135,11 @@ var AsyncNodePlugin = function() {
5157
5135
  _create_class(ViewInstance, [
5158
5136
  {
5159
5137
  key: "updateAsync",
5160
- value: function updateAsync() {
5138
+ value: function updateAsync(asyncNode) {
5161
5139
  var _this_resolver;
5162
- var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update();
5140
+ var update = (_this_resolver = this.resolver) === null || _this_resolver === void 0 ? void 0 : _this_resolver.update(/* @__PURE__ */ new Set(), /* @__PURE__ */ new Set([
5141
+ asyncNode
5142
+ ]));
5163
5143
  this.lastUpdate = update;
5164
5144
  this.hooks.onUpdate.call(update);
5165
5145
  }
@@ -5277,11 +5257,12 @@ var AsyncNodePlugin = function() {
5277
5257
  *
5278
5258
  * @param id - the id of async node. It should be identical for each async node
5279
5259
  */ function asyncNode(id) {
5280
- var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
5260
+ var flatten2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true, onValueReceived = arguments.length > 2 ? arguments[2] : void 0;
5281
5261
  return {
5282
5262
  id: id,
5283
5263
  type: "async",
5284
5264
  flatten: flatten2,
5265
+ onValueReceived: onValueReceived,
5285
5266
  value: {
5286
5267
  type: "value",
5287
5268
  value: {
@@ -5376,7 +5357,7 @@ var AsyncNodePlugin = function() {
5376
5357
  for(var _iterator = templateSubstitutions[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
5377
5358
  var _step_value = _step.value, expression = _step_value.expression, value = _step_value.value;
5378
5359
  var flags = "g";
5379
- if (typeof expression === "object") {
5360
+ if ((typeof expression === "undefined" ? "undefined" : _type_of(expression)) === "object") {
5380
5361
  flags = "".concat(expression.flags).concat(expression.global ? "" : "g");
5381
5362
  }
5382
5363
  templateStr = templateStr.replace(new RegExp(expression, flags), value);
@@ -5525,7 +5506,7 @@ var AsyncNodePlugin = function() {
5525
5506
  var bindingResolveLookup = createPatternMatcher("{{", "}}");
5526
5507
  var expressionResolveLookup = createPatternMatcher("@[", "]@");
5527
5508
  function resolveAllRefs(node, resolveOptions, propertiesToSkip) {
5528
- if (node === null || node === void 0 || typeof node !== "object" && typeof node !== "string") {
5509
+ if (node === null || node === void 0 || (typeof node === "undefined" ? "undefined" : _type_of(node)) !== "object" && typeof node !== "string") {
5529
5510
  return node;
5530
5511
  }
5531
5512
  if (typeof node === "string") {
@@ -5538,7 +5519,7 @@ var AsyncNodePlugin = function() {
5538
5519
  }
5539
5520
  var val = node[key];
5540
5521
  var newVal = val;
5541
- if (typeof val === "object") {
5522
+ if ((typeof val === "undefined" ? "undefined" : _type_of(val)) === "object") {
5542
5523
  newVal = resolveAllRefs(val, resolveOptions, propertiesToSkip);
5543
5524
  } else if (typeof val === "string") {
5544
5525
  newVal = resolveString(val, resolveOptions);
@@ -5827,7 +5808,7 @@ var AsyncNodePlugin = function() {
5827
5808
  key: "applyParser",
5828
5809
  value: function applyParser(parser) {
5829
5810
  parser.hooks.parseNode.tap("multi-node", function(obj, nodeType, options, childOptions) {
5830
- if (childOptions && !hasTemplateKey(childOptions.key) && Array.isArray(obj)) {
5811
+ if ((childOptions === void 0 || !hasTemplateKey(childOptions.key)) && Array.isArray(obj)) {
5831
5812
  var values = obj.map(function(childVal) {
5832
5813
  return parser.parseObject(childVal, "value", options);
5833
5814
  }).filter(function(child) {
@@ -5838,7 +5819,7 @@ var AsyncNodePlugin = function() {
5838
5819
  }
5839
5820
  var multiNode = parser.createASTNode({
5840
5821
  type: "multi-node",
5841
- override: !hasTemplateValues(childOptions.parentObj, childOptions.key),
5822
+ override: childOptions !== void 0 && !hasTemplateValues(childOptions.parentObj, childOptions.key),
5842
5823
  values: values
5843
5824
  }, obj);
5844
5825
  if (!multiNode) {
@@ -5849,7 +5830,7 @@ var AsyncNodePlugin = function() {
5849
5830
  v.parent = multiNode;
5850
5831
  });
5851
5832
  }
5852
- return [
5833
+ return childOptions === void 0 ? multiNode : [
5853
5834
  {
5854
5835
  path: _to_consumable_array(childOptions.path).concat([
5855
5836
  childOptions.key
@@ -5879,7 +5860,7 @@ var AsyncNodePlugin = function() {
5879
5860
  key: "applyParser",
5880
5861
  value: function applyParser(parser) {
5881
5862
  parser.hooks.parseNode.tap("asset", function(obj, nodeType, options, childOptions) {
5882
- if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && typeof obj === "object") {
5863
+ if ((childOptions === null || childOptions === void 0 ? void 0 : childOptions.key) === "asset" && (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object") {
5883
5864
  var assetAST = parser.parseObject(obj, "asset", options);
5884
5865
  if (!assetAST) {
5885
5866
  return [];
@@ -6079,6 +6060,7 @@ var AsyncNodePlugin = function() {
6079
6060
  }();
6080
6061
  var FlowInstance = /*#__PURE__*/ function() {
6081
6062
  function FlowInstance(id, flow, options) {
6063
+ var _this = this;
6082
6064
  _class_call_check(this, FlowInstance);
6083
6065
  this.isTransitioning = false;
6084
6066
  this.hooks = {
@@ -6095,60 +6077,55 @@ var AsyncNodePlugin = function() {
6095
6077
  this.flow = flow;
6096
6078
  this.log = options === null || options === void 0 ? void 0 : options.logger;
6097
6079
  this.history = [];
6098
- var _this = this;
6099
- this.hooks.transition.tap("startPromise", function() {
6100
- var _ref = _async_to_generator(function(_oldState, nextState) {
6080
+ this.hooks.transition.tap("startPromise", function(_oldState, nextState) {
6081
+ return _async_to_generator(function() {
6101
6082
  var newState;
6102
6083
  return _ts_generator(this, function(_state) {
6103
6084
  newState = nextState.value;
6104
- if (_this.flowPromise && newState.state_type === "END") {
6105
- _this.flowPromise.resolve(newState);
6085
+ if (this.flowPromise && newState.state_type === "END") {
6086
+ this.flowPromise.resolve(newState);
6106
6087
  }
6107
6088
  return [
6108
6089
  2
6109
6090
  ];
6110
6091
  });
6111
- });
6112
- return function(_oldState, nextState) {
6113
- return _ref.apply(this, arguments);
6114
- };
6115
- }());
6092
+ }).call(_this);
6093
+ });
6116
6094
  }
6117
6095
  _create_class(FlowInstance, [
6118
6096
  {
6119
6097
  key: "start",
6120
6098
  value: /** Start the state machine */ function start() {
6121
- var _this = this;
6122
6099
  return _async_to_generator(function() {
6123
6100
  var _this_log, initialState;
6124
6101
  return _ts_generator(this, function(_state) {
6125
- if (_this.flowPromise) {
6102
+ if (this.flowPromise) {
6126
6103
  ;
6127
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6104
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.warn("Already called start for flow");
6128
6105
  return [
6129
6106
  2,
6130
- _this.flowPromise.promise
6107
+ this.flowPromise.promise
6131
6108
  ];
6132
6109
  }
6133
- _this.flow = _this.hooks.beforeStart.call(_this.flow) || _this.flow;
6134
- if (_this.flow.onStart) {
6135
- _this.hooks.onStart.call(_this.flow.onStart);
6110
+ this.flow = this.hooks.beforeStart.call(this.flow) || this.flow;
6111
+ if (this.flow.onStart) {
6112
+ this.hooks.onStart.call(this.flow.onStart);
6136
6113
  }
6137
- initialState = _this.flow.startState;
6114
+ initialState = this.flow.startState;
6138
6115
  if (!initialState) {
6139
6116
  return [
6140
6117
  2,
6141
6118
  Promise.reject(new Error("No 'startState' defined for flow"))
6142
6119
  ];
6143
6120
  }
6144
- _this.flowPromise = (0, import_p_defer2.default)();
6145
- _this.pushHistory(initialState);
6121
+ this.flowPromise = (0, import_p_defer2.default)();
6122
+ this.pushHistory(initialState);
6146
6123
  return [
6147
6124
  2,
6148
- _this.flowPromise.promise
6125
+ this.flowPromise.promise
6149
6126
  ];
6150
6127
  });
6151
- })();
6128
+ }).call(this);
6152
6129
  }
6153
6130
  },
6154
6131
  {
@@ -6200,7 +6177,7 @@ var AsyncNodePlugin = function() {
6200
6177
  throw new Error("No flow definition for: ".concat(stateName, " was found."));
6201
6178
  }
6202
6179
  var nextState = this.flow[stateName];
6203
- if (!this.flow[stateName] || typeof nextState !== "object" || !("state_type" in nextState)) {
6180
+ if (!this.flow[stateName] || (typeof nextState === "undefined" ? "undefined" : _type_of(nextState)) !== "object" || !("state_type" in nextState)) {
6204
6181
  var _this_log;
6205
6182
  (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.error("Flow doesn't contain any states named: ".concat(stateName));
6206
6183
  return;
@@ -6260,30 +6237,30 @@ var AsyncNodePlugin = function() {
6260
6237
  {
6261
6238
  key: "run",
6262
6239
  value: function run(startState) {
6263
- var _this = this;
6264
6240
  return _async_to_generator(function() {
6265
- var _this_log, startFlow, flow, end, firstItem;
6241
+ var _this, _this_log, startFlow, flow, end, firstItem;
6266
6242
  return _ts_generator(this, function(_state) {
6267
6243
  switch(_state.label){
6268
6244
  case 0:
6269
- if (!Object.prototype.hasOwnProperty.call(_this.navigation, startState)) {
6245
+ _this = this;
6246
+ if (!Object.prototype.hasOwnProperty.call(this.navigation, startState)) {
6270
6247
  return [
6271
6248
  2,
6272
6249
  Promise.reject(new Error("No flow defined for: ".concat(startState)))
6273
6250
  ];
6274
6251
  }
6275
- startFlow = _this.navigation[startState];
6276
- if (startFlow === null || typeof startFlow !== "object") {
6252
+ startFlow = this.navigation[startState];
6253
+ if (startFlow === null || (typeof startFlow === "undefined" ? "undefined" : _type_of(startFlow)) !== "object") {
6277
6254
  return [
6278
6255
  2,
6279
6256
  Promise.reject(new Error("Flow: ".concat(startState, " needs to be an object")))
6280
6257
  ];
6281
6258
  }
6282
- (_this_log = _this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6259
+ (_this_log = this.log) === null || _this_log === void 0 ? void 0 : _this_log.debug("Starting flow: ".concat(startState));
6283
6260
  flow = new FlowInstance(startState, startFlow, {
6284
- logger: _this.log
6261
+ logger: this.log
6285
6262
  });
6286
- _this.addNewFlow(flow);
6263
+ this.addNewFlow(flow);
6287
6264
  flow.hooks.afterTransition.tap("flow-controller", function(flowInstance) {
6288
6265
  var _flowInstance_currentState;
6289
6266
  if (((_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value.state_type) === "FLOW") {
@@ -6303,10 +6280,10 @@ var AsyncNodePlugin = function() {
6303
6280
  ];
6304
6281
  case 1:
6305
6282
  end = _state.sent();
6306
- _this.navStack.pop();
6307
- if (_this.navStack.length > 0) {
6283
+ this.navStack.pop();
6284
+ if (this.navStack.length > 0) {
6308
6285
  firstItem = 0;
6309
- _this.current = _this.navStack[firstItem];
6286
+ this.current = this.navStack[firstItem];
6310
6287
  }
6311
6288
  return [
6312
6289
  2,
@@ -6314,16 +6291,15 @@ var AsyncNodePlugin = function() {
6314
6291
  ];
6315
6292
  }
6316
6293
  });
6317
- })();
6294
+ }).call(this);
6318
6295
  }
6319
6296
  },
6320
6297
  {
6321
6298
  key: "start",
6322
6299
  value: function start() {
6323
- var _this = this;
6324
6300
  return _async_to_generator(function() {
6325
6301
  return _ts_generator(this, function(_state) {
6326
- if (!_this.navigation.BEGIN) {
6302
+ if (!this.navigation.BEGIN) {
6327
6303
  return [
6328
6304
  2,
6329
6305
  Promise.reject(new Error("Must supply a BEGIN state"))
@@ -6331,10 +6307,10 @@ var AsyncNodePlugin = function() {
6331
6307
  }
6332
6308
  return [
6333
6309
  2,
6334
- _this.run(_this.navigation.BEGIN)
6310
+ this.run(this.navigation.BEGIN)
6335
6311
  ];
6336
6312
  });
6337
- })();
6313
+ }).call(this);
6338
6314
  }
6339
6315
  }
6340
6316
  ]);
@@ -7441,7 +7417,7 @@ var AsyncNodePlugin = function() {
7441
7417
  var parentBinding = resolved.parent();
7442
7418
  var property = resolved.key();
7443
7419
  var parentValue = this.get(parentBinding);
7444
- var existedBeforeDelete = typeof parentValue === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7420
+ var existedBeforeDelete = (typeof parentValue === "undefined" ? "undefined" : _type_of(parentValue)) === "object" && parentValue !== null && Object.prototype.hasOwnProperty.call(parentValue, property);
7445
7421
  this.getModel().delete(resolved, options);
7446
7422
  if (existedBeforeDelete && !this.get(resolved)) {
7447
7423
  this.trash.add(resolved);
@@ -7542,7 +7518,7 @@ var AsyncNodePlugin = function() {
7542
7518
  var expressionEvaluator;
7543
7519
  var handleEval = function(exp) {
7544
7520
  if (exp) {
7545
- if (typeof exp === "object" && "exp" in exp) {
7521
+ if ((typeof exp === "undefined" ? "undefined" : _type_of(exp)) === "object" && "exp" in exp) {
7546
7522
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp.exp);
7547
7523
  } else {
7548
7524
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp);
@@ -7803,7 +7779,7 @@ var AsyncNodePlugin = function() {
7803
7779
  flow.hooks.beforeTransition.tap("player", function(state, transitionVal) {
7804
7780
  var computedTransitionVal = state.transitions[transitionVal] ? transitionVal : "*";
7805
7781
  if (state.onEnd && state.transitions[computedTransitionVal]) {
7806
- if (typeof state.onEnd === "object" && "exp" in state.onEnd) {
7782
+ if (_type_of(state.onEnd) === "object" && "exp" in state.onEnd) {
7807
7783
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd.exp);
7808
7784
  } else {
7809
7785
  expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(state.onEnd);
@@ -7962,12 +7938,12 @@ var AsyncNodePlugin = function() {
7962
7938
  {
7963
7939
  key: "start",
7964
7940
  value: function start(payload) {
7965
- var _this = this;
7966
7941
  return _async_to_generator(function() {
7967
- var _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7942
+ var _this, _payload_id, ref, maybeUpdateState, _this_setupFlow, state, start, endProps, _tmp, error, errorState;
7968
7943
  return _ts_generator(this, function(_state) {
7969
7944
  switch(_state.label){
7970
7945
  case 0:
7946
+ _this = this;
7971
7947
  ref = Symbol((_payload_id = payload === null || payload === void 0 ? void 0 : payload.id) !== null && _payload_id !== void 0 ? _payload_id : "payload");
7972
7948
  maybeUpdateState = function(newState) {
7973
7949
  if (_this.state.ref !== ref) {
@@ -7977,7 +7953,7 @@ var AsyncNodePlugin = function() {
7977
7953
  _this.setState(newState);
7978
7954
  return newState;
7979
7955
  };
7980
- _this.setState({
7956
+ this.setState({
7981
7957
  status: "not-started",
7982
7958
  ref: ref
7983
7959
  });
@@ -7989,8 +7965,8 @@ var AsyncNodePlugin = function() {
7989
7965
  ,
7990
7966
  4
7991
7967
  ]);
7992
- _this_setupFlow = _this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7993
- _this.setState(_object_spread({
7968
+ _this_setupFlow = this.setupFlow(payload), state = _this_setupFlow.state, start = _this_setupFlow.start;
7969
+ this.setState(_object_spread({
7994
7970
  ref: ref
7995
7971
  }, state));
7996
7972
  start();
@@ -8035,7 +8011,7 @@ var AsyncNodePlugin = function() {
8035
8011
  ];
8036
8012
  }
8037
8013
  });
8038
- })();
8014
+ }).call(this);
8039
8015
  }
8040
8016
  }
8041
8017
  ]);
@@ -8047,9 +8023,11 @@ var AsyncNodePlugin = function() {
8047
8023
  };
8048
8024
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
8049
8025
  var import_queue_microtask3 = __toESM(require_queue_microtask());
8050
- var import_timm10 = __toESM(require_timm());
8051
8026
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/transform.ts
8052
8027
  var asyncTransform = function(assetId, wrapperAssetType, asset, flatten2) {
8028
+ var path = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : [
8029
+ "values"
8030
+ ];
8053
8031
  var id = "async-" + assetId;
8054
8032
  var asyncNode = Builder.asyncNode(id, flatten2);
8055
8033
  var multiNode;
@@ -8064,11 +8042,168 @@ var AsyncNodePlugin = function() {
8064
8042
  id: wrapperAssetType + "-" + id,
8065
8043
  type: wrapperAssetType
8066
8044
  });
8067
- Builder.addChild(wrapperAsset, [
8068
- "values"
8069
- ], multiNode);
8045
+ Builder.addChild(wrapperAsset, path, multiNode);
8070
8046
  return wrapperAsset;
8071
8047
  };
8048
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/utils/extractNodeFromPath.ts
8049
+ var getMatchValue = function(pathA, pathB) {
8050
+ if (pathA.length > pathB.length) {
8051
+ return 0;
8052
+ }
8053
+ var matchCount = 0;
8054
+ for(var i = 0; i < pathA.length; i++){
8055
+ if (pathA[i] === pathB[i]) {
8056
+ matchCount++;
8057
+ } else {
8058
+ return 0;
8059
+ }
8060
+ }
8061
+ return matchCount;
8062
+ };
8063
+ var extractNodeFromPath = function(node, path) {
8064
+ if (path === void 0 || path.length === 0) {
8065
+ return node;
8066
+ }
8067
+ if (!("children" in node && node.children)) {
8068
+ return void 0;
8069
+ }
8070
+ var matchResult = 0;
8071
+ var bestMatch;
8072
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8073
+ try {
8074
+ for(var _iterator = node.children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8075
+ var child = _step.value;
8076
+ var matchValue = getMatchValue(child.path, path);
8077
+ if (matchValue > matchResult) {
8078
+ matchResult = matchValue;
8079
+ bestMatch = child;
8080
+ }
8081
+ }
8082
+ } catch (err) {
8083
+ _didIteratorError = true;
8084
+ _iteratorError = err;
8085
+ } finally{
8086
+ try {
8087
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
8088
+ _iterator.return();
8089
+ }
8090
+ } finally{
8091
+ if (_didIteratorError) {
8092
+ throw _iteratorError;
8093
+ }
8094
+ }
8095
+ }
8096
+ if (!bestMatch) {
8097
+ return void 0;
8098
+ }
8099
+ if (matchResult >= path.length) {
8100
+ return bestMatch.value;
8101
+ }
8102
+ return extractNodeFromPath(bestMatch.value, path.slice(matchResult));
8103
+ };
8104
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/utils/traverseAndReplace.ts
8105
+ var traverseAndReplace = function(node, replaceFn) {
8106
+ if (node.type === NodeType.MultiNode) {
8107
+ var index = 0;
8108
+ while(index < node.values.length){
8109
+ var child = node.values[index];
8110
+ if (!child) {
8111
+ index++;
8112
+ continue;
8113
+ }
8114
+ var result = replaceFn(child);
8115
+ if (result.type === NodeType.MultiNode) {
8116
+ node.values = _to_consumable_array(node.values.slice(0, index)).concat(_to_consumable_array(result.values), _to_consumable_array(node.values.slice(index + 1)));
8117
+ } else {
8118
+ node.values[index] = result;
8119
+ index++;
8120
+ }
8121
+ }
8122
+ return node;
8123
+ }
8124
+ return replaceFn(node);
8125
+ };
8126
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/utils/unwrapAsset.ts
8127
+ var unwrapAsset = function(node) {
8128
+ var _node_children;
8129
+ if (node.type !== NodeType.Value) {
8130
+ return node;
8131
+ }
8132
+ var child = (_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children.find(function(x) {
8133
+ return x.path.length === 1 && x.path[0] === "asset";
8134
+ });
8135
+ if (!child) {
8136
+ return node;
8137
+ }
8138
+ return child.value;
8139
+ };
8140
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/utils/requiresAssetWrapper.ts
8141
+ var requiresAssetWrapper = function(node) {
8142
+ if (node.type === NodeType.Asset) {
8143
+ return true;
8144
+ }
8145
+ if (node.type !== NodeType.Applicability) {
8146
+ return false;
8147
+ }
8148
+ return node.value.type === NodeType.Asset;
8149
+ };
8150
+ // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/createAsyncTransform.ts
8151
+ var defaultGetNodeId = function(node) {
8152
+ return "async-".concat(node.value.id);
8153
+ };
8154
+ var createAsyncTransform = function(options) {
8155
+ 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 ? [
8156
+ "values"
8157
+ ] : _options_path, tmp = options.flatten, flatten2 = tmp === void 0 ? true : tmp, _options_asyncNodePosition = options.asyncNodePosition, asyncNodePosition = _options_asyncNodePosition === void 0 ? "append" : _options_asyncNodePosition;
8158
+ var replaceNode = function(node) {
8159
+ var unwrapped = unwrapAsset(node);
8160
+ if (unwrapped.type !== NodeType.Asset || unwrapped.value.type !== transformAssetType) {
8161
+ return node;
8162
+ }
8163
+ var transformed = asyncTransform2(unwrapped);
8164
+ var _extractNodeFromPath;
8165
+ return (_extractNodeFromPath = extractNodeFromPath(transformed, path)) !== null && _extractNodeFromPath !== void 0 ? _extractNodeFromPath : node;
8166
+ };
8167
+ var replacer = function(node) {
8168
+ return traverseAndReplace(node, replaceNode);
8169
+ };
8170
+ var asyncTransform2 = function(node) {
8171
+ var _Builder;
8172
+ var id = getAsyncNodeId(node);
8173
+ var asset = getNestedAsset === null || getNestedAsset === void 0 ? void 0 : getNestedAsset(node);
8174
+ var replaceFunction = flatten2 ? replacer : void 0;
8175
+ var asyncNode = Builder.asyncNode(id, flatten2, replaceFunction);
8176
+ var values = [
8177
+ asyncNode
8178
+ ];
8179
+ if (asset) {
8180
+ var otherValues = [];
8181
+ if (requiresAssetWrapper(asset)) {
8182
+ otherValues.push(Builder.assetWrapper(asset));
8183
+ } else if (asset.type === NodeType.MultiNode) {
8184
+ var _otherValues;
8185
+ (_otherValues = otherValues).push.apply(_otherValues, _to_consumable_array(asset.values));
8186
+ } else {
8187
+ otherValues.push(asset);
8188
+ }
8189
+ if (asyncNodePosition === "append") {
8190
+ var _values;
8191
+ (_values = values).unshift.apply(_values, _to_consumable_array(otherValues));
8192
+ } else {
8193
+ var _values1;
8194
+ (_values1 = values).push.apply(_values1, _to_consumable_array(otherValues));
8195
+ }
8196
+ }
8197
+ var multiNode = (_Builder = Builder).multiNode.apply(_Builder, _to_consumable_array(values));
8198
+ var wrapperAsset = Builder.asset({
8199
+ id: wrapperAssetType + "-" + id,
8200
+ type: wrapperAssetType
8201
+ });
8202
+ Builder.addChild(wrapperAsset, path, multiNode);
8203
+ return wrapperAsset;
8204
+ };
8205
+ return asyncTransform2;
8206
+ };
8072
8207
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/plugins/async-node/core/src/index.ts
8073
8208
  var AsyncNodePluginSymbol = Symbol.for("AsyncNodePlugin");
8074
8209
  var _AsyncNodePlugin = /*#__PURE__*/ function() {
@@ -8088,8 +8223,8 @@ var AsyncNodePlugin = function() {
8088
8223
  });
8089
8224
  }
8090
8225
  if (asyncHandler) {
8091
- this.hooks.onAsyncNode.tap("async", function() {
8092
- var _ref = _async_to_generator(function(node, callback) {
8226
+ this.hooks.onAsyncNode.tap("async", function(node, callback) {
8227
+ return _async_to_generator(function() {
8093
8228
  return _ts_generator(this, function(_state) {
8094
8229
  switch(_state.label){
8095
8230
  case 0:
@@ -8104,11 +8239,8 @@ var AsyncNodePlugin = function() {
8104
8239
  ];
8105
8240
  }
8106
8241
  });
8107
- });
8108
- return function(node, callback) {
8109
- return _ref.apply(this, arguments);
8110
- };
8111
- }());
8242
+ })();
8243
+ });
8112
8244
  }
8113
8245
  }
8114
8246
  _create_class(_AsyncNodePlugin, [
@@ -8155,6 +8287,9 @@ var AsyncNodePlugin = function() {
8155
8287
  */ key: "parseNodeAndUpdate",
8156
8288
  value: function parseNodeAndUpdate(node, context, result, options) {
8157
8289
  var parsedNode = options.parseNode && result ? options.parseNode(result) : void 0;
8290
+ if (parsedNode && node.onValueReceived) {
8291
+ parsedNode = node.onValueReceived(parsedNode);
8292
+ }
8158
8293
  this.handleAsyncUpdate(node, context, parsedNode);
8159
8294
  }
8160
8295
  },
@@ -8172,10 +8307,17 @@ var AsyncNodePlugin = function() {
8172
8307
  var nodeResolveCache = context.nodeResolveCache, view = context.view;
8173
8308
  if (nodeResolveCache.get(node.id) !== newNode) {
8174
8309
  nodeResolveCache.set(node.id, newNode ? newNode : node);
8175
- view.updateAsync();
8310
+ view.updateAsync(node.id);
8176
8311
  }
8177
8312
  }
8178
8313
  },
8314
+ {
8315
+ key: "hasValidMapping",
8316
+ value: function hasValidMapping(node, context) {
8317
+ var nodeResolveCache = context.nodeResolveCache;
8318
+ return nodeResolveCache.has(node.id) && nodeResolveCache.get(node.id) !== node;
8319
+ }
8320
+ },
8179
8321
  {
8180
8322
  /**
8181
8323
  * Handles the asynchronous API integration for resolving nodes.
@@ -8187,11 +8329,11 @@ var AsyncNodePlugin = function() {
8187
8329
  var _this = this;
8188
8330
  resolver.hooks.beforeResolve.tap(this.name, function(node, options) {
8189
8331
  if (!_this.isAsync(node)) {
8190
- return node;
8332
+ return node === null ? node : _this.resolveAsyncChildren(node, context);
8191
8333
  }
8192
8334
  var resolvedNode = context.nodeResolveCache.get(node.id);
8193
8335
  if (resolvedNode !== void 0) {
8194
- return resolvedNode;
8336
+ return _this.resolveAsyncChildren(resolvedNode, context);
8195
8337
  }
8196
8338
  if (context.inProgressNodes.has(node.id)) {
8197
8339
  return node;
@@ -8204,42 +8346,90 @@ var AsyncNodePlugin = function() {
8204
8346
  });
8205
8347
  }
8206
8348
  },
8349
+ {
8350
+ /**
8351
+ * 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.
8352
+ * Handles async node chains as well to make sure all applicable nodes can get flattened.
8353
+ * @param node - The node whose children need to be resolved.
8354
+ * @param context - the async plugin context needed to reach into the cache
8355
+ * @returns The same node but with async node children mapped to their resolved AST.
8356
+ */ key: "resolveAsyncChildren",
8357
+ value: function resolveAsyncChildren(node, context) {
8358
+ var _this = this;
8359
+ var _node_asyncNodesResolved;
8360
+ var asyncNodesResolved = (_node_asyncNodesResolved = node.asyncNodesResolved) !== null && _node_asyncNodesResolved !== void 0 ? _node_asyncNodesResolved : [];
8361
+ node.asyncNodesResolved = asyncNodesResolved;
8362
+ if (node.type === NodeType.MultiNode) {
8363
+ var index = 0;
8364
+ while(index < node.values.length){
8365
+ var childNode = node.values[index];
8366
+ if ((childNode === null || childNode === void 0 ? void 0 : childNode.type) !== NodeType.Async || !this.hasValidMapping(childNode, context)) {
8367
+ index++;
8368
+ continue;
8369
+ }
8370
+ var mappedNode = context.nodeResolveCache.get(childNode.id);
8371
+ asyncNodesResolved.push(childNode.id);
8372
+ if (mappedNode.type === NodeType.MultiNode && childNode.flatten) {
8373
+ mappedNode.values.forEach(function(v) {
8374
+ return v.parent = node;
8375
+ });
8376
+ node.values = _to_consumable_array(node.values.slice(0, index)).concat(_to_consumable_array(mappedNode.values), _to_consumable_array(node.values.slice(index + 1)));
8377
+ } else {
8378
+ node.values[index] = mappedNode;
8379
+ mappedNode.parent = node;
8380
+ }
8381
+ }
8382
+ } else if ("children" in node) {
8383
+ var _node_children;
8384
+ (_node_children = node.children) === null || _node_children === void 0 ? void 0 : _node_children.forEach(function(c) {
8385
+ while(c.value.type === NodeType.Async && _this.hasValidMapping(c.value, context)){
8386
+ asyncNodesResolved.push(c.value.id);
8387
+ c.value = context.nodeResolveCache.get(c.value.id);
8388
+ c.value.parent = node;
8389
+ }
8390
+ });
8391
+ }
8392
+ return node;
8393
+ }
8394
+ },
8207
8395
  {
8208
8396
  key: "runAsyncNode",
8209
8397
  value: function runAsyncNode(node, context, options) {
8210
- var _this = this;
8211
8398
  return _async_to_generator(function() {
8212
- var _this_basePlugin, result, e, _this_basePlugin1, _options_logger, error, result1, _this_basePlugin_getPlayerInstance, _this_basePlugin2, playerState;
8399
+ var _this, _this_basePlugin, result, e, _this_basePlugin1, _options_logger, error, result1, _this_basePlugin_getPlayerInstance, _this_basePlugin2, playerState;
8213
8400
  return _ts_generator(this, function(_state) {
8214
8401
  switch(_state.label){
8215
8402
  case 0:
8403
+ _this = this;
8404
+ _state.label = 1;
8405
+ case 1:
8216
8406
  _state.trys.push([
8217
- 0,
8218
- 2,
8407
+ 1,
8408
+ 3,
8219
8409
  ,
8220
- 3
8410
+ 4
8221
8411
  ]);
8222
8412
  return [
8223
8413
  4,
8224
- (_this_basePlugin = _this.basePlugin) === null || _this_basePlugin === void 0 ? void 0 : _this_basePlugin.hooks.onAsyncNode.call(node, function(result2) {
8414
+ (_this_basePlugin = this.basePlugin) === null || _this_basePlugin === void 0 ? void 0 : _this_basePlugin.hooks.onAsyncNode.call(node, function(result2) {
8225
8415
  _this.parseNodeAndUpdate(node, context, result2, options);
8226
8416
  })
8227
8417
  ];
8228
- case 1:
8418
+ case 2:
8229
8419
  result = _state.sent();
8230
8420
  context.inProgressNodes.delete(node.id);
8231
- _this.parseNodeAndUpdate(node, context, result, options);
8421
+ this.parseNodeAndUpdate(node, context, result, options);
8232
8422
  return [
8233
8423
  3,
8234
- 3
8424
+ 4
8235
8425
  ];
8236
- case 2:
8426
+ case 3:
8237
8427
  e = _state.sent();
8238
8428
  error = _instanceof(e, Error) ? e : new Error(String(e));
8239
- result1 = (_this_basePlugin1 = _this.basePlugin) === null || _this_basePlugin1 === void 0 ? void 0 : _this_basePlugin1.hooks.onAsyncNodeError.call(error, node);
8429
+ result1 = (_this_basePlugin1 = this.basePlugin) === null || _this_basePlugin1 === void 0 ? void 0 : _this_basePlugin1.hooks.onAsyncNodeError.call(error, node);
8240
8430
  if (result1 === void 0) {
8241
8431
  ;
8242
- 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();
8432
+ 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();
8243
8433
  if ((playerState === null || playerState === void 0 ? void 0 : playerState.status) === "in-progress") {
8244
8434
  playerState.fail(error);
8245
8435
  }
@@ -8249,18 +8439,18 @@ var AsyncNodePlugin = function() {
8249
8439
  }
8250
8440
  (_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);
8251
8441
  context.inProgressNodes.delete(node.id);
8252
- _this.parseNodeAndUpdate(node, context, result1, options);
8442
+ this.parseNodeAndUpdate(node, context, result1, options);
8253
8443
  return [
8254
8444
  3,
8255
- 3
8445
+ 4
8256
8446
  ];
8257
- case 3:
8447
+ case 4:
8258
8448
  return [
8259
8449
  2
8260
8450
  ];
8261
8451
  }
8262
8452
  });
8263
- })();
8453
+ }).call(this);
8264
8454
  }
8265
8455
  },
8266
8456
  {
@@ -8272,7 +8462,7 @@ var AsyncNodePlugin = function() {
8272
8462
  {
8273
8463
  key: "isDeterminedAsync",
8274
8464
  value: function isDeterminedAsync(obj) {
8275
- return obj && Object.prototype.hasOwnProperty.call(obj, "async");
8465
+ return (typeof obj === "undefined" ? "undefined" : _type_of(obj)) === "object" && obj !== null && Object.prototype.hasOwnProperty.call(obj, "async");
8276
8466
  }
8277
8467
  },
8278
8468
  {
@@ -8281,7 +8471,11 @@ var AsyncNodePlugin = function() {
8281
8471
  var _this = this;
8282
8472
  parser.hooks.parseNode.tap(this.name, function(obj, nodeType, options, childOptions) {
8283
8473
  if (_this.isDeterminedAsync(obj)) {
8284
- var parsedAsync = parser.parseObject((0, import_timm10.omit)(obj, "async"), nodeType, options);
8474
+ var async = obj.async, flatten2 = obj.flatten, rest = _object_without_properties(obj, [
8475
+ "async",
8476
+ "flatten"
8477
+ ]);
8478
+ var parsedAsync = parser.parseObject(rest, nodeType, options);
8285
8479
  var parsedNodeId = getNodeID(parsedAsync);
8286
8480
  if (parsedAsync === null || !parsedNodeId) {
8287
8481
  return childOptions ? [] : null;
@@ -8289,7 +8483,8 @@ var AsyncNodePlugin = function() {
8289
8483
  var asyncAST = parser.createASTNode({
8290
8484
  id: parsedNodeId,
8291
8485
  type: NodeType.Async,
8292
- value: parsedAsync
8486
+ value: parsedAsync,
8487
+ flatten: flatten2
8293
8488
  }, obj);
8294
8489
  if (childOptions) {
8295
8490
  return asyncAST ? [