tods-competition-factory 1.8.26 → 1.8.28

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.
@@ -1709,6 +1709,14 @@ function getDevContext(contextCriteria) {
1709
1709
  return (Object.keys(contextCriteria).every(function (key) { var _a; return ((_a = globalState.devContext) === null || _a === void 0 ? void 0 : _a[key]) === contextCriteria[key]; }) && globalState.devContext);
1710
1710
  }
1711
1711
  }
1712
+ function setGlobalLog(loggingFx) {
1713
+ if (typeof loggingFx === 'function') {
1714
+ globalState.globalLog = loggingFx;
1715
+ }
1716
+ else {
1717
+ delete globalState.globalLog;
1718
+ }
1719
+ }
1712
1720
  function setDevContext(value) {
1713
1721
  globalState.devContext = value;
1714
1722
  }
@@ -1811,6 +1819,14 @@ function handleCaughtError(_a) {
1811
1819
  err: err,
1812
1820
  });
1813
1821
  }
1822
+ function globalLog$1(engine, log) {
1823
+ if (globalState.globalLog) {
1824
+ return globalState.globalLog(engine, log);
1825
+ }
1826
+ else {
1827
+ console.log(engine, log);
1828
+ }
1829
+ }
1814
1830
 
1815
1831
  var validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
1816
1832
  var validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
@@ -2913,7 +2929,7 @@ var matchUpFormatCode = {
2913
2929
  };
2914
2930
 
2915
2931
  function factoryVersion() {
2916
- return '1.8.26';
2932
+ return '1.8.28';
2917
2933
  }
2918
2934
 
2919
2935
  function getObjectTieFormat(obj) {
@@ -2975,312 +2991,6 @@ function resolveTieFormat(_a) {
2975
2991
  };
2976
2992
  }
2977
2993
 
