acsi-core 0.9.30 → 0.9.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
2
2
 
3
+ var history = require('history');
3
4
  var toolkit = require('@reduxjs/toolkit');
4
5
  var React = require('react');
5
6
  var React__default = _interopDefault(React);
@@ -17,9 +18,9 @@ var rehypeKatex = _interopDefault(require('rehype-katex'));
17
18
  var remarkRehype = _interopDefault(require('remark-rehype'));
18
19
  var rehypeRaw = _interopDefault(require('rehype-raw'));
19
20
  require('katex/dist/katex.min.css');
20
- var msalBrowser = require('@azure/msal-browser');
21
21
  var Cookies = _interopDefault(require('js-cookie'));
22
22
  var moment = _interopDefault(require('moment'));
23
+ var msalBrowser = require('@azure/msal-browser');
23
24
  var reactToastify = require('react-toastify');
24
25
  var reactGoogleLogin = require('@leecheuk/react-google-login');
25
26
  var material = require('@mui/material');
@@ -28,592 +29,6 @@ var Sentry = require('@sentry/react');
28
29
  var fa = require('react-icons/fa');
29
30
  var CreatableSelect = _interopDefault(require('react-select/creatable'));
30
31
 
31
- function _extends() {
32
- return _extends = Object.assign ? Object.assign.bind() : function (n) {
33
- for (var e = 1; e < arguments.length; e++) {
34
- var t = arguments[e];
35
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
36
- }
37
- return n;
38
- }, _extends.apply(null, arguments);
39
- }
40
-
41
- function isAbsolute(pathname) {
42
- return pathname.charAt(0) === '/';
43
- }
44
-
45
- // About 1.5x faster than the two-arg version of Array#splice()
46
- function spliceOne(list, index) {
47
- for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) {
48
- list[i] = list[k];
49
- }
50
-
51
- list.pop();
52
- }
53
-
54
- // This implementation is based heavily on node's url.parse
55
- function resolvePathname(to, from) {
56
- if (from === undefined) from = '';
57
-
58
- var toParts = (to && to.split('/')) || [];
59
- var fromParts = (from && from.split('/')) || [];
60
-
61
- var isToAbs = to && isAbsolute(to);
62
- var isFromAbs = from && isAbsolute(from);
63
- var mustEndAbs = isToAbs || isFromAbs;
64
-
65
- if (to && isAbsolute(to)) {
66
- // to is absolute
67
- fromParts = toParts;
68
- } else if (toParts.length) {
69
- // to is relative, drop the filename
70
- fromParts.pop();
71
- fromParts = fromParts.concat(toParts);
72
- }
73
-
74
- if (!fromParts.length) return '/';
75
-
76
- var hasTrailingSlash;
77
- if (fromParts.length) {
78
- var last = fromParts[fromParts.length - 1];
79
- hasTrailingSlash = last === '.' || last === '..' || last === '';
80
- } else {
81
- hasTrailingSlash = false;
82
- }
83
-
84
- var up = 0;
85
- for (var i = fromParts.length; i >= 0; i--) {
86
- var part = fromParts[i];
87
-
88
- if (part === '.') {
89
- spliceOne(fromParts, i);
90
- } else if (part === '..') {
91
- spliceOne(fromParts, i);
92
- up++;
93
- } else if (up) {
94
- spliceOne(fromParts, i);
95
- up--;
96
- }
97
- }
98
-
99
- if (!mustEndAbs) for (; up--; up) fromParts.unshift('..');
100
-
101
- if (
102
- mustEndAbs &&
103
- fromParts[0] !== '' &&
104
- (!fromParts[0] || !isAbsolute(fromParts[0]))
105
- )
106
- fromParts.unshift('');
107
-
108
- var result = fromParts.join('/');
109
-
110
- if (hasTrailingSlash && result.substr(-1) !== '/') result += '/';
111
-
112
- return result;
113
- }
114
-
115
- var isProduction = process.env.NODE_ENV === 'production';
116
- function warning(condition, message) {
117
- if (!isProduction) {
118
- if (condition) {
119
- return;
120
- }
121
-
122
- var text = "Warning: " + message;
123
-
124
- if (typeof console !== 'undefined') {
125
- console.warn(text);
126
- }
127
-
128
- try {
129
- throw Error(text);
130
- } catch (x) {}
131
- }
132
- }
133
-
134
- var isProduction$1 = process.env.NODE_ENV === 'production';
135
- var prefix = 'Invariant failed';
136
- function invariant(condition, message) {
137
- if (condition) {
138
- return;
139
- }
140
- if (isProduction$1) {
141
- throw new Error(prefix);
142
- }
143
- var provided = typeof message === 'function' ? message() : message;
144
- var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
145
- throw new Error(value);
146
- }
147
-
148
- function addLeadingSlash(path) {
149
- return path.charAt(0) === '/' ? path : '/' + path;
150
- }
151
- function hasBasename(path, prefix) {
152
- return path.toLowerCase().indexOf(prefix.toLowerCase()) === 0 && '/?#'.indexOf(path.charAt(prefix.length)) !== -1;
153
- }
154
- function stripBasename(path, prefix) {
155
- return hasBasename(path, prefix) ? path.substr(prefix.length) : path;
156
- }
157
- function stripTrailingSlash(path) {
158
- return path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
159
- }
160
- function parsePath(path) {
161
- var pathname = path || '/';
162
- var search = '';
163
- var hash = '';
164
- var hashIndex = pathname.indexOf('#');
165
-
166
- if (hashIndex !== -1) {
167
- hash = pathname.substr(hashIndex);
168
- pathname = pathname.substr(0, hashIndex);
169
- }
170
-
171
- var searchIndex = pathname.indexOf('?');
172
-
173
- if (searchIndex !== -1) {
174
- search = pathname.substr(searchIndex);
175
- pathname = pathname.substr(0, searchIndex);
176
- }
177
-
178
- return {
179
- pathname: pathname,
180
- search: search === '?' ? '' : search,
181
- hash: hash === '#' ? '' : hash
182
- };
183
- }
184
- function createPath(location) {
185
- var pathname = location.pathname,
186
- search = location.search,
187
- hash = location.hash;
188
- var path = pathname || '/';
189
- if (search && search !== '?') path += search.charAt(0) === '?' ? search : "?" + search;
190
- if (hash && hash !== '#') path += hash.charAt(0) === '#' ? hash : "#" + hash;
191
- return path;
192
- }
193
-
194
- function createLocation(path, state, key, currentLocation) {
195
- var location;
196
-
197
- if (typeof path === 'string') {
198
- // Two-arg form: push(path, state)
199
- location = parsePath(path);
200
- location.state = state;
201
- } else {
202
- // One-arg form: push(location)
203
- location = _extends({}, path);
204
- if (location.pathname === undefined) location.pathname = '';
205
-
206
- if (location.search) {
207
- if (location.search.charAt(0) !== '?') location.search = '?' + location.search;
208
- } else {
209
- location.search = '';
210
- }
211
-
212
- if (location.hash) {
213
- if (location.hash.charAt(0) !== '#') location.hash = '#' + location.hash;
214
- } else {
215
- location.hash = '';
216
- }
217
-
218
- if (state !== undefined && location.state === undefined) location.state = state;
219
- }
220
-
221
- try {
222
- location.pathname = decodeURI(location.pathname);
223
- } catch (e) {
224
- if (e instanceof URIError) {
225
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.');
226
- } else {
227
- throw e;
228
- }
229
- }
230
-
231
- if (key) location.key = key;
232
-
233
- if (currentLocation) {
234
- // Resolve incomplete/relative pathname relative to current location.
235
- if (!location.pathname) {
236
- location.pathname = currentLocation.pathname;
237
- } else if (location.pathname.charAt(0) !== '/') {
238
- location.pathname = resolvePathname(location.pathname, currentLocation.pathname);
239
- }
240
- } else {
241
- // When there is no prior location and pathname is empty, set it to /
242
- if (!location.pathname) {
243
- location.pathname = '/';
244
- }
245
- }
246
-
247
- return location;
248
- }
249
-
250
- function createTransitionManager() {
251
- var prompt = null;
252
-
253
- function setPrompt(nextPrompt) {
254
- process.env.NODE_ENV !== "production" ? warning(prompt == null, 'A history supports only one prompt at a time') : void 0;
255
- prompt = nextPrompt;
256
- return function () {
257
- if (prompt === nextPrompt) prompt = null;
258
- };
259
- }
260
-
261
- function confirmTransitionTo(location, action, getUserConfirmation, callback) {
262
- // TODO: If another transition starts while we're still confirming
263
- // the previous one, we may end up in a weird state. Figure out the
264
- // best way to handle this.
265
- if (prompt != null) {
266
- var result = typeof prompt === 'function' ? prompt(location, action) : prompt;
267
-
268
- if (typeof result === 'string') {
269
- if (typeof getUserConfirmation === 'function') {
270
- getUserConfirmation(result, callback);
271
- } else {
272
- process.env.NODE_ENV !== "production" ? warning(false, 'A history needs a getUserConfirmation function in order to use a prompt message') : void 0;
273
- callback(true);
274
- }
275
- } else {
276
- // Return false from a transition hook to cancel the transition.
277
- callback(result !== false);
278
- }
279
- } else {
280
- callback(true);
281
- }
282
- }
283
-
284
- var listeners = [];
285
-
286
- function appendListener(fn) {
287
- var isActive = true;
288
-
289
- function listener() {
290
- if (isActive) fn.apply(void 0, arguments);
291
- }
292
-
293
- listeners.push(listener);
294
- return function () {
295
- isActive = false;
296
- listeners = listeners.filter(function (item) {
297
- return item !== listener;
298
- });
299
- };
300
- }
301
-
302
- function notifyListeners() {
303
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
304
- args[_key] = arguments[_key];
305
- }
306
-
307
- listeners.forEach(function (listener) {
308
- return listener.apply(void 0, args);
309
- });
310
- }
311
-
312
- return {
313
- setPrompt: setPrompt,
314
- confirmTransitionTo: confirmTransitionTo,
315
- appendListener: appendListener,
316
- notifyListeners: notifyListeners
317
- };
318
- }
319
-
320
- var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
321
- function getConfirmation(message, callback) {
322
- callback(window.confirm(message)); // eslint-disable-line no-alert
323
- }
324
- /**
325
- * Returns true if the HTML5 history API is supported. Taken from Modernizr.
326
- *
327
- * https://github.com/Modernizr/Modernizr/blob/master/LICENSE
328
- * https://github.com/Modernizr/Modernizr/blob/master/feature-detects/history.js
329
- * changed to avoid false negatives for Windows Phones: https://github.com/reactjs/react-router/issues/586
330
- */
331
-
332
- function supportsHistory() {
333
- var ua = window.navigator.userAgent;
334
- if ((ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) && ua.indexOf('Mobile Safari') !== -1 && ua.indexOf('Chrome') === -1 && ua.indexOf('Windows Phone') === -1) return false;
335
- return window.history && 'pushState' in window.history;
336
- }
337
- /**
338
- * Returns true if browser fires popstate on hash change.
339
- * IE10 and IE11 do not.
340
- */
341
-
342
- function supportsPopStateOnHashChange() {
343
- return window.navigator.userAgent.indexOf('Trident') === -1;
344
- }
345
- /**
346
- * Returns true if a given popstate event is an extraneous WebKit event.
347
- * Accounts for the fact that Chrome on iOS fires real popstate events
348
- * containing undefined state when pressing the back button.
349
- */
350
-
351
- function isExtraneousPopstateEvent(event) {
352
- return event.state === undefined && navigator.userAgent.indexOf('CriOS') === -1;
353
- }
354
-
355
- var PopStateEvent = 'popstate';
356
- var HashChangeEvent = 'hashchange';
357
-
358
- function getHistoryState() {
359
- try {
360
- return window.history.state || {};
361
- } catch (e) {
362
- // IE 11 sometimes throws when accessing window.history.state
363
- // See https://github.com/ReactTraining/history/pull/289
364
- return {};
365
- }
366
- }
367
- /**
368
- * Creates a history object that uses the HTML5 history API including
369
- * pushState, replaceState, and the popstate event.
370
- */
371
-
372
-
373
- function createBrowserHistory(props) {
374
- if (props === void 0) {
375
- props = {};
376
- }
377
-
378
- !canUseDOM ? process.env.NODE_ENV !== "production" ? invariant(false, 'Browser history needs a DOM') : invariant(false) : void 0;
379
- var globalHistory = window.history;
380
- var canUseHistory = supportsHistory();
381
- var needsHashChangeListener = !supportsPopStateOnHashChange();
382
- var _props = props,
383
- _props$forceRefresh = _props.forceRefresh,
384
- forceRefresh = _props$forceRefresh === void 0 ? false : _props$forceRefresh,
385
- _props$getUserConfirm = _props.getUserConfirmation,
386
- getUserConfirmation = _props$getUserConfirm === void 0 ? getConfirmation : _props$getUserConfirm,
387
- _props$keyLength = _props.keyLength,
388
- keyLength = _props$keyLength === void 0 ? 6 : _props$keyLength;
389
- var basename = props.basename ? stripTrailingSlash(addLeadingSlash(props.basename)) : '';
390
-
391
- function getDOMLocation(historyState) {
392
- var _ref = historyState || {},
393
- key = _ref.key,
394
- state = _ref.state;
395
-
396
- var _window$location = window.location,
397
- pathname = _window$location.pathname,
398
- search = _window$location.search,
399
- hash = _window$location.hash;
400
- var path = pathname + search + hash;
401
- process.env.NODE_ENV !== "production" ? warning(!basename || hasBasename(path, basename), 'You are attempting to use a basename on a page whose URL path does not begin ' + 'with the basename. Expected path "' + path + '" to begin with "' + basename + '".') : void 0;
402
- if (basename) path = stripBasename(path, basename);
403
- return createLocation(path, state, key);
404
- }
405
-
406
- function createKey() {
407
- return Math.random().toString(36).substr(2, keyLength);
408
- }
409
-
410
- var transitionManager = createTransitionManager();
411
-
412
- function setState(nextState) {
413
- _extends(history, nextState);
414
-
415
- history.length = globalHistory.length;
416
- transitionManager.notifyListeners(history.location, history.action);
417
- }
418
-
419
- function handlePopState(event) {
420
- // Ignore extraneous popstate events in WebKit.
421
- if (isExtraneousPopstateEvent(event)) return;
422
- handlePop(getDOMLocation(event.state));
423
- }
424
-
425
- function handleHashChange() {
426
- handlePop(getDOMLocation(getHistoryState()));
427
- }
428
-
429
- var forceNextPop = false;
430
-
431
- function handlePop(location) {
432
- if (forceNextPop) {
433
- forceNextPop = false;
434
- setState();
435
- } else {
436
- var action = 'POP';
437
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
438
- if (ok) {
439
- setState({
440
- action: action,
441
- location: location
442
- });
443
- } else {
444
- revertPop(location);
445
- }
446
- });
447
- }
448
- }
449
-
450
- function revertPop(fromLocation) {
451
- var toLocation = history.location; // TODO: We could probably make this more reliable by
452
- // keeping a list of keys we've seen in sessionStorage.
453
- // Instead, we just default to 0 for keys we don't know.
454
-
455
- var toIndex = allKeys.indexOf(toLocation.key);
456
- if (toIndex === -1) toIndex = 0;
457
- var fromIndex = allKeys.indexOf(fromLocation.key);
458
- if (fromIndex === -1) fromIndex = 0;
459
- var delta = toIndex - fromIndex;
460
-
461
- if (delta) {
462
- forceNextPop = true;
463
- go(delta);
464
- }
465
- }
466
-
467
- var initialLocation = getDOMLocation(getHistoryState());
468
- var allKeys = [initialLocation.key]; // Public interface
469
-
470
- function createHref(location) {
471
- return basename + createPath(location);
472
- }
473
-
474
- function push(path, state) {
475
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to push when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
476
- var action = 'PUSH';
477
- var location = createLocation(path, state, createKey(), history.location);
478
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
479
- if (!ok) return;
480
- var href = createHref(location);
481
- var key = location.key,
482
- state = location.state;
483
-
484
- if (canUseHistory) {
485
- globalHistory.pushState({
486
- key: key,
487
- state: state
488
- }, null, href);
489
-
490
- if (forceRefresh) {
491
- window.location.href = href;
492
- } else {
493
- var prevIndex = allKeys.indexOf(history.location.key);
494
- var nextKeys = allKeys.slice(0, prevIndex + 1);
495
- nextKeys.push(location.key);
496
- allKeys = nextKeys;
497
- setState({
498
- action: action,
499
- location: location
500
- });
501
- }
502
- } else {
503
- process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot push state in browsers that do not support HTML5 history') : void 0;
504
- window.location.href = href;
505
- }
506
- });
507
- }
508
-
509
- function replace(path, state) {
510
- process.env.NODE_ENV !== "production" ? warning(!(typeof path === 'object' && path.state !== undefined && state !== undefined), 'You should avoid providing a 2nd state argument to replace when the 1st ' + 'argument is a location-like object that already has state; it is ignored') : void 0;
511
- var action = 'REPLACE';
512
- var location = createLocation(path, state, createKey(), history.location);
513
- transitionManager.confirmTransitionTo(location, action, getUserConfirmation, function (ok) {
514
- if (!ok) return;
515
- var href = createHref(location);
516
- var key = location.key,
517
- state = location.state;
518
-
519
- if (canUseHistory) {
520
- globalHistory.replaceState({
521
- key: key,
522
- state: state
523
- }, null, href);
524
-
525
- if (forceRefresh) {
526
- window.location.replace(href);
527
- } else {
528
- var prevIndex = allKeys.indexOf(history.location.key);
529
- if (prevIndex !== -1) allKeys[prevIndex] = location.key;
530
- setState({
531
- action: action,
532
- location: location
533
- });
534
- }
535
- } else {
536
- process.env.NODE_ENV !== "production" ? warning(state === undefined, 'Browser history cannot replace state in browsers that do not support HTML5 history') : void 0;
537
- window.location.replace(href);
538
- }
539
- });
540
- }
541
-
542
- function go(n) {
543
- globalHistory.go(n);
544
- }
545
-
546
- function goBack() {
547
- go(-1);
548
- }
549
-
550
- function goForward() {
551
- go(1);
552
- }
553
-
554
- var listenerCount = 0;
555
-
556
- function checkDOMListeners(delta) {
557
- listenerCount += delta;
558
-
559
- if (listenerCount === 1 && delta === 1) {
560
- window.addEventListener(PopStateEvent, handlePopState);
561
- if (needsHashChangeListener) window.addEventListener(HashChangeEvent, handleHashChange);
562
- } else if (listenerCount === 0) {
563
- window.removeEventListener(PopStateEvent, handlePopState);
564
- if (needsHashChangeListener) window.removeEventListener(HashChangeEvent, handleHashChange);
565
- }
566
- }
567
-
568
- var isBlocked = false;
569
-
570
- function block(prompt) {
571
- if (prompt === void 0) {
572
- prompt = false;
573
- }
574
-
575
- var unblock = transitionManager.setPrompt(prompt);
576
-
577
- if (!isBlocked) {
578
- checkDOMListeners(1);
579
- isBlocked = true;
580
- }
581
-
582
- return function () {
583
- if (isBlocked) {
584
- isBlocked = false;
585
- checkDOMListeners(-1);
586
- }
587
-
588
- return unblock();
589
- };
590
- }
591
-
592
- function listen(listener) {
593
- var unlisten = transitionManager.appendListener(listener);
594
- checkDOMListeners(1);
595
- return function () {
596
- checkDOMListeners(-1);
597
- unlisten();
598
- };
599
- }
600
-
601
- var history = {
602
- length: globalHistory.length,
603
- action: 'POP',
604
- location: initialLocation,
605
- createHref: createHref,
606
- push: push,
607
- replace: replace,
608
- go: go,
609
- goBack: goBack,
610
- goForward: goForward,
611
- block: block,
612
- listen: listen
613
- };
614
- return history;
615
- }
616
-
617
32
  var setLoading = toolkit.createAction("common/setLoading");
