tods-competition-factory 1.8.25 → 1.8.26

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.
@@ -1576,17 +1576,20 @@ function cycleMutationStatus$1() {
1576
1576
  }
1577
1577
  function addNotice$1(_a) {
1578
1578
  var topic = _a.topic, payload = _a.payload, key = _a.key;
1579
- syncGlobalState.modified = true;
1580
1579
  if (typeof topic !== 'string' || typeof payload !== 'object') {
1581
1580
  return;
1582
1581
  }
1582
+ if (!syncGlobalState.disableNotifications)
1583
+ syncGlobalState.modified = true;
1583
1584
  if (syncGlobalState.disableNotifications ||
1584
- !syncGlobalState.subscriptions[topic])
1585
+ !syncGlobalState.subscriptions[topic]) {
1585
1586
  return;
1587
+ }
1586
1588
  if (key) {
1587
1589
  syncGlobalState.notices = syncGlobalState.notices.filter(function (notice) { return !(notice.topic === topic && notice.key === key); });
1588
1590
  }
1589
1591
  syncGlobalState.notices.push({ topic: topic, payload: payload, key: key });
1592
+ return __assign({}, SUCCESS);
1590
1593
  }
1591
1594
  function getNotices$1(_a) {
1592
1595
  var topic = _a.topic;
@@ -2910,7 +2913,7 @@ var matchUpFormatCode = {
2910
2913
  };
2911
2914
 
2912
2915
  function factoryVersion() {
2913
- return '1.8.25';
2916
+ return '1.8.26';
2914
2917
  }
2915
2918
 
2916
2919
  function getObjectTieFormat(obj) {
@@ -7768,41 +7771,6 @@ function getMatchUpType(params) {
7768
7771
  return { matchUpType: matchUpType };
7769
7772
  }
7770
7773
 
7771
- function modifyEntryProfile(_a) {
7772
- var drawDefinition = _a.drawDefinition, attributes = _a.attributes;
7773
- var extension = findDrawDefinitionExtension({
7774
- name: ENTRY_PROFILE,
7775
- drawDefinition: drawDefinition,
7776
- }).extension;
7777
- var entryProfile = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
7778
- attributes.forEach(function (attribute) {
7779
- Object.keys(attribute).forEach(function (key) {
7780
- if (!entryProfile[key]) {
7781
- entryProfile[key] = attribute[key];
7782
- }
7783
- else {
7784
- Object.assign(entryProfile[key], attribute[key]);
7785
- }
7786
- });
7787
- });
7788
- extension = {
7789
- name: ENTRY_PROFILE,
7790
- value: entryProfile,
7791
- };
7792
- addDrawDefinitionExtension({ drawDefinition: drawDefinition, extension: extension });
7793
- return { entryProfile: entryProfile };
7794
- }
7795
-
7796
- function getEntryProfile(_a) {
7797
- var drawDefinition = _a.drawDefinition;
7798
- var extension = findDrawDefinitionExtension({
7799
- name: ENTRY_PROFILE,
7800
- drawDefinition: drawDefinition,
7801
- }).extension;
7802
- var entryProfile = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
7803
- return { entryProfile: entryProfile };
7804
- }
7805
-
7806
7774
  var _a$i, _b$5, _c$1;
7807
7775
  // stage types
7808
7776
  var MAIN = 'MAIN';
@@ -7861,6 +7829,7 @@ var FIRST_MATCHUP = 'FIRST_MATCHUP'; // condition for valididty of link
7861
7829
  // draw types
7862
7830
  // PLAY_OFF is also a stage type
7863
7831
  var AD_HOC = 'AD_HOC';
7832
+ var FLEX_ROUNDS = 'AD_HOC';
7864
7833
  var FEED_IN$1 = 'FEED_IN';
7865
7834
  var COMPASS = 'COMPASS';
7866
7835
  var OLYMPIC = 'OLYMPIC';
@@ -7954,6 +7923,7 @@ var drawDefinitionConstants = {
7954
7923
  LOSER: LOSER,
7955
7924
  AD_HOC: AD_HOC,
7956
7925
  FEED_IN: FEED_IN$1,
7926
+ FLEX_ROUNDS: FLEX_ROUNDS,
7957
7927
  COMPASS: COMPASS,
7958
7928
  PLAY_OFF: PLAY_OFF,
7959
7929
  OLYMPIC: OLYMPIC,
@@ -8092,6 +8062,119 @@ function getDrawStructures(_a) {
8092
8062
  }
8093
8063
  }
8094
8064
 
8065
+ function getAllPositionedParticipantIds(_a) {
8066
+ var drawDefinition = _a.drawDefinition;
8067
+ if (!drawDefinition)
8068
+ return { error: MISSING_DRAW_DEFINITION };
8069
+ var stagePositionedParticipantIds = {};
8070
+ var allPositionedParticipantIds = (drawDefinition.structures || [])
8071
+ .map(function (structure) {
8072
+ var _a;
8073
+ var _b;
8074
+ var stage = structure.stage;
8075
+ if (!stagePositionedParticipantIds[stage])
8076
+ stagePositionedParticipantIds[stage] = [];
8077
+ var positionAssignments = getPositionAssignments$1({ structure: structure }).positionAssignments;
8078
+ var particiapntIds = (_b = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.map(extractAttributes('participantId')).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
8079
+ (_a = stagePositionedParticipantIds[stage]).push.apply(_a, __spreadArray([], __read(particiapntIds), false));
8080
+ return particiapntIds;
8081
+ })
8082
+ .flat();
8083
+ return { allPositionedParticipantIds: allPositionedParticipantIds, stagePositionedParticipantIds: stagePositionedParticipantIds };
8084
+ }
8085
+ function getPositionAssignments$1(_a) {
8086
+ var _b;
8087
+ var drawDefinition = _a.drawDefinition, structureId = _a.structureId, structure = _a.structure;
8088
+ var error, positionAssignments = [];
8089
+ if (!structure) {
8090
+ if (!drawDefinition) {
8091
+ return { positionAssignments: positionAssignments, error: MISSING_DRAW_DEFINITION };
8092
+ }
8093
+ (_b = findStructure({ drawDefinition: drawDefinition, structureId: structureId }), structure = _b.structure, error = _b.error);
8094
+ if (error)
8095
+ return { positionAssignments: positionAssignments, error: error };
8096
+ }
8097
+ if (structure.structures) {
8098
+ positionAssignments = [].concat.apply([], __spreadArray([], __read(structure.structures.map(function (structure) {
8099
+ return getPositionAssignments$1({ structure: structure }).positionAssignments;
8100
+ })), false));
8101
+ }
8102
+ else if (structure.positionAssignments) {
8103
+ positionAssignments = structure.positionAssignments;
8104
+ }
8105
+ else {
8106
+ error = MISSING_POSITION_ASSIGNMENTS;
8107
+ }
8108
+ return { positionAssignments: positionAssignments, error: error };
8109
+ }
8110
+ function structureAssignedDrawPositions(_a) {
8111
+ var _b;
8112
+ var drawDefinition = _a.drawDefinition, structureId = _a.structureId, structure = _a.structure;
8113
+ var positionAssignments = ((_b = getPositionAssignments$1({
8114
+ drawDefinition: drawDefinition,
8115
+ structureId: structureId,
8116
+ structure: structure,
8117
+ })) === null || _b === void 0 ? void 0 : _b.positionAssignments) || [];
8118
+ var assignedPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8119
+ var _a, _b;
8120
+ return (_b = (_a = assignment.participantId) !== null && _a !== void 0 ? _a : assignment.bye) !== null && _b !== void 0 ? _b : assignment.qualifier;
8121
+ });
8122
+ var allPositionsAssigned = positionAssignments &&
8123
+ (positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.length) === (assignedPositions === null || assignedPositions === void 0 ? void 0 : assignedPositions.length);
8124
+ var unassignedPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8125
+ return (!assignment.participantId && !assignment.bye && !assignment.qualifier);
8126
+ });
8127
+ var byePositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8128
+ return !assignment.participantId && assignment.bye;
8129
+ });
8130
+ var qualifierPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8131
+ return !assignment.participantId && assignment.qualifier;
8132
+ });
8133
+ return {
8134
+ allPositionsAssigned: allPositionsAssigned,
8135
+ positionAssignments: positionAssignments,
8136
+ unassignedPositions: unassignedPositions,
8137
+ assignedPositions: assignedPositions,
8138
+ qualifierPositions: qualifierPositions,
8139
+ byePositions: byePositions,
8140
+ };
8141
+ }
8142
+
8143
+ function modifyEntryProfile(_a) {
8144
+ var drawDefinition = _a.drawDefinition, attributes = _a.attributes;
8145
+ var extension = findDrawDefinitionExtension({
8146
+ name: ENTRY_PROFILE,
8147
+ drawDefinition: drawDefinition,
8148
+ }).extension;
8149
+ var entryProfile = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
8150
+ attributes.forEach(function (attribute) {
8151
+ Object.keys(attribute).forEach(function (key) {
8152
+ if (!entryProfile[key]) {
8153
+ entryProfile[key] = attribute[key];
8154
+ }
8155
+ else {
8156
+ Object.assign(entryProfile[key], attribute[key]);
8157
+ }
8158
+ });
8159
+ });
8160
+ extension = {
8161
+ name: ENTRY_PROFILE,
8162
+ value: entryProfile,
8163
+ };
8164
+ addDrawDefinitionExtension({ drawDefinition: drawDefinition, extension: extension });
8165
+ return { entryProfile: entryProfile };
8166
+ }
8167
+
8168
+ function getEntryProfile(_a) {
8169
+ var drawDefinition = _a.drawDefinition;
8170
+ var extension = findDrawDefinitionExtension({
8171
+ name: ENTRY_PROFILE,
8172
+ drawDefinition: drawDefinition,
8173
+ }).extension;
8174
+ var entryProfile = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
8175
+ return { entryProfile: entryProfile };
8176
+ }
8177
+
8095
8178
  var ALTERNATE = exports.EntryStatusEnum.Alternate;
