tods-competition-factory 2.0.0-beta.3 → 2.0.0-beta.4

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.0-beta.3';
6
+ return '2.0.0-beta.4';
7
7
  }
8
8
 
9
9
  /******************************************************************************
@@ -2604,9 +2604,7 @@ function createMap(objectArray, attribute) {
2604
2604
  .filter(Boolean)), false));
2605
2605
  }
2606
2606
  // e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
2607
- var hasAttributeValues = function (a) { return function (o) {
2608
- return Object.keys(a).every(function (key) { return o[key] === a[key]; });
2609
- }; };
2607
+ var hasAttributeValues = function (a) { return function (o) { return Object.keys(a).every(function (key) { return o[key] === a[key]; }); }; };
2610
2608
  // extracts targeted attributes
2611
2609
  // e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
2612
2610
  // supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
@@ -2632,6 +2630,7 @@ var extractAttributes = function (accessor) { return function (element) {
2632
2630
  })) ||
2633
2631
  ((_a = (typeof accessor === 'string' && getAccessorValue({ element: element, accessor: accessor }))) === null || _a === void 0 ? void 0 : _a.value);
2634
2632
  }; };
2633
+ var xa = extractAttributes;
2635
2634
  // useful in notifications where back end does not recognize undefined for updates
2636
2635
  function undefinedToNull(obj, shallow) {
2637
2636
  if (obj === undefined)
@@ -3794,7 +3793,7 @@ function getAllPositionedParticipantIds(_a) {
3794
3793
  if (!stagePositionedParticipantIds[stage])
3795
3794
  stagePositionedParticipantIds[stage] = [];
3796
3795
  var positionAssignments = getPositionAssignments$1({ structure: structure }).positionAssignments;
3797
- var particiapntIds = (_b = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.map(extractAttributes('participantId')).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
3796
+ var particiapntIds = (_b = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.map(xa('participantId')).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
3798
3797
  (_a = stagePositionedParticipantIds[stage]).push.apply(_a, __spreadArray([], __read(particiapntIds), false));
3799
3798
  return particiapntIds;
3800
3799
  })
@@ -7243,35 +7242,23 @@ function getTeamLineUp(_a) {
7243
7242
  return { lineUp: lineUp };
7244
7243
  }
7245
7244
 
7246
- function getDrawPositionCollectionAssignment(_a) {
7245
+ function getCollectionAssignment(_a) {
7247
7246
  var tournamentParticipants = _a.tournamentParticipants, positionAssignments = _a.positionAssignments, collectionPosition = _a.collectionPosition, _b = _a.drawPositions, drawPositions = _b === void 0 ? [] : _b, participantMap = _a.participantMap, drawDefinition = _a.drawDefinition, collectionId = _a.collectionId, sideLineUps = _a.sideLineUps, matchUpType = _a.matchUpType;
7248
7247
  if (!collectionId || !collectionPosition)
7249
- return;
7250
- var drawPositionCollectionAssignment = (drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.map(function (drawPosition) {
7251
- var _a, _b, _c;
7252
- var _d, _e, _f, _g, _h, _j;
7253
- var teamParticipantId = (_d = positionAssignments.find(function (assignment) { return assignment.drawPosition === drawPosition; })) === null || _d === void 0 ? void 0 : _d.participantId;
7254
- var side = sideLineUps === null || sideLineUps === void 0 ? void 0 : sideLineUps.find(function (lineUp) { return (lineUp === null || lineUp === void 0 ? void 0 : lineUp.drawPosition) === drawPosition; });
7255
- var teamParticipant = (side === null || side === void 0 ? void 0 : side.teamParticipant) ||
7256
- (teamParticipantId && ((_e = participantMap === null || participantMap === void 0 ? void 0 : participantMap[teamParticipantId]) === null || _e === void 0 ? void 0 : _e.participant)) ||
7257
- (tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.find(function (_a) {
7258
- var participantId = _a.participantId;
7259
- return participantId === teamParticipantId;
7260
- }));
7261
- var lineUp = (side === null || side === void 0 ? void 0 : side.lineUp) ||
7262
- ((_f = getTeamLineUp({
7263
- participantId: teamParticipantId,
7264
- drawDefinition: drawDefinition,
7265
- })) === null || _f === void 0 ? void 0 : _f.lineUp);
7266
- var _k = getCollectionPositionAssignments({
7248
+ return {};
7249
+ var getAssignment = function (_a) {
7250
+ var _b, _c, _d;
7251
+ var _e, _f, _g;
7252
+ var attribute = _a.attribute, lineUp = _a.lineUp, teamParticipant = _a.teamParticipant;
7253
+ var _h = getCollectionPositionAssignments({
7267
7254
  collectionPosition: collectionPosition,
7268
7255
  collectionId: collectionId,
7269
7256
  lineUp: lineUp,
7270
- }), assignedParticipantIds = _k.assignedParticipantIds, substitutions = _k.substitutions;
7257
+ }), assignedParticipantIds = _h.assignedParticipantIds, substitutions = _h.substitutions;
7271
7258
  if (matchUpType === DOUBLES) {
7272
7259
  if ((assignedParticipantIds === null || assignedParticipantIds === void 0 ? void 0 : assignedParticipantIds.length) <= 2) {
7273
- var pairedParticipantId = (_h = (_g = participantMap === null || participantMap === void 0 ? void 0 : participantMap[assignedParticipantIds[0]]) === null || _g === void 0 ? void 0 : _g.pairIdMap) === null || _h === void 0 ? void 0 : _h[assignedParticipantIds[1]];
7274
- var pairedParticipant = pairedParticipantId && ((_j = participantMap[pairedParticipantId]) === null || _j === void 0 ? void 0 : _j.participant);
7260
+ var pairedParticipantId = (_f = (_e = participantMap === null || participantMap === void 0 ? void 0 : participantMap[assignedParticipantIds[0]]) === null || _e === void 0 ? void 0 : _e.pairIdMap) === null || _f === void 0 ? void 0 : _f[assignedParticipantIds[1]];
7261
+ var pairedParticipant = pairedParticipantId && ((_g = participantMap[pairedParticipantId]) === null || _g === void 0 ? void 0 : _g.participant);
7275
7262
  var participant = pairedParticipant ||
7276
7263
  // resort to brute force
7277
7264
  getPairedParticipant({
@@ -7279,23 +7266,49 @@ function getDrawPositionCollectionAssignment(_a) {
7279
7266
  tournamentParticipants: tournamentParticipants,
7280
7267
  }).participant;
7281
7268
  var participantId = participant === null || participant === void 0 ? void 0 : participant.participantId;
7282
- return _a = {},
7283
- _a[drawPosition] = { participantId: participantId, teamParticipant: teamParticipant, substitutions: substitutions },
7284
- _a;
7269
+ return _b = {},
7270
+ _b[attribute] = { participantId: participantId, teamParticipant: teamParticipant, substitutions: substitutions },
7271
+ _b;
7285
7272
  }
7286
7273
  else if ((assignedParticipantIds === null || assignedParticipantIds === void 0 ? void 0 : assignedParticipantIds.length) > 2) {
7287
- return _b = {}, _b[drawPosition] = { teamParticipant: teamParticipant, substitutions: substitutions }, _b;
7274
+ return _c = {}, _c[attribute] = { teamParticipant: teamParticipant, substitutions: substitutions }, _c;
7288
7275
  }
7289
7276
  }
7290
7277
  else {
7291
7278
  var participantId = assignedParticipantIds === null || assignedParticipantIds === void 0 ? void 0 : assignedParticipantIds[0];
7292
- return (participantId && (_c = {},
7293
- _c[drawPosition] = { participantId: participantId, teamParticipant: teamParticipant, substitutions: substitutions },
7294
- _c));
7279
+ return (participantId && (_d = {},
7280
+ _d[attribute] = { participantId: participantId, teamParticipant: teamParticipant, substitutions: substitutions },
7281
+ _d));
7295
7282
  }
7296
7283
  return undefined;
7284
+ };
7285
+ if (!(drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.length)) {
7286
+ var sideNumberCollectionAssignment = (sideLineUps === null || sideLineUps === void 0 ? void 0 : sideLineUps.map(function (side) {
7287
+ var _a;
7288
+ var teamParticipant = side.teamParticipant, sideNumber = side.sideNumber;
7289
+ var lineUp = side.lineUp || ((_a = getTeamLineUp({ participantId: teamParticipant.teamParticipantId, drawDefinition: drawDefinition })) === null || _a === void 0 ? void 0 : _a.lineUp);
7290
+ return getAssignment({ attribute: sideNumber, lineUp: lineUp, teamParticipant: teamParticipant });
7291
+ }).filter(Boolean)) || {};
7292
+ return { sideNumberCollectionAssignment: Object.assign.apply(Object, __spreadArray([{}], __read(sideNumberCollectionAssignment), false)) };
7293
+ }
7294
+ var drawPositionCollectionAssignment = (drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.map(function (drawPosition) {
7295
+ var _a, _b, _c;
7296
+ var teamParticipantId = (_a = positionAssignments.find(function (assignment) { return assignment.drawPosition === drawPosition; })) === null || _a === void 0 ? void 0 : _a.participantId;
7297
+ var side = sideLineUps === null || sideLineUps === void 0 ? void 0 : sideLineUps.find(function (lineUp) { return (lineUp === null || lineUp === void 0 ? void 0 : lineUp.drawPosition) === drawPosition; });
7298
+ var teamParticipant = (side === null || side === void 0 ? void 0 : side.teamParticipant) ||
7299
+ (teamParticipantId && ((_b = participantMap === null || participantMap === void 0 ? void 0 : participantMap[teamParticipantId]) === null || _b === void 0 ? void 0 : _b.participant)) ||
7300
+ (tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.find(function (_a) {
7301
+ var participantId = _a.participantId;
7302
+ return participantId === teamParticipantId;
7303
+ }));
7304
+ var lineUp = (side === null || side === void 0 ? void 0 : side.lineUp) ||
7305
+ ((_c = getTeamLineUp({
7306
+ participantId: teamParticipantId,
7307
+ drawDefinition: drawDefinition,
7308
+ })) === null || _c === void 0 ? void 0 : _c.lineUp);
7309
+ return getAssignment({ attribute: drawPosition, lineUp: lineUp, teamParticipant: teamParticipant });
7297
7310
  }).filter(Boolean)) || {};
7298
- return Object.assign.apply(Object, __spreadArray([{}], __read(drawPositionCollectionAssignment), false));
7311
+ return { drawPositionCollectionAssignment: Object.assign.apply(Object, __spreadArray([{}], __read(drawPositionCollectionAssignment), false)) };
7299
7312
  }
7300
7313
 
7301
7314
  function modifyEntryProfile(_a) {
@@ -9779,25 +9792,13 @@ function filterMatchUps(params) {
9779
9792
  });
9780
9793
  }
9781
9794
 
9782
- /**
9783
- *
9784
- * @param {object} drawPositionCollectionAssignment - mapping of drawPositions to participantIds derived from collectionAssignments
9785
- * @param {object[]} positionAssignments - mapping of drawPositions to participantIds (in TIES this is TEAM participantId)
9786
- * @param {number} displaySideNumber - accounts for both top and bottom feed arm positioning
9787
- * @param {object[]} seedAssignments - mapping of participantIds to seedNumber and seedValue
9788
- * @param {number} drawPosition -
9789
- * @param {boolean} isFeedRound - whether a round includes fed drawPositions
9790
- * @param {number} sideNumber - 1 or 2
9791
- */
9792
9795
  function getSide(_a) {
9793
9796
  var _b, _c, _d, _e;
9794
- var drawPositionCollectionAssignment = _a.drawPositionCollectionAssignment, positionAssignments = _a.positionAssignments, displaySideNumber = _a.displaySideNumber, seedAssignments = _a.seedAssignments, drawPosition = _a.drawPosition, isFeedRound = _a.isFeedRound, sideNumber = _a.sideNumber;
9795
- var assignment = positionAssignments.find(function (assignment) {
9796
- return assignment.drawPosition && assignment.drawPosition === drawPosition;
9797
- });
9798
- var participantId = drawPositionCollectionAssignment
9799
- ? (_b = drawPositionCollectionAssignment[drawPosition]) === null || _b === void 0 ? void 0 : _b.participantId
9800
- : assignment === null || assignment === void 0 ? void 0 : assignment.participantId;
9797
+ var drawPositionCollectionAssignment = _a.drawPositionCollectionAssignment, sideNumberCollectionAssignment = _a.sideNumberCollectionAssignment, positionAssignments = _a.positionAssignments, displaySideNumber = _a.displaySideNumber, seedAssignments = _a.seedAssignments, drawPosition = _a.drawPosition, isFeedRound = _a.isFeedRound, sideNumber = _a.sideNumber;
9798
+ var assignment = positionAssignments.find(function (assignment) { return assignment.drawPosition && assignment.drawPosition === drawPosition; });
9799
+ var dpc = drawPosition && drawPositionCollectionAssignment;
9800
+ var snc = sideNumber && sideNumberCollectionAssignment;
9801
+ var participantId = dpc ? (_b = dpc[drawPosition]) === null || _b === void 0 ? void 0 : _b.participantId : assignment === null || assignment === void 0 ? void 0 : assignment.participantId;
9801
9802
  var sideValue = assignment
9802
9803
  ? getSideValue$1({
9803
9804
  displaySideNumber: displaySideNumber,
@@ -9806,7 +9807,7 @@ function getSide(_a) {
9806
9807
  assignment: assignment,
9807
9808
  sideNumber: sideNumber,
9808
9809
  })
9809
- : {};
9810
+ : __assign({}, snc === null || snc === void 0 ? void 0 : snc[sideNumber]);
9810
9811
  if (isFeedRound) {
9811
9812
  if (sideNumber === 1) {
9812
9813
  Object.assign(sideValue, { participantFed: true });
@@ -9815,15 +9816,17 @@ function getSide(_a) {
9815
9816
  Object.assign(sideValue, { participantAdvanced: true });
9816
9817
  }
9817
9818
  }
9818
- var teamParticipant = (_c = drawPositionCollectionAssignment === null || drawPositionCollectionAssignment === void 0 ? void 0 : drawPositionCollectionAssignment[drawPosition]) === null || _c === void 0 ? void 0 : _c.teamParticipant;
9819
- var participant = (_d = drawPositionCollectionAssignment === null || drawPositionCollectionAssignment === void 0 ? void 0 : drawPositionCollectionAssignment[drawPosition]) === null || _d === void 0 ? void 0 : _d.participant;
9820
- var substitutions = (_e = drawPositionCollectionAssignment === null || drawPositionCollectionAssignment === void 0 ? void 0 : drawPositionCollectionAssignment[drawPosition]) === null || _e === void 0 ? void 0 : _e.substitutions;
9821
- if (participant)
9822
- Object.assign(sideValue, { participant: participant });
9823
- if (substitutions)
9824
- Object.assign(sideValue, { substitutions: substitutions });
9825
- if (teamParticipant)
9826
- Object.assign(sideValue, { teamParticipant: teamParticipant });
9819
+ if (drawPosition && dpc) {
9820
+ var teamParticipant = (_c = dpc[drawPosition]) === null || _c === void 0 ? void 0 : _c.teamParticipant;
9821
+ var participant = (_d = dpc[drawPosition]) === null || _d === void 0 ? void 0 : _d.participant;
9822
+ var substitutions = (_e = dpc[drawPosition]) === null || _e === void 0 ? void 0 : _e.substitutions;
9823
+ if (participant)
9824
+ sideValue.participant = participant;
9825
+ if (substitutions)
9826
+ sideValue.substitutions = substitutions;
9827
+ if (teamParticipant)
9828
+ sideValue.teamParticipant = teamParticipant;
9829
+ }
9827
9830
  return sideValue;
9828
9831
  }
9829
9832
  function getSideValue$1(_a) {
@@ -9847,9 +9850,7 @@ function getSideValue$1(_a) {
9847
9850
  }
9848
9851
  function getSeeding(_a) {
9849
9852
  var seedAssignments = _a.seedAssignments, participantId = _a.participantId;
9850
- return seedAssignments === null || seedAssignments === void 0 ? void 0 : seedAssignments.find(function (assignment) {
9851
- return !assignment.seedProxy && assignment.participantId === participantId;
9852
- });
9853
+ return seedAssignments === null || seedAssignments === void 0 ? void 0 : seedAssignments.find(function (assignment) { return !assignment.seedProxy && assignment.participantId === participantId; });
9853
9854
  }
9854
9855
 
9855
9856
  var ANY = 'ANY';
@@ -10069,8 +10070,8 @@ function getAllStructureMatchUps(_a) {
10069
10070
  var drawPositions = (_f = tieDrawPositions !== null && tieDrawPositions !== void 0 ? tieDrawPositions : matchUp.drawPositions) !== null && _f !== void 0 ? _f : [];
10070
10071
  var collectionPosition = matchUp.collectionPosition, collectionId = matchUp.collectionId, roundPosition = matchUp.roundPosition;
10071
10072
  var roundNumber = (_g = matchUp.roundNumber) !== null && _g !== void 0 ? _g : additionalContext.roundNumber;
10072
- var drawPositionCollectionAssignment = collectionId
10073
- ? getDrawPositionCollectionAssignment({
10073
+ var collectionAssignmentDetail = collectionId
10074
+ ? getCollectionAssignment({
10074
10075
  tournamentParticipants: tournamentParticipants,
10075
10076
  positionAssignments: positionAssignments,
10076
10077
  collectionPosition: collectionPosition,
@@ -10170,15 +10171,7 @@ function getAllStructureMatchUps(_a) {
10170
10171
  var _a;
10171
10172
  var sideNumber = index + 1;
10172
10173
  var displaySideNumber = reversedDisplayOrder_1 ? 3 - sideNumber : sideNumber;
10173
- var side = getSide({
10174
- drawPositionCollectionAssignment: drawPositionCollectionAssignment,
10175
- positionAssignments: positionAssignments,
10176
- displaySideNumber: displaySideNumber,
10177
- seedAssignments: seedAssignments,
10178
- drawPosition: drawPosition,
10179
- isFeedRound: isFeedRound_1,
10180
- sideNumber: sideNumber,
10181
- });
10174
+ var side = getSide(__assign(__assign({}, collectionAssignmentDetail), { positionAssignments: positionAssignments, displaySideNumber: displaySideNumber, seedAssignments: seedAssignments, drawPosition: drawPosition, isFeedRound: isFeedRound_1, sideNumber: sideNumber }));
10182
10175
  var existingSide = (_a = matchUp.sides) === null || _a === void 0 ? void 0 : _a.find(function (existing) { return existing.sideNumber === sideNumber; });
10183
10176
  // drawPositions for consolation structures are offset by the number of fed positions in subsequent rounds
10184
10177
  // columnPosition gives an ordered position value relative to a single column
@@ -11369,10 +11362,8 @@ function addFinishingRounds(_a) {
11369
11362
  // for qualifying, offset the final round so that qualifyinground is finishingRound
11370
11363
  var finishingRoundOffset = roundLimit ? roundsCount - roundLimit : 0;
11371
11364
  // for QUALIFYING draws the best finishingPosition is equal to the number of matchUps in the final round of the structure
11372
- var minQualifyingPosition = finishingRoundOffset &&
11373
- ((_b = roundProfile === null || roundProfile === void 0 ? void 0 : roundProfile[roundsCount - finishingRoundOffset]) === null || _b === void 0 ? void 0 : _b.matchUpsCount);
11374
- var roundMatchUpsCountArray = roundProfile &&
11375
- Object.values(roundProfile).map(extractAttributes('matchUpsCount'));
11365
+ var minQualifyingPosition = finishingRoundOffset && ((_b = roundProfile === null || roundProfile === void 0 ? void 0 : roundProfile[roundsCount - finishingRoundOffset]) === null || _b === void 0 ? void 0 : _b.matchUpsCount);
11366
+ var roundMatchUpsCountArray = roundProfile && Object.values(roundProfile).map(xa('matchUpsCount'));
11376
11367
  // returns a range for array of possible finishing drawPositions
11377
11368
  var finishingRange = function (positionRange, winner) {
11378
11369
  var minFinishingPosition = Math.min.apply(Math, __spreadArray([], __read(positionRange), false));
@@ -11399,9 +11390,7 @@ function addFinishingRounds(_a) {
11399
11390
  var fmlcException = fmlc && roundNumber !== 1;
11400
11391
  var rangeOffset = 1 + finishingPositionOffset + (fmlcException ? positionsFed !== null && positionsFed !== void 0 ? positionsFed : 0 : 0);
11401
11392
  var finalPosition = 1;
11402
- var positionRange = generateRange(rangeOffset, lucky
11403
- ? rangeOffset + matchUpsCount * 2
11404
- : upcomingMatchUps + rangeOffset + finalPosition);
11393
+ var positionRange = generateRange(rangeOffset, lucky ? rangeOffset + matchUpsCount * 2 : upcomingMatchUps + rangeOffset + finalPosition);
11405
11394
  var slicer = upcomingMatchUps + finalPosition - matchUpsCount;
11406
11395
  var loser = finishingRange(positionRange.slice(slicer));
11407
11396
  var winner = finishingRange(positionRange.slice(0, slicer), true);
@@ -12945,17 +12934,13 @@ function getAssignedParticipantIds(_a) {
12945
12934
  var drawDefinition = _a.drawDefinition, stages = _a.stages;
12946
12935
  if (!drawDefinition)
12947
12936
  return { error: MISSING_DRAW_DEFINITION };
12948
- var stageStructures = ((_b = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) !== null && _b !== void 0 ? _b : []).filter(function (structure) {
12949
- return !(stages === null || stages === void 0 ? void 0 : stages.length) || (structure.stage && stages.includes(structure.stage));
12950
- });
12937
+ var stageStructures = ((_b = drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.structures) !== null && _b !== void 0 ? _b : []).filter(function (structure) { return !(stages === null || stages === void 0 ? void 0 : stages.length) || (structure.stage && stages.includes(structure.stage)); });
12951
12938
  var assignedParticipantIds = unique(stageStructures
12952
12939
  .map(function (structure) {
12953
12940
  var positionAssignments = getPositionAssignments$1({
12954
12941
  structure: structure,
12955
12942
  }).positionAssignments;
12956
- return positionAssignments
12957
- ? positionAssignments.map(extractAttributes('participantId'))
12958
- : [];
12943
+ return positionAssignments ? positionAssignments.map(xa('participantId')) : [];
12959
12944
  })
12960
12945
  .flat()
12961
12946
  .filter(Boolean));
@@ -13917,12 +13902,13 @@ function getParticipantEntries(params) {
13917
13902
  var getRanking = function (_a) {
13918
13903
  var _b, _c, _d, _e;
13919
13904
  var eventType = _a.eventType, scaleNames = _a.scaleNames, participantId = _a.participantId;
13920
- return (_e = (_d = (_c = (_b = participantMap[participantId].participant) === null || _b === void 0 ? void 0 : _b.rankings) === null || _c === void 0 ? void 0 : _c[eventType]) === null || _d === void 0 ? void 0 : _d.find(function (ranking) { return scaleNames.includes(ranking.scaleName); })) === null || _e === void 0 ? void 0 : _e.scaleValue;
13905
+ return (_e = (_d = (_c = (_b = participantMap[participantId].participant) === null || _b === void 0 ? void 0 : _b.rankings) === null || _c === void 0 ? void 0 : _c[eventType]) === null || _d === void 0 ? void 0 : _d.find(function (ranking) {
13906
+ return scaleNames.includes(ranking.scaleName);
13907
+ })) === null || _e === void 0 ? void 0 : _e.scaleValue;
13921
13908
  };
13922
13909
  var _loop_1 = function (event_1) {
13923
13910
  var e_3, _o, e_4, _p, e_5, _q;
13924
- if ((participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.eventIds) &&
13925
- !participantFilters.eventIds.includes(event_1.eventId))
13911
+ if ((participantFilters === null || participantFilters === void 0 ? void 0 : participantFilters.eventIds) && !participantFilters.eventIds.includes(event_1.eventId))
13926
13912
  return "continue";
13927
13913
  var _r = event_1.drawDefinitions, drawDefinitions = _r === void 0 ? [] : _r, _s = event_1.extensions, extensions = _s === void 0 ? [] : _s, eventType = event_1.eventType, eventName = event_1.eventName, category = event_1.category, entries = event_1.entries, eventId = event_1.eventId, gender = event_1.gender;
13928
13914
  var flightProfile = getFlightProfile({ event: event_1 }).flightProfile;
@@ -13932,13 +13918,9 @@ function getParticipantEntries(params) {
13932
13918
  eventsPublishStatuses[eventId] = publishStatuses;
13933
13919
  var publishedSeeding = publishStatuses === null || publishStatuses === void 0 ? void 0 : publishStatuses.publishedSeeding;
13934
13920
  if (withEvents || withSeeding || withRankingProfile) {
13935
- var extensionConversions = convertExtensions
13936
- ? Object.assign.apply(Object, __spreadArray([{}], __read(extensionsToAttributes(extensions)), false)) : {};
13921
+ var extensionConversions = convertExtensions ? Object.assign.apply(Object, __spreadArray([{}], __read(extensionsToAttributes(extensions)), false)) : {};
13937
13922
  derivedEventInfo[eventId] = __assign(__assign({}, extensionConversions), { eventName: eventName, eventType: eventType, category: category, eventId: eventId, gender: gender });
13938
- var scaleNames = [
13939
- category === null || category === void 0 ? void 0 : category.categoryName,
13940
- category === null || category === void 0 ? void 0 : category.ageCategoryCode,
13941
- ].filter(Boolean);
13923
+ var scaleNames = [category === null || category === void 0 ? void 0 : category.categoryName, category === null || category === void 0 ? void 0 : category.ageCategoryCode].filter(Boolean);
13942
13924
  var _loop_3 = function (entry) {
13943
13925
  var _t;
13944
13926
  var participantId = entry.participantId;
@@ -13978,8 +13960,7 @@ function getParticipantEntries(params) {
13978
13960
  };
13979
13961
  addEventEntry(participantId);
13980
13962
  // add details for individualParticipantIds for TEAM/PAIR events
13981
- var individualParticipantIds = participantMap[participantId].participant.individualParticipantIds ||
13982
- [];
13963
+ var individualParticipantIds = participantMap[participantId].participant.individualParticipantIds || [];
13983
13964
  individualParticipantIds.forEach(addEventEntry);
13984
13965
  };
13985
13966
  try {
@@ -14008,7 +13989,7 @@ function getParticipantEntries(params) {
14008
13989
  _b);
14009
13990
  })), false)) : undefined;
14010
13991
  };
14011
- var drawIds = unique(__spreadArray(__spreadArray([], __read(drawDefinitions.map(extractAttributes('drawId'))), false), __read(flights.map(extractAttributes('drawId'))), false));
13992
+ var drawIds = unique(__spreadArray(__spreadArray([], __read(drawDefinitions.map(xa('drawId'))), false), __read(flights.map(xa('drawId'))), false));
14012
13993
  var _loop_4 = function (drawId) {
14013
13994
  var e_6, _u;
14014
13995
  var drawDefinition = drawDefinitions.find(function (drawDefinition) { return drawDefinition.drawId === drawId; });
@@ -14016,10 +13997,7 @@ function getParticipantEntries(params) {
14016
13997
  var entries_2 = (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.entries) || (flight === null || flight === void 0 ? void 0 : flight.drawEntries);
14017
13998
  var _v = drawDefinition !== null && drawDefinition !== void 0 ? drawDefinition : {}, _w = _v.structures, structures = _w === void 0 ? [] : _w, drawOrder = _v.drawOrder, drawName = _v.drawName, drawType = _v.drawType;
14018
13999
  var flightNumber = flight === null || flight === void 0 ? void 0 : flight.flightNumber;
14019
- var scaleNames = [
14020
- category === null || category === void 0 ? void 0 : category.categoryName,
14021
- category === null || category === void 0 ? void 0 : category.ageCategoryCode,
14022
- ].filter(Boolean);
14000
+ var scaleNames = [category === null || category === void 0 ? void 0 : category.categoryName, category === null || category === void 0 ? void 0 : category.ageCategoryCode].filter(Boolean);
14023
14001
  // used in rankings pipeline.
14024
14002
  // the structures in which a particpant particpates are ordered
14025
14003
  // to enable differentiation for Points-per-round and points-per-win
@@ -14027,9 +14005,7 @@ function getParticipantEntries(params) {
14027
14005
  .sort(function (a, b) { return structureSort(a, b); })
14028
14006
  .map(function (_a) {
14029
14007
  var structureId = _a.structureId, structures = _a.structures;
14030
- return __spreadArray([
14031
- structureId
14032
- ], __read((structures || []).map(function (_a) {
14008
+ return __spreadArray([structureId], __read((structures || []).map(function (_a) {
14033
14009
  var structureId = _a.structureId;
14034
14010
  return structureId;
14035
14011
  })), false);
@@ -14075,8 +14051,7 @@ function getParticipantEntries(params) {
14075
14051
  });
14076
14052
  var seedingPublished = !usePublishState ||
14077
14053
  ((eventPublishedSeeding === null || eventPublishedSeeding === void 0 ? void 0 : eventPublishedSeeding.published) &&
14078
- (((_e = eventPublishedSeeding === null || eventPublishedSeeding === void 0 ? void 0 : eventPublishedSeeding.drawIds) === null || _e === void 0 ? void 0 : _e.length) === 0 ||
14079
- ((_f = eventPublishedSeeding === null || eventPublishedSeeding === void 0 ? void 0 : eventPublishedSeeding.drawIds) === null || _f === void 0 ? void 0 : _f.includes(drawId))));
14054
+ (((_e = eventPublishedSeeding === null || eventPublishedSeeding === void 0 ? void 0 : eventPublishedSeeding.drawIds) === null || _e === void 0 ? void 0 : _e.length) === 0 || ((_f = eventPublishedSeeding === null || eventPublishedSeeding === void 0 ? void 0 : eventPublishedSeeding.drawIds) === null || _f === void 0 ? void 0 : _f.includes(drawId))));
14080
14055
  var _loop_6 = function (entry) {
14081
14056
  var entryStatus = entry.entryStatus, entryStage = entry.entryStage, entryPosition = entry.entryPosition, participantId = entry.participantId;
14082
14057
  // get event ranking
@@ -14095,19 +14070,13 @@ function getParticipantEntries(params) {
14095
14070
  var includeSeeding = withSeeding && seedingPublished;
14096
14071
  var seedAssignments = includeSeeding ? {} : undefined;
14097
14072
  var mainSeeding = includeSeeding
14098
- ? ((_b = mainSeedingMap === null || mainSeedingMap === void 0 ? void 0 : mainSeedingMap[participantId]) === null || _b === void 0 ? void 0 : _b.seedValue) ||
14099
- ((_c = mainSeedingMap === null || mainSeedingMap === void 0 ? void 0 : mainSeedingMap[participantId]) === null || _c === void 0 ? void 0 : _c.seedNumber)
14100
- : undefined;
14101
- var mainSeedingAssignments = mainSeeding
14102
- ? mainSeedingMap === null || mainSeedingMap === void 0 ? void 0 : mainSeedingMap[participantId]
14073
+ ? ((_b = mainSeedingMap === null || mainSeedingMap === void 0 ? void 0 : mainSeedingMap[participantId]) === null || _b === void 0 ? void 0 : _b.seedValue) || ((_c = mainSeedingMap === null || mainSeedingMap === void 0 ? void 0 : mainSeedingMap[participantId]) === null || _c === void 0 ? void 0 : _c.seedNumber)
14103
14074
  : undefined;
14075
+ var mainSeedingAssignments = mainSeeding ? mainSeedingMap === null || mainSeedingMap === void 0 ? void 0 : mainSeedingMap[participantId] : undefined;
14104
14076
  var qualifyingSeeding = includeSeeding
14105
- ? ((_d = qualifyingSeedingMap === null || qualifyingSeedingMap === void 0 ? void 0 : qualifyingSeedingMap[participantId]) === null || _d === void 0 ? void 0 : _d.seedValue) ||
14106
- ((_e = qualifyingSeedingMap === null || qualifyingSeedingMap === void 0 ? void 0 : qualifyingSeedingMap[participantId]) === null || _e === void 0 ? void 0 : _e.seedNumber)
14107
- : undefined;
14108
- var qualifyingSeedingAssignments = qualifyingSeeding
14109
- ? qualifyingSeedingMap === null || qualifyingSeedingMap === void 0 ? void 0 : qualifyingSeedingMap[participantId]
14077
+ ? ((_d = qualifyingSeedingMap === null || qualifyingSeedingMap === void 0 ? void 0 : qualifyingSeedingMap[participantId]) === null || _d === void 0 ? void 0 : _d.seedValue) || ((_e = qualifyingSeedingMap === null || qualifyingSeedingMap === void 0 ? void 0 : qualifyingSeedingMap[participantId]) === null || _e === void 0 ? void 0 : _e.seedNumber)
14110
14078
  : undefined;
14079
+ var qualifyingSeedingAssignments = qualifyingSeeding ? qualifyingSeedingMap === null || qualifyingSeedingMap === void 0 ? void 0 : qualifyingSeedingMap[participantId] : undefined;
14111
14080
  if (seedAssignments && mainSeeding)
14112
14081
  seedAssignments[MAIN] = mainSeedingAssignments;
14113
14082
  if (seedAssignments && qualifyingSeeding)
@@ -14125,10 +14094,7 @@ function getParticipantEntries(params) {
14125
14094
  if (seedAssignments) {
14126
14095
  if (!participantMap[id].events[eventId].seedAssignments)
14127
14096
  participantMap[id].events[eventId].seedAssignments = {};
14128
- Object.keys(seedAssignments).forEach(function (stage) {
14129
- return (participantMap[id].events[eventId].seedAssignments[stage] =
14130
- seedAssignments[stage]);
14131
- });
14097
+ Object.keys(seedAssignments).forEach(function (stage) { return (participantMap[id].events[eventId].seedAssignments[stage] = seedAssignments[stage]); });
14132
14098
  }
14133
14099
  }
14134
14100
  if (withDraws || withRankingProfile) {
@@ -14146,8 +14112,7 @@ function getParticipantEntries(params) {
14146
14112
  };
14147
14113
  if (![UNGROUPED, UNPAIRED].includes(entryStatus)) {
14148
14114
  addDrawEntry(participantId);
14149
- var individualParticipantIds = participantMap[participantId].participant
14150
- .individualParticipantIds || [];
14115
+ var individualParticipantIds = participantMap[participantId].participant.individualParticipantIds || [];
14151
14116
  // add for individualParticipantIds when participantType is TEAM/PAIR
14152
14117
  individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.forEach(addDrawEntry);
14153
14118
  }
@@ -14255,12 +14220,8 @@ function getParticipantEntries(params) {
14255
14220
  }
14256
14221
  finally { if (e_7) throw e_7.error; }
14257
14222
  }
14258
- if (Array.isArray(potentialParticipants) &&
14259
- (nextMatchUps || !!scheduleAnalysis || withScheduleItems)) {
14260
- var potentialParticipantIds = potentialParticipants
14261
- .flat()
14262
- .map(extractAttributes('participantId'))
14263
- .filter(Boolean);
14223
+ if (Array.isArray(potentialParticipants) && (nextMatchUps || !!scheduleAnalysis || withScheduleItems)) {
14224
+ var potentialParticipantIds = potentialParticipants.flat().map(xa('participantId')).filter(Boolean);
14264
14225
  potentialParticipantIds === null || potentialParticipantIds === void 0 ? void 0 : potentialParticipantIds.forEach(function (participantId) {
14265
14226
  var relevantParticipantIds = getRelevantParticipantIds(participantId);
14266
14227
  relevantParticipantIds === null || relevantParticipantIds === void 0 ? void 0 : relevantParticipantIds.forEach(function (relevantParticipantId) {
@@ -14350,8 +14311,7 @@ function getParticipantEntries(params) {
14350
14311
  };
14351
14312
  var _loop_7 = function (drawId) {
14352
14313
  var _11 = derivedDrawInfo[drawId] || {}, _12 = _11.orderedStructureIds, orderedStructureIds = _12 === void 0 ? [] : _12, flightNumber = _11.flightNumber;
14353
- if (participantAggregator.structureParticipation &&
14354
- orderedStructureIds.length) {
14314
+ if (participantAggregator.structureParticipation && orderedStructureIds.length) {
14355
14315
  var finishingPositionRange_1;
14356
14316
  var nonQualifyingOrder_1 = 0;
14357
14317
  // structures in which a participant participants/exits
@@ -14361,26 +14321,19 @@ function getParticipantEntries(params) {
14361
14321
  if (!participation)
14362
14322
  return;
14363
14323
  if (!finishingPositionRange_1)
14364
- finishingPositionRange_1 =
14365
- participation === null || participation === void 0 ? void 0 : participation.finishingPositionRange;
14366
- if (diff_1(finishingPositionRange_1) >
14367
- diff_1(participation === null || participation === void 0 ? void 0 : participation.finishingPositionRange))
14368
- finishingPositionRange_1 =
14369
- participation === null || participation === void 0 ? void 0 : participation.finishingPositionRange;
14324
+ finishingPositionRange_1 = participation === null || participation === void 0 ? void 0 : participation.finishingPositionRange;
14325
+ if (diff_1(finishingPositionRange_1) > diff_1(participation === null || participation === void 0 ? void 0 : participation.finishingPositionRange))
14326
+ finishingPositionRange_1 = participation === null || participation === void 0 ? void 0 : participation.finishingPositionRange;
14370
14327
  var notQualifying = participation.stage !== QUALIFYING;
14371
14328
  if (notQualifying)
14372
14329
  nonQualifyingOrder_1 += 1;
14373
- var participationOrder = notQualifying
14374
- ? nonQualifyingOrder_1
14375
- : undefined;
14330
+ var participationOrder = notQualifying ? nonQualifyingOrder_1 : undefined;
14376
14331
  return definedAttributes(__assign(__assign({}, participation), { participationOrder: participationOrder, flightNumber: flightNumber }));
14377
14332
  })
14378
14333
  .filter(Boolean);
14379
14334
  if (participantAggregator.draws[drawId]) {
14380
- participantAggregator.draws[drawId].finishingPositionRange =
14381
- finishingPositionRange_1;
14382
- participantAggregator.draws[drawId].structureParticipation =
14383
- orderedParticipation;
14335
+ participantAggregator.draws[drawId].finishingPositionRange = finishingPositionRange_1;
14336
+ participantAggregator.draws[drawId].structureParticipation = orderedParticipation;
14384
14337
  }
14385
14338
  }
14386
14339
  };
@@ -14399,9 +14352,7 @@ function getParticipantEntries(params) {
14399
14352
  }
14400
14353
  }
14401
14354
  if (scheduleAnalysis) {
14402
- var scheduledMinutesDifference = isObject(scheduleAnalysis)
14403
- ? scheduleAnalysis.scheduledMinutesDifference
14404
- : 0;
14355
+ var scheduledMinutesDifference = isObject(scheduleAnalysis) ? scheduleAnalysis.scheduledMinutesDifference : 0;
14405
14356
  // iterate through participantAggregator.scheduleItems
14406
14357
  var scheduleItems = participantAggregator.scheduleItems || [];
14407
14358
  var potentialMatchUps = participantAggregator.potentialMatchUps || {};
@@ -14425,19 +14376,15 @@ function getParticipantEntries(params) {
14425
14376
  for (var scheduleItemsToConsider_1 = (e_10 = void 0, __values(scheduleItemsToConsider)), scheduleItemsToConsider_1_1 = scheduleItemsToConsider_1.next(); !scheduleItemsToConsider_1_1.done; scheduleItemsToConsider_1_1 = scheduleItemsToConsider_1.next()) {
14426
14377
  var consideredItem = scheduleItemsToConsider_1_1.value;
14427
14378
  var ignoreItem = consideredItem.matchUpId === scheduleItem.matchUpId ||
14428
- ([WALKOVER$2, DEFAULTED].includes(consideredItem.matchUpStatus) &&
14429
- !consideredItem.checkScoreHasValue);
14379
+ ([WALKOVER$2, DEFAULTED].includes(consideredItem.matchUpStatus) && !consideredItem.checkScoreHasValue);
14430
14380
  if (ignoreItem)
14431
14381
  continue;
14432
14382
  // if there is a matchType change (SINGLES => DOUBLES or vice versa) then there is potentially a different timeAfterRecovery
14433
14383
  var typeChange = scheduleItem.matchUpType !== consideredItem.matchUpType;
14434
- var notBeforeTime = typeChange
14435
- ? typeChangeTimeAfterRecovery || timeAfterRecovery
14436
- : timeAfterRecovery;
14384
+ var notBeforeTime = typeChange ? typeChangeTimeAfterRecovery || timeAfterRecovery : timeAfterRecovery;
14437
14385
  // if two matchUps are both potentials and both part of the same draw they cannot be considered in conflict
14438
14386
  var sameDraw = scheduleItem.drawId === consideredItem.drawId;
14439
- var bothPotential = potentialMatchUps[scheduleItem.matchUpId] &&
14440
- potentialMatchUps[consideredItem.matchUpId];
14387
+ var bothPotential = potentialMatchUps[scheduleItem.matchUpId] && potentialMatchUps[consideredItem.matchUpId];
14441
14388
  var consideredMinutes = timeStringMinutes(consideredItem.scheduledTime);
14442
14389
  var minutesDifference = Math.abs(consideredMinutes - scheduledMinutes);
14443
14390
  var itemIsPrior = consideredMinutes >= scheduledMinutes;
@@ -14446,14 +14393,10 @@ function getParticipantEntries(params) {
14446
14393
  // 2. A scheduledTime occurring before a prior matchUps notBeforeTime (timeAfterRecovery)
14447
14394
  var timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference)
14448
14395
  ? minutesDifference <= scheduledMinutesDifference
14449
- : itemIsPrior &&
14450
- timeStringMinutes(consideredItem.scheduledTime) <
14451
- timeStringMinutes(notBeforeTime);
14396
+ : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
14452
14397
  // if there is a time overlap capture both the prior matchUpId and the conflicted matchUpId
14453
14398
  if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
14454
- var key = [scheduleItem.matchUpId, consideredItem.matchUpId]
14455
- .sort(stringSort)
14456
- .join('|');
14399
+ var key = [scheduleItem.matchUpId, consideredItem.matchUpId].sort(stringSort).join('|');
14457
14400
  participantAggregator.scheduleConflicts[key] = {
14458
14401
  priorScheduledMatchUpId: scheduleItem.matchUpId,
14459
14402
  matchUpIdWithConflict: consideredItem.matchUpId,
@@ -14481,8 +14424,7 @@ function getParticipantEntries(params) {
14481
14424
  if (Object.keys(participantAggregator.scheduleConflicts).length) {
14482
14425
  participantIdsWithConflicts.push(pid);
14483
14426
  }
14484
- participantMap[pid].scheduleConflicts =
14485
- participantAggregator.scheduleConflicts;
14427
+ participantMap[pid].scheduleConflicts = participantAggregator.scheduleConflicts;
14486
14428
  }
14487
14429
  };
14488
14430
  try {
@@ -15200,28 +15142,23 @@ function removeEventEntries(_a) {
15200
15142
  var stack = 'removeEventEntries';
15201
15143
  if (!(event === null || event === void 0 ? void 0 : event.eventId))
15202
15144
  return { error: MISSING_EVENT };
15203
- if (!Array.isArray(participantIds) ||
15204
- participantIds.some(function (participantId) { return !isString(participantId); })) {
15145
+ if (!Array.isArray(participantIds) || participantIds.some(function (participantId) { return !isString(participantId); })) {
15205
15146
  return decorateResult({ result: { error: INVALID_PARTICIPANT_ID }, stack: stack });
15206
15147
  }
15207
15148
  // do not filter by stages; must kmow all participantIds assigned to any stage!
15208
15149
  var assignedParticipantIds = ((_b = event.drawDefinitions) !== null && _b !== void 0 ? _b : []).flatMap(function (drawDefinition) { var _a; return (_a = getAssignedParticipantIds({ drawDefinition: drawDefinition }).assignedParticipantIds) !== null && _a !== void 0 ? _a : []; });
15209
15150
  var statusParticipantIds = (((entryStatuses === null || entryStatuses === void 0 ? void 0 : entryStatuses.length) &&
15210
- ((_c = event.entries) === null || _c === void 0 ? void 0 : _c.filter(function (entry) {
15211
- return entry.entryStatus && entryStatuses.includes(entry.entryStatus);
15212
- }))) ||
15151
+ ((_c = event.entries) === null || _c === void 0 ? void 0 : _c.filter(function (entry) { return entry.entryStatus && entryStatuses.includes(entry.entryStatus); }))) ||
15213
15152
  [])
15214
- .map(extractAttributes('participantId'))
15153
+ .map(xa('participantId'))
15215
15154
  .filter(function (participantId) { return !assignedParticipantIds.includes(participantId); });
15216
- var stageParticipantIds = ((stage &&
15217
- ((_d = event.entries) === null || _d === void 0 ? void 0 : _d.filter(function (entry) { return entry.entryStage && entry.entryStage === stage; }))) ||
15155
+ var stageParticipantIds = ((stage && ((_d = event.entries) === null || _d === void 0 ? void 0 : _d.filter(function (entry) { return entry.entryStage && entry.entryStage === stage; }))) ||
15218
15156
  [])
15219
- .map(extractAttributes('participantId'))
15157
+ .map(xa('participantId'))
15220
15158
  .filter(function (participantId) { return !assignedParticipantIds.includes(participantId); });
15221
15159
  if (participantIds.length) {
15222
15160
  participantIds = participantIds.filter(function (participantId) {
15223
- return (!(entryStatuses === null || entryStatuses === void 0 ? void 0 : entryStatuses.length) ||
15224
- statusParticipantIds.includes(participantId)) &&
15161
+ return (!(entryStatuses === null || entryStatuses === void 0 ? void 0 : entryStatuses.length) || statusParticipantIds.includes(participantId)) &&
15225
15162
  (!stage || stageParticipantIds.includes(participantId));
15226
15163
  });
15227
15164
  }
@@ -15235,9 +15172,7 @@ function removeEventEntries(_a) {
15235
15172
  participantIds = stageParticipantIds;
15236
15173
  }
15237
15174
  if ((participantIds === null || participantIds === void 0 ? void 0 : participantIds.length) &&
15238
- assignedParticipantIds.some(function (participantId) {
15239
- return participantIds.includes(participantId);
15240
- })) {
15175
+ assignedParticipantIds.some(function (participantId) { return participantIds.includes(participantId); })) {
15241
15176
  return decorateResult({
15242
15177
  result: { error: EXISTING_PARTICIPANT_DRAW_POSITION_ASSIGNMENT },
15243
15178
  stack: stack,
@@ -17114,8 +17049,7 @@ function getDrawData(params) {
17114
17049
  var structureId = structure === null || structure === void 0 ? void 0 : structure.structureId;
17115
17050
  var seedAssignments = [];
17116
17051
  // pass seedAssignments from { stageSequence: 1 } to other stages
17117
- if (structure.stage &&
17118
- [MAIN, CONSOLATION, PLAY_OFF].includes(structure.stage)) {
17052
+ if (structure.stage && [MAIN, CONSOLATION, PLAY_OFF].includes(structure.stage)) {
17119
17053
  seedAssignments = mainStageSeedAssignments;
17120
17054
  }
17121
17055
  if ((structure === null || structure === void 0 ? void 0 : structure.stage) === QUALIFYING) {
@@ -17123,9 +17057,7 @@ function getDrawData(params) {
17123
17057
  }
17124
17058
  var _b = getAllStructureMatchUps({
17125
17059
  // only propagate seedAssignments where none are present
17126
- seedAssignments: !((_a = structure === null || structure === void 0 ? void 0 : structure.seedAssignments) === null || _a === void 0 ? void 0 : _a.length)
17127
- ? seedAssignments
17128
- : undefined,
17060
+ seedAssignments: !((_a = structure === null || structure === void 0 ? void 0 : structure.seedAssignments) === null || _a === void 0 ? void 0 : _a.length) ? seedAssignments : undefined,
17129
17061
  context: __assign({ drawId: drawInfo.drawId }, context),
17130
17062
  tournamentParticipants: tournamentParticipants,
17131
17063
  policyDefinitions: policyDefinitions,
@@ -17140,7 +17072,7 @@ function getDrawData(params) {
17140
17072
  var positionAssignments = getPositionAssignments$1({
17141
17073
  structure: structure,
17142
17074
  }).positionAssignments;
17143
- var participantResults = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(extractAttributes(PARTICIPANT_ID)).map(function (assignment) {
17075
+ var participantResults = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(xa(PARTICIPANT_ID)).map(function (assignment) {
17144
17076
  participantPlacements = true;
17145
17077
  var drawPosition = assignment.drawPosition, participantId = assignment.participantId;
17146
17078
  var extension = findExtension({
@@ -17180,14 +17112,10 @@ function getDrawData(params) {
17180
17112
  DOUBLE_DEFAULT,
17181
17113
  DOUBLE_WALKOVER,
17182
17114
  ].includes(matchUp.matchUpStatus);
17183
- return (active ||
17184
- activeMatchUpStatus ||
17185
- !!matchUp.winningSide ||
17186
- !!((_a = matchUp.score) === null || _a === void 0 ? void 0 : _a.scoreStringSide1));
17115
+ return active || activeMatchUpStatus || !!matchUp.winningSide || !!((_a = matchUp.score) === null || _a === void 0 ? void 0 : _a.scoreStringSide1);
17187
17116
  }, false);
17188
17117
  var structureCompleted = matchUps.reduce(function (completed, matchUp) {
17189
- return (completed &&
17190
- [BYE, COMPLETED$1, RETIRED$1, WALKOVER$2, DEFAULTED, ABANDONED$1].includes(matchUp.matchUpStatus));
17118
+ return completed && [BYE, COMPLETED$1, RETIRED$1, WALKOVER$2, DEFAULTED, ABANDONED$1].includes(matchUp.matchUpStatus);
17191
17119
  }, !!matchUps.length);
17192
17120
  structureInfo.structureCompleted = structureCompleted;
17193
17121
  completedStructures[structureId] = structureCompleted;
@@ -20128,8 +20056,8 @@ function getTieMatchUpContext(_a) {
20128
20056
  drawDefinition: drawDefinition,
20129
20057
  matchUpsMap: matchUpsMap,
20130
20058
  }).matchUp;
20131
- var sideParticipantIds = (_c = (_b = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _b === void 0 ? void 0 : _b.map(extractAttributes('participantId'))) !== null && _c !== void 0 ? _c : [];
20132
- var assignedParticipantIds = (_d = relevantAssignments === null || relevantAssignments === void 0 ? void 0 : relevantAssignments.map(extractAttributes('participantId'))) !== null && _d !== void 0 ? _d : [];
20059
+ var sideParticipantIds = (_c = (_b = dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.sides) === null || _b === void 0 ? void 0 : _b.map(xa('participantId'))) !== null && _c !== void 0 ? _c : [];
20060
+ var assignedParticipantIds = (_d = relevantAssignments === null || relevantAssignments === void 0 ? void 0 : relevantAssignments.map(xa('participantId'))) !== null && _d !== void 0 ? _d : [];
20133
20061
  var participantIds = __spreadArray(__spreadArray([], __read(sideParticipantIds), false), __read(assignedParticipantIds), false);
20134
20062
  var teamParticipants = getParticipants({
20135
20063
  tournamentRecord: tournamentRecord,
@@ -22734,7 +22662,7 @@ function updateTieFormat(_a) {
22734
22662
  if (change.countChange > 0) {
22735
22663
  var collectionPositionOffset = Math.max.apply(Math, __spreadArray([0], __read(matchUp.tieMatchUps
22736
22664
  .filter(function (tieMatchUp) { return tieMatchUp.collectionId === change.collectionId; })
22737
- .map(extractAttributes('collectionPosition'))), false));
22665
+ .map(xa('collectionPosition'))), false));
22738
22666
  var collectionDefinition = tieFormat.collectionDefinitions.find(function (def) { return def.collectionId === change.collectionId; });
22739
22667
  var newMatchUps = generateCollectionMatchUps({
22740
22668
  matchUpsLimit: change.countChange,
@@ -22783,7 +22711,7 @@ function getMatchUpChangesArePossible(_a) {
22783
22711
  var collectionId = _a.collectionId, countChange = _a.countChange;
22784
22712
  var toBePlayedTieMatchUpIds = matchUp.tieMatchUps
22785
22713
  .filter(function (tieMatchUp) { return tieMatchUp.collectionId === collectionId && tieMatchUp.matchUpStatus === TO_BE_PLAYED; })
22786
- .map(extractAttributes('matchUpId'));
22714
+ .map(xa('matchUpId'));
22787
22715
  var possibleToChange = toBePlayedTieMatchUpIds.length + countChange >= 0 || countChange > 0;
22788
22716
  if (!possibleToChange && countChange < 0)
22789
22717
  cannotChangeReaon = 'Insufficient TO_BE_PLAYED matchUps';
@@ -27320,7 +27248,7 @@ function findTournamentId(_a) {
27320
27248
  function createSubOrderMap(_a) {
27321
27249
  var positionAssignments = _a.positionAssignments;
27322
27250
  var subOrderArray = (positionAssignments || [])
27323
- .filter(extractAttributes(PARTICIPANT_ID))
27251
+ .filter(xa(PARTICIPANT_ID))
27324
27252
  .map(function (assignment) {
27325
27253
  var extension = findExtension({
27326
27254
  element: assignment,
@@ -31154,16 +31082,14 @@ function removeStructure(_a) {
31154
31082
  return stage === MAIN && stageSequence === 1;
31155
31083
  });
31156
31084
  var isMainStageSequence1 = structureId === (mainStageSequence1 === null || mainStageSequence1 === void 0 ? void 0 : mainStageSequence1.structureId);
31157
- var qualifyingStructureIds = structures
31158
- .filter(function (_a) {
31085
+ var qualifyingStructureIds = structures.filter(function (_a) {
31159
31086
  var stage = _a.stage;
31160
31087
  return stage === QUALIFYING;
31161
- })
31162
- .map(extractAttributes('structureId'));
31088
+ }).map(xa('structureId'));
31163
31089
  if (isMainStageSequence1 && !qualifyingStructureIds.length) {
31164
31090
  return { error: CANNOT_REMOVE_MAIN_STRUCTURE };
31165
31091
  }
31166
- var structureIds = structures.map(extractAttributes('structureId'));
31092
+ var structureIds = structures.map(xa('structureId'));
31167
31093
  var removedMatchUpIds = [];
31168
31094
  var getTargetedStructureIds = function (structureId) {
31169
31095
  var _a, _b;
@@ -31188,9 +31114,7 @@ function removeStructure(_a) {
31188
31114
  ? getQualifyingSourceStructureIds(id)
31189
31115
  : getTargetedStructureIds(id));
31190
31116
  });
31191
- var idsToRemove = isMainStageSequence1
31192
- ? relatedStructureIdsMap.get(structureId)
31193
- : [structureId];
31117
+ var idsToRemove = isMainStageSequence1 ? relatedStructureIdsMap.get(structureId) : [structureId];
31194
31118
  var _loop_1 = function () {
31195
31119
  var idBeingRemoved = idsToRemove.pop();
31196
31120
  var structure_1 = findStructure({
@@ -31201,10 +31125,7 @@ function removeStructure(_a) {
31201
31125
  var matchUpIds = getMatchUpIds(matchUps_1);
31202
31126
  removedMatchUpIds.push.apply(removedMatchUpIds, __spreadArray([], __read(matchUpIds), false));
31203
31127
  drawDefinition.links =
31204
- (_g = (_f = drawDefinition.links) === null || _f === void 0 ? void 0 : _f.filter(function (link) {
31205
- return link.source.structureId !== idBeingRemoved &&
31206
- link.target.structureId !== idBeingRemoved;
31207
- })) !== null && _g !== void 0 ? _g : [];
31128
+ (_g = (_f = drawDefinition.links) === null || _f === void 0 ? void 0 : _f.filter(function (link) { return link.source.structureId !== idBeingRemoved && link.target.structureId !== idBeingRemoved; })) !== null && _g !== void 0 ? _g : [];
31208
31129
  if (!isMainStageSequence1 ||
31209
31130
  (isMainStageSequence1 && qualifyingStructureIds.length) ||
31210
31131
  idBeingRemoved !== structureId) {
@@ -31217,8 +31138,7 @@ function removeStructure(_a) {
31217
31138
  var targetedStructureIds = idBeingRemoved &&
31218
31139
  ((_j = relatedStructureIdsMap.get(idBeingRemoved)) === null || _j === void 0 ? void 0 : _j.filter(function (id) {
31219
31140
  // IMPORTANT: only delete MAIN stageSequence: 1 if specified to protect against DOUBLE_ELIMINATION scenario
31220
- return id !== (mainStageSequence1 === null || mainStageSequence1 === void 0 ? void 0 : mainStageSequence1.structureId) ||
31221
- structureId === mainStageSequence1.structureId;
31141
+ return id !== (mainStageSequence1 === null || mainStageSequence1 === void 0 ? void 0 : mainStageSequence1.structureId) || structureId === mainStageSequence1.structureId;
31222
31142
  }));
31223
31143
  if (targetedStructureIds === null || targetedStructureIds === void 0 ? void 0 : targetedStructureIds.length)
31224
31144
  idsToRemove.push.apply(idsToRemove, __spreadArray([], __read(targetedStructureIds), false));
@@ -31229,18 +31149,16 @@ function removeStructure(_a) {
31229
31149
  // now get all remaining matchUps in the draw
31230
31150
  var matchUps = getAllDrawMatchUps({ drawDefinition: drawDefinition }).matchUps;
31231
31151
  matchUps === null || matchUps === void 0 ? void 0 : matchUps.forEach(function (matchUp) {
31232
- if (matchUp.winnerMatchUpId &&
31233
- removedMatchUpIds.includes(matchUp.winnerMatchUpId)) {
31152
+ if (matchUp.winnerMatchUpId && removedMatchUpIds.includes(matchUp.winnerMatchUpId)) {
31234
31153
  delete matchUp.winnerMatchUpId;
31235
31154
  }
31236
- if (matchUp.loserMatchUpId &&
31237
- removedMatchUpIds.includes(matchUp.loserMatchUpId)) {
31155
+ if (matchUp.loserMatchUpId && removedMatchUpIds.includes(matchUp.loserMatchUpId)) {
31238
31156
  delete matchUp.loserMatchUpId;
31239
31157
  }
31240
31158
  });
31241
31159
  // if this is MAIN stageSequence: 1 there must be qualifying, return to empty state
31242
31160
  if (isMainStageSequence1) {
31243
- var mainStageSequence1MatchUpIds = (_l = ((_k = mainStageSequence1.matchUps) !== null && _k !== void 0 ? _k : [])) === null || _l === void 0 ? void 0 : _l.map(extractAttributes('matchUpId'));
31161
+ var mainStageSequence1MatchUpIds = (_l = ((_k = mainStageSequence1.matchUps) !== null && _k !== void 0 ? _k : [])) === null || _l === void 0 ? void 0 : _l.map(xa('matchUpId'));
31244
31162
  removedMatchUpIds.push.apply(removedMatchUpIds, __spreadArray([], __read(mainStageSequence1MatchUpIds), false));
31245
31163
  mainStageSequence1.positionAssignments = [];
31246
31164
  mainStageSequence1.seedAssignments = [];
@@ -34354,9 +34272,7 @@ function attachStructures(_a) {
34354
34272
  if (newStructures.length)
34355
34273
  (_b = drawDefinition.structures).push.apply(_b, __spreadArray([], __read(newStructures), false));
34356
34274
  addGoesTo({ drawDefinition: drawDefinition });
34357
- var matchUps = structures
34358
- .map(function (structure) { var _a; return ((_a = getAllStructureMatchUps({ structure: structure })) === null || _a === void 0 ? void 0 : _a.matchUps) || []; })
34359
- .flat();
34275
+ var matchUps = structures.map(function (structure) { var _a; return ((_a = getAllStructureMatchUps({ structure: structure })) === null || _a === void 0 ? void 0 : _a.matchUps) || []; }).flat();
34360
34276
  addMatchUpsNotice({
34361
34277
  tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
34362
34278
  eventId: event === null || event === void 0 ? void 0 : event.eventId,
@@ -34388,13 +34304,8 @@ function attachStructures(_a) {
34388
34304
  Object.assign(matchUp, attribs);
34389
34305
  if (tieMatchUps === null || tieMatchUps === void 0 ? void 0 : tieMatchUps.length) {
34390
34306
  var modifiedTieMatchUpsMap_1 = {};
34391
- tieMatchUps.forEach(function (modifiedTieMatchUp) {
34392
- return (modifiedMatchUpMap_1[modifiedTieMatchUp.matchUpId] =
34393
- modifiedTieMatchUp);
34394
- });
34395
- matchUp.tieMatchUps.forEach(function (tm) {
34396
- return Object.assign(tm, modifiedTieMatchUpsMap_1[tm.matchUpId]);
34397
- });
34307
+ tieMatchUps.forEach(function (modifiedTieMatchUp) { return (modifiedMatchUpMap_1[modifiedTieMatchUp.matchUpId] = modifiedTieMatchUp); });
34308
+ matchUp.tieMatchUps.forEach(function (tm) { return Object.assign(tm, modifiedTieMatchUpsMap_1[tm.matchUpId]); });
34398
34309
  }
34399
34310
  modifiedMatchUpMap_1[matchUp.matchUpId].matchUp = matchUp;
34400
34311
  modifyMatchUpNotice(modifiedMatchUpMap_1[matchUp.matchUpId]);
@@ -34426,7 +34337,7 @@ function attachStructures(_a) {
34426
34337
  }
34427
34338
  });
34428
34339
  }
34429
- var addedStructureIds = newStructures.map(extractAttributes('structureId'));
34340
+ var addedStructureIds = newStructures.map(xa('structureId'));
34430
34341
  if (tournamentRecord) {
34431
34342
  var itemValue = { structureIds: structureIds, drawId: drawDefinition.drawId };
34432
34343
  var timeItem = {
@@ -35721,9 +35632,7 @@ function deleteAdHocMatchUps(_a) {
35721
35632
  return { error: STRUCTURE_NOT_FOUND };
35722
35633
  var existingMatchUps = structure === null || structure === void 0 ? void 0 : structure.matchUps;
35723
35634
  var structureHasRoundPositions = existingMatchUps === null || existingMatchUps === void 0 ? void 0 : existingMatchUps.find(function (matchUp) { return !!matchUp.roundPosition; });
35724
- if (structure.structures ||
35725
- structureHasRoundPositions ||
35726
- structure.finishingPosition === ROUND_OUTCOME) {
35635
+ if (structure.structures || structureHasRoundPositions || structure.finishingPosition === ROUND_OUTCOME) {
35727
35636
  return { error: INVALID_STRUCTURE };
35728
35637
  }
35729
35638
  var matchUpIdsWithScoreValue = [];
@@ -35733,7 +35642,7 @@ function deleteAdHocMatchUps(_a) {
35733
35642
  matchUpIdsWithScoreValue.push(matchUpId);
35734
35643
  return matchUpIds.includes(matchUpId);
35735
35644
  })) !== null && _d !== void 0 ? _d : [];
35736
- var matchUpIdsToDelete = matchUpsToDelete.map(extractAttributes('matchUpId'));
35645
+ var matchUpIdsToDelete = matchUpsToDelete.map(xa('matchUpId'));
35737
35646
  if (matchUpIdsToDelete.length) {
35738
35647
  structure.matchUps = ((_e = structure.matchUps) !== null && _e !== void 0 ? _e : []).filter(function (_a) {
35739
35648
  var matchUpId = _a.matchUpId;
@@ -35746,7 +35655,7 @@ function deleteAdHocMatchUps(_a) {
35746
35655
  eventId: event === null || event === void 0 ? void 0 : event.eventId,
35747
35656
  drawDefinition: drawDefinition,
35748
35657
  });
35749
- var roundNumbers = unique(structure.matchUps.map(extractAttributes('roundNumber')));
35658
+ var roundNumbers = unique(structure.matchUps.map(xa('roundNumber')));
35750
35659
  var missingRoundNumbers = getMissingSequenceNumbers(roundNumbers);
35751
35660
  if (missingRoundNumbers.length) {
35752
35661
  missingRoundNumbers.reverse();
@@ -35897,7 +35806,7 @@ function modifyTieFormat(_a) {
35897
35806
  var collectionId = _a.collectionId;
35898
35807
  return !existingCollectionIds.includes(collectionId);
35899
35808
  });
35900
- var addedCollectionIds = addedCollectionDefinitions.map(extractAttributes('collectionId'));
35809
+ var addedCollectionIds = addedCollectionDefinitions.map(xa('collectionId'));
35901
35810
  var modifications = [];
35902
35811
  var processedTieFormat;
35903
35812
  var tieFormatName = modifiedTieFormat.tieFormatName;
@@ -35987,19 +35896,13 @@ function modifyTieFormat(_a) {
35987
35896
  processedTieFormat.tieFormatName = tieFormatName;
35988
35897
  modifications.push({ tieFormatName: tieFormatName });
35989
35898
  }
35990
- else if (modifications.length ||
35991
- addedCollectionIds.length ||
35992
- removedCollectionIds.length) {
35899
+ else if (modifications.length || addedCollectionIds.length || removedCollectionIds.length) {
35993
35900
  delete processedTieFormat.tieFormatName;
35994
35901
  modifications.push('tieFormatName removed: modifications without new tieFormatName');
35995
35902
  }
35996
- processedTieFormat.collectionDefinitions =
35997
- processedTieFormat.collectionDefinitions
35998
- .sort(function (a, b) {
35999
- return numericSortValue(a.collectionOrder) -
36000
- numericSortValue(b.collectionOrder);
36001
- })
36002
- .map(function (def, i) { return (__assign(__assign({}, def), { collectionOrder: i + 1 })); });
35903
+ processedTieFormat.collectionDefinitions = processedTieFormat.collectionDefinitions
35904
+ .sort(function (a, b) { return numericSortValue(a.collectionOrder) - numericSortValue(b.collectionOrder); })
35905
+ .map(function (def, i) { return (__assign(__assign({}, def), { collectionOrder: i + 1 })); });
36003
35906
  return __assign({ processedTieFormat: copyTieFormat(processedTieFormat), modifications: modifications }, SUCCESS);
36004
35907
  }
36005
35908
 
@@ -37252,7 +37155,7 @@ function getEncounters(_a) {
37252
37155
  try {
37253
37156
  for (var matchUps_1 = __values(matchUps), matchUps_1_1 = matchUps_1.next(); !matchUps_1_1.done; matchUps_1_1 = matchUps_1.next()) {
37254
37157
  var matchUp = matchUps_1_1.value;
37255
- var participantIds = matchUp.sides.map(extractAttributes('participantId'));
37158
+ var participantIds = matchUp.sides.map(xa('participantId'));
37256
37159
  if (participantIds.length === 2) {
37257
37160
  var _c = __read(participantIds, 2), p1 = _c[0], p2 = _c[1];
37258
37161
  var pairing = pairingHash(p1, p2);
@@ -38760,10 +38663,9 @@ function addFlight(_a) {
38760
38663
  return decorateResult({ result: { error: MISSING_VALUE }, stack: stack });
38761
38664
  if (drawEntries === null || drawEntries === void 0 ? void 0 : drawEntries.length) {
38762
38665
  // check that all drawEntries are in event.entries
38763
- var enteredParticipantIds = ((_b = event.entries) !== null && _b !== void 0 ? _b : []).map(extractAttributes('participantId'));
38764
- var flightParticipantIds = drawEntries.map(extractAttributes('participantId'));
38765
- if (intersection(flightParticipantIds, enteredParticipantIds).length !==
38766
- flightParticipantIds.length) {
38666
+ var enteredParticipantIds = ((_b = event.entries) !== null && _b !== void 0 ? _b : []).map(xa('participantId'));
38667
+ var flightParticipantIds = drawEntries.map(xa('participantId'));
38668
+ if (intersection(flightParticipantIds, enteredParticipantIds).length !== flightParticipantIds.length) {
38767
38669
  return decorateResult({ result: { error: INVALID_VALUES }, stack: stack });
38768
38670
  }
38769
38671
  }
@@ -42337,7 +42239,7 @@ function generateDrawDefinition(params) {
42337
42239
  var entryStage = _a.entryStage, entryStatus = _a.entryStatus;
42338
42240
  return (!entryStage || entryStage === MAIN) && entryStatus && STRUCTURE_SELECTED_STATUSES.includes(entryStatus);
42339
42241
  });
42340
- var participantIds_1 = entries_2 === null || entries_2 === void 0 ? void 0 : entries_2.map(extractAttributes('participantId'));
42242
+ var participantIds_1 = entries_2 === null || entries_2 === void 0 ? void 0 : entries_2.map(xa('participantId'));
42341
42243
  var matchUpsCount_1 = entries_2 ? Math.floor(entries_2.length / 2) : 0;
42342
42244
  generateRange(1, params.roundsCount + 1).forEach(function () {
42343
42245
  var _a, _b, _c;
@@ -45467,8 +45369,7 @@ function generateScheduleTimes(_a) {
45467
45369
  if (tournamentRecord && !tournamentRecords) {
45468
45370
  tournamentRecords = (_b = {}, _b[tournamentRecord.tournamentId] = tournamentRecord, _b);
45469
45371
  }
45470
- if (typeof tournamentRecords !== 'object' ||
45471
- !Object.keys(tournamentRecords).length)
45372
+ if (typeof tournamentRecords !== 'object' || !Object.keys(tournamentRecords).length)
45472
45373
  return { error: MISSING_TOURNAMENT_RECORDS };
45473
45374
  periodLength =
45474
45375
  periodLength !== null && periodLength !== void 0 ? periodLength : calculatePeriodLength({
@@ -45481,10 +45382,8 @@ function generateScheduleTimes(_a) {
45481
45382
  tournamentRecords: tournamentRecords,
45482
45383
  }), allCourts = _e.courts, venues = _e.venues;
45483
45384
  var courts = (_c = allCourts === null || allCourts === void 0 ? void 0 : allCourts.filter(function (court) { return !venueIds || venueIds.includes(court.venueId); })) !== null && _c !== void 0 ? _c : [];
45484
- startTime =
45485
- startTime !== null && startTime !== void 0 ? startTime : getDateTimeBoundary({ courts: courts, scheduleDate: scheduleDate, startTime: true });
45486
- endTime =
45487
- endTime !== null && endTime !== void 0 ? endTime : getDateTimeBoundary({ courts: courts, scheduleDate: scheduleDate, endTime: true });
45385
+ startTime = startTime !== null && startTime !== void 0 ? startTime : getDateTimeBoundary({ courts: courts, scheduleDate: scheduleDate, startTime: true });
45386
+ endTime = endTime !== null && endTime !== void 0 ? endTime : getDateTimeBoundary({ courts: courts, scheduleDate: scheduleDate, endTime: true });
45488
45387
  var _f = generateBookings({
45489
45388
  defaultRecoveryMinutes: defaultRecoveryMinutes,
45490
45389
  averageMatchUpMinutes: averageMatchUpMinutes,
@@ -45508,10 +45407,8 @@ function generateScheduleTimes(_a) {
45508
45407
  };
45509
45408
  var scheduleTimes = getScheduleTimes(timingParameters).scheduleTimes;
45510
45409
  // if a single venue specified, or only one venue available, return venueId
45511
- var venueId = ((venueIds === null || venueIds === void 0 ? void 0 : venueIds.length) === 1 && venueIds[0]) ||
45512
- ((venues === null || venues === void 0 ? void 0 : venues.length) === 1 && venues[0].venueId) ||
45513
- undefined;
45514
- var dateScheduledMatchUpIds = dateScheduledMatchUps === null || dateScheduledMatchUps === void 0 ? void 0 : dateScheduledMatchUps.map(extractAttributes('matchUpId'));
45410
+ var venueId = ((venueIds === null || venueIds === void 0 ? void 0 : venueIds.length) === 1 && venueIds[0]) || ((venues === null || venues === void 0 ? void 0 : venues.length) === 1 && venues[0].venueId) || undefined;
45411
+ var dateScheduledMatchUpIds = dateScheduledMatchUps === null || dateScheduledMatchUps === void 0 ? void 0 : dateScheduledMatchUps.map(xa('matchUpId'));
45515
45412
  return {
45516
45413
  dateScheduledMatchUpIds: dateScheduledMatchUpIds,
45517
45414
  dateScheduledMatchUps: dateScheduledMatchUps,
@@ -49331,13 +49228,9 @@ function generateFlightDrawDefinitions(_a) {
49331
49228
  var drawProfile = drawProfiles[index];
49332
49229
  var _k = drawProfile || {}, seedsCount = _k.seedsCount, _l = _k.generate, generate = _l === void 0 ? true : _l;
49333
49230
  if (generate) {
49334
- var drawParticipantIds_1 = drawEntries
49335
- .filter(extractAttributes(PARTICIPANT_ID))
49336
- .map(extractAttributes(PARTICIPANT_ID));
49231
+ var drawParticipantIds_1 = drawEntries.filter(xa(PARTICIPANT_ID)).map(xa(PARTICIPANT_ID));
49337
49232
  var seedingScaleName_1 = categoryName || eventName;
49338
- if (tournamentRecord &&
49339
- seedsCount &&
49340
- seedsCount <= drawParticipantIds_1.length) {
49233
+ if (tournamentRecord && seedsCount && seedsCount <= drawParticipantIds_1.length) {
49341
49234
  var scaleValues = generateRange(1, seedsCount + 1);
49342
49235
  scaleValues.forEach(function (scaleValue, index) {
49343
49236
  var scaleItem = {
@@ -49367,9 +49260,7 @@ function generateFlightDrawDefinitions(_a) {
49367
49260
  if (Array.isArray(drawExtensions)) {
49368
49261
  drawExtensions
49369
49262
  .filter(isValidExtension)
49370
- .forEach(function (extension) {
49371
- return addExtension({ element: drawDefinition_1, extension: extension });
49372
- });
49263
+ .forEach(function (extension) { return addExtension({ element: drawDefinition_1, extension: extension }); });
49373
49264
  }
49374
49265
  result = addDrawDefinition({
49375
49266
  suppressNotifications: true,
@@ -49415,14 +49306,10 @@ function generateFlightDrawDefinitions(_a) {
49415
49306
  });
49416
49307
  if (result_3.error)
49417
49308
  return { value: { error: result_3.error, drawIds: [] } };
49418
- var playoffCompletionGoal = completionGoal
49419
- ? completionGoal - (completedCount !== null && completedCount !== void 0 ? completedCount : 0)
49420
- : undefined;
49309
+ var playoffCompletionGoal = completionGoal ? completionGoal - (completedCount !== null && completedCount !== void 0 ? completedCount : 0) : undefined;
49421
49310
  result_3 = completeDrawMatchUps({
49422
49311
  completeAllMatchUps: !completionGoal && completeAllMatchUps,
49423
- completionGoal: completionGoal
49424
- ? playoffCompletionGoal
49425
- : undefined,
49312
+ completionGoal: completionGoal ? playoffCompletionGoal : undefined,
49426
49313
  matchUpStatusProfile: matchUpStatusProfile,
49427
49314
  randomWinningSide: randomWinningSide,
49428
49315
  tournamentRecord: tournamentRecord,
@@ -49693,7 +49580,7 @@ function generateEventWithFlights(params) {
49693
49580
  drawIds = drawDefinitionResult.drawIds;
49694
49581
  }
49695
49582
  else if ((_d = eventProfile === null || eventProfile === void 0 ? void 0 : eventProfile.participantsProfile) === null || _d === void 0 ? void 0 : _d.participantsCount) {
49696
- var eventParticipantIds = uniqueDrawParticipants.map(extractAttributes('participantId'));
49583
+ var eventParticipantIds = uniqueDrawParticipants.map(xa('participantId'));
49697
49584
  if (eventParticipantIds.length) {
49698
49585
  var result = addEventEntries({
49699
49586
  participantIds: eventParticipantIds,
@@ -51548,7 +51435,7 @@ function mergeParticipants(_a) {
51548
51435
  if (!tournamentRecord.participants)
51549
51436
  tournamentRecord.participants = [];
51550
51437
  var mappedParticipants = incomingParticipants
51551
- .filter(extractAttributes(PARTICIPANT_ID))
51438
+ .filter(xa(PARTICIPANT_ID))
51552
51439
  .map(function (p) {
51553
51440
  var _a;
51554
51441
  return (_a = {}, _a[p.participantId] = p, _a);
@@ -51564,7 +51451,7 @@ function mergeParticipants(_a) {
51564
51451
  }
51565
51452
  return participant;
51566
51453
  });
51567
- var existingParticipantIds = tournamentRecord.participants.map(extractAttributes(PARTICIPANT_ID)) || [];
51454
+ var existingParticipantIds = tournamentRecord.participants.map(xa(PARTICIPANT_ID)) || [];
51568
51455
  var newParticipants = incomingParticipants.filter(function (_a) {
51569
51456
  var participantId = _a.participantId;
51570
51457
  return !existingParticipantIds.includes(participantId);
@@ -51605,7 +51492,7 @@ function addPenalty(params) {
51605
51492
  var participants = (_e = getParticipants({
51606
51493
  tournamentRecord: tournamentRecord_1,
51607
51494
  }).participants) !== null && _e !== void 0 ? _e : [];
51608
- var tournamentParticipantIds = participants === null || participants === void 0 ? void 0 : participants.map(extractAttributes('participantId')).filter(function (participantId) { return participantIds.includes(participantId); });
51495
+ var tournamentParticipantIds = participants === null || participants === void 0 ? void 0 : participants.map(xa('participantId')).filter(function (participantId) { return participantIds.includes(participantId); });
51609
51496
  if (tournamentParticipantIds.length) {
51610
51497
  var result = penaltyAdd(__assign(__assign({}, params), { penaltyId: (_f = params.penaltyId) !== null && _f !== void 0 ? _f : penaltyId, tournamentRecord: tournamentRecord_1, participantIds: tournamentParticipantIds }));
51611
51498
  penaltyId = result.penaltyId;
@@ -51619,8 +51506,7 @@ function addPenalty(params) {
51619
51506
  }
51620
51507
  finally { if (e_1) throw e_1.error; }
51621
51508
  }
51622
- return penaltyId
51623
- ? __assign(__assign({}, SUCCESS), { penaltyId: penaltyId }) : { error: PARTICIPANT_NOT_FOUND };
51509
+ return penaltyId ? __assign(__assign({}, SUCCESS), { penaltyId: penaltyId }) : { error: PARTICIPANT_NOT_FOUND };
51624
51510
  }
51625
51511
  function penaltyAdd(_a) {
51626
51512
  var _b;
@@ -51633,9 +51519,7 @@ function penaltyAdd(_a) {
51633
51519
  return { error: MISSING_PENALTY_TYPE };
51634
51520
  // TODO: add penalty timeItem to matchUp.timeItems[]
51635
51521
  var participants = (_b = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants) !== null && _b !== void 0 ? _b : [];
51636
- var relevantParticipants = participants.filter(function (participant) {
51637
- return participantIds.includes(participant.participantId);
51638
- });
51522
+ var relevantParticipants = participants.filter(function (participant) { return participantIds.includes(participant.participantId); });
51639
51523
  if (!relevantParticipants.length)
51640
51524
  return { error: PARTICIPANT_NOT_FOUND };
51641
51525
  var createdAt = new Date().toISOString();
@@ -51649,9 +51533,7 @@ function penaltyAdd(_a) {
51649
51533
  createdAt: createdAt,
51650
51534
  });
51651
51535
  if (Array.isArray(extensions)) {
51652
- extensions.forEach(function (extension) {
51653
- return addExtension({ element: penaltyItem, extension: extension });
51654
- });
51536
+ extensions.forEach(function (extension) { return addExtension({ element: penaltyItem, extension: extension }); });
51655
51537
  }
51656
51538
  relevantParticipants.forEach(function (participant) {
51657
51539
  if (!participant.penalties)
@@ -54045,11 +53927,7 @@ function getValidLuckyLosersAction(_a) {
54045
53927
  drawPosition: drawPosition,
54046
53928
  matchUps: matchUps,
54047
53929
  }).initialRoundNumber;
54048
- var relevantLink_1 = (_g = drawDefinition.links) === null || _g === void 0 ? void 0 : _g.find(function (link) {
54049
- var _a;
54050
- return ((_a = link.target) === null || _a === void 0 ? void 0 : _a.structureId) === (structure === null || structure === void 0 ? void 0 : structure.structureId) &&
54051
- link.target.roundNumber === initialRoundNumber_1;
54052
- });
53930
+ var relevantLink_1 = (_g = drawDefinition.links) === null || _g === void 0 ? void 0 : _g.find(function (link) { var _a; return ((_a = link.target) === null || _a === void 0 ? void 0 : _a.structureId) === (structure === null || structure === void 0 ? void 0 : structure.structureId) && link.target.roundNumber === initialRoundNumber_1; });
54053
53931
  var sourceRoundNumber = (_h = relevantLink_1 === null || relevantLink_1 === void 0 ? void 0 : relevantLink_1.source) === null || _h === void 0 ? void 0 : _h.roundNumber;
54054
53932
  matchUpFilters.roundNumbers = [sourceRoundNumber];
54055
53933
  }
@@ -54059,18 +53937,14 @@ function getValidLuckyLosersAction(_a) {
54059
53937
  matchUpFilters: matchUpFilters,
54060
53938
  drawDefinition: drawDefinition,
54061
53939
  }).completedMatchUps;
54062
- var assignedParticipantIds = positionAssignments
54063
- .map(function (assignment) { return assignment.participantId; })
54064
- .filter(Boolean);
53940
+ var assignedParticipantIds = positionAssignments.map(function (assignment) { return assignment.participantId; }).filter(Boolean);
54065
53941
  var availableParticipantIds = completedMatchUps === null || completedMatchUps === void 0 ? void 0 : completedMatchUps.filter(function (_a) {
54066
53942
  var matchUpType = _a.matchUpType, winningSide = _a.winningSide;
54067
53943
  return winningSide && ((event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$2 || matchUpType === TEAM$2);
54068
53944
  }).map(function (_a) {
54069
53945
  var winningSide = _a.winningSide, sides = _a.sides;
54070
53946
  return winningSide && (sides === null || sides === void 0 ? void 0 : sides[1 - (winningSide - 1)]);
54071
- }).map(extractAttributes('participantId')).filter(function (participantId) {
54072
- return participantId && !assignedParticipantIds.includes(participantId);
54073
- });
53947
+ }).map(xa('participantId')).filter(function (participantId) { return participantId && !assignedParticipantIds.includes(participantId); });
54074
53948
  availableParticipantIds === null || availableParticipantIds === void 0 ? void 0 : availableParticipantIds.forEach(function (participantId) {
54075
53949
  // ensure if 'restrictBySourceRound' is false and there are multiple links that participants aren't added multiple times
54076
53950
  if (!availableLuckyLoserParticipantIds.includes(participantId))
@@ -54090,9 +53964,7 @@ function getValidLuckyLosersAction(_a) {
54090
53964
  }
54091
53965
  finally { if (e_1) throw e_1.error; }
54092
53966
  }
54093
- var availableLuckyLosers = tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.filter(function (participant) {
54094
- return availableLuckyLoserParticipantIds === null || availableLuckyLoserParticipantIds === void 0 ? void 0 : availableLuckyLoserParticipantIds.includes(participant.participantId);
54095
- });
53967
+ var availableLuckyLosers = tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.filter(function (participant) { return availableLuckyLoserParticipantIds === null || availableLuckyLoserParticipantIds === void 0 ? void 0 : availableLuckyLoserParticipantIds.includes(participant.participantId); });
54096
53968
  availableLuckyLosers === null || availableLuckyLosers === void 0 ? void 0 : availableLuckyLosers.forEach(function (luckyLoser) {
54097
53969
  var _a;
54098
53970
  var entry = ((_a = drawDefinition.entries) !== null && _a !== void 0 ? _a : []).find(function (entry) { return entry.participantId === luckyLoser.participantId; });
@@ -54248,9 +54120,7 @@ function getValidAssignmentActions(_a) {
54248
54120
  // if there are no unfilledPositions for available seeds then return all unfilled positions
54249
54121
  if (!(unfilledPositions === null || unfilledPositions === void 0 ? void 0 : unfilledPositions.length)) {
54250
54122
  unfilledPositions = positionAssignments
54251
- .filter(function (assignment) {
54252
- return !assignment.participantId && !assignment.bye && !assignment.qualifier;
54253
- })
54123
+ .filter(function (assignment) { return !assignment.participantId && !assignment.bye && !assignment.qualifier; })
54254
54124
  .map(function (assignment) { return assignment.drawPosition; });
54255
54125
  }
54256
54126
  if (!isByePosition) {
@@ -54262,9 +54132,7 @@ function getValidAssignmentActions(_a) {
54262
54132
  });
54263
54133
  }
54264
54134
  if (isWinRatioFedStructure && ignoreSeedPositions) {
54265
- var assignedParticipantIds_1 = positionAssignments
54266
- .map(function (assignment) { return assignment.participantId; })
54267
- .filter(Boolean);
54135
+ var assignedParticipantIds_1 = positionAssignments.map(function (assignment) { return assignment.participantId; }).filter(Boolean);
54268
54136
  var matchUpFilters = { structureIds: positionSourceStructureIds };
54269
54137
  var completedMatchUps = getDrawMatchUps({
54270
54138
  inContext: true,
@@ -54278,14 +54146,10 @@ function getValidAssignmentActions(_a) {
54278
54146
  return (event === null || event === void 0 ? void 0 : event.eventType) !== TEAM$2 || matchUpType === TEAM$2;
54279
54147
  })) === null || _d === void 0 ? void 0 : _d.map(function (_a) {
54280
54148
  var sides = _a.sides;
54281
- return sides === null || sides === void 0 ? void 0 : sides.map(extractAttributes('participantId'));
54282
- }).flat().filter(function (participantId) {
54283
- return participantId && !assignedParticipantIds_1.includes(participantId);
54284
- }));
54149
+ return sides === null || sides === void 0 ? void 0 : sides.map(xa('participantId'));
54150
+ }).flat().filter(function (participantId) { return participantId && !assignedParticipantIds_1.includes(participantId); }));
54285
54151
  var participantsAvailable = returnParticipants
54286
- ? tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.filter(function (participant) {
54287
- return availableParticipantIds_1 === null || availableParticipantIds_1 === void 0 ? void 0 : availableParticipantIds_1.includes(participant.participantId);
54288
- }).map(function (participant) { return makeDeepCopy(participant, undefined, true); })
54152
+ ? tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.filter(function (participant) { return availableParticipantIds_1 === null || availableParticipantIds_1 === void 0 ? void 0 : availableParticipantIds_1.includes(participant.participantId); }).map(function (participant) { return makeDeepCopy(participant, undefined, true); })
54289
54153
  : undefined;
54290
54154
  participantsAvailable === null || participantsAvailable === void 0 ? void 0 : participantsAvailable.forEach(function (participant) {
54291
54155
  var _a;
@@ -54309,9 +54173,7 @@ function getValidAssignmentActions(_a) {
54309
54173
  var availableParticipantIds_2;
54310
54174
  if (unplacedSeedAssignments === null || unplacedSeedAssignments === void 0 ? void 0 : unplacedSeedAssignments.length) {
54311
54175
  // return any valid seedAssignments
54312
- var validToAssign = unplacedSeedAssignments.filter(function (seedAssignment) {
54313
- return unplacedSeedParticipantIds === null || unplacedSeedParticipantIds === void 0 ? void 0 : unplacedSeedParticipantIds.includes(seedAssignment.participantId);
54314
- });
54176
+ var validToAssign = unplacedSeedAssignments.filter(function (seedAssignment) { return unplacedSeedParticipantIds === null || unplacedSeedParticipantIds === void 0 ? void 0 : unplacedSeedParticipantIds.includes(seedAssignment.participantId); });
54315
54177
  validToAssign.sort(validAssignmentsSort);
54316
54178
  availableParticipantIds_2 = validToAssign.map(function (assignment) { return assignment.participantId; });
54317
54179
  }
@@ -54321,9 +54183,7 @@ function getValidAssignmentActions(_a) {
54321
54183
  }
54322
54184
  // add structureId and drawPosition to the payload so the client doesn't need to discover
54323
54185
  var participantsAvailable = returnParticipants
54324
- ? tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.filter(function (participant) {
54325
- return availableParticipantIds_2.includes(participant.participantId);
54326
- }).map(function (participant) { return makeDeepCopy(participant, undefined, true); })
54186
+ ? tournamentParticipants === null || tournamentParticipants === void 0 ? void 0 : tournamentParticipants.filter(function (participant) { return availableParticipantIds_2.includes(participant.participantId); }).map(function (participant) { return makeDeepCopy(participant, undefined, true); })
54327
54187
  : undefined;
54328
54188
  if (participantsAvailable === null || participantsAvailable === void 0 ? void 0 : participantsAvailable.length) {
54329
54189
  validAssignmentActions.push(definedAttributes({
@@ -54341,8 +54201,7 @@ function getValidAssignmentActions(_a) {
54341
54201
  function validAssignmentsSort(a, b) {
54342
54202
  if (a.bye)
54343
54203
  return -1;
54344
- if (getNumericSeedValue(a.seedValue) < getNumericSeedValue(b.seedValue) ||
54345
- (a.seedValue && !b.seedValue))
54204
+ if (getNumericSeedValue(a.seedValue) < getNumericSeedValue(b.seedValue) || (a.seedValue && !b.seedValue))
54346
54205
  return -1;
54347
54206
  return (a.seedNumber || 0) - (b.seedNumber || 0);
54348
54207
  }
@@ -56908,7 +56767,7 @@ function getEvents(_a) {
56908
56767
  })
56909
56768
  .map(function (event) {
56910
56769
  var _a;
56911
- var eventDrawIds = (_a = event.drawDefinitions) === null || _a === void 0 ? void 0 : _a.map(extractAttributes('drawId'));
56770
+ var eventDrawIds = (_a = event.drawDefinitions) === null || _a === void 0 ? void 0 : _a.map(xa('drawId'));
56912
56771
  if ((drawIds === null || drawIds === void 0 ? void 0 : drawIds.length) && !intersection(drawIds, eventDrawIds).length)
56913
56772
  return;
56914
56773
  var eventCopy = makeDeepCopy(event);
@@ -56925,9 +56784,7 @@ function getEvents(_a) {
56925
56784
  withScaleValues: true,
56926
56785
  tournamentRecord: tournamentRecord,
56927
56786
  }).participantMap;
56928
- var sum = function (values) {
56929
- return values.reduce(function (total, value) { return total + parseFloat(value); }, 0);
56930
- };
56787
+ var sum = function (values) { return values.reduce(function (total, value) { return total + parseFloat(value); }, 0); };
56931
56788
  var _loop_1 = function (event_1) {
56932
56789
  var e_2, _o, e_3, _p, e_4, _q, e_5, _r, e_6, _s, e_7, _t, e_8, _u;
56933
56790
  var eventType = scaleEventType !== null && scaleEventType !== void 0 ? scaleEventType : event_1.eventType;
@@ -56943,7 +56800,7 @@ function getEvents(_a) {
56943
56800
  var entryStatus = _a.entryStatus;
56944
56801
  return STRUCTURE_SELECTED_STATUSES.includes(entryStatus);
56945
56802
  });
56946
- var participantIds = selectedEntries.map(extractAttributes(PARTICIPANT_ID));
56803
+ var participantIds = selectedEntries.map(xa(PARTICIPANT_ID));
56947
56804
  var processParticipant = function (participant) {
56948
56805
  var e_9, _a, e_10, _b;
56949
56806
  var _c, _d, _e, _f, _g, _h, _j, _k;
@@ -57052,8 +56909,7 @@ function getEvents(_a) {
57052
56909
  var processParticipant = function (participant) {
57053
56910
  var e_13, _a, e_14, _b;
57054
56911
  var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
57055
- if (((_c = eventsMap[eventId].draws) === null || _c === void 0 ? void 0 : _c[drawId]) &&
57056
- ((_d = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _d === void 0 ? void 0 : _d[eventType])) {
56912
+ if (((_c = eventsMap[eventId].draws) === null || _c === void 0 ? void 0 : _c[drawId]) && ((_d = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _d === void 0 ? void 0 : _d[eventType])) {
57057
56913
  try {
57058
56914
  for (var _q = (e_13 = void 0, __values((_f = (_e = participant === null || participant === void 0 ? void 0 : participant.ratings) === null || _e === void 0 ? void 0 : _e[eventType]) !== null && _f !== void 0 ? _f : [])), _r = _q.next(); !_r.done; _r = _q.next()) {
57059
56915
  var rating = _r.value;
@@ -57077,8 +56933,7 @@ function getEvents(_a) {
57077
56933
  finally { if (e_13) throw e_13.error; }
57078
56934
  }
57079
56935
  }
57080
- if (((_k = eventsMap[eventId].draws) === null || _k === void 0 ? void 0 : _k[drawId]) &&
57081
- ((_l = participant === null || participant === void 0 ? void 0 : participant.rankings) === null || _l === void 0 ? void 0 : _l[eventType])) {
56936
+ if (((_k = eventsMap[eventId].draws) === null || _k === void 0 ? void 0 : _k[drawId]) && ((_l = participant === null || participant === void 0 ? void 0 : participant.rankings) === null || _l === void 0 ? void 0 : _l[eventType])) {
57082
56937
  try {
57083
56938
  for (var _s = (e_14 = void 0, __values((_o = (_m = participant === null || participant === void 0 ? void 0 : participant.rankings) === null || _m === void 0 ? void 0 : _m[eventType]) !== null && _o !== void 0 ? _o : [])), _t = _s.next(); !_t.done; _t = _s.next()) {
57084
56939
  var ranking = _t.value;
@@ -57135,8 +56990,7 @@ function getEvents(_a) {
57135
56990
  };
57136
56991
  var processedDrawIds = [];
57137
56992
  var ignoreDrawId = function (drawId) {
57138
- return ((drawIds === null || drawIds === void 0 ? void 0 : drawIds.length) && drawIds.includes(drawId)) ||
57139
- processedDrawIds.includes(drawId);
56993
+ return ((drawIds === null || drawIds === void 0 ? void 0 : drawIds.length) && drawIds.includes(drawId)) || processedDrawIds.includes(drawId);
57140
56994
  };
57141
56995
  try {
57142
56996
  for (var _z = (e_5 = void 0, __values((_j = event_1.drawDefinitions) !== null && _j !== void 0 ? _j : [])), _0 = _z.next(); !_0.done; _0 = _z.next()) {
@@ -57171,7 +57025,7 @@ function getEvents(_a) {
57171
57025
  var drawId = flight.drawId;
57172
57026
  if (ignoreDrawId(drawId))
57173
57027
  continue;
57174
- var participantIds_3 = flight.drawEntries.map(extractAttributes(PARTICIPANT_ID));
57028
+ var participantIds_3 = flight.drawEntries.map(xa(PARTICIPANT_ID));
57175
57029
  processFlight(drawId, participantIds_3);
57176
57030
  }
57177
57031
  }
@@ -57610,8 +57464,7 @@ function getParticipantStats(_a) {
57610
57464
  if (matchUps && !Array.isArray(matchUps))
57611
57465
  return { error: INVALID_MATCHUP };
57612
57466
  var participantsProfile = withScaleValues ? { withScaleValues: withScaleValues } : undefined;
57613
- matchUps =
57614
- matchUps !== null && matchUps !== void 0 ? matchUps : allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
57467
+ matchUps = matchUps !== null && matchUps !== void 0 ? matchUps : allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
57615
57468
  if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length))
57616
57469
  return { error: MISSING_MATCHUPS };
57617
57470
  var teamParticipantIds = [];
@@ -57630,7 +57483,7 @@ function getParticipantStats(_a) {
57630
57483
  return { error: INVALID_PARTICIPANT_IDS };
57631
57484
  }
57632
57485
  if (!teamParticipantIds.length)
57633
- teamParticipantIds.push.apply(teamParticipantIds, __spreadArray([], __read(teamParticipants.map(extractAttributes('participantId'))), false));
57486
+ teamParticipantIds.push.apply(teamParticipantIds, __spreadArray([], __read(teamParticipants.map(xa('participantId'))), false));
57634
57487
  var participantDetails = new Map();
57635
57488
  var participantStats = new Map();
57636
57489
  var participating = new Map();
@@ -57707,13 +57560,13 @@ function getParticipantStats(_a) {
57707
57560
  var _b, _c, _d, _e, _f;
57708
57561
  var side = _a.side, individualParticipantIds = _a.individualParticipantIds;
57709
57562
  return ((side.participantId &&
57710
- (!(individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.length) ||
57711
- individualParticipantIds.includes(side.participantId)) && [
57563
+ (!(individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.length) || individualParticipantIds.includes(side.participantId)) && [
57712
57564
  side.participantId,
57713
57565
  ]) ||
57714
57566
  (((_c = (_b = side.participant) === null || _b === void 0 ? void 0 : _b.individualParticipantIds) === null || _c === void 0 ? void 0 : _c.length) &&
57715
57567
  (!(individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.length) ||
57716
- intersection(individualParticipantIds, (_d = side.participant) === null || _d === void 0 ? void 0 : _d.individualParticipantIds).length === ((_f = (_e = side.participant) === null || _e === void 0 ? void 0 : _e.individualParticipantIds) === null || _f === void 0 ? void 0 : _f.length)) &&
57568
+ intersection(individualParticipantIds, (_d = side.participant) === null || _d === void 0 ? void 0 : _d.individualParticipantIds).length ===
57569
+ ((_f = (_e = side.participant) === null || _e === void 0 ? void 0 : _e.individualParticipantIds) === null || _f === void 0 ? void 0 : _f.length)) &&
57717
57570
  side.participant.individualParticipantIds));
57718
57571
  };
57719
57572
  if (teamMap.size) {
@@ -57826,17 +57679,12 @@ function getParticipantStats(_a) {
57826
57679
  if (!isObject(matchUp))
57827
57680
  return { value: { error: INVALID_MATCHUP } };
57828
57681
  var matchUpStatus = matchUp.matchUpStatus, matchUpFormat = matchUp.matchUpFormat, matchUpType = matchUp.matchUpType, winningSide = matchUp.winningSide, score = matchUp.score, sides = matchUp.sides;
57829
- if (!sides ||
57830
- !score ||
57831
- matchUpType === TEAM_MATCHUP ||
57832
- matchUpStatus === BYE)
57682
+ if (!sides || !score || matchUpType === TEAM_MATCHUP || matchUpStatus === BYE)
57833
57683
  return "continue";
57834
57684
  var sideParticipantIds = getSideParticipantIds(sides);
57835
57685
  if (!sideParticipantIds.filter(Boolean).length)
57836
57686
  return "continue";
57837
- var competitiveness = withCompetitiveProfiles &&
57838
- winningSide &&
57839
- ((_k = getMatchUpCompetitiveProfile({ matchUp: matchUp })) === null || _k === void 0 ? void 0 : _k.competitiveness);
57687
+ var competitiveness = withCompetitiveProfiles && winningSide && ((_k = getMatchUpCompetitiveProfile({ matchUp: matchUp })) === null || _k === void 0 ? void 0 : _k.competitiveness);
57840
57688
  relevantMatchUps.push(matchUp);
57841
57689
  var setsTally = countSets({
57842
57690
  matchUpStatus: matchUpStatus,
@@ -57863,12 +57711,8 @@ function getParticipantStats(_a) {
57863
57711
  var participantName = (_b = participantDetails.get(id)) === null || _b === void 0 ? void 0 : _b.participantName;
57864
57712
  var stats = initStats(id, participantName);
57865
57713
  if (stats) {
57866
- var teamSumTally = function (stat, tally) {
57867
- return tally.forEach(function (t, i) { return (stats[stat][i] += t); });
57868
- };
57869
- var tiebreaks = index
57870
- ? __spreadArray([], __read(tiebreaksTally), false).reverse()
57871
- : tiebreaksTally;
57714
+ var teamSumTally = function (stat, tally) { return tally.forEach(function (t, i) { return (stats[stat][i] += t); }); };
57715
+ var tiebreaks = index ? __spreadArray([], __read(tiebreaksTally), false).reverse() : tiebreaksTally;
57872
57716
  var points = index ? __spreadArray([], __read(pointsTally), false).reverse() : pointsTally;
57873
57717
  var games = index ? __spreadArray([], __read(gamesTally), false).reverse() : gamesTally;
57874
57718
  var sets = index ? __spreadArray([], __read(setsTally), false).reverse() : setsTally;
@@ -57993,8 +57837,7 @@ function getParticipantStats(_a) {
57993
57837
  // now rank each team by their ratio on each attribute
57994
57838
  var accessor = "".concat(attr, "Ratio");
57995
57839
  if (typeof stats[accessor] === 'number') {
57996
- var index = (_p = ratio
57997
- .get(accessor)) === null || _p === void 0 ? void 0 : _p.sort(highLowSort).indexOf(stats[accessor]);
57840
+ var index = (_p = ratio.get(accessor)) === null || _p === void 0 ? void 0 : _p.sort(highLowSort).indexOf(stats[accessor]);
57998
57841
  if (typeof index === 'number' && index >= 0) {
57999
57842
  var rankAccessor = "".concat(attr, "Rank");
58000
57843
  stats[rankAccessor] = index + 1;