@juki-team/commons 0.1.32 → 0.1.40

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