tods-competition-factory 1.6.27 → 1.6.28

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.
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
362
362
  };
363
363
 
364
364
  function factoryVersion() {
365
- return '1.6.27';
365
+ return '1.6.28';
366
366
  }
367
367
 
368
368
  /******************************************************************************
@@ -62179,16 +62179,21 @@ function prepareStage(params) {
62179
62179
 
62180
62180
  function generateDrawDefinition(params) {
62181
62181
  var e_1, _a, e_2, _b, e_3, _c, e_4, _d, _e, e_5, _f, e_6, _g, _h;
62182
- var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15;
62182
+ var _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21;
62183
62183
  var stack = 'generateDrawDefinition';
62184
- var _16 = params.drawType, drawType = _16 === void 0 ? DrawTypeEnum.SingleElimination : _16, _17 = params.considerEventEntries, considerEventEntries = _17 === void 0 ? true : _17, // in the absence of drawSize and drawEntries, look to event.entries
62185
- ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, policyDefinitions = params.policyDefinitions, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, enforceGender = params.enforceGender, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, addToEvent = params.addToEvent, placeByes = params.placeByes, event = params.event;
62184
+ var _22 = params.drawType, drawType = _22 === void 0 ? DrawTypeEnum.SingleElimination : _22, _23 = params.considerEventEntries, considerEventEntries = _23 === void 0 ? true : _23, // in the absence of drawSize and drawEntries, look to event.entries
62185
+ ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, policyDefinitions = params.policyDefinitions, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, addToEvent = params.addToEvent, placeByes = params.placeByes, event = params.event;
62186
62186
  // get participants both for entry validation and for automated placement
62187
62187
  // automated placement requires them to be "inContext" for avoidance policies to work
62188
62188
  var participants = getTournamentParticipants({
62189
62189
  tournamentRecord: tournamentRecord,
62190
62190
  inContext: true,
62191
62191
  }).tournamentParticipants;
62192
+ var appliedPolicies = (_j = getAppliedPolicies({
62193
+ tournamentRecord: tournamentRecord,
62194
+ event: event,
62195
+ }).appliedPolicies) !== null && _j !== void 0 ? _j : {};
62196
+ var enforceGender = (_o = (_k = params.enforceGender) !== null && _k !== void 0 ? _k : (_m = (_l = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _l === void 0 ? void 0 : _l.participants) === null || _m === void 0 ? void 0 : _m.enforceGender) !== null && _o !== void 0 ? _o : (_q = (_p = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _p === void 0 ? void 0 : _p.participants) === null || _q === void 0 ? void 0 : _q.enforceGender;
62192
62197
  // entries participantTypes must correspond with eventType
62193
62198
  // this is only possible if the event is provided
62194
62199
  var validEntriesResult = event &&
@@ -62202,16 +62207,16 @@ function generateDrawDefinition(params) {
62202
62207
  tournamentRecord &&
62203
62208
  getAllowedDrawTypes({
62204
62209
  tournamentRecord: tournamentRecord,
62205
- categoryType: (_j = event === null || event === void 0 ? void 0 : event.category) === null || _j === void 0 ? void 0 : _j.categoryType,
62206
- categoryName: (_k = event === null || event === void 0 ? void 0 : event.category) === null || _k === void 0 ? void 0 : _k.categoryName,
62210
+ categoryType: (_r = event === null || event === void 0 ? void 0 : event.category) === null || _r === void 0 ? void 0 : _r.categoryType,
62211
+ categoryName: (_s = event === null || event === void 0 ? void 0 : event.category) === null || _s === void 0 ? void 0 : _s.categoryName,
62207
62212
  });
62208
62213
  if ((allowedDrawTypes === null || allowedDrawTypes === void 0 ? void 0 : allowedDrawTypes.length) && !allowedDrawTypes.includes(drawType)) {
62209
62214
  return decorateResult({ result: { error: INVALID_DRAW_TYPE }, stack: stack });
62210
62215
  }
62211
- var eventEntries = (_m = (_l = event === null || event === void 0 ? void 0 : event.entries) === null || _l === void 0 ? void 0 : _l.filter(function (entry) {
62216
+ var eventEntries = (_u = (_t = event === null || event === void 0 ? void 0 : event.entries) === null || _t === void 0 ? void 0 : _t.filter(function (entry) {
62212
62217
  return entry.entryStatus &&
62213
62218
  __spreadArray(__spreadArray([], __read(STRUCTURE_ENTERED_TYPES), false), [QUALIFIER], false).includes(entry.entryStatus);
62214
- })) !== null && _m !== void 0 ? _m : [];
62219
+ })) !== null && _u !== void 0 ? _u : [];
62215
62220
  var consideredEntries = ((qualifyingOnly && []) ||
62216
62221
  drawEntries ||
62217
62222
  (considerEventEntries ? eventEntries : [])).filter(function (_a) {
@@ -62241,12 +62246,12 @@ function generateDrawDefinition(params) {
62241
62246
  });
62242
62247
  }
62243
62248
  var seedsCount = typeof params.seedsCount !== 'number'
62244
- ? ensureInt((_o = params.seedsCount) !== null && _o !== void 0 ? _o : 0)
62245
- : (_p = params.seedsCount) !== null && _p !== void 0 ? _p : 0;
62249
+ ? ensureInt((_v = params.seedsCount) !== null && _v !== void 0 ? _v : 0)
62250
+ : (_w = params.seedsCount) !== null && _w !== void 0 ? _w : 0;
62246
62251
  var eventType = event === null || event === void 0 ? void 0 : event.eventType;
62247
- var matchUpType = (_q = params.matchUpType) !== null && _q !== void 0 ? _q : eventType;
62252
+ var matchUpType = (_x = params.matchUpType) !== null && _x !== void 0 ? _x : eventType;
62248
62253
  var existingDrawDefinition = params.drawId
62249
- ? (_r = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _r === void 0 ? void 0 : _r.find(function (d) { return d.drawId === params.drawId; })
62254
+ ? (_y = event === null || event === void 0 ? void 0 : event.drawDefinitions) === null || _y === void 0 ? void 0 : _y.find(function (d) { return d.drawId === params.drawId; })
62250
62255
  : undefined;
62251
62256
  // drawDefinition cannot have both tieFormat and matchUpFormat
62252
62257
  var tieFormat = params.tieFormat, matchUpFormat = params.matchUpFormat;
@@ -62254,16 +62259,16 @@ function generateDrawDefinition(params) {
62254
62259
  if (matchUpType === TEAM$2 && eventType === TEAM$2) {
62255
62260
  // if there is an existingDrawDefinition which has a tieFormat on MAIN structure
62256
62261
  // use this tieFormat ONLY when no tieFormat is specified in params
62257
- var existingMainTieFormat = (_t = (_s = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _s === void 0 ? void 0 : _s.find(function (_a) {
62262
+ var existingMainTieFormat = (_0 = (_z = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _z === void 0 ? void 0 : _z.find(function (_a) {
62258
62263
  var stage = _a.stage;
62259
62264
  return stage === MAIN;
62260
- })) === null || _t === void 0 ? void 0 : _t.tieFormat;
62265
+ })) === null || _0 === void 0 ? void 0 : _0.tieFormat;
62261
62266
  tieFormat =
62262
62267
  tieFormat ||
62263
62268
  existingMainTieFormat ||
62264
62269
  // if tieFormatName is provided and it matches the name of the tieFormat attached to parent event...
62265
62270
  (tieFormatName &&
62266
- ((_u = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _u === void 0 ? void 0 : _u.tieFormatName) === tieFormatName &&
62271
+ ((_1 = event === null || event === void 0 ? void 0 : event.tieFormat) === null || _1 === void 0 ? void 0 : _1.tieFormatName) === tieFormatName &&
62267
62272
  event.tieFormat) ||
62268
62273
  // if the tieFormatName is not found in the factory then will use default
62269
62274
  (tieFormatName &&
@@ -62315,7 +62320,7 @@ function generateDrawDefinition(params) {
62315
62320
  var result = checkTieFormat(tieFormat);
62316
62321
  if (result.error)
62317
62322
  return decorateResult({ result: result, stack: stack });
62318
- drawDefinition.tieFormat = (_v = result.tieFormat) !== null && _v !== void 0 ? _v : tieFormat;
62323
+ drawDefinition.tieFormat = (_2 = result.tieFormat) !== null && _2 !== void 0 ? _2 : tieFormat;
62319
62324
  }
62320
62325
  else if (matchUpFormat) {
62321
62326
  var result = setMatchUpFormat$1({
@@ -62335,10 +62340,6 @@ function generateDrawDefinition(params) {
62335
62340
  drawDefinition.matchUpType = matchUpType;
62336
62341
  }
62337
62342
  }
62338
- var appliedPolicies = (_w = getAppliedPolicies({
62339
- tournamentRecord: tournamentRecord,
62340
- event: event,
62341
- }).appliedPolicies) !== null && _w !== void 0 ? _w : {};
62342
62343
  if (policyDefinitions) {
62343
62344
  if (typeof policyDefinitions !== 'object') {
62344
62345
  return decorateResult({
@@ -62352,8 +62353,8 @@ function generateDrawDefinition(params) {
62352
62353
  else {
62353
62354
  var policiesToAttach = {};
62354
62355
  try {
62355
- for (var _18 = __values(Object.keys(policyDefinitions)), _19 = _18.next(); !_19.done; _19 = _18.next()) {
62356
- var key = _19.value;
62356
+ for (var _24 = __values(Object.keys(policyDefinitions)), _25 = _24.next(); !_25.done; _25 = _24.next()) {
62357
+ var key = _25.value;
62357
62358
  if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !==
62358
62359
  JSON.stringify(policyDefinitions[key])) {
62359
62360
  policiesToAttach[key] = policyDefinitions[key];
@@ -62363,7 +62364,7 @@ function generateDrawDefinition(params) {
62363
62364
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
62364
62365
  finally {
62365
62366
  try {
62366
- if (_19 && !_19.done && (_a = _18.return)) _a.call(_18);
62367
+ if (_25 && !_25.done && (_a = _24.return)) _a.call(_24);
62367
62368
  }
62368
62369
  finally { if (e_1) throw e_1.error; }
62369
62370
  }
@@ -62379,19 +62380,19 @@ function generateDrawDefinition(params) {
62379
62380
  Object.assign(appliedPolicies, POLICY_SEEDING_USTA);
62380
62381
  }
62381
62382
  // find existing MAIN structureId if existingDrawDefinition
62382
- var structureId = (_y = (_x = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _x === void 0 ? void 0 : _x.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _y === void 0 ? void 0 : _y.structureId;
62383
+ var structureId = (_4 = (_3 = existingDrawDefinition === null || existingDrawDefinition === void 0 ? void 0 : existingDrawDefinition.structures) === null || _3 === void 0 ? void 0 : _3.find(function (structure) { return structure.stage === MAIN && structure.stageSequence === 1; })) === null || _4 === void 0 ? void 0 : _4.structureId;
62383
62384
  var entries = drawEntries !== null && drawEntries !== void 0 ? drawEntries : eventEntries;
62384
62385
  var positioningReports = [];
62385
62386
  var drawTypeResult;
62386
62387
  var conflicts = [];
62387
62388
  var generateQualifyingPlaceholder = params.qualifyingPlaceholder &&
62388
- !((_z = params.qualifyingProfiles) === null || _z === void 0 ? void 0 : _z.length) &&
62389
+ !((_5 = params.qualifyingProfiles) === null || _5 === void 0 ? void 0 : _5.length) &&
62389
62390
  !existingDrawDefinition;
62390
62391
  var existingQualifyingStructures = existingDrawDefinition
62391
- ? (_0 = existingDrawDefinition.structures) === null || _0 === void 0 ? void 0 : _0.filter(function (structure) { return structure.stage === QUALIFYING; })
62392
+ ? (_6 = existingDrawDefinition.structures) === null || _6 === void 0 ? void 0 : _6.filter(function (structure) { return structure.stage === QUALIFYING; })
62392
62393
  : [];
62393
62394
  var existingQualifyingPlaceholderStructureId = (existingQualifyingStructures === null || existingQualifyingStructures === void 0 ? void 0 : existingQualifyingStructures.length) === 1 &&
62394
- !((_1 = existingQualifyingStructures[0].matchUps) === null || _1 === void 0 ? void 0 : _1.length) &&
62395
+ !((_7 = existingQualifyingStructures[0].matchUps) === null || _7 === void 0 ? void 0 : _7.length) &&
62395
62396
  existingQualifyingStructures[0].structureId;
62396
62397
  if (existingQualifyingPlaceholderStructureId) {
62397
62398
  var qualifyingProfiles = params.qualifyingProfiles;
@@ -62407,24 +62408,24 @@ function generateDrawDefinition(params) {
62407
62408
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.error) {
62408
62409
  return qualifyingResult;
62409
62410
  }
62410
- drawDefinition.structures = (_2 = drawDefinition.structures) === null || _2 === void 0 ? void 0 : _2.filter(function (_a) {
62411
+ drawDefinition.structures = (_8 = drawDefinition.structures) === null || _8 === void 0 ? void 0 : _8.filter(function (_a) {
62411
62412
  var structureId = _a.structureId;
62412
62413
  return structureId !== existingQualifyingPlaceholderStructureId;
62413
62414
  });
62414
- drawDefinition.links = (_3 = drawDefinition.links) === null || _3 === void 0 ? void 0 : _3.filter(function (_a) {
62415
+ drawDefinition.links = (_9 = drawDefinition.links) === null || _9 === void 0 ? void 0 : _9.filter(function (_a) {
62415
62416
  var source = _a.source;
62416
62417
  return source.structureId !== existingQualifyingPlaceholderStructureId;
62417
62418
  });
62418
- var _20 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _20.qualifiersCount, qualifyingDrawPositionsCount = _20.qualifyingDrawPositionsCount, qualifyingDetails = _20.qualifyingDetails;
62419
+ var _26 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _26.qualifiersCount, qualifyingDrawPositionsCount = _26.qualifyingDrawPositionsCount, qualifyingDetails = _26.qualifyingDetails;
62419
62420
  if (qualifyingDrawPositionsCount) {
62420
62421
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
62421
- (_4 = drawDefinition.structures) === null || _4 === void 0 ? void 0 : _4.push.apply(_4, __spreadArray([], __read(qualifyingResult.structures), false));
62422
+ (_10 = drawDefinition.structures) === null || _10 === void 0 ? void 0 : _10.push.apply(_10, __spreadArray([], __read(qualifyingResult.structures), false));
62422
62423
  }
62423
62424
  if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.links) {
62424
- (_5 = drawDefinition.links) === null || _5 === void 0 ? void 0 : _5.push.apply(_5, __spreadArray([], __read(qualifyingResult.links), false));
62425
+ (_11 = drawDefinition.links) === null || _11 === void 0 ? void 0 : _11.push.apply(_11, __spreadArray([], __read(qualifyingResult.links), false));
62425
62426
  }
62426
62427
  }
62427
- var mainStructure = (_6 = drawDefinition.structures) === null || _6 === void 0 ? void 0 : _6.find(function (_a) {
62428
+ var mainStructure = (_12 = drawDefinition.structures) === null || _12 === void 0 ? void 0 : _12.find(function (_a) {
62428
62429
  var stage = _a.stage, stageSequence = _a.stageSequence;
62429
62430
  return stage === MAIN && stageSequence === 1;
62430
62431
  });
@@ -62450,12 +62451,12 @@ function generateDrawDefinition(params) {
62450
62451
  if (result.error)
62451
62452
  return result;
62452
62453
  try {
62453
- for (var _21 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
62454
+ for (var _27 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
62454
62455
  var entryStage = _a.entryStage;
62455
62456
  return entryStage === StageTypeEnum.Qualifying;
62456
- })), _22 = _21.next(); !_22.done; _22 = _21.next()) {
62457
- var entry = _22.value;
62458
- var entryData = __assign(__assign({}, entry), { entryStage: (_7 = entry.entryStage) !== null && _7 !== void 0 ? _7 : StageTypeEnum.Main, drawDefinition: drawDefinition });
62457
+ })), _28 = _27.next(); !_28.done; _28 = _27.next()) {
62458
+ var entry = _28.value;
62459
+ var entryData = __assign(__assign({}, entry), { entryStage: (_13 = entry.entryStage) !== null && _13 !== void 0 ? _13 : StageTypeEnum.Main, drawDefinition: drawDefinition });
62459
62460
  // ignore errors (EXITING_PARTICIPANT)
62460
62461
  addDrawEntry(entryData);
62461
62462
  }
@@ -62463,23 +62464,23 @@ function generateDrawDefinition(params) {
62463
62464
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
62464
62465
  finally {
62465
62466
  try {
62466
- if (_22 && !_22.done && (_b = _21.return)) _b.call(_21);
62467
+ if (_28 && !_28.done && (_b = _27.return)) _b.call(_27);
62467
62468
  }
62468
62469
  finally { if (e_2) throw e_2.error; }
62469
62470
  }
62470
62471
  try {
62471
- for (var _23 = __values(qualifyingDetails || []), _24 = _23.next(); !_24.done; _24 = _23.next()) {
62472
- var qualifyingDetail = _24.value;
62472
+ for (var _29 = __values(qualifyingDetails || []), _30 = _29.next(); !_30.done; _30 = _29.next()) {
62473
+ var qualifyingDetail = _30.value;
62473
62474
  var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
62474
62475
  var link = mainStructure &&
62475
- ((_8 = generateQualifyingLink({
62476
+ ((_14 = generateQualifyingLink({
62476
62477
  targetStructureId: mainStructure.structureId,
62477
62478
  sourceStructureId: qualifyingStructureId,
62478
62479
  sourceRoundNumber: qualifyingRoundNumber,
62479
62480
  finishingPositions: finishingPositions,
62480
62481
  targetEntryRound: targetEntryRound,
62481
62482
  linkType: linkType,
62482
- })) === null || _8 === void 0 ? void 0 : _8.link);
62483
+ })) === null || _14 === void 0 ? void 0 : _14.link);
62483
62484
  if (link === null || link === void 0 ? void 0 : link.error)
62484
62485
  return link;
62485
62486
  if (link) {
@@ -62492,7 +62493,7 @@ function generateDrawDefinition(params) {
62492
62493
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
62493
62494
  finally {
62494
62495
  try {
62495
- if (_24 && !_24.done && (_c = _23.return)) _c.call(_23);
62496
+ if (_30 && !_30.done && (_c = _29.return)) _c.call(_29);
62496
62497
  }
62497
62498
  finally { if (e_3) throw e_3.error; }
62498
62499
  }
@@ -62513,7 +62514,7 @@ function generateDrawDefinition(params) {
62513
62514
  entry.entryStage &&
62514
62515
  entry.entryStage !== StageTypeEnum.Main)
62515
62516
  continue;
62516
- var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_9 = entry.entryStage) !== null && _9 !== void 0 ? _9 : StageTypeEnum.Main, drawDefinition: drawDefinition, drawType: drawType });
62517
+ var entryData = __assign(__assign({}, entry), { ignoreStageSpace: ignoreStageSpace !== null && ignoreStageSpace !== void 0 ? ignoreStageSpace : drawType === AD_HOC, entryStage: (_15 = entry.entryStage) !== null && _15 !== void 0 ? _15 : StageTypeEnum.Main, drawDefinition: drawDefinition, drawType: drawType });
62517
62518
  var result = addDrawEntry(entryData);
62518
62519
  if (drawEntries && result.error) {
62519
62520
  // only report errors with drawEntries
@@ -62537,13 +62538,13 @@ function generateDrawDefinition(params) {
62537
62538
  if (structureResult.error && !structureResult.conflicts) {
62538
62539
  return structureResult;
62539
62540
  }
62540
- if ((_10 = structureResult.positioningReport) === null || _10 === void 0 ? void 0 : _10.length)
62541
+ if ((_16 = structureResult.positioningReport) === null || _16 === void 0 ? void 0 : _16.length)
62541
62542
  positioningReports.push((_e = {}, _e[MAIN] = structureResult.positioningReport, _e));
62542
62543
  structureId = structureResult.structureId;
62543
62544
  if (structureResult.conflicts)
62544
62545
  conflicts = structureResult.conflicts;
62545
62546
  if (drawType === AD_HOC && params.roundsCount) {
62546
- var entries_2 = (_11 = event === null || event === void 0 ? void 0 : event.entries) === null || _11 === void 0 ? void 0 : _11.filter(function (_a) {
62547
+ var entries_2 = (_17 = event === null || event === void 0 ? void 0 : event.entries) === null || _17 === void 0 ? void 0 : _17.filter(function (_a) {
62547
62548
  var entryStage = _a.entryStage, entryStatus = _a.entryStatus;
62548
62549
  return (!entryStage || entryStage === MAIN) &&
62549
62550
  entryStatus &&
@@ -62590,20 +62591,20 @@ function generateDrawDefinition(params) {
62590
62591
  var roundTarget = 1;
62591
62592
  params.qualifyingProfiles.sort(roundTargetSort);
62592
62593
  try {
62593
- for (var _25 = __values(params.qualifyingProfiles), _26 = _25.next(); !_26.done; _26 = _25.next()) {
62594
- var roundTargetProfile = _26.value;
62594
+ for (var _31 = __values(params.qualifyingProfiles), _32 = _31.next(); !_32.done; _32 = _31.next()) {
62595
+ var roundTargetProfile = _32.value;
62595
62596
  if (!Array.isArray(roundTargetProfile.structureProfiles))
62596
62597
  return decorateResult({
62597
62598
  result: { error: MISSING_VALUE },
62598
62599
  info: mustBeAnArray('structureProfiles'),
62599
62600
  });
62600
62601
  roundTarget = roundTargetProfile.roundTarget || roundTarget;
62601
- var sortedStructureProfiles = ((_12 = roundTargetProfile.structureProfiles) === null || _12 === void 0 ? void 0 : _12.sort(sequenceSort)) || [];
62602
+ var sortedStructureProfiles = ((_18 = roundTargetProfile.structureProfiles) === null || _18 === void 0 ? void 0 : _18.sort(sequenceSort)) || [];
62602
62603
  var sequence = 1;
62603
62604
  try {
62604
62605
  for (var sortedStructureProfiles_1 = (e_6 = void 0, __values(sortedStructureProfiles)), sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next(); !sortedStructureProfiles_1_1.done; sortedStructureProfiles_1_1 = sortedStructureProfiles_1.next()) {
62605
62606
  var structureProfile = sortedStructureProfiles_1_1.value;
62606
- var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _27 = structureProfile.seedsCount, seedsCount_1 = _27 === void 0 ? 0 : _27, seedingProfile = structureProfile.seedingProfile, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
62607
+ var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _33 = structureProfile.seedsCount, seedsCount_1 = _33 === void 0 ? 0 : _33, seedingProfile = structureProfile.seedingProfile, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
62607
62608
  var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedingProfile: seedingProfile, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount_1, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
62608
62609
  if (qualifyingStageResult.error) {
62609
62610
  return qualifyingStageResult;
@@ -62612,9 +62613,9 @@ function generateDrawDefinition(params) {
62612
62613
  preparedStructureIds.push(qualifyingStageResult.structureId);
62613
62614
  }
62614
62615
  sequence += 1;
62615
- if ((_13 = qualifyingStageResult.conflicts) === null || _13 === void 0 ? void 0 : _13.length)
62616
+ if ((_19 = qualifyingStageResult.conflicts) === null || _19 === void 0 ? void 0 : _19.length)
62616
62617
  qualifyingConflicts.push.apply(qualifyingConflicts, __spreadArray([], __read(qualifyingStageResult.conflicts), false));
62617
- if ((_14 = qualifyingStageResult.positioningReport) === null || _14 === void 0 ? void 0 : _14.length)
62618
+ if ((_20 = qualifyingStageResult.positioningReport) === null || _20 === void 0 ? void 0 : _20.length)
62618
62619
  positioningReports.push((_h = {},
62619
62620
  _h[QUALIFYING] = qualifyingStageResult.positioningReport,
62620
62621
  _h));
@@ -62633,7 +62634,7 @@ function generateDrawDefinition(params) {
62633
62634
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
62634
62635
  finally {
62635
62636
  try {
62636
- if (_26 && !_26.done && (_f = _25.return)) _f.call(_25);
62637
+ if (_32 && !_32.done && (_f = _31.return)) _f.call(_31);
62637
62638
  }
62638
62639
  finally { if (e_5) throw e_5.error; }
62639
62640
  }
@@ -62656,7 +62657,7 @@ function generateDrawDefinition(params) {
62656
62657
  drawDefinition.links = [];
62657
62658
  drawDefinition.links.push(link);
62658
62659
  }
62659
- drawDefinition.drawName = (_15 = params.drawName) !== null && _15 !== void 0 ? _15 : drawType;
62660
+ drawDefinition.drawName = (_21 = params.drawName) !== null && _21 !== void 0 ? _21 : drawType;
62660
62661
  if (typeof voluntaryConsolation === 'object') {
62661
62662
  addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { tournamentRecord: tournamentRecord, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, matchUpType: matchUpType }));
62662
62663
  }