tods-competition-factory 2.0.35 → 2.0.37

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function factoryVersion() {
6
- return '2.0.35';
6
+ return '2.0.37';
7
7
  }
8
8
 
9
9
  function isFunction(obj) {
@@ -1873,7 +1873,7 @@ function checkRequiredParameters(params, requiredParams, stack) {
1873
1873
  if (!paramError)
1874
1874
  return { valid: true };
1875
1875
  const error = params?.[errorParam] === undefined
1876
- ? errors[errorParam] || INVALID_VALUES
1876
+ ? errors[errorParam] || paramError[ERROR] || INVALID_VALUES
1877
1877
  : (paramError[VALIDATE] && paramError[INVALID]) || INVALID_VALUES;
1878
1878
  const param = errorParam ?? (paramError[ONE_OF] && Object.keys(paramError[ONE_OF]).join(', '));
1879
1879
  return decorateResult({
@@ -1917,10 +1917,10 @@ function findParamError(params, requiredParams) {
1917
1917
  const booleanParams = Object.keys(attrs).filter((key) => typeof attrs[key] === 'boolean');
1918
1918
  const invalidParam = booleanParams.find((param) => {
1919
1919
  const invalidValidationFunction = _validate && !isFunction(_validate);
1920
- const faliedTypeCheck = params[param] && !_validate && invalidType(params, param, _ofType);
1921
- const paramNotPresent = attrs[param] && !params[param];
1920
+ const faliedTypeCheck = params[param] !== undefined && !_validate && invalidType(params, param, _ofType);
1921
+ const paramNotPresent = attrs[param] && [undefined, null].includes(params[param]);
1922
1922
  const invalid = invalidValidationFunction || faliedTypeCheck || paramNotPresent;
1923
- const hasError = invalid || (_validate && params[param] && !checkValidation(params[param], _validate));
1923
+ const hasError = invalid || (_validate && params[param] !== undefined && !checkValidation(params[param], _validate));
1924
1924
  if (hasError) {
1925
1925
  errorParam = param;
1926
1926
  paramInfo = _info;
@@ -7166,7 +7166,11 @@ function findEvent(params) {
7166
7166
  };
7167
7167
  }
7168
7168
 
7169
- function getHomeParticipantId({ visibilityThreshold, timeStamp, schedule, matchUp }) {
7169
+ function getHomeParticipantId(params) {
7170
+ const { visibilityThreshold, timeStamp, schedule, matchUp } = params;
7171
+ const paramsCheck = checkRequiredParameters(params, [{ [MATCHUP]: true }]);
7172
+ if (paramsCheck.error)
7173
+ return paramsCheck;
7170
7174
  const { itemValue: homeParticipantId, timeStamp: itemTimeStamp } = latestVisibleTimeItemValue({
7171
7175
  timeItems: matchUp?.timeItems || [],
7172
7176
  itemType: HOME_PARTICIPANT_ID,
@@ -15376,13 +15380,7 @@ function checkRoundsArgs(params, additionalChecks) {
15376
15380
  }
15377
15381
 
15378
15382
  function shiftAdHocRounds(params) {
15379
- const check = checkRoundsArgs(params, [
15380
- {
15381
- targetRoundNumber: true,
15382
- roundNumber: true,
15383
- [OF_TYPE]: NUMBER,
15384
- },
15385
- ]);
15383
+ const check = checkRoundsArgs(params, [{ targetRoundNumber: true, roundNumber: true, [OF_TYPE]: NUMBER }]);
15386
15384
  if (check.error)
15387
15385
  return check;
15388
15386
  const { structure, roundMatchUps, roundNumbers } = check;
@@ -19909,7 +19907,109 @@ function calculatePercentages({ participantResults, matchUpFormat, tallyPolicy,
19909
19907
  });
19910
19908
  }
19911
19909
 
19912
- function getParticipantResults({ participantIds, matchUpFormat, tallyPolicy, perPlayer, matchUps, }) {
19910
+ const ELO = 'ELO';
19911
+ const NTRP = 'NTRP';
19912
+ const TRN = 'TRN';
19913
+ const UTR = 'UTR';
19914
+ const WTN = 'WTN';
19915
+ const ratingConstants = {
19916
+ ELO,
19917
+ NTRP,
19918
+ TRN,
19919
+ UTR,
19920
+ WTN,
19921
+ };
19922
+
19923
+ const ratingsParameters = {
19924
+ [ELO]: {
19925
+ defaultInitialization: 1500,
19926
+ decimalsCount: 0,
19927
+ range: [0, 3000],
19928
+ ascending: true,
19929
+ },
19930
+ [NTRP]: {
19931
+ accessors: ['ntrpRating', 'dntrpRatingHundredths'],
19932
+ attributes: { ustaRatingType: '' },
19933
+ accessor: 'dntrpRatingHundredths',
19934
+ defaultInitialization: 3,
19935
+ decimalsCount: 1,
19936
+ ascending: true,
19937
+ range: [1, 7],
19938
+ },
19939
+ [UTR]: {
19940
+ defaultInitialization: 6,
19941
+ accessors: ['utrRating'],
19942
+ accessor: 'utrRating',
19943
+ decimalsCount: 2,
19944
+ ascending: true,
19945
+ range: [1, 16],
19946
+ },
19947
+ [WTN]: {
19948
+ attributes: { confidence: { generator: true, range: [60, 100] } },
19949
+ accessors: ['wtnRating', 'confidence'],
19950
+ defaultInitialization: 23,
19951
+ accessor: 'wtnRating',
19952
+ ascending: false,
19953
+ decimalsCount: 2,
19954
+ range: [40, 1],
19955
+ },
19956
+ };
19957
+
19958
+ function convertRange({ value, sourceRange, targetRange }) {
19959
+ return (((value - sourceRange[0]) * (targetRange[1] - targetRange[0])) / (sourceRange[1] - sourceRange[0]) + targetRange[0]);
19960
+ }
19961
+
19962
+ function getRatingConvertedToELO({ sourceRatingType, sourceRating }) {
19963
+ const sourceRatingRange = ratingsParameters[sourceRatingType].range;
19964
+ const invertedScale = sourceRatingRange[0] > sourceRatingRange[1];
19965
+ const eloRatingRange = ratingsParameters[ELO].range;
19966
+ return convertRange({
19967
+ value: invertedScale ? sourceRatingRange[0] - sourceRating : sourceRating,
19968
+ sourceRange: sourceRatingRange,
19969
+ targetRange: eloRatingRange,
19970
+ });
19971
+ }
19972
+ function getRatingConvertedFromELO({ targetRatingType, sourceRating }) {
19973
+ const decimalPlaces = ratingsParameters[targetRatingType].decimalsCount || 0;
19974
+ const targetRatingRange = ratingsParameters[targetRatingType].range;
19975
+ const invertedScale = targetRatingRange[0] > targetRatingRange[1];
19976
+ const eloRatingRange = ratingsParameters[ELO].range;
19977
+ const result = convertRange({
19978
+ targetRange: targetRatingRange,
19979
+ sourceRange: eloRatingRange,
19980
+ value: sourceRating,
19981
+ });
19982
+ const convertedRating = parseFloat(parseFloat(result).toFixed(decimalPlaces));
19983
+ return invertedScale ? targetRatingRange[0] - convertedRating : convertedRating;
19984
+ }
19985
+
19986
+ function getConvertedRating(params) {
19987
+ const paramsCheck = checkRequiredParameters(params, [{ ratings: true, [OF_TYPE]: OBJECT }]);
19988
+ if (paramsCheck.error)
19989
+ return paramsCheck;
19990
+ const matchUpType = params.matchUpType && [SINGLES, DOUBLES].includes(params.matchUpType) ? params.matchUpType : SINGLES;
19991
+ const ratingTypes = Object.keys(ratingsParameters);
19992
+ const targetRatingType = params.targetRatingType && ratingTypes.includes(params.targetRatingType) ? params.targetRatingType : ELO;
19993
+ const sourceRatings = params.ratings[matchUpType]
19994
+ ? params.ratings[matchUpType].reduce((sr, rating) => (sr.includes(rating.scaleName) ? sr : sr.concat(rating.scaleName)), [])
19995
+ : [];
19996
+ if (!sourceRatings)
19997
+ return { error: NOT_FOUND };
19998
+ const sourceRatingObject = params.ratings[matchUpType]?.find((rating) => rating.scaleName === targetRatingType) ??
19999
+ params.ratings[matchUpType][0];
20000
+ if (sourceRatings[0] === targetRatingType)
20001
+ return sourceRatingObject;
20002
+ const accessor = ratingsParameters[sourceRatingObject.scaleName].accessor;
20003
+ const value = accessor ? sourceRatingObject.scaleValue[accessor] : sourceRatingObject.scaleValue;
20004
+ const eloValue = getRatingConvertedToELO({ sourceRatingType: sourceRatingObject.scaleName, sourceRating: value });
20005
+ const convertedRating = getRatingConvertedFromELO({
20006
+ targetRatingType: targetRatingType,
20007
+ sourceRating: eloValue,
20008
+ });
20009
+ return { convertedRating };
20010
+ }
20011
+
20012
+ function getParticipantResults({ participantIds, pressureRating, matchUpFormat, tallyPolicy, perPlayer, matchUps, }) {
19913
20013
  const participantResults = {};
19914
20014
  const excludeMatchUpStatuses = tallyPolicy?.excludeMatchUpStatuses || [];
19915
20015
  const filteredMatchUps = matchUps?.filter((matchUp) => {
@@ -20029,11 +20129,13 @@ function getParticipantResults({ participantIds, matchUpFormat, tallyPolicy, per
20029
20129
  matchUpFormat: tieMatchUp.matchUpFormat,
20030
20130
  matchUpStatus: tieMatchUp.matchUpStatus,
20031
20131
  score: tieMatchUp.score,
20132
+ sides: tieMatchUp.sides,
20032
20133
  winningParticipantId,
20033
20134
  losingParticipantId,
20135
+ manualGamesOverride,
20034
20136
  participantResults,
20035
20137
  isTieMatchUp: true,
20036
- manualGamesOverride,
20138
+ pressureRating,
20037
20139
  tallyPolicy,
20038
20140
  winningSide,
20039
20141
  });
@@ -20053,20 +20155,22 @@ function getParticipantResults({ participantIds, matchUpFormat, tallyPolicy, per
20053
20155
  manualGamesOverride,
20054
20156
  losingParticipantId,
20055
20157
  participantResults,
20158
+ pressureRating,
20056
20159
  matchUpStatus,
20057
20160
  tallyPolicy,
20058
20161
  winningSide,
20059
20162
  score,
20163
+ sides,
20060
20164
  });
20061
20165
  }
20062
20166
  }
20167
+ const gamesWonSide1 = score?.sets?.reduce((total, set) => total + (set?.side1Score ?? 0), 0);
20168
+ const gamesWonSide2 = score?.sets?.reduce((total, set) => total + (set.side2Score ?? 0), 0);
20063
20169
  if (manualGamesOverride) {
20064
20170
  const side1participantId = sides?.find(({ sideNumber }) => sideNumber === 1)?.participantId;
20065
20171
  const side2participantId = sides?.find(({ sideNumber }) => sideNumber === 2)?.participantId;
20066
20172
  checkInitializeParticipant(participantResults, side1participantId);
20067
20173
  checkInitializeParticipant(participantResults, side2participantId);
20068
- const gamesWonSide1 = score?.sets?.reduce((total, set) => total + (set?.side1Score ?? 0), 0);
20069
- const gamesWonSide2 = score?.sets?.reduce((total, set) => total + (set.side2Score ?? 0), 0);
20070
20174
  if (side1participantId) {
20071
20175
  participantResults[side1participantId].gamesWon += gamesWonSide1;
20072
20176
  participantResults[side1participantId].gamesLost += gamesWonSide2;
@@ -20119,6 +20223,8 @@ function checkInitializeParticipant(participantResults, participantId) {
20119
20223
  matchUpsWon: 0,
20120
20224
  pointsLost: 0,
20121
20225
  pointsWon: 0,
20226
+ pressureScores: [],
20227
+ ratingVariation: [],
20122
20228
  retirements: 0,
20123
20229
  setsLost: 0,
20124
20230
  setsWon: 0,
@@ -20157,9 +20263,25 @@ function processScore({ manualGamesOverride, participantResults, score, sides })
20157
20263
  }
20158
20264
  });
20159
20265
  }
20160
- function processMatchUp({ winningParticipantId, losingParticipantId, participantResults, manualGamesOverride, matchUpFormat, matchUpStatus, isTieMatchUp, tallyPolicy, winningSide, score, }) {
20266
+ function processMatchUp({ winningParticipantId, manualGamesOverride, losingParticipantId, participantResults, pressureRating, matchUpFormat, matchUpStatus, isTieMatchUp, tallyPolicy, winningSide, score, sides, }) {
20161
20267
  const winningSideIndex = winningSide && winningSide - 1;
20162
20268
  const losingSideIndex = 1 - winningSideIndex;
20269
+ if (pressureRating) {
20270
+ const fixed2 = (value) => parseFloat(Number(Math.round(value * 1000) / 1000).toFixed(2));
20271
+ const gamesWonSide1 = score?.sets?.reduce((total, set) => total + (set?.side1Score ?? 0), 0);
20272
+ const gamesWonSide2 = score?.sets?.reduce((total, set) => total + (set.side2Score ?? 0), 0);
20273
+ const side1 = sides.find(({ sideNumber }) => sideNumber === 1);
20274
+ const side2 = sides.find(({ sideNumber }) => sideNumber === 2);
20275
+ const side1ConvertedRating = getConvertedRating({ ratings: side1?.participant?.ratings }).convertedRating;
20276
+ const side2ConvertedRating = getConvertedRating({ ratings: side2?.participant?.ratings }).convertedRating;
20277
+ const side1Value = gamesWonSide1 * side2ConvertedRating;
20278
+ const side2Value = gamesWonSide2 * side1ConvertedRating;
20279
+ participantResults[side1?.participantId].pressureScores.push(fixed2(side1Value / (side1Value + side2Value)));
20280
+ participantResults[side2?.participantId].pressureScores.push(fixed2(side2Value / (side1Value + side2Value)));
20281
+ const highRange = Math.max(...ratingsParameters[ELO].range);
20282
+ participantResults[side1?.participantId].ratingVariation.push(fixed2((side1ConvertedRating - side2ConvertedRating) / highRange));
20283
+ participantResults[side2?.participantId].ratingVariation.push(fixed2((side2ConvertedRating - side1ConvertedRating) / highRange));
20284
+ }
20163
20285
  if (!isTieMatchUp) {
20164
20286
  processOutcome$1({
20165
20287
  winningParticipantId,
@@ -20515,7 +20637,7 @@ function headToHeadWinner({ participantIds, participantResults }) {
20515
20637
  }
20516
20638
  }
20517
20639
 
20518
- function tallyParticipantResults({ policyDefinitions, generateReport, matchUpFormat, matchUps = [], subOrderMap, perPlayer, }) {
20640
+ function tallyParticipantResults({ policyDefinitions, generateReport, pressureRating, matchUpFormat, matchUps = [], subOrderMap, perPlayer, }) {
20519
20641
  if (!matchUps?.length || !validMatchUps(matchUps))
20520
20642
  return { error: MISSING_MATCHUPS };
20521
20643
  const structureIds = unique(matchUps.map(({ structureId }) => structureId));
@@ -20536,6 +20658,7 @@ function tallyParticipantResults({ policyDefinitions, generateReport, matchUpFor
20536
20658
  const consideredMatchUps = matchUps.filter((matchUp) => checkMatchUpIsComplete({ matchUp }) || matchUp.matchUpType === TEAM$1);
20537
20659
  const { participantResults } = getParticipantResults({
20538
20660
  matchUps: consideredMatchUps,
20661
+ pressureRating,
20539
20662
  matchUpFormat,
20540
20663
  tallyPolicy,
20541
20664
  perPlayer,
@@ -21209,7 +21332,7 @@ function tiebreakFormat(tieobject) {
21209
21332
  }
21210
21333
 
21211
21334
  function isValidMatchUpFormat({ matchUpFormat }) {
21212
- if (typeof matchUpFormat !== 'string')
21335
+ if (!isString(matchUpFormat) || matchUpFormat === '')
21213
21336
  return false;
21214
21337
  const parsedFormat = parse(matchUpFormat);
21215
21338
  const setParts = matchUpFormat.match(/-S:([1-9])+\/TB([0-9]{1,2})@?([1-9]?)*/);
@@ -26350,55 +26473,7 @@ function addParticipantScaleItem({ removePriorValues, participant, scaleItem })
26350
26473
  return { ...SUCCESS, valueChanged, newValue: scaleItem.scaleValue };
26351
26474
  }
26352
26475
 
26353
- const ELO = 'ELO';
26354
- const NTRP = 'NTRP';
26355
- const TRN = 'TRN';
26356
- const UTR = 'UTR';
26357
- const WTN = 'WTN';
26358
- const ratingConstants = {
26359
- ELO,
26360
- NTRP,
26361
- TRN,
26362
- UTR,
26363
- WTN,
26364
- };
26365
-
26366
- const ratingsParameters = {
26367
- [ELO]: {
26368
- defaultInitialization: 1500,
26369
- decimalsCount: 0,
26370
- range: [0, 3000],
26371
- ascending: true,
26372
- },
26373
- [NTRP]: {
26374
- accessors: ['ntrpRating', 'dntrpRatingHundredths'],
26375
- attributes: { ustaRatingType: '' },
26376
- accessor: 'dntrpRatingHundredths',
26377
- defaultInitialization: 3,
26378
- decimalsCount: 1,
26379
- ascending: true,
26380
- range: [1, 7],
26381
- },
26382
- [UTR]: {
26383
- defaultInitialization: 6,
26384
- accessors: ['utrRating'],
26385
- accessor: 'utrRating',
26386
- decimalsCount: 2,
26387
- ascending: true,
26388
- range: [1, 16],
26389
- },
26390
- [WTN]: {
26391
- attributes: { confidence: { generator: true, range: [60, 100] } },
26392
- accessors: ['wtnRating', 'confidence'],
26393
- defaultInitialization: 23,
26394
- accessor: 'wtnRating',
26395
- ascending: false,
26396
- decimalsCount: 2,
26397
- range: [40, 1],
26398
- },
26399
- };
26400
-
26401
- const k538 = (countables) => 250 / Math.pow(countables + 5, 0.4);
26476
+ const k538 = (countables = 0) => 250 / Math.pow(countables + 5, 0.4);
26402
26477
  const kDefault = () => 1;
26403
26478
  function kSet(maxCountables = 3, counted = 2) {
26404
26479
  const kset = maxCountables / counted;
@@ -26412,12 +26487,12 @@ const eloConfig = {
26412
26487
  kDefault,
26413
26488
  };
26414
26489
  function calculateNewRatings(params) {
26415
- let { winnerRating, loserRating, ratingRange } = params;
26490
+ let { winnerRating, loserRating } = params;
26416
26491
  const { ratings = ratingsParameters, winnerCountables = 1, loserCountables = 0, ratingType = ELO, maxCountables, countables, } = params || {};
26417
26492
  const ratingParameters = ratings?.[ratingType];
26418
26493
  if (!ratingParameters)
26419
26494
  return { error: MISSING_VALUE };
26420
- ratingRange = ratingParameters.range || ratingRange;
26495
+ const ratingRange = ratingParameters.range || params.ratingRange;
26421
26496
  winnerRating = winnerRating || ratingParameters.defaultInitialization;
26422
26497
  loserRating = loserRating || ratingParameters.defaultInitialization;
26423
26498
  const invertedScale = ratingRange[0] > ratingRange[1];
@@ -26430,7 +26505,6 @@ function calculateNewRatings(params) {
26430
26505
  if (!inRange(ratingRange, loserRating))
26431
26506
  loserRating = ratingParameters.defaultInitialization;
26432
26507
  }
26433
- const convertRange = ({ value, sourceRange, targetRange }) => ((value - sourceRange[0]) * (targetRange[1] - targetRange[0])) / (sourceRange[1] - sourceRange[0]) + targetRange[0];
26434
26508
  const convertedWinnerRating = convertRange({
26435
26509
  targetRange: ratingsParameters[ELO].range,
26436
26510
  sourceRange: consideredRange,
@@ -33992,7 +34066,7 @@ function getDrawIsPublished({ publishStatus, drawId }) {
33992
34066
  }
33993
34067
 
33994
34068
  function getDrawData(params) {
33995
- const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
34069
+ const { tournamentParticipants = [], includePositionAssignments, policyDefinitions, tournamentRecord, inContext = true, usePublishState, status = PUBLIC, pressureRating, refreshResults, drawDefinition, noDeepCopy, sortConfig, context, event, } = params;
33996
34070
  if (!drawDefinition)
33997
34071
  return { error: MISSING_DRAW_DEFINITION };
33998
34072
  const drawInfo = (({ matchUpFormat, updatedAt, drawType, drawName, drawId }) => ({
@@ -34070,11 +34144,12 @@ function getDrawData(params) {
34070
34144
  drawPosition,
34071
34145
  };
34072
34146
  });
34073
- if (!participantResults?.length && matchUps.length && params.allParticipantResults) {
34147
+ if (matchUps.length && ((!participantResults?.length && params.allParticipantResults) || refreshResults)) {
34074
34148
  const { subOrderMap } = createSubOrderMap({ positionAssignments });
34075
34149
  const result = tallyParticipantResults({
34076
34150
  matchUpFormat: structure.matchUpFormat,
34077
34151
  policyDefinitions,
34152
+ pressureRating,
34078
34153
  subOrderMap,
34079
34154
  matchUps,
34080
34155
  });
@@ -34102,14 +34177,14 @@ function getDrawData(params) {
34102
34177
  structureInfo.positionAssignments = positionAssignments;
34103
34178
  structureInfo.structureActive = matchUps.reduce((active, matchUp) => {
34104
34179
  const activeMatchUpStatus = [
34180
+ DOUBLE_WALKOVER,
34181
+ DOUBLE_DEFAULT,
34182
+ IN_PROGRESS$1,
34105
34183
  COMPLETED$1,
34106
34184
  CANCELLED$1,
34107
34185
  DEFAULTED,
34108
34186
  RETIRED$1,
34109
34187
  WALKOVER$2,
34110
- IN_PROGRESS$1,
34111
- DOUBLE_DEFAULT,
34112
- DOUBLE_WALKOVER,
34113
34188
  ].includes(matchUp.matchUpStatus);
34114
34189
  return active || activeMatchUpStatus || !!matchUp.winningSide || !!matchUp.score?.scoreStringSide1;
34115
34190
  }, false);
@@ -34231,6 +34306,8 @@ function getEventData(params) {
34231
34306
  }))(getDrawData({
34232
34307
  allParticipantResults: params.allParticipantResults,
34233
34308
  context: { eventId, tournamentId, endDate },
34309
+ pressureRating: params.pressureRating,
34310
+ refreshResults: params.refreshResults,
34234
34311
  includePositionAssignments,
34235
34312
  tournamentParticipants,
34236
34313
  noDeepCopy: true,
@@ -36624,6 +36701,7 @@ var query$2 = {
36624
36701
  getCheckedInParticipantIds: getCheckedInParticipantIds,
36625
36702
  getCompetitionMatchUps: getCompetitionMatchUps,
36626
36703
  getEventMatchUpFormatTiming: getEventMatchUpFormatTiming,
36704
+ getHomeParticipantId: getHomeParticipantId,
36627
36705
  getMatchUpCompetitiveProfile: getMatchUpCompetitiveProfile,
36628
36706
  getMatchUpContextIds: getMatchUpContextIds,
36629
36707
  getMatchUpDailyLimits: getMatchUpDailyLimits,
@@ -36979,6 +37057,7 @@ var index$f = {
36979
37057
  getEventTimeItem: getEventTimeItem,
36980
37058
  getEvents: getEvents,
36981
37059
  getFlightProfile: getFlightProfile,
37060
+ getHomeParticipantId: getHomeParticipantId,
36982
37061
  getLinkedTournamentIds: getLinkedTournamentIds,
36983
37062
  getMatchUpCompetitiveProfile: getMatchUpCompetitiveProfile,
36984
37063
  getMatchUpContextIds: getMatchUpContextIds,
@@ -42662,10 +42741,22 @@ function scoreModification(params) {
42662
42741
  }
42663
42742
 
42664
42743
  function setMatchUpHomeParticipantId(params) {
42744
+ const paramsCheck = checkRequiredParameters(params, [
42745
+ { [TOURNAMENT_RECORD]: true, [DRAW_DEFINITION]: true, [MATCHUP_ID]: true },
42746
+ { homeParticipantId: true, [ERROR]: MISSING_PARTICIPANT_ID },
42747
+ ]);
42748
+ if (paramsCheck.error)
42749
+ return paramsCheck;
42750
+ const resolutions = resolveFromParameters(params, [{ [PARAM]: MATCHUP, attr: { [IN_CONTEXT]: true } }]);
42751
+ if (resolutions.error)
42752
+ return resolutions;
42753
+ const participantIds = resolutions?.matchUp?.matchUp?.sides?.map((side) => side?.participantId);
42754
+ if (params.homeParticipantId && !participantIds?.includes(params.homeParticipantId))
42755
+ return { error: INVALID_PARTICIPANT_ID };
42665
42756
  const { disableNotice = true, homeParticipantId, removePriorValues, tournamentRecord, drawDefinition, matchUpId, } = params;
42666
42757
  const timeItem = {
42667
- itemValue: homeParticipantId,
42668
42758
  itemType: HOME_PARTICIPANT_ID,
42759
+ itemValue: homeParticipantId,
42669
42760
  };
42670
42761
  return addMatchUpTimeItem({
42671
42762
  duplicateValues: false,
@@ -44761,6 +44852,7 @@ var index$9 = {
44761
44852
  getCheckedInParticipantIds: getCheckedInParticipantIds,
44762
44853
  getCompetitionMatchUps: getCompetitionMatchUps,
44763
44854
  getEventMatchUpFormatTiming: getEventMatchUpFormatTiming,
44855
+ getHomeParticipantId: getHomeParticipantId,
44764
44856
  getMatchUpCompetitiveProfile: getMatchUpCompetitiveProfile,
44765
44857
  getMatchUpContextIds: getMatchUpContextIds,
44766
44858
  getMatchUpDailyLimits: getMatchUpDailyLimits,
@@ -46955,6 +47047,7 @@ var lastNames = [
46955
47047
  "Lem",
46956
47048
  "Lovelace",
46957
47049
  "Mander",
47050
+ "McLuhan",
46958
47051
  "Midgely",
46959
47052
  "Mond",
46960
47053
  "Montoya",
@@ -47113,6 +47206,7 @@ var firstMale = [
47113
47206
  "Lief",
47114
47207
  "Malachi",
47115
47208
  "Mark",
47209
+ "Marhsall",
47116
47210
  "Masanobu",
47117
47211
  "Maurits",
47118
47212
  "Michael",
@@ -57608,9 +57702,19 @@ const POLICY_SCORING_DEFAULT = {
57608
57702
  },
57609
57703
  },
57610
57704
  },
57705
+ matchUpFormats: [],
57706
+ matchUpStatusCodes: {
57707
+ [ABANDONED$1]: [],
57708
+ [CANCELLED$1]: [],
57709
+ [DEFAULTED]: [],
57710
+ [INCOMPLETE]: [],
57711
+ [RETIRED$1]: [],
57712
+ [WALKOVER$2]: [],
57713
+ },
57611
57714
  },
57612
57715
  };
57613
57716
 
57717
+ const personalCircumstance = 'Personal circumstance';
57614
57718
  const POLICY_SCORING_USTA = {
57615
57719
  [POLICY_TYPE_SCORING]: {
57616
57720
  requireAllPositionsAssigned: false,
@@ -57704,6 +57808,182 @@ const POLICY_SCORING_USTA = {
57704
57808
  matchUpFormat: 'SET1-S:T20',
57705
57809
  },
57706
57810
  ],
57811
+ matchUpStatusCodes: {
57812
+ [ABANDONED$1]: [
57813
+ {
57814
+ matchUpStatusCodeDisplay: 'Abandoned',
57815
+ label: 'Abandoned match',
57816
+ matchUpStatusCode: 'OA',
57817
+ },
57818
+ ],
57819
+ [CANCELLED$1]: [
57820
+ {
57821
+ matchUpStatusCodeDisplay: 'Unplayed or Cancelled',
57822
+ label: 'Cancelled match',
57823
+ matchUpStatusCode: 'OC',
57824
+ },
57825
+ ],
57826
+ [INCOMPLETE]: [
57827
+ {
57828
+ matchUpStatusCodeDisplay: 'Incomplete',
57829
+ label: 'Incomplete match',
57830
+ matchUpStatusCode: 'OI',
57831
+ },
57832
+ ],
57833
+ [DEFAULTED]: [
57834
+ {
57835
+ description: 'Disqualification for cause or ineligibility',
57836
+ label: 'Disqualification (ineligibility)',
57837
+ matchUpStatusCodeDisplay: 'Def [dq]',
57838
+ matchUpStatusCode: 'DQ',
57839
+ },
57840
+ {
57841
+ description: 'Misconduct before or between matches',
57842
+ label: 'Misconduct',
57843
+ matchUpStatusCodeDisplay: 'Def [cond]',
57844
+ matchUpStatusCode: 'DM',
57845
+ },
57846
+ {
57847
+ description: 'Failure to start match because of adult discipline',
57848
+ label: 'Fail. (adult discipline)',
57849
+ matchUpStatusCodeDisplay: 'Def [ad]',
57850
+ matchUpStatusCode: 'D5',
57851
+ },
57852
+ {
57853
+ description: 'Refusal to start match for reason other than adult discipline, injury, illness, or personal circumstance. ' +
57854
+ '(After the Referee has conclusively confirmed that a player refuses to play a match, the Referee need not ' +
57855
+ 'wait until the scheduled time of the match to records the result.)',
57856
+ label: 'Refusal to start match',
57857
+ matchUpStatusCodeDisplay: 'Def [refsl]',
57858
+ matchUpStatusCode: 'D4',
57859
+ },
57860
+ {
57861
+ label: 'Not showing up',
57862
+ matchUpStatusCodeDisplay: 'Def [ns]',
57863
+ matchUpStatusCode: 'D6',
57864
+ },
57865
+ {
57866
+ description: 'Lateness for match including, but not limited to, intending to play but mistakenly arriving at the ' +
57867
+ 'wrong time, location, or without proper equipment',
57868
+ label: 'Lateness for match',
57869
+ matchUpStatusCodeDisplay: 'Score + Def [late]',
57870
+ matchUpStatusCode: 'D7',
57871
+ },
57872
+ {
57873
+ label: 'Double default',
57874
+ matchUpStatusCodeDisplay: 'Def/Def',
57875
+ matchUpStatusCode: 'DD',
57876
+ },
57877
+ {
57878
+ description: 'Refusal to continue playing a match for reason other than injury, illness, personal circumstance, or ' +
57879
+ 'adult discipline',
57880
+ label: 'Refusal to continue match',
57881
+ matchUpStatusCodeDisplay: 'Def [refsl]',
57882
+ matchUpStatusCode: 'D9',
57883
+ },
57884
+ {
57885
+ description: 'Default for receiving an injection, IV, or supplemental oxygen',
57886
+ label: 'Default (PEDs)',
57887
+ matchUpStatusCodeDisplay: 'Def [med]',
57888
+ matchUpStatusCode: 'DI',
57889
+ },
57890
+ {
57891
+ description: 'Default under Point Penalty System',
57892
+ label: 'Default (Point Penalty System)',
57893
+ matchUpStatusCodeDisplay: 'Def [pps]',
57894
+ matchUpStatusCode: 'DP',
57895
+ },
57896
+ ],
57897
+ [WALKOVER$2]: [
57898
+ {
57899
+ matchUpStatusCodeDisplay: 'Wo [inj]',
57900
+ matchUpStatusCode: 'W1',
57901
+ label: 'Injury',
57902
+ },
57903
+ {
57904
+ matchUpStatusCodeDisplay: 'Wo [ill]',
57905
+ matchUpStatusCode: 'W2',
57906
+ label: 'Illness',
57907
+ },
57908
+ {
57909
+ matchUpStatusCodeDisplay: 'Wo [pc]',
57910
+ label: personalCircumstance,
57911
+ matchUpStatusCode: 'W3',
57912
+ },
57913
+ {
57914
+ matchUpStatusCodeDisplay: 'Wo/Wo',
57915
+ matchUpStatusCode: 'WOWO',
57916
+ label: 'Double walkover',
57917
+ },
57918
+ {
57919
+ matchUpStatusCodeDisplay: 'Wo [Tae]',
57920
+ label: 'Tournament Administrative Error',
57921
+ matchUpStatusCode: 'W4',
57922
+ },
57923
+ {
57924
+ matchUpStatusCodeDisplay: 'Wo/Withdrawn',
57925
+ matchUpStatusCode: 'W5',
57926
+ label: 'Withdrawn',
57927
+ },
57928
+ ],
57929
+ [RETIRED$1]: [
57930
+ {
57931
+ matchUpStatusCodeDisplay: 'Ret [inj]',
57932
+ matchUpStatusCode: 'RJ',
57933
+ label: 'Injury',
57934
+ },
57935
+ {
57936
+ matchUpStatusCodeDisplay: 'Ret [ill]',
57937
+ matchUpStatusCode: 'RI',
57938
+ label: 'Illness',
57939
+ },
57940
+ {
57941
+ matchUpStatusCodeDisplay: 'Ret [pc]',
57942
+ label: personalCircumstance,
57943
+ matchUpStatusCode: 'RC',
57944
+ },
57945
+ {
57946
+ description: 'Retirement because of adult discipline',
57947
+ label: 'Ret. (adult discipline)',
57948
+ matchUpStatusCodeDisplay: 'Ret [ad]',
57949
+ matchUpStatusCode: 'RD',
57950
+ },
57951
+ {
57952
+ description: 'A player who retires from a match remains eligible for consolations, place playoffs, doubles and ' +
57953
+ 'subsequent round robin matches',
57954
+ matchUpStatusCodeDisplay: 'Ret [elg]',
57955
+ label: 'Ret. (eligible)',
57956
+ matchUpStatusCode: 'RU',
57957
+ },
57958
+ ],
57959
+ [WITHDRAWN]: [
57960
+ {
57961
+ matchUpStatusCodeDisplay: 'Wd [inj]',
57962
+ matchUpStatusCode: 'WD.INJ',
57963
+ label: 'Injury',
57964
+ },
57965
+ {
57966
+ matchUpStatusCodeDisplay: 'Wd [ill]',
57967
+ matchUpStatusCode: 'WD.ILL',
57968
+ label: 'Illness',
57969
+ },
57970
+ {
57971
+ matchUpStatusCodeDisplay: 'Wd [pc]',
57972
+ label: personalCircumstance,
57973
+ matchUpStatusCode: 'WD.PC',
57974
+ },
57975
+ {
57976
+ matchUpStatusCodeDisplay: 'Wd/Wd',
57977
+ matchUpStatusCode: 'WD.WD',
57978
+ label: 'Double withdrawal',
57979
+ },
57980
+ {
57981
+ label: 'Tournament Administrative Error',
57982
+ matchUpStatusCodeDisplay: 'Wd [Tae]',
57983
+ matchUpStatusCode: 'WD.TAE',
57984
+ },
57985
+ ],
57986
+ },
57707
57987
  },
57708
57988
  };
57709
57989