2978
- var typeMatch = function (arr, type) {
2979
- return arr.filter(Boolean).every(function (i) { return typeof i === type; });
2980
- };
2981
- var allNumeric = function (arr) { return arr.filter(Boolean).every(isNumeric); };
2982
- function getCategoryAgeDetails(params) {
2983
- var _a, _b;
2984
- var category = params.category;
2985
- if (typeof category !== 'object')
2986
- return { error: INVALID_CATEGORY };
2987
- var ageCategoryCode = category.ageCategoryCode, ageMaxDate = category.ageMaxDate, ageMinDate = category.ageMinDate, ageMax = category.ageMax, ageMin = category.ageMin;
2988
- var categoryName = category.categoryName;
2989
- var combinedAge;
2990
- if (!typeMatch([ageCategoryCode, ageMaxDate, ageMinDate, categoryName], 'string') ||
2991
- !allNumeric([ageMax, ageMin] ||
2992
- ![ageMaxDate, ageMinDate].filter(Boolean).every(isValidDateString)))
2993
- return { error: INVALID_CATEGORY };
2994
- var consideredDate = (_a = params.consideredDate) !== null && _a !== void 0 ? _a : extractDate(new Date().toLocaleDateString('sv'));
2995
- if (!isValidDateString(consideredDate))
2996
- return { error: INVALID_DATE };
2997
- // const [consideredYear, month, day] = consideredDate
2998
- var _c = __read(consideredDate
2999
- .split('-')
3000
- .slice(0, 3)
3001
- .map(function (n) { return parseInt(n); }), 1), consideredYear = _c[0];
3002
- // const monthDay = `${zeroPad(month)}-${zeroPad(day)}`;
3003
- var previousDayDate = dateStringDaysChange(consideredDate, -1);
3004
- var _d = __read(previousDayDate
3005
- .split('-')
3006
- .slice(1, 3)
3007
- .map(function (n) { return parseInt(n); }), 2), previousDayMonth = _d[0], previousDay = _d[1];
3008
- var previousMonthDay = "".concat(zeroPad(previousDayMonth), "-").concat(zeroPad(previousDay));
3009
- var nextDayDate = dateStringDaysChange(consideredDate, 1);
3010
- var _e = __read(nextDayDate
3011
- .split('-')
3012
- .slice(1, 3)
3013
- .map(function (n) { return parseInt(n); }), 2), nextDayMonth = _e[0], nextDay = _e[1];
3014
- var nextMonthDay = "".concat(zeroPad(nextDayMonth), "-").concat(zeroPad(nextDay));
3015
- var calculatedAgeMaxDate = ageMin && dateStringDaysChange(consideredDate, -1 * 365 * ageMin);
3016
- var calculatedAgeMinDate = ageMax && dateStringDaysChange(consideredDate, -1 * 365 * ageMax);
3017
- // collect errors; e.g. provided ageMin does not equal calculated ageMin
3018
- var errors = [];
3019
- var addError = function (errorString) {
3020
- return !errors.includes(errorString) && errors.push(errorString);
3021
- };
3022
- ageCategoryCode = ageCategoryCode !== null && ageCategoryCode !== void 0 ? ageCategoryCode : categoryName;
3023
- var prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
3024
- var extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
3025
- var isBetween = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.includes('-');
3026
- var isCombined = isBetween && (ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined));
3027
- var isCoded = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(prePost);
3028
- // construct min or max date with or without year
3029
- //const isYYMM = (datePart) => datePart.match(/^\d{2}-\d{2}$/);
3030
- var constructedDate = function (y, df) { return "".concat(y, "-").concat(df); };
3031
- var uPre = function (ageInt) {
3032
- var ageMinYear = consideredYear - ageInt;
3033
- var newMinDate = constructedDate(ageMinYear, nextMonthDay);
3034
- if (category.ageMinDate && category.ageMinDate !== newMinDate)
3035
- addError("Invalid submitted ageMinDate: ".concat(ageMinDate));
3036
- ageMinDate = newMinDate;
3037
- if (ageCategoryCode) {
3038
- if (category.ageMax && category.ageMax !== ageInt - 1) {
3039
- addError("Invalid submitted ageMax: ".concat(ageMax));
3040
- calculatedAgeMinDate = undefined;
3041
- }
3042
- ageMax = ageInt - 1;
3043
- }
3044
- };
3045
- var uPost = function (ageInt) {
3046
- var ageMinYear = consideredYear - ageInt - 1;
3047
- var newMinDate = constructedDate(ageMinYear, nextMonthDay);
3048
- if (category.ageMin && category.ageMin > ageInt) {
3049
- addError("Invalid submitted ageMin: ".concat(ageMin));
3050
- }
3051
- if (category.ageMax && category.ageMax > ageInt) {
3052
- addError("Invalid submitted ageMax: ".concat(ageMax));
3053
- }
3054
- if (category.ageMinDate && category.ageMinDate !== newMinDate)
3055
- addError("Invalid submitted ageMinDate: ".concat(ageMinDate));
3056
- ageMinDate = newMinDate;
3057
- if (ageCategoryCode) {
3058
- if (category.ageMax && category.ageMax !== ageInt) {
3059
- addError("Invalid submitted ageMax: ".concat(ageMax));
3060
- calculatedAgeMaxDate = undefined;
3061
- }
3062
- ageMax = ageInt;
3063
- }
3064
- };
3065
- var oPre = function (ageInt) {
3066
- var ageMaxYear = consideredYear - ageInt;
3067
- var newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
3068
- if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
3069
- addError("Invalid submitted ageMaxDate: ".concat(ageMaxDate));
3070
- ageMaxDate = newMaxDate;
3071
- if (ageCategoryCode) {
3072
- if (category.ageMin && category.ageMin !== ageInt + 1) {
3073
- addError("Invalid submitted ageMin: ".concat(ageMin));
3074
- calculatedAgeMaxDate = undefined;
3075
- }
3076
- ageMin = ageInt + 1;
3077
- }
3078
- };
3079
- var oPost = function (ageInt) {
3080
- var ageMaxYear = consideredYear - ageInt - 1;
3081
- var newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
3082
- if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
3083
- addError("Invalid submitted ageMaxDate: ".concat(ageMaxDate));
3084
- ageMaxDate = newMaxDate;
3085
- if (ageCategoryCode) {
3086
- if (category.ageMin && category.ageMin !== ageInt) {
3087
- addError("Invalid submitted ageMin: ".concat(ageMin));
3088
- calculatedAgeMaxDate = undefined;
3089
- }
3090
- ageMin = ageInt;
3091
- }
3092
- };
3093
- var processCode = function (code) {
3094
- var _a = __read((code.match(prePost) || []).slice(1), 3), pre = _a[0], age = _a[1], post = _a[2];
3095
- var ageInt = parseInt(age);
3096
- if (pre === 'U') {
3097
- if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
3098
- addError("Invalid submitted ageMaxDate: ".concat(category.ageMaxDate));
3099
- }
3100
- uPre(ageInt);
3101
- }
3102
- else if (pre === 'O') {
3103
- oPre(ageInt);
3104
- }
3105
- if (post === 'U') {
3106
- if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
3107
- addError("Invalid submitted ageMaxDate: ".concat(category.ageMaxDate));
3108
- }
3109
- uPost(ageInt);
3110
- }
3111
- else if (post === 'O') {
3112
- oPost(ageInt);
3113
- }
3114
- ageMaxDate = ageMaxDate !== null && ageMaxDate !== void 0 ? ageMaxDate : calculatedAgeMaxDate;
3115
- ageMinDate = ageMinDate !== null && ageMinDate !== void 0 ? ageMinDate : calculatedAgeMinDate;
3116
- };
3117
- if (isCombined) {
3118
- // min and max birthdates are not relevant
3119
- // TODO: utility function to calculate combined age given two birthdates?
3120
- ageMaxDate = undefined;
3121
- ageMinDate = undefined;
3122
- ageMax = undefined;
3123
- ageMin = undefined;
3124
- if (category.ageMin) {
3125
- // calculate ageMaxDate
3126
- var ageMaxYear = consideredYear - category.ageMin;
3127
- ageMaxDate = constructedDate(ageMaxYear, previousMonthDay);
3128
- }
3129
- if (category.ageMax) {
3130
- // calculate ageMinDate
3131
- var ageMinYear = consideredYear - category.ageMax - 1;
3132
- ageMinDate = constructedDate(ageMinYear, nextMonthDay);
3133
- }
3134
- var _f = __read(((_b = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined)) !== null && _b !== void 0 ? _b : [])
3135
- .slice(1)
3136
- .map(function (n) { return parseInt(n); }), 2), lowAge = _f[0], highAge = _f[1];
3137
- if (lowAge <= highAge) {
3138
- ageMin = lowAge;
3139
- ageMax = highAge;
3140
- combinedAge = true;
3141
- }
3142
- else {
3143
- addError("Invalid combined age range ".concat(ageCategoryCode));
3144
- }
3145
- }
3146
- else if (isBetween) {
3147
- ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.split('-').forEach(processCode);
3148
- }
3149
- else if (isCoded) {
3150
- processCode(ageCategoryCode);
3151
- }
3152
- else {
3153
- if (ageMin)
3154
- oPre(ageMin);
3155
- if (ageMax)
3156
- uPost(ageMax);
3157
- }
3158
- if (ageMax && category.ageMin && category.ageMin > ageMax) {
3159
- addError("Invalid submitted ageMin: ".concat(category.ageMin));
3160
- ageMin = undefined;
3161
- }
3162
- var result = definedAttributes({
3163
- consideredDate: consideredDate,
3164
- combinedAge: combinedAge,
3165
- ageMaxDate: ageMaxDate,
3166
- ageMinDate: ageMinDate,
3167
- ageMax: ageMax,
3168
- ageMin: ageMin,
3169
- });
3170
- if (errors.length)
3171
- result.errors = errors;
3172
- return result;
3173
- }
3174
-
3175
- function decorateResult(_a) {
3176
- var context = _a.context, result = _a.result, stack = _a.stack, info = _a.info;
3177
- if (result && !Array.isArray(result === null || result === void 0 ? void 0 : result.stack))
3178
- result.stack = [];
3179
- if (result && Array.isArray(result === null || result === void 0 ? void 0 : result.stack) && typeof stack === 'string') {
3180
- result.stack.push(stack);
3181
- }
3182
- if (result && info) {
3183
- result.info = info;
3184
- }
3185
- if (result && typeof context === 'object' && Object.keys(context).length) {
3186
- Object.assign(result, definedAttributes(context));
3187
- }
3188
- if (result && !(result === null || result === void 0 ? void 0 : result.error) && !(result === null || result === void 0 ? void 0 : result.success)) {
3189
- Object.assign(result, __assign({}, SUCCESS));
3190
- }
3191
- return result !== null && result !== void 0 ? result : { success: true };
3192
- }
3193
-
3194
- function validateCategory(_a) {
3195
- var category = _a.category;
3196
- if (!isObject(category))
3197
- return { error: INVALID_VALUES };
3198
- var categoryDetails = getCategoryAgeDetails({ category: category });
3199
- if (categoryDetails.error)
3200
- return { error: categoryDetails };
3201
- var ratingMax = category.ratingMax, ratingMin = category.ratingMin;
3202
- if (ratingMax && !isNumeric(ratingMax))
3203
- return decorateResult({
3204
- result: { error: INVALID_VALUES },
3205
- context: { ratingMax: ratingMax },
3206
- });
3207
- if (ratingMin && !isNumeric(ratingMin))
3208
- return decorateResult({
3209
- result: { error: INVALID_VALUES },
3210
- context: { ratingMin: ratingMin },
3211
- });
3212
- return __assign({}, categoryDetails);
3213
- }
3214
-
3215
- function categoryCanContain(_a) {
3216
- var childCategory = _a.childCategory, withDetails = _a.withDetails, category = _a.category;
3217
- var categoryDetails = validateCategory({ category: category });
3218
- var childCategoryDetails = validateCategory({
3219
- category: childCategory,
3220
- });
3221
- var invalidAgeMin = childCategoryDetails.ageMin &&
3222
- ((categoryDetails.ageMin &&
3223
- childCategoryDetails.ageMin < categoryDetails.ageMin) ||
3224
- (categoryDetails.ageMax &&
3225
- childCategoryDetails.ageMin > categoryDetails.ageMax));
3226
- var invalidAgeMax = childCategoryDetails.ageMax &&
3227
- ((categoryDetails.ageMax &&
3228
- childCategoryDetails.ageMax > categoryDetails.ageMax) ||
3229
- (categoryDetails.ageMin &&
3230
- childCategoryDetails.ageMax < categoryDetails.ageMin));
3231
- var invalidAgeMinDate = childCategoryDetails.ageMinDate &&
3232
- categoryDetails.ageMaxDate &&
3233
- new Date(childCategoryDetails.ageMinDate) >
3234
- new Date(categoryDetails.ageMaxDate);
3235
- var invalidAgeMaxDate = childCategoryDetails.ageMaxDate &&
3236
- categoryDetails.ageMinDate &&
3237
- new Date(childCategoryDetails.ageMaxDate) <
3238
- new Date(categoryDetails.ageMinDate);
3239
- var ratingComparison = category.ratingType &&
3240
- childCategory.ratingType &&
3241
- category.ratingType === childCategory.ratingType;
3242
- var invalidRatingRange = ratingComparison &&
3243
- ((category.ratingMin &&
3244
- childCategory.ratingMin &&
3245
- childCategory.ratingMin < category.ratingMin) ||
3246
- (category.ratingMax &&
3247
- childCategory.ratingMax &&
3248
- childCategory.ratingMax > category.ratingMax) ||
3249
- (category.ratingMin &&
3250
- childCategory.ratingMax &&
3251
- childCategory.ratingMax < category.ratingMin) ||
3252
- (category.ratingMax &&
3253
- childCategory.ratingMin &&
3254
- childCategory.ratingMin > category.ratingMax));
3255
- var invalidBallType = category.ballType &&
3256
- childCategory.ballType &&
3257
- category.ballType !== childCategory.ballType;
3258
- var valid = !invalidRatingRange &&
3259
- !invalidAgeMinDate &&
3260
- !invalidAgeMaxDate &&
3261
- !invalidBallType &&
3262
- !invalidAgeMax &&
3263
- !invalidAgeMin;
3264
- var ignoreFalse = true;
3265
- var result = definedAttributes({
3266
- invalidRatingRange: invalidRatingRange,
3267
- invalidAgeMinDate: invalidAgeMinDate,
3268
- invalidAgeMaxDate: invalidAgeMaxDate,
3269
- invalidBallType: invalidBallType,
3270
- invalidAgeMax: invalidAgeMax,
3271
- invalidAgeMin: invalidAgeMin,
3272
- valid: valid,
3273
- }, ignoreFalse);
3274
- if (withDetails) {
3275
- Object.assign(result, { categoryDetails: categoryDetails, childCategoryDetails: childCategoryDetails });
3276
- }
3277
- return result;
3278
- }
3279
-
3280
- function mustBeAnArray(value) {
3281
- return "".concat(value, " must be an array");
3282
- }
3283
-
3284
2994
  var DrawTypeEnum;
