@juki-team/commons 0.1.32 → 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.
Files changed (254) hide show
  1. package/dist/cjs/index.cjs +3567 -0
  2. package/dist/esm/index.js +3347 -0
  3. package/dist/{constants → types/constants}/commons.d.ts +8 -8
  4. package/dist/{constants → types/constants}/company.d.ts +3 -3
  5. package/dist/{constants → types/constants}/contest.d.ts +3 -3
  6. package/dist/{constants → types/constants}/course.d.ts +2 -2
  7. package/dist/{constants → types/constants}/entity.d.ts +1 -1
  8. package/dist/{constants → types/constants}/file.d.ts +5 -6
  9. package/dist/types/constants/index.d.ts +18 -0
  10. package/dist/{constants → types/constants}/judge.d.ts +9 -11
  11. package/dist/{constants → types/constants}/problem.d.ts +8 -9
  12. package/dist/types/constants/services.d.ts +8 -0
  13. package/dist/{constants → types/constants}/system.d.ts +2 -2
  14. package/dist/{constants → types/constants}/teams.d.ts +3 -4
  15. package/dist/types/constants/user.d.ts +16 -0
  16. package/dist/{constants → types/constants}/websocket.d.ts +1 -1
  17. package/dist/{constants → types/constants}/worksheet.d.ts +2 -2
  18. package/dist/{dto → types/dto}/class.d.ts +4 -4
  19. package/dist/{dto → types/dto}/code.d.ts +1 -1
  20. package/dist/{dto → types/dto}/comments.d.ts +3 -3
  21. package/dist/types/dto/company.d.ts +67 -0
  22. package/dist/{dto → types/dto}/contest.d.ts +8 -9
  23. package/dist/{dto → types/dto}/course.d.ts +5 -5
  24. package/dist/{dto → types/dto}/entity.d.ts +3 -3
  25. package/dist/{dto → types/dto}/excalidraw.d.ts +4 -4
  26. package/dist/{dto → types/dto}/file.d.ts +2 -2
  27. package/dist/types/dto/index.d.ts +25 -0
  28. package/dist/{dto → types/dto}/judge.d.ts +1 -1
  29. package/dist/{dto → types/dto}/markdown.d.ts +4 -4
  30. package/dist/{dto → types/dto}/mermaid.d.ts +4 -4
  31. package/dist/{dto → types/dto}/problem.d.ts +4 -5
  32. package/dist/{dto → types/dto}/scoreboard.d.ts +1 -1
  33. package/dist/{dto → types/dto}/session.d.ts +2 -2
  34. package/dist/{dto → types/dto}/socket.d.ts +7 -8
  35. package/dist/{dto → types/dto}/statistics.d.ts +2 -2
  36. package/dist/{dto → types/dto}/submission.d.ts +4 -5
  37. package/dist/{dto → types/dto}/system.d.ts +18 -18
  38. package/dist/{dto → types/dto}/user.d.ts +14 -14
  39. package/dist/{dto → types/dto}/virtual-user.d.ts +1 -2
  40. package/dist/{dto → types/dto}/worksheet-submissions.d.ts +4 -4
  41. package/dist/{dto → types/dto}/worksheet.d.ts +4 -4
  42. package/dist/{helpers → types/helpers}/class.d.ts +1 -1
  43. package/dist/{helpers → types/helpers}/commons.d.ts +11 -9
  44. package/dist/{helpers → types/helpers}/contest.d.ts +1 -1
  45. package/dist/{helpers → types/helpers}/document.d.ts +2 -2
  46. package/dist/types/helpers/index.d.ts +14 -0
  47. package/dist/types/helpers/interval.d.ts +2 -0
  48. package/dist/{helpers → types/helpers}/judging.d.ts +2 -3
  49. package/dist/types/helpers/object.d.ts +1 -0
  50. package/dist/types/helpers/responses.d.ts +8 -0
  51. package/dist/types/helpers/socket.d.ts +45 -0
  52. package/dist/{helpers → types/helpers}/time.d.ts +1 -1
  53. package/dist/{helpers → types/helpers}/user.d.ts +1 -1
  54. package/dist/types/helpers/worksheet.d.ts +10 -0
  55. package/dist/types/index.d.ts +5 -23
  56. package/dist/{prototypes → types/prototypes}/Error.d.ts +3 -3
  57. package/dist/types/prototypes/Number.d.ts +7 -0
  58. package/dist/types/prototypes/index.d.ts +3 -0
  59. package/dist/types/{class.d.ts → types/class.d.ts} +2 -2
  60. package/dist/types/{commons.d.ts → types/commons.d.ts} +3 -3
  61. package/dist/types/types/company.d.ts +29 -0
  62. package/dist/types/{contest.d.ts → types/contest.d.ts} +26 -9
  63. package/dist/types/{course.d.ts → types/course.d.ts} +1 -1
  64. package/dist/types/{entity.d.ts → types/entity.d.ts} +4 -4
  65. package/dist/types/{excalidraw.d.ts → types/excalidraw.d.ts} +3 -3
  66. package/dist/types/{file.d.ts → types/file.d.ts} +9 -4
  67. package/dist/types/{group.d.ts → types/group.d.ts} +5 -2
  68. package/dist/types/types/index.d.ts +25 -0
  69. package/dist/types/{judge.d.ts → types/judge.d.ts} +32 -3
  70. package/dist/types/{markdown.d.ts → types/markdown.d.ts} +1 -1
  71. package/dist/types/{mermaid.d.ts → types/mermaid.d.ts} +1 -1
  72. package/dist/types/types/prisma.d.ts +284 -0
  73. package/dist/types/{problems.d.ts → types/problems.d.ts} +13 -4
  74. package/dist/types/types/services.d.ts +213 -0
  75. package/dist/types/{sheet.d.ts → types/sheet.d.ts} +2 -3
  76. package/dist/types/{socket.d.ts → types/socket.d.ts} +3 -3
  77. package/dist/types/{teams.d.ts → types/teams.d.ts} +2 -25
  78. package/dist/types/{users.d.ts → types/users.d.ts} +4 -10
  79. package/dist/types/types/virtual-user.d.ts +7 -0
  80. package/dist/types/{worksheet.d.ts → types/worksheet.d.ts} +3 -3
  81. package/package.json +27 -22
  82. package/biome.shared.json +0 -102
  83. package/dist/constants/commons.js +0 -658
  84. package/dist/constants/company.js +0 -24
  85. package/dist/constants/contest.js +0 -29
  86. package/dist/constants/course.js +0 -12
  87. package/dist/constants/date.js +0 -23
  88. package/dist/constants/email.js +0 -34
  89. package/dist/constants/entity.js +0 -18
  90. package/dist/constants/file.js +0 -46
  91. package/dist/constants/index.d.ts +0 -18
  92. package/dist/constants/index.js +0 -18
  93. package/dist/constants/judge.js +0 -221
  94. package/dist/constants/problem.js +0 -72
  95. package/dist/constants/routing.js +0 -7
  96. package/dist/constants/services.d.ts +0 -5
  97. package/dist/constants/services.js +0 -131
  98. package/dist/constants/system.js +0 -9
  99. package/dist/constants/teams.js +0 -18
  100. package/dist/constants/time.js +0 -9
  101. package/dist/constants/user.d.ts +0 -10
  102. package/dist/constants/user.js +0 -35
  103. package/dist/constants/websocket.js +0 -5
  104. package/dist/constants/worksheet.js +0 -66
  105. package/dist/dto/class.js +0 -1
  106. package/dist/dto/code.js +0 -1
  107. package/dist/dto/comments.js +0 -1
  108. package/dist/dto/contest.js +0 -7
  109. package/dist/dto/course.js +0 -1
  110. package/dist/dto/entity.js +0 -5
  111. package/dist/dto/excalidraw.js +0 -1
  112. package/dist/dto/file.js +0 -1
  113. package/dist/dto/image.js +0 -1
  114. package/dist/dto/index.d.ts +0 -24
  115. package/dist/dto/index.js +0 -24
  116. package/dist/dto/judge.js +0 -1
  117. package/dist/dto/markdown.js +0 -1
  118. package/dist/dto/mermaid.js +0 -1
  119. package/dist/dto/organization.d.ts +0 -102
  120. package/dist/dto/organization.js +0 -1
  121. package/dist/dto/problem.js +0 -1
  122. package/dist/dto/scoreboard.js +0 -1
  123. package/dist/dto/session.js +0 -1
  124. package/dist/dto/socket.js +0 -1
  125. package/dist/dto/statistics.js +0 -1
  126. package/dist/dto/submission.js +0 -1
  127. package/dist/dto/system.js +0 -1
  128. package/dist/dto/url.js +0 -1
  129. package/dist/dto/user.js +0 -1
  130. package/dist/dto/virtual-user.js +0 -1
  131. package/dist/dto/worksheet-submissions.js +0 -1
  132. package/dist/dto/worksheet.js +0 -1
  133. package/dist/helpers/class.js +0 -10
  134. package/dist/helpers/comments.js +0 -4
  135. package/dist/helpers/commons.js +0 -191
  136. package/dist/helpers/contest.js +0 -21
  137. package/dist/helpers/document.js +0 -38
  138. package/dist/helpers/file.js +0 -4
  139. package/dist/helpers/index.d.ts +0 -14
  140. package/dist/helpers/index.js +0 -14
  141. package/dist/helpers/interval.d.ts +0 -2
  142. package/dist/helpers/interval.js +0 -22
  143. package/dist/helpers/judging.js +0 -107
  144. package/dist/helpers/object.d.ts +0 -1
  145. package/dist/helpers/object.js +0 -32
  146. package/dist/helpers/responses.d.ts +0 -8
  147. package/dist/helpers/responses.js +0 -78
  148. package/dist/helpers/socket.d.ts +0 -45
  149. package/dist/helpers/socket.js +0 -238
  150. package/dist/helpers/time.js +0 -101
  151. package/dist/helpers/user.js +0 -14
  152. package/dist/helpers/worksheet.d.ts +0 -10
  153. package/dist/helpers/worksheet.js +0 -131
  154. package/dist/index.d.ts +0 -6
  155. package/dist/index.js +0 -6
  156. package/dist/prisma/enums/AssignmentClassType.d.ts +0 -7
  157. package/dist/prisma/enums/AssignmentClassType.js +0 -6
  158. package/dist/prisma/enums/ContestEventAction.d.ts +0 -10
  159. package/dist/prisma/enums/ContestEventAction.js +0 -9
  160. package/dist/prisma/enums/ContestProblemPrerequisiteType.d.ts +0 -5
  161. package/dist/prisma/enums/ContestProblemPrerequisiteType.js +0 -4
  162. package/dist/prisma/enums/ContestRole.d.ts +0 -11
  163. package/dist/prisma/enums/ContestRole.js +0 -10
  164. package/dist/prisma/enums/ContestStatus.d.ts +0 -6
  165. package/dist/prisma/enums/ContestStatus.js +0 -5
  166. package/dist/prisma/enums/CourseRole.d.ts +0 -12
  167. package/dist/prisma/enums/CourseRole.js +0 -11
  168. package/dist/prisma/enums/EntityObjectType.d.ts +0 -13
  169. package/dist/prisma/enums/EntityObjectType.js +0 -12
  170. package/dist/prisma/enums/EntityRole.d.ts +0 -8
  171. package/dist/prisma/enums/EntityRole.js +0 -7
  172. package/dist/prisma/enums/EntitySubjectType.d.ts +0 -7
  173. package/dist/prisma/enums/EntitySubjectType.js +0 -6
  174. package/dist/prisma/enums/FileRole.d.ts +0 -9
  175. package/dist/prisma/enums/FileRole.js +0 -8
  176. package/dist/prisma/enums/FileType.d.ts +0 -5
  177. package/dist/prisma/enums/FileType.js +0 -4
  178. package/dist/prisma/enums/GroupType.d.ts +0 -5
  179. package/dist/prisma/enums/GroupType.js +0 -4
  180. package/dist/prisma/enums/JudgeType.d.ts +0 -12
  181. package/dist/prisma/enums/JudgeType.js +0 -11
  182. package/dist/prisma/enums/OrganizationPlan.d.ts +0 -7
  183. package/dist/prisma/enums/OrganizationPlan.js +0 -6
  184. package/dist/prisma/enums/ProblemRole.d.ts +0 -11
  185. package/dist/prisma/enums/ProblemRole.js +0 -10
  186. package/dist/prisma/enums/ProblemScoringMode.d.ts +0 -6
  187. package/dist/prisma/enums/ProblemScoringMode.js +0 -5
  188. package/dist/prisma/enums/ProblemType.d.ts +0 -6
  189. package/dist/prisma/enums/ProblemType.js +0 -5
  190. package/dist/prisma/enums/ProblemVerdict.d.ts +0 -14
  191. package/dist/prisma/enums/ProblemVerdict.js +0 -13
  192. package/dist/prisma/enums/ShareLinkVisibility.d.ts +0 -5
  193. package/dist/prisma/enums/ShareLinkVisibility.js +0 -4
  194. package/dist/prisma/enums/SubmissionRunStatus.d.ts +0 -18
  195. package/dist/prisma/enums/SubmissionRunStatus.js +0 -17
  196. package/dist/prisma/enums/SystemRole.d.ts +0 -9
  197. package/dist/prisma/enums/SystemRole.js +0 -8
  198. package/dist/prisma/enums/TeamRole.d.ts +0 -9
  199. package/dist/prisma/enums/TeamRole.js +0 -8
  200. package/dist/prisma/enums/TelemetryType.d.ts +0 -9
  201. package/dist/prisma/enums/TelemetryType.js +0 -8
  202. package/dist/prisma/enums/UserRole.d.ts +0 -10
  203. package/dist/prisma/enums/UserRole.js +0 -9
  204. package/dist/prisma/enums/WorkingIn.d.ts +0 -8
  205. package/dist/prisma/enums/WorkingIn.js +0 -7
  206. package/dist/prisma/enums/WorksheetContentType.d.ts +0 -10
  207. package/dist/prisma/enums/WorksheetContentType.js +0 -9
  208. package/dist/prisma/enums/index.d.ts +0 -26
  209. package/dist/prisma/enums/index.js +0 -26
  210. package/dist/prototypes/Date.js +0 -218
  211. package/dist/prototypes/Error.js +0 -17
  212. package/dist/prototypes/Number.d.ts +0 -7
  213. package/dist/prototypes/Number.js +0 -8
  214. package/dist/prototypes/index.d.ts +0 -3
  215. package/dist/prototypes/index.js +0 -3
  216. package/dist/types/account.js +0 -10
  217. package/dist/types/class.js +0 -7
  218. package/dist/types/comments.js +0 -1
  219. package/dist/types/commons.js +0 -69
  220. package/dist/types/company.d.ts +0 -6
  221. package/dist/types/company.js +0 -7
  222. package/dist/types/contest.js +0 -6
  223. package/dist/types/course.js +0 -1
  224. package/dist/types/entity.js +0 -50
  225. package/dist/types/excalidraw.js +0 -1
  226. package/dist/types/file.js +0 -13
  227. package/dist/types/group.js +0 -1
  228. package/dist/types/index.js +0 -23
  229. package/dist/types/judge.js +0 -17
  230. package/dist/types/markdown.js +0 -1
  231. package/dist/types/mermaid.js +0 -1
  232. package/dist/types/notification.js +0 -8
  233. package/dist/types/problems.js +0 -16
  234. package/dist/types/services.d.ts +0 -214
  235. package/dist/types/services.js +0 -147
  236. package/dist/types/sheet.js +0 -16
  237. package/dist/types/socket.js +0 -49
  238. package/dist/types/submission.js +0 -1
  239. package/dist/types/teams.js +0 -28
  240. package/dist/types/users.js +0 -33
  241. package/dist/types/worksheet.js +0 -11
  242. /package/dist/{constants → types/constants}/date.d.ts +0 -0
  243. /package/dist/{constants → types/constants}/email.d.ts +0 -0
  244. /package/dist/{constants → types/constants}/routing.d.ts +0 -0
  245. /package/dist/{constants → types/constants}/time.d.ts +0 -0
  246. /package/dist/{dto → types/dto}/image.d.ts +0 -0
  247. /package/dist/{dto → types/dto}/url.d.ts +0 -0
  248. /package/dist/{helpers → types/helpers}/comments.d.ts +0 -0
  249. /package/dist/{helpers → types/helpers}/file.d.ts +0 -0
  250. /package/dist/{prototypes → types/prototypes}/Date.d.ts +0 -0
  251. /package/dist/types/{account.d.ts → types/account.d.ts} +0 -0
  252. /package/dist/types/{comments.d.ts → types/comments.d.ts} +0 -0
  253. /package/dist/types/{notification.d.ts → types/notification.d.ts} +0 -0
  254. /package/dist/types/{submission.d.ts → types/submission.d.ts} +0 -0