8096
8179
  var CONFIRMED = exports.EntryStatusEnum.Confirmed;
8097
8180
  var DIRECT_ACCEPTANCE = exports.EntryStatusEnum.DirectAcceptance;
@@ -8348,11 +8431,14 @@ function getStageWildcardEntriesCount(_a) {
8348
8431
  function getStructureSeedAssignments(_a) {
8349
8432
  var _b;
8350
8433
  var _c;
8351
- var provisionalPositioning = _a.provisionalPositioning, drawDefinition = _a.drawDefinition, structureId = _a.structureId, structure = _a.structure;
8434
+ var provisionalPositioning = _a.provisionalPositioning, returnAllProxies = _a.returnAllProxies, drawDefinition = _a.drawDefinition, structureId = _a.structureId, structure = _a.structure;
8352
8435
  var error, seedAssignments = [];
8353
8436
  if (!structure) {
8354
8437
  (_b = findStructure({ drawDefinition: drawDefinition, structureId: structureId }), structure = _b.structure, error = _b.error);
8355
8438
  }
8439
+ var positionAssignments = getPositionAssignments$1({
8440
+ structure: structure,
8441
+ }).positionAssignments;
8356
8442
  if (error || !structure)
8357
8443
  return { seedAssignments: [], error: STRUCTURE_NOT_FOUND };
8358
8444
  if (!structureId)
@@ -8368,7 +8454,7 @@ function getStructureSeedAssignments(_a) {
8368
8454
  structureId: structureId,
8369
8455
  stage: stage,
8370
8456
  });
8371
- var seedProxies = entries
8457
+ var proxiedEntries = entries
8372
8458
  ? entries
8373
8459
  .filter(function (entry) { return entry.placementGroup === 1; })
8374
8460
  .sort(function (a, b) {
@@ -8383,11 +8469,12 @@ function getStructureSeedAssignments(_a) {
8383
8469
  return {
8384
8470
  participantId: entry.participantId,
8385
8471
  seedValue: seedNumber,
8472
+ seedProxy: true,
8386
8473
  seedNumber: seedNumber,
8387
- seedProxy: true, // flag so that proxy seeding information doesn't get used externally
8388
8474
  };
8389
8475
  })
8390
8476
  : [];
8477
+ var seedProxies = proxiedEntries === null || proxiedEntries === void 0 ? void 0 : proxiedEntries.slice(0, returnAllProxies ? proxiedEntries.length : positionAssignments.length / 2);
8391
8478
  if (seedProxies.length) {
8392
8479
  // seedProxies are only found in PLAY_OFF when ROUND_ROBIN is MAIN stage
8393
8480
  seedAssignments = seedProxies;
@@ -8399,7 +8486,13 @@ function getStructureSeedAssignments(_a) {
8399
8486
  error = MISSING_SEED_ASSIGNMENTS;
8400
8487
  }
8401
8488
  var seedLimit = structure.seedLimit || ((_c = structure === null || structure === void 0 ? void 0 : structure.positionAssignments) === null || _c === void 0 ? void 0 : _c.length);
8402
- return { seedAssignments: seedAssignments, seedLimit: seedLimit, stage: stage, stageSequence: stageSequence, error: error };
8489
+ return {
8490
+ seedAssignments: seedAssignments,
8491
+ stageSequence: stageSequence,
8492
+ seedLimit: seedLimit,
8493
+ stage: stage,
8494
+ error: error,
8495
+ };
8403
8496
  }
8404
8497
 
8405
8498
  function getExitProfiles(_a) {
@@ -8723,84 +8816,6 @@ function getSourceDrawPositionRanges(_a) {
8723
8816
  * }
8724
8817
  */
8725
8818
 
8726
- function getAllPositionedParticipantIds(_a) {
8727
- var drawDefinition = _a.drawDefinition;
8728
- if (!drawDefinition)
8729
- return { error: MISSING_DRAW_DEFINITION };
8730
- var stagePositionedParticipantIds = {};
8731
- var allPositionedParticipantIds = (drawDefinition.structures || [])
8732
- .map(function (structure) {
8733
- var _a;
8734
- var _b;
8735
- var stage = structure.stage;
8736
- if (!stagePositionedParticipantIds[stage])
8737
- stagePositionedParticipantIds[stage] = [];
8738
- var positionAssignments = getPositionAssignments$1({ structure: structure }).positionAssignments;
8739
- var particiapntIds = (_b = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.map(extractAttributes('participantId')).filter(Boolean)) !== null && _b !== void 0 ? _b : [];
8740
- (_a = stagePositionedParticipantIds[stage]).push.apply(_a, __spreadArray([], __read(particiapntIds), false));
8741
- return particiapntIds;
8742
- })
8743
- .flat();
8744
- return { allPositionedParticipantIds: allPositionedParticipantIds, stagePositionedParticipantIds: stagePositionedParticipantIds };
8745
- }
8746
- function getPositionAssignments$1(_a) {
8747
- var _b;
8748
- var drawDefinition = _a.drawDefinition, structureId = _a.structureId, structure = _a.structure;
8749
- var error, positionAssignments = [];
8750
- if (!structure) {
8751
- if (!drawDefinition) {
8752
- return { positionAssignments: positionAssignments, error: MISSING_DRAW_DEFINITION };
8753
- }
8754
- (_b = findStructure({ drawDefinition: drawDefinition, structureId: structureId }), structure = _b.structure, error = _b.error);
8755
- if (error)
8756
- return { positionAssignments: positionAssignments, error: error };
8757
- }
8758
- if (structure.structures) {
8759
- positionAssignments = [].concat.apply([], __spreadArray([], __read(structure.structures.map(function (structure) {
8760
- return getPositionAssignments$1({ structure: structure }).positionAssignments;
8761
- })), false));
8762
- }
8763
- else if (structure.positionAssignments) {
8764
- positionAssignments = structure.positionAssignments;
8765
- }
8766
- else {
8767
- error = MISSING_POSITION_ASSIGNMENTS;
8768
- }
8769
- return { positionAssignments: positionAssignments, error: error };
8770
- }
8771
- function structureAssignedDrawPositions(_a) {
8772
- var _b;
8773
- var drawDefinition = _a.drawDefinition, structureId = _a.structureId, structure = _a.structure;
8774
- var positionAssignments = ((_b = getPositionAssignments$1({
8775
- drawDefinition: drawDefinition,
8776
- structureId: structureId,
8777
- structure: structure,
8778
- })) === null || _b === void 0 ? void 0 : _b.positionAssignments) || [];
8779
- var assignedPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8780
- var _a, _b;
8781
- return (_b = (_a = assignment.participantId) !== null && _a !== void 0 ? _a : assignment.bye) !== null && _b !== void 0 ? _b : assignment.qualifier;
8782
- });
8783
- var allPositionsAssigned = positionAssignments &&
8784
- (positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.length) === (assignedPositions === null || assignedPositions === void 0 ? void 0 : assignedPositions.length);
8785
- var unassignedPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8786
- return (!assignment.participantId && !assignment.bye && !assignment.qualifier);
8787
- });
8788
- var byePositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8789
- return !assignment.participantId && assignment.bye;
8790
- });
8791
- var qualifierPositions = positionAssignments === null || positionAssignments === void 0 ? void 0 : positionAssignments.filter(function (assignment) {
8792
- return !assignment.participantId && assignment.qualifier;
8793
- });
8794
- return {
8795
- allPositionsAssigned: allPositionsAssigned,
8796
- positionAssignments: positionAssignments,
8797
- unassignedPositions: unassignedPositions,
8798
- assignedPositions: assignedPositions,
8799
- qualifierPositions: qualifierPositions,
8800
- byePositions: byePositions,
8801
- };
8802
- }
8803
-
8804
8819
  function getOrderedDrawPositions(_a) {
8805
8820
  var _b;
8806
8821
  var drawPositions = _a.drawPositions, roundProfile = _a.roundProfile, roundNumber = _a.roundNumber;
@@ -25832,7 +25847,7 @@ function getSeedingThresholds(_a) {
25832
25847
 
25833
25848
  function getValidSeedBlocks(_a) {
25834
25849
  var _b, _c;
25835
- var provisionalPositioning = _a.provisionalPositioning, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, allPositions = _a.allPositions, structure = _a.structure;
25850
+ var provisionalPositioning = _a.provisionalPositioning, returnAllProxies = _a.returnAllProxies, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, allPositions = _a.allPositions, structure = _a.structure;
25836
25851
  var validSeedBlocks = [];
25837
25852
  if (!structure)
25838
25853
  return { error: MISSING_STRUCTURE };
@@ -25843,6 +25858,7 @@ function getValidSeedBlocks(_a) {
25843
25858
  }), matchUps = _d.matchUps, roundMatchUps = _d.roundMatchUps;
25844
25859
  var seedAssignments = getStructureSeedAssignments({
25845
25860
  provisionalPositioning: provisionalPositioning,
25861
+ returnAllProxies: returnAllProxies,
25846
25862
  drawDefinition: drawDefinition,
25847
25863
  structure: structure,
25848
25864
  }).seedAssignments;
@@ -26083,6 +26099,7 @@ function getNextSeedBlock(params) {
26083
26099
  var provisionalPositioning = params.provisionalPositioning, drawDefinition = params.drawDefinition, seedBlockInfo = params.seedBlockInfo, structureId = params.structureId, randomize = params.randomize;
26084
26100
  var structure = findStructure({ drawDefinition: drawDefinition, structureId: structureId }).structure;
26085
26101
  var seedAssignments = getStructureSeedAssignments({
26102
+ returnAllProxies: params.returnAllProxies,
26086
26103
  provisionalPositioning: provisionalPositioning,
26087
26104
  drawDefinition: drawDefinition,
26088
26105
  structure: structure,
@@ -26094,6 +26111,7 @@ function getNextSeedBlock(params) {
26094
26111
  var validSeedBlocks = (seedBlockInfo === null || seedBlockInfo === void 0 ? void 0 : seedBlockInfo.validSeedBlocks) ||
26095
26112
  (structure &&
26096
26113
  ((_a = getValidSeedBlocks({
26114
+ returnAllProxies: params.returnAllProxies,
26097
26115
  provisionalPositioning: provisionalPositioning,
26098
26116
  appliedPolicies: appliedPolicies,
26099
26117
  drawDefinition: drawDefinition,
@@ -44893,22 +44911,6 @@ function getSwapOptions(_a) {
44893
44911
  .flat(1);
44894
44912
  }
44895
44913
 
44896
- /**
44897
- *
44898
- * NOTE: some of these parameters are passed directly through to other functions via ...params
44899
- *
44900
- * @param {object[]} initialPositionAssignments - positionAssignments before any new participants placed
44901
- * @param {object[]} participantsWithGroupings - participants with added team/group/pair participantIds arrays
44902
- * @param {string[]} unseededParticipantIds - ids of participants who are unseeded
44903
- * @param {object[]} drawPositionChunks - drawPositions grouped by round starting with the final round
44904
- * @param {object[]} drawPositionGroups - drawPositions paird with their initial round opponent drawPosition
44905
- * @param {object[]} policyAttributes - { key: '' } objects defining accessors for participant values to be compared
44906
- * @param {object} drawDefinition - drawDefinition object
44907
- * @param {boolean} pairedPriority - flag whether to prioritize positions which already have one opponent placed
44908
- * @param {string} structureId - id of the structure in which participants are to be placed
44909
- * @param {object[]} allGroups - map of values and participantIds which have those values
44910
- *
44911
- */
44912
44914
  function generatePositioningCandidate(params) {
44913
44915
  var initialPositionAssignments = params.initialPositionAssignments, participantsWithGroupings = params.participantsWithGroupings, opponentsToPlaceCount = params.opponentsToPlaceCount, unseededByePositions = params.unseededByePositions, drawPositionGroups = params.drawPositionGroups, policyAttributes = params.policyAttributes, idCollections = params.idCollections, allGroups = params.allGroups;
44914
44916
  var errors = [];
@@ -45022,7 +45024,8 @@ function swapAssignedPositions(_a) {
45022
45024
  function randomUnseededSeparation(_a) {
45023
45025
  var e_1, _b;
45024
45026
  var _c, _d;
45025
- var provisionalPositioning = _a.provisionalPositioning, unseededParticipantIds = _a.unseededParticipantIds, inContextDrawMatchUps = _a.inContextDrawMatchUps, unseededByePositions = _a.unseededByePositions, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, participants = _a.participants, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId, avoidance = _a.avoidance, drawSize = _a.drawSize, entries = _a.entries, // entries for the specific stage of drawDefinition
45027
+ var provisionalPositioning = _a.provisionalPositioning, unseededParticipantIds = _a.unseededParticipantIds, inContextDrawMatchUps = _a.inContextDrawMatchUps, unseededByePositions = _a.unseededByePositions, tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, participants = _a.participants, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId, avoidance = _a.avoidance, drawSize = _a.drawSize,
45028
+ // entries, // entries for the specific stage of drawDefinition
45026
45029
  event = _a.event;
45027
45030
  if (!avoidance) {
45028
45031
  return { error: MISSING_AVOIDANCE_POLICY };
@@ -45061,16 +45064,17 @@ function randomUnseededSeparation(_a) {
45061
45064
  var _f = isRoundRobin
45062
45065
  ? roundRobinParticipantGroups(params)
45063
45066
  : eliminationParticipantGroups(params), drawPositionGroups = _f.drawPositionGroups, drawPositionChunks = _f.drawPositionChunks;
45064
- var idCollections = {};
45065
- idCollections.groupParticipants = participants
45066
- .filter(function (participant) { return participant.participantType === GROUP; })
45067
- .map(function (participant) { return participant.participantId; });
45068
- idCollections.teamParticipants = participants
45069
- .filter(function (participant) { return participant.participantType === TEAM; })
45070
- .map(function (participant) { return participant.participantId; });
45071
- idCollections.pairParticipants = participants
45072
- .filter(function (participant) { return participant.participantType === PAIR; })
45073
- .map(function (participant) { return participant.participantId; });
45067
+ var idCollections = {
45068
+ groupParticipants: participants
45069
+ .filter(function (participant) { return participant.participantType === GROUP; })
45070
+ .map(function (participant) { return participant.participantId; }),
45071
+ teamParticipants: participants
45072
+ .filter(function (participant) { return participant.participantType === TEAM; })
45073
+ .map(function (participant) { return participant.participantId; }),
45074
+ pairParticipants: participants
45075
+ .filter(function (participant) { return participant.participantType === PAIR; })
45076
+ .map(function (participant) { return participant.participantId; }),
45077
+ };
45074
45078
  var allGroups = getAttributeGroupings({
45075
45079
  targetParticipantIds: unseededParticipantIds,
45076
45080
  policyAttributes: policyAttributes,
@@ -45127,7 +45131,7 @@ function randomUnseededSeparation(_a) {
45127
45131
  idCollections: idCollections,
45128
45132
  allGroups: allGroups,
45129
45133
  drawSize: drawSize,
45130
- entries: entries,
45134
+ // entries,
45131
45135
  });
45132
45136
  });
45133
45137
  var candidates = noPairPriorityCandidates
@@ -45516,11 +45520,11 @@ function getSeedOrderByePositions(_a) {
45516
45520
  var strictSeedOrderByePositions = getOrderedByePositions({
45517
45521
  orderedSeedDrawPositions: orderedSortedFirstRoundSeededDrawPositions,
45518
45522
  relevantMatchUps: relevantMatchUps,
45519
- }).slice(0, positionedSeeds.length);
45523
+ }).slice(0, byesToPlace);
45520
45524
  var blockSeedOrderByePositions = getOrderedByePositions({
45521
45525
  orderedSeedDrawPositions: blockSortedRandomDrawPositions,
45522
45526
  relevantMatchUps: relevantMatchUps,
45523
- }).slice(0, positionedSeeds.length);
45527
+ }).slice(0, byesToPlace);
45524
45528
  return {
45525
45529
  strictSeedOrderByePositions: strictSeedOrderByePositions,
45526
45530
  blockSeedOrderByePositions: blockSeedOrderByePositions,
@@ -46247,7 +46251,6 @@ function automatedPositioning$1(_a) {
46247
46251
  })
46248
46252
  : undefined;
46249
46253
  if (result_3 === null || result_3 === void 0 ? void 0 : result_3.error) {
46250
- console.log('positionByes', { result: result_3 });
46251
46254
  return handleErrorCondition(result_3);
46252
46255
  }
46253
46256
  unseededByePositions = result_3 === null || result_3 === void 0 ? void 0 : result_3.unseededByePositions;
@@ -46357,6 +46360,7 @@ function automatedPlayoffPositioning(params) {
46357
46360
  }).playoffStructures) === null || _b === void 0 ? void 0 : _b.sort(function (a, b) { return getMinFinishingPositionRange(a) - getMinFinishingPositionRange(b); });
46358
46361
  var structurePositionAssignments = [];
46359
46362
  var participants = tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants;
46363
+ var positioningReports = [];
46360
46364
  if (playoffStructures) {
46361
46365
  try {
46362
46366
  for (var playoffStructures_1 = __values(playoffStructures), playoffStructures_1_1 = playoffStructures_1.next(); !playoffStructures_1_1.done; playoffStructures_1_1 = playoffStructures_1.next()) {
@@ -46380,6 +46384,8 @@ function automatedPlayoffPositioning(params) {
46380
46384
  structureId: playoffStructureId,
46381
46385
  });
46382
46386
  }
46387
+ if (result.positioningReport)
46388
+ positioningReports.push(result.positioningReport);
46383
46389
  }
46384
46390
  }
46385
46391
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
@@ -46390,7 +46396,7 @@ function automatedPlayoffPositioning(params) {
46390
46396
  finally { if (e_1) throw e_1.error; }
46391
46397
  }
46392
46398
  }
46393
- return __assign(__assign({}, SUCCESS), { structurePositionAssignments: structurePositionAssignments });
46399
+ return __assign(__assign({}, SUCCESS), { structurePositionAssignments: structurePositionAssignments, positioningReports: positioningReports });
46394
46400
  }
46395
46401
 
46396
46402
  function generateAndPopulateRRplayoffStructures(params) {
@@ -47108,18 +47114,37 @@ function getStructureGroups(_a) {
47108
47114
  function generateQualifyingStructure$1(params) {
47109
47115
  var _a;
47110
47116
  var _b, _c, _d, _e, _f, _g, _h, _j;
47111
- if (!params.drawDefinition)
47112
- return { error: MISSING_DRAW_DEFINITION };
47113
47117
  var stack = 'generateQualifyingStructure';
47118
+ if (!params.drawDefinition)
47119
+ return decorateResult({
47120
+ result: { error: MISSING_DRAW_DEFINITION },
47121
+ stack: stack,
47122
+ });
47123
+ if ((params.drawSize && !isConvertableInteger(params.drawSize)) ||
47124
+ (params.participantsCount &&
47125
+ !isConvertableInteger(params.participantsCount)) ||
47126
+ (params.qualifyingPositions &&
47127
+ !isConvertableInteger(params.qualifyingPositions))) {
47128
+ return decorateResult({ result: { error: INVALID_VALUES }, stack: stack });
47129
+ }
47114
47130
  var drawSize = (_b = params.drawSize) !== null && _b !== void 0 ? _b : coerceEven(params.participantsCount);
47115
47131
  var qualifyingRoundNumber = params.qualifyingRoundNumber, qualifyingPositions = params.qualifyingPositions, targetStructureId = params.targetStructureId, structureOptions = params.structureOptions, appliedPolicies = params.appliedPolicies, drawDefinition = params.drawDefinition, matchUpFormat = params.matchUpFormat, structureName = params.structureName, structureId = params.structureId, roundTarget = params.roundTarget, drawType = params.drawType, idPrefix = params.idPrefix, isMock = params.isMock, uuids = params.uuids;
47132
+ if (!params.drawSize)
47133
+ return decorateResult({
47134
+ result: { error: MISSING_DRAW_SIZE },
47135
+ context: { drawSize: drawSize },
47136
+ stack: stack,
47137
+ });
47138
+ if (qualifyingPositions && qualifyingPositions >= params.drawSize)
47139
+ return decorateResult({
47140
+ result: { error: INVALID_VALUES },
47141
+ context: { drawSize: drawSize, qualifyingPositions: qualifyingPositions },
47142
+ stack: stack,
47143
+ });
47116
47144
  var roundLimit, roundsCount, structure, matchUps;
47117
47145
  var qualifiersCount = 0;
47118
47146
  var finishingPositions;
47119
47147
  var stageSequence = 1;
47120
- if (!isConvertableInteger(drawSize)) {
47121
- return decorateResult({ result: { error: MISSING_DRAW_SIZE }, stack: stack });
47122
- }
47123
47148
  var structureProfiles = getStructureGroups({ drawDefinition: drawDefinition }).structureProfiles;
47124
47149
  var structureProfile = structureProfiles[targetStructureId];
47125
47150
  if (!structureProfile) {
@@ -47814,6 +47839,7 @@ function removeStructure(_a) {
47814
47839
  var structure = structures.find(function (structure) { return structure.structureId === structureId; });
47815
47840
  if (!structure)
47816
47841
  return { error: STRUCTURE_NOT_FOUND };
47842
+ // TODO: if structure being rmoved is qualifying structure, ensure no source structures have scored matchUps
47817
47843
  var structureMatchUps = getAllStructureMatchUps({ structure: structure }).matchUps;
47818
47844
  var scoresPresent = structureMatchUps.some(function (_a) {
47819
47845
  var score = _a.score;
@@ -51964,6 +51990,7 @@ function getValidAssignmentActions(_a) {
51964
51990
  if (!ignoreSeedPositions) {
51965
51991
  var result = getNextSeedBlock({
51966
51992
  provisionalPositioning: provisionalPositioning,
51993
+ returnAllProxies: true,
51967
51994
  randomize: true,
51968
51995
  drawDefinition: drawDefinition,
51969
51996
  structureId: structureId,
@@ -52540,6 +52567,7 @@ function positionActions$1(params) {
52540
52567
  isValidSeedPosition({ drawDefinition: drawDefinition, structureId: structureId, drawPosition: drawPosition }) &&
52541
52568
  validToAssignSeed) {
52542
52569
  var seedAssignments = getStructureSeedAssignments({
52570
+ returnAllProxies: true,
52543
52571
  drawDefinition: drawDefinition,
52544
52572
  structure: structure,
52545
52573
  }).seedAssignments;
@@ -52568,6 +52596,7 @@ function positionActions$1(params) {
52568
52596
  isValidSeedPosition({ drawDefinition: drawDefinition, structureId: structureId, drawPosition: drawPosition }) &&
52569
52597
  validToAssignSeed) {
52570
52598
  var seedAssignments = getStructureSeedAssignments({
52599
+ returnAllProxies: true,
52571
52600
  drawDefinition: drawDefinition,
52572
52601
  structure: structure,
52573
52602
  }).seedAssignments;