618
33
  var setLoadingPage = toolkit.createAction("common/setLoadingPage");
619
34
  var setAlert = toolkit.createAction("common/setAlert");
@@ -672,25 +87,6 @@ var ORGANIZATION_TEAM = "ORGANIZATION_TEAM";
672
87
 
673
88
  var styleGlobal = {"signup_wrap":"_1KLz9","box-signin":"_2Jo1o","signin_title":"_3egBO","signup_link":"_1DoIT","google_button":"_34hK_","microsoft_button":"_19ESb","box-field":"_2e9xO","box-input":"_3zXRp","box-text":"_8NJga","box-button-email":"_21FPk","box-signin-container":"_1QERu","box-signin-text":"_2-znH","box-signin-logo":"_1aB2m","box-right":"_3qndF","image-slideshow":"_1aM7m","active":"_Vx1zf","box-right-body":"_JzdCr","box-right-footer":"_19aCA","pr-30":"_2HB5r","width-400":"_4ehXP"};
674
89
 
675
- // A type of promise-like that resolves synchronously and supports only one observer
676
-
677
- const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
678
-
679
- const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
680
-
681
- // Asynchronously call a function and send errors to recovery continuation
682
- function _catch(body, recover) {
683
- try {
684
- var result = body();
685
- } catch(e) {
686
- return recover(e);
687
- }
688
- if (result && result.then) {
689
- return result.then(void 0, recover);
690
- }
691
- return result;
692
- }
693
-
694
90
  function _arrayLikeToArray(r, a) {
695
91
  (null == a || a > r.length) && (a = r.length);
696
92
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
@@ -713,14 +109,14 @@ function _createForOfIteratorHelperLoose(r, e) {
713
109
  }
714
110
  throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
715
111
  }
