@juki-team/commons 0.1.40 → 0.1.41
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/cjs/index.cjs +1522 -1522
- package/dist/esm/index.js +1522 -1522
- package/package.json +19 -12
package/dist/esm/index.js
CHANGED
|
@@ -1378,21 +1378,6 @@ const COURSE_ROLE = {
|
|
|
1378
1378
|
[CourseRole.SUPER_ADMIN]: { value: CourseRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
1379
1379
|
};
|
|
1380
1380
|
|
|
1381
|
-
const isWorksheetAssignment = (assignment) => {
|
|
1382
|
-
return assignment.type === AssignmentClass.WORKSHEET;
|
|
1383
|
-
};
|
|
1384
|
-
const isCourseAssignment = (assignment) => {
|
|
1385
|
-
return assignment.type === AssignmentClass.COURSE;
|
|
1386
|
-
};
|
|
1387
|
-
const isContestAssignment = (assignment) => {
|
|
1388
|
-
return assignment.type === AssignmentClass.CONTEST;
|
|
1389
|
-
};
|
|
1390
|
-
|
|
1391
|
-
const getAssignmentCommentKey = (classKey, cycleKey, sessionKey, assignmentKey) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}`;
|
|
1392
|
-
const getAssignmentUserCommentKey = (classKey, cycleKey, sessionKey, assignmentKey, userNickname, userCompany) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}|user_nickname:${userNickname}|user_company:${userCompany}`;
|
|
1393
|
-
const getProblemCommentKey = (problemKey) => `problem:${problemKey}`;
|
|
1394
|
-
const getContestCommentKey = (contestKey) => `contest:${contestKey}`;
|
|
1395
|
-
|
|
1396
1381
|
function isStringJson(str) {
|
|
1397
1382
|
try {
|
|
1398
1383
|
if (typeof str === 'string') {
|
|
@@ -1580,484 +1565,384 @@ const areArraysDifferent = (a, b) => {
|
|
|
1580
1565
|
return false;
|
|
1581
1566
|
};
|
|
1582
1567
|
|
|
1583
|
-
const
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
const
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
const
|
|
1605
|
-
switch (true) {
|
|
1606
|
-
case (document?.members?.rankAdministrators === EntityMembersRank.NONE || document?.members?.rankAdministrators === EntityMembersRank.CLOSE)
|
|
1607
|
-
&& document?.members?.rankManagers === EntityMembersRank.OPEN
|
|
1608
|
-
&& (document?.members?.rankGuests === EntityMembersRank.NONE || document?.members?.rankGuests === EntityMembersRank.CLOSE || document?.members?.rankGuests === EntityMembersRank.OPEN)
|
|
1609
|
-
&& document?.members?.rankSpectators === EntityMembersRank.OPEN
|
|
1610
|
-
&& (document?.members?.rankParticipants === EntityMembersRank.NONE || document?.members?.rankParticipants === EntityMembersRank.CLOSE || document?.members?.rankParticipants === EntityMembersRank.OPEN):
|
|
1611
|
-
return EntityAccess.EXPOSED;
|
|
1612
|
-
case (document?.members?.rankAdministrators === EntityMembersRank.NONE || document?.members?.rankAdministrators === EntityMembersRank.CLOSE)
|
|
1613
|
-
&& document?.members?.rankManagers === EntityMembersRank.CLOSE
|
|
1614
|
-
&& (document?.members?.rankGuests === EntityMembersRank.NONE || document?.members?.rankGuests === EntityMembersRank.CLOSE || document?.members?.rankGuests === EntityMembersRank.OPEN)
|
|
1615
|
-
&& document?.members?.rankSpectators === EntityMembersRank.OPEN
|
|
1616
|
-
&& (document?.members?.rankParticipants === EntityMembersRank.NONE || document?.members?.rankParticipants === EntityMembersRank.CLOSE || document?.members?.rankParticipants === EntityMembersRank.OPEN):
|
|
1617
|
-
return EntityAccess.PUBLIC;
|
|
1618
|
-
case (document?.members?.rankAdministrators === EntityMembersRank.NONE || document?.members?.rankAdministrators === EntityMembersRank.CLOSE)
|
|
1619
|
-
&& document?.members?.rankManagers === EntityMembersRank.CLOSE
|
|
1620
|
-
&& (document?.members?.rankGuests === EntityMembersRank.NONE || document?.members?.rankGuests === EntityMembersRank.CLOSE || document?.members?.rankGuests === EntityMembersRank.OPEN)
|
|
1621
|
-
&& document?.members?.rankSpectators === EntityMembersRank.CLOSE
|
|
1622
|
-
&& (document?.members?.rankParticipants === EntityMembersRank.NONE || document?.members?.rankParticipants === EntityMembersRank.CLOSE || document?.members?.rankParticipants === EntityMembersRank.OPEN):
|
|
1623
|
-
return EntityAccess.RESTRICTED;
|
|
1624
|
-
case document?.members?.rankAdministrators === EntityMembersRank.NONE
|
|
1625
|
-
&& document?.members?.rankManagers === EntityMembersRank.NONE
|
|
1626
|
-
&& document?.members?.rankGuests === EntityMembersRank.NONE
|
|
1627
|
-
&& document?.members?.rankSpectators === EntityMembersRank.NONE
|
|
1628
|
-
&& document?.members?.rankParticipants === EntityMembersRank.NONE:
|
|
1629
|
-
return EntityAccess.PRIVATE;
|
|
1630
|
-
default:
|
|
1631
|
-
return EntityAccess.PRIVATE;
|
|
1632
|
-
}
|
|
1633
|
-
};
|
|
1634
|
-
const isUserMember = (member) => {
|
|
1635
|
-
return typeof member.userId === 'string';
|
|
1636
|
-
};
|
|
1637
|
-
const isTeamMember = (member) => {
|
|
1638
|
-
return typeof member.teamId === 'string';
|
|
1639
|
-
};
|
|
1640
|
-
const toEntityMembersDTO = (members) => {
|
|
1641
|
-
return {
|
|
1642
|
-
rankAdministrators: members.rankAdministrators,
|
|
1643
|
-
administrators: Object.keys(members.administrators),
|
|
1644
|
-
rankManagers: members.rankManagers,
|
|
1645
|
-
managers: Object.keys(members.managers),
|
|
1646
|
-
rankParticipants: members.rankParticipants,
|
|
1647
|
-
participants: Object.keys(members.participants),
|
|
1648
|
-
rankGuests: members.rankGuests,
|
|
1649
|
-
guests: Object.keys(members.guests),
|
|
1650
|
-
rankSpectators: members.rankSpectators,
|
|
1651
|
-
spectators: Object.keys(members.spectators),
|
|
1652
|
-
};
|
|
1653
|
-
};
|
|
1568
|
+
const YEARS = range(1970, 2100);
|
|
1569
|
+
const MONTH_NAMES = [
|
|
1570
|
+
'January',
|
|
1571
|
+
'February',
|
|
1572
|
+
'March',
|
|
1573
|
+
'April',
|
|
1574
|
+
'May',
|
|
1575
|
+
'June',
|
|
1576
|
+
'July',
|
|
1577
|
+
'August',
|
|
1578
|
+
'September',
|
|
1579
|
+
'October',
|
|
1580
|
+
'November',
|
|
1581
|
+
'December',
|
|
1582
|
+
];
|
|
1583
|
+
const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
1584
|
+
const HOURS = range(0, 24);
|
|
1585
|
+
const MINUTES = range(0, 60);
|
|
1586
|
+
const SECONDS = range(0, 60);
|
|
1587
|
+
const MILLISECONDS = range(0, 1000);
|
|
1588
|
+
const MAX_DATE = new Date(8640000000000000);
|
|
1589
|
+
const MIN_DATE = new Date(0);
|
|
1654
1590
|
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1591
|
+
const SUPPORT_EMAIL = 'support@juki.app';
|
|
1592
|
+
const JUKI_APP_EMAIL_TEMPLATE = `<div style="width: 100%; background: #F2F2F2;">
|
|
1593
|
+
<div style="background: #164066; width: 100%;">
|
|
1594
|
+
<div style="height: 56px; color: white; width: 100px; margin: 0 auto">
|
|
1595
|
+
<img
|
|
1596
|
+
src="https://images.juki.pub/assets/juki-app-horizontal-white-logo.svg"
|
|
1597
|
+
alt="juki app logo"
|
|
1598
|
+
height="56px"
|
|
1599
|
+
style="padding:10px; box-sizing: border-box"
|
|
1600
|
+
/>
|
|
1601
|
+
</div>
|
|
1602
|
+
</div>
|
|
1603
|
+
<div style="padding: 24px; color: #333333; font-family: sans-serif; font-size: 16px; line-height: 24px;">
|
|
1604
|
+
<div style="max-width: 520px; margin: 0 auto; padding: 24px; background: white; border-radius: 6px;">
|
|
1605
|
+
<section style="padding: 0 0 1em 0; border-bottom: 1px solid #828282;">
|
|
1606
|
+
{{content}}
|
|
1607
|
+
</section>
|
|
1608
|
+
<div style="font-size: 14px; text-align: center; color: #828282; line-height: 16px; padding-top: 1em">
|
|
1609
|
+
<p style="margin: 0;">
|
|
1610
|
+
Si tú no realizaste la solicitud, escribenos a
|
|
1611
|
+
<a href="mailto:${SUPPORT_EMAIL}" style="color: #2468A6; text-decoration: none;">
|
|
1612
|
+
${SUPPORT_EMAIL}
|
|
1613
|
+
</a>
|
|
1614
|
+
</p>
|
|
1615
|
+
<p style="margin: 0;">
|
|
1616
|
+
Este mensaje fue enviado por el equipo de
|
|
1617
|
+
<a href="https://juki.app" style="color: #2468A6; text-decoration: none;">
|
|
1618
|
+
juki.app
|
|
1619
|
+
</a>
|
|
1620
|
+
</p>
|
|
1621
|
+
</div>
|
|
1622
|
+
</div>
|
|
1623
|
+
</div>
|
|
1624
|
+
</div>`;
|
|
1659
1625
|
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
}
|
|
1678
|
-
};
|
|
1679
|
-
const clearAsyncInterval = (intervalIndex) => {
|
|
1680
|
-
if (asyncIntervals[intervalIndex]) {
|
|
1681
|
-
asyncIntervals[intervalIndex] = false;
|
|
1682
|
-
}
|
|
1683
|
-
};
|
|
1626
|
+
const EMPTY_DOCUMENT_MEMBERS = () => ({
|
|
1627
|
+
access: EntityAccess.PRIVATE,
|
|
1628
|
+
managers: {},
|
|
1629
|
+
spectators: {},
|
|
1630
|
+
});
|
|
1631
|
+
const EMPTY_ENTITY_MEMBERS = () => ({
|
|
1632
|
+
rankAdministrators: EntityMembersRank.CLOSE,
|
|
1633
|
+
administrators: {},
|
|
1634
|
+
rankManagers: EntityMembersRank.CLOSE,
|
|
1635
|
+
managers: {},
|
|
1636
|
+
rankGuests: EntityMembersRank.CLOSE,
|
|
1637
|
+
guests: {},
|
|
1638
|
+
rankSpectators: EntityMembersRank.CLOSE,
|
|
1639
|
+
spectators: {},
|
|
1640
|
+
rankParticipants: EntityMembersRank.CLOSE,
|
|
1641
|
+
participants: {},
|
|
1642
|
+
});
|
|
1684
1643
|
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
}
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1644
|
+
const JUDGE = {
|
|
1645
|
+
// [Judge.CUSTOMER]: {
|
|
1646
|
+
// value: Judge.CUSTOMER,
|
|
1647
|
+
// label: '',
|
|
1648
|
+
// logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
1649
|
+
// logoSize: [ 883.991, 435 ],
|
|
1650
|
+
// url: '',
|
|
1651
|
+
// // getLoginUrl: () => '',
|
|
1652
|
+
// // getProfileUrl: () => '',
|
|
1653
|
+
// // getSubmitUrl: () => '',
|
|
1654
|
+
// // getSubmissionUrl: () => '',
|
|
1655
|
+
// // getProblemUrl: (key: string) => `/problem/view/${key}`,
|
|
1656
|
+
// // getUserSubmissionsUrl: () => '',
|
|
1657
|
+
// },
|
|
1658
|
+
[Judge.JUKI_JUDGE]: {
|
|
1659
|
+
value: Judge.JUKI_JUDGE,
|
|
1660
|
+
label: 'Juki Judge',
|
|
1661
|
+
logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
1662
|
+
logoSize: [883.991, 435],
|
|
1663
|
+
url: 'https://judge.juki.app',
|
|
1664
|
+
// getLoginUrl: () => '',
|
|
1665
|
+
// getProfileUrl: () => '',
|
|
1666
|
+
// getSubmitUrl: () => '',
|
|
1667
|
+
// getSubmissionUrl: () => '',
|
|
1668
|
+
// getProblemUrl: (key: string) => `https://judge.juki.app/problem/view/${key}`,
|
|
1669
|
+
// getUserSubmissionsUrl: () => '',
|
|
1670
|
+
},
|
|
1671
|
+
[Judge.CODEFORCES]: {
|
|
1672
|
+
value: Judge.CODEFORCES,
|
|
1673
|
+
label: 'Codeforces',
|
|
1674
|
+
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
1675
|
+
logoSize: [1232.75, 145.12],
|
|
1676
|
+
url: 'https://codeforces.com',
|
|
1677
|
+
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
1678
|
+
// getProfileUrl: () => '',
|
|
1679
|
+
// getSubmitUrl: () => 'https://codeforces.com/problemset/submit',
|
|
1680
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
1681
|
+
// const [ contestId ] = problemKey.split('-');
|
|
1682
|
+
// return `https://codeforces.com/problemset/submission/${contestId}/${submissionId}`;
|
|
1683
|
+
// },
|
|
1684
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1685
|
+
// const [ contestId, index ] = problemKey.split('-');
|
|
1686
|
+
// return `https://codeforces.com/problemset/problem/${contestId}/${index}`;
|
|
1687
|
+
// },
|
|
1688
|
+
// getUserSubmissionsUrl: () => '',
|
|
1689
|
+
},
|
|
1690
|
+
[Judge.CODEFORCES_GYM]: {
|
|
1691
|
+
value: Judge.CODEFORCES_GYM,
|
|
1692
|
+
label: 'Codeforces Gym',
|
|
1693
|
+
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
1694
|
+
logoSize: [1232.75, 145.12],
|
|
1695
|
+
url: 'https://codeforces.com',
|
|
1696
|
+
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
1697
|
+
// getProfileUrl: () => '',
|
|
1698
|
+
// getSubmitUrl: (problemKey: string) => {
|
|
1699
|
+
// const [ gymContestId, index ] = problemKey.split('-');
|
|
1700
|
+
// return `https://codeforces.com/gym/${gymContestId}/submit`;
|
|
1701
|
+
// },
|
|
1702
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
1703
|
+
// const [ gymContestId ] = problemKey.split('-');
|
|
1704
|
+
// return `https://codeforces.com/gym/${gymContestId}/submission/${submissionId}`;
|
|
1705
|
+
// },
|
|
1706
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1707
|
+
// const [ gymContestId, index ] = problemKey.split('-');
|
|
1708
|
+
// return `https://codeforces.com/gym/${gymContestId}/problem/${index}`;
|
|
1709
|
+
// },
|
|
1710
|
+
// getUserSubmissionsUrl: () => '',
|
|
1711
|
+
},
|
|
1712
|
+
[Judge.JV_UMSA]: {
|
|
1713
|
+
value: Judge.JV_UMSA,
|
|
1714
|
+
label: 'Juez Virtual UMSA',
|
|
1715
|
+
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
1716
|
+
logoSize: [1232.75, 145.12],
|
|
1717
|
+
url: 'https://jv.umsa.bo',
|
|
1718
|
+
// getLoginUrl: () => 'https://jv.umsa.bo/oj/login.php',
|
|
1719
|
+
// getProfileUrl: () => 'https://jv.umsa.bo/oj/userInfo.php',
|
|
1720
|
+
// getSubmitUrl: (problemKey: string) => {
|
|
1721
|
+
// // single problem: '1019'
|
|
1722
|
+
// // cib problem: '1019-A'
|
|
1723
|
+
// const isContestProblem = problemKey.includes('-');
|
|
1724
|
+
// // A -> 0, B -> 1, C -> 2, D -> 3, E -> 4, F -> 5, G -> 6, H -> 7, I -> 8, J -> 9
|
|
1725
|
+
// const params = problemKey.split('-');
|
|
1726
|
+
// return isContestProblem
|
|
1727
|
+
// ? `https://jv.umsa.bo/oj/submitpage.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
1728
|
+
// : `https://jv.umsa.bo/oj/submitpage.php?id=${problemKey}`;
|
|
1729
|
+
// },
|
|
1730
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string) => {
|
|
1731
|
+
// // return `https://jv.umsa.bo/status.php?problem_id=&user_id=${username}&language=-1&jresult=-1`;
|
|
1732
|
+
// return `https://jv.umsa.bo/oj/showsource.php?id=${submissionId}`;
|
|
1733
|
+
// },
|
|
1734
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1735
|
+
// const isContestProblem = problemKey.includes('-');
|
|
1736
|
+
// const params = problemKey.split('-');
|
|
1737
|
+
// return isContestProblem
|
|
1738
|
+
// ? `https://jv.umsa.bo/oj/problem.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
1739
|
+
// : `https://jv.umsa.bo/oj/problem.php?id=${problemKey}`;
|
|
1740
|
+
// },
|
|
1741
|
+
// getUserSubmissionsUrl: (username: string) => `https://jv.umsa.bo/oj/status.php?user_id=${username}`,
|
|
1742
|
+
},
|
|
1743
|
+
[Judge.UVA_ONLINE_JUDGE]: {
|
|
1744
|
+
value: Judge.UVA_ONLINE_JUDGE,
|
|
1745
|
+
label: 'Uva Online Judge',
|
|
1746
|
+
logo: 'https://images.juki.pub/c/uva-online-judge-logo-color.png',
|
|
1747
|
+
logoSize: [150, 135.994],
|
|
1748
|
+
url: 'https://onlinejudge.org',
|
|
1749
|
+
},
|
|
1750
|
+
[Judge.AT_CODER]: {
|
|
1751
|
+
value: Judge.AT_CODER,
|
|
1752
|
+
label: 'AtCoder',
|
|
1753
|
+
logo: 'https://images.juki.pub/c/at-coder-logo-color.png',
|
|
1754
|
+
logoSize: [762.997, 675],
|
|
1755
|
+
url: 'https://atcoder.jp',
|
|
1756
|
+
},
|
|
1757
|
+
[Judge.CODECHEF]: {
|
|
1758
|
+
value: Judge.CODECHEF,
|
|
1759
|
+
label: 'Codechef',
|
|
1760
|
+
logo: 'https://images.juki.pub/c/codechef-logo-color.svg',
|
|
1761
|
+
logoSize: [1207.7, 453.17],
|
|
1762
|
+
url: 'https://www.codechef.com',
|
|
1763
|
+
},
|
|
1764
|
+
[Judge.TOPCODER]: {
|
|
1765
|
+
value: Judge.TOPCODER,
|
|
1766
|
+
label: 'Topcoder',
|
|
1767
|
+
logo: 'https://images.juki.pub/c/topcoder-logo-color.png',
|
|
1768
|
+
logoSize: [971.99, 415.99],
|
|
1769
|
+
url: 'https://www.topcoder.com',
|
|
1770
|
+
},
|
|
1771
|
+
[Judge.LEETCODE]: {
|
|
1772
|
+
value: Judge.LEETCODE,
|
|
1773
|
+
label: 'LeetCode',
|
|
1774
|
+
logo: 'https://images.juki.pub/assets/leetcode-logo-color.svg',
|
|
1775
|
+
logoSize: [95, 111],
|
|
1776
|
+
url: 'https://leetcode.com',
|
|
1777
|
+
// getProblemUrl: (problemKey: string) => {
|
|
1778
|
+
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}`;
|
|
1779
|
+
// },
|
|
1780
|
+
// getProfileUrl: (userNickname: string) => {
|
|
1781
|
+
// return `https://leetcode.com/u/${userNickname}`;
|
|
1782
|
+
// },
|
|
1783
|
+
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string, submissionRunId: string) => {
|
|
1784
|
+
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}/submissions/${submissionRunId}`;
|
|
1785
|
+
// },
|
|
1786
|
+
},
|
|
1774
1787
|
};
|
|
1775
|
-
const
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
}
|
|
1788
|
+
const RUNNER_ACCEPTED_PROBLEM_MODES = [
|
|
1789
|
+
ProblemScoringMode.TOTAL,
|
|
1790
|
+
ProblemScoringMode.SUBTASK,
|
|
1791
|
+
ProblemScoringMode.PARTIAL,
|
|
1792
|
+
];
|
|
1793
|
+
const RUNNER_ACCEPTED_PROBLEM_TYPES = [
|
|
1794
|
+
ProblemType.STANDARD,
|
|
1795
|
+
ProblemType.DYNAMIC,
|
|
1796
|
+
];
|
|
1797
|
+
const RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES = [
|
|
1798
|
+
CodeLanguage.C_11,
|
|
1799
|
+
CodeLanguage.CPP_11,
|
|
1800
|
+
CodeLanguage.CPP_20,
|
|
1801
|
+
CodeLanguage.JAVA_21,
|
|
1802
|
+
CodeLanguage.PYTHON_3,
|
|
1803
|
+
CodeLanguage.PYTHON_PYPY_3,
|
|
1804
|
+
CodeLanguage.JAVASCRIPT_NODE_JS_22,
|
|
1805
|
+
CodeLanguage.PSEUDOCODE_PSEINT,
|
|
1806
|
+
];
|
|
1807
|
+
const ACCEPTED_PROGRAMMING_LANGUAGES = [
|
|
1808
|
+
...RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES,
|
|
1809
|
+
];
|
|
1810
|
+
const PROBLEM_VERDICT = {
|
|
1811
|
+
[ProblemVerdict.NONE]: { value: ProblemVerdict.NONE, label: 'none', color: '#555555' },
|
|
1812
|
+
[ProblemVerdict.PENDING]: { value: ProblemVerdict.PENDING, label: 'pending', color: '#79B6FD' },
|
|
1813
|
+
[ProblemVerdict.HIDDEN]: { value: ProblemVerdict.HIDDEN, label: 'hidden', color: '#555555' },
|
|
1814
|
+
[ProblemVerdict.AC]: { value: ProblemVerdict.AC, label: 'accepted', color: '#43D787' },
|
|
1815
|
+
[ProblemVerdict.PE]: { value: ProblemVerdict.PE, label: 'presentation error', color: '#55db93' },
|
|
1816
|
+
[ProblemVerdict.PA]: { value: ProblemVerdict.PA, label: 'partial accepted', color: '#55db93' },
|
|
1817
|
+
[ProblemVerdict.CE]: { value: ProblemVerdict.CE, label: 'compilation error', color: '#FE9F9F' },
|
|
1818
|
+
[ProblemVerdict.RE]: { value: ProblemVerdict.RE, label: 'runtime error', color: '#FE9F9F' },
|
|
1819
|
+
[ProblemVerdict.TLE]: { value: ProblemVerdict.TLE, label: 'time limit exceed', color: '#FE9F9F' },
|
|
1820
|
+
[ProblemVerdict.MLE]: { value: ProblemVerdict.MLE, label: 'memory limit exceed', color: '#FE9F9F' },
|
|
1821
|
+
[ProblemVerdict.WA]: { value: ProblemVerdict.WA, label: 'wrong answer', color: '#FE9F9F' },
|
|
1807
1822
|
};
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
};
|
|
1849
|
-
Date.prototype.changeMonth = function (monthIndex) {
|
|
1850
|
-
const newDate = new Date(this);
|
|
1851
|
-
newDate.setMonth(monthIndex);
|
|
1852
|
-
return newDate;
|
|
1853
|
-
};
|
|
1854
|
-
Date.prototype.changeDay = function (date) {
|
|
1855
|
-
const newDate = new Date(this);
|
|
1856
|
-
newDate.setDate(date);
|
|
1857
|
-
return newDate;
|
|
1858
|
-
};
|
|
1859
|
-
Date.prototype.changeHours = function (hours) {
|
|
1860
|
-
const newDate = new Date(this);
|
|
1861
|
-
newDate.setHours(hours);
|
|
1862
|
-
return newDate;
|
|
1863
|
-
};
|
|
1864
|
-
Date.prototype.changeMinutes = function (minutes) {
|
|
1865
|
-
const newDate = new Date(this);
|
|
1866
|
-
newDate.setMinutes(minutes);
|
|
1867
|
-
return newDate;
|
|
1868
|
-
};
|
|
1869
|
-
Date.prototype.changeSeconds = function (seconds) {
|
|
1870
|
-
const newDate = new Date(this);
|
|
1871
|
-
newDate.setSeconds(seconds);
|
|
1872
|
-
return newDate;
|
|
1873
|
-
};
|
|
1874
|
-
Date.prototype.changeMilliseconds = function (milliseconds) {
|
|
1875
|
-
const newDate = new Date(this);
|
|
1876
|
-
newDate.setMilliseconds(milliseconds);
|
|
1877
|
-
return newDate;
|
|
1878
|
-
};
|
|
1879
|
-
Date.prototype.decreaseYear = function (count = 1) {
|
|
1880
|
-
return this.changeYear(this.getFullYear() - count);
|
|
1881
|
-
};
|
|
1882
|
-
Date.prototype.increaseYear = function (count = 1) {
|
|
1883
|
-
return this.changeYear(this.getFullYear() + count);
|
|
1884
|
-
};
|
|
1885
|
-
Date.prototype.decreaseMonth = function () {
|
|
1886
|
-
const newDate = new Date(this);
|
|
1887
|
-
newDate.setMonth(newDate.getMonth() - 1);
|
|
1888
|
-
return newDate;
|
|
1889
|
-
};
|
|
1890
|
-
Date.prototype.increaseMonth = function () {
|
|
1891
|
-
const newDate = new Date(this);
|
|
1892
|
-
newDate.setMonth(newDate.getMonth() + 1);
|
|
1893
|
-
return newDate;
|
|
1894
|
-
};
|
|
1895
|
-
Date.prototype.increaseDay = function () {
|
|
1896
|
-
const newDate = new Date(this);
|
|
1897
|
-
newDate.setDate(newDate.getDate() + 1);
|
|
1898
|
-
return newDate;
|
|
1899
|
-
};
|
|
1900
|
-
Date.prototype.decreaseDay = function () {
|
|
1901
|
-
const newDate = new Date(this);
|
|
1902
|
-
newDate.setDate(newDate.getDate() - 1);
|
|
1903
|
-
return newDate;
|
|
1904
|
-
};
|
|
1905
|
-
Date.prototype.startOfYear = function () {
|
|
1906
|
-
const newDate = new Date(this);
|
|
1907
|
-
newDate.setMonth(0);
|
|
1908
|
-
return newDate.startOfMonth();
|
|
1909
|
-
};
|
|
1910
|
-
Date.prototype.endOfYear = function () {
|
|
1911
|
-
const nextMonth = this.increaseYear().startOfYear();
|
|
1912
|
-
return new Date(nextMonth.getTime() - 1);
|
|
1913
|
-
};
|
|
1914
|
-
Date.prototype.startOfMonth = function () {
|
|
1915
|
-
const newDate = new Date(this);
|
|
1916
|
-
newDate.setDate(1);
|
|
1917
|
-
return newDate.startOfDay();
|
|
1918
|
-
};
|
|
1919
|
-
Date.prototype.endOfMonth = function () {
|
|
1920
|
-
const nextMonth = this.increaseMonth().startOfMonth();
|
|
1921
|
-
return new Date(nextMonth.getTime() - 1);
|
|
1922
|
-
};
|
|
1923
|
-
Date.prototype.startOfWeek = function () {
|
|
1924
|
-
const newDate = new Date(this);
|
|
1925
|
-
while (newDate.getDay()) {
|
|
1926
|
-
newDate.setDate(newDate.getDate() - 1);
|
|
1927
|
-
}
|
|
1928
|
-
return newDate.startOfDay();
|
|
1929
|
-
};
|
|
1930
|
-
Date.prototype.endOfWeek = function () {
|
|
1931
|
-
const newDate = new Date(this);
|
|
1932
|
-
while (newDate.getDay() < 6) {
|
|
1933
|
-
newDate.setDate(newDate.getDate() - 1);
|
|
1934
|
-
}
|
|
1935
|
-
return newDate.endOfDay();
|
|
1936
|
-
};
|
|
1937
|
-
Date.prototype.startOfDay = function () {
|
|
1938
|
-
const newDate = new Date(this);
|
|
1939
|
-
newDate.setHours(0, 0, 0, 0);
|
|
1940
|
-
return newDate;
|
|
1941
|
-
};
|
|
1942
|
-
Date.prototype.endOfDay = function () {
|
|
1943
|
-
const newDate = new Date(this);
|
|
1944
|
-
newDate.setHours(23, 59, 59, 999);
|
|
1945
|
-
return newDate;
|
|
1946
|
-
};
|
|
1947
|
-
Date.prototype.startOfHour = function () {
|
|
1948
|
-
const newDate = new Date(this);
|
|
1949
|
-
newDate.setMinutes(0, 0, 0);
|
|
1950
|
-
return newDate;
|
|
1951
|
-
};
|
|
1952
|
-
Date.prototype.endOfHour = function () {
|
|
1953
|
-
const newDate = new Date(this);
|
|
1954
|
-
newDate.setMinutes(59, 59, 999);
|
|
1955
|
-
return newDate;
|
|
1956
|
-
};
|
|
1957
|
-
Date.prototype.startOfMinute = function () {
|
|
1958
|
-
const newDate = new Date(this);
|
|
1959
|
-
newDate.setSeconds(0, 0);
|
|
1960
|
-
return newDate;
|
|
1961
|
-
};
|
|
1962
|
-
Date.prototype.endOfMinute = function () {
|
|
1963
|
-
const newDate = new Date(this);
|
|
1964
|
-
newDate.setSeconds(59, 999);
|
|
1965
|
-
return newDate;
|
|
1823
|
+
const PROBLEM_VERDICTS = [
|
|
1824
|
+
ProblemVerdict.NONE,
|
|
1825
|
+
ProblemVerdict.PENDING,
|
|
1826
|
+
ProblemVerdict.AC,
|
|
1827
|
+
ProblemVerdict.PE,
|
|
1828
|
+
ProblemVerdict.PA,
|
|
1829
|
+
ProblemVerdict.CE,
|
|
1830
|
+
ProblemVerdict.RE,
|
|
1831
|
+
ProblemVerdict.TLE,
|
|
1832
|
+
ProblemVerdict.MLE,
|
|
1833
|
+
ProblemVerdict.WA,
|
|
1834
|
+
];
|
|
1835
|
+
const SUBMISSION_RUN_STATUS = {
|
|
1836
|
+
[SubmissionRunStatus.NONE]: { value: SubmissionRunStatus.NONE, label: 'none' }, // status
|
|
1837
|
+
[SubmissionRunStatus.RECEIVED]: { value: SubmissionRunStatus.RECEIVED, label: 'received' }, // state
|
|
1838
|
+
[SubmissionRunStatus.COMPILING]: { value: SubmissionRunStatus.COMPILING, label: 'compiling' }, // state
|
|
1839
|
+
[SubmissionRunStatus.COMPILED]: { value: SubmissionRunStatus.COMPILED, label: 'compiled' }, // status
|
|
1840
|
+
[SubmissionRunStatus.COMPILATION_ERROR]: { value: SubmissionRunStatus.COMPILATION_ERROR, label: 'compilation error' }, // status
|
|
1841
|
+
[SubmissionRunStatus.FETCHING_TEST_CASES]: {
|
|
1842
|
+
value: SubmissionRunStatus.FETCHING_TEST_CASES,
|
|
1843
|
+
label: 'fetching test cases',
|
|
1844
|
+
}, // state
|
|
1845
|
+
[SubmissionRunStatus.RUNNING_TEST_CASE]: { value: SubmissionRunStatus.RUNNING_TEST_CASE, label: 'running test case' }, // state
|
|
1846
|
+
[SubmissionRunStatus.RUNNING_TEST_CASES]: {
|
|
1847
|
+
value: SubmissionRunStatus.RUNNING_TEST_CASES,
|
|
1848
|
+
label: 'running test cases',
|
|
1849
|
+
}, // state
|
|
1850
|
+
[SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES]: {
|
|
1851
|
+
value: SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES,
|
|
1852
|
+
label: 'running sample cases',
|
|
1853
|
+
}, // state
|
|
1854
|
+
[SubmissionRunStatus.EXECUTED_TEST_CASE]: {
|
|
1855
|
+
value: SubmissionRunStatus.EXECUTED_TEST_CASE,
|
|
1856
|
+
label: 'executed test case',
|
|
1857
|
+
}, // status
|
|
1858
|
+
[SubmissionRunStatus.FAILED_TEST_CASE]: { value: SubmissionRunStatus.FAILED_TEST_CASE, label: 'failed test case' }, // status
|
|
1859
|
+
[SubmissionRunStatus.JUDGING_TEST_CASE]: { value: SubmissionRunStatus.JUDGING_TEST_CASE, label: 'judging test case' }, // state
|
|
1860
|
+
[SubmissionRunStatus.GRADING]: { value: SubmissionRunStatus.GRADING, label: 'grading' }, // status
|
|
1861
|
+
[SubmissionRunStatus.FAILED]: { value: SubmissionRunStatus.FAILED, label: 'failed' }, // status
|
|
1862
|
+
[SubmissionRunStatus.COMPLETED]: { value: SubmissionRunStatus.COMPLETED, label: 'completed' }, // status
|
|
1966
1863
|
};
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
return newDate;
|
|
1864
|
+
const RUNNER_TYPE = {
|
|
1865
|
+
[RunnerType.HIGH_PERFORMANCE]: { value: RunnerType.HIGH_PERFORMANCE, label: 'high performance' },
|
|
1866
|
+
[RunnerType.LOW_PERFORMANCE]: { value: RunnerType.LOW_PERFORMANCE, label: 'low performance' },
|
|
1971
1867
|
};
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1868
|
+
|
|
1869
|
+
const PROBLEM_INPUT = {
|
|
1870
|
+
[ProblemInput.STANDARD]: { value: ProblemInput.STANDARD, label: 'standard' },
|
|
1871
|
+
[ProblemInput.INTERACTIVE]: { value: ProblemInput.INTERACTIVE, label: 'interactive' },
|
|
1976
1872
|
};
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1873
|
+
const PROBLEM_OUTPUT = {
|
|
1874
|
+
[ProblemOutput.STANDARD]: { value: ProblemOutput.STANDARD, label: 'standard' },
|
|
1875
|
+
[ProblemOutput.DYNAMIC]: { value: ProblemOutput.DYNAMIC, label: 'dynamic' },
|
|
1876
|
+
[ProblemOutput.INTERACTIVE]: { value: ProblemOutput.INTERACTIVE, label: 'interactive' },
|
|
1980
1877
|
};
|
|
1981
|
-
|
|
1982
|
-
|
|
1878
|
+
const PROBLEM_MODES = [ProblemScoringMode.TOTAL, ProblemScoringMode.SUBTASK, ProblemScoringMode.PARTIAL];
|
|
1879
|
+
const PROBLEM_MODE = {
|
|
1880
|
+
[ProblemScoringMode.TOTAL]: {
|
|
1881
|
+
value: ProblemScoringMode.TOTAL,
|
|
1882
|
+
label: 'total',
|
|
1883
|
+
description: 'if all test cases are Accepted the result is Accepted '
|
|
1884
|
+
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
1885
|
+
},
|
|
1886
|
+
[ProblemScoringMode.SUBTASK]: {
|
|
1887
|
+
value: ProblemScoringMode.SUBTASK,
|
|
1888
|
+
label: 'subtask',
|
|
1889
|
+
description: 'the test cases are grouped and each group of test cases is assigned a score, '
|
|
1890
|
+
+ 'if all test cases in a group are Accepted then the score assigned to that group of test cases is added to total score, '
|
|
1891
|
+
+ 'if total score is equal to the sum of the assigned scores of all groups of test cases then the result is Accepted, '
|
|
1892
|
+
+ 'otherwise if the total score is greater than zero the result is Partial Accepted with the total accumulated score, '
|
|
1893
|
+
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
1894
|
+
},
|
|
1895
|
+
[ProblemScoringMode.PARTIAL]: {
|
|
1896
|
+
value: ProblemScoringMode.PARTIAL,
|
|
1897
|
+
label: 'partial',
|
|
1898
|
+
description: 'the test cases are grouped and each group is associated with X points, '
|
|
1899
|
+
+ 'and each test case in a group scores X points ',
|
|
1900
|
+
},
|
|
1983
1901
|
};
|
|
1984
|
-
|
|
1985
|
-
|
|
1902
|
+
const PROBLEM_TYPES = [ProblemType.STANDARD, ProblemType.DYNAMIC, ProblemType.INTERACTIVE];
|
|
1903
|
+
const PROBLEM_TYPE = {
|
|
1904
|
+
[ProblemType.STANDARD]: {
|
|
1905
|
+
value: ProblemType.STANDARD,
|
|
1906
|
+
label: 'standard',
|
|
1907
|
+
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
1908
|
+
+ 'The source code is either standalone or to be compiled. '
|
|
1909
|
+
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
1910
|
+
+ 'The output produced by the contestant\'s program is then compared to the correct output using a simple diff algorithm.',
|
|
1911
|
+
},
|
|
1912
|
+
[ProblemType.INTERACTIVE]: {
|
|
1913
|
+
value: ProblemType.INTERACTIVE, label: 'interactive', description: 'developing..',
|
|
1914
|
+
},
|
|
1915
|
+
[ProblemType.DYNAMIC]: {
|
|
1916
|
+
value: ProblemType.DYNAMIC,
|
|
1917
|
+
label: 'dynamic',
|
|
1918
|
+
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
1919
|
+
+ 'The user\'s source code is either standalone or to be compiled. '
|
|
1920
|
+
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
1921
|
+
+ 'The output produced by the contestant\'s program is saved. '
|
|
1922
|
+
+ 'The problem editor save a single source code in C++ 17. '
|
|
1923
|
+
+ 'The editor\'s source code can read judge input filepath argv[1], judge output filepath argv[2], user\'s output filepath argv[3], user\'s error filepath argv[4], user\'s log filepath argv[5], user\'s source filepath argv[6] and submission information filepath argv[7] (companyId, submitId, runId, userId, contestId, problemId, language, userNickname, timestamp). '
|
|
1924
|
+
+ 'The resulting editor\'s executable should be "AC" or a number between 1 and 100 for partial accepted',
|
|
1925
|
+
},
|
|
1986
1926
|
};
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
}
|
|
1996
|
-
Date.prototype.isSameMinute = function (date) {
|
|
1997
|
-
return this.isSameHour(date) && this.getMinutes() === date.getMinutes();
|
|
1998
|
-
};
|
|
1999
|
-
Date.prototype.isSameSecond = function (date) {
|
|
2000
|
-
return this.isSameMinute(date) && this.getSeconds() === date.getSeconds();
|
|
2001
|
-
};
|
|
2002
|
-
Date.prototype.isSameMillisecond = function (date) {
|
|
2003
|
-
return this.isEqual(date);
|
|
2004
|
-
};
|
|
2005
|
-
Date.prototype.isValidDate = function () {
|
|
2006
|
-
return this instanceof Date && !isNaN(this.getTime());
|
|
2007
|
-
};
|
|
2008
|
-
Date.prototype.isYearAfter = function (date) {
|
|
2009
|
-
return this.getFullYear() > date.getFullYear();
|
|
2010
|
-
};
|
|
2011
|
-
Date.prototype.isMonthAfter = function (date) {
|
|
2012
|
-
return this.isYearAfter(date) || (this.isSameYear(date) && this.getMonth() > date.getMonth());
|
|
2013
|
-
};
|
|
2014
|
-
Date.prototype.isDayAfter = function (date) {
|
|
2015
|
-
return this.isMonthAfter(date) || (this.isSameMonth(date) && this.getDate() > date.getDate());
|
|
2016
|
-
};
|
|
2017
|
-
Date.prototype.isHoursAfter = function (date) {
|
|
2018
|
-
return this.isDayAfter(date) || (this.isSameDay(date) && this.getHours() > date.getHours());
|
|
2019
|
-
};
|
|
2020
|
-
Date.prototype.isMinutesAfter = function (date) {
|
|
2021
|
-
return this.isHoursAfter(date) || (this.isSameHour(date) && this.getMinutes() > date.getMinutes());
|
|
2022
|
-
};
|
|
2023
|
-
Date.prototype.isSecondsAfter = function (date) {
|
|
2024
|
-
return this.isMinutesAfter(date) || (this.isSameMinute(date) && this.getSeconds() > date.getSeconds());
|
|
2025
|
-
};
|
|
2026
|
-
Date.prototype.isMillisecondsAfter = function (date) {
|
|
2027
|
-
return this.isSecondsAfter(date) || (this.isSameSecond(date) && this.getMilliseconds() > date.getMilliseconds());
|
|
2028
|
-
};
|
|
2029
|
-
Date.prototype.isAfter = function (date) {
|
|
2030
|
-
return this.getTime() > date.getTime();
|
|
2031
|
-
};
|
|
2032
|
-
Date.prototype.isYearBefore = function (date) {
|
|
2033
|
-
return this.getFullYear() < date.getFullYear();
|
|
2034
|
-
};
|
|
2035
|
-
Date.prototype.isMonthBefore = function (date) {
|
|
2036
|
-
return this.isYearBefore(date) || (this.isSameYear(date) && this.getMonth() < date.getMonth());
|
|
2037
|
-
};
|
|
2038
|
-
Date.prototype.isDayBefore = function (date) {
|
|
2039
|
-
return this.isMonthBefore(date) || (this.isSameMonth(date) && this.getDate() < date.getDate());
|
|
2040
|
-
};
|
|
2041
|
-
Date.prototype.isHoursBefore = function (date) {
|
|
2042
|
-
return this.isDayBefore(date) || (this.isSameDay(date) && this.getHours() < date.getHours());
|
|
2043
|
-
};
|
|
2044
|
-
Date.prototype.isMinutesBefore = function (date) {
|
|
2045
|
-
return this.isHoursBefore(date) || (this.isSameHour(date) && this.getMinutes() < date.getMinutes());
|
|
2046
|
-
};
|
|
2047
|
-
Date.prototype.isSecondsBefore = function (date) {
|
|
2048
|
-
return this.isMinutesBefore(date) || (this.isSameMinute(date) && this.getSeconds() < date.getSeconds());
|
|
2049
|
-
};
|
|
2050
|
-
Date.prototype.isMillisecondsBefore = function (date) {
|
|
2051
|
-
return this.isSecondsBefore(date) || (this.isSameSecond(date) && this.getMilliseconds() < date.getMilliseconds());
|
|
2052
|
-
};
|
|
2053
|
-
Date.prototype.isBefore = function (date) {
|
|
2054
|
-
return this.getTime() < date.getTime();
|
|
2055
|
-
};
|
|
2056
|
-
Date.prototype.isWithinInterval = function ({ start, end }, cmp = '[]') {
|
|
2057
|
-
return (cmp.charAt(0) === '[' ? this.isEqual(start) || this.isAfter(start) : this.isAfter(start)) &&
|
|
2058
|
-
(cmp.charAt(1) === '[' ? this.isEqual(end) || this.isBefore(end) : this.isBefore(end));
|
|
1927
|
+
const PROBLEM_ROLE = {
|
|
1928
|
+
[Role.RESTRICTED]: { value: Role.RESTRICTED, label: 'restricted', level: 7 },
|
|
1929
|
+
[Role.GUEST]: { value: Role.GUEST, label: 'guest', level: 6 },
|
|
1930
|
+
[Role.REGULAR]: { value: Role.REGULAR, label: 'regular', level: 5 },
|
|
1931
|
+
[Role.CREATOR]: { value: Role.CREATOR, label: 'creator', level: 4 },
|
|
1932
|
+
[Role.MANAGER]: { value: Role.MANAGER, label: 'manager', level: 3 },
|
|
1933
|
+
[Role.MASTER]: { value: Role.MASTER, label: 'master', level: 2 },
|
|
1934
|
+
[Role.ADMIN]: { value: Role.ADMIN, label: 'admin', level: 1 },
|
|
1935
|
+
[Role.SUPER_ADMIN]: { value: Role.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2059
1936
|
};
|
|
2060
1937
|
|
|
1938
|
+
const _TYPE = ':type';
|
|
1939
|
+
const _KEY = ':key';
|
|
1940
|
+
const _TAB = ':tab';
|
|
1941
|
+
const _SUB_TAB = ':subTab?';
|
|
1942
|
+
const _SUB_SUB_TAB = ':subSubTab?';
|
|
1943
|
+
const PAGE = 'page';
|
|
1944
|
+
const PAGE_SIZE = 'size';
|
|
1945
|
+
|
|
2061
1946
|
const ERROR = {
|
|
2062
1947
|
// Http Errors
|
|
2063
1948
|
[ErrorCode.ERR500]: { value: ErrorCode.ERR500, message: 'internal server error', status: 500 },
|
|
@@ -2215,1133 +2100,1248 @@ const ERROR = {
|
|
|
2215
2100
|
[ErrorCode.ERR0820]: { value: ErrorCode.ERR0820, message: 'file is archived', status: 400 },
|
|
2216
2101
|
};
|
|
2217
2102
|
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
super(message);
|
|
2222
|
-
this.message = message;
|
|
2223
|
-
this.code = code;
|
|
2224
|
-
if (custom?.stack) {
|
|
2225
|
-
this.stack = custom.stack;
|
|
2226
|
-
}
|
|
2227
|
-
if (custom?.data) {
|
|
2228
|
-
this.data = custom.data;
|
|
2229
|
-
}
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
|
-
/* eslint-disable no-extend-native */
|
|
2234
|
-
Number.prototype.padStart = function (maxLength, fillString = '0') {
|
|
2235
|
-
return (this + '').padStart(maxLength, fillString);
|
|
2103
|
+
const FILE_TYPE = {
|
|
2104
|
+
[FileType.FILE]: { value: FileType.FILE, label: 'file' },
|
|
2105
|
+
[FileType.FOLDER]: { value: FileType.FOLDER, label: 'folder' },
|
|
2236
2106
|
};
|
|
2237
|
-
|
|
2238
|
-
|
|
2107
|
+
const FILE_ROLE = {
|
|
2108
|
+
[Role.RESTRICTED]: { value: Role.RESTRICTED, label: 'restricted', level: 5 },
|
|
2109
|
+
[Role.GUEST]: { value: Role.GUEST, label: 'guest', level: 4 },
|
|
2110
|
+
[Role.REGULAR]: { value: Role.REGULAR, label: 'regular', level: 3 },
|
|
2111
|
+
[Role.MASTER]: { value: Role.MASTER, label: 'master', level: 2 },
|
|
2112
|
+
[Role.ADMIN]: { value: Role.ADMIN, label: 'admin', level: 1 },
|
|
2113
|
+
[Role.SUPER_ADMIN]: { value: Role.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2239
2114
|
};
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
stack: err?.stack || error.stack,
|
|
2250
|
-
data: err?.data || null,
|
|
2251
|
-
});
|
|
2252
|
-
}
|
|
2253
|
-
function errorsResponse(message, ...errors) {
|
|
2254
|
-
return {
|
|
2255
|
-
success: false,
|
|
2256
|
-
message: message,
|
|
2257
|
-
errors: errors.map(error => ({
|
|
2258
|
-
code: error.code,
|
|
2259
|
-
message: error.message,
|
|
2260
|
-
detail: error.stack || new Error().stack || '',
|
|
2261
|
-
data: error.data,
|
|
2262
|
-
})),
|
|
2263
|
-
};
|
|
2264
|
-
}
|
|
2265
|
-
function contentResponse(message, content) {
|
|
2266
|
-
return {
|
|
2267
|
-
success: true,
|
|
2268
|
-
message,
|
|
2269
|
-
content,
|
|
2270
|
-
};
|
|
2271
|
-
}
|
|
2272
|
-
function contentsResponse(message, contents, meta) {
|
|
2273
|
-
return {
|
|
2274
|
-
success: true,
|
|
2275
|
-
message,
|
|
2276
|
-
contents,
|
|
2277
|
-
meta,
|
|
2278
|
-
};
|
|
2279
|
-
}
|
|
2280
|
-
const cleanRequest = (responseText) => {
|
|
2281
|
-
if (!isStringJson(responseText)) {
|
|
2282
|
-
// this occurs when the endpoint don't exits or server is down
|
|
2283
|
-
const response = {
|
|
2284
|
-
success: false,
|
|
2285
|
-
message: ERROR[ErrorCode.ERR9999].message,
|
|
2286
|
-
errors: [{ code: ErrorCode.ERR9999, detail: '', message: ERROR[ErrorCode.ERR9999].message }],
|
|
2287
|
-
};
|
|
2288
|
-
consoleError({ message: 'response is not string json, success false on cleaning request', responseText, response });
|
|
2289
|
-
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2290
|
-
return response;
|
|
2291
|
-
}
|
|
2292
|
-
const responseJson = JSON.parse(responseText);
|
|
2293
|
-
if (typeof responseJson.success === 'boolean') {
|
|
2294
|
-
if (responseJson.success === true && typeof responseJson.message === 'string' && responseJson.content) { // V1
|
|
2295
|
-
return {
|
|
2296
|
-
success: true,
|
|
2297
|
-
message: responseJson.message,
|
|
2298
|
-
content: responseJson.content,
|
|
2299
|
-
};
|
|
2300
|
-
}
|
|
2301
|
-
else if (responseJson.success === true && typeof responseJson.message === 'string' && Array.isArray(responseJson.contents) && responseJson.meta) { // V1
|
|
2302
|
-
return {
|
|
2303
|
-
success: true,
|
|
2304
|
-
message: responseJson.message,
|
|
2305
|
-
contents: responseJson.contents,
|
|
2306
|
-
meta: responseJson.meta,
|
|
2307
|
-
};
|
|
2308
|
-
}
|
|
2309
|
-
else if (responseJson.success === false && typeof responseJson.message === 'string' && Array.isArray(responseJson.errors)) { // V1
|
|
2310
|
-
const response = {
|
|
2311
|
-
success: false,
|
|
2312
|
-
message: responseJson.message,
|
|
2313
|
-
errors: responseJson.errors,
|
|
2314
|
-
};
|
|
2315
|
-
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2316
|
-
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2317
|
-
return response;
|
|
2318
|
-
}
|
|
2319
|
-
}
|
|
2320
|
-
const response = {
|
|
2321
|
-
success: false,
|
|
2322
|
-
message: ERROR[ErrorCode.ERR9998].message,
|
|
2323
|
-
errors: [{ code: ErrorCode.ERR9998, detail: '', message: ERROR[ErrorCode.ERR9998].message }],
|
|
2324
|
-
};
|
|
2325
|
-
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2326
|
-
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2327
|
-
return response;
|
|
2115
|
+
const ENTITY_STATE = {
|
|
2116
|
+
[EntityState.RELEASED]: {
|
|
2117
|
+
value: EntityState.RELEASED,
|
|
2118
|
+
label: 'released',
|
|
2119
|
+
},
|
|
2120
|
+
[EntityState.ARCHIVED]: {
|
|
2121
|
+
value: EntityState.ARCHIVED,
|
|
2122
|
+
label: 'archived',
|
|
2123
|
+
},
|
|
2328
2124
|
};
|
|
2329
|
-
const
|
|
2330
|
-
|
|
2125
|
+
const ENTITY_ACCESS = {
|
|
2126
|
+
[EntityAccess.PRIVATE]: {
|
|
2127
|
+
value: EntityAccess.PRIVATE,
|
|
2128
|
+
label: 'private',
|
|
2129
|
+
description: 'the record will be visible and editable only to the owner',
|
|
2130
|
+
},
|
|
2131
|
+
[EntityAccess.RESTRICTED]: {
|
|
2132
|
+
value: EntityAccess.RESTRICTED,
|
|
2133
|
+
label: 'restricted',
|
|
2134
|
+
description: 'the record will be visible to viewers and the owner and editable to editors and the owner',
|
|
2135
|
+
},
|
|
2136
|
+
[EntityAccess.PUBLIC]: {
|
|
2137
|
+
value: EntityAccess.PUBLIC,
|
|
2138
|
+
label: 'public',
|
|
2139
|
+
description: 'the record will be visible to anyone and editable to editors and the owner',
|
|
2140
|
+
},
|
|
2141
|
+
[EntityAccess.EXPOSED]: {
|
|
2142
|
+
value: EntityAccess.EXPOSED,
|
|
2143
|
+
label: 'exposed',
|
|
2144
|
+
description: 'the record will be visible and editable to anyone',
|
|
2145
|
+
},
|
|
2331
2146
|
};
|
|
2332
2147
|
|
|
2333
|
-
const
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
}
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
&& event?.event === WebSocketMessageEvent.PING;
|
|
2148
|
+
const SYSTEM_ROLE = {
|
|
2149
|
+
[SystemRole.GUEST]: { value: SystemRole.GUEST, label: 'guest', level: 5 },
|
|
2150
|
+
[SystemRole.REGULAR]: { value: SystemRole.REGULAR, label: 'regular', level: 4 },
|
|
2151
|
+
[SystemRole.MANAGER]: { value: SystemRole.MANAGER, label: 'manager', level: 3 },
|
|
2152
|
+
[SystemRole.MASTER]: { value: SystemRole.MASTER, label: 'master', level: 2 },
|
|
2153
|
+
[SystemRole.ADMIN]: { value: SystemRole.ADMIN, label: 'admin', level: 1 },
|
|
2154
|
+
[SystemRole.SUPER_ADMIN]: { value: SystemRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2341
2155
|
};
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2156
|
+
|
|
2157
|
+
const MEMBER_ROLE = {
|
|
2158
|
+
[MemberRole.COACH]: { value: MemberRole.COACH, label: 'coach' },
|
|
2159
|
+
[MemberRole.CO_COACH]: { value: MemberRole.CO_COACH, label: 'co-coach' },
|
|
2160
|
+
[MemberRole.STAFF]: { value: MemberRole.STAFF, label: 'staff' },
|
|
2161
|
+
[MemberRole.ATTENDEE]: { value: MemberRole.ATTENDEE, label: 'attendee' },
|
|
2162
|
+
[MemberRole.RESERVE]: { value: MemberRole.RESERVE, label: 'reserve' },
|
|
2163
|
+
[MemberRole.CONTESTANT]: { value: MemberRole.CONTESTANT, label: 'contestant' },
|
|
2345
2164
|
};
|
|
2346
|
-
const
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
}
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
};
|
|
2354
|
-
const isChatCompletionsWebSocketEventDTO = (event) => {
|
|
2355
|
-
return isWebsocketSubscription(event)
|
|
2356
|
-
&& event?.event === WebSocketMessageEvent.CHAT_COMPLETIONS;
|
|
2165
|
+
const TEAM_ROLE = {
|
|
2166
|
+
[TeamRole.RESTRICTED]: { value: TeamRole.RESTRICTED, label: 'restricted', level: 5 },
|
|
2167
|
+
[TeamRole.GUEST]: { value: TeamRole.GUEST, label: 'guest', level: 4 },
|
|
2168
|
+
[TeamRole.REGULAR]: { value: TeamRole.REGULAR, label: 'regular', level: 3 },
|
|
2169
|
+
[TeamRole.MANAGER]: { value: TeamRole.MANAGER, label: 'manager', level: 2 },
|
|
2170
|
+
[TeamRole.ADMIN]: { value: TeamRole.ADMIN, label: 'admin', level: 1 },
|
|
2171
|
+
[TeamRole.SUPER_ADMIN]: { value: TeamRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2357
2172
|
};
|
|
2358
|
-
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2173
|
+
|
|
2174
|
+
const ONE_SECOND = 1000;
|
|
2175
|
+
const SEC_30 = ONE_SECOND * 30;
|
|
2176
|
+
const SEC_60 = ONE_SECOND * 60;
|
|
2177
|
+
const SEC_90 = ONE_SECOND * 90;
|
|
2178
|
+
const SEC_120 = ONE_SECOND * 120;
|
|
2179
|
+
const ONE_MINUTE = ONE_SECOND * 60;
|
|
2180
|
+
const ONE_HOUR = ONE_MINUTE * 60;
|
|
2181
|
+
const ONE_DAY = ONE_HOUR * 24;
|
|
2182
|
+
const ONE_WEEK = ONE_DAY * 7;
|
|
2183
|
+
|
|
2184
|
+
const USER_STATUS = {
|
|
2185
|
+
[UserStatus.ACTIVE]: { value: UserStatus.ACTIVE, label: 'active' },
|
|
2186
|
+
[UserStatus.REPORTED]: { value: UserStatus.REPORTED, label: 'reported' },
|
|
2187
|
+
[UserStatus.ARCHIVED]: { value: UserStatus.ARCHIVED, label: 'archived' },
|
|
2363
2188
|
};
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2189
|
+
const USER_ROLE = {
|
|
2190
|
+
[UserRole.RESTRICTED]: { value: UserRole.RESTRICTED, label: 'restricted', level: 6 },
|
|
2191
|
+
[UserRole.GUEST]: { value: UserRole.GUEST, label: 'guest', level: 5 },
|
|
2192
|
+
[UserRole.LIMITED]: { value: UserRole.LIMITED, label: 'limited', level: 4 },
|
|
2193
|
+
[UserRole.REGULAR]: { value: UserRole.REGULAR, label: 'regular', level: 3 },
|
|
2194
|
+
[UserRole.MANAGER]: { value: UserRole.MANAGER, label: 'manager', level: 2 },
|
|
2195
|
+
[UserRole.ADMIN]: { value: UserRole.ADMIN, label: 'admin', level: 1 },
|
|
2196
|
+
[UserRole.SUPER_ADMIN]: { value: UserRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
2368
2197
|
};
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2198
|
+
const EMPTY_USER_PERMISSIONS = {
|
|
2199
|
+
users: {
|
|
2200
|
+
create: false,
|
|
2201
|
+
manage: false,
|
|
2202
|
+
administrate: false,
|
|
2203
|
+
},
|
|
2204
|
+
problems: {
|
|
2205
|
+
create: false,
|
|
2206
|
+
manage: false,
|
|
2207
|
+
},
|
|
2208
|
+
submissions: {
|
|
2209
|
+
manage: false,
|
|
2210
|
+
},
|
|
2211
|
+
contests: {
|
|
2212
|
+
create: false,
|
|
2213
|
+
manage: false,
|
|
2214
|
+
},
|
|
2215
|
+
company: {
|
|
2216
|
+
manage: false,
|
|
2217
|
+
administrate: false,
|
|
2218
|
+
},
|
|
2219
|
+
services: {
|
|
2220
|
+
administrate: false,
|
|
2221
|
+
},
|
|
2373
2222
|
};
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2223
|
+
|
|
2224
|
+
const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
|
|
2225
|
+
const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
|
|
2226
|
+
const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
|
|
2227
|
+
const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
|
|
2228
|
+
const CHANNEL_PRESENCE_CLIENT = 'pre:client';
|
|
2229
|
+
|
|
2230
|
+
const NEW_PAGE_SHEET = () => ({
|
|
2231
|
+
id: v4(),
|
|
2232
|
+
type: WorksheetType.NEW_PAGE,
|
|
2233
|
+
title: '',
|
|
2234
|
+
points: 0,
|
|
2235
|
+
});
|
|
2236
|
+
const ASPECT_RATIO = {
|
|
2237
|
+
[AspectRatio.RATIO_21_9]: {
|
|
2238
|
+
aspectRatio: AspectRatio.RATIO_21_9,
|
|
2239
|
+
width: 2520,
|
|
2240
|
+
height: 1080,
|
|
2241
|
+
decimal: 21 / 9,
|
|
2242
|
+
label: 'ultrawide',
|
|
2243
|
+
},
|
|
2244
|
+
[AspectRatio.RATIO_20_9]: {
|
|
2245
|
+
aspectRatio: AspectRatio.RATIO_20_9,
|
|
2246
|
+
width: 2400,
|
|
2247
|
+
height: 1080,
|
|
2248
|
+
decimal: 20 / 9,
|
|
2249
|
+
label: 'mobile wide',
|
|
2250
|
+
},
|
|
2251
|
+
[AspectRatio.RATIO_16_9]: {
|
|
2252
|
+
aspectRatio: AspectRatio.RATIO_16_9,
|
|
2253
|
+
width: 1920,
|
|
2254
|
+
height: 1080,
|
|
2255
|
+
decimal: 16 / 9,
|
|
2256
|
+
label: 'widescreen',
|
|
2257
|
+
},
|
|
2258
|
+
[AspectRatio.RATIO_16_10]: {
|
|
2259
|
+
aspectRatio: AspectRatio.RATIO_16_10,
|
|
2260
|
+
width: 1920,
|
|
2261
|
+
height: 1200,
|
|
2262
|
+
decimal: 16 / 10,
|
|
2263
|
+
label: 'widescreen tall',
|
|
2264
|
+
},
|
|
2265
|
+
[AspectRatio.RATIO_3_2]: {
|
|
2266
|
+
aspectRatio: AspectRatio.RATIO_3_2,
|
|
2267
|
+
width: 1440,
|
|
2268
|
+
height: 960,
|
|
2269
|
+
decimal: 3 / 2,
|
|
2270
|
+
label: 'balanced',
|
|
2271
|
+
},
|
|
2272
|
+
[AspectRatio.RATIO_4_3]: {
|
|
2273
|
+
aspectRatio: AspectRatio.RATIO_4_3,
|
|
2274
|
+
width: 1024,
|
|
2275
|
+
height: 768,
|
|
2276
|
+
decimal: 4 / 3,
|
|
2277
|
+
label: 'standard',
|
|
2278
|
+
},
|
|
2279
|
+
[AspectRatio.RATIO_5_4]: {
|
|
2280
|
+
aspectRatio: AspectRatio.RATIO_5_4,
|
|
2281
|
+
width: 1280,
|
|
2282
|
+
height: 1024,
|
|
2283
|
+
decimal: 5 / 4,
|
|
2284
|
+
label: 'square old',
|
|
2285
|
+
},
|
|
2286
|
+
[AspectRatio.RATIO_1_1]: {
|
|
2287
|
+
aspectRatio: AspectRatio.RATIO_1_1,
|
|
2288
|
+
width: 1000,
|
|
2289
|
+
height: 1000,
|
|
2290
|
+
decimal: 1,
|
|
2291
|
+
label: 'square',
|
|
2292
|
+
},
|
|
2378
2293
|
};
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2294
|
+
|
|
2295
|
+
var ContestProblemBlockedByType;
|
|
2296
|
+
(function (ContestProblemBlockedByType) {
|
|
2297
|
+
ContestProblemBlockedByType["UNMET_PREREQUISITES"] = "UNMET_PREREQUISITES";
|
|
2298
|
+
ContestProblemBlockedByType["MAX_ACCEPTED_SUBMISSIONS_ACHIEVED"] = "MAX_ACCEPTED_SUBMISSIONS_ACHIEVED";
|
|
2299
|
+
ContestProblemBlockedByType["START_TIME_IN_THE_FUTURE"] = "START_TIME_IN_THE_FUTURE";
|
|
2300
|
+
ContestProblemBlockedByType["END_TIME_IN_THE_PAST"] = "END_TIME_IN_THE_PAST";
|
|
2301
|
+
})(ContestProblemBlockedByType || (ContestProblemBlockedByType = {}));
|
|
2302
|
+
|
|
2303
|
+
var MemberType;
|
|
2304
|
+
(function (MemberType) {
|
|
2305
|
+
MemberType["USER"] = "USER";
|
|
2306
|
+
MemberType["TEAM"] = "TEAM";
|
|
2307
|
+
})(MemberType || (MemberType = {}));
|
|
2308
|
+
|
|
2309
|
+
const isWorksheetAssignment = (assignment) => {
|
|
2310
|
+
return assignment.type === AssignmentClass.WORKSHEET;
|
|
2382
2311
|
};
|
|
2383
|
-
const
|
|
2384
|
-
return
|
|
2385
|
-
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_GET_DATA;
|
|
2312
|
+
const isCourseAssignment = (assignment) => {
|
|
2313
|
+
return assignment.type === AssignmentClass.COURSE;
|
|
2386
2314
|
};
|
|
2387
|
-
const
|
|
2388
|
-
return
|
|
2389
|
-
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_PROBLEM_CRAWLED;
|
|
2315
|
+
const isContestAssignment = (assignment) => {
|
|
2316
|
+
return assignment.type === AssignmentClass.CONTEST;
|
|
2390
2317
|
};
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2318
|
+
|
|
2319
|
+
const getAssignmentCommentKey = (classKey, cycleKey, sessionKey, assignmentKey) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}`;
|
|
2320
|
+
const getAssignmentUserCommentKey = (classKey, cycleKey, sessionKey, assignmentKey, userNickname, userCompany) => `class:${classKey}|cycle:${cycleKey}|session:${sessionKey}|assignment:${assignmentKey}|user_nickname:${userNickname}|user_company:${userCompany}`;
|
|
2321
|
+
const getProblemCommentKey = (problemKey) => `problem:${problemKey}`;
|
|
2322
|
+
const getContestCommentKey = (contestKey) => `contest:${contestKey}`;
|
|
2323
|
+
|
|
2324
|
+
const isEndlessContest = (settings) => {
|
|
2325
|
+
return settings?.startTimestamp === MIN_DATE.getTime()
|
|
2326
|
+
&& settings?.frozenTimestamp === MAX_DATE.getTime()
|
|
2327
|
+
&& settings?.quietTimestamp === MAX_DATE.getTime()
|
|
2328
|
+
&& settings?.endTimestamp === MAX_DATE.getTime()
|
|
2329
|
+
&& settings?.penalty === 0;
|
|
2394
2330
|
};
|
|
2395
|
-
const
|
|
2396
|
-
return
|
|
2397
|
-
&&
|
|
2331
|
+
const isGlobalContest = (settings) => {
|
|
2332
|
+
return settings?.startTimestamp === 0
|
|
2333
|
+
&& settings?.frozenTimestamp === 0
|
|
2334
|
+
&& settings?.quietTimestamp === 0
|
|
2335
|
+
&& settings?.endTimestamp === 0
|
|
2336
|
+
&& settings?.penalty === 0;
|
|
2398
2337
|
};
|
|
2399
|
-
const
|
|
2400
|
-
return
|
|
2401
|
-
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
2338
|
+
const isPastContest = (settings) => {
|
|
2339
|
+
return Date.now() > (settings?.endTimestamp ?? 0);
|
|
2402
2340
|
};
|
|
2403
|
-
const
|
|
2404
|
-
return
|
|
2405
|
-
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CONTEST_CHANGES;
|
|
2341
|
+
const isFutureContest = (settings) => {
|
|
2342
|
+
return (settings?.startTimestamp ?? 0) > Date.now();
|
|
2406
2343
|
};
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2344
|
+
|
|
2345
|
+
const getDocumentAccess = (document) => {
|
|
2346
|
+
switch (true) {
|
|
2347
|
+
case (document?.members?.rankAdministrators === EntityMembersRank.NONE || document?.members?.rankAdministrators === EntityMembersRank.CLOSE)
|
|
2348
|
+
&& document?.members?.rankManagers === EntityMembersRank.OPEN
|
|
2349
|
+
&& (document?.members?.rankGuests === EntityMembersRank.NONE || document?.members?.rankGuests === EntityMembersRank.CLOSE || document?.members?.rankGuests === EntityMembersRank.OPEN)
|
|
2350
|
+
&& document?.members?.rankSpectators === EntityMembersRank.OPEN
|
|
2351
|
+
&& (document?.members?.rankParticipants === EntityMembersRank.NONE || document?.members?.rankParticipants === EntityMembersRank.CLOSE || document?.members?.rankParticipants === EntityMembersRank.OPEN):
|
|
2352
|
+
return EntityAccess.EXPOSED;
|
|
2353
|
+
case (document?.members?.rankAdministrators === EntityMembersRank.NONE || document?.members?.rankAdministrators === EntityMembersRank.CLOSE)
|
|
2354
|
+
&& document?.members?.rankManagers === EntityMembersRank.CLOSE
|
|
2355
|
+
&& (document?.members?.rankGuests === EntityMembersRank.NONE || document?.members?.rankGuests === EntityMembersRank.CLOSE || document?.members?.rankGuests === EntityMembersRank.OPEN)
|
|
2356
|
+
&& document?.members?.rankSpectators === EntityMembersRank.OPEN
|
|
2357
|
+
&& (document?.members?.rankParticipants === EntityMembersRank.NONE || document?.members?.rankParticipants === EntityMembersRank.CLOSE || document?.members?.rankParticipants === EntityMembersRank.OPEN):
|
|
2358
|
+
return EntityAccess.PUBLIC;
|
|
2359
|
+
case (document?.members?.rankAdministrators === EntityMembersRank.NONE || document?.members?.rankAdministrators === EntityMembersRank.CLOSE)
|
|
2360
|
+
&& document?.members?.rankManagers === EntityMembersRank.CLOSE
|
|
2361
|
+
&& (document?.members?.rankGuests === EntityMembersRank.NONE || document?.members?.rankGuests === EntityMembersRank.CLOSE || document?.members?.rankGuests === EntityMembersRank.OPEN)
|
|
2362
|
+
&& document?.members?.rankSpectators === EntityMembersRank.CLOSE
|
|
2363
|
+
&& (document?.members?.rankParticipants === EntityMembersRank.NONE || document?.members?.rankParticipants === EntityMembersRank.CLOSE || document?.members?.rankParticipants === EntityMembersRank.OPEN):
|
|
2364
|
+
return EntityAccess.RESTRICTED;
|
|
2365
|
+
case document?.members?.rankAdministrators === EntityMembersRank.NONE
|
|
2366
|
+
&& document?.members?.rankManagers === EntityMembersRank.NONE
|
|
2367
|
+
&& document?.members?.rankGuests === EntityMembersRank.NONE
|
|
2368
|
+
&& document?.members?.rankSpectators === EntityMembersRank.NONE
|
|
2369
|
+
&& document?.members?.rankParticipants === EntityMembersRank.NONE:
|
|
2370
|
+
return EntityAccess.PRIVATE;
|
|
2371
|
+
default:
|
|
2372
|
+
return EntityAccess.PRIVATE;
|
|
2373
|
+
}
|
|
2410
2374
|
};
|
|
2411
|
-
const
|
|
2412
|
-
return
|
|
2413
|
-
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CLIENT_TRACK;
|
|
2375
|
+
const isUserMember = (member) => {
|
|
2376
|
+
return typeof member.userId === 'string';
|
|
2414
2377
|
};
|
|
2415
|
-
const
|
|
2416
|
-
return
|
|
2417
|
-
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_CLIENT_TRACK;
|
|
2378
|
+
const isTeamMember = (member) => {
|
|
2379
|
+
return typeof member.teamId === 'string';
|
|
2418
2380
|
};
|
|
2419
|
-
const
|
|
2420
|
-
return
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2381
|
+
const toEntityMembersDTO = (members) => {
|
|
2382
|
+
return {
|
|
2383
|
+
rankAdministrators: members.rankAdministrators,
|
|
2384
|
+
administrators: Object.keys(members.administrators),
|
|
2385
|
+
rankManagers: members.rankManagers,
|
|
2386
|
+
managers: Object.keys(members.managers),
|
|
2387
|
+
rankParticipants: members.rankParticipants,
|
|
2388
|
+
participants: Object.keys(members.participants),
|
|
2389
|
+
rankGuests: members.rankGuests,
|
|
2390
|
+
guests: Object.keys(members.guests),
|
|
2391
|
+
rankSpectators: members.rankSpectators,
|
|
2392
|
+
spectators: Object.keys(members.spectators),
|
|
2393
|
+
};
|
|
2426
2394
|
};
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2395
|
+
|
|
2396
|
+
function removeExtension(fileName) {
|
|
2397
|
+
const i = fileName.lastIndexOf('.');
|
|
2398
|
+
return i !== -1 ? fileName.substring(0, i) : fileName;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
// https://dev.to/jsmccrumb/asynchronous-setinterval-4j69
|
|
2402
|
+
const asyncIntervals = [];
|
|
2403
|
+
const runAsyncInterval = async (cb, interval, intervalIndex) => {
|
|
2404
|
+
await cb();
|
|
2405
|
+
if (asyncIntervals[intervalIndex]) {
|
|
2406
|
+
setTimeout(() => runAsyncInterval(cb, interval, intervalIndex), interval);
|
|
2407
|
+
}
|
|
2433
2408
|
};
|
|
2434
|
-
const
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2409
|
+
const setAsyncInterval = (cb, interval) => {
|
|
2410
|
+
if (cb && typeof cb === 'function') {
|
|
2411
|
+
const intervalIndex = asyncIntervals.length;
|
|
2412
|
+
asyncIntervals.push(true);
|
|
2413
|
+
void runAsyncInterval(cb, interval, intervalIndex);
|
|
2414
|
+
return intervalIndex;
|
|
2415
|
+
}
|
|
2416
|
+
else {
|
|
2417
|
+
throw new Error('Callback must be a function');
|
|
2418
|
+
}
|
|
2438
2419
|
};
|
|
2439
|
-
const
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
&& event?.status in SubmissionRunStatus;
|
|
2420
|
+
const clearAsyncInterval = (intervalIndex) => {
|
|
2421
|
+
if (asyncIntervals[intervalIndex]) {
|
|
2422
|
+
asyncIntervals[intervalIndex] = false;
|
|
2423
|
+
}
|
|
2444
2424
|
};
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2425
|
+
|
|
2426
|
+
const getDataOfTestCase = (testCase, timeLimit, memoryLimit) => {
|
|
2427
|
+
const { timeUsed, memoryUsed, exitCode } = getDataLog(testCase?.log);
|
|
2428
|
+
const timeLimitExceeded = timeUsed > timeLimit;
|
|
2429
|
+
const memoryLimitExceeded = memoryUsed > memoryLimit;
|
|
2430
|
+
const runtimeError = exitCode !== 0;
|
|
2431
|
+
const compilationError = testCase?.status === SubmissionRunStatus.COMPILATION_ERROR;
|
|
2432
|
+
return {
|
|
2433
|
+
compilationError,
|
|
2434
|
+
timeUsed,
|
|
2435
|
+
timeLimitExceeded: timeLimitExceeded,
|
|
2436
|
+
memoryUsed,
|
|
2437
|
+
memoryLimitExceeded: memoryLimitExceeded,
|
|
2438
|
+
exitCode,
|
|
2439
|
+
runtimeError,
|
|
2440
|
+
failed: !!testCase?.log && (timeLimitExceeded || memoryLimitExceeded || runtimeError),
|
|
2441
|
+
};
|
|
2452
2442
|
};
|
|
2453
|
-
const
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2443
|
+
const getVerdictFromTestCase = (testCaseValue, timeLimit, memoryLimit) => {
|
|
2444
|
+
const { compilationError, timeLimitExceeded, memoryLimitExceeded, runtimeError, timeUsed, memoryUsed, exitCode, } = getDataOfTestCase(testCaseValue, timeLimit, memoryLimit);
|
|
2445
|
+
return {
|
|
2446
|
+
verdict: compilationError
|
|
2447
|
+
? ProblemVerdict.CE
|
|
2448
|
+
: timeLimitExceeded
|
|
2449
|
+
? ProblemVerdict.TLE
|
|
2450
|
+
: memoryLimitExceeded
|
|
2451
|
+
? ProblemVerdict.MLE
|
|
2452
|
+
: runtimeError
|
|
2453
|
+
? ProblemVerdict.RE
|
|
2454
|
+
: testCaseValue.out === testCaseValue.testOut
|
|
2455
|
+
? ProblemVerdict.AC
|
|
2456
|
+
: testCaseValue.withPE && testCaseValue.out.split(' ').join('').split('\n').join('') === testCaseValue.testOut.split(' ').join('').split('\n').join('')
|
|
2457
|
+
? ProblemVerdict.PE
|
|
2458
|
+
: !testCaseValue.withPE && testCaseValue.out.split(' ').join('').split('\n').join('') === testCaseValue.testOut.split(' ').join('').split('\n').join('')
|
|
2459
|
+
? ProblemVerdict.AC
|
|
2460
|
+
: ProblemVerdict.WA,
|
|
2461
|
+
timeUsed,
|
|
2462
|
+
memoryUsed,
|
|
2463
|
+
exitCode,
|
|
2464
|
+
};
|
|
2460
2465
|
};
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
&&
|
|
2472
|
-
|
|
2466
|
+
const mergeVerdicts = (first, second) => {
|
|
2467
|
+
let verdict = first.verdict;
|
|
2468
|
+
if (second.verdict === ProblemVerdict.RE) {
|
|
2469
|
+
verdict = ProblemVerdict.RE;
|
|
2470
|
+
}
|
|
2471
|
+
else if (second.verdict === ProblemVerdict.TLE && verdict != ProblemVerdict.RE) {
|
|
2472
|
+
verdict = ProblemVerdict.TLE;
|
|
2473
|
+
}
|
|
2474
|
+
else if (second.verdict === ProblemVerdict.MLE
|
|
2475
|
+
&& verdict !== ProblemVerdict.TLE
|
|
2476
|
+
&& verdict !== ProblemVerdict.RE) {
|
|
2477
|
+
verdict = ProblemVerdict.MLE;
|
|
2478
|
+
}
|
|
2479
|
+
else if (second.verdict === ProblemVerdict.WA
|
|
2480
|
+
&& verdict !== ProblemVerdict.MLE
|
|
2481
|
+
&& verdict !== ProblemVerdict.TLE
|
|
2482
|
+
&& verdict !== ProblemVerdict.RE) {
|
|
2483
|
+
verdict = ProblemVerdict.WA;
|
|
2484
|
+
}
|
|
2485
|
+
else if (second.verdict === ProblemVerdict.PE
|
|
2486
|
+
&& verdict !== ProblemVerdict.WA
|
|
2487
|
+
&& verdict !== ProblemVerdict.MLE
|
|
2488
|
+
&& verdict !== ProblemVerdict.TLE
|
|
2489
|
+
&& verdict !== ProblemVerdict.RE) {
|
|
2490
|
+
verdict = ProblemVerdict.PE;
|
|
2491
|
+
}
|
|
2492
|
+
else if (second.verdict === ProblemVerdict.PA
|
|
2493
|
+
&& verdict !== ProblemVerdict.PE
|
|
2494
|
+
&& verdict !== ProblemVerdict.WA
|
|
2495
|
+
&& verdict !== ProblemVerdict.MLE
|
|
2496
|
+
&& verdict !== ProblemVerdict.TLE
|
|
2497
|
+
&& verdict !== ProblemVerdict.RE) {
|
|
2498
|
+
verdict = ProblemVerdict.PA;
|
|
2499
|
+
}
|
|
2500
|
+
else if (second.verdict === ProblemVerdict.AC
|
|
2501
|
+
&& verdict !== ProblemVerdict.PA
|
|
2502
|
+
&& verdict !== ProblemVerdict.PE
|
|
2503
|
+
&& verdict !== ProblemVerdict.WA
|
|
2504
|
+
&& verdict !== ProblemVerdict.MLE
|
|
2505
|
+
&& verdict !== ProblemVerdict.TLE
|
|
2506
|
+
&& verdict !== ProblemVerdict.RE) {
|
|
2507
|
+
verdict = ProblemVerdict.AC;
|
|
2508
|
+
}
|
|
2509
|
+
return {
|
|
2510
|
+
timeUsed: Math.max(first.timeUsed, second.timeUsed),
|
|
2511
|
+
memoryUsed: Math.max(first.memoryUsed, second.memoryUsed),
|
|
2512
|
+
exitCode: first.exitCode || second.exitCode,
|
|
2513
|
+
verdict,
|
|
2514
|
+
};
|
|
2473
2515
|
};
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2476
|
-
|
|
2516
|
+
const getDataLog = (log) => {
|
|
2517
|
+
const lines = log?.split?.('\n') || [];
|
|
2518
|
+
let timeUsed = 0;
|
|
2519
|
+
let memoryUsed = 0;
|
|
2520
|
+
let exitCode = -1;
|
|
2521
|
+
if (lines.length > 4) {
|
|
2522
|
+
for (const line of lines) {
|
|
2523
|
+
if (line.startsWith('time:')) {
|
|
2524
|
+
timeUsed = +line.split(':')[1];
|
|
2525
|
+
if (Number.isNaN(timeUsed)) {
|
|
2526
|
+
timeUsed = 0;
|
|
2527
|
+
}
|
|
2528
|
+
timeUsed *= 1000;
|
|
2529
|
+
}
|
|
2530
|
+
else if (line.startsWith('max-rss:')) {
|
|
2531
|
+
memoryUsed = parseInt(line.split(':')[1], 10); // en KB
|
|
2532
|
+
}
|
|
2533
|
+
else if (line.startsWith('exitcode:')) {
|
|
2534
|
+
exitCode = parseInt(line.split(':')[1], 10);
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
else if (lines.length >= 3) {
|
|
2539
|
+
timeUsed = +lines[0];
|
|
2540
|
+
memoryUsed = +lines[1];
|
|
2541
|
+
exitCode = +lines[2];
|
|
2542
|
+
}
|
|
2543
|
+
return {
|
|
2544
|
+
timeUsed: Number.isNaN(timeUsed) ? 0 : timeUsed,
|
|
2545
|
+
memoryUsed: Number.isNaN(memoryUsed) ? 0 : memoryUsed,
|
|
2546
|
+
exitCode: Number.isNaN(exitCode) ? -1 : exitCode,
|
|
2547
|
+
};
|
|
2477
2548
|
};
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2549
|
+
|
|
2550
|
+
function memorySizeOf(obj) {
|
|
2551
|
+
let bytes = 0;
|
|
2552
|
+
function sizeOf(obj) {
|
|
2553
|
+
if (obj !== null && obj !== undefined) {
|
|
2554
|
+
switch (typeof obj) {
|
|
2555
|
+
case "number":
|
|
2556
|
+
bytes += 8;
|
|
2557
|
+
break;
|
|
2558
|
+
case "string":
|
|
2559
|
+
bytes += obj.length * 2;
|
|
2560
|
+
break;
|
|
2561
|
+
case "boolean":
|
|
2562
|
+
bytes += 4;
|
|
2563
|
+
break;
|
|
2564
|
+
case "object":
|
|
2565
|
+
const objClass = Object.prototype.toString.call(obj).slice(8, -1);
|
|
2566
|
+
if (objClass === "Object" || objClass === "Array") {
|
|
2567
|
+
for (const key in obj) {
|
|
2568
|
+
if (!obj.hasOwnProperty(key))
|
|
2569
|
+
continue;
|
|
2570
|
+
bytes += key.length * 2;
|
|
2571
|
+
sizeOf(obj[key]);
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2574
|
+
else
|
|
2575
|
+
bytes += obj.toString().length * 2;
|
|
2576
|
+
break;
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
return bytes;
|
|
2580
|
+
}
|
|
2581
|
+
return sizeOf(obj);
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/* eslint-disable no-extend-native */
|
|
2585
|
+
Date.prototype.changeYear = function (year) {
|
|
2586
|
+
const newDate = new Date(this);
|
|
2587
|
+
newDate.setFullYear(year);
|
|
2588
|
+
return newDate;
|
|
2481
2589
|
};
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2590
|
+
Date.prototype.changeMonth = function (monthIndex) {
|
|
2591
|
+
const newDate = new Date(this);
|
|
2592
|
+
newDate.setMonth(monthIndex);
|
|
2593
|
+
return newDate;
|
|
2485
2594
|
};
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2595
|
+
Date.prototype.changeDay = function (date) {
|
|
2596
|
+
const newDate = new Date(this);
|
|
2597
|
+
newDate.setDate(date);
|
|
2598
|
+
return newDate;
|
|
2489
2599
|
};
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2600
|
+
Date.prototype.changeHours = function (hours) {
|
|
2601
|
+
const newDate = new Date(this);
|
|
2602
|
+
newDate.setHours(hours);
|
|
2603
|
+
return newDate;
|
|
2493
2604
|
};
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2605
|
+
Date.prototype.changeMinutes = function (minutes) {
|
|
2606
|
+
const newDate = new Date(this);
|
|
2607
|
+
newDate.setMinutes(minutes);
|
|
2608
|
+
return newDate;
|
|
2497
2609
|
};
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2610
|
+
Date.prototype.changeSeconds = function (seconds) {
|
|
2611
|
+
const newDate = new Date(this);
|
|
2612
|
+
newDate.setSeconds(seconds);
|
|
2613
|
+
return newDate;
|
|
2501
2614
|
};
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2615
|
+
Date.prototype.changeMilliseconds = function (milliseconds) {
|
|
2616
|
+
const newDate = new Date(this);
|
|
2617
|
+
newDate.setMilliseconds(milliseconds);
|
|
2618
|
+
return newDate;
|
|
2506
2619
|
};
|
|
2507
|
-
|
|
2508
|
-
return
|
|
2509
|
-
&& event?.event === WebSocketResponseEvent.SUBMISSIONS_CRAWL
|
|
2510
|
-
&& !!event?.content;
|
|
2620
|
+
Date.prototype.decreaseYear = function (count = 1) {
|
|
2621
|
+
return this.changeYear(this.getFullYear() - count);
|
|
2511
2622
|
};
|
|
2512
|
-
|
|
2513
|
-
return
|
|
2514
|
-
&& event?.event === WebSocketResponseEvent.CONTEST_CHANGES
|
|
2515
|
-
&& !!event?.content;
|
|
2623
|
+
Date.prototype.increaseYear = function (count = 1) {
|
|
2624
|
+
return this.changeYear(this.getFullYear() + count);
|
|
2516
2625
|
};
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2626
|
+
Date.prototype.decreaseMonth = function () {
|
|
2627
|
+
const newDate = new Date(this);
|
|
2628
|
+
newDate.setMonth(newDate.getMonth() - 1);
|
|
2629
|
+
return newDate;
|
|
2520
2630
|
};
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
].includes(event?.event)
|
|
2526
|
-
&& !!event?.content;
|
|
2631
|
+
Date.prototype.increaseMonth = function () {
|
|
2632
|
+
const newDate = new Date(this);
|
|
2633
|
+
newDate.setMonth(newDate.getMonth() + 1);
|
|
2634
|
+
return newDate;
|
|
2527
2635
|
};
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2636
|
+
Date.prototype.increaseDay = function () {
|
|
2637
|
+
const newDate = new Date(this);
|
|
2638
|
+
newDate.setDate(newDate.getDate() + 1);
|
|
2639
|
+
return newDate;
|
|
2531
2640
|
};
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2641
|
+
Date.prototype.decreaseDay = function () {
|
|
2642
|
+
const newDate = new Date(this);
|
|
2643
|
+
newDate.setDate(newDate.getDate() - 1);
|
|
2644
|
+
return newDate;
|
|
2535
2645
|
};
|
|
2536
|
-
|
|
2537
|
-
const
|
|
2538
|
-
|
|
2646
|
+
Date.prototype.startOfYear = function () {
|
|
2647
|
+
const newDate = new Date(this);
|
|
2648
|
+
newDate.setMonth(0);
|
|
2649
|
+
return newDate.startOfMonth();
|
|
2539
2650
|
};
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
// const aYearMilliseconds = 1000 * 60 * 60 * 24 * 365;
|
|
2544
|
-
// const remainingYears = Math.floor(timeRemaining / aYearMilliseconds);
|
|
2545
|
-
// remaining.push({ remaining: remainingYears, label: 'years', milliseconds: aYearMilliseconds });
|
|
2546
|
-
// const aWeekMilliseconds = 1000 * 60 * 60 * 24 * 7;
|
|
2547
|
-
// const remainingWeeks = Math.floor((timeRemaining % aYearMilliseconds) / aWeekMilliseconds);
|
|
2548
|
-
// remaining.push({ remaining: remainingWeeks, label: 'weeks', milliseconds: aWeekMilliseconds });
|
|
2549
|
-
const aSecondMilliseconds = 1000;
|
|
2550
|
-
const aMinuteMilliseconds = aSecondMilliseconds * 60;
|
|
2551
|
-
const aHourMilliseconds = aMinuteMilliseconds * 60;
|
|
2552
|
-
const aDayMilliseconds = aHourMilliseconds * 24;
|
|
2553
|
-
const aWeekMilliseconds = aDayMilliseconds * 7;
|
|
2554
|
-
const remainingWeeks = Math.floor(timeRemaining / aWeekMilliseconds);
|
|
2555
|
-
remaining.push({
|
|
2556
|
-
remaining: remainingWeeks,
|
|
2557
|
-
label: remainingWeeks === 1 ? 'week' : 'weeks',
|
|
2558
|
-
abbreviatedLabel: 'w',
|
|
2559
|
-
milliseconds: aWeekMilliseconds,
|
|
2560
|
-
digits: 2,
|
|
2561
|
-
});
|
|
2562
|
-
const remainingDays = Math.floor((timeRemaining % aWeekMilliseconds) / aDayMilliseconds);
|
|
2563
|
-
remaining.push({
|
|
2564
|
-
remaining: remainingDays,
|
|
2565
|
-
label: remainingDays === 1 ? 'day' : 'days',
|
|
2566
|
-
abbreviatedLabel: 'd',
|
|
2567
|
-
milliseconds: aDayMilliseconds,
|
|
2568
|
-
digits: 2,
|
|
2569
|
-
});
|
|
2570
|
-
const remainingHours = Math.floor((timeRemaining % aDayMilliseconds) / aHourMilliseconds);
|
|
2571
|
-
remaining.push({
|
|
2572
|
-
remaining: remainingHours,
|
|
2573
|
-
label: remainingHours === 1 ? 'hour' : 'hours',
|
|
2574
|
-
abbreviatedLabel: 'h',
|
|
2575
|
-
milliseconds: aHourMilliseconds,
|
|
2576
|
-
digits: 2,
|
|
2577
|
-
});
|
|
2578
|
-
const remainingMinutes = Math.floor((timeRemaining % aHourMilliseconds) / aMinuteMilliseconds);
|
|
2579
|
-
remaining.push({
|
|
2580
|
-
remaining: remainingMinutes,
|
|
2581
|
-
label: remainingMinutes === 1 ? 'minute' : 'minutes',
|
|
2582
|
-
abbreviatedLabel: 'm',
|
|
2583
|
-
milliseconds: aMinuteMilliseconds,
|
|
2584
|
-
digits: 2,
|
|
2585
|
-
});
|
|
2586
|
-
const remainingSeconds = Math.floor((timeRemaining % aMinuteMilliseconds) / aSecondMilliseconds);
|
|
2587
|
-
remaining.push({
|
|
2588
|
-
remaining: remainingSeconds,
|
|
2589
|
-
label: remainingSeconds === 1 ? 'second' : 'seconds',
|
|
2590
|
-
abbreviatedLabel: 's',
|
|
2591
|
-
milliseconds: aSecondMilliseconds,
|
|
2592
|
-
digits: 2,
|
|
2593
|
-
});
|
|
2594
|
-
const remainingMilliseconds = Math.floor(timeRemaining % aSecondMilliseconds);
|
|
2595
|
-
remaining.push({
|
|
2596
|
-
remaining: remainingMilliseconds,
|
|
2597
|
-
label: remainingMilliseconds === 1 ? 'millisecond' : 'milliseconds',
|
|
2598
|
-
abbreviatedLabel: 'ms',
|
|
2599
|
-
milliseconds: 1,
|
|
2600
|
-
digits: 3,
|
|
2601
|
-
});
|
|
2602
|
-
// while (remaining[0].remaining <= 0) {
|
|
2603
|
-
// remaining.shift();
|
|
2604
|
-
// if (remaining.length === 3) {
|
|
2605
|
-
// break;
|
|
2606
|
-
// }
|
|
2607
|
-
// }
|
|
2608
|
-
return remaining;
|
|
2609
|
-
}
|
|
2610
|
-
function normalizeToLocalStartOfDay(timestamp) {
|
|
2611
|
-
const date = new Date(timestamp);
|
|
2612
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
2613
|
-
}
|
|
2614
|
-
function normalizeToLocalStartOfHour(timestamp) {
|
|
2615
|
-
const date = new Date(timestamp);
|
|
2616
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours());
|
|
2617
|
-
}
|
|
2618
|
-
function normalizeToLocalStartOfMinutes(timestamp) {
|
|
2619
|
-
const date = new Date(timestamp);
|
|
2620
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
2621
|
-
}
|
|
2622
|
-
function normalizeToLocalStartOfSeconds(timestamp) {
|
|
2623
|
-
const date = new Date(timestamp);
|
|
2624
|
-
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
2625
|
-
}
|
|
2626
|
-
const getYears = (d) => d.getFullYear();
|
|
2627
|
-
const getMonths = (d) => d.getFullYear() * 12 + d.getMonth();
|
|
2628
|
-
const getDays = (d) => {
|
|
2629
|
-
return Math.floor(normalizeToLocalStartOfDay(d).getTime() / ONE_DAY);
|
|
2651
|
+
Date.prototype.endOfYear = function () {
|
|
2652
|
+
const nextMonth = this.increaseYear().startOfYear();
|
|
2653
|
+
return new Date(nextMonth.getTime() - 1);
|
|
2630
2654
|
};
|
|
2631
|
-
|
|
2632
|
-
|
|
2655
|
+
Date.prototype.startOfMonth = function () {
|
|
2656
|
+
const newDate = new Date(this);
|
|
2657
|
+
newDate.setDate(1);
|
|
2658
|
+
return newDate.startOfDay();
|
|
2633
2659
|
};
|
|
2634
|
-
|
|
2635
|
-
|
|
2660
|
+
Date.prototype.endOfMonth = function () {
|
|
2661
|
+
const nextMonth = this.increaseMonth().startOfMonth();
|
|
2662
|
+
return new Date(nextMonth.getTime() - 1);
|
|
2636
2663
|
};
|
|
2637
|
-
|
|
2638
|
-
|
|
2664
|
+
Date.prototype.startOfWeek = function () {
|
|
2665
|
+
const newDate = new Date(this);
|
|
2666
|
+
while (newDate.getDay()) {
|
|
2667
|
+
newDate.setDate(newDate.getDate() - 1);
|
|
2668
|
+
}
|
|
2669
|
+
return newDate.startOfDay();
|
|
2639
2670
|
};
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2671
|
+
Date.prototype.endOfWeek = function () {
|
|
2672
|
+
const newDate = new Date(this);
|
|
2673
|
+
while (newDate.getDay() < 6) {
|
|
2674
|
+
newDate.setDate(newDate.getDate() - 1);
|
|
2675
|
+
}
|
|
2676
|
+
return newDate.endOfDay();
|
|
2644
2677
|
};
|
|
2645
|
-
|
|
2646
|
-
const
|
|
2647
|
-
|
|
2678
|
+
Date.prototype.startOfDay = function () {
|
|
2679
|
+
const newDate = new Date(this);
|
|
2680
|
+
newDate.setHours(0, 0, 0, 0);
|
|
2681
|
+
return newDate;
|
|
2648
2682
|
};
|
|
2649
|
-
|
|
2650
|
-
|
|
2683
|
+
Date.prototype.endOfDay = function () {
|
|
2684
|
+
const newDate = new Date(this);
|
|
2685
|
+
newDate.setHours(23, 59, 59, 999);
|
|
2686
|
+
return newDate;
|
|
2651
2687
|
};
|
|
2652
|
-
|
|
2653
|
-
const
|
|
2654
|
-
|
|
2688
|
+
Date.prototype.startOfHour = function () {
|
|
2689
|
+
const newDate = new Date(this);
|
|
2690
|
+
newDate.setMinutes(0, 0, 0);
|
|
2691
|
+
return newDate;
|
|
2655
2692
|
};
|
|
2656
|
-
|
|
2657
|
-
const
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
title: '',
|
|
2661
|
-
points: 0,
|
|
2662
|
-
});
|
|
2663
|
-
const ASPECT_RATIO = {
|
|
2664
|
-
[AspectRatio.RATIO_21_9]: {
|
|
2665
|
-
aspectRatio: AspectRatio.RATIO_21_9,
|
|
2666
|
-
width: 2520,
|
|
2667
|
-
height: 1080,
|
|
2668
|
-
decimal: 21 / 9,
|
|
2669
|
-
label: 'ultrawide',
|
|
2670
|
-
},
|
|
2671
|
-
[AspectRatio.RATIO_20_9]: {
|
|
2672
|
-
aspectRatio: AspectRatio.RATIO_20_9,
|
|
2673
|
-
width: 2400,
|
|
2674
|
-
height: 1080,
|
|
2675
|
-
decimal: 20 / 9,
|
|
2676
|
-
label: 'mobile wide',
|
|
2677
|
-
},
|
|
2678
|
-
[AspectRatio.RATIO_16_9]: {
|
|
2679
|
-
aspectRatio: AspectRatio.RATIO_16_9,
|
|
2680
|
-
width: 1920,
|
|
2681
|
-
height: 1080,
|
|
2682
|
-
decimal: 16 / 9,
|
|
2683
|
-
label: 'widescreen',
|
|
2684
|
-
},
|
|
2685
|
-
[AspectRatio.RATIO_16_10]: {
|
|
2686
|
-
aspectRatio: AspectRatio.RATIO_16_10,
|
|
2687
|
-
width: 1920,
|
|
2688
|
-
height: 1200,
|
|
2689
|
-
decimal: 16 / 10,
|
|
2690
|
-
label: 'widescreen tall',
|
|
2691
|
-
},
|
|
2692
|
-
[AspectRatio.RATIO_3_2]: {
|
|
2693
|
-
aspectRatio: AspectRatio.RATIO_3_2,
|
|
2694
|
-
width: 1440,
|
|
2695
|
-
height: 960,
|
|
2696
|
-
decimal: 3 / 2,
|
|
2697
|
-
label: 'balanced',
|
|
2698
|
-
},
|
|
2699
|
-
[AspectRatio.RATIO_4_3]: {
|
|
2700
|
-
aspectRatio: AspectRatio.RATIO_4_3,
|
|
2701
|
-
width: 1024,
|
|
2702
|
-
height: 768,
|
|
2703
|
-
decimal: 4 / 3,
|
|
2704
|
-
label: 'standard',
|
|
2705
|
-
},
|
|
2706
|
-
[AspectRatio.RATIO_5_4]: {
|
|
2707
|
-
aspectRatio: AspectRatio.RATIO_5_4,
|
|
2708
|
-
width: 1280,
|
|
2709
|
-
height: 1024,
|
|
2710
|
-
decimal: 5 / 4,
|
|
2711
|
-
label: 'square old',
|
|
2712
|
-
},
|
|
2713
|
-
[AspectRatio.RATIO_1_1]: {
|
|
2714
|
-
aspectRatio: AspectRatio.RATIO_1_1,
|
|
2715
|
-
width: 1000,
|
|
2716
|
-
height: 1000,
|
|
2717
|
-
decimal: 1,
|
|
2718
|
-
label: 'square',
|
|
2719
|
-
},
|
|
2693
|
+
Date.prototype.endOfHour = function () {
|
|
2694
|
+
const newDate = new Date(this);
|
|
2695
|
+
newDate.setMinutes(59, 59, 999);
|
|
2696
|
+
return newDate;
|
|
2720
2697
|
};
|
|
2721
|
-
|
|
2722
|
-
const
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
sheets.unshift(NEW_PAGE_SHEET());
|
|
2726
|
-
}
|
|
2727
|
-
let newPage = sheets[0];
|
|
2728
|
-
let content = [];
|
|
2729
|
-
const sheetsByPages = [];
|
|
2730
|
-
for (let i = 1; i < sheets.length; i++) {
|
|
2731
|
-
const sheet = sheets[i];
|
|
2732
|
-
if (sheet.type === WorksheetType.NEW_PAGE) {
|
|
2733
|
-
sheetsByPages.push({
|
|
2734
|
-
header: newPage,
|
|
2735
|
-
content: [...content],
|
|
2736
|
-
});
|
|
2737
|
-
newPage = sheet;
|
|
2738
|
-
content = [];
|
|
2739
|
-
}
|
|
2740
|
-
else {
|
|
2741
|
-
content.push(sheet);
|
|
2742
|
-
}
|
|
2743
|
-
}
|
|
2744
|
-
sheetsByPages.push({
|
|
2745
|
-
header: newPage,
|
|
2746
|
-
content: [...content],
|
|
2747
|
-
});
|
|
2748
|
-
return sheetsByPages;
|
|
2698
|
+
Date.prototype.startOfMinute = function () {
|
|
2699
|
+
const newDate = new Date(this);
|
|
2700
|
+
newDate.setSeconds(0, 0);
|
|
2701
|
+
return newDate;
|
|
2749
2702
|
};
|
|
2750
|
-
|
|
2751
|
-
const
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
}
|
|
2755
|
-
let newPage = sheets[0];
|
|
2756
|
-
let content = [];
|
|
2757
|
-
const sheetsByPages = [];
|
|
2758
|
-
for (let i = 1; i < sheets.length; i++) {
|
|
2759
|
-
const sheet = sheets[i];
|
|
2760
|
-
if (sheet.type === WorksheetType.NEW_PAGE) {
|
|
2761
|
-
sheetsByPages.push({
|
|
2762
|
-
header: newPage,
|
|
2763
|
-
content: content.map(c => ({
|
|
2764
|
-
id: c.id,
|
|
2765
|
-
type: c.type,
|
|
2766
|
-
title: c.title,
|
|
2767
|
-
points: c.points,
|
|
2768
|
-
})),
|
|
2769
|
-
});
|
|
2770
|
-
newPage = sheet;
|
|
2771
|
-
content = [];
|
|
2772
|
-
}
|
|
2773
|
-
else {
|
|
2774
|
-
content.push(sheet);
|
|
2775
|
-
}
|
|
2776
|
-
}
|
|
2777
|
-
sheetsByPages.push({
|
|
2778
|
-
header: newPage,
|
|
2779
|
-
content: [...content],
|
|
2780
|
-
});
|
|
2781
|
-
return sheetsByPages;
|
|
2703
|
+
Date.prototype.endOfMinute = function () {
|
|
2704
|
+
const newDate = new Date(this);
|
|
2705
|
+
newDate.setSeconds(59, 999);
|
|
2706
|
+
return newDate;
|
|
2782
2707
|
};
|
|
2783
|
-
|
|
2784
|
-
const
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
&& typeof value?.title == 'string'
|
|
2788
|
-
&& typeof value?.points == 'number';
|
|
2708
|
+
Date.prototype.startOfSecond = function () {
|
|
2709
|
+
const newDate = new Date(this);
|
|
2710
|
+
newDate.setMilliseconds(0);
|
|
2711
|
+
return newDate;
|
|
2789
2712
|
};
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2713
|
+
Date.prototype.endOfSecond = function () {
|
|
2714
|
+
const newDate = new Date(this);
|
|
2715
|
+
newDate.setMilliseconds(999);
|
|
2716
|
+
return newDate;
|
|
2794
2717
|
};
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
&& typeof value?.sourceCode === 'object' && value?.sourceCode !== null
|
|
2799
|
-
&& value?.testCases === 'object' && value?.testCases !== null
|
|
2800
|
-
&& Array.isArray(value?.languages)
|
|
2801
|
-
&& typeof value?.height == 'number';
|
|
2718
|
+
Date.prototype.isToday = function () {
|
|
2719
|
+
const today = new Date();
|
|
2720
|
+
return this.isSameDay(today);
|
|
2802
2721
|
};
|
|
2803
|
-
|
|
2804
|
-
return
|
|
2805
|
-
&& value?.type === WorksheetType.QUIZ_PROBLEM
|
|
2806
|
-
&& Object.values(Judge).includes(value?.problemJudge) || typeof value?.problemJudge === 'string'
|
|
2807
|
-
&& typeof value?.problemKey == 'string'
|
|
2808
|
-
&& Array.isArray(value?.languages)
|
|
2809
|
-
&& typeof value?.height == 'number';
|
|
2722
|
+
Date.prototype.isEqual = function (date) {
|
|
2723
|
+
return this.getTime() === date.getTime();
|
|
2810
2724
|
};
|
|
2811
|
-
|
|
2812
|
-
return
|
|
2813
|
-
&& value?.type === WorksheetType.QUIZ_OPTIONS
|
|
2814
|
-
&& typeof value?.description == 'string'
|
|
2815
|
-
&& Array.isArray(value?.options)
|
|
2816
|
-
&& value?.options.every((option) => typeof option?.label == 'string' && typeof option?.correct == 'boolean' && typeof option?.id == 'string')
|
|
2817
|
-
&& typeof value?.multiple == 'boolean'
|
|
2818
|
-
&& (value?.scoringMode === 'TOTAL' || value?.scoringMode === 'PARTIAL');
|
|
2725
|
+
Date.prototype.isSameYear = function (date) {
|
|
2726
|
+
return this.getFullYear() === date.getFullYear();
|
|
2819
2727
|
};
|
|
2820
|
-
|
|
2821
|
-
return
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2728
|
+
Date.prototype.isSameMonth = function (date) {
|
|
2729
|
+
return this.isSameYear(date) && this.getMonth() === date.getMonth();
|
|
2730
|
+
};
|
|
2731
|
+
Date.prototype.isSameDay = function (date) {
|
|
2732
|
+
return this.isSameMonth(date) && this.getDate() === date.getDate();
|
|
2733
|
+
};
|
|
2734
|
+
Date.prototype.isSameHour = function (date) {
|
|
2735
|
+
return this.isSameDay(date) && this.getHours() === date.getHours();
|
|
2736
|
+
};
|
|
2737
|
+
Date.prototype.isSameMinute = function (date) {
|
|
2738
|
+
return this.isSameHour(date) && this.getMinutes() === date.getMinutes();
|
|
2739
|
+
};
|
|
2740
|
+
Date.prototype.isSameSecond = function (date) {
|
|
2741
|
+
return this.isSameMinute(date) && this.getSeconds() === date.getSeconds();
|
|
2742
|
+
};
|
|
2743
|
+
Date.prototype.isSameMillisecond = function (date) {
|
|
2744
|
+
return this.isEqual(date);
|
|
2745
|
+
};
|
|
2746
|
+
Date.prototype.isValidDate = function () {
|
|
2747
|
+
return this instanceof Date && !isNaN(this.getTime());
|
|
2748
|
+
};
|
|
2749
|
+
Date.prototype.isYearAfter = function (date) {
|
|
2750
|
+
return this.getFullYear() > date.getFullYear();
|
|
2751
|
+
};
|
|
2752
|
+
Date.prototype.isMonthAfter = function (date) {
|
|
2753
|
+
return this.isYearAfter(date) || (this.isSameYear(date) && this.getMonth() > date.getMonth());
|
|
2754
|
+
};
|
|
2755
|
+
Date.prototype.isDayAfter = function (date) {
|
|
2756
|
+
return this.isMonthAfter(date) || (this.isSameMonth(date) && this.getDate() > date.getDate());
|
|
2757
|
+
};
|
|
2758
|
+
Date.prototype.isHoursAfter = function (date) {
|
|
2759
|
+
return this.isDayAfter(date) || (this.isSameDay(date) && this.getHours() > date.getHours());
|
|
2760
|
+
};
|
|
2761
|
+
Date.prototype.isMinutesAfter = function (date) {
|
|
2762
|
+
return this.isHoursAfter(date) || (this.isSameHour(date) && this.getMinutes() > date.getMinutes());
|
|
2763
|
+
};
|
|
2764
|
+
Date.prototype.isSecondsAfter = function (date) {
|
|
2765
|
+
return this.isMinutesAfter(date) || (this.isSameMinute(date) && this.getSeconds() > date.getSeconds());
|
|
2766
|
+
};
|
|
2767
|
+
Date.prototype.isMillisecondsAfter = function (date) {
|
|
2768
|
+
return this.isSecondsAfter(date) || (this.isSameSecond(date) && this.getMilliseconds() > date.getMilliseconds());
|
|
2769
|
+
};
|
|
2770
|
+
Date.prototype.isAfter = function (date) {
|
|
2771
|
+
return this.getTime() > date.getTime();
|
|
2772
|
+
};
|
|
2773
|
+
Date.prototype.isYearBefore = function (date) {
|
|
2774
|
+
return this.getFullYear() < date.getFullYear();
|
|
2775
|
+
};
|
|
2776
|
+
Date.prototype.isMonthBefore = function (date) {
|
|
2777
|
+
return this.isYearBefore(date) || (this.isSameYear(date) && this.getMonth() < date.getMonth());
|
|
2778
|
+
};
|
|
2779
|
+
Date.prototype.isDayBefore = function (date) {
|
|
2780
|
+
return this.isMonthBefore(date) || (this.isSameMonth(date) && this.getDate() < date.getDate());
|
|
2781
|
+
};
|
|
2782
|
+
Date.prototype.isHoursBefore = function (date) {
|
|
2783
|
+
return this.isDayBefore(date) || (this.isSameDay(date) && this.getHours() < date.getHours());
|
|
2784
|
+
};
|
|
2785
|
+
Date.prototype.isMinutesBefore = function (date) {
|
|
2786
|
+
return this.isHoursBefore(date) || (this.isSameHour(date) && this.getMinutes() < date.getMinutes());
|
|
2787
|
+
};
|
|
2788
|
+
Date.prototype.isSecondsBefore = function (date) {
|
|
2789
|
+
return this.isMinutesBefore(date) || (this.isSameMinute(date) && this.getSeconds() < date.getSeconds());
|
|
2790
|
+
};
|
|
2791
|
+
Date.prototype.isMillisecondsBefore = function (date) {
|
|
2792
|
+
return this.isSecondsBefore(date) || (this.isSameSecond(date) && this.getMilliseconds() < date.getMilliseconds());
|
|
2793
|
+
};
|
|
2794
|
+
Date.prototype.isBefore = function (date) {
|
|
2795
|
+
return this.getTime() < date.getTime();
|
|
2796
|
+
};
|
|
2797
|
+
Date.prototype.isWithinInterval = function ({ start, end }, cmp = '[]') {
|
|
2798
|
+
return (cmp.charAt(0) === '[' ? this.isEqual(start) || this.isAfter(start) : this.isAfter(start)) &&
|
|
2799
|
+
(cmp.charAt(1) === '[' ? this.isEqual(end) || this.isBefore(end) : this.isBefore(end));
|
|
2826
2800
|
};
|
|
2827
2801
|
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
];
|
|
2843
|
-
const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
2844
|
-
const HOURS = range(0, 24);
|
|
2845
|
-
const MINUTES = range(0, 60);
|
|
2846
|
-
const SECONDS = range(0, 60);
|
|
2847
|
-
const MILLISECONDS = range(0, 1000);
|
|
2848
|
-
const MAX_DATE = new Date(8640000000000000);
|
|
2849
|
-
const MIN_DATE = new Date(0);
|
|
2802
|
+
class JkError extends Error {
|
|
2803
|
+
constructor(code, custom) {
|
|
2804
|
+
const message = custom?.message || ERROR[code].message;
|
|
2805
|
+
super(message);
|
|
2806
|
+
this.message = message;
|
|
2807
|
+
this.code = code;
|
|
2808
|
+
if (custom?.stack) {
|
|
2809
|
+
this.stack = custom.stack;
|
|
2810
|
+
}
|
|
2811
|
+
if (custom?.data) {
|
|
2812
|
+
this.data = custom.data;
|
|
2813
|
+
}
|
|
2814
|
+
}
|
|
2815
|
+
}
|
|
2850
2816
|
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
height="56px"
|
|
2859
|
-
style="padding:10px; box-sizing: border-box"
|
|
2860
|
-
/>
|
|
2861
|
-
</div>
|
|
2862
|
-
</div>
|
|
2863
|
-
<div style="padding: 24px; color: #333333; font-family: sans-serif; font-size: 16px; line-height: 24px;">
|
|
2864
|
-
<div style="max-width: 520px; margin: 0 auto; padding: 24px; background: white; border-radius: 6px;">
|
|
2865
|
-
<section style="padding: 0 0 1em 0; border-bottom: 1px solid #828282;">
|
|
2866
|
-
{{content}}
|
|
2867
|
-
</section>
|
|
2868
|
-
<div style="font-size: 14px; text-align: center; color: #828282; line-height: 16px; padding-top: 1em">
|
|
2869
|
-
<p style="margin: 0;">
|
|
2870
|
-
Si tú no realizaste la solicitud, escribenos a
|
|
2871
|
-
<a href="mailto:${SUPPORT_EMAIL}" style="color: #2468A6; text-decoration: none;">
|
|
2872
|
-
${SUPPORT_EMAIL}
|
|
2873
|
-
</a>
|
|
2874
|
-
</p>
|
|
2875
|
-
<p style="margin: 0;">
|
|
2876
|
-
Este mensaje fue enviado por el equipo de
|
|
2877
|
-
<a href="https://juki.app" style="color: #2468A6; text-decoration: none;">
|
|
2878
|
-
juki.app
|
|
2879
|
-
</a>
|
|
2880
|
-
</p>
|
|
2881
|
-
</div>
|
|
2882
|
-
</div>
|
|
2883
|
-
</div>
|
|
2884
|
-
</div>`;
|
|
2817
|
+
/* eslint-disable no-extend-native */
|
|
2818
|
+
Number.prototype.padStart = function (maxLength, fillString = '0') {
|
|
2819
|
+
return (this + '').padStart(maxLength, fillString);
|
|
2820
|
+
};
|
|
2821
|
+
Number.prototype.padEnd = function (maxLength, fillString = '0') {
|
|
2822
|
+
return (this + '').padEnd(maxLength, fillString);
|
|
2823
|
+
};
|
|
2885
2824
|
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2825
|
+
function toJkError(err) {
|
|
2826
|
+
const error = new Error();
|
|
2827
|
+
let code = err?.code;
|
|
2828
|
+
if (!(code in ErrorCode)) {
|
|
2829
|
+
code = ErrorCode.ERR500;
|
|
2830
|
+
}
|
|
2831
|
+
return new JkError(code, {
|
|
2832
|
+
message: err?.message || error.message,
|
|
2833
|
+
stack: err?.stack || error.stack,
|
|
2834
|
+
data: err?.data || null,
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
function errorsResponse(message, ...errors) {
|
|
2838
|
+
return {
|
|
2839
|
+
success: false,
|
|
2840
|
+
message: message,
|
|
2841
|
+
errors: errors.map(error => ({
|
|
2842
|
+
code: error.code,
|
|
2843
|
+
message: error.message,
|
|
2844
|
+
detail: error.stack || new Error().stack || '',
|
|
2845
|
+
data: error.data,
|
|
2846
|
+
})),
|
|
2847
|
+
};
|
|
2848
|
+
}
|
|
2849
|
+
function contentResponse(message, content) {
|
|
2850
|
+
return {
|
|
2851
|
+
success: true,
|
|
2852
|
+
message,
|
|
2853
|
+
content,
|
|
2854
|
+
};
|
|
2855
|
+
}
|
|
2856
|
+
function contentsResponse(message, contents, meta) {
|
|
2857
|
+
return {
|
|
2858
|
+
success: true,
|
|
2859
|
+
message,
|
|
2860
|
+
contents,
|
|
2861
|
+
meta,
|
|
2862
|
+
};
|
|
2863
|
+
}
|
|
2864
|
+
const cleanRequest = (responseText) => {
|
|
2865
|
+
if (!isStringJson(responseText)) {
|
|
2866
|
+
// this occurs when the endpoint don't exits or server is down
|
|
2867
|
+
const response = {
|
|
2868
|
+
success: false,
|
|
2869
|
+
message: ERROR[ErrorCode.ERR9999].message,
|
|
2870
|
+
errors: [{ code: ErrorCode.ERR9999, detail: '', message: ERROR[ErrorCode.ERR9999].message }],
|
|
2871
|
+
};
|
|
2872
|
+
consoleError({ message: 'response is not string json, success false on cleaning request', responseText, response });
|
|
2873
|
+
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2874
|
+
return response;
|
|
2875
|
+
}
|
|
2876
|
+
const responseJson = JSON.parse(responseText);
|
|
2877
|
+
if (typeof responseJson.success === 'boolean') {
|
|
2878
|
+
if (responseJson.success === true && typeof responseJson.message === 'string' && responseJson.content) { // V1
|
|
2879
|
+
return {
|
|
2880
|
+
success: true,
|
|
2881
|
+
message: responseJson.message,
|
|
2882
|
+
content: responseJson.content,
|
|
2883
|
+
};
|
|
2884
|
+
}
|
|
2885
|
+
else if (responseJson.success === true && typeof responseJson.message === 'string' && Array.isArray(responseJson.contents) && responseJson.meta) { // V1
|
|
2886
|
+
return {
|
|
2887
|
+
success: true,
|
|
2888
|
+
message: responseJson.message,
|
|
2889
|
+
contents: responseJson.contents,
|
|
2890
|
+
meta: responseJson.meta,
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
else if (responseJson.success === false && typeof responseJson.message === 'string' && Array.isArray(responseJson.errors)) { // V1
|
|
2894
|
+
const response = {
|
|
2895
|
+
success: false,
|
|
2896
|
+
message: responseJson.message,
|
|
2897
|
+
errors: responseJson.errors,
|
|
2898
|
+
};
|
|
2899
|
+
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2900
|
+
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2901
|
+
return response;
|
|
2902
|
+
}
|
|
2903
|
+
}
|
|
2904
|
+
const response = {
|
|
2905
|
+
success: false,
|
|
2906
|
+
message: ERROR[ErrorCode.ERR9998].message,
|
|
2907
|
+
errors: [{ code: ErrorCode.ERR9998, detail: '', message: ERROR[ErrorCode.ERR9998].message }],
|
|
2908
|
+
};
|
|
2909
|
+
consoleError({ message: 'success false on cleaning request', responseText, response });
|
|
2910
|
+
// jukiApiManager.reportError({ message: 'success false on cleaning request', responseText, response });
|
|
2911
|
+
return response;
|
|
2912
|
+
};
|
|
2913
|
+
const getDefaultMeta = (contents, sort) => {
|
|
2914
|
+
return { sort: sort ?? [], page: 1, size: contents.length, totalElements: contents.length, filter: {} };
|
|
2915
|
+
};
|
|
2903
2916
|
|
|
2904
|
-
const
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
// label: '',
|
|
2908
|
-
// logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
2909
|
-
// logoSize: [ 883.991, 435 ],
|
|
2910
|
-
// url: '',
|
|
2911
|
-
// // getLoginUrl: () => '',
|
|
2912
|
-
// // getProfileUrl: () => '',
|
|
2913
|
-
// // getSubmitUrl: () => '',
|
|
2914
|
-
// // getSubmissionUrl: () => '',
|
|
2915
|
-
// // getProblemUrl: (key: string) => `/problem/view/${key}`,
|
|
2916
|
-
// // getUserSubmissionsUrl: () => '',
|
|
2917
|
-
// },
|
|
2918
|
-
[Judge.JUKI_JUDGE]: {
|
|
2919
|
-
value: Judge.JUKI_JUDGE,
|
|
2920
|
-
label: 'Juki Judge',
|
|
2921
|
-
logo: 'https://images.juki.pub/c/juki-judge-logo-horizontal-color.svg',
|
|
2922
|
-
logoSize: [883.991, 435],
|
|
2923
|
-
url: 'https://judge.juki.app',
|
|
2924
|
-
// getLoginUrl: () => '',
|
|
2925
|
-
// getProfileUrl: () => '',
|
|
2926
|
-
// getSubmitUrl: () => '',
|
|
2927
|
-
// getSubmissionUrl: () => '',
|
|
2928
|
-
// getProblemUrl: (key: string) => `https://judge.juki.app/problem/view/${key}`,
|
|
2929
|
-
// getUserSubmissionsUrl: () => '',
|
|
2930
|
-
},
|
|
2931
|
-
[Judge.CODEFORCES]: {
|
|
2932
|
-
value: Judge.CODEFORCES,
|
|
2933
|
-
label: 'Codeforces',
|
|
2934
|
-
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
2935
|
-
logoSize: [1232.75, 145.12],
|
|
2936
|
-
url: 'https://codeforces.com',
|
|
2937
|
-
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
2938
|
-
// getProfileUrl: () => '',
|
|
2939
|
-
// getSubmitUrl: () => 'https://codeforces.com/problemset/submit',
|
|
2940
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
2941
|
-
// const [ contestId ] = problemKey.split('-');
|
|
2942
|
-
// return `https://codeforces.com/problemset/submission/${contestId}/${submissionId}`;
|
|
2943
|
-
// },
|
|
2944
|
-
// getProblemUrl: (problemKey: string) => {
|
|
2945
|
-
// const [ contestId, index ] = problemKey.split('-');
|
|
2946
|
-
// return `https://codeforces.com/problemset/problem/${contestId}/${index}`;
|
|
2947
|
-
// },
|
|
2948
|
-
// getUserSubmissionsUrl: () => '',
|
|
2949
|
-
},
|
|
2950
|
-
[Judge.CODEFORCES_GYM]: {
|
|
2951
|
-
value: Judge.CODEFORCES_GYM,
|
|
2952
|
-
label: 'Codeforces Gym',
|
|
2953
|
-
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
2954
|
-
logoSize: [1232.75, 145.12],
|
|
2955
|
-
url: 'https://codeforces.com',
|
|
2956
|
-
// getLoginUrl: () => 'https://codeforces.com/enter',
|
|
2957
|
-
// getProfileUrl: () => '',
|
|
2958
|
-
// getSubmitUrl: (problemKey: string) => {
|
|
2959
|
-
// const [ gymContestId, index ] = problemKey.split('-');
|
|
2960
|
-
// return `https://codeforces.com/gym/${gymContestId}/submit`;
|
|
2961
|
-
// },
|
|
2962
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string) => {
|
|
2963
|
-
// const [ gymContestId ] = problemKey.split('-');
|
|
2964
|
-
// return `https://codeforces.com/gym/${gymContestId}/submission/${submissionId}`;
|
|
2965
|
-
// },
|
|
2966
|
-
// getProblemUrl: (problemKey: string) => {
|
|
2967
|
-
// const [ gymContestId, index ] = problemKey.split('-');
|
|
2968
|
-
// return `https://codeforces.com/gym/${gymContestId}/problem/${index}`;
|
|
2969
|
-
// },
|
|
2970
|
-
// getUserSubmissionsUrl: () => '',
|
|
2971
|
-
},
|
|
2972
|
-
[Judge.JV_UMSA]: {
|
|
2973
|
-
value: Judge.JV_UMSA,
|
|
2974
|
-
label: 'Juez Virtual UMSA',
|
|
2975
|
-
logo: 'https://images.juki.pub/c/codeforces-logo-horizontal-color.svg',
|
|
2976
|
-
logoSize: [1232.75, 145.12],
|
|
2977
|
-
url: 'https://jv.umsa.bo',
|
|
2978
|
-
// getLoginUrl: () => 'https://jv.umsa.bo/oj/login.php',
|
|
2979
|
-
// getProfileUrl: () => 'https://jv.umsa.bo/oj/userInfo.php',
|
|
2980
|
-
// getSubmitUrl: (problemKey: string) => {
|
|
2981
|
-
// // single problem: '1019'
|
|
2982
|
-
// // cib problem: '1019-A'
|
|
2983
|
-
// const isContestProblem = problemKey.includes('-');
|
|
2984
|
-
// // A -> 0, B -> 1, C -> 2, D -> 3, E -> 4, F -> 5, G -> 6, H -> 7, I -> 8, J -> 9
|
|
2985
|
-
// const params = problemKey.split('-');
|
|
2986
|
-
// return isContestProblem
|
|
2987
|
-
// ? `https://jv.umsa.bo/oj/submitpage.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
2988
|
-
// : `https://jv.umsa.bo/oj/submitpage.php?id=${problemKey}`;
|
|
2989
|
-
// },
|
|
2990
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string) => {
|
|
2991
|
-
// // return `https://jv.umsa.bo/status.php?problem_id=&user_id=${username}&language=-1&jresult=-1`;
|
|
2992
|
-
// return `https://jv.umsa.bo/oj/showsource.php?id=${submissionId}`;
|
|
2993
|
-
// },
|
|
2994
|
-
// getProblemUrl: (problemKey: string) => {
|
|
2995
|
-
// const isContestProblem = problemKey.includes('-');
|
|
2996
|
-
// const params = problemKey.split('-');
|
|
2997
|
-
// return isContestProblem
|
|
2998
|
-
// ? `https://jv.umsa.bo/oj/problem.php?cid=${params[0]}&pid=${params[1].charCodeAt(0) - 65}`
|
|
2999
|
-
// : `https://jv.umsa.bo/oj/problem.php?id=${problemKey}`;
|
|
3000
|
-
// },
|
|
3001
|
-
// getUserSubmissionsUrl: (username: string) => `https://jv.umsa.bo/oj/status.php?user_id=${username}`,
|
|
3002
|
-
},
|
|
3003
|
-
[Judge.UVA_ONLINE_JUDGE]: {
|
|
3004
|
-
value: Judge.UVA_ONLINE_JUDGE,
|
|
3005
|
-
label: 'Uva Online Judge',
|
|
3006
|
-
logo: 'https://images.juki.pub/c/uva-online-judge-logo-color.png',
|
|
3007
|
-
logoSize: [150, 135.994],
|
|
3008
|
-
url: 'https://onlinejudge.org',
|
|
3009
|
-
},
|
|
3010
|
-
[Judge.AT_CODER]: {
|
|
3011
|
-
value: Judge.AT_CODER,
|
|
3012
|
-
label: 'AtCoder',
|
|
3013
|
-
logo: 'https://images.juki.pub/c/at-coder-logo-color.png',
|
|
3014
|
-
logoSize: [762.997, 675],
|
|
3015
|
-
url: 'https://atcoder.jp',
|
|
3016
|
-
},
|
|
3017
|
-
[Judge.CODECHEF]: {
|
|
3018
|
-
value: Judge.CODECHEF,
|
|
3019
|
-
label: 'Codechef',
|
|
3020
|
-
logo: 'https://images.juki.pub/c/codechef-logo-color.svg',
|
|
3021
|
-
logoSize: [1207.7, 453.17],
|
|
3022
|
-
url: 'https://www.codechef.com',
|
|
3023
|
-
},
|
|
3024
|
-
[Judge.TOPCODER]: {
|
|
3025
|
-
value: Judge.TOPCODER,
|
|
3026
|
-
label: 'Topcoder',
|
|
3027
|
-
logo: 'https://images.juki.pub/c/topcoder-logo-color.png',
|
|
3028
|
-
logoSize: [971.99, 415.99],
|
|
3029
|
-
url: 'https://www.topcoder.com',
|
|
3030
|
-
},
|
|
3031
|
-
[Judge.LEETCODE]: {
|
|
3032
|
-
value: Judge.LEETCODE,
|
|
3033
|
-
label: 'LeetCode',
|
|
3034
|
-
logo: 'https://images.juki.pub/assets/leetcode-logo-color.svg',
|
|
3035
|
-
logoSize: [95, 111],
|
|
3036
|
-
url: 'https://leetcode.com',
|
|
3037
|
-
// getProblemUrl: (problemKey: string) => {
|
|
3038
|
-
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}`;
|
|
3039
|
-
// },
|
|
3040
|
-
// getProfileUrl: (userNickname: string) => {
|
|
3041
|
-
// return `https://leetcode.com/u/${userNickname}`;
|
|
3042
|
-
// },
|
|
3043
|
-
// getSubmissionUrl: (problemKey: string, submissionId: string, username: string, submissionRunId: string) => {
|
|
3044
|
-
// return `https://leetcode.com/problems/${problemKey.replace('PL-', '')}/submissions/${submissionRunId}`;
|
|
3045
|
-
// },
|
|
3046
|
-
},
|
|
2917
|
+
const isWebsocketSubscription = (event) => {
|
|
2918
|
+
return (Object.values(WebSocketSubscriptionEvent).includes(event?.event) || Object.values(WebSocketMessageEvent).includes(event?.event))
|
|
2919
|
+
&& typeof event?.clientId === 'string' && !!event.clientId;
|
|
3047
2920
|
};
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
const
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
const
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
const
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
2921
|
+
// Custom CHANNEL_PUBLISH_MESSAGES
|
|
2922
|
+
const isPingWebSocketEventDTO = (event) => {
|
|
2923
|
+
return isWebsocketSubscription(event)
|
|
2924
|
+
&& event?.event === WebSocketMessageEvent.PING;
|
|
2925
|
+
};
|
|
2926
|
+
const isClientTrackLocationWebSocketEventDTO = (event) => {
|
|
2927
|
+
return isWebsocketSubscription(event)
|
|
2928
|
+
&& event?.event === WebSocketMessageEvent.CLIENT_TRACK_LOCATION;
|
|
2929
|
+
};
|
|
2930
|
+
const isClientTrackScreenshotWebSocketEventDTO = (event) => {
|
|
2931
|
+
return isWebsocketSubscription(event)
|
|
2932
|
+
&& event?.event === WebSocketMessageEvent.CLIENT_TRACK_SCREENSHOT;
|
|
2933
|
+
};
|
|
2934
|
+
const isClientTrackDeviceWebSocketEventDTO = (event) => {
|
|
2935
|
+
return isWebsocketSubscription(event)
|
|
2936
|
+
&& event?.event === WebSocketMessageEvent.CLIENT_TRACK_DEVICE;
|
|
2937
|
+
};
|
|
2938
|
+
const isChatCompletionsWebSocketEventDTO = (event) => {
|
|
2939
|
+
return isWebsocketSubscription(event)
|
|
2940
|
+
&& event?.event === WebSocketMessageEvent.CHAT_COMPLETIONS;
|
|
2941
|
+
};
|
|
2942
|
+
// CHANNEL_PUBLISH_SUBSCRIPTIONS
|
|
2943
|
+
const isSubscribeCodeRunStatusWebSocketEventDTO = (event) => {
|
|
2944
|
+
return isWebsocketSubscription(event)
|
|
2945
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CODE_RUN_STATUS
|
|
2946
|
+
&& typeof event?.runId === 'string' && !!event.runId;
|
|
2947
|
+
};
|
|
2948
|
+
const isUnsubscribeCodeRunStatusWebSocketEventDTO = (event) => {
|
|
2949
|
+
return isWebsocketSubscription(event)
|
|
2950
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_CODE_RUN_STATUS
|
|
2951
|
+
&& typeof event?.runId === 'string' && !!event.runId;
|
|
2952
|
+
};
|
|
2953
|
+
const isSubscribeSubmissionRunStatusWebSocketEventDTO = (event) => {
|
|
2954
|
+
return isWebsocketSubscription(event)
|
|
2955
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSION_RUN_STATUS
|
|
2956
|
+
&& typeof event?.submitId === 'string' && !!event.submitId;
|
|
2957
|
+
};
|
|
2958
|
+
const isUnsubscribeSubmissionRunStatusWebSocketEventDTO = (event) => {
|
|
2959
|
+
return isWebsocketSubscription(event)
|
|
2960
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSION_RUN_STATUS
|
|
2961
|
+
&& typeof event?.submitId === 'string' && !!event.submitId;
|
|
2962
|
+
};
|
|
2963
|
+
const isSubscribeGetDataWebSocketEventDTO = (event) => {
|
|
2964
|
+
return isWebsocketSubscription(event)
|
|
2965
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_GET_DATA;
|
|
2966
|
+
};
|
|
2967
|
+
const isUnsubscribeGetDataWebSocketEventDTO = (event) => {
|
|
2968
|
+
return isWebsocketSubscription(event)
|
|
2969
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_GET_DATA;
|
|
2970
|
+
};
|
|
2971
|
+
const isSubscribeProblemCrawledWebSocketEventDTO = (event) => {
|
|
2972
|
+
return isWebsocketSubscription(event)
|
|
2973
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_PROBLEM_CRAWLED;
|
|
2974
|
+
};
|
|
2975
|
+
const isUnsubscribeProblemCrawledWebSocketEventDTO = (event) => {
|
|
2976
|
+
return isWebsocketSubscription(event)
|
|
2977
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_PROBLEM_CRAWLED;
|
|
2978
|
+
};
|
|
2979
|
+
const isSubscribeSubmissionsCrawlWebSocketEventDTO = (event) => {
|
|
2980
|
+
return isWebsocketSubscription(event)
|
|
2981
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
2982
|
+
};
|
|
2983
|
+
const isUnsubscribeSubmissionsCrawlWebSocketEventDTO = (event) => {
|
|
2984
|
+
return isWebsocketSubscription(event)
|
|
2985
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_SUBMISSIONS_CRAWL;
|
|
2986
|
+
};
|
|
2987
|
+
const isSubscribeContestChangesWebSocketEventDTO = (event) => {
|
|
2988
|
+
return isWebsocketSubscription(event)
|
|
2989
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CONTEST_CHANGES;
|
|
2990
|
+
};
|
|
2991
|
+
const isUnsubscribeContestChangesWebSocketEventDTO = (event) => {
|
|
2992
|
+
return isWebsocketSubscription(event)
|
|
2993
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_CONTEST_CHANGES;
|
|
2994
|
+
};
|
|
2995
|
+
const isSubscribeClientTrackWebSocketEventDTO = (event) => {
|
|
2996
|
+
return isWebsocketSubscription(event)
|
|
2997
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_CLIENT_TRACK;
|
|
2998
|
+
};
|
|
2999
|
+
const isUnsubscribeClientTrackWebSocketEventDTO = (event) => {
|
|
3000
|
+
return isWebsocketSubscription(event)
|
|
3001
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_CLIENT_TRACK;
|
|
3002
|
+
};
|
|
3003
|
+
const isSubscribeUserNotificationWebSocketEventDTO = (event) => {
|
|
3004
|
+
return isWebsocketSubscription(event)
|
|
3005
|
+
&& event?.event === WebSocketSubscriptionEvent.SUBSCRIBE_USER_NOTIFICATION;
|
|
3006
|
+
};
|
|
3007
|
+
const isUnsubscribeUserNotificationWebSocketEventDTO = (event) => {
|
|
3008
|
+
return isWebsocketSubscription(event)
|
|
3009
|
+
&& event?.event === WebSocketSubscriptionEvent.UNSUBSCRIBE_USER_NOTIFICATION;
|
|
3010
|
+
};
|
|
3011
|
+
// is WebSocketResponseEventDTO, CHANNEL_SUBSCRIBE_CLIENT
|
|
3012
|
+
const isWebSocketResponseEventDTO = (event) => {
|
|
3013
|
+
return Object.values(WebSocketResponseEvent).includes(event?.event)
|
|
3014
|
+
&& typeof event?.key === 'string'
|
|
3015
|
+
&& typeof event?.connectionId === 'string'
|
|
3016
|
+
&& typeof event?.messageTimestamp === 'number' && !!event.messageTimestamp;
|
|
3017
|
+
};
|
|
3018
|
+
const isPongWebSocketResponseEventDTO = (event) => {
|
|
3019
|
+
return isWebSocketResponseEventDTO(event)
|
|
3020
|
+
&& event?.event === WebSocketResponseEvent.PONG
|
|
3021
|
+
&& !!event?.data;
|
|
3022
|
+
};
|
|
3023
|
+
const isCodeRunStatusMessageWebSocketResponseEventDTO = (event) => {
|
|
3024
|
+
return isWebSocketResponseEventDTO(event)
|
|
3025
|
+
&& event?.event === WebSocketResponseEvent.CODE_RUN_STATUS
|
|
3026
|
+
&& typeof event?.runId === 'string' && !!event.runId
|
|
3027
|
+
&& event?.status in SubmissionRunStatus;
|
|
3028
|
+
};
|
|
3029
|
+
const isSubmissionRunStatusMessageWebSocketResponseEventDTO = (event) => {
|
|
3030
|
+
return isWebSocketResponseEventDTO(event)
|
|
3031
|
+
&& event?.event === WebSocketResponseEvent.SUBMISSION_RUN_STATUS
|
|
3032
|
+
&& typeof event?.submitId === 'string' && !!event.submitId
|
|
3033
|
+
&& event?.status in SubmissionRunStatus
|
|
3034
|
+
&& event?.verdict in ProblemVerdict
|
|
3035
|
+
&& typeof event?.points === 'number';
|
|
3036
|
+
};
|
|
3037
|
+
const isUserMessageWebSocketResponseEventDTO = (event) => {
|
|
3038
|
+
return isWebSocketResponseEventDTO(event)
|
|
3039
|
+
&& event?.event === WebSocketResponseEvent.USER_MESSAGE
|
|
3040
|
+
&& typeof event?.user?.nickname === 'string' && !!event.user?.nickname
|
|
3041
|
+
&& typeof event?.user?.imageUrl === 'string' && !!event.user?.imageUrl
|
|
3042
|
+
&& typeof event?.user?.company?.key === 'string' && !!event.user?.company?.key
|
|
3043
|
+
&& !!event?.content;
|
|
3044
|
+
};
|
|
3045
|
+
const isSendDataWebSocketResponseEventDTO = (event) => {
|
|
3046
|
+
return [
|
|
3047
|
+
WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST,
|
|
3048
|
+
WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST,
|
|
3049
|
+
WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST,
|
|
3050
|
+
WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST,
|
|
3051
|
+
WebSocketResponseEvent.SEND_DATA_RUN_COMMAND,
|
|
3052
|
+
WebSocketResponseEvent.SEND_DATA_CLIENT_TRACK,
|
|
3053
|
+
WebSocketResponseEvent.SEND_DATA_CHAT_COMPLETIONS,
|
|
3054
|
+
].includes(event?.event)
|
|
3055
|
+
&& typeof event?.dataId === 'string' && !!event.dataId
|
|
3056
|
+
&& !!event?.content;
|
|
3057
|
+
};
|
|
3058
|
+
const isSendDataEcsTaskDefinitionListWebSocketResponseEventDTO = (event) => {
|
|
3059
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3060
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_ECS_TASK_DEFINITIONS_LIST;
|
|
3082
3061
|
};
|
|
3083
|
-
const
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
ProblemVerdict.AC,
|
|
3087
|
-
ProblemVerdict.PE,
|
|
3088
|
-
ProblemVerdict.PA,
|
|
3089
|
-
ProblemVerdict.CE,
|
|
3090
|
-
ProblemVerdict.RE,
|
|
3091
|
-
ProblemVerdict.TLE,
|
|
3092
|
-
ProblemVerdict.MLE,
|
|
3093
|
-
ProblemVerdict.WA,
|
|
3094
|
-
];
|
|
3095
|
-
const SUBMISSION_RUN_STATUS = {
|
|
3096
|
-
[SubmissionRunStatus.NONE]: { value: SubmissionRunStatus.NONE, label: 'none' }, // status
|
|
3097
|
-
[SubmissionRunStatus.RECEIVED]: { value: SubmissionRunStatus.RECEIVED, label: 'received' }, // state
|
|
3098
|
-
[SubmissionRunStatus.COMPILING]: { value: SubmissionRunStatus.COMPILING, label: 'compiling' }, // state
|
|
3099
|
-
[SubmissionRunStatus.COMPILED]: { value: SubmissionRunStatus.COMPILED, label: 'compiled' }, // status
|
|
3100
|
-
[SubmissionRunStatus.COMPILATION_ERROR]: { value: SubmissionRunStatus.COMPILATION_ERROR, label: 'compilation error' }, // status
|
|
3101
|
-
[SubmissionRunStatus.FETCHING_TEST_CASES]: {
|
|
3102
|
-
value: SubmissionRunStatus.FETCHING_TEST_CASES,
|
|
3103
|
-
label: 'fetching test cases',
|
|
3104
|
-
}, // state
|
|
3105
|
-
[SubmissionRunStatus.RUNNING_TEST_CASE]: { value: SubmissionRunStatus.RUNNING_TEST_CASE, label: 'running test case' }, // state
|
|
3106
|
-
[SubmissionRunStatus.RUNNING_TEST_CASES]: {
|
|
3107
|
-
value: SubmissionRunStatus.RUNNING_TEST_CASES,
|
|
3108
|
-
label: 'running test cases',
|
|
3109
|
-
}, // state
|
|
3110
|
-
[SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES]: {
|
|
3111
|
-
value: SubmissionRunStatus.RUNNING_SAMPLE_TEST_CASES,
|
|
3112
|
-
label: 'running sample cases',
|
|
3113
|
-
}, // state
|
|
3114
|
-
[SubmissionRunStatus.EXECUTED_TEST_CASE]: {
|
|
3115
|
-
value: SubmissionRunStatus.EXECUTED_TEST_CASE,
|
|
3116
|
-
label: 'executed test case',
|
|
3117
|
-
}, // status
|
|
3118
|
-
[SubmissionRunStatus.FAILED_TEST_CASE]: { value: SubmissionRunStatus.FAILED_TEST_CASE, label: 'failed test case' }, // status
|
|
3119
|
-
[SubmissionRunStatus.JUDGING_TEST_CASE]: { value: SubmissionRunStatus.JUDGING_TEST_CASE, label: 'judging test case' }, // state
|
|
3120
|
-
[SubmissionRunStatus.GRADING]: { value: SubmissionRunStatus.GRADING, label: 'grading' }, // status
|
|
3121
|
-
[SubmissionRunStatus.FAILED]: { value: SubmissionRunStatus.FAILED, label: 'failed' }, // status
|
|
3122
|
-
[SubmissionRunStatus.COMPLETED]: { value: SubmissionRunStatus.COMPLETED, label: 'completed' }, // status
|
|
3062
|
+
const isSendDataEc2InstancesListWebSocketResponseEventDTO = (event) => {
|
|
3063
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3064
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST;
|
|
3123
3065
|
};
|
|
3124
|
-
const
|
|
3125
|
-
|
|
3126
|
-
|
|
3066
|
+
const isSendDataEcsTasksListWebSocketResponseEventDTO = (event) => {
|
|
3067
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3068
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST;
|
|
3127
3069
|
};
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
[ProblemInput.INTERACTIVE]: { value: ProblemInput.INTERACTIVE, label: 'interactive' },
|
|
3070
|
+
const isSendDataSsmSessionsListWebSocketResponseEventDTO = (event) => {
|
|
3071
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3072
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST;
|
|
3132
3073
|
};
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
[ProblemOutput.INTERACTIVE]: { value: ProblemOutput.INTERACTIVE, label: 'interactive' },
|
|
3074
|
+
const isSendDataRunCommandWebSocketResponseEventDTO = (event) => {
|
|
3075
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3076
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_RUN_COMMAND;
|
|
3137
3077
|
};
|
|
3138
|
-
const
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
value: ProblemScoringMode.TOTAL,
|
|
3142
|
-
label: 'total',
|
|
3143
|
-
description: 'if all test cases are Accepted the result is Accepted '
|
|
3144
|
-
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
3145
|
-
},
|
|
3146
|
-
[ProblemScoringMode.SUBTASK]: {
|
|
3147
|
-
value: ProblemScoringMode.SUBTASK,
|
|
3148
|
-
label: 'subtask',
|
|
3149
|
-
description: 'the test cases are grouped and each group of test cases is assigned a score, '
|
|
3150
|
-
+ 'if all test cases in a group are Accepted then the score assigned to that group of test cases is added to total score, '
|
|
3151
|
-
+ 'if total score is equal to the sum of the assigned scores of all groups of test cases then the result is Accepted, '
|
|
3152
|
-
+ 'otherwise if the total score is greater than zero the result is Partial Accepted with the total accumulated score, '
|
|
3153
|
-
+ 'otherwise it will be Runtime Error, Time Limited Exceeded, Memory Limited Exceeded, Wrong Answer or Presentation Error in that order.',
|
|
3154
|
-
},
|
|
3155
|
-
[ProblemScoringMode.PARTIAL]: {
|
|
3156
|
-
value: ProblemScoringMode.PARTIAL,
|
|
3157
|
-
label: 'partial',
|
|
3158
|
-
description: 'the test cases are grouped and each group is associated with X points, '
|
|
3159
|
-
+ 'and each test case in a group scores X points ',
|
|
3160
|
-
},
|
|
3078
|
+
const isSendDataClientTrackWebSocketResponseEventDTO = (event) => {
|
|
3079
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3080
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_CLIENT_TRACK;
|
|
3161
3081
|
};
|
|
3162
|
-
const
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
value: ProblemType.STANDARD,
|
|
3166
|
-
label: 'standard',
|
|
3167
|
-
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
3168
|
-
+ 'The source code is either standalone or to be compiled. '
|
|
3169
|
-
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
3170
|
-
+ 'The output produced by the contestant\'s program is then compared to the correct output using a simple diff algorithm.',
|
|
3171
|
-
},
|
|
3172
|
-
[ProblemType.INTERACTIVE]: {
|
|
3173
|
-
value: ProblemType.INTERACTIVE, label: 'interactive', description: 'developing..',
|
|
3174
|
-
},
|
|
3175
|
-
[ProblemType.DYNAMIC]: {
|
|
3176
|
-
value: ProblemType.DYNAMIC,
|
|
3177
|
-
label: 'dynamic',
|
|
3178
|
-
description: 'The contestant submit a single source code in one of the allowed programming languages. '
|
|
3179
|
-
+ 'The user\'s source code is either standalone or to be compiled. '
|
|
3180
|
-
+ 'The resulting user\'s executable does I/O standard input and output. '
|
|
3181
|
-
+ 'The output produced by the contestant\'s program is saved. '
|
|
3182
|
-
+ 'The problem editor save a single source code in C++ 17. '
|
|
3183
|
-
+ 'The editor\'s source code can read judge input filepath argv[1], judge output filepath argv[2], user\'s output filepath argv[3], user\'s error filepath argv[4], user\'s log filepath argv[5], user\'s source filepath argv[6] and submission information filepath argv[7] (companyId, submitId, runId, userId, contestId, problemId, language, userNickname, timestamp). '
|
|
3184
|
-
+ 'The resulting editor\'s executable should be "AC" or a number between 1 and 100 for partial accepted',
|
|
3185
|
-
},
|
|
3082
|
+
const isSenDataChatCompletionsWebSocketResponseEventDTO = (event) => {
|
|
3083
|
+
return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
|
|
3084
|
+
&& event?.event === WebSocketResponseEvent.SEND_DATA_CHAT_COMPLETIONS;
|
|
3186
3085
|
};
|
|
3187
|
-
const
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3086
|
+
const isProblemCrawledWebSocketResponseEventDTO = (event) => {
|
|
3087
|
+
return isWebSocketResponseEventDTO(event)
|
|
3088
|
+
&& event?.event === WebSocketResponseEvent.PROBLEM_CRAWLED
|
|
3089
|
+
&& !!event?.content;
|
|
3090
|
+
};
|
|
3091
|
+
const isSubmissionsCrawlWebSocketResponseEventDTO = (event) => {
|
|
3092
|
+
return isWebSocketResponseEventDTO(event)
|
|
3093
|
+
&& event?.event === WebSocketResponseEvent.SUBMISSIONS_CRAWL
|
|
3094
|
+
&& !!event?.content;
|
|
3095
|
+
};
|
|
3096
|
+
const isContestChangesWebSocketResponseEventDTO = (event) => {
|
|
3097
|
+
return isWebSocketResponseEventDTO(event)
|
|
3098
|
+
&& event?.event === WebSocketResponseEvent.CONTEST_CHANGES
|
|
3099
|
+
&& !!event?.content;
|
|
3100
|
+
};
|
|
3101
|
+
const isClientTrackWebSocketResponseEventDTO = (event) => {
|
|
3102
|
+
return isWebSocketResponseEventDTO(event)
|
|
3103
|
+
&& event?.event === WebSocketResponseEvent.CLIENT_TRACK;
|
|
3104
|
+
};
|
|
3105
|
+
const isUserNotificationWebSocketResponseEventDTO = (event) => {
|
|
3106
|
+
return [
|
|
3107
|
+
WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION,
|
|
3108
|
+
WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION,
|
|
3109
|
+
].includes(event?.event)
|
|
3110
|
+
&& !!event?.content;
|
|
3111
|
+
};
|
|
3112
|
+
const isUserNotificationSubmissionWebSocketResponseEventDTO = (event) => {
|
|
3113
|
+
return isWebSocketResponseEventDTO(event) && isUserNotificationWebSocketResponseEventDTO(event)
|
|
3114
|
+
&& event?.event === WebSocketResponseEvent.USER_NOTIFICATION_SUBMISSION;
|
|
3115
|
+
};
|
|
3116
|
+
const isUserNotificationContestClarificationWebSocketResponseEventDTO = (event) => {
|
|
3117
|
+
return isWebSocketResponseEventDTO(event) && isUserNotificationWebSocketResponseEventDTO(event)
|
|
3118
|
+
&& event?.event === WebSocketResponseEvent.USER_NOTIFICATION_CONTEST_CLARIFICATION;
|
|
3119
|
+
};
|
|
3120
|
+
// generic
|
|
3121
|
+
const getWebSocketResponseEventKey = (event, clientId, id) => {
|
|
3122
|
+
return `${event}-${clientId}-${id}`;
|
|
3123
|
+
};
|
|
3124
|
+
|
|
3125
|
+
function splitTime(timeRemaining) {
|
|
3126
|
+
const remaining = [];
|
|
3127
|
+
// const aYearMilliseconds = 1000 * 60 * 60 * 24 * 365;
|
|
3128
|
+
// const remainingYears = Math.floor(timeRemaining / aYearMilliseconds);
|
|
3129
|
+
// remaining.push({ remaining: remainingYears, label: 'years', milliseconds: aYearMilliseconds });
|
|
3130
|
+
// const aWeekMilliseconds = 1000 * 60 * 60 * 24 * 7;
|
|
3131
|
+
// const remainingWeeks = Math.floor((timeRemaining % aYearMilliseconds) / aWeekMilliseconds);
|
|
3132
|
+
// remaining.push({ remaining: remainingWeeks, label: 'weeks', milliseconds: aWeekMilliseconds });
|
|
3133
|
+
const aSecondMilliseconds = 1000;
|
|
3134
|
+
const aMinuteMilliseconds = aSecondMilliseconds * 60;
|
|
3135
|
+
const aHourMilliseconds = aMinuteMilliseconds * 60;
|
|
3136
|
+
const aDayMilliseconds = aHourMilliseconds * 24;
|
|
3137
|
+
const aWeekMilliseconds = aDayMilliseconds * 7;
|
|
3138
|
+
const remainingWeeks = Math.floor(timeRemaining / aWeekMilliseconds);
|
|
3139
|
+
remaining.push({
|
|
3140
|
+
remaining: remainingWeeks,
|
|
3141
|
+
label: remainingWeeks === 1 ? 'week' : 'weeks',
|
|
3142
|
+
abbreviatedLabel: 'w',
|
|
3143
|
+
milliseconds: aWeekMilliseconds,
|
|
3144
|
+
digits: 2,
|
|
3145
|
+
});
|
|
3146
|
+
const remainingDays = Math.floor((timeRemaining % aWeekMilliseconds) / aDayMilliseconds);
|
|
3147
|
+
remaining.push({
|
|
3148
|
+
remaining: remainingDays,
|
|
3149
|
+
label: remainingDays === 1 ? 'day' : 'days',
|
|
3150
|
+
abbreviatedLabel: 'd',
|
|
3151
|
+
milliseconds: aDayMilliseconds,
|
|
3152
|
+
digits: 2,
|
|
3153
|
+
});
|
|
3154
|
+
const remainingHours = Math.floor((timeRemaining % aDayMilliseconds) / aHourMilliseconds);
|
|
3155
|
+
remaining.push({
|
|
3156
|
+
remaining: remainingHours,
|
|
3157
|
+
label: remainingHours === 1 ? 'hour' : 'hours',
|
|
3158
|
+
abbreviatedLabel: 'h',
|
|
3159
|
+
milliseconds: aHourMilliseconds,
|
|
3160
|
+
digits: 2,
|
|
3161
|
+
});
|
|
3162
|
+
const remainingMinutes = Math.floor((timeRemaining % aHourMilliseconds) / aMinuteMilliseconds);
|
|
3163
|
+
remaining.push({
|
|
3164
|
+
remaining: remainingMinutes,
|
|
3165
|
+
label: remainingMinutes === 1 ? 'minute' : 'minutes',
|
|
3166
|
+
abbreviatedLabel: 'm',
|
|
3167
|
+
milliseconds: aMinuteMilliseconds,
|
|
3168
|
+
digits: 2,
|
|
3169
|
+
});
|
|
3170
|
+
const remainingSeconds = Math.floor((timeRemaining % aMinuteMilliseconds) / aSecondMilliseconds);
|
|
3171
|
+
remaining.push({
|
|
3172
|
+
remaining: remainingSeconds,
|
|
3173
|
+
label: remainingSeconds === 1 ? 'second' : 'seconds',
|
|
3174
|
+
abbreviatedLabel: 's',
|
|
3175
|
+
milliseconds: aSecondMilliseconds,
|
|
3176
|
+
digits: 2,
|
|
3177
|
+
});
|
|
3178
|
+
const remainingMilliseconds = Math.floor(timeRemaining % aSecondMilliseconds);
|
|
3179
|
+
remaining.push({
|
|
3180
|
+
remaining: remainingMilliseconds,
|
|
3181
|
+
label: remainingMilliseconds === 1 ? 'millisecond' : 'milliseconds',
|
|
3182
|
+
abbreviatedLabel: 'ms',
|
|
3183
|
+
milliseconds: 1,
|
|
3184
|
+
digits: 3,
|
|
3185
|
+
});
|
|
3186
|
+
// while (remaining[0].remaining <= 0) {
|
|
3187
|
+
// remaining.shift();
|
|
3188
|
+
// if (remaining.length === 3) {
|
|
3189
|
+
// break;
|
|
3190
|
+
// }
|
|
3191
|
+
// }
|
|
3192
|
+
return remaining;
|
|
3193
|
+
}
|
|
3194
|
+
function normalizeToLocalStartOfDay(timestamp) {
|
|
3195
|
+
const date = new Date(timestamp);
|
|
3196
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate());
|
|
3197
|
+
}
|
|
3198
|
+
function normalizeToLocalStartOfHour(timestamp) {
|
|
3199
|
+
const date = new Date(timestamp);
|
|
3200
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours());
|
|
3201
|
+
}
|
|
3202
|
+
function normalizeToLocalStartOfMinutes(timestamp) {
|
|
3203
|
+
const date = new Date(timestamp);
|
|
3204
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
3205
|
+
}
|
|
3206
|
+
function normalizeToLocalStartOfSeconds(timestamp) {
|
|
3207
|
+
const date = new Date(timestamp);
|
|
3208
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes());
|
|
3209
|
+
}
|
|
3210
|
+
const getYears = (d) => d.getFullYear();
|
|
3211
|
+
const getMonths = (d) => d.getFullYear() * 12 + d.getMonth();
|
|
3212
|
+
const getDays = (d) => {
|
|
3213
|
+
return Math.floor(normalizeToLocalStartOfDay(d).getTime() / ONE_DAY);
|
|
3196
3214
|
};
|
|
3215
|
+
const getHours = (d) => {
|
|
3216
|
+
return Math.floor(normalizeToLocalStartOfHour(d).getTime() / ONE_HOUR);
|
|
3217
|
+
};
|
|
3218
|
+
const getMinutes = (d) => {
|
|
3219
|
+
return Math.floor(normalizeToLocalStartOfMinutes(d).getTime() / ONE_MINUTE);
|
|
3220
|
+
};
|
|
3221
|
+
const getSeconds = (d) => {
|
|
3222
|
+
return Math.floor(normalizeToLocalStartOfSeconds(d).getTime() / 1000);
|
|
3223
|
+
};
|
|
3224
|
+
const getMilliseconds = (d) => d.getTime();
|
|
3197
3225
|
|
|
3198
|
-
const
|
|
3199
|
-
|
|
3200
|
-
const _TAB = ':tab';
|
|
3201
|
-
const _SUB_TAB = ':subTab?';
|
|
3202
|
-
const _SUB_SUB_TAB = ':subSubTab?';
|
|
3203
|
-
const PAGE = 'page';
|
|
3204
|
-
const PAGE_SIZE = 'size';
|
|
3205
|
-
|
|
3206
|
-
const FILE_TYPE = {
|
|
3207
|
-
[FileType.FILE]: { value: FileType.FILE, label: 'file' },
|
|
3208
|
-
[FileType.FOLDER]: { value: FileType.FOLDER, label: 'folder' },
|
|
3226
|
+
const getUserKey = (userNickname, userCompanyKey) => {
|
|
3227
|
+
return userNickname + '|' + userCompanyKey;
|
|
3209
3228
|
};
|
|
3210
|
-
const
|
|
3211
|
-
[
|
|
3212
|
-
|
|
3213
|
-
[Role.REGULAR]: { value: Role.REGULAR, label: 'regular', level: 3 },
|
|
3214
|
-
[Role.MASTER]: { value: Role.MASTER, label: 'master', level: 2 },
|
|
3215
|
-
[Role.ADMIN]: { value: Role.ADMIN, label: 'admin', level: 1 },
|
|
3216
|
-
[Role.SUPER_ADMIN]: { value: Role.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
3229
|
+
const getParamsOfUserKey = (userKey) => {
|
|
3230
|
+
const [userNickname, userCompanyKey] = userKey.split('|');
|
|
3231
|
+
return { userNickname, userCompanyKey };
|
|
3217
3232
|
};
|
|
3218
|
-
const
|
|
3219
|
-
|
|
3220
|
-
value: EntityState.RELEASED,
|
|
3221
|
-
label: 'released',
|
|
3222
|
-
},
|
|
3223
|
-
[EntityState.ARCHIVED]: {
|
|
3224
|
-
value: EntityState.ARCHIVED,
|
|
3225
|
-
label: 'archived',
|
|
3226
|
-
},
|
|
3233
|
+
const getClientId = (sessionId, uiId) => {
|
|
3234
|
+
return `${sessionId}|${uiId}`;
|
|
3227
3235
|
};
|
|
3228
|
-
const
|
|
3229
|
-
[
|
|
3230
|
-
|
|
3231
|
-
label: 'private',
|
|
3232
|
-
description: 'the record will be visible and editable only to the owner',
|
|
3233
|
-
},
|
|
3234
|
-
[EntityAccess.RESTRICTED]: {
|
|
3235
|
-
value: EntityAccess.RESTRICTED,
|
|
3236
|
-
label: 'restricted',
|
|
3237
|
-
description: 'the record will be visible to viewers and the owner and editable to editors and the owner',
|
|
3238
|
-
},
|
|
3239
|
-
[EntityAccess.PUBLIC]: {
|
|
3240
|
-
value: EntityAccess.PUBLIC,
|
|
3241
|
-
label: 'public',
|
|
3242
|
-
description: 'the record will be visible to anyone and editable to editors and the owner',
|
|
3243
|
-
},
|
|
3244
|
-
[EntityAccess.EXPOSED]: {
|
|
3245
|
-
value: EntityAccess.EXPOSED,
|
|
3246
|
-
label: 'exposed',
|
|
3247
|
-
description: 'the record will be visible and editable to anyone',
|
|
3248
|
-
},
|
|
3236
|
+
const getParamsOfClientId = (clientId) => {
|
|
3237
|
+
const [sessionId, uiId] = clientId.split('|');
|
|
3238
|
+
return { sessionId, uiId };
|
|
3249
3239
|
};
|
|
3250
3240
|
|
|
3251
|
-
const
|
|
3252
|
-
|
|
3253
|
-
[
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3241
|
+
const getWorksheetsInPages = (initialSheets) => {
|
|
3242
|
+
const sheets = [...initialSheets];
|
|
3243
|
+
if (sheets[0]?.type !== WorksheetType.NEW_PAGE) {
|
|
3244
|
+
sheets.unshift(NEW_PAGE_SHEET());
|
|
3245
|
+
}
|
|
3246
|
+
let newPage = sheets[0];
|
|
3247
|
+
let content = [];
|
|
3248
|
+
const sheetsByPages = [];
|
|
3249
|
+
for (let i = 1; i < sheets.length; i++) {
|
|
3250
|
+
const sheet = sheets[i];
|
|
3251
|
+
if (sheet.type === WorksheetType.NEW_PAGE) {
|
|
3252
|
+
sheetsByPages.push({
|
|
3253
|
+
header: newPage,
|
|
3254
|
+
content: [...content],
|
|
3255
|
+
});
|
|
3256
|
+
newPage = sheet;
|
|
3257
|
+
content = [];
|
|
3258
|
+
}
|
|
3259
|
+
else {
|
|
3260
|
+
content.push(sheet);
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
sheetsByPages.push({
|
|
3264
|
+
header: newPage,
|
|
3265
|
+
content: [...content],
|
|
3266
|
+
});
|
|
3267
|
+
return sheetsByPages;
|
|
3258
3268
|
};
|
|
3259
|
-
|
|
3260
|
-
const
|
|
3261
|
-
[
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3269
|
+
const getSummaryWorksheetsInPages = (initialSheets) => {
|
|
3270
|
+
const sheets = [...initialSheets];
|
|
3271
|
+
if (sheets[0]?.type !== WorksheetType.NEW_PAGE) {
|
|
3272
|
+
sheets.unshift(NEW_PAGE_SHEET());
|
|
3273
|
+
}
|
|
3274
|
+
let newPage = sheets[0];
|
|
3275
|
+
let content = [];
|
|
3276
|
+
const sheetsByPages = [];
|
|
3277
|
+
for (let i = 1; i < sheets.length; i++) {
|
|
3278
|
+
const sheet = sheets[i];
|
|
3279
|
+
if (sheet.type === WorksheetType.NEW_PAGE) {
|
|
3280
|
+
sheetsByPages.push({
|
|
3281
|
+
header: newPage,
|
|
3282
|
+
content: content.map(c => ({
|
|
3283
|
+
id: c.id,
|
|
3284
|
+
type: c.type,
|
|
3285
|
+
title: c.title,
|
|
3286
|
+
points: c.points,
|
|
3287
|
+
})),
|
|
3288
|
+
});
|
|
3289
|
+
newPage = sheet;
|
|
3290
|
+
content = [];
|
|
3291
|
+
}
|
|
3292
|
+
else {
|
|
3293
|
+
content.push(sheet);
|
|
3294
|
+
}
|
|
3295
|
+
}
|
|
3296
|
+
sheetsByPages.push({
|
|
3297
|
+
header: newPage,
|
|
3298
|
+
content: [...content],
|
|
3299
|
+
});
|
|
3300
|
+
return sheetsByPages;
|
|
3267
3301
|
};
|
|
3268
|
-
const
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
[TeamRole.SUPER_ADMIN]: { value: TeamRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
3302
|
+
const getTotalExercisesOfSummaryWorksheetsInPages = (content) => content.reduce((sum, { content }) => sum + content.reduce((sum, { type }) => sum + +(type === WorksheetType.QUIZ_OPTIONS || type === WorksheetType.QUIZ_PROBLEM || type === WorksheetType.QUIZ_TEXT), 0), 0);
|
|
3303
|
+
const isBasicWorksheet = (value) => {
|
|
3304
|
+
return typeof value?.id == 'string' && value.id
|
|
3305
|
+
&& Object.values(WorksheetType).includes(value?.type)
|
|
3306
|
+
&& typeof value?.title == 'string'
|
|
3307
|
+
&& typeof value?.points == 'number';
|
|
3275
3308
|
};
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
const SEC_90 = ONE_SECOND * 90;
|
|
3281
|
-
const SEC_120 = ONE_SECOND * 120;
|
|
3282
|
-
const ONE_MINUTE = ONE_SECOND * 60;
|
|
3283
|
-
const ONE_HOUR = ONE_MINUTE * 60;
|
|
3284
|
-
const ONE_DAY = ONE_HOUR * 24;
|
|
3285
|
-
const ONE_WEEK = ONE_DAY * 7;
|
|
3286
|
-
|
|
3287
|
-
const USER_STATUS = {
|
|
3288
|
-
[UserStatus.ACTIVE]: { value: UserStatus.ACTIVE, label: 'active' },
|
|
3289
|
-
[UserStatus.REPORTED]: { value: UserStatus.REPORTED, label: 'reported' },
|
|
3290
|
-
[UserStatus.ARCHIVED]: { value: UserStatus.ARCHIVED, label: 'archived' },
|
|
3309
|
+
const isJkmdSheet = (value) => {
|
|
3310
|
+
return isBasicWorksheet(value)
|
|
3311
|
+
&& value?.type === WorksheetType.JK_MD
|
|
3312
|
+
&& typeof value?.content == 'string';
|
|
3291
3313
|
};
|
|
3292
|
-
const
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
[UserRole.SUPER_ADMIN]: { value: UserRole.SUPER_ADMIN, label: 'super admin', level: 0 },
|
|
3314
|
+
const isCodeEditorSheet = (value) => {
|
|
3315
|
+
return isBasicWorksheet(value)
|
|
3316
|
+
&& value?.type === WorksheetType.CODE_EDITOR
|
|
3317
|
+
&& typeof value?.sourceCode === 'object' && value?.sourceCode !== null
|
|
3318
|
+
&& value?.testCases === 'object' && value?.testCases !== null
|
|
3319
|
+
&& Array.isArray(value?.languages)
|
|
3320
|
+
&& typeof value?.height == 'number';
|
|
3300
3321
|
};
|
|
3301
|
-
const
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
},
|
|
3322
|
+
const isQuizProblemSheet = (value) => {
|
|
3323
|
+
return isBasicWorksheet(value)
|
|
3324
|
+
&& value?.type === WorksheetType.QUIZ_PROBLEM
|
|
3325
|
+
&& Object.values(Judge).includes(value?.problemJudge) || typeof value?.problemJudge === 'string'
|
|
3326
|
+
&& typeof value?.problemKey == 'string'
|
|
3327
|
+
&& Array.isArray(value?.languages)
|
|
3328
|
+
&& typeof value?.height == 'number';
|
|
3329
|
+
};
|
|
3330
|
+
const isQuizOptionsSheet = (value) => {
|
|
3331
|
+
return isBasicWorksheet(value)
|
|
3332
|
+
&& value?.type === WorksheetType.QUIZ_OPTIONS
|
|
3333
|
+
&& typeof value?.description == 'string'
|
|
3334
|
+
&& Array.isArray(value?.options)
|
|
3335
|
+
&& value?.options.every((option) => typeof option?.label == 'string' && typeof option?.correct == 'boolean' && typeof option?.id == 'string')
|
|
3336
|
+
&& typeof value?.multiple == 'boolean'
|
|
3337
|
+
&& (value?.scoringMode === 'TOTAL' || value?.scoringMode === 'PARTIAL');
|
|
3338
|
+
};
|
|
3339
|
+
const isQuizTextSheet = (value) => {
|
|
3340
|
+
return isBasicWorksheet(value)
|
|
3341
|
+
&& value?.type === WorksheetType.QUIZ_TEXT
|
|
3342
|
+
&& typeof value?.description == 'string'
|
|
3343
|
+
&& typeof value?.answer == 'string'
|
|
3344
|
+
&& ['text', 'number', 'textarea'].includes(value?.inputType);
|
|
3325
3345
|
};
|
|
3326
|
-
|
|
3327
|
-
const CHANNEL_PUBLISH_SUBSCRIPTIONS = 'pub:subscriptions';
|
|
3328
|
-
const CHANNEL_SUBSCRIBE_NOTIFICATIONS = 'sub:notifications';
|
|
3329
|
-
const CHANNEL_SUBSCRIBE_CLIENT = (clientId) => `sub:client:${clientId}`;
|
|
3330
|
-
const CHANNEL_PUBLISH_MESSAGES = 'pub:messages';
|
|
3331
|
-
const CHANNEL_PRESENCE_CLIENT = 'pre:client';
|
|
3332
|
-
|
|
3333
|
-
var ContestProblemBlockedByType;
|
|
3334
|
-
(function (ContestProblemBlockedByType) {
|
|
3335
|
-
ContestProblemBlockedByType["UNMET_PREREQUISITES"] = "UNMET_PREREQUISITES";
|
|
3336
|
-
ContestProblemBlockedByType["MAX_ACCEPTED_SUBMISSIONS_ACHIEVED"] = "MAX_ACCEPTED_SUBMISSIONS_ACHIEVED";
|
|
3337
|
-
ContestProblemBlockedByType["START_TIME_IN_THE_FUTURE"] = "START_TIME_IN_THE_FUTURE";
|
|
3338
|
-
ContestProblemBlockedByType["END_TIME_IN_THE_PAST"] = "END_TIME_IN_THE_PAST";
|
|
3339
|
-
})(ContestProblemBlockedByType || (ContestProblemBlockedByType = {}));
|
|
3340
|
-
|
|
3341
|
-
var MemberType;
|
|
3342
|
-
(function (MemberType) {
|
|
3343
|
-
MemberType["USER"] = "USER";
|
|
3344
|
-
MemberType["TEAM"] = "TEAM";
|
|
3345
|
-
})(MemberType || (MemberType = {}));
|
|
3346
3346
|
|
|
3347
3347
|
export { ACCEPTED_PROGRAMMING_LANGUAGES, ASPECT_RATIO, AspectRatio, AssignmentClass, AssignmentState, AssignmentType, CHANNEL_PRESENCE_CLIENT, CHANNEL_PUBLISH_MESSAGES, CHANNEL_PUBLISH_SUBSCRIPTIONS, CHANNEL_SUBSCRIBE_CLIENT, CHANNEL_SUBSCRIBE_NOTIFICATIONS, CODE_LANGUAGE, COMPANY_PLAN, CONTEST_ROLE, CONTEST_STATUS, COOKIE_JUKI_SESSION_ID, COURSE_ROLE, CodeLanguage, CollectionKey, CompanyLogoType, CompanyPlan, ContestEventAction, ContestProblemBlockedByType, ContestProblemPrerequisiteType, ContestStatus, ContestTimeStatus, CourseRole, CourseStatus, CourseType, DAY_NAMES, DEFAULT_JUKI_PROFILE_IMAGE, DataViewMode, EMPTY_DOCUMENT_MEMBERS, EMPTY_ENTITY_MEMBERS, EMPTY_USER_PERMISSIONS, ENTITY_ACCESS, ENTITY_STATE, ERROR, EmailSubscription, EmailValidationState, EntityAccess, EntityCollection, EntityMembersRank, EntityState, EntityStatus, ErrorCode, FILE_ROLE, FILE_TYPE, FileMemberRole, FileType, FilesJukiPub, GroupType, HEADER_JUKI_FORWARDED_HOST, HEADER_JUKI_INTERNAL_API_KEY, HEADER_JUKI_METADATA, HEADER_JUKI_SECRET_TOKEN, HEADER_JUKI_VISITOR_SESSION_ID, HOURS, HTTPMethod, JUDGE, JUKI_APP_COMPANY_KEY, JUKI_APP_EMAIL_TEMPLATE, JkError, Judge, LANGUAGE, LOWERCASE_LETTERS, Language, LogLevel, LogOperation, MAX_DATE, MEMBER_ROLE, MILLISECONDS, MINUTES, MIN_DATE, MONTH_NAMES, MemberRole, MemberType, MenuViewMode, NEW_PAGE_SHEET, NUMBERS, NotificationType, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PAGE, PAGE_SIZE, PAGE_SIZES, PALLETE, PROBLEM_INPUT, PROBLEM_MODE, PROBLEM_MODES, PROBLEM_OUTPUT, PROBLEM_ROLE, PROBLEM_TYPE, PROBLEM_TYPES, PROBLEM_VERDICT, PROBLEM_VERDICTS, ProblemInput, ProblemOutput, ProblemScoringMode, ProblemType, ProblemVerdict, ProfileSetting, QuizScoringMode, RUNNER_ACCEPTED_PROBLEM_MODES, RUNNER_ACCEPTED_PROBLEM_TYPES, RUNNER_ACCEPTED_PROGRAMMING_LANGUAGES, RUNNER_TYPE, Role, RunnerType, SECONDS, SEC_120, SEC_30, SEC_60, SEC_90, SEPARATOR_TOKEN, SUBMISSION_RUN_STATUS, SUPPORT_EMAIL, SYSTEM_ROLE, ScopeData, Status, SubmissionRunStatus, SystemRole, TEAM_ROLE, THEME, TeamRole, TeamStatus, Theme, TypeTestCase, UPPERCASE_LETTERS, USER_ROLE, USER_STATUS, UserRole, UserStatus, UserTeamStatus, WebSocketMessageEvent, WebSocketResponseEvent, WebSocketSubscriptionEvent, WorkingIn, WorksheetType, YEARS, _KEY, _SUB_SUB_TAB, _SUB_TAB, _TAB, _TYPE, areArraysDifferent, chunkString, cleanRequest, clearAsyncInterval, consoleError, consoleInfo, consoleWarn, contentResponse, contentsResponse, errorsResponse, getAssignmentCommentKey, getAssignmentUserCommentKey, getClientId, getContestCommentKey, getDataLog, getDataOfTestCase, getDays, getDefaultMeta, getDocumentAccess, getHours, getMilliseconds, getMinutes, getMonths, getParamsOfClientId, getParamsOfUserKey, getPlainText, getProblemCommentKey, getProblemJudgeKey, getRandomString, getSeconds, getSummaryWorksheetsInPages, getTotalExercisesOfSummaryWorksheetsInPages, getUserKey, getVerdictFromTestCase, getWebSocketResponseEventKey, getWorksheetsInPages, getYears, humanFileSize, indexToLetters, isBasicWorksheet, isChatCompletionsWebSocketEventDTO, isClientTrackDeviceWebSocketEventDTO, isClientTrackLocationWebSocketEventDTO, isClientTrackScreenshotWebSocketEventDTO, isClientTrackWebSocketResponseEventDTO, isCodeEditorSheet, isCodeRunStatusMessageWebSocketResponseEventDTO, isContestAssignment, isContestChangesWebSocketResponseEventDTO, isCourseAssignment, isEndlessContest, isFutureContest, isGlobalContest, isJkmdSheet, isObjectJson, isPastContest, isPingWebSocketEventDTO, isPongWebSocketResponseEventDTO, isProblemCrawledWebSocketResponseEventDTO, isQuizOptionsSheet, isQuizProblemSheet, isQuizTextSheet, isSenDataChatCompletionsWebSocketResponseEventDTO, isSendDataClientTrackWebSocketResponseEventDTO, isSendDataEc2InstancesListWebSocketResponseEventDTO, isSendDataEcsTaskDefinitionListWebSocketResponseEventDTO, isSendDataEcsTasksListWebSocketResponseEventDTO, isSendDataRunCommandWebSocketResponseEventDTO, isSendDataSsmSessionsListWebSocketResponseEventDTO, isSendDataWebSocketResponseEventDTO, isStringJson, isSubmissionRunStatusMessageWebSocketResponseEventDTO, isSubmissionsCrawlWebSocketResponseEventDTO, isSubscribeClientTrackWebSocketEventDTO, isSubscribeCodeRunStatusWebSocketEventDTO, isSubscribeContestChangesWebSocketEventDTO, isSubscribeGetDataWebSocketEventDTO, isSubscribeProblemCrawledWebSocketEventDTO, isSubscribeSubmissionRunStatusWebSocketEventDTO, isSubscribeSubmissionsCrawlWebSocketEventDTO, isSubscribeUserNotificationWebSocketEventDTO, isTeamMember, isUnsubscribeClientTrackWebSocketEventDTO, isUnsubscribeCodeRunStatusWebSocketEventDTO, isUnsubscribeContestChangesWebSocketEventDTO, isUnsubscribeGetDataWebSocketEventDTO, isUnsubscribeProblemCrawledWebSocketEventDTO, isUnsubscribeSubmissionRunStatusWebSocketEventDTO, isUnsubscribeSubmissionsCrawlWebSocketEventDTO, isUnsubscribeUserNotificationWebSocketEventDTO, isUserMember, isUserMessageWebSocketResponseEventDTO, isUserNotificationContestClarificationWebSocketResponseEventDTO, isUserNotificationSubmissionWebSocketResponseEventDTO, isUserNotificationWebSocketResponseEventDTO, isWebSocketResponseEventDTO, isWebsocketSubscription, isWorksheetAssignment, join, lettersToIndex, memorySizeOf, mergeVerdicts, mex, normalizeToLocalStartOfDay, normalizeToLocalStartOfHour, normalizeToLocalStartOfMinutes, normalizeToLocalStartOfSeconds, objectUpdate, objectsUpdate, range, removeExtension, safeJsonParse, setAsyncInterval, split, splitTime, stringToArrayBuffer, toEntityMembersDTO, toJkError };
|