@@ -0,0 +1,3347 @@
1
+ import { v4 } from 'uuid';
2
+
3
+ var ProfileSetting;
4
+ (function (ProfileSetting) {
5
+ ProfileSetting["NEWSLETTER_SUBSCRIPTION"] = "newsletterSubscription";
6
+ ProfileSetting["LANGUAGE"] = "preferredLanguage";
7
+ ProfileSetting["THEME"] = "preferredTheme";
8
+ ProfileSetting["DATA_VIEW_MODE"] = "preferredDataViewMode";
9
+ ProfileSetting["MENU_VIEW_MODE"] = "preferredMenuViewMode";
10
+ ProfileSetting["TIME_ZONE"] = "preferredTimeZone";
11
+ ProfileSetting["FONT_SIZE"] = "preferredFontSize";
12
+ })(ProfileSetting || (ProfileSetting = {}));
13
+
14
+ var AssignmentClass;
15
+ (function (AssignmentClass) {
16
+ AssignmentClass["NONE"] = "NONE";
17
+ AssignmentClass["COURSE"] = "COURSE";
18
+ AssignmentClass["WORKSHEET"] = "WORKSHEET";
19
+ AssignmentClass["CONTEST"] = "CONTEST";
20
+ })(AssignmentClass || (AssignmentClass = {}));
21
+
22
+ var CodeLanguage;
23
+ (function (CodeLanguage) {
24
+ CodeLanguage["C_11"] = "c11";
25
+ CodeLanguage["CPP_11"] = "cpp11";
26
+ CodeLanguage["CPP_20"] = "cpp20";
27
+ CodeLanguage["JAVA_21"] = "java21";
28
+ CodeLanguage["PYTHON_3"] = "python3";
29
+ CodeLanguage["PYTHON_PYPY_3"] = "pypy3";
30
+ CodeLanguage["JAVASCRIPT_NODE_JS_22"] = "nodejs22";
31
+ // DEPRECATED
32
+ CodeLanguage["PYTHON_2"] = "python2";
33
+ CodeLanguage["PYTHON_PYPY_2"] = "pypy2";
34
+ CodeLanguage["ICPC_C"] = "ICPC_C";
35
+ CodeLanguage["C"] = "C";
36
+ CodeLanguage["CPP"] = "CPP";
37
+ CodeLanguage["ICPC_CPP"] = "ICPC_CPP";
38
+ CodeLanguage["CPP11"] = "CPP11";
39
+ CodeLanguage["CPP14"] = "CPP14";
40
+ CodeLanguage["CPP17"] = "CPP17";
41
+ CodeLanguage["JAVA"] = "JAVA";
42
+ CodeLanguage["ICPC_PYTHON"] = "ICPC_PYTHON";
43
+ CodeLanguage["PYTHON"] = "PYTHON";
44
+ CodeLanguage["PYTHON2"] = "PYTHON2";
45
+ CodeLanguage["PYTHON3"] = "PYTHON3";
46
+ CodeLanguage["JAVASCRIPT"] = "JAVASCRIPT";
47
+ CodeLanguage["TYPESCRIPT"] = "TYPESCRIPT";
48
+ CodeLanguage["JSX"] = "JSX";
49
+ CodeLanguage["TSX"] = "TSX";
50
+ CodeLanguage["MDX"] = "MDX";
51
+ CodeLanguage["PSEUDOCODE_PSEINT"] = "PSEUDOCODE_PSEINT";
52
+ CodeLanguage["LATEX"] = "LATEX";
53
+ CodeLanguage["JSON"] = "JSON";
54
+ CodeLanguage["HTML"] = "HTML";
55
+ CodeLanguage["TEXT"] = "TEXT";
56
+ CodeLanguage["DIFF"] = "DIFF";
57
+ CodeLanguage["MARKDOWN"] = "MARKDOWN";
58
+ CodeLanguage["ARDUINO"] = "ARDUINO";
59
+ CodeLanguage["DOT"] = "DOT";
60
+ CodeLanguage["MERMAID"] = "MERMAID";
61
+ CodeLanguage["BASH"] = "BASH";
62
+ })(CodeLanguage || (CodeLanguage = {}));
63
+ var ScopeData;
64
+ (function (ScopeData) {
65
+ ScopeData["USER"] = "USER";
66
+ ScopeData["PROBLEM"] = "PROBLEM";
67
+ ScopeData["CONTEST"] = "CONTEST";
68
+ ScopeData["ATTEMPT"] = "ATTEMPT";
69
+ })(ScopeData || (ScopeData = {}));
70
+ var Status;
71
+ (function (Status) {
72
+ Status["SUCCESS"] = "SUCCESS";
73
+ Status["ERROR"] = "ERROR";
74
+ Status["LOADING"] = "LOADING";
75
+ Status["NONE"] = "NONE";
76
+ })(Status || (Status = {}));
77
+ var EntityStatus;
78
+ (function (EntityStatus) {
79
+ EntityStatus["PUBLIC"] = "PUBLIC";
80
+ EntityStatus["RESERVED"] = "RESERVED";
81
+ EntityStatus["PRIVATE"] = "PRIVATE";
82
+ EntityStatus["ARCHIVED"] = "ARCHIVED";
83
+ })(EntityStatus || (EntityStatus = {}));
84
+ var EntityAccess;
85
+ (function (EntityAccess) {
86
+ EntityAccess["PRIVATE"] = "PRIVATE";
87
+ EntityAccess["RESTRICTED"] = "RESTRICTED";
88
+ EntityAccess["PUBLIC"] = "PUBLIC";
89
+ EntityAccess["EXPOSED"] = "EXPOSED";
90
+ })(EntityAccess || (EntityAccess = {}));
91
+
92
+ var CompanyPlan;
93
+ (function (CompanyPlan) {
94
+ CompanyPlan["FREE"] = "FREE";
95
+ CompanyPlan["STANDARD"] = "STANDARD";
96
+ CompanyPlan["PREMIUM"] = "PREMIUM";
97
+ CompanyPlan["CUSTOM"] = "CUSTOM";
98
+ })(CompanyPlan || (CompanyPlan = {}));
99
+ var CompanyLogoType;
100
+ (function (CompanyLogoType) {
101
+ CompanyLogoType["HORIZONTAL_WHITE"] = "horizontal-white";
102
+ CompanyLogoType["HORIZONTAL_COLOR"] = "horizontal-color";
103
+ CompanyLogoType["VERTICAL_WHITE"] = "vertical-white";
104
+ CompanyLogoType["VERTICAL_COLOR"] = "vertical-color";
105
+ })(CompanyLogoType || (CompanyLogoType = {}));
106
+
107
+ var ContestStatus;
108
+ (function (ContestStatus) {
109
+ ContestStatus["PUBLIC"] = "PUBLIC";
110
+ ContestStatus["RESERVED"] = "RESERVED";
111
+ ContestStatus["ARCHIVED"] = "ARCHIVED";
112
+ })(ContestStatus || (ContestStatus = {}));
113
+ var ContestTimeStatus;
114
+ (function (ContestTimeStatus) {
115
+ ContestTimeStatus["UPCOMING"] = "upcoming";
116
+ ContestTimeStatus["LIVE"] = "live";
117
+ ContestTimeStatus["PAST"] = "past";
118
+ })(ContestTimeStatus || (ContestTimeStatus = {}));
119
+ var ContestProblemPrerequisiteType;
120
+ (function (ContestProblemPrerequisiteType) {
121
+ ContestProblemPrerequisiteType["INDIVIDUALLY"] = "INDIVIDUALLY";
122
+ ContestProblemPrerequisiteType["CONTEST"] = "CONTEST";
123
+ })(ContestProblemPrerequisiteType || (ContestProblemPrerequisiteType = {}));
124
+ var ContestEventAction;
125
+ (function (ContestEventAction) {
126
+ ContestEventAction["DATA_UPDATE"] = "DATA_UPDATE";
127
+ ContestEventAction["SCOREBOARD_RECALCULATE"] = "SCOREBOARD_RECALCULATE";
128
+ ContestEventAction["SCOREBOARD_UNLOCK"] = "SCOREBOARD_UNLOCK";
129
+ ContestEventAction["SCOREBOARD_LOCK"] = "SCOREBOARD_LOCK";
130
+ ContestEventAction["ENABLE_UPSOLVING"] = "ENABLE_UPSOLVING";
131
+ ContestEventAction["DISABLE_UPSOLVING"] = "DISABLE_UPSOLVING";
132
+ ContestEventAction["PARTICIPANT_JOIN"] = "PARTICIPANT_JOIN";
133
+ })(ContestEventAction || (ContestEventAction = {}));
134
+
135
+ var EntityMembersRank;
136
+ (function (EntityMembersRank) {
137
+ EntityMembersRank["NONE"] = "NONE";
138
+ EntityMembersRank["CLOSE"] = "CLOSE";
139
+ EntityMembersRank["OPEN"] = "OPEN";
140
+ })(EntityMembersRank || (EntityMembersRank = {}));
141
+ var EntityState;
142
+ (function (EntityState) {
143
+ EntityState["RELEASED"] = "RELEASED";
144
+ EntityState["ARCHIVED"] = "ARCHIVED";
145
+ })(EntityState || (EntityState = {}));
146
+ var EntityCollection;
147
+ (function (EntityCollection) {
148
+ EntityCollection["COMPANY"] = "COMPANY";
149
+ EntityCollection["PROBLEM"] = "PROBLEM";
150
+ EntityCollection["CONTEST"] = "CONTEST";
151
+ EntityCollection["JUDGE"] = "JUDGE";
152
+ EntityCollection["USER"] = "USER";
153
+ EntityCollection["SUBMISSION"] = "SUBMISSION";
154
+ })(EntityCollection || (EntityCollection = {}));
155
+ var CollectionKey;
156
+ (function (CollectionKey) {
157
+ CollectionKey["COMPANY"] = "C";
158
+ CollectionKey["USER"] = "U";
159
+ CollectionKey["PROBLEM"] = "P";
160
+ CollectionKey["CLASS"] = "K";
161
+ CollectionKey["CLASS_ASSIGNMENT"] = "KA";
162
+ CollectionKey["CONTEST"] = "T";
163
+ CollectionKey["SCOREBOARD"] = "B";
164
+ CollectionKey["SCOREBOARD_EVENTS"] = "BE";
165
+ CollectionKey["COURSE"] = "R";
166
+ CollectionKey["FILE"] = "F";
167
+ CollectionKey["GROUP"] = "G";
168
+ CollectionKey["JUDGE"] = "J";
169
+ CollectionKey["WORKSHEET"] = "W";
170
+ CollectionKey["WORKSHEET_SUBMISSIONS"] = "WS";
171
+ CollectionKey["SUBMIT"] = "S";
172
+ CollectionKey["LOCALE"] = "L";
173
+ CollectionKey["COMMENT"] = "M";
174
+ CollectionKey["EXCALIDRAW"] = "E";
175
+ CollectionKey["MARKDOWN"] = "MD";
176
+ CollectionKey["DOCUMENT_TEMPLATE"] = "DT";
177
+ CollectionKey["MERMAID"] = "MM";
178
+ })(CollectionKey || (CollectionKey = {}));
179
+ var LogOperation;
180
+ (function (LogOperation) {
181
+ LogOperation["REMOVE"] = "REMOVE";
182
+ LogOperation["ADD"] = "ADD";
183
+ LogOperation["UPDATE"] = "UPDATE";
184
+ })(LogOperation || (LogOperation = {}));
185
+
186
+ var FileMemberRole;
187
+ (function (FileMemberRole) {
188
+ FileMemberRole["VIEWER"] = "VIEWER";
189
+ FileMemberRole["EDITOR"] = "EDITOR";
190
+ })(FileMemberRole || (FileMemberRole = {}));
191
+ var FileType;
192
+ (function (FileType) {
193
+ FileType["FOLDER"] = "FOLDER";
194
+ FileType["FILE"] = "FILE";
195
+ })(FileType || (FileType = {}));
196
+ var FilesJukiPub;
197
+ (function (FilesJukiPub) {
198
+ FilesJukiPub["SHARED"] = "shared";
199
+ FilesJukiPub["SHARED_EXCALIDRAW"] = "shared/E";
200
+ FilesJukiPub["TEMP"] = "temp";
201
+ FilesJukiPub["PROBLEMS"] = "problems";
202
+ FilesJukiPub["CONTESTS"] = "contests";
203
+ })(FilesJukiPub || (FilesJukiPub = {}));
204
+
205
+ var GroupType;
206
+ (function (GroupType) {
207
+ GroupType["CLASS"] = "CLASS";
208
+ GroupType["TEAM"] = "TEAM";
209
+ })(GroupType || (GroupType = {}));
210
+
211
+ var Judge;
212
+ (function (Judge) {
213
+ Judge["JUKI_JUDGE"] = "JUKI_JUDGE";
214
+ Judge["CODEFORCES"] = "CODEFORCES";
215
+ Judge["CODEFORCES_GYM"] = "CODEFORCES_GYM";
216
+ Judge["JV_UMSA"] = "JV_UMSA";
217
+ Judge["UVA_ONLINE_JUDGE"] = "UVA_ONLINE_JUDGE";
218
+ Judge["AT_CODER"] = "AT_CODER";
219
+ Judge["CODECHEF"] = "CODECHEF";
220
+ Judge["TOPCODER"] = "TOPCODER";
221
+ Judge["LEETCODE"] = "LEETCODE";
222
+ })(Judge || (Judge = {}));
223
+ var ProblemVerdict;
224
+ (function (ProblemVerdict) {
225
+ ProblemVerdict["NONE"] = "NONE";
226
+ ProblemVerdict["PENDING"] = "PENDING";
227
+ ProblemVerdict["HIDDEN"] = "HIDDEN";
228
+ ProblemVerdict["CE"] = "CE";
229
+ ProblemVerdict["RE"] = "RE";
230
+ ProblemVerdict["TLE"] = "TLE";
231
+ ProblemVerdict["MLE"] = "MLE";
232
+ ProblemVerdict["WA"] = "WA";
233
+ ProblemVerdict["PE"] = "PE";
234
+ ProblemVerdict["PA"] = "PA";
235
+ ProblemVerdict["AC"] = "AC";
236
+ })(ProblemVerdict || (ProblemVerdict = {}));
237
+ var SubmissionRunStatus;
238
+ (function (SubmissionRunStatus) {
239
+ SubmissionRunStatus["NONE"] = "NONE";
240
+ SubmissionRunStatus["RECEIVED"] = "RECEIVED";
241
+ SubmissionRunStatus["COMPILING"] = "COMPILING";
242
+ SubmissionRunStatus["COMPILED"] = "COMPILED";
243
+ SubmissionRunStatus["COMPILATION_ERROR"] = "COMPILATION_ERROR";
244
+ SubmissionRunStatus["FETCHING_TEST_CASES"] = "FETCHING_TEST_CASES";
245
+ SubmissionRunStatus["RUNNING_TEST_CASE"] = "RUNNING_TEST_CASE";
246
+ SubmissionRunStatus["RUNNING_TEST_CASES"] = "RUNNING_TEST_CASES";
247
+ SubmissionRunStatus["RUNNING_SAMPLE_TEST_CASES"] = "RUNNING_SAMPLE_TEST_CASES";
248
+ SubmissionRunStatus["EXECUTED_TEST_CASE"] = "EXECUTED_TEST_CASE";
249
+ SubmissionRunStatus["FAILED_TEST_CASE"] = "FAILED_TEST_CASE";
250
+ SubmissionRunStatus["JUDGING_TEST_CASE"] = "JUDGING_TEST_CASE";
251
+ SubmissionRunStatus["GRADING"] = "GRADING";
252
+ SubmissionRunStatus["FAILED"] = "FAILED";
253
+ SubmissionRunStatus["COMPLETED"] = "COMPLETED";
254
+ })(SubmissionRunStatus || (SubmissionRunStatus = {}));
255
+ var RunnerType;
256
+ (function (RunnerType) {
257
+ RunnerType["HIGH_PERFORMANCE"] = "HIGH_PERFORMANCE";
258
+ RunnerType["LOW_PERFORMANCE"] = "LOW_PERFORMANCE";
259
+ })(RunnerType || (RunnerType = {}));
260
+
261
+ var NotificationType;
262
+ (function (NotificationType) {
263
+ NotificationType["SUCCESS"] = "success";
264
+ NotificationType["INFO"] = "info";
265
+ NotificationType["WARNING"] = "warning";
266
+ NotificationType["ERROR"] = "error";
267
+ NotificationType["QUIET"] = "quiet";
268
+ })(NotificationType || (NotificationType = {}));
269
+
270
+ /**
271
+ * Enums
272
+ */
273
+ // Based on
274
+ // https://github.com/microsoft/TypeScript/issues/3192#issuecomment-261720275
275
+ const CourseStatus = {
276
+ RELEASED: 'RELEASED',
277
+ IN_DRAFT: 'IN_DRAFT',
278
+ IN_REVIEW: 'IN_REVIEW',
279
+ ARCHIVED: 'ARCHIVED',
280
+ };
281
+ const CourseType = {
282
+ PUBLIC: 'PUBLIC',
283
+ PRIVATE: 'PRIVATE',
284
+ CLOSED: 'CLOSED',
285
+ };
286
+ const AssignmentType = {
287
+ READING_PDF: 'READING_PDF',
288
+ READING_WEB: 'READING_WEB',
289
+ SOLVE_JUKI_JUDGE_PROBLEM: 'SOLVE_JUKI_JUDGE_PROBLEM',
290
+ SOLVE_CODEFORCES_JUDGE_PROBLEM: 'SOLVE_CODEFORCES_JUDGE_PROBLEM',
291
+ };
292
+ const AssignmentState = {
293
+ ASSIGNED: 'ASSIGNED',
294
+ IN_PROGRESS: 'IN_PROGRESS',
295
+ TO_REVIEW: 'TO_REVIEW',
296
+ RESOLVED: 'RESOLVED',
297
+ };
298
+ const TeamStatus = {
299
+ ACTIVE: 'ACTIVE',
300
+ REPORTED: 'REPORTED',
301
+ ARCHIVED: 'ARCHIVED',
302
+ };
303
+ const MemberRole = {
304
+ COACH: 'COACH',
305
+ CO_COACH: 'CO_COACH',
306
+ CONTESTANT: 'CONTESTANT',
307
+ ATTENDEE: 'ATTENDEE',
308
+ RESERVE: 'RESERVE',
309
+ STAFF: 'STAFF',
310
+ };
311
+ const UserTeamStatus = {
312
+ PENDING: 'PENDING',
313
+ ACCEPTED: 'ACCEPTED',
314
+ REJECTED: 'REJECTED',
315
+ };
316
+ const Language = {
317
+ ES: 'ES',
318
+ EN: 'EN',
319
+ };
320
+ const Theme = {
321
+ LIGHT: 'LIGHT',
322
+ DARK: 'DARK',
323
+ };
324
+ const EmailSubscription = {
325
+ NONE: 'NONE',
326
+ RANKED_CONTESTS: 'RANKED_CONTESTS',
327
+ WEEKLY_NEWS_SUBSCRIPTION: 'WEEKLY_NEWS_SUBSCRIPTION',
328
+ MONTHLY_NEWS_SUBSCRIPTION: 'MONTHLY_NEWS_SUBSCRIPTION',
329
+ };
330
+ const EmailValidationState = {
331
+ PENDING: 'PENDING',
332
+ VALIDATED: 'VALIDATED',
333
+ };
334
+ const UserStatus = {
335
+ ACTIVE: 'ACTIVE',
336
+ REPORTED: 'REPORTED',
337
+ ARCHIVED: 'ARCHIVED',
338
+ };
339
+ const UserRole = {
340
+ RESTRICTED: 'RESTRICTED',
341
+ GUEST: 'GUEST',
342
+ LIMITED: 'LIMITED',
343
+ REGULAR: 'REGULAR',
344
+ MANAGER: 'MANAGER',
345
+ ADMIN: 'ADMIN',
346
+ SUPER_ADMIN: 'SUPER_ADMIN',
347
+ };
348
+ const SystemRole = {
349
+ GUEST: 'GUEST',
350
+ REGULAR: 'REGULAR',
351
+ MANAGER: 'MANAGER',
352
+ MASTER: 'MASTER',
353
+ ADMIN: 'ADMIN',
354
+ SUPER_ADMIN: 'SUPER_ADMIN',
355
+ };
356
+ const TeamRole = {
357
+ RESTRICTED: 'RESTRICTED',
358
+ GUEST: 'GUEST',
359
+ REGULAR: 'REGULAR',
360
+ MANAGER: 'MANAGER',
361
+ ADMIN: 'ADMIN',
362
+ SUPER_ADMIN: 'SUPER_ADMIN',
363
+ };
364
+ const CourseRole = {
365
+ RESTRICTED: 'RESTRICTED',
366
+ GUEST: 'GUEST',
367
+ REGULAR: 'REGULAR',
368
+ CREATOR: 'CREATOR',
369
+ SUPER_CREATOR: 'SUPER_CREATOR',
370
+ MANAGER: 'MANAGER',
371
+ MASTER: 'MASTER',
372
+ ADMIN: 'ADMIN',
373
+ SUPER_ADMIN: 'SUPER_ADMIN',
374
+ };
375
+
376
+ var TypeTestCase;
377
+ (function (TypeTestCase) {
378
+ TypeTestCase["INPUT"] = "INPUT";
379
+ TypeTestCase["OUTPUT"] = "OUTPUT";
380
+ })(TypeTestCase || (TypeTestCase = {}));
381
+ var ProblemInput;
382
+ (function (ProblemInput) {
383
+ ProblemInput["STANDARD"] = "STANDARD";
384
+ ProblemInput["INTERACTIVE"] = "INTERACTIVE";
385
+ })(ProblemInput || (ProblemInput = {}));
386
+ var ProblemOutput;
387
+ (function (ProblemOutput) {
388
+ ProblemOutput["STANDARD"] = "STANDARD";
389
+ ProblemOutput["DYNAMIC"] = "DYNAMIC";
390
+ ProblemOutput["INTERACTIVE"] = "INTERACTIVE";
391
+ })(ProblemOutput || (ProblemOutput = {}));
392
+ var ProblemType;
393
+ (function (ProblemType) {
394
+ ProblemType["STANDARD"] = "STANDARD";
395
+ ProblemType["DYNAMIC"] = "DYNAMIC";
396
+ ProblemType["INTERACTIVE"] = "INTERACTIVE";
397
+ })(ProblemType || (ProblemType = {}));
398
+ var ProblemScoringMode;
399
+ (function (ProblemScoringMode) {
400
+ ProblemScoringMode["SUBTASK"] = "SUBTASK";
401
+ ProblemScoringMode["TOTAL"] = "TOTAL";
402
+ ProblemScoringMode["PARTIAL"] = "PARTIAL";
403
+ })(ProblemScoringMode || (ProblemScoringMode = {}));
404
+
405
+ var ErrorCode;
406
+ (function (ErrorCode) {
407
+ // General errors
408
+ ErrorCode["ERR400"] = "ERR400";
409
+ ErrorCode["ERR401"] = "ERR401";
410
+ ErrorCode["ERR403"] = "ERR403";
411
+ ErrorCode["ERR404"] = "ERR404";
412
+ ErrorCode["ERR405"] = "ERR405";
413
+ ErrorCode["ERR500"] = "ERR500";
414
+ // UI general errors
415
+ ErrorCode["ERR9997"] = "ERR9997";
416
+ ErrorCode["ERR9998"] = "ERR9998";
417
+ ErrorCode["ERR9999"] = "ERR9999";
418
+ // User errors // 'unable update nickname yet', 'User not active'
419
+ ErrorCode["ERR0000"] = "ERR0000";
420
+ ErrorCode["ERR0010"] = "ERR0010";
421
+ ErrorCode["ERR0011"] = "ERR0011";
422
+ ErrorCode["ERR0012"] = "ERR0012";
423
+ ErrorCode["ERR0013"] = "ERR0013";
424
+ ErrorCode["ERR0014"] = "ERR0014";
425
+ ErrorCode["ERR0015"] = "ERR0015";
426
+ ErrorCode["ERR0016"] = "ERR0016";
427
+ ErrorCode["ERR0017"] = "ERR0017";
428
+ ErrorCode["ERR0018"] = "ERR0018";
429
+ ErrorCode["ERR0019"] = "ERR0019";
430
+ ErrorCode["ERR0020"] = "ERR0020";
431
+ ErrorCode["ERR0021"] = "ERR0021";
432
+ ErrorCode["ERR0022"] = "ERR0022";
433
+ ErrorCode["ERR0023"] = "ERR0023";
434
+ ErrorCode["ERR0024"] = "ERR0024";
435
+ ErrorCode["ERR0050"] = "ERR0050";
436
+ ErrorCode["ERR0051"] = "ERR0051";
437
+ ErrorCode["ERR0052"] = "ERR0052";
438
+ ErrorCode["ERR0053"] = "ERR0053";
439
+ // Problem Errors ERR01XX',
440
+ ErrorCode["ERR0100"] = "ERR0100";
441
+ ErrorCode["ERR0110"] = "ERR0110";
442
+ ErrorCode["ERR0111"] = "ERR0111";
443
+ ErrorCode["ERR0112"] = " ERR0112";
444
+ ErrorCode["ERR0113"] = "ERR0113";
445
+ ErrorCode["ERR0114"] = "ERR0114";
446
+ ErrorCode["ERR0115"] = "ERR0115";
447
+ ErrorCode["ERR0116"] = "ERR0116";
448
+ ErrorCode["ERR0117"] = "ERR0117";
449
+ ErrorCode["ERR0118"] = "ERR0118";
450
+ ErrorCode["ERR0119"] = "ERR0119";
451
+ ErrorCode["ERR0120"] = "ERR0120";
452
+ ErrorCode["ERR0121"] = "ERR0121";
453
+ ErrorCode["ERR0122"] = "ERR0122";
454
+ // Contest Errors ERR02XX',
455
+ ErrorCode["ERR0200"] = "ERR0200";
456
+ // CRUD contest
457
+ ErrorCode["ERR0210"] = "ERR0210";
458
+ ErrorCode["ERR0211"] = "ERR0211";
459
+ ErrorCode["ERR0212"] = "ERR0212";
460
+ ErrorCode["ERR0213"] = "ERR0213";
461
+ // permissions contest
462
+ ErrorCode["ERR0214"] = "ERR0214";
463
+ ErrorCode["ERR0215"] = "ERR0215";
464
+ ErrorCode["ERR0216"] = "ERR0216";
465
+ ErrorCode["ERR0217"] = "ERR0217";
466
+ ErrorCode["ERR0218"] = "ERR0218";
467
+ ErrorCode["ERR0219"] = "ERR0219";
468
+ ErrorCode["ERR0220"] = "ERR0220";
469
+ // CRUD scoreboard
470
+ ErrorCode["ERR0230"] = "ERR0230";
471
+ ErrorCode["ERR0231"] = "ERR0231";
472
+ ErrorCode["ERR0232"] = "ERR0232";
473
+ ErrorCode["ERR0233"] = "ERR0233";
474
+ // permissions scoreboard
475
+ ErrorCode["ERR0234"] = "ERR0234";
476
+ ErrorCode["ERR0235"] = "ERR0235";
477
+ ErrorCode["ERR0236"] = "ERR0236";
478
+ ErrorCode["ERR0237"] = "ERR0237";
479
+ ErrorCode["ERR0240"] = "ERR0240";
480
+ ErrorCode["ERR0241"] = "ERR0241";
481
+ ErrorCode["ERR0242"] = "ERR0242";
482
+ ErrorCode["ERR0243"] = "ERR0243";
483
+ ErrorCode["ERR0244"] = "ERR0244";
484
+ ErrorCode["ERR0245"] = "ERR0245";
485
+ ErrorCode["ERR0246"] = "ERR0246";
486
+ ErrorCode["ERR0247"] = "ERR0247";
487
+ // Submission Errors ERR03XXX',
488
+ ErrorCode["ERR0300"] = "ERR0300";
489
+ ErrorCode["ERR0301"] = "ERR0301";
490
+ ErrorCode["ERR0302"] = "ERR0302";
491
+ ErrorCode["ERR0303"] = "ERR0303";
492
+ ErrorCode["ERR0310"] = "ERR0310";
493
+ ErrorCode["ERR0311"] = "ERR0311";
494
+ ErrorCode["ERR0321"] = "ERR0321";
495
+ ErrorCode["ERR0331"] = "ERR0331";
496
+ // Utils Errors ERR04XX
497
+ ErrorCode["ERR0400"] = "ERR0400";
498
+ ErrorCode["ERR0410"] = "ERR0410";
499
+ ErrorCode["ERR0420"] = "ERR0420";
500
+ ErrorCode["ERR0421"] = "ERR0421";
501
+ ErrorCode["ERR0430"] = "ERR0430";
502
+ ErrorCode["ERR0440"] = "ERR0440";
503
+ // Team Errors ERR06XX
504
+ ErrorCode["ERR0600"] = "ERR0600";
505
+ ErrorCode["ERR0610"] = "ERR0610";
506
+ ErrorCode["ERR0611"] = "ERR0611";
507
+ ErrorCode["ERR0612"] = "ERR0612";
508
+ ErrorCode["ERR0613"] = "ERR0613";
509
+ ErrorCode["ERR0614"] = "ERR0614";
510
+ ErrorCode["ERR0615"] = "ERR0615";
511
+ ErrorCode["ERR0616"] = "ERR0665";
512
+ ErrorCode["ERR0617"] = "ERR0617";
513
+ ErrorCode["ERR0618"] = "ERR0618";
514
+ ErrorCode["ERR0619"] = "ERR0619";
515
+ // Course Errors ERR07XXX',
516
+ // Sheets Errors ERR08XXX',
517
+ ErrorCode["ERR0800"] = "ERR0800";
518
+ ErrorCode["ERR0810"] = "ERR0810";
519
+ ErrorCode["ERR0811"] = "ERR0811";
520
+ ErrorCode["ERR0812"] = "ERR0812";
521
+ ErrorCode["ERR0813"] = "ERR0813";
522
+ ErrorCode["ERR0814"] = "ERR0814";
523
+ ErrorCode["ERR0815"] = "ERR0815";
524
+ ErrorCode["ERR0816"] = "ERR0865";
525
+ ErrorCode["ERR0817"] = "ERR0817";
526
+ ErrorCode["ERR0818"] = "ERR0818";
527
+ ErrorCode["ERR0819"] = "ERR0819";
528
+ ErrorCode["ERR0820"] = "ERR0820";
529
+ // Company Errors ERR99XXX',
530
+ ErrorCode["ERR9900"] = "ERR9900";
531
+ ErrorCode["ERR9910"] = "ERR9910";
532
+ ErrorCode["ERR9911"] = "ERR9911";
533
+ ErrorCode["ERR9912"] = "ERR9912";
534
+ ErrorCode["ERR9913"] = "ERR9913";
535
+ ErrorCode["ERR9914"] = "ERR9914";
536
+ ErrorCode["ERR9915"] = "ERR9915";
537
+ ErrorCode["ERR9916"] = "ERR9916";
538
+ ErrorCode["ERR9917"] = "ERR9917";
539
+ })(ErrorCode || (ErrorCode = {}));
540
+ var LogLevel;
541
+ (function (LogLevel) {
542
+ LogLevel["FATAL"] = "FATAL";
543
+ LogLevel["ERROR"] = "ERROR";
544
+ LogLevel["WARN"] = "WARN";
545
+ LogLevel["INFO"] = "INFO";
546
+ LogLevel["DEBUG"] = "DEBUG";
547
+ LogLevel["TRACE"] = "TRACE";
548
+ })(LogLevel || (LogLevel = {}));
549
+ var HTTPMethod;
550
+ (function (HTTPMethod) {
551
+ HTTPMethod["POST"] = "POST";
552
+ HTTPMethod["GET"] = "GET";
553
+ HTTPMethod["PUT"] = "PUT";
554
+ HTTPMethod["PATCH"] = "PATCH";
555
+ HTTPMethod["DELETE"] = "DELETE";
556
+ })(HTTPMethod || (HTTPMethod = {}));
557
+
558
+ var WorksheetType;
559
+ (function (WorksheetType) {
560
+ WorksheetType["JK_MD"] = "JK_MD";
561
+ WorksheetType["CODE_EDITOR"] = "CODE_EDITOR";
562
+ WorksheetType["LIST"] = "LIST";
563
+ WorksheetType["GRAPH"] = "GRAPH";
564
+ WorksheetType["QUIZ_PROBLEM"] = "QUIZ_PROBLEM";
565
+ WorksheetType["QUIZ_TEXT"] = "QUIZ_TEXT";
566
+ WorksheetType["QUIZ_OPTIONS"] = "QUIZ_OPTIONS";
567
+ WorksheetType["NEW_PAGE"] = "NEW_PAGE";
568
+ })(WorksheetType || (WorksheetType = {}));
569
+ var QuizScoringMode;
570
+ (function (QuizScoringMode) {
571
+ QuizScoringMode["TOTAL"] = "TOTAL";
572
+ QuizScoringMode["PARTIAL"] = "PARTIAL";
573
+ })(QuizScoringMode || (QuizScoringMode = {}));
574
+
575
+ var WebSocketMessageEvent;
576
+ (function (WebSocketMessageEvent) {
577
+ WebSocketMessageEvent["PING"] = "PING";
578
+ WebSocketMessageEvent["CLIENT_TRACK_LOCATION"] = "CLIENT_TRACK_LOCATION";
579
+ WebSocketMessageEvent["CLIENT_TRACK_SCREENSHOT"] = "CLIENT_TRACK_SCREENSHOT";
580
+ WebSocketMessageEvent["CLIENT_TRACK_DEVICE"] = "CLIENT_TRACK_DEVICE";
581
+ WebSocketMessageEvent["CHAT_COMPLETIONS"] = "CHAT_COMPLETIONS";
582
+ })(WebSocketMessageEvent || (WebSocketMessageEvent = {}));
583
+ var WebSocketSubscriptionEvent;
584
+ (function (WebSocketSubscriptionEvent) {
585
+ WebSocketSubscriptionEvent["SUBSCRIBE_CODE_RUN_STATUS"] = "SUBSCRIBE_CODE_RUN_STATUS";
586
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_CODE_RUN_STATUS"] = "UNSUBSCRIBE_CODE_RUN_STATUS";
587
+ WebSocketSubscriptionEvent["SUBSCRIBE_SUBMISSION_RUN_STATUS"] = "SUBSCRIBE_SUBMISSION_RUN_STATUS";
588
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_SUBMISSION_RUN_STATUS"] = "UNSUBSCRIBE_SUBMISSION_RUN_STATUS";
589
+ WebSocketSubscriptionEvent["SUBSCRIBE_GET_DATA"] = "SUBSCRIBE_GET_DATA";
590
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_GET_DATA"] = "SUBSCRIBE_GET_DATA";
591
+ WebSocketSubscriptionEvent["SUBSCRIBE_PROBLEM_CRAWLED"] = "SUBSCRIBE_PROBLEM_CRAWLED";
592
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_PROBLEM_CRAWLED"] = "UNSUBSCRIBE_PROBLEM_CRAWLED";
593
+ WebSocketSubscriptionEvent["SUBSCRIBE_SUBMISSIONS_CRAWL"] = "SUBSCRIBE_SUBMISSIONS_CRAWL";
594
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_SUBMISSIONS_CRAWL"] = "UNSUBSCRIBE_SUBMISSIONS_CRAWL";
595
+ WebSocketSubscriptionEvent["SUBSCRIBE_CONTEST_CHANGES"] = "SUBSCRIBE_CONTEST_CHANGES";
596
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_CONTEST_CHANGES"] = "UNSUBSCRIBE_CONTEST_CHANGES";
597
+ WebSocketSubscriptionEvent["SUBSCRIBE_CLIENT_TRACK"] = "SUBSCRIBE_CLIENT_TRACK";
598
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_CLIENT_TRACK"] = "UNSUBSCRIBE_CLIENT_TRACK";
599
+ WebSocketSubscriptionEvent["SUBSCRIBE_USER_NOTIFICATION"] = "SUBSCRIBE_USER_NOTIFICATION";
600
+ WebSocketSubscriptionEvent["UNSUBSCRIBE_USER_NOTIFICATION"] = "UNSUBSCRIBE_USER_NOTIFICATION";
601
+ })(WebSocketSubscriptionEvent || (WebSocketSubscriptionEvent = {}));
602
+ var WebSocketResponseEvent;
603
+ (function (WebSocketResponseEvent) {
604
+ WebSocketResponseEvent["PONG"] = "PONG";
605
+ WebSocketResponseEvent["CODE_RUN_STATUS"] = "CODE_RUN_STATUS";
606
+ WebSocketResponseEvent["SUBMISSION_RUN_STATUS"] = "SUBMISSION_RUN_STATUS";
607
+ WebSocketResponseEvent["USER_MESSAGE"] = "USER_MESSAGE";
608
+ WebSocketResponseEvent["SEND_DATA_"] = "SEND_DATA_";
609
+ WebSocketResponseEvent["SEND_DATA_ECS_TASK_DEFINITIONS_LIST"] = "SEND_DATA_ECS_TASK_DEFINITIONS_LIST";
610
+ WebSocketResponseEvent["SEND_DATA_ECS_TASKS_LIST"] = "SEND_DATA_ECS_TASKS_LIST";
611
+ WebSocketResponseEvent["SEND_DATA_EC2_INSTANCES_LIST"] = "SEND_DATA_EC2_INSTANCES_LIST";
612
+ WebSocketResponseEvent["SEND_DATA_SSM_SESSIONS_LIST"] = "SEND_DATA_SSM_SESSIONS_LIST";
613
+ WebSocketResponseEvent["SEND_DATA_RUN_COMMAND"] = "SEND_DATA_RUN_COMMAND";
614
+ WebSocketResponseEvent["SEND_DATA_CLIENT_TRACK"] = "SEND_DATA_CLIENT_TRACK";
615
+ WebSocketResponseEvent["SEND_DATA_CHAT_COMPLETIONS"] = "SEND_DATA_CHAT_COMPLETIONS";
616
+ WebSocketResponseEvent["PROBLEM_CRAWLED"] = "PROBLEM_CRAWLED";
617
+ WebSocketResponseEvent["SUBMISSIONS_CRAWL"] = "SUBMISSIONS_CRAWL";
618
+ WebSocketResponseEvent["CONTEST_CHANGES"] = "CONTEST_CHANGES";
619
+ WebSocketResponseEvent["CLIENT_TRACK"] = "CLIENT_TRACK";
620
+ WebSocketResponseEvent["USER_NOTIFICATION_"] = "USER_NOTIFICATION_";
621
+ WebSocketResponseEvent["USER_NOTIFICATION_SUBMISSION"] = "USER_NOTIFICATION_SUBMISSION";
622
+ WebSocketResponseEvent["USER_NOTIFICATION_CONTEST_CLARIFICATION"] = "USER_NOTIFICATION_CONTEST_CLARIFICATION";
623
+ })(WebSocketResponseEvent || (WebSocketResponseEvent = {}));
624
+
625
+ var DataViewMode;
626
+ (function (DataViewMode) {
627
+ DataViewMode["CARDS"] = "CARDS";
628
+ DataViewMode["ROWS"] = "ROWS";
629
+ })(DataViewMode || (DataViewMode = {}));
630
+ var MenuViewMode;
631
+ (function (MenuViewMode) {
632
+ MenuViewMode["HORIZONTAL"] = "HORIZONTAL";
633
+ MenuViewMode["VERTICAL"] = "VERTICAL";
634
+ })(MenuViewMode || (MenuViewMode = {}));
635
+ var Role;
636
+ (function (Role) {
637
+ Role["SUPER_ADMIN"] = "SUPER_ADMIN";
638
+ Role["ADMIN"] = "ADMIN";
639
+ Role["MASTER"] = "MASTER";
640
+ Role["MANAGER"] = "MANAGER";
641
+ Role["CREATOR"] = "CREATOR";
642
+ Role["REGULAR"] = "REGULAR";
643
+ Role["LIMITED"] = "LIMITED";
644
+ Role["GUEST"] = "GUEST";
645
+ Role["RESTRICTED"] = "RESTRICTED";
646
+ })(Role || (Role = {}));
647
+
648
+ var WorkingIn;
649
+ (function (WorkingIn) {
650
+ WorkingIn["NOTHING"] = "NOTHING";
651
+ WorkingIn["SEND_SUBMISSION"] = "SEND_SUBMISSION";
652
+ WorkingIn["TRACKING_SUBMISSION"] = "TRACKING_SUBMISSION";
653
+ WorkingIn["CRAWLING_LANGUAGES"] = "CRAWLING_LANGUAGES";
654
+ WorkingIn["CRAWLING_PROBLEM_DATA"] = "CRAWLING_PROBLEM_DATA";
655
+ })(WorkingIn || (WorkingIn = {}));
656
+
657
+ var AspectRatio;
658
+ (function (AspectRatio) {
659
+ AspectRatio["RATIO_21_9"] = "21:9";
660
+ AspectRatio["RATIO_20_9"] = "20:9";
661
+ AspectRatio["RATIO_16_9"] = "16:9";
662
+ AspectRatio["RATIO_16_10"] = "16:10";
663
+ AspectRatio["RATIO_3_2"] = "3:2";
664
+ AspectRatio["RATIO_4_3"] = "4:3";
665
+ AspectRatio["RATIO_5_4"] = "5:4";
666
+ AspectRatio["RATIO_1_1"] = "1:1";
667
+ })(AspectRatio || (AspectRatio = {}));
668
+
669
+ const LANGUAGE = {
670
+ [Language.EN]: { value: Language.EN, label: 'english' },
671
+ [Language.ES]: { value: Language.ES, label: 'español' },
672
+ };
673
+ const THEME = {
674
+ [Theme.LIGHT]: { value: Theme.LIGHT, label: 'light' },
675
+ [Theme.DARK]: { value: Theme.DARK, label: 'dark' },
676
+ };
677
+ const GCC_VERSION = `gcc (Debian 12.2.0-14+deb12u1) 12.2.0
678
+ Copyright (C) 2022 Free Software Foundation, Inc.
679
+ This is free software; see the source for copying conditions. There is NO
680
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.`;
681
+ const GPP_VERSION = `g++ (Debian 12.2.0-14+deb12u1) 12.2.0
682
+ Copyright (C) 2022 Free Software Foundation, Inc.
683
+ This is free software; see the source for copying conditions. There is NO
684
+ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.`;
685
+ const JAVAC_VERSION = `javac 17.0.15`;
686
+ const NODE_VERSION = `v20.19.2`;
687
+ const PYTHON3_VERSION = 'Python 3.11.2';
688
+ const PYPY3_VERSION = `Python 3.9.16 (7.3.11+dfsg-2+deb12u3, Dec 30 2024, 22:36:23)
689
+ [PyPy 7.3.11 with GCC 12.2.0]`;
690
+ const PSEINT_VERSION = `PSeInt 20230904-l64-wx3
691
+ http://pseint.sourceforge.net
692
+ by Pablo Novara (zaskar_84@yahoo.com.ar)
693
+ psExport 20230904-l64-wx3
694
+ http://pseint.sourceforge.net
695
+ by Pablo Novara (zaskar_84@yahoo.com.ar)`;
696
+ const C = {
697
+ mime: 'text/x-csrc',
698
+ mainFilename: 'main.c',
699
+ fileExtension: ['c'],
700
+ hasBuildFile: true,
701
+ executable: 'gcc',
702
+ executableVersion: GCC_VERSION,
703
+ templateSourceCode: '#include <stdio.h>\n \nint main(void) {\n \n printf("Hello World\\n");\n \n return 0;\n}',
704
+ monacoKey: 'c',
705
+ codeMirrorKey: 'c',
706
+ highlightJsKey: 'c',
707
+ };
708
+ const CPP = {
709
+ mime: 'text/x-c++src',
710
+ mainFilename: 'main.cpp',
711
+ fileExtension: ['cpp', 'c++', 'cxx', 'cc'],
712
+ hasBuildFile: true,
713
+ executable: 'g++',
714
+ executableVersion: GPP_VERSION,
715
+ templateSourceCode: '#include <iostream>\n\nusing namespace std;\n\n' + 'int main() {\n \n cout << "Hello World" << endl;\n \n return 0;\n}',
716
+ monacoKey: 'cpp',
717
+ codeMirrorKey: 'cpp',
718
+ highlightJsKey: 'cpp',
719
+ };
720
+ const PYTHON = {
721
+ mime: 'text/x-python',
722
+ mainFilename: 'main.py',
723
+ fileExtension: ['py'],
724
+ hasBuildFile: false,
725
+ templateSourceCode: 'print("Hello World\\n")',
726
+ monacoKey: 'python',
727
+ codeMirrorKey: 'python',
728
+ highlightJsKey: 'python',
729
+ };
730
+ const CODE_LANGUAGE = {
731
+ [CodeLanguage.C_11]: {
732
+ value: CodeLanguage.C_11,
733
+ label: 'C 11',
734
+ compilePattern: '/usr/bin/jk-c11 -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -fno-asm -lm -s -O2 -std=gnu11 -o ' +
735
+ '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
736
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
737
+ ...C,
738
+ /*
739
+ -static
740
+ Binario independiente.
741
+ -fno-optimize-sibling-calls
742
+ Desactiva la optimización de llamadas recursivas “tail call”. Facilita detectar desbordes de pila o trazas correctas.
743
+ -fno-strict-aliasing
744
+ Evita asumir aliasing de punteros agresivo. Previene bugs raros en código competitivo.
745
+ -DONLINE_JUDGE
746
+ Define la macro ONLINE_JUDGE, usada a veces para omitir logs o debug prints (#ifdef ONLINE_JUDGE).
747
+ -fno-asm
748
+ Prohíbe insertar código ensamblador inline (asm()). Seguridad en entornos restringidos.
749
+ -lm
750
+ Enlaza libm.
751
+ -s
752
+ “Strips symbols”: elimina toda información de depuración. Binario más pequeño y más difícil de desensamblar.
753
+ -O2
754
+ Nivel medio de optimización (rápido y seguro).
755
+ -std=gnu11
756
+ Usa el estándar C11 con extensiones GNU.
757
+ */
758
+ },
759
+ [CodeLanguage.CPP_11]: {
760
+ value: CodeLanguage.CPP_11,
761
+ label: 'C++ 11',
762
+ compilePattern: '/usr/bin/jk-cpp11 -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=gnu++11 -o ' +
763
+ '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
764
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
765
+ ...CPP,
766
+ },
767
+ [CodeLanguage.CPP_20]: {
768
+ value: CodeLanguage.CPP_20,
769
+ label: 'C++ 20',
770
+ compilePattern: '/usr/bin/jk-cpp20 -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=gnu++20 -o ' +
771
+ '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
772
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
773
+ ...CPP,
774
+ },
775
+ [CodeLanguage.JAVA_21]: {
776
+ value: CodeLanguage.JAVA_21,
777
+ label: 'Java 21',
778
+ mime: 'text/x-java',
779
+ mainFilename: 'Main.java',
780
+ fileExtension: ['java'],
781
+ compilePattern: "/usr/bin/jk-javac -cp '.;*' {{folder_path}}/{{source_full_file_name}}",
782
+ // compilePattern: 'javac {{folder_path}}/{{source_full_file_name}}',
783
+ // runPattern: 'java -cp {{folder_path}} {{class_name}}'
784
+ runPattern: '/usr/bin/jk-java -Xmx512M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -cp ' + '{{folder_path}} {{class_name}}',
785
+ templateSourceCode: 'class Main {\n public static void main (String[] args) {' + '\n \n System.out.println("Hello World");\n \n }\n}',
786
+ hasBuildFile: true,
787
+ executable: 'java',
788
+ executableVersion: JAVAC_VERSION,
789
+ monacoKey: 'java',
790
+ codeMirrorKey: 'java',
791
+ highlightJsKey: 'java',
792
+ },
793
+ [CodeLanguage.PYTHON_2]: {
794
+ // DEPRECATED
795
+ value: CodeLanguage.PYTHON_2,
796
+ label: 'Python 2 *',
797
+ compilePattern: '/usr/bin/jk-python2 -m py_compile {{folder_path}}/{{source_full_file_name}}',
798
+ runPattern: '/usr/bin/jk-python2 {{folder_path}}/{{source_full_file_name}}',
799
+ executable: 'python2',
800
+ executableVersion: PYPY3_VERSION,
801
+ ...PYTHON,
802
+ },
803
+ [CodeLanguage.PYTHON_3]: {
804
+ value: CodeLanguage.PYTHON_3,
805
+ label: 'Python 3',
806
+ compilePattern: '/usr/bin/jk-python3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
807
+ runPattern: '/usr/bin/jk-python3 {{folder_path}}/{{source_full_file_name}}',
808
+ executable: 'python3',
809
+ executableVersion: PYPY3_VERSION,
810
+ ...PYTHON,
811
+ },
812
+ [CodeLanguage.PYTHON_PYPY_2]: {
813
+ // DEPRECATED
814
+ value: CodeLanguage.PYTHON_PYPY_2,
815
+ label: 'PyPy 2 *',
816
+ compilePattern: '/usr/bin/jk-pypy2 -m py_compile {{folder_path}}/{{source_full_file_name}}',
817
+ runPattern: '/usr/bin/jk-pypy2 {{folder_path}}/{{source_full_file_name}}',
818
+ executable: 'pypy2',
819
+ executableVersion: PYPY3_VERSION,
820
+ ...PYTHON,
821
+ },
822
+ [CodeLanguage.PYTHON_PYPY_3]: {
823
+ value: CodeLanguage.PYTHON_PYPY_3,
824
+ label: 'PyPy 3',
825
+ compilePattern: '/usr/bin/jk-pypy3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
826
+ runPattern: '/usr/bin/jk-pypy3 {{folder_path}}/{{source_full_file_name}}',
827
+ executable: 'pypy3',
828
+ executableVersion: PYPY3_VERSION,
829
+ ...PYTHON,
830
+ },
831
+ [CodeLanguage.JAVASCRIPT_NODE_JS_22]: {
832
+ value: CodeLanguage.JAVASCRIPT_NODE_JS_22,
833
+ label: 'Javascript Node.js 22',
834
+ mime: 'application/x-javascript',
835
+ mainFilename: 'main.js',
836
+ fileExtension: ['js'],
837
+ compilePattern: '',
838
+ runPattern: '/usr/bin/jk-node22 {{folder_path}}/{{source_full_file_name}}',
839
+ templateSourceCode: 'console.log("Hello World\\n")',
840
+ hasBuildFile: false,
841
+ executable: 'node',
842
+ executableVersion: NODE_VERSION,
843
+ monacoKey: 'javascript',
844
+ codeMirrorKey: 'javascript',
845
+ highlightJsKey: 'javascript',
846
+ },
847
+ [CodeLanguage.ICPC_C]: {
848
+ // DEPRECATED
849
+ value: CodeLanguage.ICPC_C,
850
+ label: 'ICPC C *',
851
+ compilePattern: 'gcc -x c -g -O2 -std=gnu11 -static -lm -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
852
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
853
+ ...C,
854
+ },
855
+ [CodeLanguage.C]: {
856
+ // DEPRECATED
857
+ value: CodeLanguage.C,
858
+ label: 'C *',
859
+ compilePattern: 'gcc -static -fno-optimize-sibling-calls -fno-strict-aliasing -DONLINE_JUDGE -fno-asm -lm -s -O2 -o ' +
860
+ '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
861
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
862
+ ...C,
863
+ },
864
+ [CodeLanguage.ICPC_CPP]: {
865
+ // DEPRECATED
866
+ value: CodeLanguage.ICPC_CPP,
867
+ label: 'ICPC C++ *',
868
+ compilePattern: 'g++ -x c++ -static -g -O2 -std=gnu++20 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
869
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
870
+ ...CPP,
871
+ },
872
+ [CodeLanguage.CPP]: {
873
+ // DEPRECATED
874
+ value: CodeLanguage.CPP,
875
+ label: 'C++ *',
876
+ compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
877
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
878
+ ...CPP,
879
+ },
880
+ [CodeLanguage.CPP11]: {
881
+ // DEPRECATED
882
+ value: CodeLanguage.CPP11,
883
+ label: 'C++ 11 *',
884
+ compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++11 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
885
+ // compilePattern: 'g++ -O2 -s -Wall -std=c++11 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}} -lm',
886
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
887
+ ...CPP,
888
+ },
889
+ [CodeLanguage.CPP14]: {
890
+ // DEPRECATED
891
+ value: CodeLanguage.CPP14,
892
+ label: 'C++ 14 *',
893
+ // compilePattern: 'g++ -O2 -s -Wall -std=c++14 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}} -lm',
894
+ compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++14 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
895
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
896
+ ...CPP,
897
+ },
898
+ [CodeLanguage.CPP17]: {
899
+ // DEPRECATED
900
+ value: CodeLanguage.CPP17,
901
+ label: 'C++ 17 *',
902
+ // compilePattern: 'g++ -O2 -s -Wall -std=c++17 -o {{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}} -lm',
903
+ compilePattern: 'g++ -x c++ -static -DONLINE_JUDGE -lm -s -O2 -std=c++17 -o ' + '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}',
904
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
905
+ ...CPP,
906
+ },
907
+ [CodeLanguage.JAVA]: {
908
+ // DEPRECATED
909
+ value: CodeLanguage.JAVA,
910
+ label: 'Java *',
911
+ mime: 'text/x-java',
912
+ mainFilename: 'Main.java',
913
+ fileExtension: ['java'],
914
+ compilePattern: "javac -cp '.;*' {{folder_path}}/{{source_full_file_name}}",
915
+ // compilePattern: 'javac {{folder_path}}/{{source_full_file_name}}',
916
+ // runPattern: 'java -cp {{folder_path}} {{class_name}}'
917
+ runPattern: '/usr/lib/jvm/java-17-openjdk-amd64/bin/java -Xmx512M -Xss64M -DONLINE_JUDGE=true -Duser.language=en -Duser.region=US -Duser.variant=US -cp ' +
918
+ '{{folder_path}} {{class_name}}',
919
+ templateSourceCode: 'class Main {\n public static void main (String[] args) {' + '\n \n System.out.println("Hello World");\n \n }\n}',
920
+ hasBuildFile: true,
921
+ executable: 'javac',
922
+ executableVersion: JAVAC_VERSION,
923
+ monacoKey: 'java',
924
+ codeMirrorKey: 'java',
925
+ highlightJsKey: 'java',
926
+ },
927
+ [CodeLanguage.ICPC_PYTHON]: {
928
+ // DEPRECATED
929
+ value: CodeLanguage.ICPC_PYTHON,
930
+ label: 'ICPC Python *',
931
+ compilePattern: 'pypy3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
932
+ runPattern: '/usr/bin/pypy3 {{folder_path}}/{{source_full_file_name}}',
933
+ executable: 'pypy3',
934
+ executableVersion: PYPY3_VERSION,
935
+ ...PYTHON,
936
+ },
937
+ [CodeLanguage.PYTHON]: {
938
+ // DEPRECATED
939
+ value: CodeLanguage.PYTHON,
940
+ label: 'Python *',
941
+ compilePattern: 'python3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
942
+ runPattern: '/usr/bin/python3 {{folder_path}}/{{source_full_file_name}}',
943
+ executable: 'python3',
944
+ executableVersion: PYTHON3_VERSION,
945
+ ...PYTHON,
946
+ },
947
+ [CodeLanguage.PYTHON2]: {
948
+ // DEPRECATED
949
+ value: CodeLanguage.PYTHON2,
950
+ label: 'Python 2 *',
951
+ compilePattern: 'python2 -m py_compile {{folder_path}}/{{source_full_file_name}}',
952
+ runPattern: '/usr/bin/python2 {{folder_path}}/{{source_full_file_name}}',
953
+ executable: 'python',
954
+ executableVersion: 'Python 2.7.18',
955
+ ...PYTHON,
956
+ },
957
+ [CodeLanguage.PYTHON3]: {
958
+ // DEPRECATED
959
+ value: CodeLanguage.PYTHON3,
960
+ label: 'Python 3 *',
961
+ compilePattern: 'python3 -m py_compile {{folder_path}}/{{source_full_file_name}}',
962
+ runPattern: '/usr/bin/python3 {{folder_path}}/{{source_full_file_name}}',
963
+ executable: 'python3',
964
+ executableVersion: PYTHON3_VERSION,
965
+ ...PYTHON,
966
+ },
967
+ [CodeLanguage.JAVASCRIPT]: {
968
+ // DEPRECATED
969
+ value: CodeLanguage.JAVASCRIPT,
970
+ label: 'Javascript *',
971
+ mime: 'application/x-javascript',
972
+ mainFilename: 'main.js',
973
+ fileExtension: ['js'],
974
+ compilePattern: '',
975
+ runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
976
+ templateSourceCode: 'console.log("Hello World\\n")',
977
+ hasBuildFile: false,
978
+ executable: 'node',
979
+ executableVersion: NODE_VERSION,
980
+ monacoKey: 'javascript',
981
+ codeMirrorKey: 'javascript',
982
+ highlightJsKey: 'javascript',
983
+ },
984
+ [CodeLanguage.TYPESCRIPT]: {
985
+ // DEPRECATED
986
+ value: CodeLanguage.TYPESCRIPT,
987
+ label: 'Typescript *',
988
+ mime: 'application/x-typescript',
989
+ mainFilename: 'main.ts',
990
+ fileExtension: ['ts'],
991
+ compilePattern: '',
992
+ runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
993
+ templateSourceCode: 'console.log("Hello World\\n")',
994
+ hasBuildFile: false,
995
+ executable: 'node',
996
+ executableVersion: NODE_VERSION,
997
+ monacoKey: 'typescript',
998
+ codeMirrorKey: 'typescript',
999
+ highlightJsKey: 'typescript',
1000
+ },
1001
+ [CodeLanguage.TSX]: {
1002
+ // DEPRECATED
1003
+ value: CodeLanguage.TSX,
1004
+ label: 'TSX *',
1005
+ mime: 'application/x-typescript',
1006
+ mainFilename: 'main.tsx',
1007
+ fileExtension: ['tsx'],
1008
+ compilePattern: '',
1009
+ runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
1010
+ templateSourceCode: 'console.log("Hello World\\n")',
1011
+ hasBuildFile: false,
1012
+ executable: 'node',
1013
+ executableVersion: NODE_VERSION,
1014
+ monacoKey: 'typescript',
1015
+ codeMirrorKey: 'typescript',
1016
+ highlightJsKey: 'typescript',
1017
+ },
1018
+ [CodeLanguage.JSX]: {
1019
+ // DEPRECATED
1020
+ value: CodeLanguage.JSX,
1021
+ label: 'JSX *',
1022
+ mime: 'application/x-javascript',
1023
+ mainFilename: 'main.jsx',
1024
+ fileExtension: ['jsx'],
1025
+ compilePattern: '',
1026
+ runPattern: '/usr/bin/node {{folder_path}}/{{source_full_file_name}}',
1027
+ templateSourceCode: 'console.log("Hello World\\n")',
1028
+ hasBuildFile: false,
1029
+ executable: 'node',
1030
+ executableVersion: NODE_VERSION,
1031
+ monacoKey: 'javascript',
1032
+ codeMirrorKey: 'javascript',
1033
+ highlightJsKey: 'javascript',
1034
+ },
1035
+ [CodeLanguage.PSEUDOCODE_PSEINT]: {
1036
+ value: CodeLanguage.PSEUDOCODE_PSEINT,
1037
+ label: 'Pseudo-código (PSeInt)',
1038
+ mime: 'text/plain',
1039
+ mainFilename: 'main.psc',
1040
+ fileExtension: ['psc'],
1041
+ compilePattern: 'jk-pseint {{folder_path}}/{{source_full_file_name}} --norun --nouser' +
1042
+ ' && jk-pseint {{folder_path}}/{{source_full_file_name}} --draw {{folder_path}}/{{source_full_file_name}}.psd' +
1043
+ ' && jk-psexport {{folder_path}}/{{source_full_file_name}}.psd {{folder_path}}/{{source_full_file_name}}.cpp --lang=cpp' +
1044
+ ' && g++ -x c++ -g -O2 -std=gnu++20 -static -o ' +
1045
+ '{{folder_path}}/{{compiled_file_name}} {{folder_path}}/{{source_full_file_name}}.cpp',
1046
+ runPattern: '{{folder_path}}/{{compiled_file_name}}',
1047
+ templateSourceCode: 'Algoritmo HOLA_MUNDO\n\tImprimir "Hello World"\nFinAlgoritmo\n',
1048
+ hasBuildFile: false,
1049
+ executable: '',
1050
+ executableVersion: PSEINT_VERSION,
1051
+ monacoKey: 'text',
1052
+ codeMirrorKey: 'pseudocode-pseint',
1053
+ highlightJsKey: 'plaintext',
1054
+ },
1055
+ [CodeLanguage.DOT]: {
1056
+ value: CodeLanguage.DOT,
1057
+ label: 'DOT',
1058
+ mime: 'text/vnd.graphviz',
1059
+ mainFilename: 'diagram.dot',
1060
+ fileExtension: ['dot'],
1061
+ compilePattern: '',
1062
+ runPattern: '',
1063
+ templateSourceCode: 'digraph G {\n A -> B;\n B -> C;\n}',
1064
+ hasBuildFile: false,
1065
+ executable: '',
1066
+ executableVersion: '',
1067
+ monacoKey: 'dot',
1068
+ codeMirrorKey: 'dot',
1069
+ highlightJsKey: 'plaintext',
1070
+ },
1071
+ [CodeLanguage.MERMAID]: {
1072
+ value: CodeLanguage.MERMAID,
1073
+ label: 'Mermaid',
1074
+ mime: 'text/mermaid',
1075
+ mainFilename: 'diagram.mmd',
1076
+ fileExtension: ['mmd', 'mermaid'],
1077
+ compilePattern: '',
1078
+ runPattern: '',
1079
+ templateSourceCode: `graph TD
1080
+ A[Start] --> B{Is it working?}
1081
+ B -- Yes --> C[Great!]
1082
+ B -- No --> D[Fix it]
1083
+ D --> B
1084
+ `,
1085
+ hasBuildFile: false,
1086
+ executable: '',
1087
+ executableVersion: '',
1088
+ monacoKey: 'mermaid',
1089
+ codeMirrorKey: 'mermaid',
1090
+ highlightJsKey: 'plaintext',
1091
+ },
1092
+ [CodeLanguage.JSON]: {
1093
+ value: CodeLanguage.JSON,
1094
+ label: 'JSON',
1095
+ mime: 'application/json',
1096
+ mainFilename: 'main.json',
1097
+ fileExtension: ['json'],
1098
+ compilePattern: '',
1099
+ runPattern: '',
1100
+ templateSourceCode: '{\n \n}',
1101
+ hasBuildFile: false,
1102
+ executable: '',
1103
+ executableVersion: '',
1104
+ monacoKey: 'json',
1105
+ codeMirrorKey: 'javascript',
1106
+ highlightJsKey: 'json',
1107
+ },
1108
+ [CodeLanguage.TEXT]: {
1109
+ value: CodeLanguage.TEXT,
1110
+ label: 'plain text',
1111
+ mime: 'text/plain',
1112
+ mainFilename: 'main.txt',
1113
+ fileExtension: ['txt', 'text', 'in', 'out'],
1114
+ compilePattern: '',
1115
+ runPattern: '',
1116
+ templateSourceCode: '',
1117
+ hasBuildFile: false,
1118
+ executable: '',
1119
+ executableVersion: '',
1120
+ monacoKey: 'text',
1121
+ codeMirrorKey: 'text',
1122
+ highlightJsKey: 'plaintext',
1123
+ },
1124
+ [CodeLanguage.DIFF]: {
1125
+ value: CodeLanguage.DIFF,
1126
+ label: 'diff',
1127
+ mime: 'text/plain',
1128
+ mainFilename: 'main.patch',
1129
+ fileExtension: ['diff', 'patch'],
1130
+ compilePattern: '',
1131
+ runPattern: '',
1132
+ templateSourceCode: '',
1133
+ hasBuildFile: false,
1134
+ executable: '',
1135
+ executableVersion: '',
1136
+ monacoKey: 'diff',
1137
+ codeMirrorKey: 'diff',
1138
+ highlightJsKey: 'diff',
1139
+ },
1140
+ [CodeLanguage.LATEX]: {
1141
+ value: CodeLanguage.LATEX,
1142
+ label: 'LaTeX',
1143
+ mime: 'application/x-latex',
1144
+ mainFilename: 'main.tex',
1145
+ fileExtension: ['tex'],
1146
+ compilePattern: '',
1147
+ runPattern: '',
1148
+ templateSourceCode: '',
1149
+ hasBuildFile: false,
1150
+ executable: '',
1151
+ executableVersion: '',
1152
+ monacoKey: 'latex',
1153
+ codeMirrorKey: 'stex',
1154
+ highlightJsKey: 'latex',
1155
+ },
1156
+ // asc txt text diff pot
1157
+ [CodeLanguage.MARKDOWN]: {
1158
+ value: CodeLanguage.MARKDOWN,
1159
+ label: 'Markdown',
1160
+ mime: 'text/plain',
1161
+ mainFilename: 'main.md',
1162
+ fileExtension: ['md'],
1163
+ compilePattern: '',
1164
+ runPattern: '',
1165
+ templateSourceCode: '# Hello World\n',
1166
+ hasBuildFile: false,
1167
+ executable: '',
1168
+ executableVersion: '',
1169
+ monacoKey: 'markdown',
1170
+ codeMirrorKey: 'markdown',
1171
+ highlightJsKey: 'markdown',
1172
+ },
1173
+ [CodeLanguage.MDX]: {
1174
+ value: CodeLanguage.MDX,
1175
+ label: 'MDX',
1176
+ mime: 'text/plain',
1177
+ mainFilename: 'main.mdx',
1178
+ fileExtension: ['mdx'],
1179
+ compilePattern: '',
1180
+ runPattern: '',
1181
+ templateSourceCode: '# Hello World\n',
1182
+ hasBuildFile: false,
1183
+ executable: '',
1184
+ executableVersion: '',
1185
+ monacoKey: 'markdown',
1186
+ codeMirrorKey: 'markdown',
1187
+ highlightJsKey: 'markdown',
1188
+ },
1189
+ [CodeLanguage.ARDUINO]: {
1190
+ value: CodeLanguage.ARDUINO,
1191
+ label: 'Arduino',
1192
+ mime: 'text/plain',
1193
+ mainFilename: 'main.c',
1194
+ fileExtension: ['c', 'cpp', 'pde', 'h', 'ino'],
1195
+ compilePattern: '',
1196
+ runPattern: '',
1197
+ templateSourceCode: '',
1198
+ hasBuildFile: false,
1199
+ executable: '',
1200
+ executableVersion: '',
1201
+ monacoKey: 'c',
1202
+ codeMirrorKey: 'c',
1203
+ highlightJsKey: 'c',
1204
+ },
1205
+ [CodeLanguage.HTML]: {
1206
+ value: CodeLanguage.HTML,
1207
+ label: 'HTML',
1208
+ mime: 'text/HTML',
1209
+ mainFilename: 'index.html',
1210
+ fileExtension: ['html'],
1211
+ compilePattern: '',
1212
+ runPattern: '',
1213
+ templateSourceCode: '',
1214
+ hasBuildFile: false,
1215
+ executable: '',
1216
+ executableVersion: '',
1217
+ monacoKey: 'html',
1218
+ codeMirrorKey: 'html',
1219
+ highlightJsKey: 'xml',
1220
+ },
1221
+ [CodeLanguage.BASH]: {
1222
+ value: CodeLanguage.BASH,
1223
+ label: 'Bash',
1224
+ mime: 'text/plain',
1225
+ mainFilename: 'main.sh',
1226
+ fileExtension: ['sh', 'bash'],
1227
+ compilePattern: '',
1228
+ runPattern: '',
1229
+ templateSourceCode: '#!/bin/bash\necho "Hello World"\n',
1230
+ hasBuildFile: false,
1231
+ executable: 'bash',
1232
+ executableVersion: '',
1233
+ monacoKey: 'shell',
1234
+ codeMirrorKey: 'shell',
1235
+ highlightJsKey: 'bash',
1236
+ },
1237
+ };
1238
+ const PAGE_SIZES = ['32', '64', '128', '256', '512'];
1239
+ const PALLETE = {
1240
+ VIVOS: [
1241
+ { color: '#FF0000', title: 'Rojo' },
1242
+ { color: '#FF5900', title: 'Rojo - Naranja' },
1243
+ { color: '#FF8600', title: 'Naranja' },
1244
+ { color: '#FFBF00', title: 'Ámbar' },
1245
+ { color: '#FFFF00', title: 'Amarillo' },
1246
+ { color: '#A6FF00', title: 'Lima o Verde limon' },
1247
+ { color: '#00FF8C', title: 'Verde puro' },
1248
+ { color: '#00FF8C', title: 'Verde cian' },
1249
+ { color: '#00FFFF', title: 'Cian' },
1250
+ { color: '#0099FF', title: 'Cerúleo o Azur' },
1251
+ { color: '#0000FF', title: 'Azul' },
1252
+ { color: '#9F00FF', title: 'Violeta' },
1253
+ { color: '#FF00FF', title: 'Magenta' },
1254
+ { color: '#FF0099', title: 'Fucsia' },
1255
+ ],
1256
+ OSCUROS: [
1257
+ { color: '#880000', title: 'Granate' },
1258
+ { color: '#882F00', title: 'Caoba o Rojo indio' },
1259
+ { color: '#884700', title: 'Marrón o Pardo' },
1260
+ { color: '#886600', title: 'Marrón dorado' },
1261
+ { color: '#888800', title: 'Oliva' },
1262
+ { color: '#588800', title: 'Verde palta' },
1263
+ { color: '#008800', title: 'Verde estándar' },
1264
+ { color: '#008858', title: 'Esmeralda' },
1265
+ { color: '#008888', title: 'Cerceta o Azul verde' },
1266
+ { color: '#005288', title: 'Añil' },
1267
+ { color: '#000080', title: 'Azul marino' },
1268
+ { color: '#880088', title: 'Azul púrpura' },
1269
+ { color: '#880088', title: 'Púrpura o Morado' },
1270
+ { color: '#880047', title: 'Vino' },
1271
+ ],
1272
+ AGRISADOS: [
1273
+ { color: '#BF4040', title: 'Lacre' },
1274
+ { color: '#BF6340', title: 'Cobre' },
1275
+ { color: '#BF8340', title: 'Cnalea o Ocre' },
1276
+ { color: '#BF9F40', title: 'Dorado' },
1277
+ { color: '#BFBF40', title: 'Chartreuse' },
1278
+ { color: '#93BF40', title: 'Verde manzana' },
1279
+ { color: '#93BF40', title: 'Verde bosque' },
1280
+ { color: '#40BF40', title: 'Verde mar' },
1281
+ { color: '#40BFBF', title: 'Turquesa' },
1282
+ { color: '#408CBF', title: 'Azul acero' },
1283
+ { color: '#4040BF', title: 'Zafiro' },
1284
+ { color: '#9340BF', title: 'Amastista' },
1285
+ { color: '#B140BF', title: 'Púrpureo' },
1286
+ { color: '#B140BF', title: 'Fandango' },
1287
+ ],
1288
+ CLAROS: [
1289
+ { color: '#FF7777', title: 'Coral' },
1290
+ { color: '#FF9977', title: 'Salmón' },
1291
+ { color: '#FFB977', title: 'Melón o Durazno' },
1292
+ { color: '#FFDA80', title: 'Crema' },
1293
+ { color: '#FFFF88', title: 'Maíz' },
1294
+ { color: '#CFFF77', title: 'Té verde' },
1295
+ { color: '#77FF77', title: 'Verde claro' },
1296
+ { color: '#77FFAA', title: 'Menta' },
1297
+ { color: '#80FFFF', title: 'Aguamarina' },
1298
+ { color: '#73C7FF', title: 'Celeste' },
1299
+ { color: '#8082FF', title: 'Bígaro o aciano' },
1300
+ { color: '#C977FF', title: 'Lavanda o lila' },
1301
+ { color: '#FF77FF', title: 'Malva' },
1302
+ { color: '#FF77C1', title: 'Rosado' },
1303
+ ],
1304
+ };
1305
+ const UPPERCASE_LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
1306
+ const LOWERCASE_LETTERS = UPPERCASE_LETTERS.toLowerCase();
1307
+ const NUMBERS = '012345678';
1308
+ const DEFAULT_JUKI_PROFILE_IMAGE = 'https://juki-judge.s3.us-east-2.amazonaws.com/public/file/5f69783aa7a8e048ef8d0ce2.';
1309
+ const SEPARATOR_TOKEN = '\x1E';
1310
+ const HEADER_JUKI_FORWARDED_HOST = 'x-juki-forwarded-host';
1311
+ const HEADER_JUKI_VISITOR_SESSION_ID = 'x-juki-visitor-session-id';
1312
+ const HEADER_JUKI_METADATA = 'x-juki-metadata';
1313
+ const HEADER_JUKI_SECRET_TOKEN = 'x-juki-secret-token';
1314
+ const HEADER_JUKI_INTERNAL_API_KEY = 'x-juki-internal-api-key';
1315
+ const COOKIE_JUKI_SESSION_ID = 'juki-session-id';
1316
+
1317
+ const JUKI_APP_COMPANY_KEY = 'juki-app';
1318
+ const COMPANY_PLAN = {
1319
+ [CompanyPlan.FREE]: {
1320
+ value: CompanyPlan.FREE,
1321
+ label: 'free',
1322
+ description: 'the resources, runners and compilers, are shared with the juki.app giving priority to juki.app',
1323
+ },
1324
+ [CompanyPlan.STANDARD]: {
1325
+ value: CompanyPlan.STANDARD,
1326
+ label: 'standard',
1327
+ description: 'the resources are dedicated, 1 runner and 1 compiler',
1328
+ },
1329
+ [CompanyPlan.PREMIUM]: {
1330
+ value: CompanyPlan.PREMIUM,
1331
+ label: 'premium',
1332
+ description: 'the resources are dedicated and on demand use with at least 1 runner and 1 compiler',
1333
+ },
1334
+ [CompanyPlan.CUSTOM]: {
1335
+ value: CompanyPlan.CUSTOM,
1336
+ label: 'custom',
1337
+ description: 'the resources are dedicated and on demand use with at least 1 (settable) runner and 1 (settable) compiler',
1338
+ },
1339
+ };
1340
+
1341
+ const CONTEST_STATUS = {
1342
+ [ContestStatus.PUBLIC]: {
1343
+ value: ContestStatus.PUBLIC,
1344
+ label: 'public',
1345
+ description: 'the contest will appear in the contest list and the users will have access according to their roles',
1346
+ },
1347
+ [ContestStatus.RESERVED]: {
1348
+ value: ContestStatus.RESERVED,
1349
+ label: 'reserved',
1350
+ description: 'the contest will appear in the contest list only for contest members and the users will have access according to their roles',
1351
+ },
1352
+ [ContestStatus.ARCHIVED]: {
1353
+ value: ContestStatus.ARCHIVED,
1354
+ label: 'archived',
1355
+ description: 'the contest will not appear for anyone, contact the administrator to see it again',
1356
+ },
1357
+ };
1358
+ const CONTEST_ROLE = {
1359
+ [Role.RESTRICTED]: { value: Role.RESTRICTED, label: 'restricted', level: 7 },
1360
+ [Role.GUEST]: { value: Role.GUEST, label: 'guest', level: 6 },
1361
+ [Role.REGULAR]: { value: Role.REGULAR, label: 'regular', level: 5 },
1362
+ [Role.CREATOR]: { value: Role.CREATOR, label: 'creator', level: 4 },
1363
+ [Role.MANAGER]: { value: Role.MANAGER, label: 'manager', level: 3 },
1364
+ [Role.MASTER]: { value: Role.MASTER, label: 'master', level: 2 },
1365
+ [Role.ADMIN]: { value: Role.ADMIN, label: 'admin', level: 1 },
1366
+ [Role.SUPER_ADMIN]: { value: Role.SUPER_ADMIN, label: 'super admin', level: 0 },
1367
+ };
1368
+
1369
+ const COURSE_ROLE = {
1370
+ [CourseRole.RESTRICTED]: { value: CourseRole.RESTRICTED, label: 'restricted', level: 8 },
1371
+ [CourseRole.GUEST]: { value: CourseRole.GUEST, label: 'guest', level: 7 },
1372
+ [CourseRole.REGULAR]: { value: CourseRole.REGULAR, label: 'regular', level: 6 },
1373
+ [CourseRole.CREATOR]: { value: CourseRole.CREATOR, label: 'creator', level: 5 },
1374
+ [CourseRole.SUPER_CREATOR]: { value: CourseRole.SUPER_CREATOR, label: 'super creator', level: 4 },
1375
+ [CourseRole.MANAGER]: { value: CourseRole.MANAGER, label: 'manager', level: 3 },
1376
+ [CourseRole.MASTER]: { value: CourseRole.MASTER, label: 'super admin', level: 2 },
1377
+ [CourseRole.ADMIN]: { value: CourseRole.ADMIN, label: 'admin', level: 1 },
1378
+ [CourseRole.SUPER_ADMIN]: { value: CourseRole.SUPER_ADMIN, label: 'super admin', level: 0 },
1379
+ };
1380
+
1381
+ function isStringJson(str) {
1382
+ try {
1383
+ if (typeof str === 'string') {
1384
+ JSON.parse(str);
1385
+ return true;
1386
+ }
1387
+ }
1388
+ catch (e) {
1389
+ return false;
1390
+ }
1391
+ return false;
1392
+ }
1393
+ function safeJsonParse(str) {
1394
+ try {
1395
+ if (typeof str === 'string') {
1396
+ return JSON.parse(str);
1397
+ }
1398
+ }
1399
+ catch (e) {
1400
+ return null;
1401
+ }
1402
+ return null;
1403
+ }
1404
+ function isObjectJson(obj) {
1405
+ try {
1406
+ return typeof JSON.stringify(obj) === 'string';
1407
+ }
1408
+ catch (e) {
1409
+ return false;
1410
+ }
1411
+ }
1412
+ function mex(array) {
1413
+ let i = 0;
1414
+ while (array.indexOf(i) !== -1) {
1415
+ i++;
1416
+ }
1417
+ return i;
1418
+ }
1419
+ function range(start, end) {
1420
+ const result = [];
1421
+ for (let i = start; i < end; i++) {
1422
+ result.push(i);
1423
+ }
1424
+ return result;
1425
+ }
1426
+ async function getPlainText(url) {
1427
+ return await fetch(url)
1428
+ .then(data => data.text())
1429
+ .catch((error) => {
1430
+ console.error('ERROR:', error);
1431
+ return '';
1432
+ });
1433
+ }
1434
+ function objectUpdate(base, update) {
1435
+ if (JSON.stringify(base) === JSON.stringify(update)) {
1436
+ return base;
1437
+ }
1438
+ if (base !== null && update !== null && !Array.isArray(base) && typeof base === 'object' && typeof update === 'object') {
1439
+ const mergeKeys = new Set([...Object.keys(base), ...Object.keys(update)]);
1440
+ Array.from(mergeKeys).forEach(key => {
1441
+ if (update[key] !== null && update[key] !== undefined && base[key] !== update[key]) {
1442
+ base[key] = objectUpdate(base[key], update[key]);
1443
+ }
1444
+ });
1445
+ return base;
1446
+ }
1447
+ if (update !== null && update !== undefined) {
1448
+ return update;
1449
+ }
1450
+ return base;
1451
+ }
1452
+ function objectsUpdate(base, ...objects) {
1453
+ let newObject = { ...base };
1454
+ objects.forEach((update) => {
1455
+ newObject = objectUpdate(newObject, update);
1456
+ });
1457
+ return newObject;
1458
+ }
1459
+ function consoleWarn(...warn) {
1460
+ console.warn(new Date().toLocaleString(), ...warn);
1461
+ }
1462
+ function consoleInfo(...info) {
1463
+ console.info(new Date().toLocaleString(), ...info);
1464
+ }
1465
+ function consoleError(...error) {
1466
+ console.error(new Date().toLocaleString(), ...error);
1467
+ }
1468
+ function indexToLetters(index) {
1469
+ const d = Math.ceil(index / 26);
1470
+ if (d === 1) {
1471
+ return UPPERCASE_LETTERS.charAt(index - 1);
1472
+ }
1473
+ return UPPERCASE_LETTERS.charAt(d - 2) + UPPERCASE_LETTERS.charAt(index - (26 * (d - 1)) - 1);
1474
+ }
1475
+ function lettersToIndex(index) {
1476
+ if (index.length) {
1477
+ if (index.length === 1) {
1478
+ const d = UPPERCASE_LETTERS.indexOf(index);
1479
+ if (d !== -1) {
1480
+ return d + 1;
1481
+ }
1482
+ }
1483
+ else if (index.length === 2) {
1484
+ const a = index.charAt(0);
1485
+ const b = index.charAt(1);
1486
+ const numA = lettersToIndex(a);
1487
+ const numB = lettersToIndex(b);
1488
+ return numA * 26 + numB;
1489
+ }
1490
+ }
1491
+ return 0;
1492
+ }
1493
+ function getProblemJudgeKey(judge, key) {
1494
+ return `${judge}-${key}`;
1495
+ }
1496
+ /**
1497
+ * https://stackoverflow.com/questions/10420352/converting-file-size-in-bytes-to-human-readable-string
1498
+ * Format bytes as human-readable text.
1499
+ *
1500
+ * @param bytes Number of bytes.
1501
+ * @param si True to use metric (SI) units, aka powers of 1000. False to use
1502
+ * binary (IEC), aka powers of 1024.
1503
+ * @param dp Number of decimal places to display.
1504
+ *
1505
+ * @return Formatted string.
1506
+ */
1507
+ function humanFileSize(bytes, si = false, dp = 1) {
1508
+ const thresh = si ? 1000 : 1024;
1509
+ if (Math.abs(bytes) < thresh) {
1510
+ return bytes + ' B';
1511
+ }
1512
+ const units = si
1513
+ ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
1514
+ : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
1515
+ let u = -1;
1516
+ const r = 10 ** dp;
1517
+ do {
1518
+ bytes /= thresh;
1519
+ ++u;
1520
+ } while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
1521
+ return bytes.toFixed(dp) + ' ' + units[u];
1522
+ }
1523
+ function stringToArrayBuffer(str) {
1524
+ const buf = new ArrayBuffer(str.length); //convert str to arrayBuffer
1525
+ const view = new Uint8Array(buf); //create Uint8Array as viewer
1526
+ for (let i = 0; i < str.length; i++) {
1527
+ view[i] = str.charCodeAt(i) & 0xFF; //convert to octet
1528
+ }
1529
+ return buf;
1530
+ }
1531
+ function chunkString(str, size) {
1532
+ const numChunks = Math.ceil(str.length / size);
1533
+ const chunks = new Array(numChunks);
1534
+ for (let i = 0, o = 0; i < numChunks; ++i, o += size) {
1535
+ chunks[i] = str.substr(o, size);
1536
+ }
1537
+ return chunks;
1538
+ }
1539
+ function getRandomString(length) {
1540
+ const charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; // 62
1541
+ let retVal = '';
1542
+ for (let i = 0; i < length; ++i) {
1543
+ retVal += charset.charAt(Math.floor(Math.random() * charset.length));
1544
+ }
1545
+ return retVal;
1546
+ }
1547
+ function join(array) {
1548
+ return array.join(SEPARATOR_TOKEN);
1549
+ }
1550
+ function split(text) {
1551
+ return text.split(SEPARATOR_TOKEN);
1552
+ }
1553
+ const areArraysDifferent = (a, b) => {
1554
+ if (a === b) {
1555
+ return false;
1556
+ }
1557
+ if (a.length !== b.length) {
1558
+ return true;
1559
+ }
1560
+ for (let i = 0; i < b.length; i += 1) {
1561
+ if (b[i] !== a[i]) {
1562
+ return true;
1563
+ }
1564
+ }
1565
+ return false;
1566
+ };
1567
+
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);
1590
+
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>`;
1625
+
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
+ });
1643
+
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
+ },
1787
+ };
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' },
1822
+ };
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
1863
+ };
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' },
1867
+ };
1868
+
1869
+ const PROBLEM_INPUT = {
1870
+ [ProblemInput.STANDARD]: { value: ProblemInput.STANDARD, label: 'standard' },
1871
+ [ProblemInput.INTERACTIVE]: { value: ProblemInput.INTERACTIVE, label: 'interactive' },
1872
+ };
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' },
1877
+ };
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
+ },
1901
+ };
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
+ },
1926
+ };
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 },
1936
+ };
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
+
1946
+ const ERROR = {
1947
+ // Http Errors
1948
+ [ErrorCode.ERR500]: { value: ErrorCode.ERR500, message: 'internal server error', status: 500 },
1949
+ [ErrorCode.ERR400]: { value: ErrorCode.ERR400, message: 'bad request', status: 400 },
1950
+ [ErrorCode.ERR401]: { value: ErrorCode.ERR401, message: 'unauthorized', status: 401 },
1951
+ [ErrorCode.ERR403]: { value: ErrorCode.ERR403, message: 'forbidden', status: 403 },
1952
+ [ErrorCode.ERR404]: { value: ErrorCode.ERR404, message: 'not found', status: 404 },
1953
+ [ErrorCode.ERR405]: { value: ErrorCode.ERR405, message: 'method not allowed', status: 405 },
1954
+ // UI general errors
1955
+ [ErrorCode.ERR9997]: { value: ErrorCode.ERR9997, message: 'aborted request', status: 400 },
1956
+ [ErrorCode.ERR9998]: { value: ErrorCode.ERR9998, message: 'error on response', status: 400 },
1957
+ [ErrorCode.ERR9999]: { value: ErrorCode.ERR9999, message: 'service no found', status: 400 },
1958
+ // COMPANY ERRORS ERR99XX
1959
+ [ErrorCode.ERR9900]: { value: ErrorCode.ERR9900, message: 'internal server error on company service', status: 500 },
1960
+ // Company server errors
1961
+ [ErrorCode.ERR9910]: { value: ErrorCode.ERR9910, message: 'company not created', status: 500 },
1962
+ [ErrorCode.ERR9911]: { value: ErrorCode.ERR9911, message: 'company not found', status: 500 },
1963
+ [ErrorCode.ERR9912]: { value: ErrorCode.ERR9912, message: 'company not updated', status: 500 },
1964
+ [ErrorCode.ERR9913]: { value: ErrorCode.ERR9913, message: 'company not deleted', status: 500 },
1965
+ // Company user permission error
1966
+ [ErrorCode.ERR9914]: { value: ErrorCode.ERR9914, message: 'not allowed to create the company', status: 400 },
1967
+ [ErrorCode.ERR9915]: { value: ErrorCode.ERR9915, message: 'not allowed to view the company', status: 400 },
1968
+ [ErrorCode.ERR9916]: { value: ErrorCode.ERR9916, message: 'not allowed to updated the company', status: 400 },
1969
+ [ErrorCode.ERR9917]: { value: ErrorCode.ERR9917, message: 'not allowed to deleted the company', status: 400 },
1970
+ // USER ERRORS ERR00XX
1971
+ [ErrorCode.ERR0000]: { value: ErrorCode.ERR0000, message: 'internal server error on users service', status: 500 },
1972
+ // User server errors
1973
+ [ErrorCode.ERR0010]: { value: ErrorCode.ERR0010, message: 'user not created', status: 500 },
1974
+ [ErrorCode.ERR0011]: { value: ErrorCode.ERR0011, message: 'user not found', status: 500 },
1975
+ [ErrorCode.ERR0012]: { value: ErrorCode.ERR0012, message: 'user not updated', status: 500 },
1976
+ [ErrorCode.ERR0013]: { value: ErrorCode.ERR0013, message: 'user not deleted', status: 500 },
1977
+ // User user permission error
1978
+ [ErrorCode.ERR0014]: { value: ErrorCode.ERR0014, message: 'not allowed to create the user', status: 400 },
1979
+ [ErrorCode.ERR0015]: { value: ErrorCode.ERR0015, message: 'not allowed to view the user', status: 400 },
1980
+ [ErrorCode.ERR0016]: { value: ErrorCode.ERR0016, message: 'not allowed to updated the user', status: 400 },
1981
+ [ErrorCode.ERR0017]: { value: ErrorCode.ERR0017, message: 'not allowed to deleted the user', status: 400 },
1982
+ // User status permissions errors
1983
+ [ErrorCode.ERR0018]: { value: ErrorCode.ERR0018, message: 'user is reported', status: 400 },
1984
+ [ErrorCode.ERR0019]: { value: ErrorCode.ERR0019, message: 'user is archived', status: 400 },
1985
+ // User others permissions errors
1986
+ [ErrorCode.ERR0020]: { value: ErrorCode.ERR0020, message: 'user with email requested not found', status: 400 },
1987
+ [ErrorCode.ERR0021]: { value: ErrorCode.ERR0021, message: 'user with nickname requested not found', status: 400 },
1988
+ [ErrorCode.ERR0022]: { value: ErrorCode.ERR0022, message: 'the email is already registered', status: 400 },
1989
+ [ErrorCode.ERR0023]: { value: ErrorCode.ERR0023, message: 'the nickname is already taken', status: 400 },
1990
+ [ErrorCode.ERR0024]: { value: ErrorCode.ERR0024, message: 'incorrect password', status: 400 },
1991
+ // User sessions errors
1992
+ [ErrorCode.ERR0050]: { value: ErrorCode.ERR0050, message: 'user session not created', status: 500 },
1993
+ [ErrorCode.ERR0051]: { value: ErrorCode.ERR0051, message: 'user session not found', status: 500 },
1994
+ [ErrorCode.ERR0052]: { value: ErrorCode.ERR0052, message: 'user session not updated', status: 500 },
1995
+ [ErrorCode.ERR0053]: { value: ErrorCode.ERR0053, message: 'user session not deleted', status: 500 },
1996
+ // PROBLEM ERRORS ERR01XX
1997
+ [ErrorCode.ERR0100]: { value: ErrorCode.ERR0100, message: 'internal server error on problems service', status: 500 },
1998
+ // Problem server errors
1999
+ [ErrorCode.ERR0110]: { value: ErrorCode.ERR0110, message: 'problem not created', status: 500 },
2000
+ [ErrorCode.ERR0111]: { value: ErrorCode.ERR0111, message: 'problem not found', status: 500 },
2001
+ [ErrorCode.ERR0112]: { value: ErrorCode.ERR0112, message: 'problem not updated', status: 500 },
2002
+ [ErrorCode.ERR0113]: { value: ErrorCode.ERR0113, message: 'problem not deleted', status: 500 },
2003
+ // Problem user permission error
2004
+ [ErrorCode.ERR0114]: { value: ErrorCode.ERR0114, message: 'not allowed to create the problem', status: 400 },
2005
+ [ErrorCode.ERR0115]: { value: ErrorCode.ERR0115, message: 'not allowed to view the problem', status: 400 },
2006
+ [ErrorCode.ERR0116]: { value: ErrorCode.ERR0116, message: 'not allowed to updated the problem', status: 400 },
2007
+ [ErrorCode.ERR0117]: { value: ErrorCode.ERR0117, message: 'not allowed to deleted the problem', status: 400 },
2008
+ // Problem others permissions errors
2009
+ [ErrorCode.ERR0118]: { value: ErrorCode.ERR0118, message: 'problem mode not supported', status: 500 },
2010
+ [ErrorCode.ERR0119]: { value: ErrorCode.ERR0119, message: 'problem type not supported', status: 500 },
2011
+ [ErrorCode.ERR0120]: { value: ErrorCode.ERR0120, message: 'problem time limit must be a number', status: 500 },
2012
+ [ErrorCode.ERR0121]: { value: ErrorCode.ERR0121, message: 'problem memory limit must be number', status: 500 },
2013
+ [ErrorCode.ERR0122]: { value: ErrorCode.ERR0122, message: 'test case file empty', status: 400 },
2014
+ // Contest Errors ERR02XX
2015
+ [ErrorCode.ERR0200]: { value: ErrorCode.ERR0200, message: 'internal server error on contests service', status: 500 },
2016
+ // Contest Server Error
2017
+ [ErrorCode.ERR0210]: { value: ErrorCode.ERR0210, message: 'contest not created', status: 500 },
2018
+ [ErrorCode.ERR0211]: { value: ErrorCode.ERR0211, message: 'contest not found', status: 500 },
2019
+ [ErrorCode.ERR0212]: { value: ErrorCode.ERR0212, message: 'contest not updated', status: 500 },
2020
+ [ErrorCode.ERR0213]: { value: ErrorCode.ERR0213, message: 'contest not deleted', status: 500 },
2021
+ // Contest User Permission error
2022
+ [ErrorCode.ERR0214]: { value: ErrorCode.ERR0214, message: 'not allowed to create the contest', status: 400 },
2023
+ [ErrorCode.ERR0215]: { value: ErrorCode.ERR0215, message: 'not allowed to view the contest', status: 400 },
2024
+ [ErrorCode.ERR0216]: { value: ErrorCode.ERR0216, message: 'not allowed to updated the contest', status: 400 },
2025
+ [ErrorCode.ERR0217]: { value: ErrorCode.ERR0217, message: 'not allowed to deleted the contest', status: 400 },
2026
+ // Contest Others permissions errors
2027
+ [ErrorCode.ERR0218]: { value: ErrorCode.ERR0218, message: 'not allowed to register to the contest', status: 400 },
2028
+ [ErrorCode.ERR0219]: { value: ErrorCode.ERR0219, message: 'is already registered', status: 400 },
2029
+ [ErrorCode.ERR0220]: { value: ErrorCode.ERR0220, message: 'not allowed to view contests', status: 400 },
2030
+ [ErrorCode.ERR0230]: { value: ErrorCode.ERR0230, message: 'scoreboard not created', status: 500 },
2031
+ [ErrorCode.ERR0231]: { value: ErrorCode.ERR0231, message: 'scoreboard not found', status: 500 },
2032
+ [ErrorCode.ERR0232]: { value: ErrorCode.ERR0232, message: 'scoreboard not updated', status: 500 },
2033
+ [ErrorCode.ERR0233]: { value: ErrorCode.ERR0233, message: 'scoreboard not deleted', status: 500 },
2034
+ [ErrorCode.ERR0234]: { value: ErrorCode.ERR0234, message: 'not allowed to create the scoreboard', status: 400 },
2035
+ [ErrorCode.ERR0235]: { value: ErrorCode.ERR0235, message: 'not allowed to view the scoreboard', status: 400 },
2036
+ [ErrorCode.ERR0236]: { value: ErrorCode.ERR0236, message: 'not allowed to update the scoreboard', status: 400 },
2037
+ [ErrorCode.ERR0237]: { value: ErrorCode.ERR0237, message: 'not allowed to delete the scoreboard', status: 400 },
2038
+ [ErrorCode.ERR0240]: { value: ErrorCode.ERR0240, message: 'clarification not created', status: 500 },
2039
+ [ErrorCode.ERR0241]: { value: ErrorCode.ERR0241, message: 'clarification not found', status: 500 },
2040
+ [ErrorCode.ERR0242]: { value: ErrorCode.ERR0242, message: 'clarification not updated', status: 500 },
2041
+ [ErrorCode.ERR0243]: { value: ErrorCode.ERR0243, message: 'clarification not deleted', status: 500 },
2042
+ [ErrorCode.ERR0244]: { value: ErrorCode.ERR0244, message: 'not allowed to submit clarification', status: 400 },
2043
+ [ErrorCode.ERR0245]: { value: ErrorCode.ERR0245, message: 'not allowed to view clarification', status: 400 },
2044
+ [ErrorCode.ERR0246]: { value: ErrorCode.ERR0246, message: 'not allowed to update clarification', status: 400 },
2045
+ [ErrorCode.ERR0247]: { value: ErrorCode.ERR0247, message: 'not allowed to delete clarification', status: 400 },
2046
+ // Submission Errors ERR03XXX
2047
+ [ErrorCode.ERR0300]: {
2048
+ value: ErrorCode.ERR0300,
2049
+ message: 'internal server error on submissions service',
2050
+ status: 500,
2051
+ },
2052
+ [ErrorCode.ERR0301]: { value: ErrorCode.ERR0301, message: 'submission not found', status: 500 },
2053
+ [ErrorCode.ERR0302]: { value: ErrorCode.ERR0302, message: 'submission not created', status: 500 },
2054
+ [ErrorCode.ERR0303]: { value: ErrorCode.ERR0303, message: 'submission not updated', status: 500 },
2055
+ [ErrorCode.ERR0310]: { value: ErrorCode.ERR0310, message: 'source empty', status: 400 },
2056
+ [ErrorCode.ERR0311]: { value: ErrorCode.ERR0311, message: 'programming language not supported', status: 400 },
2057
+ [ErrorCode.ERR0321]: {
2058
+ value: ErrorCode.ERR0321,
2059
+ message: 'not allowed submit the problem in the contest',
2060
+ status: 400,
2061
+ },
2062
+ [ErrorCode.ERR0331]: { value: ErrorCode.ERR0331, message: 'judgement unavailable', status: 400 },
2063
+ // Utils Errors ERR04XX
2064
+ [ErrorCode.ERR0400]: { value: ErrorCode.ERR0400, message: 'internal server error on utils services', status: 500 },
2065
+ [ErrorCode.ERR0410]: { value: ErrorCode.ERR0410, message: 'empty image', status: 400 },
2066
+ [ErrorCode.ERR0420]: { value: ErrorCode.ERR0420, message: '', status: 400 }, // codes
2067
+ [ErrorCode.ERR0421]: { value: ErrorCode.ERR0421, message: 'compilation failed', status: 400 }, // codes
2068
+ [ErrorCode.ERR0430]: { value: ErrorCode.ERR0430, message: '', status: 400 }, // files
2069
+ [ErrorCode.ERR0440]: { value: ErrorCode.ERR0440, message: 'the email could not be sent', status: 400 }, // mails
2070
+ // TEAMS ERRORS ERR06XX
2071
+ [ErrorCode.ERR0600]: { value: ErrorCode.ERR0600, message: 'internal server error on teams service', status: 500 },
2072
+ // Teams server errors
2073
+ [ErrorCode.ERR0610]: { value: ErrorCode.ERR0610, message: 'team not created', status: 400 },
2074
+ [ErrorCode.ERR0611]: { value: ErrorCode.ERR0611, message: 'team not found', status: 400 },
2075
+ [ErrorCode.ERR0612]: { value: ErrorCode.ERR0612, message: 'team not updated', status: 400 },
2076
+ [ErrorCode.ERR0613]: { value: ErrorCode.ERR0613, message: 'team not deleted', status: 400 },
2077
+ // Teams user permission error
2078
+ [ErrorCode.ERR0614]: { value: ErrorCode.ERR0614, message: 'not allowed to create the team', status: 400 },
2079
+ [ErrorCode.ERR0615]: { value: ErrorCode.ERR0615, message: 'not allowed to view the team', status: 400 },
2080
+ [ErrorCode.ERR0616]: { value: ErrorCode.ERR0616, message: 'not allowed to updated the team', status: 400 },
2081
+ [ErrorCode.ERR0617]: { value: ErrorCode.ERR0617, message: 'not allowed to deleted the team', status: 400 },
2082
+ // Teams status permission error
2083
+ [ErrorCode.ERR0618]: { value: ErrorCode.ERR0618, message: 'team is reported', status: 400 },
2084
+ [ErrorCode.ERR0619]: { value: ErrorCode.ERR0619, message: 'team is archived', status: 400 },
2085
+ // FILES ERRORS ERR08XX
2086
+ [ErrorCode.ERR0800]: { value: ErrorCode.ERR0800, message: 'internal server error on files service', status: 500 },
2087
+ // Files server errors
2088
+ [ErrorCode.ERR0810]: { value: ErrorCode.ERR0810, message: 'file not created', status: 400 },
2089
+ [ErrorCode.ERR0811]: { value: ErrorCode.ERR0811, message: 'file not found', status: 400 },
2090
+ [ErrorCode.ERR0812]: { value: ErrorCode.ERR0812, message: 'file not updated', status: 400 },
2091
+ [ErrorCode.ERR0813]: { value: ErrorCode.ERR0813, message: 'file not deleted', status: 400 },
2092
+ // Files user permission error
2093
+ [ErrorCode.ERR0814]: { value: ErrorCode.ERR0814, message: 'not allowed to create the file', status: 400 },
2094
+ [ErrorCode.ERR0815]: { value: ErrorCode.ERR0815, message: 'not allowed to view the file', status: 400 },
2095
+ [ErrorCode.ERR0816]: { value: ErrorCode.ERR0816, message: 'not allowed to updated the file', status: 400 },
2096
+ [ErrorCode.ERR0817]: { value: ErrorCode.ERR0817, message: 'not allowed to deleted the file', status: 400 },
2097
+ // Files status permission error
2098
+ [ErrorCode.ERR0818]: { value: ErrorCode.ERR0818, message: 'file is reserved', status: 400 },
2099
+ [ErrorCode.ERR0819]: { value: ErrorCode.ERR0819, message: 'file is private', status: 400 },
2100
+ [ErrorCode.ERR0820]: { value: ErrorCode.ERR0820, message: 'file is archived', status: 400 },
2101
+ };
2102
+
2103
+ const FILE_TYPE = {
2104
+ [FileType.FILE]: { value: FileType.FILE, label: 'file' },
2105
+ [FileType.FOLDER]: { value: FileType.FOLDER, label: 'folder' },
2106
+ };
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 },
2114
+ };
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
+ },
2124
+ };
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
+ },
2146
+ };
2147
+
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 },
2155
+ };
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' },
2164
+ };
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 },
2172
+ };
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' },
2188
+ };
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 },
2197
+ };
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
+ },
2222
+ };
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
+ },
2293
+ };
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;
2311
+ };
2312
+ const isCourseAssignment = (assignment) => {
2313
+ return assignment.type === AssignmentClass.COURSE;
2314
+ };
2315
+ const isContestAssignment = (assignment) => {
2316
+ return assignment.type === AssignmentClass.CONTEST;
2317
+ };
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;
2330
+ };
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;
2337
+ };
2338
+ const isPastContest = (settings) => {
2339
+ return Date.now() > (settings?.endTimestamp ?? 0);
2340
+ };
2341
+ const isFutureContest = (settings) => {
2342
+ return (settings?.startTimestamp ?? 0) > Date.now();
2343
+ };
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
+ }
2374
+ };
2375
+ const isUserMember = (member) => {
2376
+ return typeof member.userId === 'string';
2377
+ };
2378
+ const isTeamMember = (member) => {
2379
+ return typeof member.teamId === 'string';
2380
+ };
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
+ };
2394
+ };
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
+ }
2408
+ };
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
+ }
2419
+ };
2420
+ const clearAsyncInterval = (intervalIndex) => {
2421
+ if (asyncIntervals[intervalIndex]) {
2422
+ asyncIntervals[intervalIndex] = false;
2423
+ }
2424
+ };
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
+ };
2442
+ };
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
+ };
2465
+ };
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
+ };
2515
+ };
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
+ };
2548
+ };
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;
2589
+ };
2590
+ Date.prototype.changeMonth = function (monthIndex) {
2591
+ const newDate = new Date(this);
2592
+ newDate.setMonth(monthIndex);
2593
+ return newDate;
2594
+ };
2595
+ Date.prototype.changeDay = function (date) {
2596
+ const newDate = new Date(this);
2597
+ newDate.setDate(date);
2598
+ return newDate;
2599
+ };
2600
+ Date.prototype.changeHours = function (hours) {
2601
+ const newDate = new Date(this);
2602
+ newDate.setHours(hours);
2603
+ return newDate;
2604
+ };
2605
+ Date.prototype.changeMinutes = function (minutes) {
2606
+ const newDate = new Date(this);
2607
+ newDate.setMinutes(minutes);
2608
+ return newDate;
2609
+ };
2610
+ Date.prototype.changeSeconds = function (seconds) {
2611
+ const newDate = new Date(this);
2612
+ newDate.setSeconds(seconds);
2613
+ return newDate;
2614
+ };
2615
+ Date.prototype.changeMilliseconds = function (milliseconds) {
2616
+ const newDate = new Date(this);
2617
+ newDate.setMilliseconds(milliseconds);
2618
+ return newDate;
2619
+ };
2620
+ Date.prototype.decreaseYear = function (count = 1) {
2621
+ return this.changeYear(this.getFullYear() - count);
2622
+ };
2623
+ Date.prototype.increaseYear = function (count = 1) {
2624
+ return this.changeYear(this.getFullYear() + count);
2625
+ };
2626
+ Date.prototype.decreaseMonth = function () {
2627
+ const newDate = new Date(this);
2628
+ newDate.setMonth(newDate.getMonth() - 1);
2629
+ return newDate;
2630
+ };
2631
+ Date.prototype.increaseMonth = function () {
2632
+ const newDate = new Date(this);
2633
+ newDate.setMonth(newDate.getMonth() + 1);
2634
+ return newDate;
2635
+ };
2636
+ Date.prototype.increaseDay = function () {
2637
+ const newDate = new Date(this);
2638
+ newDate.setDate(newDate.getDate() + 1);
2639
+ return newDate;
2640
+ };
2641
+ Date.prototype.decreaseDay = function () {
2642
+ const newDate = new Date(this);
2643
+ newDate.setDate(newDate.getDate() - 1);
2644
+ return newDate;
2645
+ };
2646
+ Date.prototype.startOfYear = function () {
2647
+ const newDate = new Date(this);
2648
+ newDate.setMonth(0);
2649
+ return newDate.startOfMonth();
2650
+ };
2651
+ Date.prototype.endOfYear = function () {
2652
+ const nextMonth = this.increaseYear().startOfYear();
2653
+ return new Date(nextMonth.getTime() - 1);
2654
+ };
2655
+ Date.prototype.startOfMonth = function () {
2656
+ const newDate = new Date(this);
2657
+ newDate.setDate(1);
2658
+ return newDate.startOfDay();
2659
+ };
2660
+ Date.prototype.endOfMonth = function () {
2661
+ const nextMonth = this.increaseMonth().startOfMonth();
2662
+ return new Date(nextMonth.getTime() - 1);
2663
+ };
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();
2670
+ };
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();
2677
+ };
2678
+ Date.prototype.startOfDay = function () {
2679
+ const newDate = new Date(this);
2680
+ newDate.setHours(0, 0, 0, 0);
2681
+ return newDate;
2682
+ };
2683
+ Date.prototype.endOfDay = function () {
2684
+ const newDate = new Date(this);
2685
+ newDate.setHours(23, 59, 59, 999);
2686
+ return newDate;
2687
+ };
2688
+ Date.prototype.startOfHour = function () {
2689
+ const newDate = new Date(this);
2690
+ newDate.setMinutes(0, 0, 0);
2691
+ return newDate;
2692
+ };
2693
+ Date.prototype.endOfHour = function () {
2694
+ const newDate = new Date(this);
2695
+ newDate.setMinutes(59, 59, 999);
2696
+ return newDate;
2697
+ };
2698
+ Date.prototype.startOfMinute = function () {
2699
+ const newDate = new Date(this);
2700
+ newDate.setSeconds(0, 0);
2701
+ return newDate;
2702
+ };
2703
+ Date.prototype.endOfMinute = function () {
2704
+ const newDate = new Date(this);
2705
+ newDate.setSeconds(59, 999);
2706
+ return newDate;
2707
+ };
2708
+ Date.prototype.startOfSecond = function () {
2709
+ const newDate = new Date(this);
2710
+ newDate.setMilliseconds(0);
2711
+ return newDate;
2712
+ };
2713
+ Date.prototype.endOfSecond = function () {
2714
+ const newDate = new Date(this);
2715
+ newDate.setMilliseconds(999);
2716
+ return newDate;
2717
+ };
2718
+ Date.prototype.isToday = function () {
2719
+ const today = new Date();
2720
+ return this.isSameDay(today);
2721
+ };
2722
+ Date.prototype.isEqual = function (date) {
2723
+ return this.getTime() === date.getTime();
2724
+ };
2725
+ Date.prototype.isSameYear = function (date) {
2726
+ return this.getFullYear() === date.getFullYear();
2727
+ };
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));
2800
+ };
2801
+
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
+ }
2816
+
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
+ };
2824
+
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
+ };
2916
+
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;
2920
+ };
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;
3061
+ };
3062
+ const isSendDataEc2InstancesListWebSocketResponseEventDTO = (event) => {
3063
+ return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
3064
+ && event?.event === WebSocketResponseEvent.SEND_DATA_EC2_INSTANCES_LIST;
3065
+ };
3066
+ const isSendDataEcsTasksListWebSocketResponseEventDTO = (event) => {
3067
+ return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
3068
+ && event?.event === WebSocketResponseEvent.SEND_DATA_ECS_TASKS_LIST;
3069
+ };
3070
+ const isSendDataSsmSessionsListWebSocketResponseEventDTO = (event) => {
3071
+ return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
3072
+ && event?.event === WebSocketResponseEvent.SEND_DATA_SSM_SESSIONS_LIST;
3073
+ };
3074
+ const isSendDataRunCommandWebSocketResponseEventDTO = (event) => {
3075
+ return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
3076
+ && event?.event === WebSocketResponseEvent.SEND_DATA_RUN_COMMAND;
3077
+ };
3078
+ const isSendDataClientTrackWebSocketResponseEventDTO = (event) => {
3079
+ return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
3080
+ && event?.event === WebSocketResponseEvent.SEND_DATA_CLIENT_TRACK;
3081
+ };
3082
+ const isSenDataChatCompletionsWebSocketResponseEventDTO = (event) => {
3083
+ return isWebSocketResponseEventDTO(event) && isSendDataWebSocketResponseEventDTO(event)
3084
+ && event?.event === WebSocketResponseEvent.SEND_DATA_CHAT_COMPLETIONS;
3085
+ };
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);
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();
3225
+
3226
+ const getUserKey = (userNickname, userCompanyKey) => {
3227
+ return userNickname + '|' + userCompanyKey;
3228
+ };
3229
+ const getParamsOfUserKey = (userKey) => {
3230
+ const [userNickname, userCompanyKey] = userKey.split('|');
3231
+ return { userNickname, userCompanyKey };
3232
+ };
3233
+ const getClientId = (sessionId, uiId) => {
3234
+ return `${sessionId}|${uiId}`;
3235
+ };
3236
+ const getParamsOfClientId = (clientId) => {
3237
+ const [sessionId, uiId] = clientId.split('|');
3238
+ return { sessionId, uiId };
3239
+ };
3240
+
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;
3268
+ };
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;
3301
+ };
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';
3308
+ };
3309
+ const isJkmdSheet = (value) => {
3310
+ return isBasicWorksheet(value)
3311
+ && value?.type === WorksheetType.JK_MD
3312
+ && typeof value?.content == 'string';
3313
+ };
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';
3321
+ };
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);
3345
+ };
3346
+
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 };