716
- function _extends$1() {
717
- return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
112
+ function _extends() {
113
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
718
114
  for (var e = 1; e < arguments.length; e++) {
719
115
  var t = arguments[e];
720
116
  for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
721
117
  }
722
118
  return n;
723
- }, _extends$1.apply(null, arguments);
119
+ }, _extends.apply(null, arguments);
724
120
  }
725
121
  function _objectWithoutPropertiesLoose(r, e) {
726
122
  if (null == r) return {};
@@ -739,6 +135,25 @@ function _unsupportedIterableToArray(r, a) {
739
135
  }
740
136
  }
741
137
 
138
+ // A type of promise-like that resolves synchronously and supports only one observer
139
+
140
+ const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.iterator || (Symbol.iterator = Symbol("Symbol.iterator"))) : "@@iterator";
141
+
142
+ const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
143
+
144
+ // Asynchronously call a function and send errors to recovery continuation
145
+ function _catch(body, recover) {
146
+ try {
147
+ var result = body();
148
+ } catch(e) {
149
+ return recover(e);
150
+ }
151
+ if (result && result.then) {
152
+ return result.then(void 0, recover);
153
+ }
154
+ return result;
155
+ }
156
+
742
157
  var styles = {"core-button":"_xvNBN","primary":"_U9Qyp","secondary":"_1VzMy","text":"_pZNuj","danger":"_2uYm1","light":"_wxH5S"};
743
158
 
744
159
  var _excluded = ["type", "children", "onClick", "icon", "disabled", "htmlType"];
