tods-competition-factory 1.7.6 → 1.7.8

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.
@@ -362,7 +362,7 @@ var matchUpFormatCode = {
362
362
  };
363
363
 
364
364
  function factoryVersion() {
365
- return '1.7.6';
365
+ return '1.7.8';
366
366
  }
367
367
 
368
368
  /******************************************************************************
@@ -2017,181 +2017,6 @@ function handleCaughtError(_a) {
2017
2017
  });
2018
2018
  }
2019
2019
 
2020
- function isObject(obj) {
2021
- return typeof obj === 'object';
2022
- }
2023
- // e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
2024
- var hasAttributeValues = function (a) { return function (o) {
2025
- return Object.keys(a).every(function (key) { return o[key] === a[key]; });
2026
- }; };
2027
- // extracts targeted attributes
2028
- // e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
2029
- // supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
2030
- var extractAttributes = function (atz) { return function (o) {
2031
- return !atz || typeof o !== 'object'
2032
- ? undefined
2033
- : (Array.isArray(atz) && atz.map(function (a) {
2034
- var _a;
2035
- return (_a = {}, _a[a] = o[a], _a);
2036
- })) ||
2037
- (typeof atz === 'object' &&
2038
- Object.keys(atz).map(function (key) {
2039
- var _a;
2040
- return (_a = {}, _a[key] = o[key], _a);
2041
- })) ||
2042
- (typeof atz === 'string' && getAttr(o, atz));
2043
- }; };
2044
- function getAttr(o, attr) {
2045
- var e_1, _a;
2046
- var attrs = attr.split('.');
2047
- try {
2048
- for (var attrs_1 = __values(attrs), attrs_1_1 = attrs_1.next(); !attrs_1_1.done; attrs_1_1 = attrs_1.next()) {
2049
- var a = attrs_1_1.value;
2050
- o = o === null || o === void 0 ? void 0 : o[a];
2051
- if (!o)
2052
- return;
2053
- }
2054
- }
2055
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2056
- finally {
2057
- try {
2058
- if (attrs_1_1 && !attrs_1_1.done && (_a = attrs_1.return)) _a.call(attrs_1);
2059
- }
2060
- finally { if (e_1) throw e_1.error; }
2061
- }
2062
- return o;
2063
- }
2064
- function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
2065
- if (typeof obj !== 'object' || obj === null)
2066
- return obj;
2067
- var deepCopy = deepCopyEnabled();
2068
- if (!(deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.enabled))
2069
- shallow = true;
2070
- var ignoreValues = ['', undefined, null];
2071
- if (ignoreFalse)
2072
- ignoreValues.push(false);
2073
- var definedKeys = Object.keys(obj).filter(function (key) {
2074
- return !ignoreValues.includes(obj[key]) &&
2075
- (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true));
2076
- });
2077
- return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
2078
- var _a, _b;
2079
- return Array.isArray(obj[key])
2080
- ? (_a = {},
2081
- _a[key] = shallow
2082
- ? obj[key]
2083
- : obj[key].map(function (m) { return definedAttributes(m); }),
2084
- _a) : (_b = {}, _b[key] = shallow ? obj[key] : definedAttributes(obj[key]), _b);
2085
- })), false));
2086
- }
2087
- function countKeys(o) {
2088
- if (Array.isArray(o)) {
2089
- return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
2090
- }
2091
- else if (typeof o === 'object' && o !== null) {
2092
- return (Object.keys(o).length +
2093
- Object.keys(o)
2094
- .map(function (k) { return countKeys(o[k]); })
2095
- .reduce(function (a, b) { return a + b; }, 0));
2096
- }
2097
- return 0;
2098
- }
2099
- function generateHashCode(o) {
2100
- if (o === null || typeof o !== 'object')
2101
- return undefined;
2102
- var str = JSON.stringify(o);
2103
- var keyCount = countKeys(o);
2104
- var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
2105
- return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
2106
- }
2107
-
2108
- // NOTE: type really does need to be any!
2109
- function attributeFilter(params) {
2110
- if (params === null)
2111
- return {};
2112
- var _a = params || {}, source = _a.source, template = _a.template;
2113
- if (!template)
2114
- return source;
2115
- var target = {};
2116
- attributeCopy(source, template, target);
2117
- return target;
2118
- function attributeCopy(valuesObject, templateObject, outputObject) {
2119
- var e_1, _a;
2120
- if (!valuesObject || !templateObject)
2121
- return undefined;
2122
- var vKeys = Object.keys(valuesObject);
2123
- var oKeys = Object.keys(templateObject);
2124
- // the orMap allows spcification of { 'a||b': boolean } so that filter templates can apply to multiple attributes
2125
- var orMap = Object.assign.apply(Object, __spreadArray([{}], __read(oKeys
2126
- .filter(function (key) { return key.indexOf('||'); })
2127
- .map(function (key) { return key.split('||').map(function (or) {
2128
- var _a;
2129
- return (_a = {}, _a[or] = key, _a);
2130
- }); })
2131
- .flat()), false));
2132
- var allKeys = oKeys.concat.apply(oKeys, __spreadArray([], __read(Object.keys(orMap)), false));
2133
- var wildcard = allKeys.includes('*');
2134
- var _loop_1 = function (vKey) {
2135
- if (allKeys.indexOf(vKey) >= 0 || wildcard) {
2136
- var templateKey = orMap[vKey] || vKey;
2137
- var tobj_1 = templateObject[templateKey] || wildcard;
2138
- var vobj = valuesObject[vKey];
2139
- if (typeof tobj_1 === 'object' &&
2140
- typeof vobj !== 'function' &&
2141
- !Array.isArray(tobj_1)) {
2142
- if (Array.isArray(vobj)) {
2143
- var mappedElements = vobj
2144
- .map(function (arrayMember) {
2145
- var target = {};
2146
- var result = attributeCopy(arrayMember, tobj_1, target);
2147
- return result !== false ? target : undefined;
2148
- })
2149
- .filter(Boolean);
2150
- outputObject[vKey] = mappedElements;
2151
- }
2152
- else if (vobj) {
2153
- outputObject[vKey] = {};
2154
- attributeCopy(vobj, tobj_1, outputObject[vKey]);
2155
- }
2156
- }
2157
- else {
2158
- var value = valuesObject[vKey];
2159
- var exclude = Array.isArray(tobj_1) && !tobj_1.includes(value);
2160
- if (exclude)
2161
- return { value: false };
2162
- if (templateObject[vKey] ||
2163
- (wildcard && templateObject[vKey] !== false)) {
2164
- outputObject[vKey] = value;
2165
- }
2166
- }
2167
- }
2168
- };
2169
- try {
2170
- for (var vKeys_1 = __values(vKeys), vKeys_1_1 = vKeys_1.next(); !vKeys_1_1.done; vKeys_1_1 = vKeys_1.next()) {
2171
- var vKey = vKeys_1_1.value;
2172
- var state_1 = _loop_1(vKey);
2173
- if (typeof state_1 === "object")
2174
- return state_1.value;
2175
- }
2176
- }
2177
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
2178
- finally {
2179
- try {
2180
- if (vKeys_1_1 && !vKeys_1_1.done && (_a = vKeys_1.return)) _a.call(vKeys_1);
2181
- }
2182
- finally { if (e_1) throw e_1.error; }
2183
- }
2184
- return undefined;
2185
- }
2186
- }
2187
-
2188
- function generateTimeCode(index) {
2189
- if (index === void 0) { index = 0; }
2190
- var uidate = new Date();
2191
- uidate.setHours(uidate.getHours() + index);
2192
- return uidate.getTime().toString(36).slice(-6).toUpperCase();
2193
- }
2194
-
2195
2020
  var validDateString = /^[\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1])$/;
2196
2021
  var validTimeString = /^((0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)([.,][0-9]{3})?$/;
2197
2022
  var dateValidation = /^([\d]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][\d]|3[0-1]))([ T](0[\d]|1[\d]|2[0-3]):[0-5][\d](:[0-5][\d])?)?([.,][\d]{3})?Z?$/;
@@ -2633,6 +2458,261 @@ function extensionsToAttributes(extensions) {
2633
2458
  }).filter(Boolean);
2634
2459
  }
2635
2460
 
2461
+ function getAccessorValue(_a) {
2462
+ var element = _a.element, accessor = _a.accessor;
2463
+ if (typeof accessor !== 'string')
2464
+ return { values: [] };
2465
+ var targetElement = makeDeepCopy(element);
2466
+ var attributes = accessor.split('.');
2467
+ var values = [];
2468
+ var value;
2469
+ processKeys({ targetElement: targetElement, attributes: attributes });
2470
+ var result = { value: value };
2471
+ if (values.length)
2472
+ result.values = values;
2473
+ return result;
2474
+ function processKeys(_a) {
2475
+ var e_1, _b;
2476
+ var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
2477
+ var _loop_1 = function (index, attribute) {
2478
+ if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
2479
+ var remainingKeys_1 = attributes.slice(index + 1);
2480
+ if (!remainingKeys_1.length) {
2481
+ if (!value)
2482
+ value = targetElement[attribute];
2483
+ if (!values.includes(targetElement[attribute])) {
2484
+ values.push(targetElement[attribute]);
2485
+ }
2486
+ }
2487
+ else if (Array.isArray(targetElement[attribute])) {
2488
+ var values_1 = targetElement[attribute];
2489
+ values_1.forEach(function (nestedTarget) {
2490
+ return processKeys({
2491
+ targetElement: nestedTarget,
2492
+ attributes: remainingKeys_1,
2493
+ });
2494
+ });
2495
+ }
2496
+ else {
2497
+ targetElement = targetElement[attribute];
2498
+ checkValue({ targetElement: targetElement, index: index });
2499
+ }
2500
+ }
2501
+ };
2502
+ try {
2503
+ for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
2504
+ var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
2505
+ _loop_1(index, attribute);
2506
+ }
2507
+ }
2508
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2509
+ finally {
2510
+ try {
2511
+ if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
2512
+ }
2513
+ finally { if (e_1) throw e_1.error; }
2514
+ }
2515
+ function checkValue(_a) {
2516
+ var targetElement = _a.targetElement, index = _a.index;
2517
+ if (targetElement &&
2518
+ index === attributes.length - 1 &&
2519
+ ['string', 'number'].includes(typeof targetElement)) {
2520
+ var extractedValue = significantCharacters
2521
+ ? targetElement.slice(0, significantCharacters)
2522
+ : targetElement;
2523
+ if (value) {
2524
+ if (!values.includes(extractedValue)) {
2525
+ values.push(extractedValue);
2526
+ }
2527
+ }
2528
+ else {
2529
+ value = extractedValue;
2530
+ values.push(extractedValue);
2531
+ }
2532
+ }
2533
+ }
2534
+ }
2535
+ }
2536
+
2537
+ function isString(obj) {
2538
+ return typeof obj === 'string';
2539
+ }
2540
+ function isObject(obj) {
2541
+ return typeof obj === 'object';
2542
+ }
2543
+ function createMap(objectArray, attribute) {
2544
+ if (!Array.isArray(objectArray))
2545
+ return {};
2546
+ return Object.assign.apply(Object, __spreadArray([{}], __read((objectArray !== null && objectArray !== void 0 ? objectArray : [])
2547
+ .filter(isObject)
2548
+ .map(function (obj) {
2549
+ var _a;
2550
+ return (obj[attribute] && (_a = {},
2551
+ _a[obj[attribute]] = obj,
2552
+ _a));
2553
+ })
2554
+ .filter(Boolean)), false));
2555
+ }
2556
+ // e.g. result.find(hav({ attr: value })) -or- result.filter(hav({ attr: value }))
2557
+ var hasAttributeValues = function (a) { return function (o) {
2558
+ return Object.keys(a).every(function (key) { return o[key] === a[key]; });
2559
+ }; };
2560
+ // extracts targeted attributes
2561
+ // e.g. const byeAssignments = positionAssignments.filter(xa('bye')).map(xa('drawPosition'));
2562
+ // supports xa('string'), xa(['string', 'string']), xa({ attr1: true, attr2: true })
2563
+ var extractAttributes = function (accessor) { return function (element) {
2564
+ var _a;
2565
+ return !accessor || typeof element !== 'object'
2566
+ ? undefined
2567
+ : (Array.isArray(accessor) &&
2568
+ accessor.map(function (a) {
2569
+ var _a;
2570
+ var _b;
2571
+ return (_a = {},
2572
+ _a[a] = (_b = getAccessorValue({ element: element, accessor: a })) === null || _b === void 0 ? void 0 : _b.value,
2573
+ _a);
2574
+ })) ||
2575
+ (typeof accessor === 'object' &&
2576
+ Object.keys(accessor).map(function (key) {
2577
+ var _a;
2578
+ var _b;
2579
+ return (_a = {},
2580
+ _a[key] = (_b = getAccessorValue({ element: element, accessor: key })) === null || _b === void 0 ? void 0 : _b.value,
2581
+ _a);
2582
+ })) ||
2583
+ ((_a = (typeof accessor === 'string' && getAccessorValue({ element: element, accessor: accessor }))) === null || _a === void 0 ? void 0 : _a.value);
2584
+ }; };
2585
+ function definedAttributes(obj, ignoreFalse, ignoreEmptyArrays, shallow) {
2586
+ if (typeof obj !== 'object' || obj === null)
2587
+ return obj;
2588
+ var deepCopy = deepCopyEnabled();
2589
+ if (!(deepCopy === null || deepCopy === void 0 ? void 0 : deepCopy.enabled))
2590
+ shallow = true;
2591
+ var ignoreValues = ['', undefined, null];
2592
+ if (ignoreFalse)
2593
+ ignoreValues.push(false);
2594
+ var definedKeys = Object.keys(obj).filter(function (key) {
2595
+ return !ignoreValues.includes(obj[key]) &&
2596
+ (!ignoreEmptyArrays || (Array.isArray(obj[key]) ? obj[key].length : true));
2597
+ });
2598
+ return Object.assign.apply(Object, __spreadArray([{}], __read(definedKeys.map(function (key) {
2599
+ var _a, _b;
2600
+ return Array.isArray(obj[key])
2601
+ ? (_a = {},
2602
+ _a[key] = shallow
2603
+ ? obj[key]
2604
+ : obj[key].map(function (m) { return definedAttributes(m); }),
2605
+ _a) : (_b = {}, _b[key] = shallow ? obj[key] : definedAttributes(obj[key]), _b);
2606
+ })), false));
2607
+ }
2608
+ function countKeys(o) {
2609
+ if (Array.isArray(o)) {
2610
+ return o.length + o.map(countKeys).reduce(function (a, b) { return a + b; }, 0);
2611
+ }
2612
+ else if (typeof o === 'object' && o !== null) {
2613
+ return (Object.keys(o).length +
2614
+ Object.keys(o)
2615
+ .map(function (k) { return countKeys(o[k]); })
2616
+ .reduce(function (a, b) { return a + b; }, 0));
2617
+ }
2618
+ return 0;
2619
+ }
2620
+ function generateHashCode(o) {
2621
+ if (o === null || typeof o !== 'object')
2622
+ return undefined;
2623
+ var str = JSON.stringify(o);
2624
+ var keyCount = countKeys(o);
2625
+ var charSum = str.split('').reduce(function (a, b) { return a + b.charCodeAt(0); }, 0);
2626
+ return [str.length, keyCount, charSum].map(function (e) { return e.toString(36); }).join('');
2627
+ }
2628
+
2629
+ // NOTE: type really does need to be any!
2630
+ function attributeFilter(params) {
2631
+ if (params === null)
2632
+ return {};
2633
+ var _a = params || {}, source = _a.source, template = _a.template;
2634
+ if (!template)
2635
+ return source;
2636
+ var target = {};
2637
+ attributeCopy(source, template, target);
2638
+ return target;
2639
+ function attributeCopy(valuesObject, templateObject, outputObject) {
2640
+ var e_1, _a;
2641
+ if (!valuesObject || !templateObject)
2642
+ return undefined;
2643
+ var vKeys = Object.keys(valuesObject);
2644
+ var oKeys = Object.keys(templateObject);
2645
+ // the orMap allows spcification of { 'a||b': boolean } so that filter templates can apply to multiple attributes
2646
+ var orMap = Object.assign.apply(Object, __spreadArray([{}], __read(oKeys
2647
+ .filter(function (key) { return key.indexOf('||'); })
2648
+ .map(function (key) { return key.split('||').map(function (or) {
2649
+ var _a;
2650
+ return (_a = {}, _a[or] = key, _a);
2651
+ }); })
2652
+ .flat()), false));
2653
+ var allKeys = oKeys.concat.apply(oKeys, __spreadArray([], __read(Object.keys(orMap)), false));
2654
+ var wildcard = allKeys.includes('*');
2655
+ var _loop_1 = function (vKey) {
2656
+ if (allKeys.indexOf(vKey) >= 0 || wildcard) {
2657
+ var templateKey = orMap[vKey] || vKey;
2658
+ var tobj_1 = templateObject[templateKey] || wildcard;
2659
+ var vobj = valuesObject[vKey];
2660
+ if (typeof tobj_1 === 'object' &&
2661
+ typeof vobj !== 'function' &&
2662
+ !Array.isArray(tobj_1)) {
2663
+ if (Array.isArray(vobj)) {
2664
+ var mappedElements = vobj
2665
+ .map(function (arrayMember) {
2666
+ var target = {};
2667
+ var result = attributeCopy(arrayMember, tobj_1, target);
2668
+ return result !== false ? target : undefined;
2669
+ })
2670
+ .filter(Boolean);
2671
+ outputObject[vKey] = mappedElements;
2672
+ }
2673
+ else if (vobj) {
2674
+ outputObject[vKey] = {};
2675
+ attributeCopy(vobj, tobj_1, outputObject[vKey]);
2676
+ }
2677
+ }
2678
+ else {
2679
+ var value = valuesObject[vKey];
2680
+ var exclude = Array.isArray(tobj_1) && !tobj_1.includes(value);
2681
+ if (exclude)
2682
+ return { value: false };
2683
+ if (templateObject[vKey] ||
2684
+ (wildcard && templateObject[vKey] !== false)) {
2685
+ outputObject[vKey] = value;
2686
+ }
2687
+ }
2688
+ }
2689
+ };
2690
+ try {
2691
+ for (var vKeys_1 = __values(vKeys), vKeys_1_1 = vKeys_1.next(); !vKeys_1_1.done; vKeys_1_1 = vKeys_1.next()) {
2692
+ var vKey = vKeys_1_1.value;
2693
+ var state_1 = _loop_1(vKey);
2694
+ if (typeof state_1 === "object")
2695
+ return state_1.value;
2696
+ }
2697
+ }
2698
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
2699
+ finally {
2700
+ try {
2701
+ if (vKeys_1_1 && !vKeys_1_1.done && (_a = vKeys_1.return)) _a.call(vKeys_1);
2702
+ }
2703
+ finally { if (e_1) throw e_1.error; }
2704
+ }
2705
+ return undefined;
2706
+ }
2707
+ }
2708
+
2709
+ function generateTimeCode(index) {
2710
+ if (index === void 0) { index = 0; }
2711
+ var uidate = new Date();
2712
+ uidate.setHours(uidate.getHours() + index);
2713
+ return uidate.getTime().toString(36).slice(-6).toUpperCase();
2714
+ }
2715
+
2636
2716
  function numericSort(a, b) {
2637
2717
  return a - b;
2638
2718
  }
@@ -5341,9 +5421,10 @@ function getCollectionPositionMatchUps(_a) {
5341
5421
 
5342
5422
  var add = function (a, b) { return (a || 0) + (b || 0); };
5343
5423
  function getBand(spread, bandProfiles) {
5344
- return ((isNaN(spread) && WALKOVER$1) ||
5345
- (spread <= bandProfiles[DECISIVE] && DECISIVE) ||
5346
- (spread <= bandProfiles[ROUTINE] && ROUTINE) ||
5424
+ var spreadValue = Array.isArray(spread) ? spread[0] : spread;
5425
+ return ((isNaN(spreadValue) && WALKOVER$1) ||
5426
+ (spreadValue <= bandProfiles[DECISIVE] && DECISIVE) ||
5427
+ (spreadValue <= bandProfiles[ROUTINE] && ROUTINE) ||
5347
5428
  COMPETITIVE);
5348
5429
  }
5349
5430
  function getScoreComponents(_a) {
@@ -5412,7 +5493,8 @@ function getMatchUpCompetitiveProfile(_a) {
5412
5493
  var scoreComponents = getScoreComponents({ score: score });
5413
5494
  var spread = pctSpread([scoreComponents]);
5414
5495
  var competitiveness = getBand(spread, bandProfiles);
5415
- return __assign(__assign({}, SUCCESS), { competitiveness: competitiveness, pctSpread: spread });
5496
+ var pctSpreadValue = Array.isArray(spread) ? spread[0] : spread;
5497
+ return __assign(__assign({}, SUCCESS), { competitiveness: competitiveness, pctSpread: pctSpreadValue });
5416
5498
  }
5417
5499
 
5418
5500
  function findMatchupFormatAverageTimes(params) {
@@ -9007,6 +9089,7 @@ function isAdHoc(_a) {
9007
9089
  var hasRoundPosition = matchUps === null || matchUps === void 0 ? void 0 : matchUps.find(function (matchUp) { return matchUp === null || matchUp === void 0 ? void 0 : matchUp.roundPosition; });
9008
9090
  var hasDrawPosition = matchUps === null || matchUps === void 0 ? void 0 : matchUps.find(function (matchUp) { var _a; return (_a = matchUp === null || matchUp === void 0 ? void 0 : matchUp.drawPositions) === null || _a === void 0 ? void 0 : _a.length; });
9009
9091
  return (!(structure === null || structure === void 0 ? void 0 : structure.structures) &&
9092
+ (structure === null || structure === void 0 ? void 0 : structure.stage) !== VOLUNTARY_CONSOLATION &&
9010
9093
  !((drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.drawType) && drawDefinition.drawType !== AD_HOC) &&
9011
9094
  !hasRoundPosition &&
9012
9095
  !hasDrawPosition);
@@ -9016,6 +9099,9 @@ var _a$h, _b$4;
9016
9099
  var POLICY_ROUND_NAMING_DEFAULT = (_a$h = {},
9017
9100
  _a$h[POLICY_TYPE_ROUND_NAMING] = {
9018
9101
  policyName: 'Round Naming Default',
9102
+ namingConventions: {
9103
+ round: 'Round',
9104
+ },
9019
9105
  abbreviatedRoundNamingMap: {
9020
9106
  // key is matchUpsCount for the round
9021
9107
  1: 'F',
@@ -9056,6 +9142,10 @@ function getRoundContextProfile(_a) {
9056
9142
  defaultRoundNamingPolicy.abbreviatedRoundNamingMap ||
9057
9143
  {};
9058
9144
  var roundNamePrefix = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.affixes) || defaultRoundNamingPolicy.affixes;
9145
+ var roundNumberAffix = roundNamePrefix.roundNumber || defaultRoundNamingPolicy.affixes.roundNumber;
9146
+ var namingConventions = (roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.namingConventions) ||
9147
+ defaultRoundNamingPolicy.namingConventions;
9148
+ var roundNameFallback = namingConventions.round;
9059
9149
  var stageInitial = stage && stage !== MAIN && stage[0];
9060
9150
  var stageConstants = roundNamingPolicy === null || roundNamingPolicy === void 0 ? void 0 : roundNamingPolicy.stageConstants;
9061
9151
  var stageConstant = (stage && (stageConstants === null || stageConstants === void 0 ? void 0 : stageConstants[stage])) || stageInitial;
@@ -9063,8 +9153,8 @@ function getRoundContextProfile(_a) {
9063
9153
  if (isRoundRobin || isAdHocStructure || isLuckyStructure) {
9064
9154
  Object.assign.apply(Object, __spreadArray([roundNamingProfile], __read(roundProfileKeys.map(function (key) {
9065
9155
  var _a;
9066
- var roundName = "Round ".concat(key);
9067
- var abbreviatedRoundName = "R".concat(key);
9156
+ var roundName = "".concat(roundNameFallback, " ").concat(key);
9157
+ var abbreviatedRoundName = "".concat(roundNumberAffix).concat(key);
9068
9158
  return _a = {}, _a[key] = { roundName: roundName, abbreviatedRoundName: abbreviatedRoundName }, _a;
9069
9159
  })), false));
9070
9160
  }
@@ -28296,75 +28386,6 @@ function getEventPublishStatuses(_a) {
28296
28386
  return undefined;
28297
28387
  }
28298
28388
 
28299
- function getAccessorValue(_a) {
28300
- var element = _a.element, accessor = _a.accessor;
28301
- if (typeof accessor !== 'string')
28302
- return { values: [] };
28303
- var targetElement = makeDeepCopy(element);
28304
- var attributes = accessor.split('.');
28305
- var values = [];
28306
- var value;
28307
- processKeys({ targetElement: targetElement, attributes: attributes });
28308
- var result = { value: value };
28309
- if (values.length)
28310
- result.values = values;
28311
- return result;
28312
- function processKeys(_a) {
28313
- var e_1, _b;
28314
- var targetElement = _a.targetElement, _c = _a.attributes, attributes = _c === void 0 ? [] : _c, significantCharacters = _a.significantCharacters;
28315
- var _loop_1 = function (index, attribute) {
28316
- if (targetElement === null || targetElement === void 0 ? void 0 : targetElement[attribute]) {
28317
- if (Array.isArray(targetElement[attribute])) {
28318
- var values_1 = targetElement[attribute];
28319
- var remainingKeys_1 = attributes.slice(index);
28320
- values_1.forEach(function (nestedTarget) {
28321
- return processKeys({
28322
- targetElement: nestedTarget,
28323
- attributes: remainingKeys_1,
28324
- });
28325
- });
28326
- }
28327
- else {
28328
- targetElement = targetElement[attribute];
28329
- checkValue({ targetElement: targetElement, index: index });
28330
- }
28331
- }
28332
- };
28333
- try {
28334
- for (var _d = __values(attributes.entries()), _e = _d.next(); !_e.done; _e = _d.next()) {
28335
- var _f = __read(_e.value, 2), index = _f[0], attribute = _f[1];
28336
- _loop_1(index, attribute);
28337
- }
28338
- }
28339
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
28340
- finally {
28341
- try {
28342
- if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
28343
- }
28344
- finally { if (e_1) throw e_1.error; }
28345
- }
28346
- function checkValue(_a) {
28347
- var targetElement = _a.targetElement, index = _a.index;
28348
- if (targetElement &&
28349
- index === attributes.length - 1 &&
28350
- ['string', 'number'].includes(typeof targetElement)) {
28351
- var extractedValue = significantCharacters
28352
- ? targetElement.slice(0, significantCharacters)
28353
- : targetElement;
28354
- if (value) {
28355
- if (!values.includes(extractedValue)) {
28356
- values.push(extractedValue);
28357
- }
28358
- }
28359
- else {
28360
- value = extractedValue;
28361
- values.push(extractedValue);
28362
- }
28363
- }
28364
- }
28365
- }
28366
- }
28367
-
28368
28389
  function participantScaleItem(_a) {
28369
28390
  var _b, _c;
28370
28391
  var requireTimeStamp = _a.requireTimeStamp, scaleAttributes = _a.scaleAttributes, participant = _a.participant;
@@ -28572,8 +28593,8 @@ function modifyMatchUpFormatTiming$1(_a) {
28572
28593
  var tournamentScheduling = (extension === null || extension === void 0 ? void 0 : extension.value) || {};
28573
28594
  var value = modifyScheduling(__assign(__assign({}, tournamentScheduling), { matchUpFormat: matchUpFormat, averageTimes: averageTimes, recoveryTimes: recoveryTimes }));
28574
28595
  addTournamentExtension({
28575
- tournamentRecord: tournamentRecord,
28576
28596
  extension: { name: name, value: value },
28597
+ tournamentRecord: tournamentRecord,
28577
28598
  });
28578
28599
  }
28579
28600
  return __assign({}, SUCCESS);
@@ -51389,8 +51410,10 @@ function attachPolicies(_a) {
51389
51410
  if (!drawDefinition.extensions)
51390
51411
  drawDefinition.extensions = [];
51391
51412
  var appliedPolicies = (_c = (_b = getAppliedPolicies({ drawDefinition: drawDefinition })) === null || _b === void 0 ? void 0 : _b.appliedPolicies) !== null && _c !== void 0 ? _c : {};
51413
+ var validReplacements = [POLICY_TYPE_ROUND_NAMING, POLICY_TYPE_DISPLAY];
51392
51414
  var applied = Object.keys(policyDefinitions).every(function (policyType) {
51393
- if (!appliedPolicies[policyType]) {
51415
+ if (!appliedPolicies[policyType] ||
51416
+ validReplacements.includes(policyType)) {
51394
51417
  appliedPolicies[policyType] = policyDefinitions[policyType];
51395
51418
  return true;
51396
51419
  }
@@ -54984,6 +55007,116 @@ function modifyParticipantOtherName(_a) {
54984
55007
  return __assign({}, SUCCESS);
54985
55008
  }
54986
55009
 
55010
+ function formatPersonName(_a) {
55011
+ var _b, _c;
55012
+ var personFormat = _a.personFormat, person = _a.person;
55013
+ var alpha = function (str) { return str.replace(/\W/g, ''); };
55014
+ var allLowerCase = function (str) { return /^[a-z]*$/.test(alpha(str)); };
55015
+ var allUpperCase = function (str) { return /^[A-Z]*$/.test(alpha(str)); };
55016
+ var lastUpperCase = function (str) { return /^[LAST]{4}/.test(alpha(str)); };
55017
+ var lastFirst = function (str) {
55018
+ return str.toLowerCase().indexOf('l') < str.toLowerCase().indexOf('f');
55019
+ };
55020
+ var commaSeparated = function (str) { return str.indexOf(',') >= 0; };
55021
+ var firstInital = function (str) { return str.toLowerCase().indexOf('f.') >= 0; };
55022
+ var lastNameOnly = function (str) { return str.toLowerCase().indexOf('f') < 0; };
55023
+ var hasSpacing = function (str) { return str.indexOf(' ') > 0; };
55024
+ if (!person)
55025
+ return;
55026
+ var spacer = hasSpacing(personFormat) ? ' ' : '';
55027
+ var capitalizeFirst = function (str) {
55028
+ return str
55029
+ .split(' ')
55030
+ .map(function (name) {
55031
+ return name
55032
+ .split('')
55033
+ .map(function (c, i) { return (i ? c.toLowerCase() : c.toUpperCase()); })
55034
+ .join('');
55035
+ })
55036
+ .join(' ');
55037
+ };
55038
+ var firstName = capitalizeFirst((_b = person === null || person === void 0 ? void 0 : person.standardGivenName) !== null && _b !== void 0 ? _b : '');
55039
+ var lastName = capitalizeFirst((_c = person === null || person === void 0 ? void 0 : person.standardFamilyName) !== null && _c !== void 0 ? _c : '');
55040
+ if (!personFormat)
55041
+ return "".concat(firstName).concat(spacer).concat(lastName);
55042
+ if (firstInital(personFormat) &&
55043
+ !commaSeparated(personFormat) &&
55044
+ !lastFirst(personFormat)) {
55045
+ firstName = "".concat(firstName[0], ".");
55046
+ }
55047
+ if (allLowerCase(personFormat)) {
55048
+ firstName = firstName.toLowerCase();
55049
+ lastName = lastName.toLowerCase();
55050
+ }
55051
+ else if (allUpperCase(personFormat)) {
55052
+ firstName = firstName.toUpperCase();
55053
+ lastName = lastName.toUpperCase();
55054
+ }
55055
+ else if (lastUpperCase(personFormat)) {
55056
+ lastName = lastName.toUpperCase();
55057
+ }
55058
+ var participantName = "".concat(firstName).concat(spacer).concat(lastName);
55059
+ if (lastNameOnly(personFormat)) {
55060
+ participantName = lastName;
55061
+ }
55062
+ else if (lastFirst(personFormat)) {
55063
+ if (commaSeparated(personFormat)) {
55064
+ participantName = "".concat(lastName, ",").concat(spacer).concat(firstName);
55065
+ }
55066
+ else {
55067
+ participantName = "".concat(lastName).concat(spacer).concat(firstName);
55068
+ }
55069
+ }
55070
+ return participantName;
55071
+ }
55072
+
55073
+ function formatParticipantName(_a) {
55074
+ var participantMap = _a.participantMap, participant = _a.participant, formats = _a.formats;
55075
+ var participantType = participant.participantType, individualParticipantIds = participant.individualParticipantIds, person = participant.person;
55076
+ var format = participantType && formats[participantType];
55077
+ if (participantType === TEAM_PARTICIPANT)
55078
+ return;
55079
+ if (format) {
55080
+ var personFormat_1 = format.personFormat, doublesJoiner = format.doublesJoiner;
55081
+ if (participantType === INDIVIDUAL) {
55082
+ participant.participantName = formatPersonName({ person: person, personFormat: personFormat_1 });
55083
+ }
55084
+ if (participantType === PAIR) {
55085
+ participant.participantName = individualParticipantIds === null || individualParticipantIds === void 0 ? void 0 : individualParticipantIds.map(function (id) {
55086
+ var _a;
55087
+ var person = (_a = participantMap[id]) === null || _a === void 0 ? void 0 : _a.person;
55088
+ return formatPersonName({ person: person, personFormat: personFormat_1 });
55089
+ }).filter(Boolean).join(doublesJoiner !== null && doublesJoiner !== void 0 ? doublesJoiner : '/');
55090
+ }
55091
+ }
55092
+ }
55093
+
55094
+ function regenerateParticipantNames(_a) {
55095
+ var e_1, _b;
55096
+ var _c;
55097
+ var tournamentRecord = _a.tournamentRecord, formats = _a.formats;
55098
+ if (!tournamentRecord)
55099
+ return { error: MISSING_TOURNAMENT_RECORD };
55100
+ if (!isObject(formats))
55101
+ return { error: MISSING_VALUE };
55102
+ var participants = (_c = tournamentRecord.participants) !== null && _c !== void 0 ? _c : [];
55103
+ var participantMap = createMap(participants, 'participantId');
55104
+ try {
55105
+ for (var participants_1 = __values(participants), participants_1_1 = participants_1.next(); !participants_1_1.done; participants_1_1 = participants_1.next()) {
55106
+ var participant = participants_1_1.value;
55107
+ formatParticipantName({ participant: participant, participantMap: participantMap, formats: formats });
55108
+ }
55109
+ }
55110
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
55111
+ finally {
55112
+ try {
55113
+ if (participants_1_1 && !participants_1_1.done && (_b = participants_1.return)) _b.call(participants_1);
55114
+ }
55115
+ finally { if (e_1) throw e_1.error; }
55116
+ }
55117
+ return __assign({}, SUCCESS);
55118
+ }
55119
+
54987
55120
  function getTournamentPersons(_a) {
54988
55121
  var tournamentRecord = _a.tournamentRecord, participantFilters = _a.participantFilters;
54989
55122
  if (!tournamentRecord)
@@ -55476,6 +55609,7 @@ var participantGovernor = {
55476
55609
  removeParticipantIdsFromAllTeams: removeParticipantIdsFromAllTeams,
55477
55610
  getParticipantMembership: getParticipantMembership,
55478
55611
  generateTeamsFromParticipantAttribute: generateTeamsFromParticipantAttribute,
55612
+ regenerateParticipantNames: regenerateParticipantNames,
55479
55613
  getParticipantIdFinishingPositions: getParticipantIdFinishingPositions,
55480
55614
  modifyParticipant: modifyParticipant,
55481
55615
  modifyParticipantName: modifyParticipantName,
@@ -61158,13 +61292,6 @@ function deleteFlightAndFlightDraw(_a) {
61158
61292
  return refreshEventDrawOrder({ tournamentRecord: tournamentRecord, event: event });
61159
61293
  }
61160
61294
 
61161
- function generateAdHocMatchUps(params) {
61162
- return generateAdHocMatchUps$1(params);
61163
- }
61164
- function addAdHocMatchUps(params) {
61165
- return addAdHocMatchUps$1(params);
61166
- }
61167
-
61168
61295
  function attachFlightProfile(_a) {
61169
61296
  var _b;
61170
61297
  var deleteExisting = _a.deleteExisting, event = _a.event, flightProfile = _a.flightProfile;
@@ -61362,6 +61489,85 @@ function deleteAdHocMatchUps(params) {
61362
61489
  return deleteAdHocMatchUps$1(params);
61363
61490
  }
61364
61491
 
61492
+ function modifyDrawName(_a) {
61493
+ var _b;
61494
+ var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, flightProfile = _a.flightProfile, drawName = _a.drawName, drawId = _a.drawId, event = _a.event;
61495
+ if (!drawName || typeof drawName !== 'string')
61496
+ return decorateResult({
61497
+ result: { error: INVALID_VALUES },
61498
+ context: { drawName: drawName },
61499
+ });
61500
+ if (!flightProfile) {
61501
+ flightProfile = getFlightProfile({ event: event }).flightProfile;
61502
+ }
61503
+ var flight = (_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; });
61504
+ if (flight) {
61505
+ flight.drawName = drawName;
61506
+ var extension = {
61507
+ name: FLIGHT_PROFILE,
61508
+ value: __assign(__assign({}, flightProfile), { flights: flightProfile.flights }),
61509
+ };
61510
+ addEventExtension$1({ event: event, extension: extension });
61511
+ }
61512
+ if (drawDefinition) {
61513
+ drawDefinition.drawName = drawName;
61514
+ modifyDrawNotice({
61515
+ tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
61516
+ drawDefinition: drawDefinition,
61517
+ });
61518
+ }
61519
+ if (!flight && !drawDefinition) {
61520
+ return { error: MISSING_DRAW_DEFINITION };
61521
+ }
61522
+ return __assign(__assign({}, SUCCESS), { flight: flight });
61523
+ }
61524
+
61525
+ function modifyDrawDefinition(_a) {
61526
+ var _b;
61527
+ var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, drawUpdates = _a.drawUpdates, drawId = _a.drawId, event = _a.event;
61528
+ if (!isObject(drawUpdates))
61529
+ return { error: INVALID_END_TIME };
61530
+ var flightProfile = getFlightProfile({ event: event }).flightProfile;
61531
+ var nameResult = drawUpdates.drawName &&
61532
+ modifyDrawName({
61533
+ drawName: drawUpdates.drawName,
61534
+ tournamentRecord: tournamentRecord,
61535
+ drawDefinition: drawDefinition,
61536
+ flightProfile: flightProfile,
61537
+ drawId: drawId,
61538
+ event: event,
61539
+ });
61540
+ if (nameResult === null || nameResult === void 0 ? void 0 : nameResult.error)
61541
+ return nameResult === null || nameResult === void 0 ? void 0 : nameResult.error;
61542
+ var flight = (nameResult === null || nameResult === void 0 ? void 0 : nameResult.flight) ||
61543
+ ((_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; }));
61544
+ if (!flight && !drawDefinition) {
61545
+ return { error: MISSING_DRAW_DEFINITION };
61546
+ }
61547
+ if (flight) {
61548
+ // TODO: any relevant changes to flightProfile
61549
+ var extension = {
61550
+ name: FLIGHT_PROFILE,
61551
+ value: __assign(__assign({}, flightProfile), { flights: flightProfile.flights }),
61552
+ };
61553
+ addEventExtension$1({ event: event, extension: extension });
61554
+ }
61555
+ if (drawDefinition) {
61556
+ if (drawUpdates.policyDefinitions) {
61557
+ attachPolicies({
61558
+ policyDefinitions: drawUpdates.policyDefinitions,
61559
+ drawDefinition: drawDefinition,
61560
+ });
61561
+ }
61562
+ // TODO: any relevant changes to drawDefinition
61563
+ modifyDrawNotice({
61564
+ tournamentId: tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.tournamentId,
61565
+ drawDefinition: drawDefinition,
61566
+ });
61567
+ }
61568
+ return __assign({}, SUCCESS);
61569
+ }
61570
+
61365
61571
  function resetDrawDefinition(_a) {
61366
61572
  var e_1, _b, e_2, _c;
61367
61573
  var _d;
@@ -61567,31 +61773,6 @@ function setOrderOfFinish(params) {
61567
61773
  return setOrderOfFinish$1(params);
61568
61774
  }
61569
61775
 
61570
- function modifyDrawName(_a) {
61571
- var _b;
61572
- var event = _a.event, drawId = _a.drawId, drawDefinition = _a.drawDefinition, drawName = _a.drawName;
61573
- if (!drawName || typeof drawName !== 'string')
61574
- return { error: INVALID_VALUES, drawName: drawName };
61575
- var flightProfile = getFlightProfile({ event: event }).flightProfile;
61576
- var flight = (_b = flightProfile === null || flightProfile === void 0 ? void 0 : flightProfile.flights) === null || _b === void 0 ? void 0 : _b.find(function (flight) { return flight.drawId === drawId; });
61577
- if (flight) {
61578
- flight.drawName = drawName;
61579
- var extension = {
61580
- name: FLIGHT_PROFILE,
61581
- value: __assign(__assign({}, flightProfile), { flights: flightProfile.flights }),
61582
- };
61583
- addEventExtension$1({ event: event, extension: extension });
61584
- }
61585
- if (drawDefinition) {
61586
- drawDefinition.drawName = drawName;
61587
- modifyDrawNotice({ drawDefinition: drawDefinition });
61588
- }
61589
- if (!flight && !drawDefinition) {
61590
- return { error: MISSING_DRAW_DEFINITION };
61591
- }
61592
- return __assign({}, SUCCESS);
61593
- }
61594
-
61595
61776
  function modifyEventEntries(_a) {
61596
61777
  var _b;
61597
61778
  var _c = _a.entryStatus, entryStatus = _c === void 0 ? DIRECT_ACCEPTANCE : _c, _d = _a.unpairedParticipantIds, unpairedParticipantIds = _d === void 0 ? [] : _d, _e = _a.participantIdPairs, participantIdPairs = _e === void 0 ? [] : _e, _f = _a.entryStage, entryStage = _f === void 0 ? MAIN : _f, tournamentRecord = _a.tournamentRecord, event = _a.event;
@@ -61715,6 +61896,13 @@ function addFlight(_a) {
61715
61896
  return addEventExtension$1({ event: event, extension: extension });
61716
61897
  }
61717
61898
 
61899
+ function generateAdHocMatchUps(params) {
61900
+ return generateAdHocMatchUps$1(params);
61901
+ }
61902
+ function addAdHocMatchUps(params) {
61903
+ return addAdHocMatchUps$1(params);
61904
+ }
61905
+
61718
61906
  function attachConsolationStructures(params) {
61719
61907
  return attachStructures(__assign(__assign({}, params), { itemType: 'attachConsolationStructures' }));
61720
61908
  }
@@ -63040,6 +63228,71 @@ function enableTieAutoCalc(params) {
63040
63228
  return enableTieAutoCalc$1(params);
63041
63229
  }
63042
63230
 
63231
+ function modifyEvent(_a) {
63232
+ var _b;
63233
+ var tournamentRecord = _a.tournamentRecord, eventUpdates = _a.eventUpdates, eventId = _a.eventId, event = _a.event;
63234
+ if (!tournamentRecord)
63235
+ return { error: MISSING_TOURNAMENT_RECORD };
63236
+ if (!isString(eventId) || !isObject(eventUpdates))
63237
+ return { error: INVALID_VALUES };
63238
+ var enteredParticipantIds = ((_b = event === null || event === void 0 ? void 0 : event.entries) === null || _b === void 0 ? void 0 : _b.filter(function (_a) {
63239
+ var entryStatus = _a.entryStatus;
63240
+ var status = entryStatus;
63241
+ return __spreadArray(__spreadArray([], __read(STRUCTURE_SELECTED_STATUSES), false), [ALTERNATE], false).includes(status);
63242
+ }).map(function (_a) {
63243
+ var participantId = _a.participantId;
63244
+ return participantId;
63245
+ })) || [];
63246
+ var enteredParticipants = enteredParticipantIds
63247
+ ? getParticipants$1({
63248
+ participantFilters: { participantIds: enteredParticipantIds },
63249
+ withIndividualParticipants: true,
63250
+ tournamentRecord: tournamentRecord,
63251
+ }).participants || []
63252
+ : [];
63253
+ var genderAccumulator = [];
63254
+ var enteredParticipantTypes = enteredParticipants.reduce(function (types, participant) {
63255
+ var _a, _b;
63256
+ var genders = ((_a = participant.person) === null || _a === void 0 ? void 0 : _a.sex)
63257
+ ? [participant.person.sex]
63258
+ : ((_b = participant.individualParticpants) === null || _b === void 0 ? void 0 : _b.map(function (p) { var _a; return (_a = p.person) === null || _a === void 0 ? void 0 : _a.sex; })) || [];
63259
+ genderAccumulator.push.apply(genderAccumulator, __spreadArray([], __read(genders), false));
63260
+ return !types.includes(participant.participantType)
63261
+ ? types.concat(participant.participantType)
63262
+ : types;
63263
+ }, []);
63264
+ var enteredParticipantGenders = unique(genderAccumulator);
63265
+ var validGender = !enteredParticipantGenders.length ||
63266
+ [MIXED, ANY].includes(eventUpdates.gender || '') ||
63267
+ (enteredParticipantGenders.length === 1 &&
63268
+ enteredParticipantGenders[0] === eventUpdates.gender);
63269
+ if (eventUpdates.gender && !validGender)
63270
+ return decorateResult({
63271
+ context: { gender: eventUpdates.gender },
63272
+ result: { error: INVALID_VALUES },
63273
+ });
63274
+ var validEventTypes = (enteredParticipantTypes.includes(TEAM$1) && [TEAM$1]) ||
63275
+ (enteredParticipantTypes.includes(INDIVIDUAL) && [SINGLES]) ||
63276
+ (enteredParticipantTypes.includes(PAIR) && [DOUBLES]) || [
63277
+ DOUBLES,
63278
+ SINGLES,
63279
+ TEAM$1,
63280
+ ];
63281
+ var validEventType = validEventTypes.includes(eventUpdates.eventType || '');
63282
+ if (eventUpdates.eventType && !validEventType)
63283
+ return decorateResult({
63284
+ context: { participantType: eventUpdates.eventType },
63285
+ result: { error: INVALID_VALUES },
63286
+ });
63287
+ if (eventUpdates.eventType)
63288
+ event.eventType === eventUpdates.eventType;
63289
+ if (eventUpdates.eventName)
63290
+ event.eventName = eventUpdates.eventName;
63291
+ if (eventUpdates.gender)
63292
+ event.gender = eventUpdates.gender;
63293
+ return __assign({}, SUCCESS);
63294
+ }
63295
+
63043
63296
  var eventGovernor = {
63044
63297
  generateQualifyingStructure: generateQualifyingStructure,
63045
63298
  attachQualifyingStructure: attachQualifyingStructure,
@@ -63060,11 +63313,12 @@ var eventGovernor = {
63060
63313
  modifyTieFormat: modifyTieFormat$1,
63061
63314
  resetScorecard: resetScorecard,
63062
63315
  resetTieFormat: resetTieFormat$1,
63063
- addEvent: addEvent,
63064
- deleteEvents: deleteEvents,
63065
- setEventDates: setEventDates,
63066
63316
  setEventStartDate: setEventStartDate,
63067
63317
  setEventEndDate: setEventEndDate,
63318
+ setEventDates: setEventDates,
63319
+ deleteEvents: deleteEvents,
63320
+ modifyEvent: modifyEvent,
63321
+ addEvent: addEvent,
63068
63322
  removeSeededParticipant: removeSeededParticipant,
63069
63323
  removeScaleValues: removeScaleValues,
63070
63324
  checkValidEntries: checkValidEntries,
@@ -63075,6 +63329,7 @@ var eventGovernor = {
63075
63329
  getAvailablePlayoffProfiles: getAvailablePlayoffProfiles,
63076
63330
  deleteDrawDefinitions: deleteDrawDefinitions,
63077
63331
  addPlayoffStructures: addPlayoffStructures,
63332
+ modifyDrawDefinition: modifyDrawDefinition,
63078
63333
  addDrawDefinition: addDrawDefinition$1,
63079
63334
  removeStructure: removeStructure,
63080
63335
  modifyDrawName: modifyDrawName,
@@ -63177,7 +63432,7 @@ function getMaxEntryPosition(params) {
63177
63432
  function getPredictiveAccuracy(params) {
63178
63433
  var _a, _b, _c, _d, _e, _f, _g;
63179
63434
  var matchUps = params.matchUps;
63180
- var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, zoneMargin = params.zoneMargin, scaleName = params.scaleName, eventId = params.eventId, drawId = params.drawId, event = params.event;
63435
+ var tournamentRecord = params.tournamentRecord, drawDefinition = params.drawDefinition, excludeMargin = params.excludeMargin, exclusionRule = params.exclusionRule, zoneDoubling = params.zoneDoubling, matchUpType = params.matchUpType, scaleName = params.scaleName, eventId = params.eventId, zonePct = params.zonePct, drawId = params.drawId, event = params.event;
63181
63436
  if (!tournamentRecord && !matchUps)
63182
63437
  return { error: MISSING_TOURNAMENT_RECORD };
63183
63438
  if (matchUpType && ![SINGLES$1, DOUBLES$1].includes(matchUpType))
@@ -63187,6 +63442,12 @@ function getPredictiveAccuracy(params) {
63187
63442
  var scaleProfile = ratingsParameters[scaleName];
63188
63443
  var ascending = (_b = (_a = scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.ascending) !== null && _a !== void 0 ? _a : params.ascending) !== null && _b !== void 0 ? _b : false;
63189
63444
  var valueAccessor = (_c = scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.accessor) !== null && _c !== void 0 ? _c : params.valueAccessor;
63445
+ var ratingsRangeDifference = Array.isArray(scaleProfile === null || scaleProfile === void 0 ? void 0 : scaleProfile.range)
63446
+ ? Math.abs(scaleProfile.range[0] - scaleProfile.range[1])
63447
+ : 0;
63448
+ var zoneMargin = isConvertableInteger(zonePct) && ratingsRangeDifference
63449
+ ? (zonePct || 0 / 100) * ratingsRangeDifference
63450
+ : params.zoneMargin || ratingsRangeDifference;
63190
63451
  var contextProfile = { withScaleValues: true, withCompetitiveness: true };
63191
63452
  var contextFilters = {
63192
63453
  matchUpTypes: matchUpType ? [matchUpType] : [SINGLES$1, DOUBLES$1],
@@ -63233,7 +63494,7 @@ function getPredictiveAccuracy(params) {
63233
63494
  }
63234
63495
  var relevantMatchUps = matchUps.filter(function (_a) {
63235
63496
  var winningSide = _a.winningSide, score = _a.score, sides = _a.sides, matchUpStatus = _a.matchUpStatus;
63236
- return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus) &&
63497
+ return ![RETIRED$1, DEFAULTED, WALKOVER$2, DEAD_RUBBER, ABANDONED$1].includes(matchUpStatus || '') &&
63237
63498
  scoreHasValue({ score: score }) &&
63238
63499
  (sides === null || sides === void 0 ? void 0 : sides.length) === 2 &&
63239
63500
  winningSide;
@@ -63246,9 +63507,11 @@ function getPredictiveAccuracy(params) {
63246
63507
  ascending: ascending,
63247
63508
  scaleName: scaleName,
63248
63509
  });
63249
- var marginCalc = !zoneDoubling || matchUpType === SINGLES$1 ? zoneMargin : zoneMargin * 2;
63250
- var zoneData = zoneMargin &&
63251
- relevantMatchUps
63510
+ var marginCalc = !zoneDoubling || matchUpType === SINGLES$1
63511
+ ? zoneMargin
63512
+ : (zoneMargin || 0) * 2;
63513
+ var zoneData = zoneMargin
63514
+ ? relevantMatchUps
63252
63515
  .map(function (_a) {
63253
63516
  var competitiveProfile = _a.competitiveProfile, matchUpType = _a.matchUpType, score = _a.score, sides = _a.sides;
63254
63517
  var sideValues = getSideValues({
@@ -63267,8 +63530,9 @@ function getPredictiveAccuracy(params) {
63267
63530
  .filter(function (_a) {
63268
63531
  var valuesGap = _a.valuesGap;
63269
63532
  return valuesGap <= marginCalc;
63270
- });
63271
- var zoneBands = (zoneData === null || zoneData === void 0 ? void 0 : zoneData.length) && getGroupingBands({ zoneData: zoneData });
63533
+ })
63534
+ : [];
63535
+ var zoneBands = getGroupingBands({ zoneData: zoneData });
63272
63536
  var totalZoneMatchUps = zoneBands && [].concat(Object.values(zoneBands)).flat().length;
63273
63537
  var zoneDistribution = totalZoneMatchUps && Object.assign.apply(Object, __spreadArray([{}], __read(Object.keys(zoneBands).map(function (key) {
63274
63538
  var _a;
@@ -63441,7 +63705,7 @@ function getGroupingAccuracy(_a) {
63441
63705
  continue;
63442
63706
  }
63443
63707
  var valuesGap = sideValues[winningIndex].value - sideValues[1 - winningIndex].value;
63444
- var floatMargin = parseFloat(excludeMargin);
63708
+ var floatMargin = parseFloat(excludeMargin || 0);
63445
63709
  var excludeGap = floatMargin && Math.abs(valuesGap) < floatMargin;
63446
63710
  if (excludeGap) {
63447
63711
  accuracy.excluded.push({
@@ -65548,7 +65812,7 @@ function generatePersons(params) {
65548
65812
  return false;
65549
65813
  if (typeof person.lastName !== 'string')
65550
65814
  return false;
65551
- if (![MALE, FEMALE].includes(person.sex))
65815
+ if (person.sex && ![MALE, FEMALE].includes(person.sex))
65552
65816
  return false;
65553
65817
  if (person.nationalityCode &&
65554
65818
  (typeof person.nationalityCode !== 'string' ||
@@ -65569,7 +65833,9 @@ function generatePersons(params) {
65569
65833
  return { error: INVALID_VALUES };
65570
65834
  }
65571
65835
  }
65572
- var shuffledPersons = shuffleArray(validPersonData);
65836
+ var shuffledPersons = personData
65837
+ ? validPersonData
65838
+ : shuffleArray(validPersonData);
65573
65839
  if (shuffledPersons.length < count) {
65574
65840
  var _c = defaultPersonData.reduce(function (a, person) {
65575
65841
  var firstName = person.firstName, lastName = person.lastName, nationalityCode = person.nationalityCode;