tods-competition-factory 1.8.1 → 1.8.3

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/index.mjs CHANGED
@@ -333,7 +333,7 @@ const matchUpFormatCode = {
333
333
  };
334
334
 
335
335
  function factoryVersion() {
336
- return "1.8.1";
336
+ return "1.8.3";
337
337
  }
338
338
 
339
339
  function getObjectTieFormat(obj) {
@@ -6441,20 +6441,20 @@ const ROUND_ROBIN_WITH_PLAYOFF = "ROUND_ROBIN_WITH_PLAYOFF";
6441
6441
  const DECIDER = "DECIDER";
6442
6442
  const BACKDRAW = "BACKDRAW";
6443
6443
  const COMPASS_ATTRIBUTES = {
6444
- 0: { name: "EAST", abbreviation: "E" },
6445
- "0-1": { name: "WEST", abbreviation: "W" },
6446
- "0-2": { name: "NORTH", abbreviation: "N" },
6447
- "0-3": { name: "NORTHEAST", abbreviation: "NE" },
6448
- "0-1-1": { name: "SOUTH", abbreviation: "S" },
6449
- "0-1-2": { name: "SOUTHWEST", abbreviation: "SW" },
6450
- "0-2-1": { name: "NORTHWEST", abbreviation: "NW" },
6451
- "0-1-1-1": { name: "SOUTHEAST", abbreviation: "SE" }
6444
+ 0: { name: "East", abbreviation: "E" },
6445
+ "0-1": { name: "West", abbreviation: "W" },
6446
+ "0-2": { name: "North", abbreviation: "N" },
6447
+ "0-3": { name: "Northeast", abbreviation: "NE" },
6448
+ "0-1-1": { name: "South", abbreviation: "S" },
6449
+ "0-1-2": { name: "Southwest", abbreviation: "SW" },
6450
+ "0-2-1": { name: "Northwest", abbreviation: "NW" },
6451
+ "0-1-1-1": { name: "Southeast", abbreviation: "SE" }
6452
6452
  };
6453
6453
  const OLYMPIC_ATTRIBUTES = {
6454
- 0: { name: "EAST", abbreviation: "E" },
6455
- "0-1": { name: "WEST", abbreviation: "W" },
6456
- "0-2": { name: "NORTH", abbreviation: "N" },
6457
- "0-1-1": { name: "SOUTH", abbreviation: "S" }
6454
+ 0: { name: "East", abbreviation: "E" },
6455
+ "0-1": { name: "West", abbreviation: "W" },
6456
+ "0-2": { name: "North", abbreviation: "N" },
6457
+ "0-1-1": { name: "South", abbreviation: "S" }
6458
6458
  };
6459
6459
  const WIN_RATIO = "WIN_RATIO";
6460
6460
  const ROUND_OUTCOME = "ROUND_OUTCOME";
@@ -15183,6 +15183,144 @@ const fixtures = {
15183
15183
  flagIOC
15184
15184
  };
15185
15185
 
15186
+ const logColors = {
15187
+ reset: "\x1B[0m",
15188
+ bright: "\x1B[1m",
15189
+ dim: "\x1B[2m",
15190
+ red: "\x1B[31m",
15191
+ brightred: "\x1B[91m",
15192
+ green: "\x1B[32m",
15193
+ brightgreen: "\x1B[92m",
15194
+ yellow: "\x1B[33m",
15195
+ brightyellow: "\x1B[93m",
15196
+ blue: "\x1B[34m",
15197
+ brightblue: "\x1B[94m",
15198
+ lightblue: "\x1B[105m",
15199
+ magenta: "\x1B[35m",
15200
+ brightmagenta: "\x1B[95m",
15201
+ cyan: "\x1B[36m",
15202
+ brightcyan: "\x1B[96m",
15203
+ white: "\x1B[37m",
15204
+ brightwhite: "\x1B[97m"
15205
+ };
15206
+
15207
+ const globalLog = [];
15208
+ function pushGlobalLog(value, devContextOverride) {
15209
+ if (typeof value === "string")
15210
+ value = { method: value };
15211
+ if (devContextOverride || getDevContext())
15212
+ globalLog.push(value);
15213
+ }
15214
+ function getGlobalLog(purge) {
15215
+ const globalLogCopy = globalLog.slice();
15216
+ if (purge) {
15217
+ globalLog.length = 0;
15218
+ }
15219
+ return globalLogCopy;
15220
+ }
15221
+ function printGlobalLog(purge) {
15222
+ const globalLogCopy = getGlobalLog(purge);
15223
+ const modifiedText = globalLogCopy.map((line) => {
15224
+ const { color, keyColors, method, newline } = line;
15225
+ const methodColor = Object.keys(logColors).includes(color) ? logColors[color] : logColors.cyan;
15226
+ const bodyKeys = Object.keys(line).filter(
15227
+ (key) => !["color", "keyColors", "method", "newline"].includes(key)
15228
+ );
15229
+ const body = bodyKeys.map((key) => {
15230
+ const keyColor = keyColors && Object.keys(keyColors).includes(key) && logColors[keyColors[key]] ? logColors[keyColors[key]] : logColors.brightwhite;
15231
+ return `${logColors.white}${key}: ${keyColor}${line[key]}`;
15232
+ }).join(", ");
15233
+ const tabs = method?.length < 15 ? ` ` : " ";
15234
+ return [
15235
+ newline ? "\n" : "",
15236
+ methodColor,
15237
+ method,
15238
+ tabs,
15239
+ logColors.white,
15240
+ body,
15241
+ logColors.reset,
15242
+ "\n"
15243
+ ].join("");
15244
+ });
15245
+ if (modifiedText?.length)
15246
+ console.log(...modifiedText);
15247
+ }
15248
+ function purgeGlobalLog() {
15249
+ globalLog.length = 0;
15250
+ }
15251
+
15252
+ function visualizeScheduledMatchUps({
15253
+ scheduledMatchUps,
15254
+ showGlobalLog
15255
+ }) {
15256
+ purgeGlobalLog();
15257
+ const structureIds = scheduledMatchUps?.reduce(
15258
+ (structureIds2, { structureId }) => structureIds2.includes(structureId) ? structureIds2 : structureIds2.concat(structureId),
15259
+ []
15260
+ );
15261
+ const structureNames = Object.assign(
15262
+ {},
15263
+ ...(structureIds || []).map((structureId) => {
15264
+ const { structureName, matchUpType } = scheduledMatchUps.find(
15265
+ (matchUp) => matchUp.structureId === structureId
15266
+ );
15267
+ return {
15268
+ [structureId]: `${structureName} ${matchUpType}`
15269
+ };
15270
+ })
15271
+ );
15272
+ structureIds?.forEach((structureId) => {
15273
+ pushGlobalLog(
15274
+ {
15275
+ color: "blue",
15276
+ method: "draw",
15277
+ structure: structureNames[structureId],
15278
+ keyColors: {
15279
+ structure: "magenta"
15280
+ }
15281
+ },
15282
+ true
15283
+ );
15284
+ const structureMatchUps = scheduledMatchUps.filter(
15285
+ (matchUp) => matchUp.structureId === structureId
15286
+ );
15287
+ const roundMatchUps = getRoundMatchUps$1({
15288
+ matchUps: structureMatchUps
15289
+ })?.roundMatchUps || [];
15290
+ Object.keys(roundMatchUps).forEach((roundNumber) => {
15291
+ pushGlobalLog(
15292
+ {
15293
+ roundNumber,
15294
+ keyColors: {
15295
+ roundNumber: "brightcyan"
15296
+ }
15297
+ },
15298
+ true
15299
+ );
15300
+ roundMatchUps[roundNumber].forEach(({ matchUpId, schedule }) => {
15301
+ const scheduledTime = extractTime(schedule.scheduledTime);
15302
+ pushGlobalLog(
15303
+ {
15304
+ matchUpId,
15305
+ time: scheduledTime,
15306
+ date: schedule.scheduledDate,
15307
+ venue: schedule.venueId,
15308
+ keyColors: {
15309
+ time: "brightcyan",
15310
+ date: "brightcyan",
15311
+ matchUpId: "yellow",
15312
+ venue: "magenta"
15313
+ }
15314
+ },
15315
+ true
15316
+ );
15317
+ });
15318
+ });
15319
+ });
15320
+ if (showGlobalLog)
15321
+ printGlobalLog();
15322
+ }
15323
+
15186
15324
  function calculateWinCriteria({
15187
15325
  collectionDefinitions = [],
15188
15326
  collectionGroups = []
@@ -20660,11 +20798,6 @@ function getStructureDrawPositionProfiles(params) {
20660
20798
  };
20661
20799
  }
20662
20800
 
20663
- function pushGlobalLog(value, devContextOverride) {
20664
- if (devContextOverride || getDevContext())
20665
- ;
20666
- }
20667
-
20668
20801
  function clearDrawPosition(params) {
20669
20802
  let { inContextDrawMatchUps, participantId, drawPosition } = params;
20670
20803
  const { tournamentRecord, drawDefinition, structureId, matchUpsMap, event } = params;
@@ -20968,7 +21101,11 @@ function removeDrawPosition({
20968
21101
  const noChange = initialDrawPositions?.includes(drawPosition) && initialMatchUpStatus === targetMatchUp.matchUpStatus && initialWinningSide === targetMatchUp.winningSide;
20969
21102
  if (!noChange) {
20970
21103
  if (removedDrawPosition) {
20971
- pushGlobalLog();
21104
+ pushGlobalLog({
21105
+ method: stack,
21106
+ color: "brightyellow",
21107
+ removedDrawPosition
21108
+ });
20972
21109
  }
20973
21110
  modifyMatchUpNotice({
20974
21111
  tournamentId: tournamentRecord?.tournamentId,
@@ -21012,7 +21149,11 @@ function removeDrawPosition({
21012
21149
  matchUps: loserStructureMatchUps
21013
21150
  });
21014
21151
  if (initialRoundNumber2 === 1) {
21015
- pushGlobalLog();
21152
+ pushGlobalLog({
21153
+ method: stack,
21154
+ color: "brightyellow",
21155
+ loserMatchUpDrawPosition
21156
+ });
21016
21157
  drawPositionRemovals({
21017
21158
  structureId: loserMatchUp.structureId,
21018
21159
  drawPosition: loserMatchUpDrawPosition,
@@ -21461,7 +21602,7 @@ function assignDrawPositionBye$1({
21461
21602
  if (!structureId)
21462
21603
  ({ structureId } = structure);
21463
21604
  const stack = "assignDrawPositionBye";
21464
- pushGlobalLog();
21605
+ pushGlobalLog({ method: stack, color: "cyan", drawPosition });
21465
21606
  if (!matchUpsMap) {
21466
21607
  matchUpsMap = getMatchUpsMap({ drawDefinition });
21467
21608
  }
@@ -21645,7 +21786,8 @@ function advanceDrawPosition({
21645
21786
  matchUpId,
21646
21787
  event
21647
21788
  }) {
21648
- pushGlobalLog();
21789
+ const stack = "advanceDrawPosition";
21790
+ pushGlobalLog({ method: stack, color: "cyan", drawPositionToAdvance });
21649
21791
  const matchUp = matchUpsMap.drawMatchUps.find(
21650
21792
  (matchUp2) => matchUp2.matchUpId === matchUpId
21651
21793
  );
@@ -21788,10 +21930,16 @@ function advanceWinner({
21788
21930
  winningSide: void 0,
21789
21931
  drawPositions
21790
21932
  });
21791
- noContextWinnerMatchUp.drawPositions.find(
21933
+ const changedDrawPosition = noContextWinnerMatchUp.drawPositions.find(
21792
21934
  (position) => !twoDrawPositions.includes(position)
21793
21935
  );
21794
- pushGlobalLog();
21936
+ pushGlobalLog({
21937
+ method: stack,
21938
+ color: "brightyellow",
21939
+ changedDrawPosition,
21940
+ pairedDrawPositionIsBye,
21941
+ drawPositionIsBye
21942
+ });
21795
21943
  modifyMatchUpNotice({
21796
21944
  tournamentId: tournamentRecord?.tournamentId,
21797
21945
  matchUp: noContextWinnerMatchUp,
@@ -21855,7 +22003,8 @@ function assignFedDrawPositionBye({
21855
22003
  event
21856
22004
  }) {
21857
22005
  const { roundNumber } = loserMatchUp;
21858
- pushGlobalLog();
22006
+ const stack = "assignFedDrawPositionBye";
22007
+ pushGlobalLog({ method: stack, color: "cyan", loserTargetDrawPosition });
21859
22008
  const mappedMatchUps = matchUpsMap?.mappedMatchUps || {};
21860
22009
  const loserStructureMatchUps = mappedMatchUps[loserMatchUp.structureId].matchUps;
21861
22010
  const { initialRoundNumber } = getInitialRoundNumber({
@@ -22961,6 +23110,7 @@ const structureTemplate = ({
22961
23110
 
22962
23111
  function generateRoundRobin({
22963
23112
  structureName = constantToString(MAIN),
23113
+ groupNameBase = "Group",
22964
23114
  stageSequence = 1,
22965
23115
  structureOptions,
22966
23116
  appliedPolicies,
@@ -22994,7 +23144,7 @@ function generateRoundRobin({
22994
23144
  ...matchUps.map(({ roundNumber }) => roundNumber)
22995
23145
  );
22996
23146
  return structureTemplate({
22997
- structureName: `Group ${structureOrder}`,
23147
+ structureName: `${groupNameBase} ${structureOrder}`,
22998
23148
  structureId: uuids?.pop(),
22999
23149
  structureType: ITEM,
23000
23150
  finishingPosition,
@@ -24844,6 +24994,12 @@ function attemptToSetWinningSide(params) {
24844
24994
  });
24845
24995
  }
24846
24996
 
24997
+ const keyColors = {
24998
+ drawPositionToRemove: "green",
24999
+ iteration: "brightred",
25000
+ winner: "green",
25001
+ loser: "brightred"
25002
+ };
24847
25003
  function removeDoubleExit(params) {
24848
25004
  const {
24849
25005
  inContextDrawMatchUps,
@@ -24856,13 +25012,25 @@ function removeDoubleExit(params) {
24856
25012
  let { iteration = 0 } = params;
24857
25013
  iteration += 1;
24858
25014
  const stack = "removeDoubleExit";
24859
- pushGlobalLog();
25015
+ pushGlobalLog({
25016
+ method: stack,
25017
+ color: "brightyellow",
25018
+ iteration,
25019
+ keyColors
25020
+ });
24860
25021
  const {
24861
25022
  targetLinks: { loserTargetLink },
24862
25023
  targetMatchUps: { loserMatchUp, winnerMatchUp, loserTargetDrawPosition }
24863
25024
  } = targetData;
24864
25025
  if (winnerMatchUp && winnerMatchUp.matchUpStatus !== BYE) {
24865
- pushGlobalLog();
25026
+ const { stage, roundNumber, roundPosition } = winnerMatchUp;
25027
+ pushGlobalLog({
25028
+ winner: "winner",
25029
+ stage,
25030
+ roundNumber,
25031
+ roundPosition,
25032
+ keyColors
25033
+ });
24866
25034
  conditionallyRemoveDrawPosition({
24867
25035
  ...params,
24868
25036
  targetMatchUp: winnerMatchUp,
@@ -24878,7 +25046,15 @@ function removeDoubleExit(params) {
24878
25046
  drawDefinition,
24879
25047
  structureId: inContextLoserMatchUp.structureId
24880
25048
  });
24881
- pushGlobalLog();
25049
+ const { stage, roundNumber, roundPosition, feedRound } = loserMatchUp;
25050
+ pushGlobalLog({
25051
+ loser: "loser",
25052
+ stage,
25053
+ roundNumber,
25054
+ roundPosition,
25055
+ keyColors,
25056
+ feedRound
25057
+ });
24882
25058
  if (appliedPolicies?.progression?.doubleExitPropagateBye) {
24883
25059
  removeDirectedBye({
24884
25060
  drawPosition: loserTargetDrawPosition,
@@ -24912,7 +25088,7 @@ function conditionallyRemoveDrawPosition(params) {
24912
25088
  iteration
24913
25089
  } = params;
24914
25090
  const stack = "conditionallyRemoveDrawPosition";
24915
- pushGlobalLog();
25091
+ pushGlobalLog({ method: stack });
24916
25092
  const nextTargetData = positionTargets({
24917
25093
  matchUpId: targetMatchUp.matchUpId,
24918
25094
  inContextDrawMatchUps,
@@ -24968,7 +25144,16 @@ function conditionallyRemoveDrawPosition(params) {
24968
25144
  }
24969
25145
  }
24970
25146
  if (nextWinnerMatchUp && drawPositionToRemove) {
24971
- pushGlobalLog();
25147
+ const { stage, roundNumber, roundPosition } = nextWinnerMatchUp;
25148
+ pushGlobalLog({
25149
+ method: "removeDirectedWinner",
25150
+ drawPositionToRemove,
25151
+ keyColors,
25152
+ color: "brightgreen",
25153
+ stage,
25154
+ roundNumber,
25155
+ roundPosition
25156
+ });
24972
25157
  removeDirectedWinner({
24973
25158
  winningDrawPosition: drawPositionToRemove,
24974
25159
  winnerMatchUp: nextWinnerMatchUp,
@@ -25493,7 +25678,12 @@ function setMatchUpStatus$2(params) {
25493
25678
  return swapWinnerLoser(params);
25494
25679
  }
25495
25680
  const matchUpWinner = winningSide && !matchUpTieId || params.projectedWinningSide;
25496
- pushGlobalLog();
25681
+ pushGlobalLog({
25682
+ method: stack,
25683
+ activeDownstream,
25684
+ matchUpWinner,
25685
+ winningSide
25686
+ });
25497
25687
  const result = !activeDownstream && noDownstreamDependencies(params) || matchUpWinner && winningSideWithDownstreamDependencies(params) || directingMatchUpStatus && applyMatchUpValues(params) || {
25498
25688
  error: NO_VALID_ACTIONS
25499
25689
  };
@@ -32970,14 +33160,16 @@ function getMatchUpsToSchedule({
32970
33160
  scheduleCompletedMatchUps,
32971
33161
  dateScheduledMatchUpIds,
32972
33162
  matchUpNotBeforeTimes,
33163
+ matchUpScheduleTimes,
32973
33164
  orderedMatchUpIds,
32974
33165
  clearDate,
32975
33166
  matchUps
32976
33167
  }) {
33168
+ const alreadyScheduledMatchUpIds = Object.keys(matchUpScheduleTimes);
32977
33169
  const matchUpsToSchedule = orderedMatchUpIds.map(
32978
33170
  (matchUpId) => matchUps.find((matchUp) => matchUp.matchUpId === matchUpId)
32979
33171
  ).filter(Boolean).filter((matchUp) => {
32980
- const alreadyScheduled = !clearDate && dateScheduledMatchUpIds.includes(matchUp.matchUpId);
33172
+ const alreadyScheduled = !clearDate && (dateScheduledMatchUpIds.includes(matchUp.matchUpId) || alreadyScheduledMatchUpIds.includes(matchUp.matchUpId));
32981
33173
  const doNotSchedule = [
32982
33174
  BYE,
32983
33175
  DEFAULTED,
@@ -33229,6 +33421,7 @@ function getVenueSchedulingDetails({
33229
33421
  scheduleCompletedMatchUps,
33230
33422
  dateScheduledMatchUpIds,
33231
33423
  matchUpNotBeforeTimes,
33424
+ matchUpScheduleTimes,
33232
33425
  orderedMatchUpIds,
33233
33426
  clearDate,
33234
33427
  matchUps
@@ -39038,7 +39231,7 @@ function competitionEngineAsync(test) {
39038
39231
  }
39039
39232
 
39040
39233
  function addVoluntaryConsolationStructure$1({
39041
- structureName = VOLUNTARY_CONSOLATION,
39234
+ structureName = constantToString(VOLUNTARY_CONSOLATION),
39042
39235
  structureAbbreviation,
39043
39236
  drawDefinition,
39044
39237
  matchUpType,
@@ -39266,7 +39459,9 @@ function generateQualifyingStructures({
39266
39459
  }
39267
39460
  const roundTargetName = qualifyingProfiles.length > 1 ? `${roundTarget}-` : "";
39268
39461
  const stageSequenceName = structureProfiles.length > 1 || roundTargetName ? stageSequence : "";
39269
- const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${QUALIFYING} ${roundTargetName}${stageSequenceName}` : QUALIFYING);
39462
+ const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${constantToString(
39463
+ QUALIFYING
39464
+ )} ${roundTargetName}${stageSequenceName}` : constantToString(QUALIFYING));
39270
39465
  if (drawType === ROUND_ROBIN) {
39271
39466
  const {
39272
39467
  structures: structures2,
@@ -39912,6 +40107,7 @@ function roundMatchCounts({ drawSize }) {
39912
40107
  function firstRoundLoserConsolation(params) {
39913
40108
  const {
39914
40109
  finishingPositionOffset = 0,
40110
+ playoffAttributes,
39915
40111
  stageSequence = 1,
39916
40112
  staggeredEntry,
39917
40113
  structureName,
@@ -39933,7 +40129,7 @@ function firstRoundLoserConsolation(params) {
39933
40129
  };
39934
40130
  const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
39935
40131
  const mainStructure = structureTemplate({
39936
- structureName: structureName || constantToString(MAIN),
40132
+ structureName: structureName || playoffAttributes?.["0"]?.name || constantToString(MAIN),
39937
40133
  structureId: structureId || uuids?.pop(),
39938
40134
  stageSequence,
39939
40135
  matchUpType,
@@ -39952,7 +40148,7 @@ function firstRoundLoserConsolation(params) {
39952
40148
  isMock
39953
40149
  });
39954
40150
  const consolation = constantToString(CONSOLATION);
39955
- const consolationStructureName = params.consolationStructureName || (structureName ? `${structureName} ${consolation}` : consolation);
40151
+ const consolationStructureName = playoffAttributes?.["0-1"]?.name ?? params.consolationStructureName ?? (structureName ? `${structureName} ${consolation}` : consolation);
39956
40152
  const consolationStructure = structureTemplate({
39957
40153
  structureName: consolationStructureName,
39958
40154
  matchUps: consolationMatchUps,
@@ -40030,10 +40226,10 @@ function feedInLinks({
40030
40226
 
40031
40227
  function generateCurtisConsolation(params) {
40032
40228
  const {
40033
- structureName = constantToString(MAIN),
40034
40229
  playoffStructureNameBase,
40035
40230
  finishingPositionOffset,
40036
40231
  stageSequence = 1,
40232
+ playoffAttributes,
40037
40233
  structureNameMap,
40038
40234
  staggeredEntry,
40039
40235
  stage = MAIN,
@@ -40053,6 +40249,7 @@ function generateCurtisConsolation(params) {
40053
40249
  uuids
40054
40250
  };
40055
40251
  const { matchUps, roundsCount: mainDrawRoundsCount } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
40252
+ const structureName = params.structureName ?? playoffAttributes?.["0"]?.name ?? constantToString(MAIN);
40056
40253
  const mainStructure = structureTemplate({
40057
40254
  structureId: structureId || uuids?.pop(),
40058
40255
  structureName,
@@ -40071,6 +40268,7 @@ function generateCurtisConsolation(params) {
40071
40268
  idPrefix: idPrefix && `${idPrefix}-c${index}`,
40072
40269
  structureId: uuids?.pop(),
40073
40270
  playoffStructureNameBase,
40271
+ playoffAttributes,
40074
40272
  structureNameMap,
40075
40273
  stageSequence: stageSequence2,
40076
40274
  roundOffset,
@@ -40099,7 +40297,7 @@ function generateCurtisConsolation(params) {
40099
40297
  matchUpType,
40100
40298
  isMock
40101
40299
  });
40102
- const defaultName = constantToString(PLAY_OFF);
40300
+ const defaultName = playoffAttributes?.["3-4"]?.name ?? constantToString(PLAY_OFF);
40103
40301
  const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
40104
40302
  const structureName2 = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
40105
40303
  const playoffStructure = structureTemplate({
@@ -40131,6 +40329,7 @@ function generateCurtisConsolation(params) {
40131
40329
  function consolationFeedStructure({
40132
40330
  playoffStructureNameBase,
40133
40331
  stageSequence = 1,
40332
+ playoffAttributes,
40134
40333
  structureNameMap,
40135
40334
  roundOffset = 0,
40136
40335
  matchUpType,
@@ -40152,7 +40351,8 @@ function consolationFeedStructure({
40152
40351
  isMock,
40153
40352
  uuids
40154
40353
  });
40155
- const defaultName = `${constantToString(CONSOLATION)} ${index + 1}`;
40354
+ const indexedStructureName = index === 0 && playoffAttributes?.["0-1"]?.name || index === 1 && playoffAttributes?.["0-3"]?.name;
40355
+ const defaultName = indexedStructureName || `${constantToString(CONSOLATION)} ${index + 1}`;
40156
40356
  const mappedStructureName = structureNameMap?.[defaultName] || defaultName;
40157
40357
  const structureName = playoffStructureNameBase ? `${playoffStructureNameBase} ${mappedStructureName}` : mappedStructureName;
40158
40358
  const consolationStructure = structureTemplate({
@@ -40202,7 +40402,7 @@ function generatePlayoffStructures(params) {
40202
40402
  const finishingPositionRange = `${finishingPositionsFrom}-${finishingPositionsTo}`;
40203
40403
  const attributeProfile = playoffAttributes?.[exitProfile];
40204
40404
  const base = playoffStructureNameBase && `${playoffStructureNameBase} ` || "";
40205
- const customNaming = finishingPositionNaming?.[finishingPositionRange];
40405
+ const customNaming = playoffAttributes?.[finishingPositionRange] ?? finishingPositionNaming?.[finishingPositionRange];
40206
40406
  const structureName = customNaming?.name || attributeProfile?.name && (addNameBaseToAttributeName ? `${base}${attributeProfile?.name}` : attributeProfile.name) || `${base}${finishingPositionRange}`;
40207
40407
  const structureAbbreviation = customNaming?.abbreviation || attributeProfile?.abbreviation;
40208
40408
  const mainParams = {
@@ -40307,6 +40507,7 @@ function feedInChampionship(params) {
40307
40507
  const {
40308
40508
  finishingPositionOffset,
40309
40509
  stageSequence = 1,
40510
+ playoffAttributes,
40310
40511
  policyDefinitions,
40311
40512
  feedsFromFinal,
40312
40513
  staggeredEntry,
@@ -40334,7 +40535,7 @@ function feedInChampionship(params) {
40334
40535
  };
40335
40536
  const { matchUps } = staggeredEntry ? feedInMatchUps(mainParams) : treeMatchUps(mainParams);
40336
40537
  const mainStructure = structureTemplate({
40337
- structureName: structureName || constantToString(MAIN),
40538
+ structureName: structureName || playoffAttributes?.["0"]?.name || constantToString(MAIN),
40338
40539
  structureId: structureId || uuids?.pop(),
40339
40540
  stageSequence,
40340
40541
  matchUpType,
@@ -40359,7 +40560,7 @@ function feedInChampionship(params) {
40359
40560
  });
40360
40561
  if (drawSize > 2) {
40361
40562
  const consolationStructure = structureTemplate({
40362
- structureName: constantToString(CONSOLATION),
40563
+ structureName: playoffAttributes?.["0-1"]?.name ?? constantToString(CONSOLATION),
40363
40564
  matchUps: consolationMatchUps,
40364
40565
  structureId: uuids?.pop(),
40365
40566
  stage: CONSOLATION,
@@ -40384,10 +40585,9 @@ function feedInChampionship(params) {
40384
40585
  }
40385
40586
 
40386
40587
  function processPlayoffGroups({
40387
- compassAttributes = COMPASS_ATTRIBUTES,
40388
- olympicAttributes = OLYMPIC_ATTRIBUTES,
40389
40588
  requireSequential = true,
40390
40589
  playoffMatchUpFormat,
40590
+ playoffAttributes,
40391
40591
  sourceStructureId,
40392
40592
  policyDefinitions,
40393
40593
  stageSequence,
@@ -40436,6 +40636,8 @@ function processPlayoffGroups({
40436
40636
  if (positionsPlayedOff) {
40437
40637
  finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
40438
40638
  }
40639
+ const finishingPositionRange = positionsPlayedOff && `${Math.min(...positionsPlayedOff)}-${Math.max(...positionsPlayedOff)}`;
40640
+ const structureName = playoffGroup.structureName || finishingPositionRange && playoffGroup.playoffAttributes?.[finishingPositionRange]?.name || playoffGroup.playoffAttributes?.["0"]?.name;
40439
40641
  const playoffGroupParams = {
40440
40642
  addNameBaseToAttributeName: playoffGroup.addNameBaseToAttributeName,
40441
40643
  playoffStructureNameBase: playoffGroup.playoffStructureNameBase,
@@ -40444,8 +40646,8 @@ function processPlayoffGroups({
40444
40646
  structureId: playoffGroup.structureId ?? uuids?.pop(),
40445
40647
  playoffAttributes: playoffGroup.playoffAttributes,
40446
40648
  structureNameMap: playoffGroup.structureNameMap,
40447
- structureName: playoffGroup.structureName,
40448
- sequenceLimit: playoffGroup.sequenceLimit
40649
+ sequenceLimit: playoffGroup.sequenceLimit,
40650
+ structureName
40449
40651
  };
40450
40652
  const params = {
40451
40653
  ...playoffGroupParams,
@@ -40487,9 +40689,9 @@ function processPlayoffGroups({
40487
40689
  });
40488
40690
  const playoffStructure = structureTemplate({
40489
40691
  structureId: playoffGroup.structureId ?? uuids?.pop(),
40490
- structureName: playoffGroup.structureName,
40491
40692
  matchUpFormat: playoffMatchUpFormat,
40492
40693
  stage: PLAY_OFF,
40694
+ structureName,
40493
40695
  stageSequence,
40494
40696
  matchUps
40495
40697
  });
@@ -40506,8 +40708,8 @@ function processPlayoffGroups({
40506
40708
  finishingPositions
40507
40709
  });
40508
40710
  } else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
40509
- const { structureName } = playoffGroup;
40510
40711
  const params2 = {
40712
+ playoffAttributes: playoffGroup.playoffAttributes ?? playoffAttributes,
40511
40713
  structureId: playoffGroup.structureId ?? uuids?.pop(),
40512
40714
  playoffStructureNameBase: structureName,
40513
40715
  idPrefix: idPrefix && `${idPrefix}-po`,
@@ -40522,12 +40724,12 @@ function processPlayoffGroups({
40522
40724
  };
40523
40725
  if (playoffDrawType === COMPASS) {
40524
40726
  Object.assign(params2, {
40525
- playoffAttributes: compassAttributes,
40727
+ playoffAttributes: playoffGroup?.playoffAttributes ?? playoffAttributes ?? COMPASS_ATTRIBUTES,
40526
40728
  roundOffsetLimit: 3
40527
40729
  });
40528
40730
  } else if (playoffDrawType === OLYMPIC) {
40529
40731
  Object.assign(params2, {
40530
- playoffAttributes: olympicAttributes,
40732
+ playoffAttributes: playoffGroup?.playoffAttributes ?? playoffAttributes ?? OLYMPIC_ATTRIBUTES,
40531
40733
  roundOffsetLimit: 2
40532
40734
  });
40533
40735
  }
@@ -40563,11 +40765,11 @@ function processPlayoffGroups({
40563
40765
  const uuidsFMLC = [uuids?.pop(), uuids?.pop()];
40564
40766
  const params2 = {
40565
40767
  structureId: playoffGroup.structureId ?? uuids?.pop(),
40566
- structureName: playoffGroup.structureName,
40567
40768
  idPrefix: idPrefix && `${idPrefix}-po`,
40568
40769
  finishingPositionOffset,
40569
40770
  uuids: uuidsFMLC,
40570
40771
  stage: PLAY_OFF,
40772
+ structureName,
40571
40773
  matchUpType,
40572
40774
  feedPolicy,
40573
40775
  drawSize,
@@ -40919,10 +41121,8 @@ function luckyRoundProfiles(drawSize) {
40919
41121
 
40920
41122
  function getGenerators(params) {
40921
41123
  const {
40922
- compassAttributes = COMPASS_ATTRIBUTES,
40923
- olympicAttributes = OLYMPIC_ATTRIBUTES,
41124
+ playoffAttributes,
40924
41125
  stageSequence = 1,
40925
- structureName,
40926
41126
  structureId,
40927
41127
  stage = MAIN,
40928
41128
  matchUpType,
@@ -40932,13 +41132,13 @@ function getGenerators(params) {
40932
41132
  const { appliedPolicies } = getAppliedPolicies(params);
40933
41133
  const feedPolicy = params.policyDefinitions?.[POLICY_TYPE_FEED_IN] || appliedPolicies?.[POLICY_TYPE_FEED_IN];
40934
41134
  params.skipRounds = params.skipRounds || drawSize <= 4 && (feedPolicy?.feedMainFinal ? 0 : 1) || 0;
40935
- const main = constantToString(MAIN);
41135
+ const structureName = params.structureName ?? playoffAttributes?.["0"]?.name ?? constantToString(MAIN);
40936
41136
  const singleElimination = () => {
40937
41137
  const { matchUps } = treeMatchUps(params);
40938
41138
  const structure = structureTemplate({
40939
41139
  structureId: structureId || uuids?.pop(),
40940
- structureName: structureName || main,
40941
41140
  stageSequence,
41141
+ structureName,
40942
41142
  matchUpType,
40943
41143
  matchUps,
40944
41144
  stage
@@ -40949,9 +41149,9 @@ function getGenerators(params) {
40949
41149
  [AD_HOC]: () => {
40950
41150
  const structure = structureTemplate({
40951
41151
  structureId: structureId || uuids?.pop(),
40952
- structureName: structureName || main,
40953
41152
  finishingPosition: WIN_RATIO,
40954
41153
  stageSequence,
41154
+ structureName,
40955
41155
  matchUps: [],
40956
41156
  matchUpType,
40957
41157
  stage
@@ -40962,8 +41162,8 @@ function getGenerators(params) {
40962
41162
  const { matchUps } = luckyDraw(params);
40963
41163
  const structure = structureTemplate({
40964
41164
  structureId: structureId || uuids?.pop(),
40965
- structureName: structureName || main,
40966
41165
  stageSequence,
41166
+ structureName,
40967
41167
  matchUpType,
40968
41168
  matchUps,
40969
41169
  stage
@@ -40975,12 +41175,12 @@ function getGenerators(params) {
40975
41175
  [COMPASS]: () => generatePlayoffStructures({
40976
41176
  ...params,
40977
41177
  roundOffsetLimit: 3,
40978
- playoffAttributes: compassAttributes
41178
+ playoffAttributes: playoffAttributes ?? COMPASS_ATTRIBUTES
40979
41179
  }),
40980
41180
  [OLYMPIC]: () => generatePlayoffStructures({
40981
41181
  ...params,
40982
41182
  roundOffsetLimit: 2,
40983
- playoffAttributes: olympicAttributes
41183
+ playoffAttributes: playoffAttributes ?? OLYMPIC_ATTRIBUTES
40984
41184
  }),
40985
41185
  [PLAY_OFF]: () => {
40986
41186
  return generatePlayoffStructures(params);
@@ -40989,8 +41189,8 @@ function getGenerators(params) {
40989
41189
  const { matchUps } = feedInMatchUps({ drawSize, uuids, matchUpType });
40990
41190
  const structure = structureTemplate({
40991
41191
  structureId: structureId || uuids?.pop(),
40992
- structureName: structureName || main,
40993
41192
  stageSequence,
41193
+ structureName,
40994
41194
  matchUpType,
40995
41195
  stage: MAIN,
40996
41196
  matchUps
@@ -44029,7 +44229,7 @@ function generateQualifyingStructure$1(params) {
44029
44229
  }
44030
44230
  const roundTargetName = roundTarget ? `${roundTarget}-` : "";
44031
44231
  const stageSequenceName = `${stageSequence}`;
44032
- const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${QUALIFYING} ${roundTargetName}${stageSequenceName}` : QUALIFYING);
44232
+ const qualifyingStructureName = structureName || (roundTargetName || stageSequenceName ? `${constantToString(QUALIFYING)} ${roundTargetName}${stageSequenceName}` : constantToString(QUALIFYING));
44033
44233
  if (drawType === ROUND_ROBIN) {
44034
44234
  const { maxRoundNumber, structures, groupCount } = generateRoundRobin({
44035
44235
  structureName: structureName || qualifyingStructureName,
@@ -63933,7 +64133,8 @@ const utilities = {
63933
64133
  unique,
63934
64134
  UUID,
63935
64135
  UUIDS,
63936
- validateTieFormat
64136
+ validateTieFormat,
64137
+ visualizeScheduledMatchUps
63937
64138
  };
63938
64139
 
63939
64140
  export { EntryStatusEnum, competitionEngine, competitionEngineAsync, deleteNotices, drawDefinitionConstants, drawEngine, drawEngineAsync, entryStatusConstants, errorConditionConstants, eventConstants, factoryConstants, fixtures, flightConstants, genderConstants, getNotices, keyValueConstants, matchUpActionConstants, matchUpEngine, matchUpEngineAsync, matchUpFormatCode, matchUpStatusConstants, matchUpTypes, mocksEngine, participantConstants, participantRoles, participantTypes, penaltyConstants, policyConstants, positionActionConstants, resultConstants, scaleConstants, scaleEngine, scaleEngineAsync, scoreGovernor, setDeepCopy, setDevContext, setStateProvider, setSubscriptions, surfaceConstants, timeItemConstants, tournamentEngine, tournamentEngineAsync, utilities, venueConstants, factoryVersion as version };