@@ -828,14 +243,28 @@ var CoreInput = function CoreInput(props) {
828
243
  var styles$3 = {"core-select":"_2sg12","label":"_1-XBo"};
829
244
 
830
245
  var Option = function Option(props) {
831
- return React__default.createElement("div", null, React__default.createElement(ReactSelect.components.Option, Object.assign({}, props), React__default.createElement(CoreInput$1, {
246
+ return React__default.createElement("div", null, React__default.createElement(ReactSelect.components.Option, Object.assign({}, props, {
247
+ onClick: function onClick(e) {
248
+ var _props$innerProps;
249
+ if (props !== null && props !== void 0 && props.action) {
250
+ e.preventDefault();
251
+ e.stopPropagation();
252
+ props === null || props === void 0 ? void 0 : props.action();
253
+ console.log("`Action executed");
254
+ return;
255
+ }
256
+ if ((_props$innerProps = props.innerProps) !== null && _props$innerProps !== void 0 && _props$innerProps.onClick) {
257
+ props.innerProps.onClick(e);
258
+ }
259
+ }
260
+ }), props.isMulti ? React__default.createElement(CoreInput$1, {
832
261
  checked: props.isSelected,
833
262
  onChange: function onChange() {
834
263
  return null;
835
264
  },
836
265
  name: "",
837
266
  label: props.label
838
- })));
267
+ }) : props.children));
839
268
  };
840
269
  var CoreSelect = function CoreSelect(props) {
841
270
  var name = props.name,
@@ -866,7 +295,7 @@ var CoreSelect = function CoreSelect(props) {
866
295
  onChange(name, newValue);
867
296
  };
868
297
  var controlStyle = function controlStyle(base, state) {
869
- var styles = _extends$1({}, base, {
298
+ var styles = _extends({}, base, {
870
299
  fontSize: "14px",
871
300
  fontWeight: "400",
872
301
  padding: "0 4px",
@@ -895,7 +324,7 @@ var CoreSelect = function CoreSelect(props) {
895
324
  return styles;
896
325
  };
897
326
  var inputStyles = function inputStyles(base) {
898
- var styles = _extends$1({}, base, {
327
+ var styles = _extends({}, base, {
899
328
  margin: "0",
900
329
  padding: "0",
901
330
  color: "inherit"
@@ -903,13 +332,13 @@ var CoreSelect = function CoreSelect(props) {
903
332
  return styles;
904
333
  };
905
334
  var placeholderStyles = function placeholderStyles(base) {
906
- var styles = _extends$1({}, base, {
335
+ var styles = _extends({}, base, {
907
336
  color: COLORS.lightGray
908
337
  });
909
338
  return styles;
910
339
  };
911
340
  var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
912
- var styles = _extends$1({}, base, {
341
+ var styles = _extends({}, base, {
913
342
  position: "relative",
914
343
  top: "-4px",
915
344
  padding: "8px 0"
@@ -917,7 +346,7 @@ var CoreSelect = function CoreSelect(props) {
917
346
  return styles;
918
347
  };
919
348
  var valueContainerStyles = function valueContainerStyles(base) {
920
- var styles = _extends$1({}, base, {
349
+ var styles = _extends({}, base, {
921
350
  height: isMulti ? undefined : "32px",
922
351
  position: "relative",
923
352
  top: "-3px"
@@ -925,11 +354,11 @@ var CoreSelect = function CoreSelect(props) {
925
354
  return styles;
926
355
  };
927
356
  var singleValueStyles = function singleValueStyles(base) {
928
- var styles = _extends$1({}, base);
357
+ var styles = _extends({}, base);
929
358
  return styles;
930
359
  };
931
360
  var optionStyles = function optionStyles(base, state) {
932
- var styles = _extends$1({}, base, {
361
+ var styles = _extends({}, base, {
933
362
  padding: "8px",
934
363
  borderRadius: "8px",
935
364
  cursor: "pointer",
@@ -943,13 +372,13 @@ var CoreSelect = function CoreSelect(props) {
943
372
  return styles;
944
373
  };
945
374
  var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
946
- var styles = _extends$1({}, base, {
375
+ var styles = _extends({}, base, {
947
376
  display: type === "no-outline" ? "none" : "block"
948
377
  });
949
378
  return styles;
950
379
  };
951
380
  var multiValueStyles = function multiValueStyles(base) {
952
- var styles = _extends$1({}, base, {
381
+ var styles = _extends({}, base, {
953
382
  backgroundColor: COLORS.lightBlue,
954
383
  borderRadius: "4px",
955
384
  padding: "2px 8px",
@@ -961,14 +390,14 @@ var CoreSelect = function CoreSelect(props) {
961
390
  return styles;
962
391
  };
963
392
  var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
964
- var styles = _extends$1({}, base, {
393
+ var styles = _extends({}, base, {
965
394
  color: COLORS.lightGray,
966
395
  cursor: "pointer"
967
396
  });
968
397
  return styles;
969
398
  };
970
399
  var multiValueLabelStyles = function multiValueLabelStyles(base) {
971
- var styles = _extends$1({}, base, {
400
+ var styles = _extends({}, base, {
972
401
  color: COLORS.blackText,
973
402
  fontWeight: "400",
974
403
  fontSize: "13px",
@@ -995,9 +424,9 @@ var CoreSelect = function CoreSelect(props) {
995
424
  closeMenuOnSelect: closeMenuOnSelect,
996
425
  hideSelectedOptions: hideSelectedOptions,
997
426
  options: options,
998
- components: isMulti ? {
427
+ components: {
999
428
  Option: Option
1000
- } : undefined,
429
+ },
1001
430
  styles: {
1002
431
  control: controlStyle,
1003
432
  input: inputStyles,
@@ -1407,7 +836,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1407
836
  onChange(name, newValue);
1408
837
  };
1409
838
  var controlStyle = function controlStyle(base, state) {
1410
- var styles = _extends$1({}, base, {
839
+ var styles = _extends({}, base, {
1411
840
  fontSize: "14px",
1412
841
  fontWeight: "400",
1413
842
  backgroundColor: state.isDisabled ? "transparent" : error ? COLORS.lightYellow : COLORS.white,
@@ -1428,7 +857,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1428
857
  return styles;
1429
858
  };
1430
859
  var inputStyles = function inputStyles(base) {
1431
- var styles = _extends$1({}, base, {
860
+ var styles = _extends({}, base, {
1432
861
  margin: "0",
1433
862
  padding: "0",
1434
863
  color: "inherit",
@@ -1438,37 +867,37 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1438
867
  return styles;
1439
868
  };
1440
869
  var placeholderStyles = function placeholderStyles(base) {
1441
- var styles = _extends$1({}, base, {
870
+ var styles = _extends({}, base, {
1442
871
  color: COLORS.lightGray
1443
872
  });
1444
873
  return styles;
1445
874
  };
1446
875
  var dropdownIndicatorStyles = function dropdownIndicatorStyles(base) {
1447
- var styles = _extends$1({}, base, {
876
+ var styles = _extends({}, base, {
1448
877
  position: "relative",
1449
878
  padding: "2px 0"
1450
879
  });
1451
880
  return styles;
1452
881
  };
1453
882
  var indicatorsContainerStyles = function indicatorsContainerStyles(base) {
1454
- var styles = _extends$1({}, base, {
883
+ var styles = _extends({}, base, {
1455
884
  display: isShowDropdown && !isMulti ? "block" : "none"
1456
885
  });
1457
886
  return styles;
1458
887
  };
1459
888
  var valueContainerStyles = function valueContainerStyles(base) {
1460
- var styles = _extends$1({}, base, {
889
+ var styles = _extends({}, base, {
1461
890
  height: isMulti ? undefined : "26px",
1462
891
  position: "relative"
1463
892
  });
1464
893
  return styles;
1465
894
  };
1466
895
  var singleValueStyles = function singleValueStyles(base) {
1467
- var styles = _extends$1({}, base);
896
+ var styles = _extends({}, base);
1468
897
  return styles;
1469
898
  };
1470
899
  var optionStyles = function optionStyles(base, state) {
1471
- var styles = _extends$1({}, base, {
900
+ var styles = _extends({}, base, {
1472
901
  padding: "8px",
1473
902
  borderRadius: "8px",
1474
903
  cursor: "pointer",
@@ -1483,7 +912,7 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1483
912
  return styles;
1484
913
  };
1485
914
  var multiValueStyles = function multiValueStyles(base) {
1486
- var styles = _extends$1({}, base, {
915
+ var styles = _extends({}, base, {
1487
916
  backgroundColor: COLORS.lightBlue,
1488
917
  borderRadius: "4px",
1489
918
  padding: "0 4px",
@@ -1495,14 +924,14 @@ var CoreSelectCompact = function CoreSelectCompact(props) {
1495
924
  return styles;
1496
925
  };
1497
926
  var multiValueRemoveStyles = function multiValueRemoveStyles(base) {
1498
- var styles = _extends$1({}, base, {
927
+ var styles = _extends({}, base, {
1499
928
  color: COLORS.lightGray,
1500
929
  cursor: "pointer"
1501
930
  });
1502
931
  return styles;
1503
932
  };
1504
933
  var multiValueLabelStyles = function multiValueLabelStyles(base) {
1505
- var styles = _extends$1({}, base, {
934
+ var styles = _extends({}, base, {
1506
935
  color: COLORS.blackText,
1507
936
  fontWeight: "400",
1508
937
  fontSize: "13px",
@@ -2170,279 +1599,6 @@ function formatContent(content) {
2170
1599
  return result.join("\n");
2171
1600
  }
2172
1601
 
2173
- var AuthenticationMessage;
2174
- (function (AuthenticationMessage) {
2175
- AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
2176
- AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
2177
- })(AuthenticationMessage || (AuthenticationMessage = {}));
2178
- (function (Role) {
2179
- Role["Student"] = "Student";
2180
- Role["Teacher"] = "Teacher";
2181
- Role["Admin"] = "Admin";
2182
- })(exports.Role || (exports.Role = {}));
2183
- var msalConfig = function msalConfig(clientId, redirectUri) {
2184
- return {
2185
- auth: {
2186
- clientId: clientId,
2187
- authority: "https://login.microsoftonline.com/common",
2188
- redirectUri: redirectUri,
2189
- navigateToLoginRequestUrl: false
2190
- },
2191
- cache: {
2192
- cacheLocation: "localStorage",
2193
- storeAuthStateInCookie: false
2194
- },
2195
- system: {
2196
- loggerOptions: {
2197
- loggerCallback: function loggerCallback(level, message, containsPii) {
2198
- if (containsPii) {
2199
- return;
2200
- }
2201
- var prefix = '[MSAL]';
2202
- switch (level) {
2203
- case msalBrowser.LogLevel.Error:
2204
- console.error(prefix + " " + message);
2205
- return;
2206
- case msalBrowser.LogLevel.Info:
2207
- console.info(prefix + " " + message);
2208
- return;
2209
- case msalBrowser.LogLevel.Verbose:
2210
- console.debug(prefix + " " + message);
2211
- return;
2212
- case msalBrowser.LogLevel.Warning:
2213
- console.warn(prefix + " " + message);
2214
- return;
2215
- default:
2216
- return;
2217
- }
2218
- }
2219
- }
2220
- }
2221
- };
2222
- };
2223
-
2224
- var msalInstance = null;
2225
- var isInitializing = false;
2226
- var initPromise = null;
2227
- var getMSALInstance = function getMSALInstance(clientId, redirectUri) {
2228
- var finalClientId = clientId || MICROSOFT_CLIENT_ID;
2229
- var finalRedirectUri = redirectUri || MICROSOFT_URL_DIRECT || window.location.origin;
2230
- if (!finalClientId) {
2231
- return null;
2232
- }
2233
- if (!msalInstance) {
2234
- msalInstance = new msalBrowser.PublicClientApplication(msalConfig(finalClientId, finalRedirectUri));
2235
- } else {
2236
- var _existingConfig$auth, _existingConfig$auth2;
2237
- var existingConfig = msalInstance.config;
2238
- if ((existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig$auth = existingConfig.auth) === null || _existingConfig$auth === void 0 ? void 0 : _existingConfig$auth.clientId) !== finalClientId || (existingConfig === null || existingConfig === void 0 ? void 0 : (_existingConfig$auth2 = existingConfig.auth) === null || _existingConfig$auth2 === void 0 ? void 0 : _existingConfig$auth2.redirectUri) !== finalRedirectUri) {
2239
- msalInstance = new msalBrowser.PublicClientApplication(msalConfig(finalClientId, finalRedirectUri));
2240
- }
2241
- }
2242
- return msalInstance;
2243
- };
2244
- var initializeMSAL = function initializeMSAL(clientId, redirectUri) {
2245
- try {
2246
- var instance = getMSALInstance(clientId, redirectUri);
2247
- if (!instance) {
2248
- return Promise.resolve(null);
2249
- }
2250
- if (isInitializing && initPromise) {
2251
- return Promise.resolve(initPromise.then(function () {
2252
- return instance;
2253
- }));
2254
- }
2255
- if (isInitializing) {
2256
- return Promise.resolve(instance);
2257
- }
2258
- isInitializing = true;
2259
- initPromise = instance.initialize().then(function () {
2260
- isInitializing = false;
2261
- return instance;
2262
- })["catch"](function (error) {
2263
- isInitializing = false;
2264
- throw error;
2265
- });
2266
- return Promise.resolve(initPromise);
2267
- } catch (e) {
2268
- return Promise.reject(e);
2269
- }
2270
- };
2271
- var handleMSALRedirect = function handleMSALRedirect(clientId, redirectUri) {
2272
- try {
2273
- if (!window.location.hash) {
2274
- return Promise.resolve(null);
2275
- }
2276
- var hashParams = new URLSearchParams(window.location.hash.substring(1));
2277
- var hasAccessToken = hashParams.has('access_token');
2278
- var hasIdToken = hashParams.has('id_token');
2279
- var hasError = hashParams.has('error');
2280
- var hasCode = hashParams.has('code');
2281
- var hasMSALParams = hasAccessToken || hasIdToken || hasError || hasCode;
2282
- if (!hasMSALParams) {
2283
- return Promise.resolve(null);
2284
- }
2285
- return Promise.resolve(_catch(function () {
2286
- return Promise.resolve(initializeMSAL(clientId, redirectUri)).then(function (instance) {
2287
- return instance ? Promise.resolve(instance.handleRedirectPromise()).then(function (response) {
2288
- var _exit = false;
2289
- var _temp = function () {
2290
- if (response) {
2291
- _exit = true;
2292
- return response;
2293
- } else {
2294
- return function () {
2295
- if (hashParams.has('code')) {
2296
- return _catch(function () {
2297
- var clientInfo = hashParams.get('client_info');
2298
- return function () {
2299
- if (clientInfo) {
2300
- var decodedClientInfo = JSON.parse(atob(clientInfo));
2301
- var allAccounts = instance.getAllAccounts();
2302
- var matchingAccount = allAccounts.find(function (acc) {
2303
- return acc.homeAccountId === decodedClientInfo.uid || acc.username === decodedClientInfo.preferred_username || acc.username === decodedClientInfo.email;
2304
- });
2305
- if (!matchingAccount && allAccounts.length > 0) {
2306
- matchingAccount = allAccounts[0];
2307
- }
2308
- return function () {
2309
- if (matchingAccount) {
2310
- return _catch(function () {
2311
- return Promise.resolve(instance.acquireTokenSilent({
2312
- scopes: ["openid", "profile", "User.Read"],
2313
- account: matchingAccount
2314
- })).then(function (silentResult) {
2315
- if (silentResult) {
2316
- _exit = true;
2317
- return silentResult;
2318
- }
2319
- });
2320
- }, function () {});
2321
- } else {
2322
- var accountInfo = {
2323
- homeAccountId: decodedClientInfo.uid || decodedClientInfo.sub,
2324
- environment: 'login.microsoftonline.com',
2325
- tenantId: decodedClientInfo.tid,
2326
- username: decodedClientInfo.preferred_username || decodedClientInfo.email,
2327
- name: decodedClientInfo.name,
2328
- localAccountId: decodedClientInfo.oid || decodedClientInfo.sub
2329
- };
2330
- var _account$accessToken$ = {
2331
- account: accountInfo,
2332
- accessToken: '',
2333
- idToken: '',
2334
- scopes: ["openid", "profile", "User.Read"],
2335
- expiresOn: null,
2336
- tenantId: decodedClientInfo.tid,
2337
- uniqueId: decodedClientInfo.oid || decodedClientInfo.sub,
2338
- tokenType: 'Bearer'
2339
- };
2340
- _exit = true;
2341
- return _account$accessToken$;
2342
- }
2343
- }();
2344
- }
2345
- }();
2346
- }, function () {});
2347
- }
2348
- }();
2349
- }
2350
- }();
2351
- return _temp && _temp.then ? _temp.then(function (_result6) {
2352
- return _exit ? _result6 : response;
2353
- }) : _exit ? _temp : response;
2354
- }) : null;
2355
- });
2356
- }, function (error) {
2357
- console.error('[MSAL] Error during redirect processing:', error);
2358
- return null;
2359
- }));
2360
- } catch (e) {
2361
- return Promise.reject(e);
2362
- }
2363
- };
2364
- var isMSALRedirect = function isMSALRedirect() {
2365
- if (!window.location.hash) {
2366
- return false;
2367
- }
2368
- var hashParams = new URLSearchParams(window.location.hash.substring(1));
2369
- return hashParams.has('access_token') || hashParams.has('id_token') || hashParams.has('error') || hashParams.has('code');
2370
- };
2371
- var getAllAccounts = function getAllAccounts() {
2372
- var instance = getMSALInstance();
2373
- if (!instance) {
2374
- return [];
2375
- }
2376
- return instance.getAllAccounts();
2377
- };
2378
- var getActiveAccount = function getActiveAccount() {
2379
- var instance = getMSALInstance();
2380
- if (!instance) {
2381
- return null;
2382
- }
2383
- return instance.getActiveAccount();
2384
- };
2385
-
2386
- var MSALRedirectHandler = function MSALRedirectHandler() {
2387
- React.useLayoutEffect(function () {
2388
- var handleRedirect = function handleRedirect() {
2389
- try {
2390
- var alreadyProcessed = localStorage.getItem('MSAL_LOGIN_PENDING');
2391
- if (alreadyProcessed === 'true') {
2392
- return Promise.resolve();
2393
- }
2394
- if (!isMSALRedirect()) {
2395
- return Promise.resolve();
2396
- }
2397
- var _temp = _catch(function () {
2398
- return Promise.resolve(handleMSALRedirect()).then(function (response) {
2399
- if (response && response.account) {
2400
- if (window.history.replaceState) {
2401
- window.history.replaceState(null, '', window.location.pathname + window.location.search);
2402
- }
2403
- localStorage.setItem('MSAL_ACCOUNT', JSON.stringify(response.account));
2404
- localStorage.setItem('MSAL_ACCESS_TOKEN', response.accessToken || '');
2405
- localStorage.setItem('MSAL_LOGIN_PENDING', 'true');
2406
- window.dispatchEvent(new CustomEvent('msal-login-success', {
2407
- detail: {
2408
- account: response.account,
2409
- accessToken: response.accessToken,
2410
- idToken: response.idToken
2411
- }
2412
- }));
2413
- if (window.location.pathname.includes('/login')) {
2414
- window.location.reload();
2415
- } else {
2416
- window.location.href = '/dashboard';
2417
- }
2418
- } else {
2419
- var hashParams = new URLSearchParams(window.location.hash.substring(1));
2420
- var error = hashParams.get('error');
2421
- var errorDescription = hashParams.get('error_description');
2422
- if (error) {
2423
- console.error('[MSAL] Authentication error:', error, errorDescription);
2424
- }
2425
- if (window.history.replaceState) {
2426
- window.history.replaceState(null, '', window.location.pathname + window.location.search);
2427
- }
2428
- }
2429
- });
2430
- }, function (error) {
2431
- console.error('[MSAL] Redirect handling error:', error);
2432
- if (window.history.replaceState) {
2433
- window.history.replaceState(null, '', window.location.pathname + window.location.search);
2434
- }
2435
- });
2436
- return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
2437
- } catch (e) {
2438
- return Promise.reject(e);
2439
- }
2440
- };
2441
- handleRedirect();
2442
- }, []);
2443
- return null;
2444
- };
2445
-
2446
1602
  var CookieService = /*#__PURE__*/function () {
2447
1603
  function CookieService() {}
2448
1604
  CookieService.setAuthCookie = function setAuthCookie(data) {
@@ -2595,6 +1751,55 @@ var TypeLogin;
2595
1751
  TypeLogin[TypeLogin["Microsoft"] = 3] = "Microsoft";
2596
1752
  })(TypeLogin || (TypeLogin = {}));
2597
1753
 
1754
+ var AuthenticationMessage;
1755
+ (function (AuthenticationMessage) {
1756
+ AuthenticationMessage["NotAllowedToRegister"] = "NotAllowedToRegister";
1757
+ AuthenticationMessage["InvalidGoogleToken"] = "InvalidGoogleToken";
1758
+ })(AuthenticationMessage || (AuthenticationMessage = {}));
1759
+ (function (Role) {
1760
+ Role["Student"] = "Student";
1761
+ Role["Teacher"] = "Teacher";
1762
+ Role["Admin"] = "Admin";
1763
+ })(exports.Role || (exports.Role = {}));
1764
+ var msalConfig = function msalConfig(clientId, redirectUri) {
1765
+ return {
1766
+ auth: {
1767
+ clientId: clientId,
1768
+ authority: "https://login.microsoftonline.com/common",
1769
+ redirectUri: redirectUri
1770
+ },
1771
+ cache: {
1772
+ cacheLocation: "sessionStorage",
1773
+ storeAuthStateInCookie: false
1774
+ },
1775
+ system: {
1776
+ loggerOptions: {
1777
+ loggerCallback: function loggerCallback(level, message, containsPii) {
1778
+ if (containsPii) {
1779
+ return;
1780
+ }
1781
+ switch (level) {
1782
+ case msalBrowser.LogLevel.Error:
1783
+ console.error(message);
1784
+ return;
1785
+ case msalBrowser.LogLevel.Info:
1786
+ console.info(message);
1787
+ return;
1788
+ case msalBrowser.LogLevel.Verbose:
1789
+ console.debug(message);
1790
+ return;
1791
+ case msalBrowser.LogLevel.Warning:
1792
+ console.warn(message);
1793
+ return;
1794
+ default:
1795
+ return;
1796
+ }
1797
+ }
1798
+ }
1799
+ }
1800
+ };
1801
+ };
1802
+
2598
1803
  var BlockLogin = function BlockLogin(_ref) {
2599
1804
  var onNavigate = _ref.onNavigate,
2600
1805
  role = _ref.role,
@@ -2641,171 +1846,11 @@ var BlockLogin = function BlockLogin(_ref) {
2641
1846
  return Promise.reject(e);
2642
1847
  }
2643
1848
  };
2644
- var isProcessingLogin = React__default.useRef(false);
2645
- var processMSALLogin = function processMSALLogin(account, accessToken) {
2646
- try {
2647
- var _exit = false;
2648
- if (isProcessingLogin.current) {
2649
- return Promise.resolve();
2650
- }
2651
- isProcessingLogin.current = true;
2652
- return Promise.resolve(_catch(function () {
2653
- function _temp3(_result) {
2654
- var _authResult$data;
2655
- if (_exit) return _result;
2656
- if (!authResult || !authResult.data || ((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
2657
- dispatch(setLoading(false));
2658
- isProcessingLogin.current = false;
2659
- alert("Please contact admin.");
2660
- return;
2661
- }
2662
- var msalCacheKeys = Object.keys(localStorage).filter(function (key) {
2663
- return key.startsWith('msal.');
2664
- });
2665
- var msalCache = {};
2666
- msalCacheKeys.forEach(function (key) {
2667
- msalCache[key] = localStorage.getItem(key) || '';
2668
- });
2669
- localStorage.clear();
2670
- Object.keys(msalCache).forEach(function (key) {
2671
- localStorage.setItem(key, msalCache[key]);
2672
- });
2673
- var tokenJWT = authResult.data.token;
2674
- isProcessingLogin.current = false;
2675
- trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
2676
- eventName: exports.AmplitudeEvent.LOGIN,
2677
- eventProperties: {
2678
- email: (account === null || account === void 0 ? void 0 : account.username) || email,
2679
- login_method: 'microsoft',
2680
- user_role: authResult.data.role,
2681
- success: true,
2682
- timestamp: new Date().toISOString()
2683
- }
2684
- });
2685
- if (role === "LandingPage") {
2686
- CookieService.setAuthCookie({
2687
- token: tokenJWT,
2688
- expiresAt: Date.now() + 24 * 60 * 60 * 1000
2689
- });
2690
- var getRedirectUrl = function getRedirectUrl(role) {
2691
- switch (role) {
2692
- case "Admin":
2693
- return ADMIN_ORIGIN;
2694
- case "Teacher":
2695
- return TEACHER_ORIGIN;
2696
- default:
2697
- return role + "." + REQUEST_ORIGIN;
2698
- }
2699
- };
2700
- var redirectUrl = getRedirectUrl(authResult.data.role);
2701
- window.location.href = redirectUrl + "/dashboard";
2702
- dispatch(setLoading(false));
2703
- } else {
2704
- localStorage.setItem(ACCESS_TOKEN, tokenJWT);
2705
- onNavigate("/dashboard");
2706
- dispatch(setLoading(false));
2707
- }
2708
- }
2709
- dispatch(setLoading(true));
2710
- var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
2711
- var infoLogin = {
2712
- firstName: fullName.split(' ').slice(0, -1).join(' '),
2713
- lastName: fullName.split(' ').slice(-1).join(' '),
2714
- fullName: fullName,
2715
- imageUrl: "",
2716
- email: (account === null || account === void 0 ? void 0 : account.username) || "",
2717
- token: accessToken || "",
2718
- googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
2719
- role: role,
2720
- type: TypeLogin.Microsoft
2721
- };
2722
- var authResult;
2723
- var _temp2 = _catch(function () {
2724
- return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (_apiLoginGoogle) {
2725
- authResult = _apiLoginGoogle;
2726
- });
2727
- }, function () {
2728
- dispatch(setLoading(false));
2729
- isProcessingLogin.current = false;
2730
- _exit = true;
2731
- });
2732
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
2733
- }, function () {
2734
- isProcessingLogin.current = false;
2735
- dispatch(setLoading(false));
2736
- alert("An error occurred while processing your login. Please try again.");
2737
- }));
2738
- } catch (e) {
2739
- return Promise.reject(e);
2740
- }
2741
- };
2742
1849
  React.useEffect(function () {
2743
1850
  if (role === "Teacher" || role === "LandingPage") {
2744
1851
  handleGetImage();
2745
1852
  }
2746
1853
  }, []);
2747
- React.useEffect(function () {
2748
- var handleMSALLoginSuccess = function handleMSALLoginSuccess(event) {
2749
- try {
2750
- var _event$detail = event.detail,
2751
- account = _event$detail.account,
2752
- _accessToken = _event$detail.accessToken;
2753
- var _temp4 = function () {
2754
- if (account && _accessToken) {
2755
- localStorage.removeItem('MSAL_LOGIN_PENDING');
2756
- localStorage.removeItem('MSAL_ACCOUNT');
2757
- localStorage.removeItem('MSAL_ACCESS_TOKEN');
2758
- sessionStorage.removeItem('MSAL_LOGIN_PENDING');
2759
- sessionStorage.removeItem('MSAL_ACCOUNT');
2760
- sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2761
- return Promise.resolve(processMSALLogin(account, _accessToken)).then(function () {});
2762
- }
2763
- }();
2764
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
2765
- } catch (e) {
2766
- return Promise.reject(e);
2767
- }
2768
- };
2769
- window.addEventListener('msal-login-success', handleMSALLoginSuccess);
2770
- var pendingLogin = localStorage.getItem('MSAL_LOGIN_PENDING');
2771
- var accountStr = localStorage.getItem('MSAL_ACCOUNT');
2772
- var accessToken = localStorage.getItem('MSAL_ACCESS_TOKEN');
2773
- if (!pendingLogin || pendingLogin !== 'true') {
2774
- pendingLogin = sessionStorage.getItem('MSAL_LOGIN_PENDING');
2775
- accountStr = sessionStorage.getItem('MSAL_ACCOUNT');
2776
- accessToken = sessionStorage.getItem('MSAL_ACCESS_TOKEN');
2777
- if (pendingLogin === 'true' && accountStr && accessToken) {
2778
- localStorage.setItem('MSAL_ACCOUNT', accountStr);
2779
- localStorage.setItem('MSAL_ACCESS_TOKEN', accessToken);
2780
- localStorage.setItem('MSAL_LOGIN_PENDING', pendingLogin);
2781
- }
2782
- }
2783
- if (pendingLogin === 'true') {
2784
- if (accountStr && accessToken) {
2785
- try {
2786
- var account = JSON.parse(accountStr);
2787
- localStorage.removeItem('MSAL_LOGIN_PENDING');
2788
- localStorage.removeItem('MSAL_ACCOUNT');
2789
- localStorage.removeItem('MSAL_ACCESS_TOKEN');
2790
- sessionStorage.removeItem('MSAL_LOGIN_PENDING');
2791
- sessionStorage.removeItem('MSAL_ACCOUNT');
2792
- sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2793
- processMSALLogin(account, accessToken);
2794
- } catch (error) {
2795
- console.error('[MSAL] Error parsing stored account:', error);
2796
- localStorage.removeItem('MSAL_LOGIN_PENDING');
2797
- localStorage.removeItem('MSAL_ACCOUNT');
2798
- localStorage.removeItem('MSAL_ACCESS_TOKEN');
2799
- sessionStorage.removeItem('MSAL_LOGIN_PENDING');
2800
- sessionStorage.removeItem('MSAL_ACCOUNT');
2801
- sessionStorage.removeItem('MSAL_ACCESS_TOKEN');
2802
- }
2803
- }
2804
- }
2805
- return function () {
2806
- window.removeEventListener('msal-login-success', handleMSALLoginSuccess);
2807
- };
2808
- }, []);
2809
1854
  var googleLogin = google.useGoogleLogin({
2810
1855
  onSuccess: function (tokenResponse) {
2811
1856
  try {
@@ -2837,8 +1882,8 @@ var BlockLogin = function BlockLogin(_ref) {
2837
1882
  };
2838
1883
  dispatch(setLoading(true));
2839
1884
  return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
2840
- var _authResult$data2;
2841
- if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
1885
+ var _authResult$data;
1886
+ if (((_authResult$data = authResult.data) === null || _authResult$data === void 0 ? void 0 : _authResult$data.id) == null) {
2842
1887
  dispatch(setLoading(false));
2843
1888
  alert("Please contact admin.");
2844
1889
  return;
@@ -2891,64 +1936,84 @@ var BlockLogin = function BlockLogin(_ref) {
2891
1936
  });
2892
1937
  var fnLoginMicrosoft = function fnLoginMicrosoft() {
2893
1938
  try {
1939
+ var msalInstance = new msalBrowser.PublicClientApplication(msalConfig(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT));
1940
+ if (!msalInstance) {
1941
+ console.error("MSAL instance not initialized");
1942
+ return Promise.resolve();
1943
+ }
2894
1944
  return Promise.resolve(_catch(function () {
2895
- var msalInstance = getMSALInstance(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT);
2896
- if (!msalInstance) {
2897
- alert("Microsoft login is not configured. Please contact admin.");
2898
- return;
2899
- }
2900
- return Promise.resolve(initializeMSAL(MICROSOFT_CLIENT_ID, MICROSOFT_URL_DIRECT)).then(function (initializedInstance) {
2901
- var _exit2 = false;
2902
- function _temp6(_result5) {
2903
- return _exit2 ? _result5 : Promise.resolve(initializedInstance.loginRedirect(loginRequest)).then(function () {});
2904
- }
2905
- if (!initializedInstance) {
2906
- alert("Failed to initialize Microsoft login. Please try again.");
2907
- return;
2908
- }
1945
+ return Promise.resolve(msalInstance.initialize()).then(function () {
2909
1946
  var loginRequest = {
2910
- scopes: ["openid", "profile", "User.Read"],
2911
- prompt: "select_account"
1947
+ scopes: ["openid", "profile", "email"]
2912
1948
  };
2913
- var _temp5 = _catch(function () {
2914
- return Promise.resolve(initializedInstance.handleRedirectPromise()).then(function (redirectResponse) {
2915
- if (redirectResponse) {
2916
- if (redirectResponse.account) {
2917
- localStorage.setItem('MSAL_ACCOUNT', JSON.stringify(redirectResponse.account));
2918
- localStorage.setItem('MSAL_ACCESS_TOKEN', redirectResponse.accessToken || '');
2919
- localStorage.setItem('MSAL_LOGIN_PENDING', 'true');
2920
- sessionStorage.setItem('MSAL_ACCOUNT', JSON.stringify(redirectResponse.account));
2921
- sessionStorage.setItem('MSAL_ACCESS_TOKEN', redirectResponse.accessToken || '');
2922
- sessionStorage.setItem('MSAL_LOGIN_PENDING', 'true');
2923
- window.dispatchEvent(new CustomEvent('msal-login-success', {
2924
- detail: {
2925
- account: redirectResponse.account,
2926
- accessToken: redirectResponse.accessToken,
2927
- idToken: redirectResponse.idToken
1949
+ var silentRequest = _extends({}, loginRequest, {
1950
+ prompt: "select_account"
1951
+ });
1952
+ return Promise.resolve(msalInstance.loginPopup(silentRequest)).then(function (response) {
1953
+ return function () {
1954
+ if (response && response.account) {
1955
+ var account = response.account;
1956
+ var fullName = (account === null || account === void 0 ? void 0 : account.name) || "";
1957
+ var infoLogin = {
1958
+ firstName: fullName.split(' ').slice(0, -1).join(' '),
1959
+ lastName: fullName.split(' ').slice(-1).join(' '),
1960
+ fullName: fullName,
1961
+ imageUrl: "",
1962
+ email: (account === null || account === void 0 ? void 0 : account.username) || "",
1963
+ token: (response === null || response === void 0 ? void 0 : response.accessToken) || "",
1964
+ googleId: (account === null || account === void 0 ? void 0 : account.homeAccountId) || "",
1965
+ role: role,
1966
+ type: TypeLogin.Microsoft
1967
+ };
1968
+ dispatch(setLoading(true));
1969
+ return Promise.resolve(apiLoginGoogle(infoLogin)).then(function (authResult) {
1970
+ var _authResult$data2;
1971
+ if (((_authResult$data2 = authResult.data) === null || _authResult$data2 === void 0 ? void 0 : _authResult$data2.id) == null) {
1972
+ dispatch(setLoading(false));
1973
+ alert("Please contact admin.");
1974
+ return;
1975
+ }
1976
+ localStorage.clear();
1977
+ var tokenJWT = authResult.data.token;
1978
+ trackEvent === null || trackEvent === void 0 ? void 0 : trackEvent({
1979
+ eventName: exports.AmplitudeEvent.LOGIN,
1980
+ eventProperties: {
1981
+ email: email,
1982
+ login_method: 'google',
1983
+ user_role: authResult.data.role,
1984
+ success: true,
1985
+ timestamp: new Date().toISOString()
2928
1986
  }
2929
- }));
2930
- _exit2 = true;
2931
- }
1987
+ });
1988
+ if (role === "LandingPage") {
1989
+ CookieService.setAuthCookie({
1990
+ token: tokenJWT,
1991
+ expiresAt: Date.now() + 24 * 60 * 60 * 1000
1992
+ });
1993
+ var getRedirectUrl = function getRedirectUrl(role) {
1994
+ switch (role) {
1995
+ case "Admin":
1996
+ return ADMIN_ORIGIN;
1997
+ case "Teacher":
1998
+ return TEACHER_ORIGIN;
1999
+ default:
2000
+ return role + "." + REQUEST_ORIGIN;
2001
+ }
2002
+ };
2003
+ var redirectUrl = getRedirectUrl(authResult.data.role);
2004
+ window.location.href = redirectUrl + "/dashboard";
2005
+ dispatch(setLoading(false));
2006
+ }
2007
+ localStorage.setItem(ACCESS_TOKEN, tokenJWT);
2008
+ onNavigate("/dashboard");
2009
+ dispatch(setLoading(false));
2010
+ });
2932
2011
  }
2933
- });
2934
- }, function () {});
2935
- return _temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5);
2012
+ }();
2013
+ });
2936
2014
  });
2937
2015
  }, function (error) {
2938
- var _errorObj$message, _errorObj$message2;
2939
- var errorObj = error;
2940
- if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'popup_window_error' || errorObj !== null && errorObj !== void 0 && (_errorObj$message = errorObj.message) !== null && _errorObj$message !== void 0 && _errorObj$message.includes('popup')) {
2941
- alert("Popup was blocked. Please allow popups for this site and try again.");
2942
- return;
2943
- }
2944
- if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'interaction_in_progress') {
2945
- return;
2946
- }
2947
- if ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) === 'invalid_request' || errorObj !== null && errorObj !== void 0 && (_errorObj$message2 = errorObj.message) !== null && _errorObj$message2 !== void 0 && _errorObj$message2.includes('redirect_uri')) {
2948
- alert("Configuration error: Redirect URI mismatch. Please contact admin.");
2949
- return;
2950
- }
2951
- alert("An error occurred during Microsoft login: " + ((errorObj === null || errorObj === void 0 ? void 0 : errorObj.message) || (errorObj === null || errorObj === void 0 ? void 0 : errorObj.errorCode) || 'Unknown error') + ". Please try again.");
2016
+ console.error("Microsoft login error:", error);
2952
2017
  }));
2953
2018
  } catch (e) {
2954
2019
  return Promise.reject(e);
@@ -3562,7 +2627,7 @@ function kindOf(val) {
3562
2627
  }
3563
2628
 
3564
2629
  // src/utils/warning.ts
3565
- function warning$1(message) {
2630
+ function warning(message) {
3566
2631
  if (typeof console !== "undefined" && typeof console.error === "function") {
3567
2632
  console.error(message);
3568
2633
  }
@@ -3615,7 +2680,7 @@ function combineReducers(reducers) {
3615
2680
  const key = reducerKeys[i];
3616
2681
  if (process.env.NODE_ENV !== "production") {
3617
2682
  if (typeof reducers[key] === "undefined") {
3618
- warning$1(`No reducer provided for key "${key}"`);
2683
+ warning(`No reducer provided for key "${key}"`);
3619
2684
  }
3620
2685
  }
3621
2686
  if (typeof reducers[key] === "function") {
@@ -3640,7 +2705,7 @@ function combineReducers(reducers) {
3640
2705
  if (process.env.NODE_ENV !== "production") {
3641
2706
  const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
3642
2707
  if (warningMessage) {
3643
- warning$1(warningMessage);
2708
+ warning(warningMessage);
3644
2709
  }
3645
2710
  }
3646
2711
  let hasChanged = false;
@@ -4008,7 +3073,7 @@ var useAmplitude = function useAmplitude() {
4008
3073
  var savedUserProperties = React.useRef({});
4009
3074
  var hasTrackedInitialSession = React.useRef(false);
4010
3075
  var setUserProperties = React.useCallback(function (properties) {
4011
- savedUserProperties.current = _extends$1({}, savedUserProperties.current, properties);
3076
+ savedUserProperties.current = _extends({}, savedUserProperties.current, properties);
4012
3077
  var identify = new amplitude.Identify();
4013
3078
  Object.entries(properties).forEach(function (_ref) {
4014
3079
  var key = _ref[0],
@@ -4020,7 +3085,7 @@ var useAmplitude = function useAmplitude() {
4020
3085
  var trackEvent = React.useCallback(function (_ref2) {
4021
3086
  var eventName = _ref2.eventName,
4022
3087
  eventProperties = _ref2.eventProperties;
4023
- amplitude.track(eventName, _extends$1({}, savedUserProperties.current, eventProperties, {
3088
+ amplitude.track(eventName, _extends({}, savedUserProperties.current, eventProperties, {
4024
3089
  timestamp: new Date().toISOString()
4025
3090
  }));
4026
3091
  }, []);
@@ -4207,7 +3272,7 @@ var getErrorMessage = function getErrorMessage(error, defaultErrorMessage) {
4207
3272
 
4208
3273
  var customStyles = {
4209
3274
  control: function control(baseStyles, state) {
4210
- return _extends$1({}, baseStyles, {
3275
+ return _extends({}, baseStyles, {
4211
3276
  fontSize: "14px",
4212
3277
  fontWeight: 700,
4213
3278
  color: styleGlobal.darker,
@@ -4222,21 +3287,21 @@ var customStyles = {
4222
3287
  });
4223
3288
  },
4224
3289
  input: function input(baseStyles, _) {
4225
- return _extends$1({}, baseStyles, {
3290
+ return _extends({}, baseStyles, {
4226
3291
  fontSize: "14px",
4227
3292
  fontWeight: 700,
4228
3293
  color: styleGlobal.darker
4229
3294
  });
4230
3295
  },
4231
3296
  singleValue: function singleValue(baseStyles) {
4232
- return _extends$1({}, baseStyles, {
3297
+ return _extends({}, baseStyles, {
4233
3298
  fontSize: "14px",
4234
3299
  fontWeight: 700,
4235
3300
  color: styleGlobal.darker
4236
3301
  });
4237
3302
  },
4238
3303
  option: function option(baseStyles, state) {
4239
- return _extends$1({}, baseStyles, {
3304
+ return _extends({}, baseStyles, {
4240
3305
  backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.light : 'white',
4241
3306
  "&:active": {
4242
3307
  backgroundColor: state.isSelected ? styleGlobal.dark : state.isFocused ? styleGlobal.less_dark : baseStyles.backgroundColor
@@ -4404,26 +3469,36 @@ var utcToLocalTime = (function (time, FORMAT) {
4404
3469
  }
4405
3470
  });
4406
3471
 
4407
- var historyCore = createBrowserHistory();
3472
+ var timeSpanToLocalMoment = (function (time) {
3473
+ if (!time) return null;
3474
+ var times = time.split(":");
3475
+ if (times.length !== 3) return null;
3476
+ var totalSeconds = +times[0] * 60 * 60 + +times[1] * 60 + +times[2];
3477
+ var startOfDay = moment.utc().startOf("day");
3478
+ var dateTime = startOfDay.add(totalSeconds, "seconds");
3479
+ return dateTime.local();
3480
+ });
3481
+
3482
+ var historyCore = history.createBrowserHistory();
4408
3483
 
4409
3484
  Object.defineProperty(exports, 'GoogleOAuthProvider', {
4410
- enumerable: true,
4411
- get: function () {
4412
- return google.GoogleOAuthProvider;
4413
- }
3485
+ enumerable: true,
3486
+ get: function () {
3487
+ return google.GoogleOAuthProvider;
3488
+ }
4414
3489
  });
4415
3490
  exports.Cookies = Cookies;
4416
3491
  Object.defineProperty(exports, 'ToastContainer', {
4417
- enumerable: true,
4418
- get: function () {
4419
- return reactToastify.ToastContainer;
4420
- }
3492
+ enumerable: true,
3493
+ get: function () {
3494
+ return reactToastify.ToastContainer;
3495
+ }
4421
3496
  });
4422
3497
  Object.defineProperty(exports, 'toast', {
4423
- enumerable: true,
4424
- get: function () {
4425
- return reactToastify.toast;
4426
- }
3498
+ enumerable: true,
3499
+ get: function () {
3500
+ return reactToastify.toast;
3501
+ }
4427
3502
  });
4428
3503
  exports.ACCESS_TOKEN = ACCESS_TOKEN;
4429
3504
  exports.BASE_URL = BASE_URL;
@@ -4452,7 +3527,6 @@ exports.DATE_TIME_MIN_VALUE = DATE_TIME_MIN_VALUE;
4452
3527
  exports.LayoutContext = LayoutContext;
4453
3528
  exports.Loading = Loading;
4454
3529
  exports.Login = Login;
4455
- exports.MSALRedirectHandler = MSALRedirectHandler;
4456
3530
  exports.MarkdownLatexRender = MarkdownRenderer;
4457
3531
  exports.NotFound = NotFound;
4458
3532
  exports.OPENSALT_BASE_URL = OPENSALT_BASE_URL;
@@ -4462,17 +3536,11 @@ exports.api = api;
4462
3536
  exports.apiUpload = apiUpload;
4463
3537
  exports.firstCheckToken = firstCheckToken;
4464
3538
  exports.getAccessToken = getAccessToken;
4465
- exports.getActiveAccount = getActiveAccount;
4466
- exports.getAllAccounts = getAllAccounts;
4467
3539
  exports.getErrorMessage = getErrorMessage;
4468
3540
  exports.getImageUrl = getImageUrl;
4469
- exports.getMSALInstance = getMSALInstance;
4470
- exports.handleMSALRedirect = handleMSALRedirect;
4471
3541
  exports.historyCore = historyCore;
4472
3542
  exports.initSentry = initSentry;
4473
3543
  exports.initializeAmplitude = initializeAmplitude;
4474
- exports.initializeMSAL = initializeMSAL;
4475
- exports.isMSALRedirect = isMSALRedirect;
4476
3544
  exports.setAddTenant = setAddTenant;
4477
3545
  exports.setAlert = setAlert;
4478
3546
  exports.setIsRefetchSidebar = setIsRefetchSidebar;
@@ -4483,6 +3551,7 @@ exports.setTeam = setTeam;
4483
3551
  exports.setTenant = setTenant;
4484
3552
  exports.setUser = setUser;
4485
3553
  exports.store = store;
3554
+ exports.timeSpanToLocalMoment = timeSpanToLocalMoment;
4486
3555
  exports.useAmplitude = useAmplitude;
4487
3556
  exports.useGoogleSignOut = useGoogleSignOut;
4488
3557
  exports.utcToLocalTime = utcToLocalTime;