tods-competition-factory 1.8.31 → 1.8.33
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.
- package/dist/forge/generate.d.ts +2 -0
- package/dist/forge/generate.mjs +132 -18
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +123 -16
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +118 -15
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +137 -19
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +180 -49
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +2 -2
|
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
function factoryVersion() {
|
|
2932
|
-
return '1.8.
|
|
2932
|
+
return '1.8.33';
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
function getObjectTieFormat(obj) {
|
|
@@ -25921,9 +25921,115 @@ function getSeedingThresholds(_a) {
|
|
|
25921
25921
|
return __assign(__assign({}, SUCCESS), { seedingThresholds: seedingThresholds });
|
|
25922
25922
|
}
|
|
25923
25923
|
|
|
25924
|
+
function getDivisions(_a) {
|
|
25925
|
+
var size = _a.size;
|
|
25926
|
+
var divisions = [size];
|
|
25927
|
+
var division = size;
|
|
25928
|
+
while (division / 2 === Math.floor(division / 2)) {
|
|
25929
|
+
division = division / 2;
|
|
25930
|
+
divisions.push(division);
|
|
25931
|
+
}
|
|
25932
|
+
if (!divisions.includes(1))
|
|
25933
|
+
divisions.push(1);
|
|
25934
|
+
divisions.sort(numericSort);
|
|
25935
|
+
divisions.reverse();
|
|
25936
|
+
return divisions;
|
|
25937
|
+
}
|
|
25938
|
+
function getSubBlock(_a) {
|
|
25939
|
+
var e_1, _b;
|
|
25940
|
+
var blockPattern = _a.blockPattern, index = _a.index;
|
|
25941
|
+
var i = 0;
|
|
25942
|
+
try {
|
|
25943
|
+
for (var blockPattern_1 = __values(blockPattern), blockPattern_1_1 = blockPattern_1.next(); !blockPattern_1_1.done; blockPattern_1_1 = blockPattern_1.next()) {
|
|
25944
|
+
var subBlock = blockPattern_1_1.value;
|
|
25945
|
+
if (i === index)
|
|
25946
|
+
return subBlock;
|
|
25947
|
+
var j = 0;
|
|
25948
|
+
while (j < subBlock.length) {
|
|
25949
|
+
if (i === index)
|
|
25950
|
+
return subBlock;
|
|
25951
|
+
i += 1;
|
|
25952
|
+
j++;
|
|
25953
|
+
}
|
|
25954
|
+
}
|
|
25955
|
+
}
|
|
25956
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
25957
|
+
finally {
|
|
25958
|
+
try {
|
|
25959
|
+
if (blockPattern_1_1 && !blockPattern_1_1.done && (_b = blockPattern_1.return)) _b.call(blockPattern_1);
|
|
25960
|
+
}
|
|
25961
|
+
finally { if (e_1) throw e_1.error; }
|
|
25962
|
+
}
|
|
25963
|
+
}
|
|
25964
|
+
function generateBlockPattern(_a) {
|
|
25965
|
+
var e_2, _b;
|
|
25966
|
+
var positioning = _a.positioning, size = _a.size;
|
|
25967
|
+
var divisions = getDivisions({ size: size });
|
|
25968
|
+
var divisionGroupings = [];
|
|
25969
|
+
var selected = [];
|
|
25970
|
+
var firstMember = function (arr) { return arr[0]; };
|
|
25971
|
+
var lastMember = function (arr) { return arr[arr.length - 1]; };
|
|
25972
|
+
var getMember = function (arr, i) {
|
|
25973
|
+
return (positioning === CLUSTER && i % 2 ? lastMember(arr) : firstMember(arr)) ||
|
|
25974
|
+
firstMember(arr);
|
|
25975
|
+
};
|
|
25976
|
+
var noneSelected = function (chunk, i) {
|
|
25977
|
+
if (chunk.every(function (member) { return !selected.includes(member); })) {
|
|
25978
|
+
var member = getMember(chunk, i);
|
|
25979
|
+
selected.push(member);
|
|
25980
|
+
return member;
|
|
25981
|
+
}
|
|
25982
|
+
};
|
|
25983
|
+
var notSelected = function (chunk) {
|
|
25984
|
+
var notSelected = chunk.filter(function (member) { return !selected.includes(member); });
|
|
25985
|
+
if (notSelected.length) {
|
|
25986
|
+
selected.push.apply(selected, __spreadArray([], __read(notSelected), false));
|
|
25987
|
+
return notSelected;
|
|
25988
|
+
}
|
|
25989
|
+
};
|
|
25990
|
+
var select = function (chunk, i) {
|
|
25991
|
+
var member = getMember(chunk, i);
|
|
25992
|
+
if (!selected.includes(member)) {
|
|
25993
|
+
selected.push(member);
|
|
25994
|
+
return member;
|
|
25995
|
+
}
|
|
25996
|
+
};
|
|
25997
|
+
var range = generateRange(1, size + 1);
|
|
25998
|
+
try {
|
|
25999
|
+
for (var divisions_1 = __values(divisions), divisions_1_1 = divisions_1.next(); !divisions_1_1.done; divisions_1_1 = divisions_1.next()) {
|
|
26000
|
+
var division = divisions_1_1.value;
|
|
26001
|
+
if (division === 1) {
|
|
26002
|
+
var chunks = chunkArray(range, 2);
|
|
26003
|
+
// first check all pairs for pair that has no member included in selected
|
|
26004
|
+
var positions = chunks.map(noneSelected).filter(Boolean);
|
|
26005
|
+
if (positions.length)
|
|
26006
|
+
divisionGroupings.push(positions);
|
|
26007
|
+
// then return positions from each chunk which are not selected
|
|
26008
|
+
var lastPositions = chunks.flatMap(notSelected).filter(Boolean);
|
|
26009
|
+
if (lastPositions.length)
|
|
26010
|
+
divisionGroupings.push(lastPositions);
|
|
26011
|
+
}
|
|
26012
|
+
else {
|
|
26013
|
+
var chunks = chunkArray(range, division);
|
|
26014
|
+
var positions = chunks.map(select).filter(Boolean);
|
|
26015
|
+
if (positions.length)
|
|
26016
|
+
divisionGroupings.push(positions);
|
|
26017
|
+
}
|
|
26018
|
+
}
|
|
26019
|
+
}
|
|
26020
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
26021
|
+
finally {
|
|
26022
|
+
try {
|
|
26023
|
+
if (divisions_1_1 && !divisions_1_1.done && (_b = divisions_1.return)) _b.call(divisions_1);
|
|
26024
|
+
}
|
|
26025
|
+
finally { if (e_2) throw e_2.error; }
|
|
26026
|
+
}
|
|
26027
|
+
return { divisions: divisions, divisionGroupings: divisionGroupings };
|
|
26028
|
+
}
|
|
26029
|
+
|
|
25924
26030
|
function getValidSeedBlocks(_a) {
|
|
25925
26031
|
var _b, _c;
|
|
25926
|
-
var provisionalPositioning = _a.provisionalPositioning, returnAllProxies = _a.returnAllProxies, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, allPositions = _a.allPositions, structure = _a.structure;
|
|
26032
|
+
var provisionalPositioning = _a.provisionalPositioning, returnAllProxies = _a.returnAllProxies, appliedPolicies = _a.appliedPolicies, seedingProfile = _a.seedingProfile, drawDefinition = _a.drawDefinition, allPositions = _a.allPositions, structure = _a.structure;
|
|
25927
26033
|
var validSeedBlocks = [];
|
|
25928
26034
|
if (!structure)
|
|
25929
26035
|
return { error: MISSING_STRUCTURE };
|
|
@@ -25959,7 +26065,7 @@ function getValidSeedBlocks(_a) {
|
|
|
25959
26065
|
.reverse();
|
|
25960
26066
|
var firstRoundDrawPositions = uniqueDrawPositionsByRound.pop();
|
|
25961
26067
|
var firstRoundDrawPositionOffset = (firstRoundDrawPositions && Math.min.apply(Math, __spreadArray([], __read(firstRoundDrawPositions), false)) - 1) || 0;
|
|
25962
|
-
|
|
26068
|
+
seedingProfile = seedingProfile !== null && seedingProfile !== void 0 ? seedingProfile : (_c = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies.seeding) === null || _c === void 0 ? void 0 : _c.seedingProfile;
|
|
25963
26069
|
var baseDrawSize = (firstRoundDrawPositions === null || firstRoundDrawPositions === void 0 ? void 0 : firstRoundDrawPositions.length) || 0;
|
|
25964
26070
|
// firstRoundDrawPositions have been popped
|
|
25965
26071
|
// seedRangeDrawPositionBlocks determines FEED_IN
|
|
@@ -26003,6 +26109,7 @@ function getValidSeedBlocks(_a) {
|
|
|
26003
26109
|
});
|
|
26004
26110
|
(validSeedBlocks = getSeedBlockPattern({
|
|
26005
26111
|
drawPositionBlocks: drawPositionChunks_1,
|
|
26112
|
+
nonRandom: seedingProfile === null || seedingProfile === void 0 ? void 0 : seedingProfile.nonRandom,
|
|
26006
26113
|
positioning: positioning,
|
|
26007
26114
|
seedGroups: seedGroups,
|
|
26008
26115
|
}).validSeedBlocks);
|
|
@@ -26010,6 +26117,7 @@ function getValidSeedBlocks(_a) {
|
|
|
26010
26117
|
}
|
|
26011
26118
|
else if (isContainer) {
|
|
26012
26119
|
var result = getContainerBlocks({
|
|
26120
|
+
nonRandom: seedingProfile === null || seedingProfile === void 0 ? void 0 : seedingProfile.nonRandom,
|
|
26013
26121
|
seedingProfile: seedingProfile,
|
|
26014
26122
|
structure: structure,
|
|
26015
26123
|
});
|
|
@@ -26061,7 +26169,7 @@ function getValidSeedBlocks(_a) {
|
|
|
26061
26169
|
}
|
|
26062
26170
|
function getContainerBlocks(_a) {
|
|
26063
26171
|
var _b, _c;
|
|
26064
|
-
var seedingProfile = _a.seedingProfile, structure = _a.structure;
|
|
26172
|
+
var seedingProfile = _a.seedingProfile, structure = _a.structure, nonRandom = _a.nonRandom;
|
|
26065
26173
|
var containedStructures = structure.structures || [];
|
|
26066
26174
|
var roundRobinGroupsCount = containedStructures.length;
|
|
26067
26175
|
var positionAssignments = (_b = getPositionAssignments$1({
|
|
@@ -26083,28 +26191,42 @@ function getContainerBlocks(_a) {
|
|
|
26083
26191
|
drawPositionBlocks: drawPositionBlocks,
|
|
26084
26192
|
positioning: positioning,
|
|
26085
26193
|
seedGroups: seedGroups,
|
|
26194
|
+
nonRandom: nonRandom,
|
|
26086
26195
|
});
|
|
26087
26196
|
}
|
|
26088
26197
|
function getSeedBlockPattern(_a) {
|
|
26089
|
-
var positioning = _a.positioning, seedGroups = _a.seedGroups,
|
|
26198
|
+
var drawPositionBlocks = _a.drawPositionBlocks, positioning = _a.positioning, seedGroups = _a.seedGroups, nonRandom = _a.nonRandom;
|
|
26090
26199
|
var validSeedBlocks = [];
|
|
26091
|
-
var
|
|
26092
|
-
|
|
26200
|
+
var divisionGroupings = generateBlockPattern({
|
|
26201
|
+
size: seedGroups.length,
|
|
26202
|
+
positioning: positioning,
|
|
26203
|
+
}).divisionGroupings;
|
|
26093
26204
|
var assignedPositions = [];
|
|
26094
26205
|
seedGroups.forEach(function (seedGroup, i) {
|
|
26095
|
-
|
|
26096
|
-
|
|
26097
|
-
|
|
26206
|
+
var relativePositions = getSubBlock({
|
|
26207
|
+
blockPattern: divisionGroupings,
|
|
26208
|
+
index: i,
|
|
26209
|
+
});
|
|
26098
26210
|
seedGroup.forEach(function (seedNumber, j) {
|
|
26099
26211
|
var blockIndex = i % 2 ? drawPositionBlocks.length - j - 1 : j;
|
|
26100
|
-
var
|
|
26101
|
-
|
|
26102
|
-
|
|
26103
|
-
|
|
26104
|
-
|
|
26105
|
-
|
|
26106
|
-
|
|
26107
|
-
|
|
26212
|
+
var block = drawPositionBlocks[blockIndex].slice();
|
|
26213
|
+
var consideredDrawPositions = block.filter(function (drawPosition, i) { return relativePositions.includes(i + 1) && drawPosition; });
|
|
26214
|
+
if (positioning !== WATERFALL) {
|
|
26215
|
+
consideredDrawPositions = nonRandom
|
|
26216
|
+
? consideredDrawPositions
|
|
26217
|
+
: shuffleArray(consideredDrawPositions);
|
|
26218
|
+
}
|
|
26219
|
+
else if (i % 2) {
|
|
26220
|
+
consideredDrawPositions.reverse();
|
|
26221
|
+
}
|
|
26222
|
+
var drawPosition = consideredDrawPositions.find(function (drawPosition) { return !assignedPositions.includes(drawPosition); });
|
|
26223
|
+
if (drawPosition) {
|
|
26224
|
+
assignedPositions.push(drawPosition);
|
|
26225
|
+
validSeedBlocks.push({
|
|
26226
|
+
seedNumbers: [seedNumber],
|
|
26227
|
+
drawPositions: [drawPosition],
|
|
26228
|
+
});
|
|
26229
|
+
}
|
|
26108
26230
|
});
|
|
26109
26231
|
});
|
|
26110
26232
|
return { validSeedBlocks: validSeedBlocks };
|
|
@@ -26172,7 +26294,7 @@ function isValidSeedPosition(_a) {
|
|
|
26172
26294
|
}
|
|
26173
26295
|
function getNextSeedBlock(params) {
|
|
26174
26296
|
var _a, _b, _c;
|
|
26175
|
-
var provisionalPositioning = params.provisionalPositioning, drawDefinition = params.drawDefinition, seedBlockInfo = params.seedBlockInfo, structureId = params.structureId, randomize = params.randomize;
|
|
26297
|
+
var provisionalPositioning = params.provisionalPositioning, drawDefinition = params.drawDefinition, seedingProfile = params.seedingProfile, seedBlockInfo = params.seedBlockInfo, structureId = params.structureId, randomize = params.randomize;
|
|
26176
26298
|
var structure = findStructure({ drawDefinition: drawDefinition, structureId: structureId }).structure;
|
|
26177
26299
|
var seedAssignments = getStructureSeedAssignments({
|
|
26178
26300
|
returnAllProxies: params.returnAllProxies,
|
|
@@ -26191,6 +26313,7 @@ function getNextSeedBlock(params) {
|
|
|
26191
26313
|
provisionalPositioning: provisionalPositioning,
|
|
26192
26314
|
appliedPolicies: appliedPolicies,
|
|
26193
26315
|
drawDefinition: drawDefinition,
|
|
26316
|
+
seedingProfile: seedingProfile,
|
|
26194
26317
|
structure: structure,
|
|
26195
26318
|
})) === null || _a === void 0 ? void 0 : _a.validSeedBlocks));
|
|
26196
26319
|
var unfilledSeedBlocks = (validSeedBlocks || []).filter(function (seedBlock) {
|
|
@@ -30140,7 +30263,7 @@ function getParticipantEntries(params) {
|
|
|
30140
30263
|
potentialMatchUps[consideredItem.matchUpId];
|
|
30141
30264
|
var consideredMinutes = timeStringMinutes(consideredItem.scheduledTime);
|
|
30142
30265
|
var minutesDifference = Math.abs(consideredMinutes - scheduledMinutes);
|
|
30143
|
-
var itemIsPrior = consideredMinutes
|
|
30266
|
+
var itemIsPrior = consideredMinutes >= scheduledMinutes;
|
|
30144
30267
|
// Conflicts can be determined in two ways:
|
|
30145
30268
|
// 1. scheduledMinutesDifference - the minutes difference between two scheduledTimes
|
|
30146
30269
|
// 2. A scheduledTime occurring before a prior matchUps notBeforeTime (timeAfterRecovery)
|
|
@@ -45573,12 +45696,13 @@ function nestArray(arr) {
|
|
|
45573
45696
|
|
|
45574
45697
|
function getSeedOrderByePositions(_a) {
|
|
45575
45698
|
var _b, _c;
|
|
45576
|
-
var provisionalPositioning = _a.provisionalPositioning, relevantMatchUps = _a.relevantMatchUps, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, byesToPlace = _a.byesToPlace, structure = _a.structure;
|
|
45699
|
+
var provisionalPositioning = _a.provisionalPositioning, relevantMatchUps = _a.relevantMatchUps, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, seedingProfile = _a.seedingProfile, seedBlockInfo = _a.seedBlockInfo, byesToPlace = _a.byesToPlace, structure = _a.structure;
|
|
45577
45700
|
if (!seedBlockInfo) {
|
|
45578
45701
|
seedBlockInfo = getValidSeedBlocks({
|
|
45579
45702
|
provisionalPositioning: provisionalPositioning,
|
|
45580
45703
|
appliedPolicies: appliedPolicies,
|
|
45581
45704
|
drawDefinition: drawDefinition,
|
|
45705
|
+
seedingProfile: seedingProfile,
|
|
45582
45706
|
structure: structure,
|
|
45583
45707
|
});
|
|
45584
45708
|
}
|
|
@@ -45872,7 +45996,7 @@ function getByesData(_a) {
|
|
|
45872
45996
|
function positionByes(_a) {
|
|
45873
45997
|
var e_1, _b;
|
|
45874
45998
|
var _c, _d;
|
|
45875
|
-
var provisionalPositioning = _a.provisionalPositioning, tournamentRecord = _a.tournamentRecord, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId, structure = _a.structure, seedLimit = _a.seedLimit, seedsOnly = _a.seedsOnly, event = _a.event;
|
|
45999
|
+
var provisionalPositioning = _a.provisionalPositioning, tournamentRecord = _a.tournamentRecord, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, seedingProfile = _a.seedingProfile, matchUpsMap = _a.matchUpsMap, structureId = _a.structureId, structure = _a.structure, seedLimit = _a.seedLimit, seedsOnly = _a.seedsOnly, event = _a.event;
|
|
45876
46000
|
if (!structure)
|
|
45877
46001
|
(structure = findStructure({ drawDefinition: drawDefinition, structureId: structureId }).structure);
|
|
45878
46002
|
if (!structureId)
|
|
@@ -45893,6 +46017,7 @@ function positionByes(_a) {
|
|
|
45893
46017
|
relevantMatchUps: relevantMatchUps,
|
|
45894
46018
|
appliedPolicies: appliedPolicies,
|
|
45895
46019
|
drawDefinition: drawDefinition,
|
|
46020
|
+
seedingProfile: seedingProfile,
|
|
45896
46021
|
seedBlockInfo: seedBlockInfo,
|
|
45897
46022
|
byesToPlace: byesToPlace,
|
|
45898
46023
|
structure: structure,
|
|
@@ -46103,6 +46228,7 @@ function positionSeedBlocks(_a) {
|
|
|
46103
46228
|
provisionalPositioning: provisionalPositioning,
|
|
46104
46229
|
appliedPolicies: appliedPolicies,
|
|
46105
46230
|
drawDefinition: drawDefinition,
|
|
46231
|
+
seedingProfile: seedingProfile,
|
|
46106
46232
|
structure: structure,
|
|
46107
46233
|
});
|
|
46108
46234
|
if (result === null || result === void 0 ? void 0 : result.error)
|
|
@@ -46145,6 +46271,7 @@ function positionSeedBlock(_a) {
|
|
|
46145
46271
|
provisionalPositioning: provisionalPositioning,
|
|
46146
46272
|
randomize: true,
|
|
46147
46273
|
drawDefinition: drawDefinition,
|
|
46274
|
+
seedingProfile: seedingProfile,
|
|
46148
46275
|
seedBlockInfo: seedBlockInfo,
|
|
46149
46276
|
structureId: structureId,
|
|
46150
46277
|
event: event,
|
|
@@ -46257,6 +46384,7 @@ function automatedPositioning$1(_a) {
|
|
|
46257
46384
|
provisionalPositioning: provisionalPositioning,
|
|
46258
46385
|
appliedPolicies: appliedPolicies,
|
|
46259
46386
|
drawDefinition: drawDefinition,
|
|
46387
|
+
seedingProfile: seedingProfile,
|
|
46260
46388
|
structure: structure,
|
|
46261
46389
|
});
|
|
46262
46390
|
if (seedBlockInfo.error)
|
|
@@ -51776,7 +51904,7 @@ function getEligibleVoluntaryConsolationParticipants$1(_a) {
|
|
|
51776
51904
|
}
|
|
51777
51905
|
|
|
51778
51906
|
function getNextUnfilledDrawPositions(_a) {
|
|
51779
|
-
var provisionalPositioning = _a.provisionalPositioning, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, structureId = _a.structureId, event = _a.event;
|
|
51907
|
+
var provisionalPositioning = _a.provisionalPositioning, drawDefinition = _a.drawDefinition, seedBlockInfo = _a.seedBlockInfo, seedingProfile = _a.seedingProfile, structureId = _a.structureId, event = _a.event;
|
|
51780
51908
|
if (!drawDefinition) {
|
|
51781
51909
|
var error = MISSING_DRAW_DEFINITION;
|
|
51782
51910
|
return { error: error, nextUnfilledDrawPositions: [] };
|
|
@@ -51796,6 +51924,7 @@ function getNextUnfilledDrawPositions(_a) {
|
|
|
51796
51924
|
provisionalPositioning: provisionalPositioning,
|
|
51797
51925
|
randomize: true,
|
|
51798
51926
|
drawDefinition: drawDefinition,
|
|
51927
|
+
seedingProfile: seedingProfile,
|
|
51799
51928
|
seedBlockInfo: seedBlockInfo,
|
|
51800
51929
|
structureId: structureId,
|
|
51801
51930
|
event: event,
|
|
@@ -52082,7 +52211,7 @@ function getValidLuckyLosersAction(_a) {
|
|
|
52082
52211
|
|
|
52083
52212
|
function getValidAssignmentActions(_a) {
|
|
52084
52213
|
var _b, _c, _d;
|
|
52085
|
-
var positionSourceStructureIds = _a.positionSourceStructureIds, unassignedParticipantIds = _a.unassignedParticipantIds, possiblyDisablingAction = _a.possiblyDisablingAction, provisionalPositioning = _a.provisionalPositioning, tournamentParticipants = _a.tournamentParticipants, isWinRatioFedStructure = _a.isWinRatioFedStructure, positionAssignments = _a.positionAssignments, returnParticipants = _a.returnParticipants, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, isByePosition = _a.isByePosition, drawPosition = _a.drawPosition, structureId = _a.structureId, event = _a.event;
|
|
52214
|
+
var positionSourceStructureIds = _a.positionSourceStructureIds, unassignedParticipantIds = _a.unassignedParticipantIds, possiblyDisablingAction = _a.possiblyDisablingAction, provisionalPositioning = _a.provisionalPositioning, tournamentParticipants = _a.tournamentParticipants, isWinRatioFedStructure = _a.isWinRatioFedStructure, positionAssignments = _a.positionAssignments, returnParticipants = _a.returnParticipants, appliedPolicies = _a.appliedPolicies, drawDefinition = _a.drawDefinition, seedingProfile = _a.seedingProfile, isByePosition = _a.isByePosition, drawPosition = _a.drawPosition, structureId = _a.structureId, event = _a.event;
|
|
52086
52215
|
var drawId = drawDefinition.drawId;
|
|
52087
52216
|
var validAssignmentActions = [];
|
|
52088
52217
|
var unplacedSeedParticipantIds, unplacedSeedAssignments, unfilledPositions = [];
|
|
@@ -52093,6 +52222,7 @@ function getValidAssignmentActions(_a) {
|
|
|
52093
52222
|
returnAllProxies: true,
|
|
52094
52223
|
randomize: true,
|
|
52095
52224
|
drawDefinition: drawDefinition,
|
|
52225
|
+
seedingProfile: seedingProfile,
|
|
52096
52226
|
structureId: structureId,
|
|
52097
52227
|
event: event,
|
|
52098
52228
|
});
|
|
@@ -64120,6 +64250,7 @@ function prepareStage(params) {
|
|
|
64120
64250
|
provisionalPositioning: provisionalPositioning,
|
|
64121
64251
|
appliedPolicies: appliedPolicies,
|
|
64122
64252
|
drawDefinition: drawDefinition,
|
|
64253
|
+
seedingProfile: seedingProfile,
|
|
64123
64254
|
structure: structure,
|
|
64124
64255
|
})
|
|
64125
64256
|
: undefined;
|
|
@@ -64265,10 +64396,10 @@ function prepareStage(params) {
|
|
|
64265
64396
|
|
|
64266
64397
|
function generateDrawDefinition(params) {
|
|
64267
64398
|
var e_1, _a, e_2, _b, e_3, _c, e_4, _d, _e, e_5, _f, e_6, _g, _h;
|
|
64268
|
-
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, _22, _23, _24;
|
|
64399
|
+
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, _22, _23, _24, _25;
|
|
64269
64400
|
var stack = 'generateDrawDefinition';
|
|
64270
|
-
var
|
|
64271
|
-
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;
|
|
64401
|
+
var _26 = params.considerEventEntries, considerEventEntries = _26 === void 0 ? true : _26, // in the absence of drawSize and drawEntries, look to event.entries
|
|
64402
|
+
ignoreAllowedDrawTypes = params.ignoreAllowedDrawTypes, voluntaryConsolation = params.voluntaryConsolation, hydrateCollections = params.hydrateCollections, policyDefinitions = params.policyDefinitions, ignoreStageSpace = params.ignoreStageSpace, tournamentRecord = params.tournamentRecord, qualifyingOnly = params.qualifyingOnly, seedingProfile = params.seedingProfile, tieFormatName = params.tieFormatName, drawEntries = params.drawEntries, addToEvent = params.addToEvent, placeByes = params.placeByes, event = params.event;
|
|
64272
64403
|
var appliedPolicies = (_j = getAppliedPolicies({
|
|
64273
64404
|
tournamentRecord: tournamentRecord,
|
|
64274
64405
|
event: event,
|
|
@@ -64281,10 +64412,10 @@ function generateDrawDefinition(params) {
|
|
|
64281
64412
|
DrawTypeEnum.SingleElimination;
|
|
64282
64413
|
// get participants both for entry validation and for automated placement
|
|
64283
64414
|
// automated placement requires them to be "inContext" for avoidance policies to work
|
|
64284
|
-
var
|
|
64415
|
+
var _27 = getParticipants$1({
|
|
64285
64416
|
withIndividualParticipants: true,
|
|
64286
64417
|
tournamentRecord: tournamentRecord,
|
|
64287
|
-
}), participants =
|
|
64418
|
+
}), participants = _27.participants, participantMap = _27.participantMap;
|
|
64288
64419
|
var enforceGender = (_r = (_o = params.enforceGender) !== null && _o !== void 0 ? _o : (_q = (_p = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _p === void 0 ? void 0 : _p.participants) === null || _q === void 0 ? void 0 : _q.enforceGender) !== null && _r !== void 0 ? _r : (_t = (_s = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_MATCHUP_ACTIONS]) === null || _s === void 0 ? void 0 : _s.participants) === null || _t === void 0 ? void 0 : _t.enforceGender;
|
|
64289
64420
|
// if tournamentRecord is provided, and unless instructed to ignore valid types,
|
|
64290
64421
|
// check for restrictions on allowed drawTypes
|
|
@@ -64454,8 +64585,8 @@ function generateDrawDefinition(params) {
|
|
|
64454
64585
|
else {
|
|
64455
64586
|
var policiesToAttach = {};
|
|
64456
64587
|
try {
|
|
64457
|
-
for (var
|
|
64458
|
-
var key =
|
|
64588
|
+
for (var _28 = __values(Object.keys(policyDefinitions)), _29 = _28.next(); !_29.done; _29 = _28.next()) {
|
|
64589
|
+
var key = _29.value;
|
|
64459
64590
|
if (JSON.stringify(appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[key]) !==
|
|
64460
64591
|
JSON.stringify(policyDefinitions[key])) {
|
|
64461
64592
|
policiesToAttach[key] = policyDefinitions[key];
|
|
@@ -64465,7 +64596,7 @@ function generateDrawDefinition(params) {
|
|
|
64465
64596
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
64466
64597
|
finally {
|
|
64467
64598
|
try {
|
|
64468
|
-
if (
|
|
64599
|
+
if (_29 && !_29.done && (_a = _28.return)) _a.call(_28);
|
|
64469
64600
|
}
|
|
64470
64601
|
finally { if (e_1) throw e_1.error; }
|
|
64471
64602
|
}
|
|
@@ -64517,7 +64648,7 @@ function generateDrawDefinition(params) {
|
|
|
64517
64648
|
var source = _a.source;
|
|
64518
64649
|
return source.structureId !== existingQualifyingPlaceholderStructureId;
|
|
64519
64650
|
});
|
|
64520
|
-
var
|
|
64651
|
+
var _30 = qualifyingResult !== null && qualifyingResult !== void 0 ? qualifyingResult : {}, qualifiersCount = _30.qualifiersCount, qualifyingDrawPositionsCount = _30.qualifyingDrawPositionsCount, qualifyingDetails = _30.qualifyingDetails;
|
|
64521
64652
|
if (qualifyingDrawPositionsCount) {
|
|
64522
64653
|
if (qualifyingResult === null || qualifyingResult === void 0 ? void 0 : qualifyingResult.structures) {
|
|
64523
64654
|
(_13 = drawDefinition.structures) === null || _13 === void 0 ? void 0 : _13.push.apply(_13, __spreadArray([], __read(qualifyingResult.structures), false));
|
|
@@ -64552,11 +64683,11 @@ function generateDrawDefinition(params) {
|
|
|
64552
64683
|
if (result.error)
|
|
64553
64684
|
return result;
|
|
64554
64685
|
try {
|
|
64555
|
-
for (var
|
|
64686
|
+
for (var _31 = __values((drawEntries !== null && drawEntries !== void 0 ? drawEntries : []).filter(function (_a) {
|
|
64556
64687
|
var entryStage = _a.entryStage;
|
|
64557
64688
|
return entryStage === StageTypeEnum.Qualifying;
|
|
64558
|
-
})),
|
|
64559
|
-
var entry =
|
|
64689
|
+
})), _32 = _31.next(); !_32.done; _32 = _31.next()) {
|
|
64690
|
+
var entry = _32.value;
|
|
64560
64691
|
var entryData = __assign(__assign({}, entry), { entryStage: (_16 = entry.entryStage) !== null && _16 !== void 0 ? _16 : StageTypeEnum.Main, drawDefinition: drawDefinition });
|
|
64561
64692
|
// ignore errors (EXITING_PARTICIPANT)
|
|
64562
64693
|
addDrawEntry(entryData);
|
|
@@ -64565,13 +64696,13 @@ function generateDrawDefinition(params) {
|
|
|
64565
64696
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
64566
64697
|
finally {
|
|
64567
64698
|
try {
|
|
64568
|
-
if (
|
|
64699
|
+
if (_32 && !_32.done && (_b = _31.return)) _b.call(_31);
|
|
64569
64700
|
}
|
|
64570
64701
|
finally { if (e_2) throw e_2.error; }
|
|
64571
64702
|
}
|
|
64572
64703
|
try {
|
|
64573
|
-
for (var
|
|
64574
|
-
var qualifyingDetail =
|
|
64704
|
+
for (var _33 = __values(qualifyingDetails || []), _34 = _33.next(); !_34.done; _34 = _33.next()) {
|
|
64705
|
+
var qualifyingDetail = _34.value;
|
|
64575
64706
|
var qualifyingRoundNumber = qualifyingDetail.finalQualifyingRoundNumber, qualifyingStructureId = qualifyingDetail.finalQualifyingStructureId, targetEntryRound = qualifyingDetail.roundTarget, finishingPositions = qualifyingDetail.finishingPositions, linkType = qualifyingDetail.linkType;
|
|
64576
64707
|
var link = mainStructure &&
|
|
64577
64708
|
((_17 = generateQualifyingLink({
|
|
@@ -64594,7 +64725,7 @@ function generateDrawDefinition(params) {
|
|
|
64594
64725
|
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
64595
64726
|
finally {
|
|
64596
64727
|
try {
|
|
64597
|
-
if (
|
|
64728
|
+
if (_34 && !_34.done && (_c = _33.return)) _c.call(_33);
|
|
64598
64729
|
}
|
|
64599
64730
|
finally { if (e_3) throw e_3.error; }
|
|
64600
64731
|
}
|
|
@@ -64635,7 +64766,7 @@ function generateDrawDefinition(params) {
|
|
|
64635
64766
|
if (drawType === LUCKY_DRAW)
|
|
64636
64767
|
seedsCount = 0;
|
|
64637
64768
|
var structureResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { qualifyingOnly: !drawSize || qualifyingOnly, // ooo!! If there is no drawSize then MAIN is not being generated
|
|
64638
|
-
appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, participants: participants, stage: MAIN, seedsCount: seedsCount, placeByes: placeByes, drawSize: drawSize, entries: entries }));
|
|
64769
|
+
appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, seedingProfile: seedingProfile, participants: participants, stage: MAIN, seedsCount: seedsCount, placeByes: placeByes, drawSize: drawSize, entries: entries }));
|
|
64639
64770
|
if (structureResult.error && !structureResult.conflicts) {
|
|
64640
64771
|
return structureResult;
|
|
64641
64772
|
}
|
|
@@ -64692,8 +64823,8 @@ function generateDrawDefinition(params) {
|
|
|
64692
64823
|
var roundTarget = 1;
|
|
64693
64824
|
params.qualifyingProfiles.sort(roundTargetSort);
|
|
64694
64825
|
try {
|
|
64695
|
-
for (var
|
|
64696
|
-
var roundTargetProfile =
|
|
64826
|
+
for (var _35 = __values(params.qualifyingProfiles), _36 = _35.next(); !_36.done; _36 = _35.next()) {
|
|
64827
|
+
var roundTargetProfile = _36.value;
|
|
64697
64828
|
if (!Array.isArray(roundTargetProfile.structureProfiles))
|
|
64698
64829
|
return decorateResult({
|
|
64699
64830
|
info: mustBeAnArray('structureProfiles'),
|
|
@@ -64706,8 +64837,8 @@ function generateDrawDefinition(params) {
|
|
|
64706
64837
|
try {
|
|
64707
64838
|
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()) {
|
|
64708
64839
|
var structureProfile = sortedStructureProfiles_1_1.value;
|
|
64709
|
-
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName,
|
|
64710
|
-
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,
|
|
64840
|
+
var qualifyingRoundNumber = structureProfile.qualifyingRoundNumber, qualifyingPositions = structureProfile.qualifyingPositions, seededParticipants = structureProfile.seededParticipants, seedingScaleName = structureProfile.seedingScaleName, _37 = structureProfile.seedsCount, seedsCount_1 = _37 === void 0 ? 0 : _37, seedByRanking = structureProfile.seedByRanking, placeByes_1 = structureProfile.placeByes, drawSize_1 = structureProfile.drawSize;
|
|
64841
|
+
var qualifyingStageResult = prepareStage(__assign(__assign(__assign({}, drawTypeResult), params), { seedingProfile: (_22 = structureProfile.seedingProfile) !== null && _22 !== void 0 ? _22 : seedingProfile, stageSequence: sequence, qualifyingRoundNumber: qualifyingRoundNumber, preparedStructureIds: preparedStructureIds, qualifyingPositions: qualifyingPositions, seededParticipants: seededParticipants, stage: QUALIFYING, seedingScaleName: seedingScaleName, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, qualifyingOnly: qualifyingOnly, seedByRanking: seedByRanking, participants: participants, roundTarget: roundTarget, seedsCount: seedsCount_1, placeByes: placeByes_1, drawSize: drawSize_1, entries: entries }));
|
|
64711
64842
|
if (qualifyingStageResult.error) {
|
|
64712
64843
|
return qualifyingStageResult;
|
|
64713
64844
|
}
|
|
@@ -64715,9 +64846,9 @@ function generateDrawDefinition(params) {
|
|
|
64715
64846
|
preparedStructureIds.push(qualifyingStageResult.structureId);
|
|
64716
64847
|
}
|
|
64717
64848
|
sequence += 1;
|
|
64718
|
-
if ((
|
|
64849
|
+
if ((_23 = qualifyingStageResult.conflicts) === null || _23 === void 0 ? void 0 : _23.length)
|
|
64719
64850
|
qualifyingConflicts.push.apply(qualifyingConflicts, __spreadArray([], __read(qualifyingStageResult.conflicts), false));
|
|
64720
|
-
if ((
|
|
64851
|
+
if ((_24 = qualifyingStageResult.positioningReport) === null || _24 === void 0 ? void 0 : _24.length)
|
|
64721
64852
|
positioningReports.push((_h = {},
|
|
64722
64853
|
_h[QUALIFYING] = qualifyingStageResult.positioningReport,
|
|
64723
64854
|
_h));
|
|
@@ -64736,7 +64867,7 @@ function generateDrawDefinition(params) {
|
|
|
64736
64867
|
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
64737
64868
|
finally {
|
|
64738
64869
|
try {
|
|
64739
|
-
if (
|
|
64870
|
+
if (_36 && !_36.done && (_f = _35.return)) _f.call(_35);
|
|
64740
64871
|
}
|
|
64741
64872
|
finally { if (e_5) throw e_5.error; }
|
|
64742
64873
|
}
|
|
@@ -64760,7 +64891,7 @@ function generateDrawDefinition(params) {
|
|
|
64760
64891
|
drawDefinition.links.push(link);
|
|
64761
64892
|
}
|
|
64762
64893
|
drawDefinition.drawName =
|
|
64763
|
-
(
|
|
64894
|
+
(_25 = params.drawName) !== null && _25 !== void 0 ? _25 : (drawType && constantToString(drawType));
|
|
64764
64895
|
if (typeof voluntaryConsolation === 'object') {
|
|
64765
64896
|
addVoluntaryConsolationStructure(__assign(__assign({}, voluntaryConsolation), { tournamentRecord: tournamentRecord, appliedPolicies: appliedPolicies, drawDefinition: drawDefinition, matchUpType: matchUpType }));
|
|
64766
64897
|
}
|