3285
2995
  (function (DrawTypeEnum) {
3286
2996
  DrawTypeEnum["AdHoc"] = "AD_HOC";
@@ -3841,6 +3551,351 @@ var SexEnum;
3841
3551
  SexEnum["Other"] = "OTHER";
3842
3552
  })(SexEnum || (SexEnum = {}));
3843
3553
 
3554
+ function decorateResult(_a) {
3555
+ var context = _a.context, result = _a.result, stack = _a.stack, info = _a.info;
3556
+ if (result && !Array.isArray(result === null || result === void 0 ? void 0 : result.stack))
3557
+ result.stack = [];
3558
+ if (result && Array.isArray(result === null || result === void 0 ? void 0 : result.stack) && typeof stack === 'string') {
3559
+ result.stack.push(stack);
3560
+ }
3561
+ if (result && info) {
3562
+ result.info = info;
3563
+ }
3564
+ if (result && typeof context === 'object' && Object.keys(context).length) {
3565
+ Object.assign(result, definedAttributes(context));
3566
+ }
3567
+ if (result && !(result === null || result === void 0 ? void 0 : result.error) && !(result === null || result === void 0 ? void 0 : result.success)) {
3568
+ Object.assign(result, __assign({}, SUCCESS));
3569
+ }
3570
+ return result !== null && result !== void 0 ? result : { success: true };
3571
+ }
3572
+
3573
+ var ANY = 'ANY';
3574
+ var MALE = 'MALE';
3575
+ var MIXED = 'MIXED';
3576
+ var OTHER$3 = 'OTHER';
3577
+ var FEMALE = 'FEMALE';
3578
+ var genderConstants = {
3579
+ ANY: ANY,
3580
+ MALE: MALE,
3581
+ FEMALE: FEMALE,
3582
+ MIXED: MIXED,
3583
+ OTHER: OTHER$3,
3584
+ };
3585
+
3586
+ function genderValidityCheck(_a) {
3587
+ var referenceGender = _a.referenceGender, matchUpType = _a.matchUpType, gender = _a.gender;
3588
+ var stack = 'genderValidityCheck';
3589
+ if (referenceGender &&
3590
+ gender &&
3591
+ [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) &&
3592
+ [GenderEnum.Male, GenderEnum.Female].includes(gender)) {
3593
+ var valid = gender === referenceGender;
3594
+ return valid
3595
+ ? { valid: true }
3596
+ : decorateResult({
3597
+ result: { valid: false, error: INVALID_GENDER },
3598
+ context: { gender: gender },
3599
+ stack: stack,
3600
+ });
3601
+ }
3602
+ if (referenceGender === MIXED &&
3603
+ (gender !== MIXED || matchUpType === TypeEnum.Singles))
3604
+ return decorateResult({
3605
+ info: 'MIXED events can only contain MIXED doubles collections',
3606
+ result: { error: INVALID_GENDER, valid: false },
3607
+ stack: stack,
3608
+ });
3609
+ return { valid: true };
3610
+ }
3611
+
3612
+ var typeMatch = function (arr, type) {
3613
+ return arr.filter(Boolean).every(function (i) { return typeof i === type; });
3614
+ };
3615
+ var allNumeric = function (arr) { return arr.filter(Boolean).every(isNumeric); };
3616
+ function getCategoryAgeDetails(params) {
3617
+ var _a, _b;
3618
+ var category = params.category;
3619
+ if (typeof category !== 'object')
3620
+ return { error: INVALID_CATEGORY };
3621
+ var ageCategoryCode = category.ageCategoryCode, ageMaxDate = category.ageMaxDate, ageMinDate = category.ageMinDate, ageMax = category.ageMax, ageMin = category.ageMin;
3622
+ var categoryName = category.categoryName;
3623
+ var combinedAge;
3624
+ if (!typeMatch([ageCategoryCode, ageMaxDate, ageMinDate, categoryName], 'string') ||
3625
+ !allNumeric([ageMax, ageMin] ||
3626
+ ![ageMaxDate, ageMinDate].filter(Boolean).every(isValidDateString)))
3627
+ return { error: INVALID_CATEGORY };
3628
+ var consideredDate = (_a = params.consideredDate) !== null && _a !== void 0 ? _a : extractDate(new Date().toLocaleDateString('sv'));
3629
+ if (!isValidDateString(consideredDate))
3630
+ return { error: INVALID_DATE };
3631
+ // const [consideredYear, month, day] = consideredDate
3632
+ var _c = __read(consideredDate
3633
+ .split('-')
3634
+ .slice(0, 3)
3635
+ .map(function (n) { return parseInt(n); }), 1), consideredYear = _c[0];
3636
+ // const monthDay = `${zeroPad(month)}-${zeroPad(day)}`;
3637
+ var previousDayDate = dateStringDaysChange(consideredDate, -1);
3638
+ var _d = __read(previousDayDate
3639
+ .split('-')
3640
+ .slice(1, 3)
3641
+ .map(function (n) { return parseInt(n); }), 2), previousDayMonth = _d[0], previousDay = _d[1];
3642
+ var previousMonthDay = "".concat(zeroPad(previousDayMonth), "-").concat(zeroPad(previousDay));
3643
+ var nextDayDate = dateStringDaysChange(consideredDate, 1);
3644
+ var _e = __read(nextDayDate
3645
+ .split('-')
3646
+ .slice(1, 3)
3647
+ .map(function (n) { return parseInt(n); }), 2), nextDayMonth = _e[0], nextDay = _e[1];
3648
+ var nextMonthDay = "".concat(zeroPad(nextDayMonth), "-").concat(zeroPad(nextDay));
3649
+ var calculatedAgeMaxDate = ageMin && dateStringDaysChange(consideredDate, -1 * 365 * ageMin);
3650
+ var calculatedAgeMinDate = ageMax && dateStringDaysChange(consideredDate, -1 * 365 * ageMax);
3651
+ // collect errors; e.g. provided ageMin does not equal calculated ageMin
3652
+ var errors = [];
3653
+ var addError = function (errorString) {
3654
+ return !errors.includes(errorString) && errors.push(errorString);
3655
+ };
3656
+ ageCategoryCode = ageCategoryCode !== null && ageCategoryCode !== void 0 ? ageCategoryCode : categoryName;
3657
+ var prePost = /^([UO]?)(\d{1,2})([UO]?)$/;
3658
+ var extractCombined = /^C(\d{1,2})-(\d{1,2})$/;
3659
+ var isBetween = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.includes('-');
3660
+ var isCombined = isBetween && (ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined));
3661
+ var isCoded = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(prePost);
3662
+ // construct min or max date with or without year
3663
+ //const isYYMM = (datePart) => datePart.match(/^\d{2}-\d{2}$/);
3664
+ var constructedDate = function (y, df) { return "".concat(y, "-").concat(df); };
3665
+ var uPre = function (ageInt) {
3666
+ var ageMinYear = consideredYear - ageInt;
3667
+ var newMinDate = constructedDate(ageMinYear, nextMonthDay);
3668
+ if (category.ageMinDate && category.ageMinDate !== newMinDate)
3669
+ addError("Invalid submitted ageMinDate: ".concat(ageMinDate));
3670
+ ageMinDate = newMinDate;
3671
+ if (ageCategoryCode) {
3672
+ if (category.ageMax && category.ageMax !== ageInt - 1) {
3673
+ addError("Invalid submitted ageMax: ".concat(ageMax));
3674
+ calculatedAgeMinDate = undefined;
3675
+ }
3676
+ ageMax = ageInt - 1;
3677
+ }
3678
+ };
3679
+ var uPost = function (ageInt) {
3680
+ var ageMinYear = consideredYear - ageInt - 1;
3681
+ var newMinDate = constructedDate(ageMinYear, nextMonthDay);
3682
+ if (category.ageMin && category.ageMin > ageInt) {
3683
+ addError("Invalid submitted ageMin: ".concat(ageMin));
3684
+ }
3685
+ if (category.ageMax && category.ageMax > ageInt) {
3686
+ addError("Invalid submitted ageMax: ".concat(ageMax));
3687
+ }
3688
+ if (category.ageMinDate && category.ageMinDate !== newMinDate)
3689
+ addError("Invalid submitted ageMinDate: ".concat(ageMinDate));
3690
+ ageMinDate = newMinDate;
3691
+ if (ageCategoryCode) {
3692
+ if (category.ageMax && category.ageMax !== ageInt) {
3693
+ addError("Invalid submitted ageMax: ".concat(ageMax));
3694
+ calculatedAgeMaxDate = undefined;
3695
+ }
3696
+ ageMax = ageInt;
3697
+ }
3698
+ };
3699
+ var oPre = function (ageInt) {
3700
+ var ageMaxYear = consideredYear - ageInt;
3701
+ var newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
3702
+ if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
3703
+ addError("Invalid submitted ageMaxDate: ".concat(ageMaxDate));
3704
+ ageMaxDate = newMaxDate;
3705
+ if (ageCategoryCode) {
3706
+ if (category.ageMin && category.ageMin !== ageInt + 1) {
3707
+ addError("Invalid submitted ageMin: ".concat(ageMin));
3708
+ calculatedAgeMaxDate = undefined;
3709
+ }
3710
+ ageMin = ageInt + 1;
3711
+ }
3712
+ };
3713
+ var oPost = function (ageInt) {
3714
+ var ageMaxYear = consideredYear - ageInt - 1;
3715
+ var newMaxDate = constructedDate(ageMaxYear, previousMonthDay);
3716
+ if (category.ageMaxDate && category.ageMaxDate !== newMaxDate)
3717
+ addError("Invalid submitted ageMaxDate: ".concat(ageMaxDate));
3718
+ ageMaxDate = newMaxDate;
3719
+ if (ageCategoryCode) {
3720
+ if (category.ageMin && category.ageMin !== ageInt) {
3721
+ addError("Invalid submitted ageMin: ".concat(ageMin));
3722
+ calculatedAgeMaxDate = undefined;
3723
+ }
3724
+ ageMin = ageInt;
3725
+ }
3726
+ };
3727
+ var processCode = function (code) {
3728
+ var _a = __read((code.match(prePost) || []).slice(1), 3), pre = _a[0], age = _a[1], post = _a[2];
3729
+ var ageInt = parseInt(age);
3730
+ if (pre === 'U') {
3731
+ if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
3732
+ addError("Invalid submitted ageMaxDate: ".concat(category.ageMaxDate));
3733
+ }
3734
+ uPre(ageInt);
3735
+ }
3736
+ else if (pre === 'O') {
3737
+ oPre(ageInt);
3738
+ }
3739
+ if (post === 'U') {
3740
+ if (category.ageMaxDate && category.ageMaxDate !== ageMaxDate) {
3741
+ addError("Invalid submitted ageMaxDate: ".concat(category.ageMaxDate));
3742
+ }
3743
+ uPost(ageInt);
3744
+ }
3745
+ else if (post === 'O') {
3746
+ oPost(ageInt);
3747
+ }
3748
+ ageMaxDate = ageMaxDate !== null && ageMaxDate !== void 0 ? ageMaxDate : calculatedAgeMaxDate;
3749
+ ageMinDate = ageMinDate !== null && ageMinDate !== void 0 ? ageMinDate : calculatedAgeMinDate;
3750
+ };
3751
+ if (isCombined) {
3752
+ // min and max birthdates are not relevant
3753
+ // TODO: utility function to calculate combined age given two birthdates?
3754
+ ageMaxDate = undefined;
3755
+ ageMinDate = undefined;
3756
+ ageMax = undefined;
3757
+ ageMin = undefined;
3758
+ if (category.ageMin) {
3759
+ // calculate ageMaxDate
3760
+ var ageMaxYear = consideredYear - category.ageMin;
3761
+ ageMaxDate = constructedDate(ageMaxYear, previousMonthDay);
3762
+ }
3763
+ if (category.ageMax) {
3764
+ // calculate ageMinDate
3765
+ var ageMinYear = consideredYear - category.ageMax - 1;
3766
+ ageMinDate = constructedDate(ageMinYear, nextMonthDay);
3767
+ }
3768
+ var _f = __read(((_b = ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.match(extractCombined)) !== null && _b !== void 0 ? _b : [])
3769
+ .slice(1)
3770
+ .map(function (n) { return parseInt(n); }), 2), lowAge = _f[0], highAge = _f[1];
3771
+ if (lowAge <= highAge) {
3772
+ ageMin = lowAge;
3773
+ ageMax = highAge;
3774
+ combinedAge = true;
3775
+ }
3776
+ else {
3777
+ addError("Invalid combined age range ".concat(ageCategoryCode));
3778
+ }
3779
+ }
3780
+ else if (isBetween) {
3781
+ ageCategoryCode === null || ageCategoryCode === void 0 ? void 0 : ageCategoryCode.split('-').forEach(processCode);
3782
+ }
3783
+ else if (isCoded) {
3784
+ processCode(ageCategoryCode);
3785
+ }
3786
+ else {
3787
+ if (ageMin)
3788
+ oPre(ageMin);
3789
+ if (ageMax)
3790
+ uPost(ageMax);
3791
+ }
3792
+ if (ageMax && category.ageMin && category.ageMin > ageMax) {
3793
+ addError("Invalid submitted ageMin: ".concat(category.ageMin));
3794
+ ageMin = undefined;
3795
+ }
3796
+ var result = definedAttributes({
3797
+ consideredDate: consideredDate,
3798
+ combinedAge: combinedAge,
3799
+ ageMaxDate: ageMaxDate,
3800
+ ageMinDate: ageMinDate,
3801
+ ageMax: ageMax,
3802
+ ageMin: ageMin,
3803
+ });
3804
+ if (errors.length)
3805
+ result.errors = errors;
3806
+ return result;
3807
+ }
3808
+
3809
+ function validateCategory(_a) {
3810
+ var category = _a.category;
3811
+ if (!isObject(category))
3812
+ return { error: INVALID_VALUES };
3813
+ var categoryDetails = getCategoryAgeDetails({ category: category });
3814
+ if (categoryDetails.error)
3815
+ return { error: categoryDetails };
3816
+ var ratingMax = category.ratingMax, ratingMin = category.ratingMin;
3817
+ if (ratingMax && !isNumeric(ratingMax))
3818
+ return decorateResult({
3819
+ result: { error: INVALID_VALUES },
3820
+ context: { ratingMax: ratingMax },
3821
+ });
3822
+ if (ratingMin && !isNumeric(ratingMin))
3823
+ return decorateResult({
3824
+ result: { error: INVALID_VALUES },
3825
+ context: { ratingMin: ratingMin },
3826
+ });
3827
+ return __assign({}, categoryDetails);
3828
+ }
3829
+
3830
+ function categoryCanContain(_a) {
3831
+ var childCategory = _a.childCategory, withDetails = _a.withDetails, category = _a.category;
3832
+ var categoryDetails = validateCategory({ category: category });
3833
+ var childCategoryDetails = validateCategory({
3834
+ category: childCategory,
3835
+ });
3836
+ var invalidAgeMin = childCategoryDetails.ageMin &&
3837
+ ((categoryDetails.ageMin &&
3838
+ childCategoryDetails.ageMin < categoryDetails.ageMin) ||
3839
+ (categoryDetails.ageMax &&
3840
+ childCategoryDetails.ageMin > categoryDetails.ageMax));
3841
+ var invalidAgeMax = childCategoryDetails.ageMax &&
3842
+ ((categoryDetails.ageMax &&
3843
+ childCategoryDetails.ageMax > categoryDetails.ageMax) ||
3844
+ (categoryDetails.ageMin &&
3845
+ childCategoryDetails.ageMax < categoryDetails.ageMin));
3846
+ var invalidAgeMinDate = childCategoryDetails.ageMinDate &&
3847
+ categoryDetails.ageMaxDate &&
3848
+ new Date(childCategoryDetails.ageMinDate) >
3849
+ new Date(categoryDetails.ageMaxDate);
3850
+ var invalidAgeMaxDate = childCategoryDetails.ageMaxDate &&
3851
+ categoryDetails.ageMinDate &&
3852
+ new Date(childCategoryDetails.ageMaxDate) <
3853
+ new Date(categoryDetails.ageMinDate);
3854
+ var ratingComparison = category.ratingType &&
3855
+ childCategory.ratingType &&
3856
+ category.ratingType === childCategory.ratingType;
3857
+ var invalidRatingRange = ratingComparison &&
3858
+ ((category.ratingMin &&
3859
+ childCategory.ratingMin &&
3860
+ childCategory.ratingMin < category.ratingMin) ||
3861
+ (category.ratingMax &&
3862
+ childCategory.ratingMax &&
3863
+ childCategory.ratingMax > category.ratingMax) ||
3864
+ (category.ratingMin &&
3865
+ childCategory.ratingMax &&
3866
+ childCategory.ratingMax < category.ratingMin) ||
3867
+ (category.ratingMax &&
3868
+ childCategory.ratingMin &&
3869
+ childCategory.ratingMin > category.ratingMax));
3870
+ var invalidBallType = category.ballType &&
3871
+ childCategory.ballType &&
3872
+ category.ballType !== childCategory.ballType;
3873
+ var valid = !invalidRatingRange &&
3874
+ !invalidAgeMinDate &&
3875
+ !invalidAgeMaxDate &&
3876
+ !invalidBallType &&
3877
+ !invalidAgeMax &&
3878
+ !invalidAgeMin;
3879
+ var ignoreFalse = true;
3880
+ var result = definedAttributes({
3881
+ invalidRatingRange: invalidRatingRange,
3882
+ invalidAgeMinDate: invalidAgeMinDate,
3883
+ invalidAgeMaxDate: invalidAgeMaxDate,
3884
+ invalidBallType: invalidBallType,
3885
+ invalidAgeMax: invalidAgeMax,
3886
+ invalidAgeMin: invalidAgeMin,
3887
+ valid: valid,
3888
+ }, ignoreFalse);
3889
+ if (withDetails) {
3890
+ Object.assign(result, { categoryDetails: categoryDetails, childCategoryDetails: childCategoryDetails });
3891
+ }
3892
+ return result;
3893
+ }
3894
+
3895
+ function mustBeAnArray(value) {
3896
+ return "".concat(value, " must be an array");
3897
+ }
3898
+
3844
3899
  function validateTieFormat(params) {
3845
3900
  var _a, _b, _c, _d;
3846
3901
  var checkCategory = !!((params === null || params === void 0 ? void 0 : params.enforceCategory) !== false && (params === null || params === void 0 ? void 0 : params.category));
@@ -3975,17 +4030,19 @@ function validateCollectionDefinition(_a) {
3975
4030
  if (matchUpFormat && !matchUpFormatCode.isValid(matchUpFormat)) {
3976
4031
  errors.push("Invalid matchUpFormat: ".concat(matchUpFormat));
3977
4032
  }
3978
- if (checkGender &&
3979
- referenceGender &&
3980
- gender &&
3981
- [GenderEnum.Male, GenderEnum.Female].includes(referenceGender) &&
3982
- referenceGender !== gender) {
3983
- errors.push("Invalid gender: ".concat(gender));
3984
- return decorateResult({
3985
- result: { error: INVALID_GENDER, errors: errors },
3986
- context: { referenceGender: referenceGender, gender: gender },
3987
- stack: stack,
4033
+ if (checkGender) {
4034
+ var result = genderValidityCheck({
4035
+ referenceGender: referenceGender,
4036
+ matchUpType: matchUpType,
4037
+ gender: gender,
3988
4038
  });
4039
+ if (result.error) {
4040
+ return decorateResult({
4041
+ context: { referenceGender: referenceGender, gender: gender },
4042
+ result: result,
4043
+ stack: stack,
4044
+ });
4045
+ }
3989
4046
  }
3990
4047
  if (checkCategory && referenceCategory && category) {
3991
4048
  var result = categoryCanContain({
@@ -6915,7 +6972,7 @@ var PUBLIC = 'PUBLIC';
6915
6972
  var STATUS$1 = 'STATUS';
6916
6973
  var MODIFICATION = 'MODIFICATION';
6917
6974
  var RETRIEVAL = 'RETRIEVAL';
6918
- var OTHER$3 = 'other';
6975
+ var OTHER$2 = 'other';
6919
6976
  var timeItemConstants = {
6920
6977
  MUTUALLY_EXCLUSIVE_TIME_MODIFIERS: MUTUALLY_EXCLUSIVE_TIME_MODIFIERS,
6921
6978
  AFTER_REST: AFTER_REST,
@@ -6934,7 +6991,7 @@ var timeItemConstants = {
6934
6991
  MODIFICATION: MODIFICATION,
6935
6992
  NEXT_AVAILABLE: NEXT_AVAILABLE,
6936
6993
  NOT_BEFORE: NOT_BEFORE,
6937
- OTHER: OTHER$3,
6994
+ OTHER: OTHER$2,
6938
6995
  PENALTY: PENALTY$1,
6939
6996
  PUBLIC: PUBLIC,
6940
6997
  PUBLISH: PUBLISH,
@@ -9467,19 +9524,6 @@ function getSeeding(_a) {
9467
9524
  });
9468
9525
  }
9469
9526
 
9470
- var ANY = 'ANY';
9471
- var MALE = 'MALE';
9472
- var MIXED = 'MIXED';
9473
- var OTHER$2 = 'OTHER';
9474
- var FEMALE = 'FEMALE';
9475
- var genderConstants = {
9476
- ANY: ANY,
9477
- MALE: MALE,
9478
- FEMALE: FEMALE,
9479
- MIXED: MIXED,
9480
- OTHER: OTHER$2,
9481
- };
9482
-
9483
9527
  function getAllStructureMatchUps(_a) {
9484
9528
  var _b, _c, _d, _e, _f, _g, _h;
9485
9529
  var scheduleVisibilityFilters = _a.scheduleVisibilityFilters, tournamentAppliedPolicies = _a.tournamentAppliedPolicies, provisionalPositioning = _a.provisionalPositioning, tournamentParticipants = _a.tournamentParticipants, afterRecoveryTimes = _a.afterRecoveryTimes, policyDefinitions = _a.policyDefinitions, tournamentRecord = _a.tournamentRecord, seedAssignments = _a.seedAssignments, contextFilters = _a.contextFilters, contextContent = _a.contextContent, matchUpFilters = _a.matchUpFilters, participantMap = _a.participantMap, scheduleTiming = _a.scheduleTiming, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, _j = _a.context, context = _j === void 0 ? {} : _j, exitProfiles = _a.exitProfiles, matchUpsMap = _a.matchUpsMap, structure = _a.structure, inContext = _a.inContext, event = _a.event;
@@ -23010,10 +23054,11 @@ function updateMatchUpStatusCodes(_a) {
23010
23054
  // ... and fed positions are always sideNumber 1
23011
23055
  (sourceMatchUp.structureId === (pairedMatchUp === null || pairedMatchUp === void 0 ? void 0 : pairedMatchUp.structureId) && 2) || 1;
23012
23056
  matchUp.matchUpStatusCodes = ((_b = matchUp.matchUpStatusCodes) !== null && _b !== void 0 ? _b : []).map(function (code) {
23013
- if (code.sideNumber === sourceSideNumber_1) {
23014
- return __assign(__assign({}, code), { previousMatchUpStatus: sourceMatchUpStatus });
23057
+ var value = isString(code) || !isNaN(code) ? { code: code } : code;
23058
+ if (value.sideNumber === sourceSideNumber_1) {
23059
+ return __assign(__assign({}, value), { previousMatchUpStatus: sourceMatchUpStatus });
23015
23060
  }
23016
- return code;
23061
+ return value;
23017
23062
  });
23018
23063
  }
23019
23064
  }
@@ -31581,13 +31626,13 @@ function modifyCollectionDefinition$1(_a) {
31581
31626
 
31582
31627
  function resolveTournamentRecord(params) {
31583
31628
  var method = params.method, tournamentRecords = params.tournamentRecords, args = __rest(params, ["method", "tournamentRecords"]);
31629
+ if (!method)
31630
+ return { error: MISSING_VALUE };
31584
31631
  // find tournamentId by brute force if not provided
31585
- var tournamentId = params.tournamentId || findTournamentId(args);
31632
+ var tournamentId = params.tournamentId || findTournamentId(__assign({ tournamentRecords: tournamentRecords }, args));
31586
31633
  if (typeof tournamentId !== 'string')
31587
31634
  return { error: MISSING_TOURNAMENT_ID };
31588
31635
  var tournamentRecord = tournamentRecords[tournamentId];
31589
- if (!tournamentRecord)
31590
- return { error: MISSING_TOURNAMENT_RECORD };
31591
31636
  return method(__assign(__assign({}, args), { tournamentRecord: tournamentRecord }));
31592
31637
  }
31593
31638
 
@@ -32829,13 +32874,13 @@ function publicFindMatchUp(params) {
32829
32874
  function findMatchUp(_a) {
32830
32875
  var _b;
32831
32876
  var _c, _d, _e, _f;
32832
- var participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, contextContent = _a.contextContent, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, matchUpId = _a.matchUpId, inContext = _a.inContext, eventId = _a.eventId, drawId = _a.drawId, event = _a.event;
32877
+ var participantsProfile = _a.participantsProfile, afterRecoveryTimes = _a.afterRecoveryTimes, tournamentRecord = _a.tournamentRecord, contextContent = _a.contextContent, contextProfile = _a.contextProfile, drawDefinition = _a.drawDefinition, nextMatchUps = _a.nextMatchUps, matchUpId = _a.matchUpId, inContext = _a.inContext, eventId = _a.eventId, drawId = _a.drawId, event = _a.event;
32833
32878
  if (!tournamentRecord)
32834
32879
  return { error: MISSING_TOURNAMENT_RECORD };
32835
32880
  if (typeof matchUpId !== 'string')
32836
32881
  return { error: MISSING_MATCHUP_ID };
32837
- if (!drawDefinition || !event) {
32838
- var matchUps = (_c = allTournamentMatchUps({ tournamentRecord: tournamentRecord }).matchUps) !== null && _c !== void 0 ? _c : [];
32882
+ if (!drawDefinition || !event || nextMatchUps) {
32883
+ var matchUps = (_c = allTournamentMatchUps({ tournamentRecord: tournamentRecord, nextMatchUps: nextMatchUps }).matchUps) !== null && _c !== void 0 ? _c : [];
32839
32884
  var inContextMatchUp = matchUps.find(function (matchUp) { return matchUp.matchUpId === matchUpId; });
32840
32885
  if (!inContextMatchUp)
32841
32886
  return { error: MATCHUP_NOT_FOUND };
@@ -39065,7 +39110,7 @@ function getSchedulingProfileIssues(params) {
39065
39110
  }
39066
39111
 
39067
39112
  function credits() {
39068
- return "\n This project would not have been possible without the generous input and patience\n of tournament organizers and directors who worked with early versions of CourtHive/TMX.\n\n Thanks to Pavel, Ivan, Mladen, Zdenko, Antoina, Jakov, Kreso, Barry, Jeff, Bobby... to name just a few. \n\n The project would not have even begun without the support of Miro, or the introduction by Sretchko.\n The project would not have succeeded without the enthusiasm of Randy and Bruce.\n Thanks to serendipity and Luca and the ensuing TODS conversations with ITF.\n Thanks to Scott and Jake for sanity checks, suggestions, and camaraderie.\n Thanks to Zoran for inspiring the async support and getting into the weeds with subscriptions.\n Thanks to Dave for backing the conversion of TMX 1.x source into the factory repository.\n Thanks to Vuk and Pavle and Rich and Chris and Deepa for the direct engagement with the APIs.\n Thanks to Joe for repeatedly challenging me and the many pointers to useful tooling.\n Thanks to Shannon for the validation of the approach from his deep domain experience.\n Thanks to Nikola for the ongoing camaraderie and explorations of what we can do with TODS.\n\n And a special thanks to my family for putting up with the long days and weeks and months of coding\n and conversations at all hours.\n ";
39113
+ return "\n This project would not have been possible without the generous input and patience\n of tournament organizers and directors who worked with early versions of CourtHive/TMX.\n\n Thanks to Pavel, Ivan, Mladen, Zdenko, Antonia, Jakov, Kreso, Barry, Jeff, Bobby... to name just a few. \n\n The project would not have even begun without the support of Miro, or the introduction by Sretchko.\n The project would not have succeeded without the enthusiasm of Randy and Bruce.\n Thanks to serendipity and Luca and the ensuing TODS conversations with ITF.\n Thanks to Scott and Jake for sanity checks, suggestions, and camaraderie.\n Thanks to Zoran for inspiring the async support and getting into the weeds with subscriptions.\n Thanks to Dave for backing the conversion of TMX 1.x source into the factory repository.\n Thanks to Vuk and Pavle and Rich and Chris and Deepa for the direct engagement with the APIs.\n Thanks to Joe for repeatedly challenging me and the many pointers to useful tooling.\n Thanks to Shannon for the validation of the approach from his deep domain experience.\n Thanks to Nikola for the ongoing camaraderie and explorations of what we can do with TODS.\n\n And a special thanks to my family for putting up with the long days and weeks and months of coding\n and conversations at all hours.\n ";
39069
39114
  }
39070
39115
 
39071
39116
  function getValidAlternatesAction(_a) {
@@ -41395,7 +41440,7 @@ function engineLogging(_a) {
41395
41440
  log.result = result;
41396
41441
  }
41397
41442
  if (Object.keys(log).length > 1)
41398
- console.log(engine, log);
41443
+ globalLog$1(engine, log);
41399
41444
  if (result && devContext.makeDeepCopy)
41400
41445
  result.deepCopyIterations = getDeepCopyIterations();
41401
41446
  }
@@ -44346,6 +44391,50 @@ function generateDrawTypeAndModifyDrawDefinition$1(params) {
44346
44391
  return __assign(__assign({ inContextDrawMatchUps: inContextDrawMatchUps, drawDefinition: drawDefinition, matchUpsMap: matchUpsMap }, SUCCESS), { structures: structures, matchUps: matchUps, links: links });
44347
44392
  }
44348
44393
 
44394
+ function processAccessors(_a) {
44395
+ var significantCharacters = _a.significantCharacters, _b = _a.accessors, accessors = _b === void 0 ? [] : _b, value = _a.value;
44396
+ var extractedValues = [];
44397
+ var accessor = accessors[0];
44398
+ if (value === null || value === void 0 ? void 0 : value[accessor]) {
44399
+ var remainingKeys_1 = accessors.slice(1);
44400
+ if (Array.isArray(value[accessor])) {
44401
+ var values = value[accessor];
44402
+ values.forEach(function (nestedValue) {
44403
+ var result = processAccessors({
44404
+ accessors: remainingKeys_1,
44405
+ significantCharacters: significantCharacters,
44406
+ value: nestedValue,
44407
+ });
44408
+ extractedValues.push.apply(extractedValues, __spreadArray([], __read(result), false));
44409
+ });
44410
+ }
44411
+ else {
44412
+ value = value[accessor];
44413
+ if (remainingKeys_1.length) {
44414
+ var result = processAccessors({
44415
+ accessors: remainingKeys_1,
44416
+ significantCharacters: significantCharacters,
44417
+ value: value,
44418
+ });
44419
+ extractedValues.push.apply(extractedValues, __spreadArray([], __read(result), false));
44420
+ }
44421
+ else {
44422
+ checkValue({ value: value });
44423
+ }
44424
+ }
44425
+ }
44426
+ function checkValue(_a) {
44427
+ var value = _a.value;
44428
+ if (value && ['string', 'number'].includes(typeof value)) {
44429
+ var extractedValue = significantCharacters
44430
+ ? value.slice(0, significantCharacters)
44431
+ : value;
44432
+ extractedValues.push(extractedValue);
44433
+ }
44434
+ }
44435
+ return extractedValues;
44436
+ }
44437
+
44349
44438
  function getAttributeGroupings(_a) {
44350
44439
  var targetParticipantIds = _a.targetParticipantIds, policyAttributes = _a.policyAttributes, idCollections = _a.idCollections, participants = _a.participants;
44351
44440
  if (!Array.isArray(policyAttributes)) {
@@ -44387,8 +44476,12 @@ function extractAttributeValues(_a) {
44387
44476
  policyAttributes.forEach(function (policyAttribute) {
44388
44477
  var _a = policyAttribute || {}, directive = _a.directive, groupings = _a.groupings, key = _a.key, significantCharacters = _a.significantCharacters;
44389
44478
  if (key) {
44390
- var keys = key.split('.');
44391
- processKeys({ value: participant, keys: keys, significantCharacters: significantCharacters });
44479
+ var accessors = key.split('.');
44480
+ extractedValues.push.apply(extractedValues, __spreadArray([], __read(processAccessors({
44481
+ significantCharacters: significantCharacters,
44482
+ value: participant,
44483
+ accessors: accessors,
44484
+ })), false));
44392
44485
  }
44393
44486
  else if (directive) {
44394
44487
  // extractedValues are values to be avoided
@@ -44418,53 +44511,6 @@ function extractAttributeValues(_a) {
44418
44511
  });
44419
44512
  var values = unique(extractedValues);
44420
44513
  return { values: values };
44421
- function processKeys(_a) {
44422
- var e_1, _b;
44423
- var value = _a.value, _c = _a.keys, keys = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
44424
- var _loop_1 = function (index, key) {
44425
- if (value === null || value === void 0 ? void 0 : value[key]) {
44426
- if (Array.isArray(value[key])) {
44427
- var values_1 = value[key];
44428
- var remainingKeys_1 = keys.slice(index);
44429
- values_1.forEach(function (nestedValue) {
44430
- return processKeys({
44431
- value: nestedValue,
44432
- keys: remainingKeys_1,
44433
- significantCharacters: significantCharacters,
44434
- });
44435
- });
44436
- }
44437
- else {
44438
- value = value[key];
44439
- checkValue({ value: value, index: index });
44440
- }
44441
- }
44442
- };
44443
- try {
44444
- for (var _d = __values(keys.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
44445
- var _f = __read(_e.value, 2), index = _f[0], key = _f[1];
44446
- _loop_1(index, key);
44447
- }
44448
- }
44449
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
44450
- finally {
44451
- try {
44452
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
44453
- }
44454
- finally { if (e_1) throw e_1.error; }
44455
- }
44456
- function checkValue(_a) {
44457
- var value = _a.value, index = _a.index;
44458
- if (value &&
44459
- index === keys.length - 1 &&
44460
- ['string', 'number'].includes(typeof value)) {
44461
- var extractedValue = significantCharacters
44462
- ? value.slice(0, significantCharacters)
44463
- : value;
44464
- extractedValues.push(extractedValue);
44465
- }
44466
- }
44467
- }
44468
44514
  }
44469
44515
 
44470
44516
  function getPositionedParticipants(_a) {
@@ -45256,7 +45302,7 @@ function positionUnseededParticipants(_a) {
45256
45302
  drawDefinition: drawDefinition,
45257
45303
  event: event,
45258
45304
  }).appliedPolicies;
45259
- var avoidance = (appliedPolicies !== null && appliedPolicies !== void 0 ? appliedPolicies : {}).avoidance;
45305
+ var avoidance = (appliedPolicies !== null && appliedPolicies !== void 0 ? appliedPolicies : {})[POLICY_TYPE_AVOIDANCE];
45260
45306
  if (structure.stage === PLAY_OFF) {
45261
45307
  // generate avoidance policies automatically for Playoffs from Round Robin Groups
45262
45308
  var groupings = entries.reduce(function (groupings, entry) {
@@ -59371,8 +59417,8 @@ function getEntryStatusReports(_a) {
59371
59417
  return sides === null || sides === void 0 ? void 0 : sides.flatMap(function (side) {
59372
59418
  var _a, _b;
59373
59419
  return matchUpType === DOUBLES_MATCHUP
59374
- ? (_a = side.participant) === null || _a === void 0 ? void 0 : _a.individualParticipantIds
59375
- : ((_b = side.participant) === null || _b === void 0 ? void 0 : _b.participantId) || side.participantId;
59420
+ ? (_a = side === null || side === void 0 ? void 0 : side.participant) === null || _a === void 0 ? void 0 : _a.individualParticipantIds
59421
+ : ((_b = side === null || side === void 0 ? void 0 : side.participant) === null || _b === void 0 ? void 0 : _b.participantId) || side.participantId;
59376
59422
  }).filter(Boolean);
59377
59423
  })
59378
59424
  .filter(Boolean);
@@ -59521,7 +59567,7 @@ function getEntryStatusReports(_a) {
59521
59567
  var _b = _a.participant, participantType = _b.participantType, participantRole = _b.participantRole;
59522
59568
  return participantType === INDIVIDUAL && participantRole === COMPETITOR;
59523
59569
  });
59524
- var nonParticipatingParticipants = individualParticipants
59570
+ var nonParticipatingParticipantIds = individualParticipants
59525
59571
  .filter(function (_a) {
59526
59572
  var participant = _a.participant;
59527
59573
  return !nonTeamEnteredParticipantIds.includes(participant.participantId);
@@ -59531,9 +59577,10 @@ function getEntryStatusReports(_a) {
59531
59577
  return participant.participantId;
59532
59578
  });
59533
59579
  var tournamentEntryReport = {
59534
- nonParticipatingEntriesCount: nonParticipatingParticipants.length,
59580
+ nonParticipatingEntriesCount: nonParticipatingParticipantIds.length,
59535
59581
  individualParticipantsCount: individualParticipants.length,
59536
59582
  eventsCount: Object.values(eventReports).length,
59583
+ nonParticipatingParticipantIds: nonParticipatingParticipantIds,
59537
59584
  drawDefinitionsCount: drawDefinitionsCount,
59538
59585
  tournamentId: tournamentId,
59539
59586
  };
@@ -59556,8 +59603,7 @@ function getParticipantStats(_a) {
59556
59603
  return { error: INVALID_MATCHUP };
59557
59604
  var participantsProfile = withScaleValues ? { withScaleValues: withScaleValues } : undefined;
59558
59605
  matchUps =
59559
- matchUps ||
59560
- allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
59606
+ matchUps !== null && matchUps !== void 0 ? matchUps : allTournamentMatchUps({ tournamentRecord: tournamentRecord, participantsProfile: participantsProfile }).matchUps;
59561
59607
  if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length))
59562
59608
  return { error: MISSING_MATCHUPS };
59563
59609
  var teamParticipantIds = [];
@@ -59636,6 +59682,9 @@ function getParticipantStats(_a) {
59636
59682
  participantName: participant.participantName,
59637
59683
  ratings: participant.ratings,
59638
59684
  });
59685
+ var stats = participantStats.get(participant.participantId);
59686
+ if (stats)
59687
+ stats.participantName = participant.participantName;
59639
59688
  }
59640
59689
  }
59641
59690
  }
@@ -67530,6 +67579,7 @@ var lastNames = [
67530
67579
  "Dallas",
67531
67580
  "Diamond",
67532
67581
  "Deckard",
67582
+ "Drazic",
67533
67583
  "Dunbar",
67534
67584
  "Earhart",
67535
67585
  "Eisenstein",
@@ -67610,7 +67660,7 @@ var firstFemale = [
67610
67660
  "Amelie",
67611
67661
  "America",
67612
67662
  "Anne",
67613
- "Antoina",
67663
+ "Antonia",
67614
67664
  "Aravis",
67615
67665
  "Astrid",
67616
67666
  "Beatrice",
@@ -68606,10 +68656,10 @@ function anonymizeTournamentRecord(_a) {
68606
68656
  counts[gender] += 1;
68607
68657
  }
68608
68658
  else {
68609
- counts[OTHER$2] += 1;
68659
+ counts[OTHER$3] += 1;
68610
68660
  }
68611
68661
  return counts;
68612
- }, (_m = {}, _m[MALE] = 0, _m[FEMALE] = 0, _m[OTHER$2] = 0, _m));
68662
+ }, (_m = {}, _m[MALE] = 0, _m[FEMALE] = 0, _m[OTHER$3] = 0, _m));
68613
68663
  var genderedPersons = Object.assign.apply(Object, __spreadArray([{}], __read(Object.keys(gendersCount).map(function (gender) {
68614
68664
  var _a;
68615
68665
  var _b;
@@ -68624,7 +68674,7 @@ function anonymizeTournamentRecord(_a) {
68624
68674
  })) === null || _b === void 0 ? void 0 : _b.persons) || [],
68625
68675
  _a);
68626
68676
  })), false));
68627
- var genderedIndices = (_o = {}, _o[MALE] = 0, _o[FEMALE] = 0, _o[OTHER$2] = 0, _o);
68677
+ var genderedIndices = (_o = {}, _o[MALE] = 0, _o[FEMALE] = 0, _o[OTHER$3] = 0, _o);
68628
68678
  var individualParticipantsCount = individualParticipants.length;
68629
68679
  var addressComponents = individualParticipants.reduce(function (components, participant) {
68630
68680
  var _a, _b;
@@ -68657,7 +68707,7 @@ function anonymizeTournamentRecord(_a) {
68657
68707
  individualParticipants.forEach(function (individualParticipant, participantIndex) {
68658
68708
  var _a, _b;
68659
68709
  var person = individualParticipant === null || individualParticipant === void 0 ? void 0 : individualParticipant.person;
68660
- var gender = (person === null || person === void 0 ? void 0 : person.sex) || OTHER$2;
68710
+ var gender = (person === null || person === void 0 ? void 0 : person.sex) || OTHER$3;
68661
68711
  var birthYear = (_a = extractDate(person === null || person === void 0 ? void 0 : person.birthDate)) === null || _a === void 0 ? void 0 : _a.split('-')[0];
68662
68712
  var genderedIndex = genderedIndices[gender];
68663
68713
  var generatedPerson = genderedPersons[gender][genderedIndex];
@@ -69221,7 +69271,7 @@ function processTieFormat(_a) {
69221
69271
  var maxDoublesCount = 0, maxSinglesCount = 0;
69222
69272
  var singlesMatchUpTotal = 0, doublesMatchUpTotal = 0;
69223
69273
  var categories = {};
69224
- var genders = (_b = {}, _b[MALE] = 0, _b[FEMALE] = 0, _b[MIXED] = 0, _b[OTHER$2] = 0, _b[ANY] = 0, _b);
69274
+ var genders = (_b = {}, _b[MALE] = 0, _b[FEMALE] = 0, _b[MIXED] = 0, _b[OTHER$3] = 0, _b[ANY] = 0, _b);
69225
69275
  tieFormat =
69226
69276
  typeof tieFormat === 'object'
69227
69277
  ? tieFormat
@@ -69278,7 +69328,7 @@ function getParticipantsCount(_a) {
69278
69328
  var gendersCount = (_b = {},
69279
69329
  _b[FEMALE] = 0,
69280
69330
  _b[MIXED] = 0,
69281
- _b[OTHER$2] = 0,
69331
+ _b[OTHER$3] = 0,
69282
69332
  _b[MALE] = 0,
69283
69333
  _b[ANY] = 0,
69284
69334
  _b);
@@ -70955,6 +71005,7 @@ var utilities = {
70955
71005
  findExtension: findExtension$2,
70956
71006
  flattenJSON: flattenJSON,
70957
71007
  garman: garman,
71008
+ genderValidityCheck: genderValidityCheck,
70958
71009
  generateHashCode: generateHashCode,
70959
71010
  generateRange: generateRange,
70960
71011
  generateScoreString: generateScoreString,
@@ -71031,6 +71082,7 @@ exports.scaleEngineAsync = scaleEngineAsync;
71031
71082
  exports.scoreGovernor = scoreGovernor;
71032
71083
  exports.setDeepCopy = setDeepCopy;
71033
71084
  exports.setDevContext = setDevContext;
71085
+ exports.setGlobalLog = setGlobalLog;
71034
71086
  exports.setStateProvider = setStateProvider;
71035
71087
  exports.setSubscriptions = setSubscriptions;
71036
71088
  exports.surfaceConstants = surfaceConstants;