tods-competition-factory 2.2.12 → 2.2.14

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.
@@ -183,18 +183,8 @@ interface TimeItem {
183
183
  itemType?: string;
184
184
  itemValue?: any;
185
185
  }
186
- declare enum CategoryEnum {
187
- AGE = "AGE",
188
- BOTH = "BOTH",
189
- LEVEL = "LEVEL"
190
- }
191
- type CategoryUnion = keyof typeof CategoryEnum;
192
- declare enum DisciplineEnum {
193
- BEACH_TENNIS = "BEACH_TENNIS",
194
- TENNIS = "TENNIS",
195
- WHEELCHAIR_TENNIS = "WHEELCHAIR_TENNIS"
196
- }
197
- type DisciplineUnion = keyof typeof DisciplineEnum;
186
+ type DisciplineUnion = 'BEACH_TENNIS' | 'TENNIS' | 'WHEELCHAIR_TENNIS';
187
+ type CategoryUnion = 'AGE' | 'BOTH' | 'LEVEL';
198
188
  interface DrawDefinition {
199
189
  activeDates?: Date[] | string[];
200
190
  automated?: boolean;
@@ -222,12 +212,7 @@ interface DrawDefinition {
222
212
  timeItems?: TimeItem[];
223
213
  updatedAt?: Date | string;
224
214
  }
225
- declare enum DrawStatusEnum {
226
- COMPLETE = "COMPLETE",
227
- IN_PROGRESS = "IN_PROGRESS",
228
- TO_BE_PLAYED = "TO_BE_PLAYED"
229
- }
230
- type DrawStatusUnion = keyof typeof DrawStatusEnum;
215
+ type DrawStatusUnion = 'COMPLETE' | 'IN_PROGRESS' | 'TO_BE_PLAYED';
231
216
  interface Entry {
232
217
  createdAt?: Date | string;
233
218
  entryId?: string;
@@ -372,12 +357,7 @@ interface MatchUpFinishingPositionRange {
372
357
  loser: number[];
373
358
  winner: number[];
374
359
  }
375
- declare enum IndoorOutdoorEnum {
376
- INDOOR = "INDOOR",
377
- MIXED = "MIXED",
378
- OUTDOOR = "OUTDOOR"
379
- }
380
- type IndoorOutdoorUnion = keyof typeof IndoorOutdoorEnum;
360
+ type IndoorOutdoorUnion = 'INDOOR' | 'MIXED' | 'OUTDOOR';
381
361
  declare enum MatchUpStatusEnum {
382
362
  ABANDONED = "ABANDONED",
383
363
  AWAITING_RESULT = "AWAITING_RESULT",
@@ -2891,6 +2871,22 @@ declare function addVoluntaryConsolationStage(params: any): {
2891
2871
  success: boolean;
2892
2872
  };
2893
2873
 
2874
+ interface ResetQualifyingStructureArgs {
2875
+ tournamentRecord?: Tournament;
2876
+ drawDefinition: DrawDefinition;
2877
+ event?: Event$1;
2878
+ structureId: string;
2879
+ }
2880
+ declare function resetQualifyingStructure({ tournamentRecord, drawDefinition, event, structureId, }: ResetQualifyingStructureArgs): {
2881
+ error: {
2882
+ message: string;
2883
+ code: string;
2884
+ };
2885
+ } | {
2886
+ success: boolean;
2887
+ error?: undefined;
2888
+ };
2889
+
2894
2890
  declare function swapDrawPositionAssignments({ tournamentRecord, drawDefinition, drawPositions, structureId, event }: {
2895
2891
  tournamentRecord: any;
2896
2892
  drawDefinition: any;
@@ -3151,6 +3147,7 @@ declare const mutate$c_removeSeededParticipant: typeof removeSeededParticipant;
3151
3147
  declare const mutate$c_removeStructure: typeof removeStructure;
3152
3148
  declare const mutate$c_renameStructures: typeof renameStructures;
3153
3149
  declare const mutate$c_resetDrawDefinition: typeof resetDrawDefinition;
3150
+ declare const mutate$c_resetQualifyingStructure: typeof resetQualifyingStructure;
3154
3151
  declare const mutate$c_resetVoluntaryConsolationStructure: typeof resetVoluntaryConsolationStructure;
3155
3152
  declare const mutate$c_setDrawParticipantRepresentativeIds: typeof setDrawParticipantRepresentativeIds;
3156
3153
  declare const mutate$c_setPositionAssignments: typeof setPositionAssignments;
@@ -3162,7 +3159,7 @@ declare const mutate$c_swapDrawPositionAssignments: typeof swapDrawPositionAssig
3162
3159
  declare const mutate$c_updateTeamLineUp: typeof updateTeamLineUp;
3163
3160
  declare const mutate$c_withdrawParticipantAtDrawPosition: typeof withdrawParticipantAtDrawPosition;
3164
3161
  declare namespace mutate$c {
3165
- export { mutate$c_adHocPositionSwap as adHocPositionSwap, mutate$c_addAdHocMatchUps as addAdHocMatchUps, mutate$c_addDrawDefinitionTimeItem as addDrawDefinitionTimeItem, mutate$c_addPlayoffStructures as addPlayoffStructures, mutate$c_addQualifyingStructure as addQualifyingStructure, mutate$c_addVoluntaryConsolationStage as addVoluntaryConsolationStage, mutate$c_addVoluntaryConsolationStructure as addVoluntaryConsolationStructure, mutate$c_alternateDrawPositionAssignment as alternateDrawPositionAssignment, mutate$c_assignDrawPosition as assignDrawPosition, mutate$c_assignDrawPositionBye as assignDrawPositionBye, mutate$c_attachConsolationStructures as attachConsolationStructures, mutate$c_attachPlayoffStructures as attachPlayoffStructures, mutate$c_attachQualifyingStructure as attachQualifyingStructure, mutate$c_attachStructures as attachStructures, mutate$c_automatedPlayoffPositioning as automatedPlayoffPositioning, mutate$c_automatedPositioning as automatedPositioning, mutate$c_deleteAdHocMatchUps as deleteAdHocMatchUps, mutate$c_luckyLoserDrawPositionAssignment as luckyLoserDrawPositionAssignment, mutate$c_modifyDrawDefinition as modifyDrawDefinition, mutate$c_modifyDrawName as modifyDrawName, mutate$c_modifySeedAssignment as modifySeedAssignment, mutate$c_pruneDrawDefinition as pruneDrawDefinition, mutate$c_qualifierDrawPositionAssignment as qualifierDrawPositionAssignment, mutate$c_removeDrawPositionAssignment as removeDrawPositionAssignment, mutate$c_removeRoundMatchUps as removeRoundMatchUps, mutate$c_removeSeededParticipant as removeSeededParticipant, mutate$c_removeStructure as removeStructure, mutate$c_renameStructures as renameStructures, mutate$c_resetDrawDefinition as resetDrawDefinition, mutate$c_resetVoluntaryConsolationStructure as resetVoluntaryConsolationStructure, mutate$c_setDrawParticipantRepresentativeIds as setDrawParticipantRepresentativeIds, mutate$c_setPositionAssignments as setPositionAssignments, mutate$c_setStructureOrder as setStructureOrder, mutate$c_setSubOrder as setSubOrder, mutate$c_shiftAdHocRounds as shiftAdHocRounds, mutate$c_swapAdHocRounds as swapAdHocRounds, mutate$c_swapDrawPositionAssignments as swapDrawPositionAssignments, mutate$c_updateTeamLineUp as updateTeamLineUp, mutate$c_withdrawParticipantAtDrawPosition as withdrawParticipantAtDrawPosition };
3162
+ export { mutate$c_adHocPositionSwap as adHocPositionSwap, mutate$c_addAdHocMatchUps as addAdHocMatchUps, mutate$c_addDrawDefinitionTimeItem as addDrawDefinitionTimeItem, mutate$c_addPlayoffStructures as addPlayoffStructures, mutate$c_addQualifyingStructure as addQualifyingStructure, mutate$c_addVoluntaryConsolationStage as addVoluntaryConsolationStage, mutate$c_addVoluntaryConsolationStructure as addVoluntaryConsolationStructure, mutate$c_alternateDrawPositionAssignment as alternateDrawPositionAssignment, mutate$c_assignDrawPosition as assignDrawPosition, mutate$c_assignDrawPositionBye as assignDrawPositionBye, mutate$c_attachConsolationStructures as attachConsolationStructures, mutate$c_attachPlayoffStructures as attachPlayoffStructures, mutate$c_attachQualifyingStructure as attachQualifyingStructure, mutate$c_attachStructures as attachStructures, mutate$c_automatedPlayoffPositioning as automatedPlayoffPositioning, mutate$c_automatedPositioning as automatedPositioning, mutate$c_deleteAdHocMatchUps as deleteAdHocMatchUps, mutate$c_luckyLoserDrawPositionAssignment as luckyLoserDrawPositionAssignment, mutate$c_modifyDrawDefinition as modifyDrawDefinition, mutate$c_modifyDrawName as modifyDrawName, mutate$c_modifySeedAssignment as modifySeedAssignment, mutate$c_pruneDrawDefinition as pruneDrawDefinition, mutate$c_qualifierDrawPositionAssignment as qualifierDrawPositionAssignment, mutate$c_removeDrawPositionAssignment as removeDrawPositionAssignment, mutate$c_removeRoundMatchUps as removeRoundMatchUps, mutate$c_removeSeededParticipant as removeSeededParticipant, mutate$c_removeStructure as removeStructure, mutate$c_renameStructures as renameStructures, mutate$c_resetDrawDefinition as resetDrawDefinition, mutate$c_resetQualifyingStructure as resetQualifyingStructure, mutate$c_resetVoluntaryConsolationStructure as resetVoluntaryConsolationStructure, mutate$c_setDrawParticipantRepresentativeIds as setDrawParticipantRepresentativeIds, mutate$c_setPositionAssignments as setPositionAssignments, mutate$c_setStructureOrder as setStructureOrder, mutate$c_setSubOrder as setSubOrder, mutate$c_shiftAdHocRounds as shiftAdHocRounds, mutate$c_swapAdHocRounds as swapAdHocRounds, mutate$c_swapDrawPositionAssignments as swapDrawPositionAssignments, mutate$c_updateTeamLineUp as updateTeamLineUp, mutate$c_withdrawParticipantAtDrawPosition as withdrawParticipantAtDrawPosition };
3166
3163
  }
3167
3164
 
3168
3165
  type GetEligibleVoluntaryConsolationParticipantsArgs = {
@@ -3996,6 +3993,7 @@ declare const index$j_removeSeededParticipant: typeof removeSeededParticipant;
3996
3993
  declare const index$j_removeStructure: typeof removeStructure;
3997
3994
  declare const index$j_renameStructures: typeof renameStructures;
3998
3995
  declare const index$j_resetDrawDefinition: typeof resetDrawDefinition;
3996
+ declare const index$j_resetQualifyingStructure: typeof resetQualifyingStructure;
3999
3997
  declare const index$j_resetVoluntaryConsolationStructure: typeof resetVoluntaryConsolationStructure;
4000
3998
  declare const index$j_setDrawParticipantRepresentativeIds: typeof setDrawParticipantRepresentativeIds;
4001
3999
  declare const index$j_setPositionAssignments: typeof setPositionAssignments;
@@ -4007,7 +4005,7 @@ declare const index$j_swapDrawPositionAssignments: typeof swapDrawPositionAssign
4007
4005
  declare const index$j_updateTeamLineUp: typeof updateTeamLineUp;
4008
4006
  declare const index$j_withdrawParticipantAtDrawPosition: typeof withdrawParticipantAtDrawPosition;
4009
4007
  declare namespace index$j {
4010
- export { index$j_adHocPositionSwap as adHocPositionSwap, index$j_addAdHocMatchUps as addAdHocMatchUps, index$j_addDrawDefinitionTimeItem as addDrawDefinitionTimeItem, index$j_addFinishingRounds as addFinishingRounds, index$j_addGoesTo as addGoesTo, index$j_addPlayoffStructures as addPlayoffStructures, index$j_addQualifyingStructure as addQualifyingStructure, index$j_addVoluntaryConsolationStage as addVoluntaryConsolationStage, index$j_addVoluntaryConsolationStructure as addVoluntaryConsolationStructure, index$j_allPlayoffPositionsFilled as allPlayoffPositionsFilled, index$j_alternateDrawPositionAssignment as alternateDrawPositionAssignment, index$j_assignDrawPosition as assignDrawPosition, index$j_assignDrawPositionBye as assignDrawPositionBye, index$j_attachConsolationStructures as attachConsolationStructures, index$j_attachPlayoffStructures as attachPlayoffStructures, index$j_attachQualifyingStructure as attachQualifyingStructure, index$j_attachStructures as attachStructures, index$j_autoSeeding as autoSeeding, index$j_automatedPlayoffPositioning as automatedPlayoffPositioning, index$j_automatedPositioning as automatedPositioning, index$j_checkValidEntries as checkValidEntries, index$j_deleteAdHocMatchUps as deleteAdHocMatchUps, index$j_drawMatic as drawMatic, publicFindDrawDefinition as findDrawDefinition, index$j_generateAdHocMatchUps as generateAdHocMatchUps, index$j_generateAdHocRounds as generateAdHocRounds, index$j_generateAndPopulatePlayoffStructures as generateAndPopulatePlayoffStructures, index$j_generateDrawDefinition as generateDrawDefinition, index$j_generateDrawMaticRound as generateDrawMaticRound, index$j_generateDrawStructuresAndLinks as generateDrawStructuresAndLinks, index$j_generateDrawTypeAndModifyDrawDefinition as generateDrawTypeAndModifyDrawDefinition, index$j_generateQualifyingStructure as generateQualifyingStructure, index$j_generateVoluntaryConsolation as generateVoluntaryConsolation, index$j_getAssignedParticipantIds as getAssignedParticipantIds, index$j_getAvailableMatchUpsCount as getAvailableMatchUpsCount, index$j_getAvailablePlayoffProfiles as getAvailablePlayoffProfiles, index$j_getDrawDefinitionTimeItem as getDrawDefinitionTimeItem, index$j_getDrawParticipantRepresentativeIds as getDrawParticipantRepresentativeIds, index$j_getDrawStructures as getDrawStructures, index$j_getDrawTypeCoercion as getDrawTypeCoercion, index$j_getEligibleVoluntaryConsolationParticipants as getEligibleVoluntaryConsolationParticipants, index$j_getMatchUpsMap as getMatchUpsMap, index$j_getParticipantIdFinishingPositions as getParticipantIdFinishingPositions, index$j_getPositionAssignments as getPositionAssignments, index$j_getPositionsPlayedOff as getPositionsPlayedOff, index$j_getSeedingThresholds as getSeedingThresholds, index$j_getSeedsCount as getSeedsCount, index$j_getStructureSeedAssignments as getStructureSeedAssignments, index$j_getTeamLineUp as getTeamLineUp, index$j_getValidGroupSizes as getValidGroupSizes, index$j_isAdHoc as isAdHoc, index$j_isCompletedStructure as isCompletedStructure, index$j_isValidForQualifying as isValidForQualifying, index$j_luckyLoserDrawPositionAssignment as luckyLoserDrawPositionAssignment, index$j_modifyDrawDefinition as modifyDrawDefinition, index$j_modifyDrawName as modifyDrawName, index$j_modifySeedAssignment as modifySeedAssignment, mutate$c as mutate, index$j_positionActions as positionActions, index$j_pruneDrawDefinition as pruneDrawDefinition, index$j_qualifierDrawPositionAssignment as qualifierDrawPositionAssignment, query$b as query, index$j_removeDrawPositionAssignment as removeDrawPositionAssignment, index$j_removeRoundMatchUps as removeRoundMatchUps, index$j_removeSeededParticipant as removeSeededParticipant, index$j_removeStructure as removeStructure, index$j_renameStructures as renameStructures, index$j_resetDrawDefinition as resetDrawDefinition, index$j_resetVoluntaryConsolationStructure as resetVoluntaryConsolationStructure, index$j_setDrawParticipantRepresentativeIds as setDrawParticipantRepresentativeIds, index$j_setPositionAssignments as setPositionAssignments, index$j_setStructureOrder as setStructureOrder, index$j_setSubOrder as setSubOrder, index$j_shiftAdHocRounds as shiftAdHocRounds, index$j_swapAdHocRounds as swapAdHocRounds, index$j_swapDrawPositionAssignments as swapDrawPositionAssignments, index$j_updateTeamLineUp as updateTeamLineUp, index$j_withdrawParticipantAtDrawPosition as withdrawParticipantAtDrawPosition };
4008
+ export { index$j_adHocPositionSwap as adHocPositionSwap, index$j_addAdHocMatchUps as addAdHocMatchUps, index$j_addDrawDefinitionTimeItem as addDrawDefinitionTimeItem, index$j_addFinishingRounds as addFinishingRounds, index$j_addGoesTo as addGoesTo, index$j_addPlayoffStructures as addPlayoffStructures, index$j_addQualifyingStructure as addQualifyingStructure, index$j_addVoluntaryConsolationStage as addVoluntaryConsolationStage, index$j_addVoluntaryConsolationStructure as addVoluntaryConsolationStructure, index$j_allPlayoffPositionsFilled as allPlayoffPositionsFilled, index$j_alternateDrawPositionAssignment as alternateDrawPositionAssignment, index$j_assignDrawPosition as assignDrawPosition, index$j_assignDrawPositionBye as assignDrawPositionBye, index$j_attachConsolationStructures as attachConsolationStructures, index$j_attachPlayoffStructures as attachPlayoffStructures, index$j_attachQualifyingStructure as attachQualifyingStructure, index$j_attachStructures as attachStructures, index$j_autoSeeding as autoSeeding, index$j_automatedPlayoffPositioning as automatedPlayoffPositioning, index$j_automatedPositioning as automatedPositioning, index$j_checkValidEntries as checkValidEntries, index$j_deleteAdHocMatchUps as deleteAdHocMatchUps, index$j_drawMatic as drawMatic, publicFindDrawDefinition as findDrawDefinition, index$j_generateAdHocMatchUps as generateAdHocMatchUps, index$j_generateAdHocRounds as generateAdHocRounds, index$j_generateAndPopulatePlayoffStructures as generateAndPopulatePlayoffStructures, index$j_generateDrawDefinition as generateDrawDefinition, index$j_generateDrawMaticRound as generateDrawMaticRound, index$j_generateDrawStructuresAndLinks as generateDrawStructuresAndLinks, index$j_generateDrawTypeAndModifyDrawDefinition as generateDrawTypeAndModifyDrawDefinition, index$j_generateQualifyingStructure as generateQualifyingStructure, index$j_generateVoluntaryConsolation as generateVoluntaryConsolation, index$j_getAssignedParticipantIds as getAssignedParticipantIds, index$j_getAvailableMatchUpsCount as getAvailableMatchUpsCount, index$j_getAvailablePlayoffProfiles as getAvailablePlayoffProfiles, index$j_getDrawDefinitionTimeItem as getDrawDefinitionTimeItem, index$j_getDrawParticipantRepresentativeIds as getDrawParticipantRepresentativeIds, index$j_getDrawStructures as getDrawStructures, index$j_getDrawTypeCoercion as getDrawTypeCoercion, index$j_getEligibleVoluntaryConsolationParticipants as getEligibleVoluntaryConsolationParticipants, index$j_getMatchUpsMap as getMatchUpsMap, index$j_getParticipantIdFinishingPositions as getParticipantIdFinishingPositions, index$j_getPositionAssignments as getPositionAssignments, index$j_getPositionsPlayedOff as getPositionsPlayedOff, index$j_getSeedingThresholds as getSeedingThresholds, index$j_getSeedsCount as getSeedsCount, index$j_getStructureSeedAssignments as getStructureSeedAssignments, index$j_getTeamLineUp as getTeamLineUp, index$j_getValidGroupSizes as getValidGroupSizes, index$j_isAdHoc as isAdHoc, index$j_isCompletedStructure as isCompletedStructure, index$j_isValidForQualifying as isValidForQualifying, index$j_luckyLoserDrawPositionAssignment as luckyLoserDrawPositionAssignment, index$j_modifyDrawDefinition as modifyDrawDefinition, index$j_modifyDrawName as modifyDrawName, index$j_modifySeedAssignment as modifySeedAssignment, mutate$c as mutate, index$j_positionActions as positionActions, index$j_pruneDrawDefinition as pruneDrawDefinition, index$j_qualifierDrawPositionAssignment as qualifierDrawPositionAssignment, query$b as query, index$j_removeDrawPositionAssignment as removeDrawPositionAssignment, index$j_removeRoundMatchUps as removeRoundMatchUps, index$j_removeSeededParticipant as removeSeededParticipant, index$j_removeStructure as removeStructure, index$j_renameStructures as renameStructures, index$j_resetDrawDefinition as resetDrawDefinition, index$j_resetQualifyingStructure as resetQualifyingStructure, index$j_resetVoluntaryConsolationStructure as resetVoluntaryConsolationStructure, index$j_setDrawParticipantRepresentativeIds as setDrawParticipantRepresentativeIds, index$j_setPositionAssignments as setPositionAssignments, index$j_setStructureOrder as setStructureOrder, index$j_setSubOrder as setSubOrder, index$j_shiftAdHocRounds as shiftAdHocRounds, index$j_swapAdHocRounds as swapAdHocRounds, index$j_swapDrawPositionAssignments as swapDrawPositionAssignments, index$j_updateTeamLineUp as updateTeamLineUp, index$j_withdrawParticipantAtDrawPosition as withdrawParticipantAtDrawPosition };
4011
4009
  }
4012
4010
 
4013
4011
  type DestroyPairEntryArgs = {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.2.12';
6
+ return '2.2.14';
7
7
  }
8
8
 
9
9
  const SINGLES_MATCHUP = 'SINGLES';
@@ -2143,11 +2143,11 @@ function isValidMatchUpFormat({ matchUpFormat }) {
2143
2143
  if (!isString(matchUpFormat) || matchUpFormat === '')
2144
2144
  return false;
2145
2145
  const parsedFormat = parse(matchUpFormat);
2146
- const setParts = matchUpFormat.match(/-S:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/);
2146
+ const setParts = matchUpFormat.match(/-S:([1-9])+\/TB(\d{1,2})@?([1-9]?)*/);
2147
2147
  const setsTo = setParts?.[1];
2148
2148
  const tiebreakTo = setParts?.[2];
2149
2149
  const tiebreakAt = setParts?.[3];
2150
- const finalSetParts = matchUpFormat.match(/-F:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/);
2150
+ const finalSetParts = matchUpFormat.match(/-F:([1-9])+\/TB(\d{1,2})@?([1-9]?)*/);
2151
2151
  const finalSetTo = finalSetParts?.[1];
2152
2152
  const finalSetTiebreakTo = finalSetParts?.[2];
2153
2153
  const finalTiebreakAt = finalSetParts?.[3];
@@ -5705,7 +5705,7 @@ function addPositionActionTelemetry(params) {
5705
5705
  name: POSITION_ACTIONS,
5706
5706
  element: drawDefinition,
5707
5707
  });
5708
- const existingValue = Array.isArray(extension?.value) ? extension?.value ?? [] : [];
5708
+ const existingValue = Array.isArray(extension?.value) ? (extension?.value ?? []) : [];
5709
5709
  if (!existingValue?.length) {
5710
5710
  const mainStructure = drawDefinition.structures.find((structure) => structure.stage === MAIN);
5711
5711
  if (mainStructure) {
@@ -7787,7 +7787,8 @@ function getParticipantMap({ withIndividualParticipants, convertExtensions, tour
7787
7787
  const participantMap = {};
7788
7788
  for (const participant of tournamentRecord.participants ?? []) {
7789
7789
  const participantId = participant?.participantId;
7790
- participantId && initializeParticipantId({ participantMap, participantId });
7790
+ if (participantId)
7791
+ initializeParticipantId({ participantMap, participantId });
7791
7792
  }
7792
7793
  for (const participant of tournamentRecord.participants ?? []) {
7793
7794
  const participantCopy = makeDeepCopy(participant, convertExtensions, internalUse);
@@ -8957,7 +8958,7 @@ function getRoundContextProfile({ roundNamingPolicy, drawDefinition, structure,
8957
8958
  .filter((structure) => structure.stage === QUALIFYING)
8958
8959
  .map(({ stageSequence }) => stageSequence ?? 1), 0)
8959
8960
  : 0;
8960
- const preQualifyingSequence = (structure.stageSequence ?? 1) < qualifyingStageSequences ? structure.stageSequence ?? 1 : '';
8961
+ const preQualifyingSequence = (structure.stageSequence ?? 1) < qualifyingStageSequences ? (structure.stageSequence ?? 1) : '';
8961
8962
  const preQualifyingAffix = preQualifyingSequence
8962
8963
  ? roundNamingPolicy?.affixes?.preQualifying || defaultRoundNamingPolicy.affixes.preQualifying || ''
8963
8964
  : '';
@@ -10202,7 +10203,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
10202
10203
  collectionDefinitions?.find((definition) => definition.collectionId === matchUp.collectionId);
10203
10204
  const matchUpFormat = matchUp.collectionId
10204
10205
  ? collectionDefinition?.matchUpFormat
10205
- : matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat;
10206
+ : (matchUp.matchUpFormat ?? structure?.matchUpFormat ?? drawDefinition?.matchUpFormat ?? event?.matchUpFormat);
10206
10207
  const matchUpType = matchUp.matchUpType ||
10207
10208
  collectionDefinition?.matchUpType ||
10208
10209
  structure?.matchUpType ||
@@ -10251,7 +10252,7 @@ function addMatchUpContext({ scheduleVisibilityFilters, sourceDrawPositionRanges
10251
10252
  ...(context?.category || {}),
10252
10253
  ...collectionDefinition.category,
10253
10254
  }
10254
- : context?.category ?? event?.category;
10255
+ : (context?.category ?? event?.category);
10255
10256
  const processCodes = (matchUp.processCodes?.length && matchUp.processCodes) ||
10256
10257
  (collectionDefinition?.processCodes?.length && collectionDefinition?.processCodes) ||
10257
10258
  (structure?.processCodes?.length && structure?.processCodes) ||
@@ -11873,7 +11874,7 @@ function addFinishingRounds({ finishingPositionOffset = 0, finishingPositionLimi
11873
11874
  };
11874
11875
  const upcomingMatchUps = roundMatchUpsCountArray?.slice(roundNumber - 1).reduce((a, b) => a + (b || 0), 0);
11875
11876
  const fmlcException = fmlc && roundNumber !== 1;
11876
- const rangeOffset = 1 + finishingPositionOffset + (fmlcException ? positionsFed ?? 0 : 0);
11877
+ const rangeOffset = 1 + finishingPositionOffset + (fmlcException ? (positionsFed ?? 0) : 0);
11877
11878
  const finalPosition = 1;
11878
11879
  const positionRange = generateRange(rangeOffset, lucky ? rangeOffset + matchUpsCount * 2 : upcomingMatchUps + rangeOffset + finalPosition);
11879
11880
  const slicer = upcomingMatchUps + finalPosition - matchUpsCount;
@@ -12155,7 +12156,7 @@ function getStructureDrawPositionProfiles(params) {
12155
12156
  const result = findStructure({ drawDefinition, structureId });
12156
12157
  if (result.error)
12157
12158
  return result;
12158
- structure = findContainer ? result.containingStructure ?? result.structure : result.structure;
12159
+ structure = findContainer ? (result.containingStructure ?? result.structure) : result.structure;
12159
12160
  }
12160
12161
  if (isAdHoc({ structure })) {
12161
12162
  return { structure, isAdHoc: true, error: INVALID_DRAW_POSITION };
@@ -13370,29 +13371,6 @@ function processEventEntry({ convertExtensions, seedAssignments, participant, wi
13370
13371
  }
13371
13372
  }
13372
13373
 
13373
- function addScheduleItem(params) {
13374
- const { participantMap, participantId, matchUpStatus, roundPosition, structureId, matchUpType, roundNumber, matchUpId, potential, schedule, drawId, score, } = params;
13375
- if (!schedule || !Object.keys(schedule).length)
13376
- return;
13377
- const ignoreMatchUp = matchUpStatus === BYE;
13378
- if (!ignoreMatchUp) {
13379
- participantMap[participantId].scheduleItems.push({
13380
- ...schedule,
13381
- scheduledDate: extractDate(schedule?.scheduledDate),
13382
- scheduledTime: extractTime$1(schedule?.scheduledTime),
13383
- checkScoreHasValue: checkScoreHasValue({ score }),
13384
- matchUpStatus,
13385
- roundPosition,
13386
- structureId,
13387
- matchUpType,
13388
- roundNumber,
13389
- matchUpId,
13390
- potential,
13391
- drawId,
13392
- });
13393
- }
13394
- }
13395
-
13396
13374
  function getTournamentPublishStatus(params) {
13397
13375
  const paramsCheck = checkRequiredParameters(params, [{ [TOURNAMENT_RECORD]: true }]);
13398
13376
  if (paramsCheck.error)
@@ -13526,7 +13504,7 @@ function getPubStatus({ event }) {
13526
13504
  const drawDetailPublishedIds = drawDetails &&
13527
13505
  Object.keys(drawDetails).length &&
13528
13506
  Object.keys(drawDetails).filter((drawId) => getDrawPublishStatus({ drawDetails, drawId }));
13529
- const publishedDrawIds = drawDetailPublishedIds?.length ? drawDetailPublishedIds : eventPubStatus.drawIds ?? [];
13507
+ const publishedDrawIds = drawDetailPublishedIds?.length ? drawDetailPublishedIds : (eventPubStatus.drawIds ?? []);
13530
13508
  if (publishedDrawIds?.length && !drawDetailPublishedIds?.length) {
13531
13509
  for (const drawId of publishedDrawIds) {
13532
13510
  drawDetails[drawId] = {
@@ -13545,8 +13523,27 @@ function getPubStatus({ event }) {
13545
13523
  };
13546
13524
  }
13547
13525
 
13548
- function stringSort(a, b) {
13549
- return (a || '').localeCompare(b || '');
13526
+ function addScheduleItem(params) {
13527
+ const { participantMap, participantId, matchUpStatus, roundPosition, structureId, matchUpType, roundNumber, matchUpId, potential, schedule, drawId, score, } = params;
13528
+ if (!schedule || !Object.keys(schedule).length)
13529
+ return;
13530
+ const ignoreMatchUp = matchUpStatus === BYE;
13531
+ if (!ignoreMatchUp) {
13532
+ participantMap[participantId].scheduleItems.push({
13533
+ ...schedule,
13534
+ scheduledDate: extractDate(schedule?.scheduledDate),
13535
+ scheduledTime: extractTime$1(schedule?.scheduledTime),
13536
+ checkScoreHasValue: checkScoreHasValue({ score }),
13537
+ matchUpStatus,
13538
+ roundPosition,
13539
+ structureId,
13540
+ matchUpType,
13541
+ roundNumber,
13542
+ matchUpId,
13543
+ potential,
13544
+ drawId,
13545
+ });
13546
+ }
13550
13547
  }
13551
13548
 
13552
13549
  function addStructureParticipation({ finishingPositionRange: matchUpFinishingPositionRanges = {}, participantMap, finishingRound, participantWon, matchUpStatus, participantId, stageSequence, roundNumber, structureId, matchUpId, drawId, stage, }) {
@@ -13740,7 +13737,8 @@ function processSides(params) {
13740
13737
  individualParticipantIds.forEach((participantId, i) => {
13741
13738
  const partnerParticipantId = individualParticipantIds[1 - i];
13742
13739
  const participant = participantMap[participantId];
13743
- participant && addPartner({ participant, partnerParticipantId });
13740
+ if (participant)
13741
+ addPartner({ participant, partnerParticipantId });
13744
13742
  });
13745
13743
  if (withEvents && matchUpSides) {
13746
13744
  const teamParticipantId = matchUpSides.find((s) => s.sideNumber === sideNumber)?.participant?.participantId;
@@ -13792,6 +13790,10 @@ function processSides(params) {
13792
13790
  }
13793
13791
  }
13794
13792
 
13793
+ function stringSort(a, b) {
13794
+ return (a || '').localeCompare(b || '');
13795
+ }
13796
+
13795
13797
  function getParticipantEntries(params) {
13796
13798
  const { participantFilters, convertExtensions, policyDefinitions, tournamentRecord, usePublishState, contextFilters, matchUpFilters, participantMap, contextProfile, withPotentialMatchUps, withRankingProfile, withScheduleItems, scheduleAnalysis, withTeamMatchUps, withStatistics, withOpponents, withMatchUps, withSeeding, withEvents, withDraws, } = params;
13797
13799
  const targetParticipantIds = participantFilters?.participantIds;
@@ -16343,7 +16345,7 @@ function getNextSeedBlock(params) {
16343
16345
  const seedsWithoutDrawPositions = seedAssignments?.filter((assignment) => !assignment.participantId);
16344
16346
  const seedsLeftToAssign = unplacedSeedAssignments?.length && unplacedSeedAssignments.length > 0
16345
16347
  ? unplacedSeedAssignments.length
16346
- : seedsWithoutDrawPositions?.length ?? 0;
16348
+ : (seedsWithoutDrawPositions?.length ?? 0);
16347
16349
  const unfilled = (seedsLeftToAssign &&
16348
16350
  nextSeedBlock?.drawPositions.filter((drawPosition) => !assignedDrawPositions?.includes(drawPosition))) ||
16349
16351
  [];
@@ -19529,7 +19531,8 @@ function removeStructure(params) {
19529
19531
  mainStageSequence1.extensions = [];
19530
19532
  }
19531
19533
  }
19532
- isQualifyingStructure && resequenceStructures({ drawDefinition });
19534
+ if (isQualifyingStructure)
19535
+ resequenceStructures({ drawDefinition });
19533
19536
  deleteMatchUpsNotice({
19534
19537
  tournamentId: tournamentRecord?.tournamentId,
19535
19538
  matchUpIds: removedMatchUpIds,
@@ -19719,6 +19722,31 @@ function addVoluntaryConsolationStage(params) {
19719
19722
  return addVoluntaryConsolationStage$1(params);
19720
19723
  }
19721
19724
 
19725
+ function resetQualifyingStructure({ tournamentRecord, drawDefinition, event, structureId, }) {
19726
+ if (!drawDefinition)
19727
+ return { error: MISSING_DRAW_DEFINITION };
19728
+ const structure = drawDefinition.structures?.find((structure) => structure.stage === QUALIFYING && structure.structureId === structureId);
19729
+ if (!structure)
19730
+ return { error: STRUCTURE_NOT_FOUND };
19731
+ const removedMatchUpIds = structure.matchUps?.map(({ matchUpId }) => matchUpId) || [];
19732
+ structure.positionAssignments = [];
19733
+ structure.seedAssignments = [];
19734
+ structure.matchUps = [];
19735
+ deleteMatchUpsNotice({
19736
+ tournamentId: tournamentRecord?.tournamentId,
19737
+ action: 'resetVoluntaryConsolationStructure',
19738
+ matchUpIds: removedMatchUpIds,
19739
+ drawDefinition,
19740
+ });
19741
+ modifyDrawNotice({
19742
+ tournamentId: tournamentRecord?.tournamentId,
19743
+ eventId: event?.eventId,
19744
+ drawDefinition,
19745
+ structureIds: [structure.structureId],
19746
+ });
19747
+ return { ...SUCCESS };
19748
+ }
19749
+
19722
19750
  const QUALIFYING_PARTICIPANT_METHOD = 'qualifierDrawPositionAssignment';
19723
19751
  const WITHDRAW_PARTICIPANT_METHOD = 'withdrawParticipantAtDrawPosition';
19724
19752
  const ALTERNATE_PARTICIPANT_METHOD = 'alternateDrawPositionAssignment';
@@ -21950,7 +21978,7 @@ function getParticipantResults({ participantIds, pressureRating, matchUpFormat,
21950
21978
  ? tieMatchUps
21951
21979
  .filter(({ matchUpStatus }) => !excludeMatchUpStatuses.includes(matchUpStatus))
21952
21980
  .flatMap(({ score }) => score?.sets?.length ?? 0)
21953
- : score?.sets?.length ?? 0);
21981
+ : (score?.sets?.length ?? 0));
21954
21982
  const totalSets = allSets?.reduce((a, b) => a + b, 0);
21955
21983
  for (const matchUp of filteredMatchUps ?? []) {
21956
21984
  const { matchUpStatus, tieMatchUps, tieFormat, score, winningSide, sides } = matchUp;
@@ -22288,7 +22316,7 @@ function getTallyReport({ matchUps, order, report }) {
22288
22316
  const floatSort = (a, b) => parseFloat(step.reversed ? a : b) - parseFloat(step.reversed ? b : a);
22289
22317
  const participantsCount = step.groups
22290
22318
  ? Object.values(step.groups).flat(Infinity).length
22291
- : step.participantIds?.length ?? 0;
22319
+ : (step.participantIds?.length ?? 0);
22292
22320
  const getExplanation = (step) => {
22293
22321
  step.groups &&
22294
22322
  Object.keys(step.groups)
@@ -22899,11 +22927,11 @@ function modifyMatchUpScore(params) {
22899
22927
  const updateTally = (structure) => {
22900
22928
  matchUpFormat = isDualMatchUp
22901
22929
  ? 'SET1-S:T100'
22902
- : matchUpFormat ??
22930
+ : (matchUpFormat ??
22903
22931
  matchUp.matchUpFormat ??
22904
22932
  structure?.matchUpFormat ??
22905
22933
  drawDefinition?.matchUpFormat ??
22906
- event?.matchUpFormat;
22934
+ event?.matchUpFormat);
22907
22935
  const matchUpFilters = isDualMatchUp ? { matchUpTypes: [TEAM$2] } : undefined;
22908
22936
  const { matchUps } = getAllStructureMatchUps({
22909
22937
  afterRecoveryTimes: false,
@@ -25076,6 +25104,7 @@ var mutate$c = {
25076
25104
  removeStructure: removeStructure,
25077
25105
  renameStructures: renameStructures,
25078
25106
  resetDrawDefinition: resetDrawDefinition,
25107
+ resetQualifyingStructure: resetQualifyingStructure,
25079
25108
  resetVoluntaryConsolationStructure: resetVoluntaryConsolationStructure,
25080
25109
  setDrawParticipantRepresentativeIds: setDrawParticipantRepresentativeIds,
25081
25110
  setPositionAssignments: setPositionAssignments,
@@ -25097,20 +25126,20 @@ function getEligibleVoluntaryConsolationParticipants({ excludedMatchUpStatuses =
25097
25126
  const eventMatchUpFilters = event?.eventType ? { matchUpTypes: [event.eventType] } : undefined;
25098
25127
  const drawMatchUpFilters = drawDefinition?.matchUpType ? { matchUpTypes: [drawDefinition.matchUpType] } : undefined;
25099
25128
  const matchUps = includeEventParticipants && event
25100
- ? allEventMatchUps({
25129
+ ? (allEventMatchUps({
25101
25130
  contextFilters: { stages },
25102
25131
  matchUpFilters: eventMatchUpFilters,
25103
25132
  tournamentRecord,
25104
25133
  inContext: true,
25105
25134
  event,
25106
- })?.matchUps ?? []
25107
- : allDrawMatchUps({
25135
+ })?.matchUps ?? [])
25136
+ : (allDrawMatchUps({
25108
25137
  contextFilters: { stages },
25109
25138
  matchUpFilters: drawMatchUpFilters,
25110
25139
  tournamentRecord,
25111
25140
  inContext: true,
25112
25141
  drawDefinition,
25113
- })?.matchUps ?? [];
25142
+ })?.matchUps ?? []);
25114
25143
  const voluntaryConsolationEntries = getStageEntries$2({
25115
25144
  stage: VOLUNTARY_CONSOLATION,
25116
25145
  drawDefinition,
@@ -30130,23 +30159,21 @@ function keyValueScore(params) {
30130
30159
  else if (analysis.isGameScoreEntry) {
30131
30160
  info = 'game scoreString entry';
30132
30161
  }
30162
+ else if (analysis.lastSetIsComplete || !sets.length) {
30163
+ updated = true;
30164
+ const { scoreString: newScore, set } = keyValueSetScore({
30165
+ analysis,
30166
+ lowSide,
30167
+ scoreString,
30168
+ value: ensureInt(value),
30169
+ });
30170
+ if (set)
30171
+ set.setNumber = sets?.length + 1 || 1;
30172
+ sets = sets?.concat(set).filter(Boolean) || [set];
30173
+ scoreString = newScore || undefined;
30174
+ }
30133
30175
  else {
30134
- if (analysis.lastSetIsComplete || !sets.length) {
30135
- updated = true;
30136
- const { scoreString: newScore, set } = keyValueSetScore({
30137
- analysis,
30138
- lowSide,
30139
- scoreString,
30140
- value: ensureInt(value),
30141
- });
30142
- if (set)
30143
- set.setNumber = sets?.length + 1 || 1;
30144
- sets = sets?.concat(set).filter(Boolean) || [set];
30145
- scoreString = newScore || undefined;
30146
- }
30147
- else {
30148
- console.log('error: unknown outcome');
30149
- }
30176
+ console.log('error: unknown outcome');
30150
30177
  }
30151
30178
  if (updated) {
30152
30179
  sets = sets?.filter(Boolean);
@@ -30225,10 +30252,8 @@ function correctContainerMismatch(score) {
30225
30252
  lastType = '';
30226
30253
  return complement;
30227
30254
  }
30228
- else {
30229
- if (!typeCount[lastType])
30230
- lastType = '';
30231
- }
30255
+ else if (!typeCount[lastType])
30256
+ lastType = '';
30232
30257
  }
30233
30258
  return char;
30234
30259
  })
@@ -35495,31 +35520,32 @@ function tournamentRelevantSchedulingIds(params) {
35495
35520
  tournamentIds.push(tournamentId);
35496
35521
  tournamentMap[tournamentId] = {};
35497
35522
  const events = tournamentRecord?.events || [];
35498
- events.forEach((event) => {
35523
+ for (const event of events) {
35499
35524
  const eventId = event.eventId;
35500
35525
  eventIds.push(eventId);
35501
35526
  tournamentMap[tournamentId][eventId] = {};
35502
- (event.drawDefinitions || []).forEach((drawDefinition) => {
35527
+ const mapParsedInt = (roundNumber) => parseInt(roundNumber);
35528
+ for (const drawDefinition of event.drawDefinitions || []) {
35503
35529
  const drawId = drawDefinition.drawId;
35504
35530
  drawIds.push(drawId);
35505
35531
  tournamentMap[tournamentId][eventId][drawId] = {};
35506
35532
  const { structures } = getDrawStructures({ drawDefinition });
35507
- (structures || []).forEach((structure) => {
35533
+ for (const structure of structures || []) {
35508
35534
  const structureId = structure.structureId;
35509
35535
  const { matchUps } = getAllStructureMatchUps({ structure });
35510
35536
  const { roundMatchUps } = getRoundMatchUps({ matchUps });
35511
- const rounds = roundMatchUps && Object.keys(roundMatchUps).map((roundNumber) => parseInt(roundNumber));
35537
+ const rounds = roundMatchUps && Object.keys(roundMatchUps).map(mapParsedInt);
35512
35538
  tournamentMap[tournamentId][eventId][drawId][structureId] = rounds;
35513
35539
  structureIds.push(structureId);
35514
35540
  if (structure.structures?.length) {
35515
- structure.structures.forEach((itemStructure) => {
35541
+ for (const itemStructure of structure.structures) {
35516
35542
  structureIds.push(itemStructure.structureId);
35517
35543
  tournamentMap[tournamentId][eventId][drawId][itemStructure.structureId] = rounds;
35518
- });
35544
+ }
35519
35545
  }
35520
- });
35521
- });
35522
- });
35546
+ }
35547
+ }
35548
+ }
35523
35549
  }
35524
35550
  return {
35525
35551
  tournamentMap,
@@ -36851,7 +36877,7 @@ function getPredictiveAccuracy(params) {
36851
36877
  : 0;
36852
36878
  const zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
36853
36879
  ? (zonePct ?? 0 / 100) * ratingsRangeDifference
36854
- : params.zoneMargin ?? ratingsRangeDifference;
36880
+ : (params.zoneMargin ?? ratingsRangeDifference);
36855
36881
  const contextProfile = { withScaleValues: true, withCompetitiveness: true };
36856
36882
  const contextFilters = {
36857
36883
  matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
@@ -38361,6 +38387,7 @@ var index$e = {
38361
38387
  removeStructure: removeStructure,
38362
38388
  renameStructures: renameStructures,
38363
38389
  resetDrawDefinition: resetDrawDefinition,
38390
+ resetQualifyingStructure: resetQualifyingStructure,
38364
38391
  resetVoluntaryConsolationStructure: resetVoluntaryConsolationStructure,
38365
38392
  setDrawParticipantRepresentativeIds: setDrawParticipantRepresentativeIds,
38366
38393
  setPositionAssignments: setPositionAssignments,
@@ -38576,7 +38603,7 @@ function addParticipant(params) {
38576
38603
  const { allowDuplicateParticipantIdPairs, returnParticipant, disableNotice, pairOverride, participant } = params;
38577
38604
  const tournamentRecord = params.tournamentId
38578
38605
  ? params.tournamentRecords?.[params.tournamentId]
38579
- : params.tournamentRecord ?? (params.activeTournamentId && params.tournamentRecords?.[params.activeTournamentId]);
38606
+ : (params.tournamentRecord ?? (params.activeTournamentId && params.tournamentRecords?.[params.activeTournamentId]));
38580
38607
  if (!tournamentRecord)
38581
38608
  return { error: MISSING_TOURNAMENT_RECORD };
38582
38609
  if (!participant)
@@ -39189,7 +39216,7 @@ function generateEventsFromTieFormat(params) {
39189
39216
  const entryStatus = eventType === DOUBLES_EVENT ? UNGROUPED : params.entryStatus || DIRECT_ACCEPTANCE;
39190
39217
  const participantIds = eventGender === MIXED
39191
39218
  ? [...genderedParticipants[MALE], ...genderedParticipants[FEMALE]]
39192
- : genderedParticipants[eventGender] ?? [];
39219
+ : (genderedParticipants[eventGender] ?? []);
39193
39220
  if (participantIds.length) {
39194
39221
  const result = addEventEntries({
39195
39222
  participantIds,
@@ -40581,7 +40608,7 @@ function checkCategoryUpdates(params) {
40581
40608
  const startDate = params.eventUpdates.startDate || params.event.startDate || params.tournamentRecord.startDate;
40582
40609
  const endDate = params.eventUpdates.endDate || params.event.endDate || params.tournamentRecord.endDate;
40583
40610
  const individualParticpants = params.enteredParticipants
40584
- .map((p) => (p.participantType === INDIVIDUAL ? p : p.individualParticpants ?? []))
40611
+ .map((p) => (p.participantType === INDIVIDUAL ? p : (p.individualParticpants ?? [])))
40585
40612
  .flat();
40586
40613
  const startAgeDetails = getCategoryAgeDetails({ category, consideredDate: startDate });
40587
40614
  const endAgeDetails = getCategoryAgeDetails({ category, consideredDate: endDate });
@@ -40636,11 +40663,11 @@ function getEnteredParticipants(params) {
40636
40663
  })
40637
40664
  .map(({ participantId }) => participantId) ?? [];
40638
40665
  return enteredParticipantIds
40639
- ? getParticipants({
40666
+ ? (getParticipants({
40640
40667
  participantFilters: { participantIds: enteredParticipantIds },
40641
40668
  withIndividualParticipants: true,
40642
40669
  tournamentRecord,
40643
- }).participants ?? []
40670
+ }).participants ?? [])
40644
40671
  : [];
40645
40672
  }
40646
40673
  function getParticipantsProfile({ enteredParticipants }) {
@@ -41170,14 +41197,14 @@ function generateLineUps(params) {
41170
41197
  const singlesSort = teamParticipant.individualParticipants?.sort(singlesScaleSort) ?? [];
41171
41198
  const doublesSort = singlesOnly
41172
41199
  ? singlesSort
41173
- : teamParticipant.individualParticipants?.sort(doublesScaleSort) ?? [];
41200
+ : (teamParticipant.individualParticipants?.sort(doublesScaleSort) ?? []);
41174
41201
  const participantAssignments = {};
41175
41202
  for (const collectionDefinition of collectionDefinitions) {
41176
41203
  const collectionParticipantIds = [];
41177
41204
  const { collectionId, matchUpCount, matchUpType, gender } = collectionDefinition;
41178
41205
  const singlesMatchUp = isMatchUpEventType(SINGLES_MATCHUP)(matchUpType);
41179
41206
  generateRange(0, matchUpCount).forEach((i) => {
41180
- const typeSort = singlesMatchUp ? singlesSort : doublesSort ?? [];
41207
+ const typeSort = singlesMatchUp ? singlesSort : (doublesSort ?? []);
41181
41208
  const collectionPosition = i + 1;
41182
41209
  const participantIds = [];
41183
41210
  generateRange(0, singlesMatchUp ? 1 : 2).forEach((i) => {
@@ -49976,7 +50003,7 @@ function generateEventParticipants(params) {
49976
50003
  const qualifyingParticipantsCount = uniqueParticipantsCount[QUALIFYING] || 0;
49977
50004
  const participantsCount = eventProfile.drawProfiles?.length
49978
50005
  ? mainParticipantsCount + qualifyingParticipantsCount
49979
- : eventProfile.participantsProfile?.participantsCount ?? 0;
50006
+ : (eventProfile.participantsProfile?.participantsCount ?? 0);
49980
50007
  const sex = [MALE, FEMALE].includes(gender) ? gender : undefined;
49981
50008
  const idPrefix = participantsProfile?.idPrefix ? `E-${eventIndex}-${participantsProfile?.idPrefix}` : undefined;
49982
50009
  const { participants: uniqueFlightParticipants } = generateParticipants({
@@ -51097,8 +51124,8 @@ function processLeagueProfiles(params) {
51097
51124
  tournamentRecord.events = [];
51098
51125
  tournamentRecord.events.push(event);
51099
51126
  if (entries.length) {
51100
- const roundsCount = (isNumeric(leagueProfile.roundsCount) && leagueProfile.roundsCount) ??
51101
- leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN
51127
+ const roundsCount = ((isNumeric(leagueProfile.roundsCount) && leagueProfile.roundsCount) ??
51128
+ leagueProfile.roundsCount === DOUBLE_ROUND_ROBIN)
51102
51129
  ? (drawSize - 1) * 2
51103
51130
  : drawSize - 1;
51104
51131
  const result = generateDrawDefinition({
@@ -56765,7 +56792,7 @@ function copyTournamentRecord(params) {
56765
56792
  }, false, true);
56766
56793
  };
56767
56794
  const tournamentRecord = {
56768
- participants: params.copyParticipants ? params.tournamentRecord.participants?.map(copyParticipant) ?? [] : [],
56795
+ participants: params.copyParticipants ? (params.tournamentRecord.participants?.map(copyParticipant) ?? []) : [],
56769
56796
  parentOrganisation: makeDeepCopy({ ...params.tournamentRecord.parentOrganisation }, false, true),
56770
56797
  venues: makeDeepCopy(params.tournamentRecord.venues ?? [], false, true),
56771
56798
  extensions: filteredExtensions(params.tournamentRecord.extensions),
@@ -58182,7 +58209,7 @@ function JSON2CSV(arrayOfJSON, config) {
58182
58209
  .sort(sortColumns);
58183
58210
  Object.keys(columnMap).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
58184
58211
  Object.keys(columnTransform).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
58185
- typeof context === 'object' &&
58212
+ if (typeof context === 'object')
58186
58213
  Object.keys(context).forEach((columnName) => !tranformedHeaderRow.includes(columnName) && tranformedHeaderRow.unshift(columnName));
58187
58214
  let mappedHeaderRow = tranformedHeaderRow.map((key) => columnMap[key] || key);
58188
58215
  if (onlyHeaderRow)