@xcpcio/core 0.64.3 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -46,6 +46,62 @@ function isValidMedalType(medal) {
46
46
  return validMedalType.includes(medal);
47
47
  }
48
48
 
49
+ class I18nText {
50
+ texts;
51
+ fallback;
52
+ fallbackLang;
53
+ constructor() {
54
+ this.texts = /* @__PURE__ */ new Map();
55
+ }
56
+ get(lang) {
57
+ return this.texts.get(lang);
58
+ }
59
+ getOrDefault(lang) {
60
+ return (lang ? this.texts.get(lang) : void 0) || (this.fallbackLang ? this.texts.get(this.fallbackLang) : void 0) || this.fallback || "";
61
+ }
62
+ set(lang, text) {
63
+ this.texts.set(lang, text);
64
+ }
65
+ has(lang) {
66
+ return this.texts.has(lang);
67
+ }
68
+ static fromI18NStringSet(stringSet) {
69
+ const i18nText = new I18nText();
70
+ i18nText.fallback = stringSet.fallback;
71
+ i18nText.fallbackLang = stringSet.fallback_lang;
72
+ if (stringSet.texts) {
73
+ for (const [lang, text] of Object.entries(stringSet.texts)) {
74
+ i18nText.set(lang, text);
75
+ }
76
+ }
77
+ return i18nText;
78
+ }
79
+ static fromIText(text) {
80
+ if (typeof text === "string") {
81
+ const i18nText = new I18nText();
82
+ i18nText.fallback = text;
83
+ return i18nText;
84
+ }
85
+ return I18nText.fromI18NStringSet(text);
86
+ }
87
+ toI18NStringSet() {
88
+ const result = {};
89
+ if (this.fallback !== void 0) {
90
+ result.fallback = this.fallback;
91
+ }
92
+ if (this.fallbackLang !== void 0) {
93
+ result.fallback_lang = this.fallbackLang;
94
+ }
95
+ if (this.texts.size > 0) {
96
+ result.texts = {};
97
+ for (const [lang, text] of this.texts.entries()) {
98
+ result.texts[lang] = text;
99
+ }
100
+ }
101
+ return result;
102
+ }
103
+ }
104
+
49
105
  function calcDirt(attemptedNum, solvedNum) {
50
106
  if (solvedNum === 0) {
51
107
  return 0;
@@ -165,7 +221,6 @@ class Problem {
165
221
  constructor() {
166
222
  this.id = "";
167
223
  this.label = "";
168
- this.name = "";
169
224
  this.statistics = new ProblemStatistics();
170
225
  this.balloonColor = {
171
226
  background_color: "#a0f0a0",
@@ -177,7 +232,9 @@ function createProblem(problemJSON) {
177
232
  const p = new Problem();
178
233
  p.id = String(problemJSON.id);
179
234
  p.label = problemJSON.label;
180
- p.name = problemJSON.name ?? "";
235
+ if (problemJSON.name) {
236
+ p.name = I18nText.fromIText(problemJSON.name);
237
+ }
181
238
  p.timeLimit = problemJSON.time_limit;
182
239
  p.memoryLimit = problemJSON.memory_limit;
183
240
  if (problemJSON.balloon_color) {
@@ -192,7 +249,7 @@ function createProblems(problemsJSON) {
192
249
  function createProblemsByProblemIds(problemIds, balloonColors) {
193
250
  const problems = problemIds.map((label, index) => {
194
251
  const p = new Problem();
195
- p.id = String(index);
252
+ p.id = index.toString();
196
253
  p.label = label;
197
254
  return p;
198
255
  });
@@ -515,6 +572,49 @@ function createSubmissions(submissionsJSON, contest) {
515
572
  }
516
573
  }
517
574
 
575
+ class Person {
576
+ name;
577
+ cfID;
578
+ icpcID;
579
+ constructor(name) {
580
+ this.name = name ?? new I18nText();
581
+ }
582
+ toIPerson() {
583
+ return {
584
+ name: this.name.toI18NStringSet(),
585
+ cf_id: this.cfID,
586
+ icpc_id: this.icpcID
587
+ };
588
+ }
589
+ static fromIPerson(iPerson) {
590
+ const person = new Person();
591
+ person.name = I18nText.fromIText(iPerson.name);
592
+ person.cfID = iPerson.cf_id;
593
+ person.icpcID = iPerson.icpc_id;
594
+ return person;
595
+ }
596
+ }
597
+ function createPersons(iPersons) {
598
+ if (!iPersons) {
599
+ return [];
600
+ }
601
+ if (typeof iPersons === "string") {
602
+ for (const c of " ,\u3001|") {
603
+ if (iPersons.includes(c)) {
604
+ return iPersons.split(c).map((name) => new Person(I18nText.fromIText(name)));
605
+ }
606
+ }
607
+ return [new Person(I18nText.fromIText(iPersons))];
608
+ }
609
+ if (Array.isArray(iPersons)) {
610
+ if (iPersons.length > 0 && typeof iPersons[0] === "object" && "name" in iPersons[0]) {
611
+ return iPersons.map((iPerson) => Person.fromIPerson(iPerson));
612
+ }
613
+ return iPersons.map((name) => new Person(I18nText.fromIText(name)));
614
+ }
615
+ return [new Person(I18nText.fromIText(iPersons))];
616
+ }
617
+
518
618
  class PlaceChartPointData {
519
619
  timePoint;
520
620
  rank;
@@ -532,7 +632,7 @@ class Team {
532
632
  badge;
533
633
  group;
534
634
  tag;
535
- coach;
635
+ coaches;
536
636
  members;
537
637
  rank;
538
638
  originalRank;
@@ -552,10 +652,12 @@ class Team {
552
652
  se;
553
653
  constructor() {
554
654
  this.id = "";
555
- this.name = "";
655
+ this.name = new I18nText();
556
656
  this.organization = "";
557
657
  this.group = [];
558
658
  this.tag = [];
659
+ this.coaches = [];
660
+ this.members = [];
559
661
  this.rank = 0;
560
662
  this.originalRank = 0;
561
663
  this.organizationRank = -1;
@@ -596,26 +698,6 @@ class Team {
596
698
  get isGirl() {
597
699
  return this.group.includes("girl");
598
700
  }
599
- get membersToArray() {
600
- if (Array.isArray(this.members)) {
601
- return this.members;
602
- }
603
- if (typeof this.members === "string") {
604
- if (this.members.includes(", ")) {
605
- return this.members.split(", ");
606
- }
607
- if (this.members.includes("\u3001")) {
608
- return this.members.split("\u3001");
609
- }
610
- }
611
- return [];
612
- }
613
- get membersToString() {
614
- if (typeof this.members === "string") {
615
- return this.members;
616
- }
617
- return this.members?.join(", ");
618
- }
619
701
  get isEffectiveTeam() {
620
702
  return this.solvedProblemNum > 0;
621
703
  }
@@ -624,6 +706,12 @@ class Team {
624
706
  const solvedNum = this.solvedProblemNum;
625
707
  return calcDirt(attemptedNum, solvedNum);
626
708
  }
709
+ membersToString(lang) {
710
+ return this.members.map((member) => member.name.getOrDefault(lang)).join(", ");
711
+ }
712
+ coachesToString(lang) {
713
+ return this.coaches.map((member) => member.name.getOrDefault(lang)).join(", ");
714
+ }
627
715
  calcSE(totalTeams) {
628
716
  let acceptedProblemNums = 0;
629
717
  let total = 0;
@@ -711,13 +799,13 @@ class Team {
711
799
  function createTeam(teamJSON) {
712
800
  const t = new Team();
713
801
  t.id = teamJSON.id ?? teamJSON.team_id ?? "";
714
- t.name = teamJSON.name ?? teamJSON.team_name ?? "";
802
+ t.name = I18nText.fromIText(teamJSON.name ?? teamJSON.team_name ?? "");
715
803
  t.organization = teamJSON.organization ?? "";
716
804
  t.badge = teamJSON.badge;
717
805
  t.group = _.cloneDeep(teamJSON.group ?? []);
718
806
  t.tag = _.cloneDeep(teamJSON.tag ?? []);
719
- t.coach = teamJSON.coach;
720
- t.members = teamJSON.members;
807
+ t.coaches = createPersons(teamJSON.coach);
808
+ t.members = createPersons(teamJSON.members);
721
809
  if (Boolean(teamJSON.official) === true) {
722
810
  t.group.push("official");
723
811
  }
@@ -931,19 +1019,17 @@ function createContestOptions(contestOptionsJSON = {}) {
931
1019
  }
932
1020
 
933
1021
  class Group {
934
- names;
935
- defaultLang;
1022
+ name;
936
1023
  isDefault;
937
1024
  constructor() {
938
- this.names = /* @__PURE__ */ new Map();
939
- this.defaultLang = "zh-CN";
1025
+ this.name = new I18nText();
940
1026
  this.isDefault = false;
941
1027
  }
942
1028
  }
943
1029
 
944
1030
  class Contest {
945
1031
  id = "";
946
- name = "";
1032
+ name;
947
1033
  startTime;
948
1034
  endTime;
949
1035
  freezeTime;
@@ -960,9 +1046,9 @@ class Contest {
960
1046
  problemsMap;
961
1047
  statusTimeDisplay;
962
1048
  badge;
1049
+ organization;
963
1050
  medal;
964
1051
  awards;
965
- organization;
966
1052
  group;
967
1053
  tag;
968
1054
  logo;
@@ -971,6 +1057,7 @@ class Contest {
971
1057
  boardLink;
972
1058
  options;
973
1059
  constructor() {
1060
+ this.name = new I18nText();
974
1061
  this.startTime = createDayJS();
975
1062
  this.endTime = createDayJS();
976
1063
  this.freezeTime = createDayJS();
@@ -1085,7 +1172,7 @@ class Contest {
1085
1172
  }
1086
1173
  function createContest(contestJSON) {
1087
1174
  const c = new Contest();
1088
- c.name = contestJSON.contest_name;
1175
+ c.name = I18nText.fromIText(contestJSON.contest_name);
1089
1176
  c.startTime = createDayJS(contestJSON.start_time);
1090
1177
  c.endTime = createDayJS(contestJSON.end_time);
1091
1178
  c.totalDurationTimestamp = c.endTime.unix() - c.startTime.unix();
@@ -1121,6 +1208,7 @@ function createContest(contestJSON) {
1121
1208
  };
1122
1209
  }
1123
1210
  c.badge = contestJSON.badge;
1211
+ c.organization = contestJSON.organization;
1124
1212
  c.medal = contestJSON.medal;
1125
1213
  (() => {
1126
1214
  if (contestJSON.medal === void 0 || contestJSON.medal === null) {
@@ -1158,26 +1246,27 @@ function createContest(contestJSON) {
1158
1246
  }
1159
1247
  }
1160
1248
  })();
1161
- c.organization = contestJSON.organization;
1162
1249
  {
1163
1250
  const g = new Group();
1164
- g.names.set("en", "All");
1165
- g.names.set("zh-CN", "\u6240\u6709\u961F\u4F0D");
1251
+ g.name.fallbackLang = "zh-CN";
1252
+ g.name.set("en", "All");
1253
+ g.name.set("zh-CN", "\u6240\u6709\u961F\u4F0D");
1166
1254
  g.isDefault = true;
1167
1255
  c.group.set("all", g);
1168
1256
  }
1169
1257
  for (const [k, v] of Object.entries(contestJSON?.group ?? {})) {
1170
1258
  let key = k;
1171
1259
  const g = new Group();
1172
- g.names.set("zh-CN", v);
1260
+ g.name.fallbackLang = "zh-CN";
1261
+ g.name.set("zh-CN", v);
1173
1262
  if (k === "official") {
1174
- g.names.set("en", "Official");
1263
+ g.name.set("en", "Official");
1175
1264
  }
1176
1265
  if (k === "unofficial") {
1177
- g.names.set("en", "Unofficial");
1266
+ g.name.set("en", "Unofficial");
1178
1267
  }
1179
1268
  if (k === "girl" || k === "girls") {
1180
- g.names.set("en", "Girls");
1269
+ g.name.set("en", "Girls");
1181
1270
  key = "girl";
1182
1271
  }
1183
1272
  c.group.set(key, g);
@@ -1204,7 +1293,7 @@ class ContestIndexConfig {
1204
1293
  unFreezeDurationTimestamp;
1205
1294
  logo;
1206
1295
  constructor() {
1207
- this.contestName = "";
1296
+ this.contestName = new I18nText();
1208
1297
  this.startTime = createDayJS();
1209
1298
  this.endTime = createDayJS();
1210
1299
  this.freezeTime = createDayJS();
@@ -1269,7 +1358,7 @@ class CodeforcesGymGhostDATConverter {
1269
1358
  }
1270
1359
  convert(rank) {
1271
1360
  let res = "";
1272
- res += `@contest "${rank.contest.name}"
1361
+ res += `@contest "${rank.contest.name.getOrDefault()}"
1273
1362
  @contlen ${Math.floor(dayjs.duration(rank.contest.endTime.diff(rank.contest.startTime)).asMinutes())}
1274
1363
  @problems ${rank.contest.problems.length}
1275
1364
  @teams ${rank.teams.length + 100}
@@ -1283,12 +1372,12 @@ class CodeforcesGymGhostDATConverter {
1283
1372
  const teamIdMap = /* @__PURE__ */ new Map();
1284
1373
  const submissionsIdMap = /* @__PURE__ */ new Map();
1285
1374
  rank.teams.forEach((team) => {
1286
- let name = team.name;
1375
+ let name = team.name.getOrDefault();
1287
1376
  if (team.organization) {
1288
1377
  name = `${team.organization} - ${name}`;
1289
1378
  }
1290
1379
  if (team.members) {
1291
- name = `${name} - ${team.membersToString}`;
1380
+ name = `${name} - ${team.membersToString()}`;
1292
1381
  }
1293
1382
  res += `@t ${teamIndex},0,1,"${name}"
1294
1383
  `;
@@ -1369,7 +1458,7 @@ class GeneralExcelConverter {
1369
1458
  rank.options.setGroup(k);
1370
1459
  rank.buildRank();
1371
1460
  const sheet = this.convertToSheet(rank);
1372
- XLSX.utils.book_append_sheet(workbook, sheet, v.names.get(v.defaultLang));
1461
+ XLSX.utils.book_append_sheet(workbook, sheet, v.name.getOrDefault());
1373
1462
  }
1374
1463
  return workbook;
1375
1464
  }
@@ -1456,10 +1545,10 @@ class GeneralExcelConverter {
1456
1545
  const aoa = [];
1457
1546
  const specialCells = [];
1458
1547
  const enableAwards = rank.contest.isEnableAwards(rank.options.group);
1459
- const enableMembers = (Array.isArray(rank.teams) && rank.teams[0]?.members) ?? false;
1460
- const enableCoach = rank.teams[0]?.coach ?? false;
1548
+ const enableMembers = rank.teams[0]?.members.length > 0;
1549
+ const enableCoach = rank.teams[0]?.coaches.length > 0;
1461
1550
  {
1462
- aoa.push([rank.contest.name]);
1551
+ aoa.push([rank.contest.name.getOrDefault()]);
1463
1552
  }
1464
1553
  {
1465
1554
  const head = [];
@@ -1476,7 +1565,7 @@ class GeneralExcelConverter {
1476
1565
  head.push("Member1", "Member2", "Member3");
1477
1566
  }
1478
1567
  if (enableCoach) {
1479
- head.push("Coach");
1568
+ head.push("Coaches");
1480
1569
  }
1481
1570
  head.push("Unofficial");
1482
1571
  head.push("Girl");
@@ -1493,7 +1582,7 @@ class GeneralExcelConverter {
1493
1582
  }
1494
1583
  arr.push(team.organization);
1495
1584
  }
1496
- arr.push(team.name, team.solvedProblemNum.toString(), team.penaltyToMinute.toString());
1585
+ arr.push(team.name.getOrDefault(), team.solvedProblemNum.toString(), team.penaltyToMinute.toString());
1497
1586
  for (const p of team.problemStatistics) {
1498
1587
  if (p.isUnSubmitted) {
1499
1588
  arr.push("-");
@@ -1523,19 +1612,15 @@ class GeneralExcelConverter {
1523
1612
  if (enableMembers) {
1524
1613
  const members = team.members;
1525
1614
  if (Array.isArray(members)) {
1526
- arr.push(members[0] ?? "");
1527
- arr.push(members[1] ?? "");
1528
- arr.push(members[2] ?? "");
1615
+ arr.push(members[0]?.name.getOrDefault() ?? "");
1616
+ arr.push(members[1]?.name.getOrDefault() ?? "");
1617
+ arr.push(members[2]?.name.getOrDefault() ?? "");
1529
1618
  } else {
1530
1619
  arr.push("", "", "");
1531
1620
  }
1532
1621
  }
1533
1622
  if (enableCoach) {
1534
- if (typeof team.coach === "string") {
1535
- arr.push(team.coach ?? "");
1536
- } else {
1537
- arr.push("");
1538
- }
1623
+ arr.push(team.coachesToString());
1539
1624
  }
1540
1625
  arr.push(team.isUnofficial ? "Y" : "N");
1541
1626
  arr.push(team.isGirl ? "Y" : "N");
@@ -1563,9 +1648,9 @@ class ICPCStandingsCsvConverter {
1563
1648
  problemsSolved: team.solvedProblemNum,
1564
1649
  totalTime: team.penaltyToMinute,
1565
1650
  lastProblemTime: team.lastSolvedProblemStatistics?.solvedTimestampToMinute ?? 0,
1566
- siteCitation: rank.contest.name,
1651
+ siteCitation: rank.contest.name.getOrDefault(),
1567
1652
  citation: ordinal(team.rank),
1568
- teamName: team.name,
1653
+ teamName: team.name.getOrDefault(),
1569
1654
  institution: team.organization
1570
1655
  };
1571
1656
  resList.push(res);
@@ -1613,37 +1698,6 @@ function getImageSource(image, asset_host) {
1613
1698
  return "";
1614
1699
  }
1615
1700
 
1616
- class Person {
1617
- name;
1618
- constructor(name = "") {
1619
- this.name = name;
1620
- }
1621
- toJSON() {
1622
- return {
1623
- name: this.name
1624
- };
1625
- }
1626
- static fromJSON(iPerson) {
1627
- if (typeof iPerson === "string") {
1628
- iPerson = JSON.parse(iPerson);
1629
- }
1630
- const person = new Person();
1631
- person.name = iPerson.name;
1632
- return person;
1633
- }
1634
- }
1635
- function createPersons(iPersons) {
1636
- if (typeof iPersons === "string") {
1637
- for (const c of " ,\u3001|") {
1638
- if (iPersons.includes(c)) {
1639
- return iPersons.split(c).map((name) => new Person(name));
1640
- }
1641
- }
1642
- return [new Person(iPersons)];
1643
- }
1644
- return iPersons.map((name) => new Person(name));
1645
- }
1646
-
1647
1701
  class RankStatistics {
1648
1702
  teamSolvedNum;
1649
1703
  teamSolvedNumIndex;
@@ -2137,12 +2191,12 @@ class RatingHistory {
2137
2191
  constructor() {
2138
2192
  this.rank = 0;
2139
2193
  this.rating = 0;
2140
- this.teamName = "";
2194
+ this.teamName = new I18nText();
2141
2195
  this.organization = "";
2142
2196
  this.members = [];
2143
2197
  this.coaches = [];
2144
2198
  this.contestID = "";
2145
- this.contestName = "";
2199
+ this.contestName = new I18nText();
2146
2200
  this.contestLink = "";
2147
2201
  this.contestTime = createDayJS();
2148
2202
  }
@@ -2150,12 +2204,12 @@ class RatingHistory {
2150
2204
  return {
2151
2205
  rank: this.rank,
2152
2206
  rating: this.rating,
2153
- teamName: this.teamName,
2207
+ teamName: this.teamName.toI18NStringSet(),
2154
2208
  organization: this.organization,
2155
- members: this.members.map((member) => member.toJSON()),
2156
- coaches: this.coaches.map((coach) => coach.toJSON()),
2209
+ members: this.members.map((member) => member.toIPerson()),
2210
+ coaches: this.coaches.map((coach) => coach.toIPerson()),
2157
2211
  contestID: this.contestID,
2158
- contestName: this.contestName,
2212
+ contestName: this.contestName.toI18NStringSet(),
2159
2213
  contestLink: this.contestLink,
2160
2214
  contestTime: this.contestTime.toDate()
2161
2215
  };
@@ -2167,12 +2221,12 @@ class RatingHistory {
2167
2221
  const ratingHistory = new RatingHistory();
2168
2222
  ratingHistory.rank = iRatingHistory.rank;
2169
2223
  ratingHistory.rating = iRatingHistory.rating;
2170
- ratingHistory.teamName = iRatingHistory.teamName;
2224
+ ratingHistory.teamName = I18nText.fromIText(iRatingHistory.teamName);
2171
2225
  ratingHistory.organization = iRatingHistory.organization;
2172
- ratingHistory.members = iRatingHistory.members.map((iMember) => Person.fromJSON(iMember));
2173
- ratingHistory.coaches = iRatingHistory.coaches.map((iCoach) => Person.fromJSON(iCoach));
2226
+ ratingHistory.members = createPersons(iRatingHistory.members);
2227
+ ratingHistory.coaches = createPersons(iRatingHistory.coaches);
2174
2228
  ratingHistory.contestID = iRatingHistory.contestID;
2175
- ratingHistory.contestName = iRatingHistory.contestName;
2229
+ ratingHistory.contestName = I18nText.fromIText(iRatingHistory.contestName);
2176
2230
  ratingHistory.contestLink = iRatingHistory.contestLink;
2177
2231
  ratingHistory.contestTime = createDayJS(iRatingHistory.contestTime);
2178
2232
  return ratingHistory;
@@ -2195,7 +2249,7 @@ class RatingUser {
2195
2249
  ratingHistories;
2196
2250
  constructor() {
2197
2251
  this.id = "";
2198
- this.name = "";
2252
+ this.name = new I18nText();
2199
2253
  this.organization = "";
2200
2254
  this.members = [];
2201
2255
  this.coaches = [];
@@ -2216,10 +2270,10 @@ class RatingUser {
2216
2270
  toJSON() {
2217
2271
  return {
2218
2272
  id: this.id,
2219
- name: this.name,
2273
+ name: this.name.toI18NStringSet(),
2220
2274
  organization: this.organization,
2221
- members: this.members.map((member) => member.toJSON()),
2222
- coaches: this.coaches.map((coach) => coach.toJSON()),
2275
+ members: this.members.map((member) => member.toIPerson()),
2276
+ coaches: this.coaches.map((coach) => coach.toIPerson()),
2223
2277
  rating: this.rating,
2224
2278
  minRating: this.minRating,
2225
2279
  maxRating: this.maxRating,
@@ -2232,10 +2286,10 @@ class RatingUser {
2232
2286
  }
2233
2287
  const ratingUser = new RatingUser();
2234
2288
  ratingUser.id = iRatingUser.id;
2235
- ratingUser.name = iRatingUser.name;
2289
+ ratingUser.name = I18nText.fromIText(iRatingUser.name);
2236
2290
  ratingUser.organization = iRatingUser.organization;
2237
- ratingUser.members = iRatingUser.members.map((member) => Person.fromJSON(member));
2238
- ratingUser.coaches = iRatingUser.coaches.map((coach) => Person.fromJSON(coach));
2291
+ ratingUser.members = iRatingUser.members.map((member) => Person.fromIPerson(member));
2292
+ ratingUser.coaches = iRatingUser.coaches.map((coach) => Person.fromIPerson(coach));
2239
2293
  ratingUser.rating = iRatingUser.rating;
2240
2294
  ratingUser.minRating = iRatingUser.minRating;
2241
2295
  ratingUser.maxRating = iRatingUser.maxRating;
@@ -2330,7 +2384,7 @@ class Rating {
2330
2384
  userMap;
2331
2385
  constructor() {
2332
2386
  this.id = "";
2333
- this.name = "";
2387
+ this.name = new I18nText();
2334
2388
  this.baseRating = 1500;
2335
2389
  this.contestIDs = [];
2336
2390
  this.users = [];
@@ -2349,8 +2403,8 @@ class Rating {
2349
2403
  u.id = id;
2350
2404
  u.name = t.name;
2351
2405
  u.organization = t.organization;
2352
- u.members = createPersons(t.members ?? []);
2353
- u.coaches = createPersons(t.coach ?? []);
2406
+ u.members = t.members;
2407
+ u.coaches = t.coaches;
2354
2408
  u.rank = t.rank;
2355
2409
  u.oldRating = this.baseRating;
2356
2410
  u.UpdateRating(this.baseRating);
@@ -2369,8 +2423,8 @@ class Rating {
2369
2423
  h.rating = u.rating;
2370
2424
  h.teamName = t.name;
2371
2425
  h.organization = t.organization;
2372
- h.members = createPersons(t.members ?? []);
2373
- h.coaches = createPersons(t.coach ?? []);
2426
+ h.members = t.members;
2427
+ h.coaches = t.coaches;
2374
2428
  h.contestID = rank.contest.id;
2375
2429
  h.contestLink = h.contestID;
2376
2430
  h.contestName = rank.contest.name;
@@ -2385,16 +2439,16 @@ class Rating {
2385
2439
  }
2386
2440
  }
2387
2441
  generateTeamId(t) {
2388
- const persons = createPersons(t.members ?? []);
2442
+ const persons = t.members;
2389
2443
  if (persons.length > 0) {
2390
- return persons.map((person) => person.name.trim()).sort().join("|");
2444
+ return persons.map((person) => person.name.getOrDefault().trim()).sort().join("|");
2391
2445
  }
2392
2446
  return `${t.organization}-${t.name}`;
2393
2447
  }
2394
2448
  toJSON() {
2395
2449
  return {
2396
2450
  id: this.id,
2397
- name: this.name,
2451
+ name: this.name.toI18NStringSet(),
2398
2452
  baseRating: this.baseRating,
2399
2453
  contestIDs: this.contestIDs,
2400
2454
  users: this.users.map((ratingUser) => ratingUser.toJSON())
@@ -2406,7 +2460,7 @@ class Rating {
2406
2460
  }
2407
2461
  const rating = new Rating();
2408
2462
  rating.id = iRating.id;
2409
- rating.name = iRating.name;
2463
+ rating.name = I18nText.fromIText(iRating.name);
2410
2464
  rating.baseRating = iRating.baseRating;
2411
2465
  rating.contestIDs = iRating.contestIDs;
2412
2466
  for (const iUser of iRating.users) {
@@ -2737,4 +2791,4 @@ class ResolverVue extends Resolver {
2737
2791
  }
2738
2792
  }
2739
2793
 
2740
- export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, ICPCStandingsCsvConverter, MedalType, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
2794
+ export { Award, Balloon, BattleOfGiants, CodeforcesGymGhostDATConverter, Contest, ContestIndex, ContestIndexConfig, ContestOptions, GeneralExcelConverter, Giants, GiantsType, I18nText, ICPCStandingsCsvConverter, MedalType, Person, PlaceChartPointData, Problem, ProblemStatistics, Rank, RankOptions, RankStatistics, Rating, RatingCalculator, RatingHistory, RatingLevel, RatingLevelToString, RatingUser, RatingUtility, Resolver, ResolverVue, Submission, Team, TeamProblemStatistics, calcDirt, createContest, createContestIndex, createContestIndexList, createDayJS, createPersons, createProblem, createProblems, createProblemsByProblemIds, createSubmission, createSubmissions, createTeam, createTeams, getImageSource, getTimeDiff, getTimestamp, getWhiteOrBlackColor, getWhiteOrBlackColorV1, isAccepted, isNotCalculatedPenaltyStatus, isPending, isRejected, isValidMedalType, stringToSubmissionStatus };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xcpcio/core",
3
3
  "type": "module",
4
- "version": "0.64.3",
4
+ "version": "0.65.0",
5
5
  "description": "The core library for XCPCIO",
6
6
  "author": "Dup4 <hi@dup4.com>",
7
7
  "license": "MIT",
@@ -42,7 +42,7 @@
42
42
  "papaparse": "^5.5.3",
43
43
  "string-width": "^8.1.0",
44
44
  "xlsx-js-style": "^1.2.0",
45
- "@xcpcio/types": "0.64.3"
45
+ "@xcpcio/types": "0.65.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@babel/types": "^7.28.4",