PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 All 140 releases
learnpress / assets / dist / js / admin / admin-courses.js

admin-courses.js in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.4.9, at assets/dist/js/admin/admin-courses.js

7,158 lines 254.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ "./assets/src/js/admin/courses/generate-with-ai.js"
5 /*!*********************************************************!*\
6 !*** ./assets/src/js/admin/courses/generate-with-ai.js ***!
7 \*********************************************************/
8 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
9
10 "use strict";
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ CreateCourseViaAI: () => (/* binding */ CreateCourseViaAI)
14 /* harmony export */ });
15 /* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js");
16 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js");
17 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(sweetalert2__WEBPACK_IMPORTED_MODULE_1__);
18 /* harmony import */ var lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lpAssetsJsPath/lpToastify.js */ "./assets/src/js/lpToastify.js");
19 /**
20 * Create course with AI
21 */
22
23
24
25
26 let lp_structure_course;
27 let lp_is_generating_course_data = false;
28 const lp_course_ai_setting = JSON.parse(localStorage.getItem('lp_course_ai_setting')) || {};
29 class CreateCourseViaAI {
30 constructor(options = {}) {
31 this.options = {
32 autoInsertButton: true,
33 isCourseBuilder: false,
34 redirectDelayMs: 2000,
35 ...options
36 };
37 this.init();
38 }
39 static selectors = {
40 elGenerateDataAiWrap: '.lp-generate-data-ai-wrap'
41 };
42 init() {
43 if (this.options.autoInsertButton) {
44 if (!lpData?.enable_open_ai) {
45 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady('.page-title-action', el => {
46 el.insertAdjacentHTML('afterend', `<button type="button" class="lp-btn-warning-enable-ai lp-btn-ai-style">
47 <i class="lp-ico-ai"></i>
48 <span>${lpData.i18n.generate_with_ai}</span>
49 </button>`);
50 });
51 } else {
52 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpOnElementReady('.page-title-action', el => {
53 el.insertAdjacentHTML('afterend', `<button type="button" class="lp-btn-generate-course-with-ai lp-btn-ai-style">
54 <i class="lp-ico-ai"></i>
55 <span>${lpData.i18n.generate_with_ai}</span>
56 </button>`);
57 });
58 }
59 }
60 this.events();
61 }
62 events() {
63 if (CreateCourseViaAI._loadedEvents) {
64 return;
65 }
66 CreateCourseViaAI._loadedEvents = true;
67 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.eventHandlers('click', [{
68 selector: '.lp-btn-warning-enable-ai',
69 class: this,
70 callBack: this.showPopupEnableAI.name
71 }, {
72 selector: '.lp-btn-generate-course-with-ai',
73 class: this,
74 callBack: this.showPopupCreateFullCourse.name
75 }, {
76 selector: '.lp-btn-step',
77 class: this,
78 callBack: this.showStep.name
79 }, {
80 selector: '.lp-btn-generate-prompt',
81 class: this,
82 callBack: this.generatePrompt.name
83 }, {
84 selector: '.lp-btn-call-open-ai',
85 class: this,
86 callBack: this.generateDataCourse.name
87 }, {
88 selector: '.lp-btn-create-course',
89 class: this,
90 callBack: this.createCourse.name
91 }, {
92 selector: '.lp-btn-close-ai-popup',
93 //class: this,
94 callBack: args => {
95 const {
96 e,
97 target
98 } = args;
99 const message = lpData?.i18n?.confirm_close_ai || 'Are you sure you want to close? Generate data will stop.';
100 if (!lp_is_generating_course_data) {
101 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().close();
102 } else if (confirm(message)) {
103 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().close();
104 }
105
106 // Testing custom confirm box
107 /*if ( confirm( message ) ) {
108 SweetAlert.close();
109 }*/
110 }
111 }]);
112 }
113
114 // Show popup warning enable AI before using.
115 showPopupEnableAI() {
116 const modalTemplate = document.querySelector('#lp-tmpl-must-enable-ai');
117 if (!modalTemplate) {
118 console.error('Enable OpenAI Modal Template not found!');
119 return;
120 }
121 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().fire({
122 html: modalTemplate.innerHTML,
123 width: '420px',
124 showCloseButton: false,
125 showConfirmButton: false
126 });
127 }
128 showPopupCreateFullCourse() {
129 const modalTemplate = document.querySelector('#lp-tmpl-create-course-ai');
130 if (!modalTemplate) {
131 console.error('AI Create Full Course Modal Template not found!');
132 return;
133 }
134 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().fire({
135 html: modalTemplate.innerHTML,
136 width: '60%',
137 showCloseButton: false,
138 showConfirmButton: false,
139 allowOutsideClick: false,
140 allowEscapeKey: false,
141 didOpen: () => {
142 const popup = sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().getPopup();
143 popup.click();
144 const targetAudience = popup.querySelector('select[name="target_audience"]');
145 if (targetAudience && lp_course_ai_setting?.target_audience) {
146 targetAudience.tomselect.setValue(lp_course_ai_setting.target_audience);
147 }
148 const tone = popup.querySelector('select[name="tone"]');
149 if (tone && lp_course_ai_setting?.tone) {
150 tone.tomselect.setValue(lp_course_ai_setting.tone);
151 }
152 const language = popup.querySelector('select[name="language"]');
153 if (language && lp_course_ai_setting?.language) {
154 language.tomselect.setValue(lp_course_ai_setting.language);
155 }
156 targetAudience.addEventListener('change', event => {
157 lp_course_ai_setting.target_audience = targetAudience.tomselect.getValue();
158 localStorage.setItem('lp_course_ai_setting', JSON.stringify(lp_course_ai_setting));
159 });
160 tone.addEventListener('change', event => {
161 lp_course_ai_setting.tone = tone.tomselect.getValue();
162 localStorage.setItem('lp_course_ai_setting', JSON.stringify(lp_course_ai_setting));
163 });
164 language.addEventListener('change', event => {
165 const value = language.tomselect.getValue();
166 lp_course_ai_setting.language = value ? [value] : [];
167 localStorage.setItem('lp_course_ai_setting', JSON.stringify(lp_course_ai_setting));
168 });
169 }
170 }).then(result => {
171 if (result.isDismissed) {
172 if (lp_is_generating_course_data) {
173 lp_is_generating_course_data = false;
174 }
175 }
176 });
177 }
178 showStep(args) {
179 const {
180 e,
181 target
182 } = args;
183 e.preventDefault();
184 const elBtnActions = target.closest('.button-actions');
185 const elCreateCourseAIWrap = elBtnActions.closest(CreateCourseViaAI.selectors.elGenerateDataAiWrap);
186 let step = parseInt(elBtnActions.dataset.step);
187 const stepAction = target.dataset.action;
188 if (stepAction === 'next') {
189 step++;
190 } else if (stepAction === 'prev') {
191 step--;
192 }
193 elBtnActions.dataset.step = step;
194 const elForm = target.closest('form');
195 const elContentStep = elForm.querySelector(`.step-content[data-step="${step}"]`);
196 const elItemStep = elCreateCourseAIWrap.querySelector(`.step-item[data-step="${step}"]`);
197 elForm.querySelectorAll('.step-content').forEach(el => el.classList.remove('active'));
198 elContentStep.classList.add('active');
199 elCreateCourseAIWrap.querySelectorAll('.step-item').forEach(el => el.classList.remove('active'));
200 elItemStep.classList.add('active');
201
202 // Get all buttons step to show/hide
203 const form = target.closest('form');
204 const elBtnSteps = form.querySelectorAll('button[data-step-show]');
205 elBtnSteps.forEach(el => {
206 const stepsShow = el.dataset.stepShow.split(',').map(s => parseInt(s.trim()));
207 if (stepsShow.includes(step)) {
208 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(el, 1);
209 } else {
210 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(el, 0);
211 }
212 });
213 }
214
215 /**
216 * Create prompt from data config
217 * @param args
218 */
219 generatePrompt(args) {
220 const {
221 e,
222 target
223 } = args;
224 e.preventDefault();
225 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, true);
226
227 // Get dataSend
228 const form = target.closest('form');
229 let dataSend = JSON.parse(target.dataset.send);
230 dataSend = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.mergeDataWithDatForm(form, dataSend);
231
232 // Ajax to generate prompt
233 const callBack = {
234 success: response => {
235 const {
236 message,
237 status,
238 data
239 } = response;
240 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(message, status);
241 if (status === 'success') {
242 const elBtnNext = form.querySelector('.lp-btn-step[data-action=next]');
243 elBtnNext.click();
244 const elPromptTextarea = form.querySelector('textarea[name=lp-openai-prompt-generated-field]');
245 elPromptTextarea.value = data;
246 }
247 },
248 error: error => {
249 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(error, 'error');
250 },
251 completed: () => {
252 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, false);
253 }
254 };
255 window.lpAJAXG.fetchAJAX(dataSend, callBack);
256 }
257
258 /**
259 * Submit prompt to OpenAI to generate course data
260 * @param args
261 */
262 generateDataCourse(args) {
263 const {
264 e,
265 target
266 } = args;
267 e.preventDefault();
268 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, true);
269
270 // Get dataSend
271 const form = target.closest('form');
272 let dataSend = JSON.parse(target.dataset.send);
273 dataSend = lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.mergeDataWithDatForm(form, dataSend);
274 const btnPrev = form.querySelector('.lp-btn-step[data-action=prev]');
275 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(btnPrev, 0);
276
277 // Ajax to generate prompt
278 const callBack = {
279 success: response => {
280 const {
281 message,
282 status,
283 data
284 } = response;
285 if (lp_is_generating_course_data) {
286 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(message, status);
287 }
288 if (status === 'success') {
289 // Save structure data
290 lp_structure_course = data.lp_structure_course;
291
292 // Set preview HTML
293 const elResults = form.querySelector('.lp-ai-generated-results');
294 elResults.innerHTML = data.lp_html_preview;
295 const elBtnNext = form.querySelector('.lp-btn-step[data-action=next]');
296 elBtnNext.click();
297 }
298 },
299 error: error => {
300 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(error, 'error');
301 },
302 completed: () => {
303 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, false);
304 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(btnPrev, 1);
305 lp_is_generating_course_data = false;
306 }
307 };
308 lp_is_generating_course_data = true;
309 window.lpAJAXG.fetchAJAX(dataSend, callBack);
310 }
311
312 /**
313 * Create course with data of OpenAI
314 * @param args
315 */
316 createCourse(args) {
317 const {
318 e,
319 target
320 } = args;
321 e.preventDefault();
322 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, true);
323
324 // Get dataSend
325 const dataSend = JSON.parse(target.dataset.send);
326 dataSend.lp_structure_course = lp_structure_course;
327 if (this.options.isCourseBuilder) {
328 dataSend.is_course_builder = 1;
329 }
330 const form = target.closest('form');
331 const elBtnPrev = form.querySelector('.lp-btn-step[data-action=prev]');
332 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elBtnPrev, 0);
333 const windowWidth = window.outerWidth;
334 let alertWidth;
335 if (windowWidth < 768) {
336 alertWidth = '90%';
337 } else {
338 alertWidth = '30%';
339 }
340 const creatingCourseAiModal = document.querySelector('#lp-tmpl-creating-course-ai');
341 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().fire({
342 html: creatingCourseAiModal.innerHTML,
343 showCloseButton: false,
344 showConfirmButton: false,
345 allowOutsideClick: false,
346 width: alertWidth
347 });
348
349 // Ajax to generate prompt
350 const callBack = {
351 success: response => {
352 const {
353 message,
354 status,
355 data
356 } = response;
357 sweetalert2__WEBPACK_IMPORTED_MODULE_1___default().close();
358 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(message, status);
359 if (status === 'success') {
360 setTimeout(() => {
361 window.location.href = data.edit_course_url;
362 }, this.options.redirectDelayMs);
363 } else {
364 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elBtnPrev, 1);
365 }
366 },
367 error: error => {
368 lpAssetsJsPath_lpToastify_js__WEBPACK_IMPORTED_MODULE_2__.show(error, 'error');
369 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpShowHideEl(elBtnPrev, 1);
370 },
371 completed: () => {
372 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_0__.lpSetLoadingEl(target, false);
373 }
374 };
375 window.lpAJAXG.fetchAJAX(dataSend, callBack);
376 }
377 }
378
379 /***/ },
380
381 /***/ "./assets/src/js/admin/courses/view-students-modal.js"
382 /*!************************************************************!*\
383 !*** ./assets/src/js/admin/courses/view-students-modal.js ***!
384 \************************************************************/
385 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
386
387 "use strict";
388 __webpack_require__.r(__webpack_exports__);
389 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
390 /* harmony export */ ViewStudentsModal: () => (/* binding */ ViewStudentsModal)
391 /* harmony export */ });
392 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js");
393 /* harmony import */ var sweetalert2__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sweetalert2__WEBPACK_IMPORTED_MODULE_0__);
394 /* harmony import */ var lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lpAssetsJsPath/utils.js */ "./assets/src/js/utils.js");
395
396
397 class ViewStudentsModal {
398 constructor() {
399 this.isRequesting = false;
400 this.activeCourseId = 0;
401 this.init();
402 }
403 static selectors = {
404 wrap: '#lp-modal-enrolled-wrap',
405 form: '#lp-modal-enrolled-form',
406 toolbarTemplate: '#lp-tmpl-enrolled-students-toolbar-modal',
407 targetTemplate: '#lp-tmpl-enrolled-students-target-modal',
408 toolbar: '.lp-enrolled-students-table-toolbar--modal',
409 courseTrigger: '.lp-btn-view-students',
410 searchInput: '#lp-modal-enrolled-search-input',
411 startDateInput: '#lp-modal-enrolled-filter-start-date',
412 endDateInput: '#lp-modal-enrolled-filter-end-date',
413 searchBtn: '.lp-enrolled-btn-search-modal',
414 clearBtn: '.lp-enrolled-btn-clear-modal',
415 modalSearchFields: '#lp-modal-enrolled-search-input, #lp-modal-enrolled-filter-start-date, #lp-modal-enrolled-filter-end-date'
416 };
417 setButtonLoadingState(btn, isLoading) {
418 if (!btn) {
419 return;
420 }
421 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.lpSetLoadingEl(btn, isLoading ? 1 : 0);
422 }
423 init() {
424 if (ViewStudentsModal._loadedEvents) {
425 return;
426 }
427 ViewStudentsModal._loadedEvents = true;
428 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.eventHandlers('click', [{
429 selector: ViewStudentsModal.selectors.courseTrigger,
430 class: this,
431 callBack: this.handleOpenModal.name
432 }, {
433 selector: ViewStudentsModal.selectors.searchBtn,
434 class: this,
435 callBack: this.handleModalSearch.name
436 }, {
437 selector: ViewStudentsModal.selectors.clearBtn,
438 class: this,
439 callBack: this.handleModalClear.name
440 }]);
441 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.eventHandlers('keydown', [{
442 selector: ViewStudentsModal.selectors.modalSearchFields,
443 class: this,
444 callBack: this.handleModalSearchOnEnter.name,
445 checkIsEventEnter: true
446 }]);
447 lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.eventHandlers('change', [{
448 selector: ViewStudentsModal.selectors.startDateInput,
449 class: this,
450 callBack: this.checkDatesRange.name
451 }, {
452 selector: ViewStudentsModal.selectors.endDateInput,
453 class: this,
454 callBack: this.checkDatesRange.name
455 }]);
456 }
457 handleOpenModal(args) {
458 const btn = args?.target?.closest(ViewStudentsModal.selectors.courseTrigger);
459 if (!btn || this.isRequesting || btn.classList.contains('loading')) {
460 return;
461 }
462 const courseId = parseInt(btn.dataset.courseId, 10) || 0;
463 if (!courseId) {
464 return;
465 }
466 const courseTitle = btn.dataset.courseTitle || '';
467 this.activeCourseId = courseId;
468 this.setButtonLoadingState(btn, true);
469 this.openModal(courseId, courseTitle, btn);
470 }
471 handleModalSearch(args) {
472 const btn = args?.target?.closest(ViewStudentsModal.selectors.searchBtn);
473 if (!btn || !this.activeCourseId) {
474 return;
475 }
476 if (args?.e) {
477 args.e.preventDefault();
478 }
479 if (this.isRequesting || btn.classList.contains('loading') || btn.disabled) {
480 return;
481 }
482 this.setButtonLoadingState(btn, true);
483 this.loadEnrolledStudents(this.activeCourseId, 1, btn);
484 }
485 handleModalSearchOnEnter(args) {
486 if (args?.e) {
487 args.e.preventDefault();
488 }
489 const form = this.getModalForm();
490 if (!form) {
491 return;
492 }
493 const btn = form.querySelector(ViewStudentsModal.selectors.searchBtn);
494 if (!btn) {
495 return;
496 }
497 this.handleModalSearch({
498 ...args,
499 target: btn
500 });
501 }
502 handleModalClear(args) {
503 const btn = args?.target?.closest(ViewStudentsModal.selectors.clearBtn);
504 const form = this.getModalForm();
505 if (!btn || !form || !this.activeCourseId) {
506 return;
507 }
508 if (args?.e) {
509 args.e.preventDefault();
510 }
511 if (this.isRequesting || btn.classList.contains('loading')) {
512 return;
513 }
514 form.reset();
515 this.setButtonLoadingState(btn, true);
516 this.loadEnrolledStudents(this.activeCourseId, 1, btn);
517 }
518 getModalPopup() {
519 return (sweetalert2__WEBPACK_IMPORTED_MODULE_0___default().getPopup) ? sweetalert2__WEBPACK_IMPORTED_MODULE_0___default().getPopup() : null;
520 }
521 getModalToolbarHtml() {
522 const template = document.querySelector(ViewStudentsModal.selectors.toolbarTemplate);
523 return template ? template.innerHTML : '';
524 }
525 getModalTargetHtml() {
526 const template = document.querySelector(ViewStudentsModal.selectors.targetTemplate);
527 return template ? template.innerHTML : '';
528 }
529 getAjaxHandle() {
530 const ajaxHandle = window.lpAJAXG;
531 if (!ajaxHandle || typeof ajaxHandle.getDataSetCurrent !== 'function' || typeof ajaxHandle.setDataSetCurrent !== 'function' || typeof ajaxHandle.showHideLoading !== 'function' || typeof ajaxHandle.fetchAJAX !== 'function') {
532 return null;
533 }
534 return ajaxHandle;
535 }
536 getModalForm() {
537 const popup = this.getModalPopup();
538 if (!popup) {
539 return null;
540 }
541 return popup.querySelector(ViewStudentsModal.selectors.form);
542 }
543 getModalFilterArgs(dataArgs = {}) {
544 const form = this.getModalForm();
545 if (!form) {
546 return dataArgs;
547 }
548 return lpAssetsJsPath_utils_js__WEBPACK_IMPORTED_MODULE_1__.mergeDataWithDatForm(form, dataArgs);
549 }
550 loadEnrolledStudents(courseId, paged, elLoading = null) {
551 const wrap = document.querySelector(ViewStudentsModal.selectors.wrap);
552 const elTarget = wrap?.querySelector('.lp-target');
553 const ajaxHandle = this.getAjaxHandle();
554 if (!wrap || !elTarget || !ajaxHandle || this.isRequesting) {
555 return;
556 }
557 this.isRequesting = true;
558 if (elLoading) {
559 this.setButtonLoadingState(elLoading, true);
560 }
561 const dataSend = ajaxHandle.getDataSetCurrent(elTarget);
562 dataSend.args = this.getModalFilterArgs(dataSend.args || {});
563 dataSend.args.course_id = parseInt(courseId, 10) || 0;
564 dataSend.args.paged = paged;
565 ajaxHandle.setDataSetCurrent(elTarget, dataSend);
566 ajaxHandle.showHideLoading(elTarget, 1);
567 const callBack = {
568 success: response => {
569 elTarget.innerHTML = response.data.content;
570 },
571 error: err => {
572 console.error(err);
573 },
574 completed: () => {
575 this.isRequesting = false;
576 ajaxHandle.showHideLoading(elTarget, 0);
577 if (elLoading) {
578 this.setButtonLoadingState(elLoading, false);
579 }
580 }
581 };
582 ajaxHandle.fetchAJAX(dataSend, callBack);
583 }
584 openModal(courseId, courseTitle, elTrigger = null) {
585 const modalToolbarHtml = this.getModalToolbarHtml();
586 const modalTargetHtml = this.getModalTargetHtml();
587 if (!modalToolbarHtml || !modalTargetHtml) {
588 if (elTrigger) {
589 this.setButtonLoadingState(elTrigger, false);
590 }
591 return;
592 }
593 this.activeCourseId = parseInt(courseId, 10) || 0;
594 sweetalert2__WEBPACK_IMPORTED_MODULE_0___default().fire({
595 title: `${courseTitle}`,
596 html: modalToolbarHtml + modalTargetHtml,
597 width: '80%',
598 showConfirmButton: false,
599 showCloseButton: true,
600 didOpen: () => {
601 this.loadEnrolledStudents(this.activeCourseId, 1, elTrigger);
602 },
603 didClose: () => {
604 this.activeCourseId = 0;
605 if (elTrigger) {
606 this.setButtonLoadingState(elTrigger, false);
607 }
608 }
609 });
610 }
611
612 // Ensure start date is not after end date and vice versa. If invalid, adjust the other date to match.
613 checkDatesRange(args) {
614 const {
615 e
616 } = args;
617 const elInput = e?.target;
618 if (!elInput) {
619 return;
620 }
621 const elForm = elInput.closest(ViewStudentsModal.selectors.form);
622 if (!elForm) {
623 return;
624 }
625 const startDateInput = elForm.querySelector(ViewStudentsModal.selectors.startDateInput);
626 const endDateInput = elForm.querySelector(ViewStudentsModal.selectors.endDateInput);
627 if (elInput === startDateInput) {
628 if (startDateInput.value) {
629 endDateInput.min = startDateInput.value;
630 if (endDateInput.value && endDateInput.value < startDateInput.value) {
631 endDateInput.value = startDateInput.value;
632 }
633 } else {
634 endDateInput.min = '';
635 }
636 } else if (elInput === endDateInput) {
637 if (endDateInput.value) {
638 startDateInput.max = endDateInput.value;
639 if (startDateInput.value && startDateInput.value > endDateInput.value) {
640 startDateInput.value = endDateInput.value;
641 }
642 } else {
643 startDateInput.max = '';
644 }
645 }
646 }
647 }
648
649 /***/ },
650
651 /***/ "./assets/src/js/lpToastify.js"
652 /*!*************************************!*\
653 !*** ./assets/src/js/lpToastify.js ***!
654 \*************************************/
655 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
656
657 "use strict";
658 __webpack_require__.r(__webpack_exports__);
659 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
660 /* harmony export */ show: () => (/* binding */ show)
661 /* harmony export */ });
662 /* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! toastify-js */ "./node_modules/toastify-js/src/toastify.js");
663 /* harmony import */ var toastify_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(toastify_js__WEBPACK_IMPORTED_MODULE_0__);
664 /* harmony import */ var toastify_js_src_toastify_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! toastify-js/src/toastify.css */ "./node_modules/toastify-js/src/toastify.css");
665 /**
666 * Utils functions
667 *
668 * @param url
669 * @param data
670 * @param functions
671 * @since 4.3.0
672 * @version 1.0.0
673 */
674
675
676 const argsToastify = {
677 text: '',
678 gravity: lpData.toast.gravity,
679 // `top` or `bottom`
680 position: lpData.toast.position,
681 // `left`, `center` or `right`
682 className: `${lpData.toast.classPrefix}`,
683 close: lpData.toast.close == 1,
684 stopOnFocus: lpData.toast.stopOnFocus == 1,
685 duration: lpData.toast.duration
686 };
687 const show = (message, status = 'success', argsCustom) => {
688 let args = argsToastify;
689 if (argsCustom) {
690 args = {
691 ...args,
692 ...argsCustom
693 };
694 }
695 const toastify = new (toastify_js__WEBPACK_IMPORTED_MODULE_0___default())({
696 ...args,
697 text: message,
698 className: `${lpData.toast.classPrefix} ${status}`
699 });
700 toastify.showToast();
701 };
702
703 /***/ },
704
705 /***/ "./assets/src/js/utils.js"
706 /*!********************************!*\
707 !*** ./assets/src/js/utils.js ***!
708 \********************************/
709 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
710
711 "use strict";
712 __webpack_require__.r(__webpack_exports__);
713 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
714 /* harmony export */ debounce: () => (/* binding */ debounce),
715 /* harmony export */ eventHandlers: () => (/* binding */ eventHandlers),
716 /* harmony export */ fullScreenView: () => (/* binding */ fullScreenView),
717 /* harmony export */ getDataOfForm: () => (/* binding */ getDataOfForm),
718 /* harmony export */ getFieldKeysOfForm: () => (/* binding */ getFieldKeysOfForm),
719 /* harmony export */ listenElementCreated: () => (/* binding */ listenElementCreated),
720 /* harmony export */ listenElementViewed: () => (/* binding */ listenElementViewed),
721 /* harmony export */ lpAddQueryArgs: () => (/* binding */ lpAddQueryArgs),
722 /* harmony export */ lpAjaxParseJsonOld: () => (/* binding */ lpAjaxParseJsonOld),
723 /* harmony export */ lpClassName: () => (/* binding */ lpClassName),
724 /* harmony export */ lpFetchAPI: () => (/* binding */ lpFetchAPI),
725 /* harmony export */ lpGetCurrentURLNoParam: () => (/* binding */ lpGetCurrentURLNoParam),
726 /* harmony export */ lpOnElementReady: () => (/* binding */ lpOnElementReady),
727 /* harmony export */ lpSetLoadingEl: () => (/* binding */ lpSetLoadingEl),
728 /* harmony export */ lpShowHideEl: () => (/* binding */ lpShowHideEl),
729 /* harmony export */ mergeDataWithDatForm: () => (/* binding */ mergeDataWithDatForm),
730 /* harmony export */ toggleCollapse: () => (/* binding */ toggleCollapse),
731 /* harmony export */ toggleEnable: () => (/* binding */ toggleEnable)
732 /* harmony export */ });
733 /**
734 * Utils functions
735 *
736 * @param url
737 * @param data
738 * @param functions
739 * @since 4.2.5.1
740 * @version 1.0.7
741 */
742 const lpClassName = {
743 hidden: 'lp-hidden',
744 loading: 'loading',
745 elCollapse: 'lp-collapse',
746 elSectionToggle: '.lp-section-toggle',
747 elTriggerToggle: '.lp-trigger-toggle',
748 elBtnFullScreen: '.lp-btn-full-screen-view',
749 elFullScreen: 'lp-full-screen-view',
750 elBtnFullScreenClose: 'lp-full-screen-view__close'
751 };
752 const lpFetchAPI = (url, data = {}, functions = {}) => {
753 if ('function' === typeof functions.before) {
754 functions.before();
755 }
756 fetch(url, {
757 method: 'GET',
758 ...data
759 }).then(response => response.json()).then(response => {
760 if ('function' === typeof functions.success) {
761 functions.success(response);
762 }
763 }).catch(err => {
764 if ('function' === typeof functions.error) {
765 functions.error(err);
766 }
767 }).finally(() => {
768 if ('function' === typeof functions.completed) {
769 functions.completed();
770 }
771 });
772 };
773
774 /**
775 * Get current URL without params.
776 *
777 * @since 4.2.5.1
778 */
779 const lpGetCurrentURLNoParam = () => {
780 let currentUrl = window.location.href;
781 const hasParams = currentUrl.includes('?');
782 if (hasParams) {
783 currentUrl = currentUrl.split('?')[0];
784 }
785 return currentUrl;
786 };
787 const lpAddQueryArgs = (endpoint, args) => {
788 const url = new URL(endpoint);
789 Object.keys(args).forEach(arg => {
790 url.searchParams.set(arg, args[arg]);
791 });
792 return url;
793 };
794
795 /**
796 * Listen element viewed.
797 *
798 * @param el
799 * @param callback
800 * @since 4.2.5.8
801 */
802 const listenElementViewed = (el, callback) => {
803 const observerSeeItem = new IntersectionObserver(function (entries) {
804 for (const entry of entries) {
805 if (entry.isIntersecting) {
806 callback(entry);
807 }
808 }
809 });
810 observerSeeItem.observe(el);
811 };
812
813 /**
814 * Listen element created.
815 *
816 * @param callback
817 * @since 4.2.5.8
818 */
819 const listenElementCreated = callback => {
820 const observerCreateItem = new MutationObserver(function (mutations) {
821 mutations.forEach(function (mutation) {
822 if (mutation.addedNodes) {
823 mutation.addedNodes.forEach(function (node) {
824 if (node.nodeType === 1) {
825 callback(node);
826 }
827 });
828 }
829 });
830 });
831 observerCreateItem.observe(document, {
832 childList: true,
833 subtree: true
834 });
835 // End.
836 };
837
838 /**
839 * Listen element created.
840 *
841 * @param selector
842 * @param callback
843 * @since 4.2.7.1
844 */
845 const lpOnElementReady = (selector, callback) => {
846 const element = document.querySelector(selector);
847 if (element) {
848 callback(element);
849 return;
850 }
851 const observer = new MutationObserver((mutations, obs) => {
852 const element = document.querySelector(selector);
853 if (element) {
854 obs.disconnect();
855 callback(element);
856 }
857 });
858 observer.observe(document.documentElement, {
859 childList: true,
860 subtree: true
861 });
862 };
863
864 // Parse JSON from string with content include LP_AJAX_START.
865 const lpAjaxParseJsonOld = data => {
866 if (typeof data !== 'string') {
867 return data;
868 }
869 const m = String.raw({
870 raw: data
871 }).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s);
872 try {
873 if (m) {
874 data = JSON.parse(m[1].replace(/(?:\r\n|\r|\n)/g, ''));
875 } else {
876 data = JSON.parse(data);
877 }
878 } catch (e) {
879 data = {};
880 }
881 return data;
882 };
883
884 // status 0: hide, 1: show
885 const lpShowHideEl = (el, status = 0) => {
886 if (!el) {
887 return;
888 }
889 if (!status) {
890 el.classList.add(lpClassName.hidden);
891 } else {
892 el.classList.remove(lpClassName.hidden);
893 }
894 };
895
896 // status 0: hide, 1: show
897 const lpSetLoadingEl = (el, status) => {
898 if (!el) {
899 return;
900 }
901 if (!status) {
902 el.classList.remove(lpClassName.loading);
903 } else {
904 el.classList.add(lpClassName.loading);
905 }
906 };
907
908 // Toggle collapse section
909 const toggleCollapse = (e, target, elTriggerClassName = '', elsExclude = [], callback) => {
910 if (!elTriggerClassName) {
911 elTriggerClassName = lpClassName.elTriggerToggle;
912 }
913
914 // Exclude elements, which should not trigger the collapse toggle
915 if (elsExclude && elsExclude.length > 0) {
916 for (const elExclude of elsExclude) {
917 if (target.closest(elExclude)) {
918 return;
919 }
920 }
921 }
922 const elTrigger = target.closest(elTriggerClassName);
923 if (!elTrigger) {
924 return;
925 }
926
927 //console.log( 'elTrigger', elTrigger );
928
929 const elSectionToggle = elTrigger.closest(`${lpClassName.elSectionToggle}`);
930 if (!elSectionToggle) {
931 return;
932 }
933 elSectionToggle.classList.toggle(`${lpClassName.elCollapse}`);
934 if ('function' === typeof callback) {
935 callback(elSectionToggle);
936 }
937 };
938
939 // Get data of form
940 const getDataOfForm = form => {
941 const dataSend = {};
942 const formData = new FormData(form);
943 for (const pair of formData.entries()) {
944 const key = pair[0];
945 const value = formData.getAll(key);
946 if (!dataSend.hasOwnProperty(key)) {
947 // Convert value array to string.
948 dataSend[key] = value.join(',');
949 }
950 }
951 return dataSend;
952 };
953
954 // Get field keys of form
955 const getFieldKeysOfForm = form => {
956 const keys = [];
957 const elements = form.elements;
958 for (let i = 0; i < elements.length; i++) {
959 const name = elements[i].name;
960 if (name && !keys.includes(name)) {
961 keys.push(name);
962 }
963 }
964 return keys;
965 };
966
967 // Merge data handle with data form.
968 const mergeDataWithDatForm = (elForm, dataHandle) => {
969 const dataForm = getDataOfForm(elForm);
970 const keys = getFieldKeysOfForm(elForm);
971 keys.forEach(key => {
972 if (!dataForm.hasOwnProperty(key)) {
973 delete dataHandle[key];
974 } else if (dataForm[key][0] === '') {
975 delete dataForm[key];
976 delete dataHandle[key];
977 }
978 });
979 dataHandle = {
980 ...dataHandle,
981 ...dataForm
982 };
983 return dataHandle;
984 };
985
986 /**
987 * Event trigger
988 * For each list of event handlers, listen event on document.
989 *
990 * eventName: 'click', 'change', ...
991 * eventHandlers = [ { selector: '.lp-button', callBack: function(){}, class: object } ]
992 *
993 * @param eventName
994 * @param eventHandlers
995 */
996 const eventHandlers = (eventName, eventHandlers) => {
997 document.addEventListener(eventName, e => {
998 const target = e.target;
999 let args = {
1000 e,
1001 target
1002 };
1003 eventHandlers.forEach(eventHandler => {
1004 args = {
1005 ...args,
1006 ...eventHandler
1007 };
1008
1009 //console.log( args );
1010
1011 // Check condition before call back
1012 if (eventHandler.conditionBeforeCallBack) {
1013 if (eventHandler.conditionBeforeCallBack(args) !== true) {
1014 return;
1015 }
1016 }
1017
1018 // Special check for keydown event with checkIsEventEnter = true
1019 if (eventName === 'keydown' && eventHandler.checkIsEventEnter) {
1020 if (e.key !== 'Enter') {
1021 return;
1022 }
1023 }
1024 if (target.closest(eventHandler.selector)) {
1025 if (eventHandler.class) {
1026 // Call method of class, function callBack will understand exactly {this} is class object.
1027 eventHandler.class[eventHandler.callBack](args);
1028 } else {
1029 // For send args is objected, {this} is eventHandler object, not class object.
1030 eventHandler.callBack(args);
1031 }
1032 }
1033 });
1034 });
1035 };
1036
1037 /**
1038 * Debounce - delays function execution until after `wait` ms of inactivity.
1039 *
1040 * Each call resets the timer. Only the last call in a burst executes.
1041 *
1042 * USE CASES:
1043 * - Search inputs, form validation, window resize
1044 * - Multiple elements need independent timers
1045 * - When you need to call with different arguments
1046 *
1047 * EXAMPLES:
1048 * const debouncedSearch = debounce( (query) => fetchResults(query), 300 );
1049 * searchInput.addEventListener('input', (e) => debouncedSearch(e.target.value));
1050 *
1051 * const debouncedResize = debounce( recalculateLayout, 250 );
1052 * window.addEventListener('resize', debouncedResize);
1053 *
1054 * ⚠️ Create ONCE outside event handlers, not inside.
1055 *
1056 * @param {Function} func - Function to debounce (can be anonymous)
1057 * @param {number} wait - Milliseconds to wait (default: 500)
1058 * @return {Function} Debounced wrapper function
1059 * @since 4.3.7
1060 * @version 1.0.0
1061 */
1062 const debounce = (func, wait = 500) => {
1063 let timer;
1064 return args => {
1065 clearTimeout(timer);
1066 timer = setTimeout(() => func(args), wait);
1067 };
1068 };
1069
1070 /**
1071 * Initialize lp-toggle-enable components.
1072 *
1073 * Finds all `.lp-toggle-enable` elements and wires up toggle behavior.
1074 * Reads initial state from `data-enabled` attribute ("true"/"false").
1075 * Calls `data-on-toggle` callback (if provided via options) on state change.
1076 *
1077 * HTML structure:
1078 * <label class="lp-toggle-enable" data-enabled="true">
1079 * <input type="checkbox" class="lp-toggle-enable__input" />
1080 * <span class="lp-toggle-enable__track"></span>
1081 * </label>
1082 *
1083 * @param {string} selector CSS selector for toggle elements (default: '.lp-toggle-enable')
1084 * @param {Function} onToggle Optional callback( el, isEnabled ) called on state change
1085 * @since 4.4.5
1086 * @version 1.0.0
1087 */
1088 window.lpToggleEnableInit = 0;
1089 const toggleEnable = (onToggle = null) => {
1090 if (window.lpToggleEnableInit) {
1091 return;
1092 }
1093 window.lpToggleEnableInit = 1;
1094 const selector = '.lp-toggle-enable';
1095 const updateUI = (toggle, isEnabled) => {
1096 toggle.classList.toggle('is-enabled', isEnabled);
1097 const input = toggle.querySelector('.lp-toggle-enable__input');
1098 if (input) {
1099 input.checked = isEnabled;
1100 input.value = isEnabled ? '1' : '0';
1101 }
1102 };
1103
1104 // Delegate click handling via eventHandlers.
1105 eventHandlers('click', [{
1106 selector,
1107 callBack: args => {
1108 const {
1109 e,
1110 target
1111 } = args;
1112 const toggle = target.closest(selector);
1113 if (!toggle || toggle.classList.contains('is-disabled')) {
1114 return;
1115 }
1116 e.preventDefault();
1117 const isEnabled = !toggle.classList.contains('is-enabled');
1118 updateUI(toggle, isEnabled);
1119 if ('function' === typeof onToggle) {
1120 onToggle(toggle, isEnabled);
1121 }
1122 }
1123 }]);
1124 };
1125
1126 /**
1127 * Initialize custom fullscreen view buttons.
1128 *
1129 * Delegates clicks on `.lp-btn-full-screen-view` buttons to
1130 * `lpToggleFullscreenView`. Reads the `data-target` attribute to find the
1131 * target element. Falls back to the button's parent element when
1132 * `data-target` is not provided.
1133 *
1134 * @since 4.4.5
1135 * @version 1.0.0
1136 */
1137 window.lpFullScreenViewInit = 0;
1138 const fullScreenView = () => {
1139 if (window.lpFullScreenViewInit) {
1140 return;
1141 }
1142 window.lpFullScreenViewInit = 1;
1143 let lastScrollY = 0;
1144 const lpToggleFullscreenView = (elTarget, elBtnFullScreen = null) => {
1145 const isFullscreen = elTarget.classList.contains(lpClassName.elFullScreen);
1146 if (isFullscreen) {
1147 elTarget.classList.remove(lpClassName.elFullScreen);
1148 document.documentElement.classList.remove('lp-full-screen-active');
1149 window.scrollTo(0, lastScrollY);
1150 } else {
1151 lastScrollY = window.scrollY;
1152 elTarget.classList.add(lpClassName.elFullScreen);
1153 document.documentElement.classList.add('lp-full-screen-active');
1154 }
1155 if (!isFullscreen) {
1156 if (!elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`)) {
1157 const closeButton = document.createElement('button');
1158 closeButton.type = 'button';
1159 closeButton.className = lpClassName.elBtnFullScreenClose;
1160 closeButton.setAttribute('aria-label', 'Close');
1161 closeButton.innerHTML = lpData.i18n.closeButtonFullScreen || 'Close &times;';
1162 closeButton.addEventListener('click', e => {
1163 e.preventDefault();
1164 lpToggleFullscreenView(elTarget);
1165 });
1166 elTarget.appendChild(closeButton);
1167 }
1168 } else {
1169 const closeButton = elTarget.querySelector(`.${lpClassName.elBtnFullScreenClose}`);
1170 if (closeButton) {
1171 closeButton.remove();
1172 }
1173 }
1174 };
1175 eventHandlers('click', [{
1176 selector: lpClassName.elBtnFullScreen,
1177 callBack: args => {
1178 const {
1179 e,
1180 target
1181 } = args;
1182 const elBtnFullScreen = target.closest(lpClassName.elBtnFullScreen);
1183 if (!elBtnFullScreen) {
1184 console.log('No full screen button found');
1185 return;
1186 }
1187 e.preventDefault();
1188 let elTarget = null;
1189 const targetSelector = elBtnFullScreen.dataset.targetFullscreen;
1190 console.log(targetSelector);
1191 if (targetSelector) {
1192 elTarget = document.querySelector(targetSelector);
1193 }
1194 if (!elTarget) {
1195 console.log('No target element found');
1196 return;
1197 }
1198 lpToggleFullscreenView(elTarget, elBtnFullScreen);
1199 }
1200 }]);
1201 };
1202
1203 /***/ },
1204
1205 /***/ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css"
1206 /*!*****************************************************************************************!*\
1207 !*** ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css ***!
1208 \*****************************************************************************************/
1209 (module, __webpack_exports__, __webpack_require__) {
1210
1211 "use strict";
1212 __webpack_require__.r(__webpack_exports__);
1213 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1214 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1215 /* harmony export */ });
1216 /* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js");
1217 /* harmony import */ var _css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
1218 /* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js");
1219 /* harmony import */ var _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
1220 // Imports
1221
1222
1223 var ___CSS_LOADER_EXPORT___ = _css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
1224 // Module
1225 ___CSS_LOADER_EXPORT___.push([module.id, `/*!
1226 * Toastify js 1.12.0
1227 * https://github.com/apvarun/toastify-js
1228 * @license MIT licensed
1229 *
1230 * Copyright (C) 2018 Varun A P
1231 */
1232
1233 .toastify {
1234 padding: 12px 20px;
1235 color: #ffffff;
1236 display: inline-block;
1237 box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);
1238 background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);
1239 background: linear-gradient(135deg, #73a5ff, #5477f5);
1240 position: fixed;
1241 opacity: 0;
1242 transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
1243 border-radius: 2px;
1244 cursor: pointer;
1245 text-decoration: none;
1246 max-width: calc(50% - 20px);
1247 z-index: 2147483647;
1248 }
1249
1250 .toastify.on {
1251 opacity: 1;
1252 }
1253
1254 .toast-close {
1255 background: transparent;
1256 border: 0;
1257 color: white;
1258 cursor: pointer;
1259 font-family: inherit;
1260 font-size: 1em;
1261 opacity: 0.4;
1262 padding: 0 5px;
1263 }
1264
1265 .toastify-right {
1266 right: 15px;
1267 }
1268
1269 .toastify-left {
1270 left: 15px;
1271 }
1272
1273 .toastify-top {
1274 top: -150px;
1275 }
1276
1277 .toastify-bottom {
1278 bottom: -150px;
1279 }
1280
1281 .toastify-rounded {
1282 border-radius: 25px;
1283 }
1284
1285 .toastify-avatar {
1286 width: 1.5em;
1287 height: 1.5em;
1288 margin: -7px 5px;
1289 border-radius: 2px;
1290 }
1291
1292 .toastify-center {
1293 margin-left: auto;
1294 margin-right: auto;
1295 left: 0;
1296 right: 0;
1297 max-width: fit-content;
1298 max-width: -moz-fit-content;
1299 }
1300
1301 @media only screen and (max-width: 360px) {
1302 .toastify-right, .toastify-left {
1303 margin-left: auto;
1304 margin-right: auto;
1305 left: 0;
1306 right: 0;
1307 max-width: fit-content;
1308 }
1309 }
1310 `, "",{"version":3,"sources":["webpack://./node_modules/toastify-js/src/toastify.css"],"names":[],"mappings":"AAAA;;;;;;EAME;;AAEF;IACI,kBAAkB;IAClB,cAAc;IACd,qBAAqB;IACrB,uFAAuF;IACvF,6DAA6D;IAC7D,qDAAqD;IACrD,eAAe;IACf,UAAU;IACV,wDAAwD;IACxD,kBAAkB;IAClB,eAAe;IACf,qBAAqB;IACrB,2BAA2B;IAC3B,mBAAmB;AACvB;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,uBAAuB;IACvB,SAAS;IACT,YAAY;IACZ,eAAe;IACf,oBAAoB;IACpB,cAAc;IACd,YAAY;IACZ,cAAc;AAClB;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,UAAU;AACd;;AAEA;IACI,WAAW;AACf;;AAEA;IACI,cAAc;AAClB;;AAEA;IACI,mBAAmB;AACvB;;AAEA;IACI,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,kBAAkB;AACtB;;AAEA;IACI,iBAAiB;IACjB,kBAAkB;IAClB,OAAO;IACP,QAAQ;IACR,sBAAsB;IACtB,2BAA2B;AAC/B;;AAEA;IACI;QACI,iBAAiB;QACjB,kBAAkB;QAClB,OAAO;QACP,QAAQ;QACR,sBAAsB;IAC1B;AACJ","sourcesContent":["/*!\n * Toastify js 1.12.0\n * https://github.com/apvarun/toastify-js\n * @license MIT licensed\n *\n * Copyright (C) 2018 Varun A P\n */\n\n.toastify {\n padding: 12px 20px;\n color: #ffffff;\n display: inline-block;\n box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.12), 0 10px 36px -4px rgba(77, 96, 232, 0.3);\n background: -webkit-linear-gradient(315deg, #73a5ff, #5477f5);\n background: linear-gradient(135deg, #73a5ff, #5477f5);\n position: fixed;\n opacity: 0;\n transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);\n border-radius: 2px;\n cursor: pointer;\n text-decoration: none;\n max-width: calc(50% - 20px);\n z-index: 2147483647;\n}\n\n.toastify.on {\n opacity: 1;\n}\n\n.toast-close {\n background: transparent;\n border: 0;\n color: white;\n cursor: pointer;\n font-family: inherit;\n font-size: 1em;\n opacity: 0.4;\n padding: 0 5px;\n}\n\n.toastify-right {\n right: 15px;\n}\n\n.toastify-left {\n left: 15px;\n}\n\n.toastify-top {\n top: -150px;\n}\n\n.toastify-bottom {\n bottom: -150px;\n}\n\n.toastify-rounded {\n border-radius: 25px;\n}\n\n.toastify-avatar {\n width: 1.5em;\n height: 1.5em;\n margin: -7px 5px;\n border-radius: 2px;\n}\n\n.toastify-center {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n max-width: -moz-fit-content;\n}\n\n@media only screen and (max-width: 360px) {\n .toastify-right, .toastify-left {\n margin-left: auto;\n margin-right: auto;\n left: 0;\n right: 0;\n max-width: fit-content;\n }\n}\n"],"sourceRoot":""}]);
1311 // Exports
1312 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
1313
1314
1315 /***/ },
1316
1317 /***/ "./node_modules/css-loader/dist/runtime/api.js"
1318 /*!*****************************************************!*\
1319 !*** ./node_modules/css-loader/dist/runtime/api.js ***!
1320 \*****************************************************/
1321 (module) {
1322
1323 "use strict";
1324
1325
1326 /*
1327 MIT License http://www.opensource.org/licenses/mit-license.php
1328 Author Tobias Koppers @sokra
1329 */
1330 module.exports = function (cssWithMappingToString) {
1331 var list = [];
1332
1333 // return the list of modules as css string
1334 list.toString = function toString() {
1335 return this.map(function (item) {
1336 var content = "";
1337 var needLayer = typeof item[5] !== "undefined";
1338 if (item[4]) {
1339 content += "@supports (".concat(item[4], ") {");
1340 }
1341 if (item[2]) {
1342 content += "@media ".concat(item[2], " {");
1343 }
1344 if (needLayer) {
1345 content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
1346 }
1347 content += cssWithMappingToString(item);
1348 if (needLayer) {
1349 content += "}";
1350 }
1351 if (item[2]) {
1352 content += "}";
1353 }
1354 if (item[4]) {
1355 content += "}";
1356 }
1357 return content;
1358 }).join("");
1359 };
1360
1361 // import a list of modules into the list
1362 list.i = function i(modules, media, dedupe, supports, layer) {
1363 if (typeof modules === "string") {
1364 modules = [[null, modules, undefined]];
1365 }
1366 var alreadyImportedModules = {};
1367 if (dedupe) {
1368 for (var k = 0; k < this.length; k++) {
1369 var id = this[k][0];
1370 if (id != null) {
1371 alreadyImportedModules[id] = true;
1372 }
1373 }
1374 }
1375 for (var _k = 0; _k < modules.length; _k++) {
1376 var item = [].concat(modules[_k]);
1377 if (dedupe && alreadyImportedModules[item[0]]) {
1378 continue;
1379 }
1380 if (typeof layer !== "undefined") {
1381 if (typeof item[5] === "undefined") {
1382 item[5] = layer;
1383 } else {
1384 item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
1385 item[5] = layer;
1386 }
1387 }
1388 if (media) {
1389 if (!item[2]) {
1390 item[2] = media;
1391 } else {
1392 item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
1393 item[2] = media;
1394 }
1395 }
1396 if (supports) {
1397 if (!item[4]) {
1398 item[4] = "".concat(supports);
1399 } else {
1400 item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
1401 item[4] = supports;
1402 }
1403 }
1404 list.push(item);
1405 }
1406 };
1407 return list;
1408 };
1409
1410 /***/ },
1411
1412 /***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js"
1413 /*!************************************************************!*\
1414 !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***!
1415 \************************************************************/
1416 (module) {
1417
1418 "use strict";
1419
1420
1421 module.exports = function (item) {
1422 var content = item[1];
1423 var cssMapping = item[3];
1424 if (!cssMapping) {
1425 return content;
1426 }
1427 if (typeof btoa === "function") {
1428 var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
1429 var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
1430 var sourceMapping = "/*# ".concat(data, " */");
1431 return [content].concat([sourceMapping]).join("\n");
1432 }
1433 return [content].join("\n");
1434 };
1435
1436 /***/ },
1437
1438 /***/ "./node_modules/toastify-js/src/toastify.css"
1439 /*!***************************************************!*\
1440 !*** ./node_modules/toastify-js/src/toastify.css ***!
1441 \***************************************************/
1442 (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1443
1444 "use strict";
1445 __webpack_require__.r(__webpack_exports__);
1446 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
1447 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
1448 /* harmony export */ });
1449 /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! !../../style-loader/dist/runtime/injectStylesIntoStyleTag.js */ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js");
1450 /* harmony import */ var _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0__);
1451 /* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleDomAPI.js */ "./node_modules/style-loader/dist/runtime/styleDomAPI.js");
1452 /* harmony import */ var _style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1__);
1453 /* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertBySelector.js */ "./node_modules/style-loader/dist/runtime/insertBySelector.js");
1454 /* harmony import */ var _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2__);
1455 /* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! !../../style-loader/dist/runtime/setAttributesWithoutAttributes.js */ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js");
1456 /* harmony import */ var _style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3__);
1457 /* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! !../../style-loader/dist/runtime/insertStyleElement.js */ "./node_modules/style-loader/dist/runtime/insertStyleElement.js");
1458 /* harmony import */ var _style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4__);
1459 /* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! !../../style-loader/dist/runtime/styleTagTransform.js */ "./node_modules/style-loader/dist/runtime/styleTagTransform.js");
1460 /* harmony import */ var _style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5__);
1461 /* harmony import */ var _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! !!../../css-loader/dist/cjs.js!./toastify.css */ "./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css");
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473 var options = {};
1474
1475 options.styleTagTransform = (_style_loader_dist_runtime_styleTagTransform_js__WEBPACK_IMPORTED_MODULE_5___default());
1476 options.setAttributes = (_style_loader_dist_runtime_setAttributesWithoutAttributes_js__WEBPACK_IMPORTED_MODULE_3___default());
1477
1478 options.insert = _style_loader_dist_runtime_insertBySelector_js__WEBPACK_IMPORTED_MODULE_2___default().bind(null, "head");
1479
1480 options.domAPI = (_style_loader_dist_runtime_styleDomAPI_js__WEBPACK_IMPORTED_MODULE_1___default());
1481 options.insertStyleElement = (_style_loader_dist_runtime_insertStyleElement_js__WEBPACK_IMPORTED_MODULE_4___default());
1482
1483 var update = _style_loader_dist_runtime_injectStylesIntoStyleTag_js__WEBPACK_IMPORTED_MODULE_0___default()(_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"], options);
1484
1485
1486
1487
1488 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"] && _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals ? _css_loader_dist_cjs_js_toastify_css__WEBPACK_IMPORTED_MODULE_6__["default"].locals : undefined);
1489
1490
1491 /***/ },
1492
1493 /***/ "./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js"
1494 /*!****************************************************************************!*\
1495 !*** ./node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js ***!
1496 \****************************************************************************/
1497 (module) {
1498
1499 "use strict";
1500
1501
1502 var stylesInDOM = [];
1503 function getIndexByIdentifier(identifier) {
1504 var result = -1;
1505 for (var i = 0; i < stylesInDOM.length; i++) {
1506 if (stylesInDOM[i].identifier === identifier) {
1507 result = i;
1508 break;
1509 }
1510 }
1511 return result;
1512 }
1513 function modulesToDom(list, options) {
1514 var idCountMap = {};
1515 var identifiers = [];
1516 for (var i = 0; i < list.length; i++) {
1517 var item = list[i];
1518 var id = options.base ? item[0] + options.base : item[0];
1519 var count = idCountMap[id] || 0;
1520 var identifier = "".concat(id, " ").concat(count);
1521 idCountMap[id] = count + 1;
1522 var indexByIdentifier = getIndexByIdentifier(identifier);
1523 var obj = {
1524 css: item[1],
1525 media: item[2],
1526 sourceMap: item[3],
1527 supports: item[4],
1528 layer: item[5]
1529 };
1530 if (indexByIdentifier !== -1) {
1531 stylesInDOM[indexByIdentifier].references++;
1532 stylesInDOM[indexByIdentifier].updater(obj);
1533 } else {
1534 var updater = addElementStyle(obj, options);
1535 options.byIndex = i;
1536 stylesInDOM.splice(i, 0, {
1537 identifier: identifier,
1538 updater: updater,
1539 references: 1
1540 });
1541 }
1542 identifiers.push(identifier);
1543 }
1544 return identifiers;
1545 }
1546 function addElementStyle(obj, options) {
1547 var api = options.domAPI(options);
1548 api.update(obj);
1549 var updater = function updater(newObj) {
1550 if (newObj) {
1551 if (newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap && newObj.supports === obj.supports && newObj.layer === obj.layer) {
1552 return;
1553 }
1554 api.update(obj = newObj);
1555 } else {
1556 api.remove();
1557 }
1558 };
1559 return updater;
1560 }
1561 module.exports = function (list, options) {
1562 options = options || {};
1563 list = list || [];
1564 var lastIdentifiers = modulesToDom(list, options);
1565 return function update(newList) {
1566 newList = newList || [];
1567 for (var i = 0; i < lastIdentifiers.length; i++) {
1568 var identifier = lastIdentifiers[i];
1569 var index = getIndexByIdentifier(identifier);
1570 stylesInDOM[index].references--;
1571 }
1572 var newLastIdentifiers = modulesToDom(newList, options);
1573 for (var _i = 0; _i < lastIdentifiers.length; _i++) {
1574 var _identifier = lastIdentifiers[_i];
1575 var _index = getIndexByIdentifier(_identifier);
1576 if (stylesInDOM[_index].references === 0) {
1577 stylesInDOM[_index].updater();
1578 stylesInDOM.splice(_index, 1);
1579 }
1580 }
1581 lastIdentifiers = newLastIdentifiers;
1582 };
1583 };
1584
1585 /***/ },
1586
1587 /***/ "./node_modules/style-loader/dist/runtime/insertBySelector.js"
1588 /*!********************************************************************!*\
1589 !*** ./node_modules/style-loader/dist/runtime/insertBySelector.js ***!
1590 \********************************************************************/
1591 (module) {
1592
1593 "use strict";
1594
1595
1596 var memo = {};
1597
1598 /* istanbul ignore next */
1599 function getTarget(target) {
1600 if (typeof memo[target] === "undefined") {
1601 var styleTarget = document.querySelector(target);
1602
1603 // Special case to return head of iframe instead of iframe itself
1604 if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
1605 try {
1606 // This will throw an exception if access to iframe is blocked
1607 // due to cross-origin restrictions
1608 styleTarget = styleTarget.contentDocument.head;
1609 } catch (e) {
1610 // istanbul ignore next
1611 styleTarget = null;
1612 }
1613 }
1614 memo[target] = styleTarget;
1615 }
1616 return memo[target];
1617 }
1618
1619 /* istanbul ignore next */
1620 function insertBySelector(insert, style) {
1621 var target = getTarget(insert);
1622 if (!target) {
1623 throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");
1624 }
1625 target.appendChild(style);
1626 }
1627 module.exports = insertBySelector;
1628
1629 /***/ },
1630
1631 /***/ "./node_modules/style-loader/dist/runtime/insertStyleElement.js"
1632 /*!**********************************************************************!*\
1633 !*** ./node_modules/style-loader/dist/runtime/insertStyleElement.js ***!
1634 \**********************************************************************/
1635 (module) {
1636
1637 "use strict";
1638
1639
1640 /* istanbul ignore next */
1641 function insertStyleElement(options) {
1642 var element = document.createElement("style");
1643 options.setAttributes(element, options.attributes);
1644 options.insert(element, options.options);
1645 return element;
1646 }
1647 module.exports = insertStyleElement;
1648
1649 /***/ },
1650
1651 /***/ "./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js"
1652 /*!**********************************************************************************!*\
1653 !*** ./node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***!
1654 \**********************************************************************************/
1655 (module, __unused_webpack_exports, __webpack_require__) {
1656
1657 "use strict";
1658
1659
1660 /* istanbul ignore next */
1661 function setAttributesWithoutAttributes(styleElement) {
1662 var nonce = true ? __webpack_require__.nc : 0;
1663 if (nonce) {
1664 styleElement.setAttribute("nonce", nonce);
1665 }
1666 }
1667 module.exports = setAttributesWithoutAttributes;
1668
1669 /***/ },
1670
1671 /***/ "./node_modules/style-loader/dist/runtime/styleDomAPI.js"
1672 /*!***************************************************************!*\
1673 !*** ./node_modules/style-loader/dist/runtime/styleDomAPI.js ***!
1674 \***************************************************************/
1675 (module) {
1676
1677 "use strict";
1678
1679
1680 /* istanbul ignore next */
1681 function apply(styleElement, options, obj) {
1682 var css = "";
1683 if (obj.supports) {
1684 css += "@supports (".concat(obj.supports, ") {");
1685 }
1686 if (obj.media) {
1687 css += "@media ".concat(obj.media, " {");
1688 }
1689 var needLayer = typeof obj.layer !== "undefined";
1690 if (needLayer) {
1691 css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {");
1692 }
1693 css += obj.css;
1694 if (needLayer) {
1695 css += "}";
1696 }
1697 if (obj.media) {
1698 css += "}";
1699 }
1700 if (obj.supports) {
1701 css += "}";
1702 }
1703 var sourceMap = obj.sourceMap;
1704 if (sourceMap && typeof btoa !== "undefined") {
1705 css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */");
1706 }
1707
1708 // For old IE
1709 /* istanbul ignore if */
1710 options.styleTagTransform(css, styleElement, options.options);
1711 }
1712 function removeStyleElement(styleElement) {
1713 // istanbul ignore if
1714 if (styleElement.parentNode === null) {
1715 return false;
1716 }
1717 styleElement.parentNode.removeChild(styleElement);
1718 }
1719
1720 /* istanbul ignore next */
1721 function domAPI(options) {
1722 if (typeof document === "undefined") {
1723 return {
1724 update: function update() {},
1725 remove: function remove() {}
1726 };
1727 }
1728 var styleElement = options.insertStyleElement(options);
1729 return {
1730 update: function update(obj) {
1731 apply(styleElement, options, obj);
1732 },
1733 remove: function remove() {
1734 removeStyleElement(styleElement);
1735 }
1736 };
1737 }
1738 module.exports = domAPI;
1739
1740 /***/ },
1741
1742 /***/ "./node_modules/style-loader/dist/runtime/styleTagTransform.js"
1743 /*!*********************************************************************!*\
1744 !*** ./node_modules/style-loader/dist/runtime/styleTagTransform.js ***!
1745 \*********************************************************************/
1746 (module) {
1747
1748 "use strict";
1749
1750
1751 /* istanbul ignore next */
1752 function styleTagTransform(css, styleElement) {
1753 if (styleElement.styleSheet) {
1754 styleElement.styleSheet.cssText = css;
1755 } else {
1756 while (styleElement.firstChild) {
1757 styleElement.removeChild(styleElement.firstChild);
1758 }
1759 styleElement.appendChild(document.createTextNode(css));
1760 }
1761 }
1762 module.exports = styleTagTransform;
1763
1764 /***/ },
1765
1766 /***/ "./node_modules/sweetalert2/dist/sweetalert2.all.js"
1767 /*!**********************************************************!*\
1768 !*** ./node_modules/sweetalert2/dist/sweetalert2.all.js ***!
1769 \**********************************************************/
1770 (module) {
1771
1772 /*!
1773 * sweetalert2 v11.26.17
1774 * Released under the MIT License.
1775 */
1776 (function (global, factory) {
1777 true ? module.exports = factory() :
1778 0;
1779 })(this, (function () { 'use strict';
1780
1781 function _assertClassBrand(e, t, n) {
1782 if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
1783 throw new TypeError("Private element is not present on this object");
1784 }
1785 function _checkPrivateRedeclaration(e, t) {
1786 if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
1787 }
1788 function _classPrivateFieldGet2(s, a) {
1789 return s.get(_assertClassBrand(s, a));
1790 }
1791 function _classPrivateFieldInitSpec(e, t, a) {
1792 _checkPrivateRedeclaration(e, t), t.set(e, a);
1793 }
1794 function _classPrivateFieldSet2(s, a, r) {
1795 return s.set(_assertClassBrand(s, a), r), r;
1796 }
1797
1798 const RESTORE_FOCUS_TIMEOUT = 100;
1799
1800 /** @type {GlobalState} */
1801 const globalState = {};
1802 const focusPreviousActiveElement = () => {
1803 if (globalState.previousActiveElement instanceof HTMLElement) {
1804 globalState.previousActiveElement.focus();
1805 globalState.previousActiveElement = null;
1806 } else if (document.body) {
1807 document.body.focus();
1808 }
1809 };
1810
1811 /**
1812 * Restore previous active (focused) element
1813 *
1814 * @param {boolean} returnFocus
1815 * @returns {Promise<void>}
1816 */
1817 const restoreActiveElement = returnFocus => {
1818 return new Promise(resolve => {
1819 if (!returnFocus) {
1820 return resolve();
1821 }
1822 const x = window.scrollX;
1823 const y = window.scrollY;
1824 globalState.restoreFocusTimeout = setTimeout(() => {
1825 focusPreviousActiveElement();
1826 resolve();
1827 }, RESTORE_FOCUS_TIMEOUT); // issues/900
1828
1829 window.scrollTo(x, y);
1830 });
1831 };
1832
1833 const swalPrefix = 'swal2-';
1834
1835 /**
1836 * @typedef {Record<SwalClass, string>} SwalClasses
1837 */
1838
1839 /**
1840 * @typedef {'success' | 'warning' | 'info' | 'question' | 'error'} SwalIcon
1841 * @typedef {Record<SwalIcon, string>} SwalIcons
1842 */
1843
1844 /** @type {SwalClass[]} */
1845 const classNames = ['container', 'shown', 'height-auto', 'iosfix', 'popup', 'modal', 'no-backdrop', 'no-transition', 'toast', 'toast-shown', 'show', 'hide', 'close', 'title', 'html-container', 'actions', 'confirm', 'deny', 'cancel', 'footer', 'icon', 'icon-content', 'image', 'input', 'file', 'range', 'select', 'radio', 'checkbox', 'label', 'textarea', 'inputerror', 'input-label', 'validation-message', 'progress-steps', 'active-progress-step', 'progress-step', 'progress-step-line', 'loader', 'loading', 'styled', 'top', 'top-start', 'top-end', 'top-left', 'top-right', 'center', 'center-start', 'center-end', 'center-left', 'center-right', 'bottom', 'bottom-start', 'bottom-end', 'bottom-left', 'bottom-right', 'grow-row', 'grow-column', 'grow-fullscreen', 'rtl', 'timer-progress-bar', 'timer-progress-bar-container', 'scrollbar-measure', 'icon-success', 'icon-warning', 'icon-info', 'icon-question', 'icon-error', 'draggable', 'dragging'];
1846 const swalClasses = classNames.reduce((acc, className) => {
1847 acc[className] = swalPrefix + className;
1848 return acc;
1849 }, /** @type {SwalClasses} */{});
1850
1851 /** @type {SwalIcon[]} */
1852 const icons = ['success', 'warning', 'info', 'question', 'error'];
1853 const iconTypes = icons.reduce((acc, icon) => {
1854 acc[icon] = swalPrefix + icon;
1855 return acc;
1856 }, /** @type {SwalIcons} */{});
1857
1858 const consolePrefix = 'SweetAlert2:';
1859
1860 /**
1861 * Capitalize the first letter of a string
1862 *
1863 * @param {string} str
1864 * @returns {string}
1865 */
1866 const capitalizeFirstLetter = str => str.charAt(0).toUpperCase() + str.slice(1);
1867
1868 /**
1869 * Standardize console warnings
1870 *
1871 * @param {string | string[]} message
1872 */
1873 const warn = message => {
1874 console.warn(`${consolePrefix} ${typeof message === 'object' ? message.join(' ') : message}`);
1875 };
1876
1877 /**
1878 * Standardize console errors
1879 *
1880 * @param {string} message
1881 */
1882 const error = message => {
1883 console.error(`${consolePrefix} ${message}`);
1884 };
1885
1886 /**
1887 * Private global state for `warnOnce`
1888 *
1889 * @type {string[]}
1890 * @private
1891 */
1892 const previousWarnOnceMessages = [];
1893
1894 /**
1895 * Show a console warning, but only if it hasn't already been shown
1896 *
1897 * @param {string} message
1898 */
1899 const warnOnce = message => {
1900 if (!previousWarnOnceMessages.includes(message)) {
1901 previousWarnOnceMessages.push(message);
1902 warn(message);
1903 }
1904 };
1905
1906 /**
1907 * Show a one-time console warning about deprecated params/methods
1908 *
1909 * @param {string} deprecatedParam
1910 * @param {string?} useInstead
1911 */
1912 const warnAboutDeprecation = (deprecatedParam, useInstead = null) => {
1913 warnOnce(`"${deprecatedParam}" is deprecated and will be removed in the next major release.${useInstead ? ` Use "${useInstead}" instead.` : ''}`);
1914 };
1915
1916 /**
1917 * If `arg` is a function, call it (with no arguments or context) and return the result.
1918 * Otherwise, just pass the value through
1919 *
1920 * @param {(() => *) | *} arg
1921 * @returns {*}
1922 */
1923 const callIfFunction = arg => typeof arg === 'function' ? arg() : arg;
1924
1925 /**
1926 * @param {*} arg
1927 * @returns {boolean}
1928 */
1929 const hasToPromiseFn = arg => arg && typeof arg.toPromise === 'function';
1930
1931 /**
1932 * @param {*} arg
1933 * @returns {Promise<*>}
1934 */
1935 const asPromise = arg => hasToPromiseFn(arg) ? arg.toPromise() : Promise.resolve(arg);
1936
1937 /**
1938 * @param {*} arg
1939 * @returns {boolean}
1940 */
1941 const isPromise = arg => arg && Promise.resolve(arg) === arg;
1942
1943 /**
1944 * Gets the popup container which contains the backdrop and the popup itself.
1945 *
1946 * @returns {HTMLElement | null}
1947 */
1948 const getContainer = () => document.body.querySelector(`.${swalClasses.container}`);
1949
1950 /**
1951 * @param {string} selectorString
1952 * @returns {HTMLElement | null}
1953 */
1954 const elementBySelector = selectorString => {
1955 const container = getContainer();
1956 return container ? container.querySelector(selectorString) : null;
1957 };
1958
1959 /**
1960 * @param {string} className
1961 * @returns {HTMLElement | null}
1962 */
1963 const elementByClass = className => {
1964 return elementBySelector(`.${className}`);
1965 };
1966
1967 /**
1968 * @returns {HTMLElement | null}
1969 */
1970 const getPopup = () => elementByClass(swalClasses.popup);
1971
1972 /**
1973 * @returns {HTMLElement | null}
1974 */
1975 const getIcon = () => elementByClass(swalClasses.icon);
1976
1977 /**
1978 * @returns {HTMLElement | null}
1979 */
1980 const getIconContent = () => elementByClass(swalClasses['icon-content']);
1981
1982 /**
1983 * @returns {HTMLElement | null}
1984 */
1985 const getTitle = () => elementByClass(swalClasses.title);
1986
1987 /**
1988 * @returns {HTMLElement | null}
1989 */
1990 const getHtmlContainer = () => elementByClass(swalClasses['html-container']);
1991
1992 /**
1993 * @returns {HTMLElement | null}
1994 */
1995 const getImage = () => elementByClass(swalClasses.image);
1996
1997 /**
1998 * @returns {HTMLElement | null}
1999 */
2000 const getProgressSteps = () => elementByClass(swalClasses['progress-steps']);
2001
2002 /**
2003 * @returns {HTMLElement | null}
2004 */
2005 const getValidationMessage = () => elementByClass(swalClasses['validation-message']);
2006
2007 /**
2008 * @returns {HTMLButtonElement | null}
2009 */
2010 const getConfirmButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.confirm}`));
2011
2012 /**
2013 * @returns {HTMLButtonElement | null}
2014 */
2015 const getCancelButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.cancel}`));
2016
2017 /**
2018 * @returns {HTMLButtonElement | null}
2019 */
2020 const getDenyButton = () => (/** @type {HTMLButtonElement} */elementBySelector(`.${swalClasses.actions} .${swalClasses.deny}`));
2021
2022 /**
2023 * @returns {HTMLElement | null}
2024 */
2025 const getInputLabel = () => elementByClass(swalClasses['input-label']);
2026
2027 /**
2028 * @returns {HTMLElement | null}
2029 */
2030 const getLoader = () => elementBySelector(`.${swalClasses.loader}`);
2031
2032 /**
2033 * @returns {HTMLElement | null}
2034 */
2035 const getActions = () => elementByClass(swalClasses.actions);
2036
2037 /**
2038 * @returns {HTMLElement | null}
2039 */
2040 const getFooter = () => elementByClass(swalClasses.footer);
2041
2042 /**
2043 * @returns {HTMLElement | null}
2044 */
2045 const getTimerProgressBar = () => elementByClass(swalClasses['timer-progress-bar']);
2046
2047 /**
2048 * @returns {HTMLElement | null}
2049 */
2050 const getCloseButton = () => elementByClass(swalClasses.close);
2051
2052 // https://github.com/jkup/focusable/blob/master/index.js
2053 const focusable = `
2054 a[href],
2055 area[href],
2056 input:not([disabled]),
2057 select:not([disabled]),
2058 textarea:not([disabled]),
2059 button:not([disabled]),
2060 iframe,
2061 object,
2062 embed,
2063 [tabindex="0"],
2064 [contenteditable],
2065 audio[controls],
2066 video[controls],
2067 summary
2068 `;
2069 /**
2070 * @returns {HTMLElement[]}
2071 */
2072 const getFocusableElements = () => {
2073 const popup = getPopup();
2074 if (!popup) {
2075 return [];
2076 }
2077 /** @type {NodeListOf<HTMLElement>} */
2078 const focusableElementsWithTabindex = popup.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])');
2079 const focusableElementsWithTabindexSorted = Array.from(focusableElementsWithTabindex)
2080 // sort according to tabindex
2081 .sort((a, b) => {
2082 const tabindexA = parseInt(a.getAttribute('tabindex') || '0');
2083 const tabindexB = parseInt(b.getAttribute('tabindex') || '0');
2084 if (tabindexA > tabindexB) {
2085 return 1;
2086 } else if (tabindexA < tabindexB) {
2087 return -1;
2088 }
2089 return 0;
2090 });
2091
2092 /** @type {NodeListOf<HTMLElement>} */
2093 const otherFocusableElements = popup.querySelectorAll(focusable);
2094 const otherFocusableElementsFiltered = Array.from(otherFocusableElements).filter(el => el.getAttribute('tabindex') !== '-1');
2095 return [...new Set(focusableElementsWithTabindexSorted.concat(otherFocusableElementsFiltered))].filter(el => isVisible$1(el));
2096 };
2097
2098 /**
2099 * @returns {boolean}
2100 */
2101 const isModal = () => {
2102 return hasClass(document.body, swalClasses.shown) && !hasClass(document.body, swalClasses['toast-shown']) && !hasClass(document.body, swalClasses['no-backdrop']);
2103 };
2104
2105 /**
2106 * @returns {boolean}
2107 */
2108 const isToast = () => {
2109 const popup = getPopup();
2110 if (!popup) {
2111 return false;
2112 }
2113 return hasClass(popup, swalClasses.toast);
2114 };
2115
2116 /**
2117 * @returns {boolean}
2118 */
2119 const isLoading = () => {
2120 const popup = getPopup();
2121 if (!popup) {
2122 return false;
2123 }
2124 return popup.hasAttribute('data-loading');
2125 };
2126
2127 /**
2128 * Securely set innerHTML of an element
2129 * https://github.com/sweetalert2/sweetalert2/issues/1926
2130 *
2131 * @param {HTMLElement} elem
2132 * @param {string} html
2133 */
2134 const setInnerHtml = (elem, html) => {
2135 elem.textContent = '';
2136 if (html) {
2137 const parser = new DOMParser();
2138 const parsed = parser.parseFromString(html, `text/html`);
2139 const head = parsed.querySelector('head');
2140 if (head) {
2141 Array.from(head.childNodes).forEach(child => {
2142 elem.appendChild(child);
2143 });
2144 }
2145 const body = parsed.querySelector('body');
2146 if (body) {
2147 Array.from(body.childNodes).forEach(child => {
2148 if (child instanceof HTMLVideoElement || child instanceof HTMLAudioElement) {
2149 elem.appendChild(child.cloneNode(true)); // https://github.com/sweetalert2/sweetalert2/issues/2507
2150 } else {
2151 elem.appendChild(child);
2152 }
2153 });
2154 }
2155 }
2156 };
2157
2158 /**
2159 * @param {HTMLElement} elem
2160 * @param {string} className
2161 * @returns {boolean}
2162 */
2163 const hasClass = (elem, className) => {
2164 if (!className) {
2165 return false;
2166 }
2167 const classList = className.split(/\s+/);
2168 for (let i = 0; i < classList.length; i++) {
2169 if (!elem.classList.contains(classList[i])) {
2170 return false;
2171 }
2172 }
2173 return true;
2174 };
2175
2176 /**
2177 * @param {HTMLElement} elem
2178 * @param {SweetAlertOptions} params
2179 */
2180 const removeCustomClasses = (elem, params) => {
2181 Array.from(elem.classList).forEach(className => {
2182 if (!Object.values(swalClasses).includes(className) && !Object.values(iconTypes).includes(className) && !Object.values(params.showClass || {}).includes(className)) {
2183 elem.classList.remove(className);
2184 }
2185 });
2186 };
2187
2188 /**
2189 * @param {HTMLElement} elem
2190 * @param {SweetAlertOptions} params
2191 * @param {string} className
2192 */
2193 const applyCustomClass = (elem, params, className) => {
2194 removeCustomClasses(elem, params);
2195 if (!params.customClass) {
2196 return;
2197 }
2198 const customClass = params.customClass[(/** @type {keyof SweetAlertCustomClass} */className)];
2199 if (!customClass) {
2200 return;
2201 }
2202 if (typeof customClass !== 'string' && !customClass.forEach) {
2203 warn(`Invalid type of customClass.${className}! Expected string or iterable object, got "${typeof customClass}"`);
2204 return;
2205 }
2206 addClass(elem, customClass);
2207 };
2208
2209 /**
2210 * @param {HTMLElement} popup
2211 * @param {import('./renderers/renderInput').InputClass | SweetAlertInput} inputClass
2212 * @returns {HTMLInputElement | null}
2213 */
2214 const getInput$1 = (popup, inputClass) => {
2215 if (!inputClass) {
2216 return null;
2217 }
2218 switch (inputClass) {
2219 case 'select':
2220 case 'textarea':
2221 case 'file':
2222 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses[inputClass]}`);
2223 case 'checkbox':
2224 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.checkbox} input`);
2225 case 'radio':
2226 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:checked`) || popup.querySelector(`.${swalClasses.popup} > .${swalClasses.radio} input:first-child`);
2227 case 'range':
2228 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.range} input`);
2229 default:
2230 return popup.querySelector(`.${swalClasses.popup} > .${swalClasses.input}`);
2231 }
2232 };
2233
2234 /**
2235 * @param {HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement} input
2236 */
2237 const focusInput = input => {
2238 input.focus();
2239
2240 // place cursor at end of text in text input
2241 if (input.type !== 'file') {
2242 // http://stackoverflow.com/a/2345915
2243 const val = input.value;
2244 input.value = '';
2245 input.value = val;
2246 }
2247 };
2248
2249 /**
2250 * @param {HTMLElement | HTMLElement[] | null} target
2251 * @param {string | string[] | readonly string[] | undefined} classList
2252 * @param {boolean} condition
2253 */
2254 const toggleClass = (target, classList, condition) => {
2255 if (!target || !classList) {
2256 return;
2257 }
2258 if (typeof classList === 'string') {
2259 classList = classList.split(/\s+/).filter(Boolean);
2260 }
2261 classList.forEach(className => {
2262 if (Array.isArray(target)) {
2263 target.forEach(elem => {
2264 if (condition) {
2265 elem.classList.add(className);
2266 } else {
2267 elem.classList.remove(className);
2268 }
2269 });
2270 } else {
2271 if (condition) {
2272 target.classList.add(className);
2273 } else {
2274 target.classList.remove(className);
2275 }
2276 }
2277 });
2278 };
2279
2280 /**
2281 * @param {HTMLElement | HTMLElement[] | null} target
2282 * @param {string | string[] | readonly string[] | undefined} classList
2283 */
2284 const addClass = (target, classList) => {
2285 toggleClass(target, classList, true);
2286 };
2287
2288 /**
2289 * @param {HTMLElement | HTMLElement[] | null} target
2290 * @param {string | string[] | readonly string[] | undefined} classList
2291 */
2292 const removeClass = (target, classList) => {
2293 toggleClass(target, classList, false);
2294 };
2295
2296 /**
2297 * Get direct child of an element by class name
2298 *
2299 * @param {HTMLElement} elem
2300 * @param {string} className
2301 * @returns {HTMLElement | undefined}
2302 */
2303 const getDirectChildByClass = (elem, className) => {
2304 const children = Array.from(elem.children);
2305 for (let i = 0; i < children.length; i++) {
2306 const child = children[i];
2307 if (child instanceof HTMLElement && hasClass(child, className)) {
2308 return child;
2309 }
2310 }
2311 };
2312
2313 /**
2314 * @param {HTMLElement} elem
2315 * @param {string} property
2316 * @param {string | number | null | undefined} value
2317 */
2318 const applyNumericalStyle = (elem, property, value) => {
2319 if (value === `${parseInt(`${value}`)}`) {
2320 value = parseInt(value);
2321 }
2322 if (value || parseInt(`${value}`) === 0) {
2323 elem.style.setProperty(property, typeof value === 'number' ? `${value}px` : (/** @type {string} */value));
2324 } else {
2325 elem.style.removeProperty(property);
2326 }
2327 };
2328
2329 /**
2330 * @param {HTMLElement | null} elem
2331 * @param {string} display
2332 */
2333 const show = (elem, display = 'flex') => {
2334 if (!elem) {
2335 return;
2336 }
2337 elem.style.display = display;
2338 };
2339
2340 /**
2341 * @param {HTMLElement | null} elem
2342 */
2343 const hide = elem => {
2344 if (!elem) {
2345 return;
2346 }
2347 elem.style.display = 'none';
2348 };
2349
2350 /**
2351 * @param {HTMLElement | null} elem
2352 * @param {string} display
2353 */
2354 const showWhenInnerHtmlPresent = (elem, display = 'block') => {
2355 if (!elem) {
2356 return;
2357 }
2358 new MutationObserver(() => {
2359 toggle(elem, elem.innerHTML, display);
2360 }).observe(elem, {
2361 childList: true,
2362 subtree: true
2363 });
2364 };
2365
2366 /**
2367 * @param {HTMLElement} parent
2368 * @param {string} selector
2369 * @param {string} property
2370 * @param {string} value
2371 */
2372 const setStyle = (parent, selector, property, value) => {
2373 /** @type {HTMLElement | null} */
2374 const el = parent.querySelector(selector);
2375 if (el) {
2376 el.style.setProperty(property, value);
2377 }
2378 };
2379
2380 /**
2381 * @param {HTMLElement} elem
2382 * @param {boolean | string | null | undefined} condition
2383 * @param {string} display
2384 */
2385 const toggle = (elem, condition, display = 'flex') => {
2386 if (condition) {
2387 show(elem, display);
2388 } else {
2389 hide(elem);
2390 }
2391 };
2392
2393 /**
2394 * borrowed from jquery $(elem).is(':visible') implementation
2395 *
2396 * @param {HTMLElement | null} elem
2397 * @returns {boolean}
2398 */
2399 const isVisible$1 = elem => Boolean(elem && (elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length));
2400
2401 /**
2402 * @returns {boolean}
2403 */
2404 const allButtonsAreHidden = () => !isVisible$1(getConfirmButton()) && !isVisible$1(getDenyButton()) && !isVisible$1(getCancelButton());
2405
2406 /**
2407 * @param {HTMLElement} elem
2408 * @returns {boolean}
2409 */
2410 const isScrollable = elem => Boolean(elem.scrollHeight > elem.clientHeight);
2411
2412 /**
2413 * @param {HTMLElement} element
2414 * @param {HTMLElement} stopElement
2415 * @returns {boolean}
2416 */
2417 const selfOrParentIsScrollable = (element, stopElement) => {
2418 let parent = /** @type {HTMLElement | null} */element;
2419 while (parent && parent !== stopElement) {
2420 if (isScrollable(parent)) {
2421 return true;
2422 }
2423 parent = parent.parentElement;
2424 }
2425 return false;
2426 };
2427
2428 /**
2429 * borrowed from https://stackoverflow.com/a/46352119
2430 *
2431 * @param {HTMLElement} elem
2432 * @returns {boolean}
2433 */
2434 const hasCssAnimation = elem => {
2435 const style = window.getComputedStyle(elem);
2436 const animDuration = parseFloat(style.getPropertyValue('animation-duration') || '0');
2437 const transDuration = parseFloat(style.getPropertyValue('transition-duration') || '0');
2438 return animDuration > 0 || transDuration > 0;
2439 };
2440
2441 /**
2442 * @param {number} timer
2443 * @param {boolean} reset
2444 */
2445 const animateTimerProgressBar = (timer, reset = false) => {
2446 const timerProgressBar = getTimerProgressBar();
2447 if (!timerProgressBar) {
2448 return;
2449 }
2450 if (isVisible$1(timerProgressBar)) {
2451 if (reset) {
2452 timerProgressBar.style.transition = 'none';
2453 timerProgressBar.style.width = '100%';
2454 }
2455 setTimeout(() => {
2456 timerProgressBar.style.transition = `width ${timer / 1000}s linear`;
2457 timerProgressBar.style.width = '0%';
2458 }, 10);
2459 }
2460 };
2461 const stopTimerProgressBar = () => {
2462 const timerProgressBar = getTimerProgressBar();
2463 if (!timerProgressBar) {
2464 return;
2465 }
2466 const timerProgressBarWidth = parseInt(window.getComputedStyle(timerProgressBar).width);
2467 timerProgressBar.style.removeProperty('transition');
2468 timerProgressBar.style.width = '100%';
2469 const timerProgressBarFullWidth = parseInt(window.getComputedStyle(timerProgressBar).width);
2470 const timerProgressBarPercent = timerProgressBarWidth / timerProgressBarFullWidth * 100;
2471 timerProgressBar.style.width = `${timerProgressBarPercent}%`;
2472 };
2473
2474 /**
2475 * Detect Node env
2476 *
2477 * @returns {boolean}
2478 */
2479 const isNodeEnv = () => typeof window === 'undefined' || typeof document === 'undefined';
2480
2481 const sweetHTML = `
2482 <div aria-labelledby="${swalClasses.title}" aria-describedby="${swalClasses['html-container']}" class="${swalClasses.popup}" tabindex="-1">
2483 <button type="button" class="${swalClasses.close}"></button>
2484 <ul class="${swalClasses['progress-steps']}"></ul>
2485 <div class="${swalClasses.icon}"></div>
2486 <img class="${swalClasses.image}" />
2487 <h2 class="${swalClasses.title}" id="${swalClasses.title}"></h2>
2488 <div class="${swalClasses['html-container']}" id="${swalClasses['html-container']}"></div>
2489 <input class="${swalClasses.input}" id="${swalClasses.input}" />
2490 <input type="file" class="${swalClasses.file}" />
2491 <div class="${swalClasses.range}">
2492 <input type="range" />
2493 <output></output>
2494 </div>
2495 <select class="${swalClasses.select}" id="${swalClasses.select}"></select>
2496 <div class="${swalClasses.radio}"></div>
2497 <label class="${swalClasses.checkbox}">
2498 <input type="checkbox" id="${swalClasses.checkbox}" />
2499 <span class="${swalClasses.label}"></span>
2500 </label>
2501 <textarea class="${swalClasses.textarea}" id="${swalClasses.textarea}"></textarea>
2502 <div class="${swalClasses['validation-message']}" id="${swalClasses['validation-message']}"></div>
2503 <div class="${swalClasses.actions}">
2504 <div class="${swalClasses.loader}"></div>
2505 <button type="button" class="${swalClasses.confirm}"></button>
2506 <button type="button" class="${swalClasses.deny}"></button>
2507 <button type="button" class="${swalClasses.cancel}"></button>
2508 </div>
2509 <div class="${swalClasses.footer}"></div>
2510 <div class="${swalClasses['timer-progress-bar-container']}">
2511 <div class="${swalClasses['timer-progress-bar']}"></div>
2512 </div>
2513 </div>
2514 `.replace(/(^|\n)\s*/g, '');
2515
2516 /**
2517 * @returns {boolean}
2518 */
2519 const resetOldContainer = () => {
2520 const oldContainer = getContainer();
2521 if (!oldContainer) {
2522 return false;
2523 }
2524 oldContainer.remove();
2525 removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'],
2526 // @ts-ignore: 'has-column' is not defined in swalClasses but may be set dynamically
2527 swalClasses['has-column']]);
2528 return true;
2529 };
2530 const resetValidationMessage$1 = () => {
2531 if (globalState.currentInstance) {
2532 globalState.currentInstance.resetValidationMessage();
2533 }
2534 };
2535 const addInputChangeListeners = () => {
2536 const popup = getPopup();
2537 if (!popup) {
2538 return;
2539 }
2540 const input = getDirectChildByClass(popup, swalClasses.input);
2541 const file = getDirectChildByClass(popup, swalClasses.file);
2542 /** @type {HTMLInputElement | null} */
2543 const range = popup.querySelector(`.${swalClasses.range} input`);
2544 /** @type {HTMLOutputElement | null} */
2545 const rangeOutput = popup.querySelector(`.${swalClasses.range} output`);
2546 const select = getDirectChildByClass(popup, swalClasses.select);
2547 /** @type {HTMLInputElement | null} */
2548 const checkbox = popup.querySelector(`.${swalClasses.checkbox} input`);
2549 const textarea = getDirectChildByClass(popup, swalClasses.textarea);
2550 if (input) {
2551 input.oninput = resetValidationMessage$1;
2552 }
2553 if (file) {
2554 file.onchange = resetValidationMessage$1;
2555 }
2556 if (select) {
2557 select.onchange = resetValidationMessage$1;
2558 }
2559 if (checkbox) {
2560 checkbox.onchange = resetValidationMessage$1;
2561 }
2562 if (textarea) {
2563 textarea.oninput = resetValidationMessage$1;
2564 }
2565 if (range && rangeOutput) {
2566 range.oninput = () => {
2567 resetValidationMessage$1();
2568 rangeOutput.value = range.value;
2569 };
2570 range.onchange = () => {
2571 resetValidationMessage$1();
2572 rangeOutput.value = range.value;
2573 };
2574 }
2575 };
2576
2577 /**
2578 * @param {string | HTMLElement} target
2579 * @returns {HTMLElement}
2580 */
2581 const getTarget = target => {
2582 if (typeof target === 'string') {
2583 const element = document.querySelector(target);
2584 if (!element) {
2585 throw new Error(`Target element "${target}" not found`);
2586 }
2587 return /** @type {HTMLElement} */element;
2588 }
2589 return target;
2590 };
2591
2592 /**
2593 * @param {SweetAlertOptions} params
2594 */
2595 const setupAccessibility = params => {
2596 const popup = getPopup();
2597 if (!popup) {
2598 return;
2599 }
2600 popup.setAttribute('role', params.toast ? 'alert' : 'dialog');
2601 popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive');
2602 if (!params.toast) {
2603 popup.setAttribute('aria-modal', 'true');
2604 }
2605 };
2606
2607 /**
2608 * @param {HTMLElement} targetElement
2609 */
2610 const setupRTL = targetElement => {
2611 if (window.getComputedStyle(targetElement).direction === 'rtl') {
2612 addClass(getContainer(), swalClasses.rtl);
2613 globalState.isRTL = true;
2614 }
2615 };
2616
2617 /**
2618 * Add modal + backdrop to DOM
2619 *
2620 * @param {SweetAlertOptions} params
2621 */
2622 const init = params => {
2623 // Clean up the old popup container if it exists
2624 const oldContainerExisted = resetOldContainer();
2625 if (isNodeEnv()) {
2626 error('SweetAlert2 requires document to initialize');
2627 return;
2628 }
2629 const container = document.createElement('div');
2630 container.className = swalClasses.container;
2631 if (oldContainerExisted) {
2632 addClass(container, swalClasses['no-transition']);
2633 }
2634 setInnerHtml(container, sweetHTML);
2635 container.dataset['swal2Theme'] = params.theme;
2636 const targetElement = getTarget(params.target || 'body');
2637 targetElement.appendChild(container);
2638 if (params.topLayer) {
2639 container.setAttribute('popover', '');
2640 container.showPopover();
2641 }
2642 setupAccessibility(params);
2643 setupRTL(targetElement);
2644 addInputChangeListeners();
2645 };
2646
2647 /**
2648 * @param {HTMLElement | object | string} param
2649 * @param {HTMLElement} target
2650 */
2651 const parseHtmlToContainer = (param, target) => {
2652 // DOM element
2653 if (param instanceof HTMLElement) {
2654 target.appendChild(param);
2655 }
2656
2657 // Object
2658 else if (typeof param === 'object') {
2659 handleObject(param, target);
2660 }
2661
2662 // Plain string
2663 else if (param) {
2664 setInnerHtml(target, param);
2665 }
2666 };
2667
2668 /**
2669 * @param {object} param
2670 * @param {HTMLElement} target
2671 */
2672 const handleObject = (param, target) => {
2673 // JQuery element(s)
2674 if ('jquery' in param) {
2675 handleJqueryElem(target, param);
2676 }
2677
2678 // For other objects use their string representation
2679 else {
2680 setInnerHtml(target, param.toString());
2681 }
2682 };
2683
2684 /**
2685 * @param {HTMLElement} target
2686 * @param {any} elem
2687 */
2688 const handleJqueryElem = (target, elem) => {
2689 target.textContent = '';
2690 if (0 in elem) {
2691 for (let i = 0; i in elem; i++) {
2692 target.appendChild(elem[i].cloneNode(true));
2693 }
2694 } else {
2695 target.appendChild(elem.cloneNode(true));
2696 }
2697 };
2698
2699 /**
2700 * @param {SweetAlert} instance
2701 * @param {SweetAlertOptions} params
2702 */
2703 const renderActions = (instance, params) => {
2704 const actions = getActions();
2705 const loader = getLoader();
2706 if (!actions || !loader) {
2707 return;
2708 }
2709
2710 // Actions (buttons) wrapper
2711 if (!params.showConfirmButton && !params.showDenyButton && !params.showCancelButton) {
2712 hide(actions);
2713 } else {
2714 show(actions);
2715 }
2716
2717 // Custom class
2718 applyCustomClass(actions, params, 'actions');
2719
2720 // Render all the buttons
2721 renderButtons(actions, loader, params);
2722
2723 // Loader
2724 setInnerHtml(loader, params.loaderHtml || '');
2725 applyCustomClass(loader, params, 'loader');
2726 };
2727
2728 /**
2729 * @param {HTMLElement} actions
2730 * @param {HTMLElement} loader
2731 * @param {SweetAlertOptions} params
2732 */
2733 function renderButtons(actions, loader, params) {
2734 const confirmButton = getConfirmButton();
2735 const denyButton = getDenyButton();
2736 const cancelButton = getCancelButton();
2737 if (!confirmButton || !denyButton || !cancelButton) {
2738 return;
2739 }
2740
2741 // Render buttons
2742 renderButton(confirmButton, 'confirm', params);
2743 renderButton(denyButton, 'deny', params);
2744 renderButton(cancelButton, 'cancel', params);
2745 handleButtonsStyling(confirmButton, denyButton, cancelButton, params);
2746 if (params.reverseButtons) {
2747 if (params.toast) {
2748 actions.insertBefore(cancelButton, confirmButton);
2749 actions.insertBefore(denyButton, confirmButton);
2750 } else {
2751 actions.insertBefore(cancelButton, loader);
2752 actions.insertBefore(denyButton, loader);
2753 actions.insertBefore(confirmButton, loader);
2754 }
2755 }
2756 }
2757
2758 /**
2759 * @param {HTMLElement} confirmButton
2760 * @param {HTMLElement} denyButton
2761 * @param {HTMLElement} cancelButton
2762 * @param {SweetAlertOptions} params
2763 */
2764 function handleButtonsStyling(confirmButton, denyButton, cancelButton, params) {
2765 if (!params.buttonsStyling) {
2766 removeClass([confirmButton, denyButton, cancelButton], swalClasses.styled);
2767 return;
2768 }
2769 addClass([confirmButton, denyButton, cancelButton], swalClasses.styled);
2770
2771 // Apply custom background colors to action buttons
2772 if (params.confirmButtonColor) {
2773 confirmButton.style.setProperty('--swal2-confirm-button-background-color', params.confirmButtonColor);
2774 }
2775 if (params.denyButtonColor) {
2776 denyButton.style.setProperty('--swal2-deny-button-background-color', params.denyButtonColor);
2777 }
2778 if (params.cancelButtonColor) {
2779 cancelButton.style.setProperty('--swal2-cancel-button-background-color', params.cancelButtonColor);
2780 }
2781
2782 // Apply the outline color to action buttons
2783 applyOutlineColor(confirmButton);
2784 applyOutlineColor(denyButton);
2785 applyOutlineColor(cancelButton);
2786 }
2787
2788 /**
2789 * @param {HTMLElement} button
2790 */
2791 function applyOutlineColor(button) {
2792 const buttonStyle = window.getComputedStyle(button);
2793 if (buttonStyle.getPropertyValue('--swal2-action-button-focus-box-shadow')) {
2794 // If the button already has a custom outline color, no need to change it
2795 return;
2796 }
2797 const outlineColor = buttonStyle.backgroundColor.replace(/rgba?\((\d+), (\d+), (\d+).*/, 'rgba($1, $2, $3, 0.5)');
2798 button.style.setProperty('--swal2-action-button-focus-box-shadow', buttonStyle.getPropertyValue('--swal2-outline').replace(/ rgba\(.*/, ` ${outlineColor}`));
2799 }
2800
2801 /**
2802 * @param {HTMLElement} button
2803 * @param {'confirm' | 'deny' | 'cancel'} buttonType
2804 * @param {SweetAlertOptions} params
2805 */
2806 function renderButton(button, buttonType, params) {
2807 const buttonName = /** @type {'Confirm' | 'Deny' | 'Cancel'} */capitalizeFirstLetter(buttonType);
2808 toggle(button, params[`show${buttonName}Button`], 'inline-block');
2809 setInnerHtml(button, params[`${buttonType}ButtonText`] || ''); // Set caption text
2810 button.setAttribute('aria-label', params[`${buttonType}ButtonAriaLabel`] || ''); // ARIA label
2811
2812 // Add buttons custom classes
2813 button.className = swalClasses[buttonType];
2814 applyCustomClass(button, params, `${buttonType}Button`);
2815 }
2816
2817 /**
2818 * @param {SweetAlert} instance
2819 * @param {SweetAlertOptions} params
2820 */
2821 const renderCloseButton = (instance, params) => {
2822 const closeButton = getCloseButton();
2823 if (!closeButton) {
2824 return;
2825 }
2826 setInnerHtml(closeButton, params.closeButtonHtml || '');
2827
2828 // Custom class
2829 applyCustomClass(closeButton, params, 'closeButton');
2830 toggle(closeButton, params.showCloseButton);
2831 closeButton.setAttribute('aria-label', params.closeButtonAriaLabel || '');
2832 };
2833
2834 /**
2835 * @param {SweetAlert} instance
2836 * @param {SweetAlertOptions} params
2837 */
2838 const renderContainer = (instance, params) => {
2839 const container = getContainer();
2840 if (!container) {
2841 return;
2842 }
2843 handleBackdropParam(container, params.backdrop);
2844 handlePositionParam(container, params.position);
2845 handleGrowParam(container, params.grow);
2846
2847 // Custom class
2848 applyCustomClass(container, params, 'container');
2849 };
2850
2851 /**
2852 * @param {HTMLElement} container
2853 * @param {SweetAlertOptions['backdrop']} backdrop
2854 */
2855 function handleBackdropParam(container, backdrop) {
2856 if (typeof backdrop === 'string') {
2857 container.style.background = backdrop;
2858 } else if (!backdrop) {
2859 addClass([document.documentElement, document.body], swalClasses['no-backdrop']);
2860 }
2861 }
2862
2863 /**
2864 * @param {HTMLElement} container
2865 * @param {SweetAlertOptions['position']} position
2866 */
2867 function handlePositionParam(container, position) {
2868 if (!position) {
2869 return;
2870 }
2871 if (position in swalClasses) {
2872 addClass(container, swalClasses[position]);
2873 } else {
2874 warn('The "position" parameter is not valid, defaulting to "center"');
2875 addClass(container, swalClasses.center);
2876 }
2877 }
2878
2879 /**
2880 * @param {HTMLElement} container
2881 * @param {SweetAlertOptions['grow']} grow
2882 */
2883 function handleGrowParam(container, grow) {
2884 if (!grow) {
2885 return;
2886 }
2887 addClass(container, swalClasses[`grow-${grow}`]);
2888 }
2889
2890 /**
2891 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
2892 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
2893 * This is the approach that Babel will probably take to implement private methods/fields
2894 * https://github.com/tc39/proposal-private-methods
2895 * https://github.com/babel/babel/pull/7555
2896 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
2897 * then we can use that language feature.
2898 */
2899
2900 var privateProps = {
2901 innerParams: new WeakMap(),
2902 domCache: new WeakMap()
2903 };
2904
2905 /// <reference path="../../../../sweetalert2.d.ts"/>
2906
2907
2908 /** @type {InputClass[]} */
2909 const inputClasses = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea'];
2910
2911 /**
2912 * @param {SweetAlert} instance
2913 * @param {SweetAlertOptions} params
2914 */
2915 const renderInput = (instance, params) => {
2916 const popup = getPopup();
2917 if (!popup) {
2918 return;
2919 }
2920 const innerParams = privateProps.innerParams.get(instance);
2921 const rerender = !innerParams || params.input !== innerParams.input;
2922 inputClasses.forEach(inputClass => {
2923 const inputContainer = getDirectChildByClass(popup, swalClasses[inputClass]);
2924 if (!inputContainer) {
2925 return;
2926 }
2927
2928 // set attributes
2929 setAttributes(inputClass, params.inputAttributes);
2930
2931 // set class
2932 inputContainer.className = swalClasses[inputClass];
2933 if (rerender) {
2934 hide(inputContainer);
2935 }
2936 });
2937 if (params.input) {
2938 if (rerender) {
2939 showInput(params);
2940 }
2941 // set custom class
2942 setCustomClass(params);
2943 }
2944 };
2945
2946 /**
2947 * @param {SweetAlertOptions} params
2948 */
2949 const showInput = params => {
2950 if (!params.input) {
2951 return;
2952 }
2953 if (!renderInputType[params.input]) {
2954 error(`Unexpected type of input! Expected ${Object.keys(renderInputType).join(' | ')}, got "${params.input}"`);
2955 return;
2956 }
2957 const inputContainer = getInputContainer(params.input);
2958 if (!inputContainer) {
2959 return;
2960 }
2961 const input = renderInputType[params.input](inputContainer, params);
2962 show(inputContainer);
2963
2964 // input autofocus
2965 if (params.inputAutoFocus) {
2966 setTimeout(() => {
2967 focusInput(input);
2968 });
2969 }
2970 };
2971
2972 /**
2973 * @param {HTMLInputElement} input
2974 */
2975 const removeAttributes = input => {
2976 for (let i = 0; i < input.attributes.length; i++) {
2977 const attrName = input.attributes[i].name;
2978 if (!['id', 'type', 'value', 'style'].includes(attrName)) {
2979 input.removeAttribute(attrName);
2980 }
2981 }
2982 };
2983
2984 /**
2985 * @param {InputClass} inputClass
2986 * @param {SweetAlertOptions['inputAttributes']} inputAttributes
2987 */
2988 const setAttributes = (inputClass, inputAttributes) => {
2989 const popup = getPopup();
2990 if (!popup) {
2991 return;
2992 }
2993 const input = getInput$1(popup, inputClass);
2994 if (!input) {
2995 return;
2996 }
2997 removeAttributes(input);
2998 for (const attr in inputAttributes) {
2999 input.setAttribute(attr, inputAttributes[attr]);
3000 }
3001 };
3002
3003 /**
3004 * @param {SweetAlertOptions} params
3005 */
3006 const setCustomClass = params => {
3007 if (!params.input) {
3008 return;
3009 }
3010 const inputContainer = getInputContainer(params.input);
3011 if (inputContainer) {
3012 applyCustomClass(inputContainer, params, 'input');
3013 }
3014 };
3015
3016 /**
3017 * @param {HTMLInputElement | HTMLTextAreaElement} input
3018 * @param {SweetAlertOptions} params
3019 */
3020 const setInputPlaceholder = (input, params) => {
3021 if (!input.placeholder && params.inputPlaceholder) {
3022 input.placeholder = params.inputPlaceholder;
3023 }
3024 };
3025
3026 /**
3027 * @param {Input} input
3028 * @param {Input} prependTo
3029 * @param {SweetAlertOptions} params
3030 */
3031 const setInputLabel = (input, prependTo, params) => {
3032 if (params.inputLabel) {
3033 const label = document.createElement('label');
3034 const labelClass = swalClasses['input-label'];
3035 label.setAttribute('for', input.id);
3036 label.className = labelClass;
3037 if (typeof params.customClass === 'object') {
3038 addClass(label, params.customClass.inputLabel);
3039 }
3040 label.innerText = params.inputLabel;
3041 prependTo.insertAdjacentElement('beforebegin', label);
3042 }
3043 };
3044
3045 /**
3046 * @param {SweetAlertInput} inputType
3047 * @returns {HTMLElement | undefined}
3048 */
3049 const getInputContainer = inputType => {
3050 const popup = getPopup();
3051 if (!popup) {
3052 return;
3053 }
3054 return getDirectChildByClass(popup, swalClasses[(/** @type {SwalClass} */inputType)] || swalClasses.input);
3055 };
3056
3057 /**
3058 * @param {HTMLInputElement | HTMLOutputElement | HTMLTextAreaElement} input
3059 * @param {SweetAlertOptions['inputValue']} inputValue
3060 */
3061 const checkAndSetInputValue = (input, inputValue) => {
3062 if (['string', 'number'].includes(typeof inputValue)) {
3063 input.value = `${inputValue}`;
3064 } else if (!isPromise(inputValue)) {
3065 warn(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof inputValue}"`);
3066 }
3067 };
3068
3069 /** @type {Record<SweetAlertInput, (input: Input | HTMLElement, params: SweetAlertOptions) => Input>} */
3070 const renderInputType = {};
3071
3072 /**
3073 * @param {Input | HTMLElement} input
3074 * @param {SweetAlertOptions} params
3075 * @returns {Input}
3076 */
3077 renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = renderInputType.search = renderInputType.date = renderInputType['datetime-local'] = renderInputType.time = renderInputType.week = renderInputType.month = /** @type {(input: Input | HTMLElement, params: SweetAlertOptions) => Input} */
3078 (input, params) => {
3079 const inputElement = /** @type {HTMLInputElement} */input;
3080 checkAndSetInputValue(inputElement, params.inputValue);
3081 setInputLabel(inputElement, inputElement, params);
3082 setInputPlaceholder(inputElement, params);
3083 inputElement.type = /** @type {string} */params.input;
3084 return inputElement;
3085 };
3086
3087 /**
3088 * @param {Input | HTMLElement} input
3089 * @param {SweetAlertOptions} params
3090 * @returns {Input}
3091 */
3092 renderInputType.file = (input, params) => {
3093 const inputElement = /** @type {HTMLInputElement} */input;
3094 setInputLabel(inputElement, inputElement, params);
3095 setInputPlaceholder(inputElement, params);
3096 return inputElement;
3097 };
3098
3099 /**
3100 * @param {Input | HTMLElement} range
3101 * @param {SweetAlertOptions} params
3102 * @returns {Input}
3103 */
3104 renderInputType.range = (range, params) => {
3105 const rangeContainer = /** @type {HTMLElement} */range;
3106 const rangeInput = rangeContainer.querySelector('input');
3107 const rangeOutput = rangeContainer.querySelector('output');
3108 if (rangeInput) {
3109 checkAndSetInputValue(rangeInput, params.inputValue);
3110 rangeInput.type = /** @type {string} */params.input;
3111 setInputLabel(rangeInput, /** @type {Input} */range, params);
3112 }
3113 if (rangeOutput) {
3114 checkAndSetInputValue(rangeOutput, params.inputValue);
3115 }
3116 return /** @type {Input} */range;
3117 };
3118
3119 /**
3120 * @param {Input | HTMLElement} select
3121 * @param {SweetAlertOptions} params
3122 * @returns {Input}
3123 */
3124 renderInputType.select = (select, params) => {
3125 const selectElement = /** @type {HTMLSelectElement} */select;
3126 selectElement.textContent = '';
3127 if (params.inputPlaceholder) {
3128 const placeholder = document.createElement('option');
3129 setInnerHtml(placeholder, params.inputPlaceholder);
3130 placeholder.value = '';
3131 placeholder.disabled = true;
3132 placeholder.selected = true;
3133 selectElement.appendChild(placeholder);
3134 }
3135 setInputLabel(selectElement, selectElement, params);
3136 return selectElement;
3137 };
3138
3139 /**
3140 * @param {Input | HTMLElement} radio
3141 * @returns {Input}
3142 */
3143 renderInputType.radio = radio => {
3144 const radioElement = /** @type {HTMLElement} */radio;
3145 radioElement.textContent = '';
3146 return /** @type {Input} */radio;
3147 };
3148
3149 /**
3150 * @param {Input | HTMLElement} checkboxContainer
3151 * @param {SweetAlertOptions} params
3152 * @returns {Input}
3153 */
3154 renderInputType.checkbox = (checkboxContainer, params) => {
3155 const popup = getPopup();
3156 if (!popup) {
3157 throw new Error('Popup not found');
3158 }
3159 const checkbox = getInput$1(popup, 'checkbox');
3160 if (!checkbox) {
3161 throw new Error('Checkbox input not found');
3162 }
3163 checkbox.value = '1';
3164 checkbox.checked = Boolean(params.inputValue);
3165 const containerElement = /** @type {HTMLElement} */checkboxContainer;
3166 const label = containerElement.querySelector('span');
3167 if (label) {
3168 const placeholderOrLabel = params.inputPlaceholder || params.inputLabel;
3169 if (placeholderOrLabel) {
3170 setInnerHtml(label, placeholderOrLabel);
3171 }
3172 }
3173 return checkbox;
3174 };
3175
3176 /**
3177 * @param {Input | HTMLElement} textarea
3178 * @param {SweetAlertOptions} params
3179 * @returns {Input}
3180 */
3181 renderInputType.textarea = (textarea, params) => {
3182 const textareaElement = /** @type {HTMLTextAreaElement} */textarea;
3183 checkAndSetInputValue(textareaElement, params.inputValue);
3184 setInputPlaceholder(textareaElement, params);
3185 setInputLabel(textareaElement, textareaElement, params);
3186
3187 /**
3188 * @param {HTMLElement} el
3189 * @returns {number}
3190 */
3191 const getMargin = el => parseInt(window.getComputedStyle(el).marginLeft) + parseInt(window.getComputedStyle(el).marginRight);
3192
3193 // https://github.com/sweetalert2/sweetalert2/issues/2291
3194 setTimeout(() => {
3195 // https://github.com/sweetalert2/sweetalert2/issues/1699
3196 if ('MutationObserver' in window) {
3197 const popup = getPopup();
3198 if (!popup) {
3199 return;
3200 }
3201 const initialPopupWidth = parseInt(window.getComputedStyle(popup).width);
3202 const textareaResizeHandler = () => {
3203 // check if texarea is still in document (i.e. popup wasn't closed in the meantime)
3204 if (!document.body.contains(textareaElement)) {
3205 return;
3206 }
3207 const textareaWidth = textareaElement.offsetWidth + getMargin(textareaElement);
3208 const popupElement = getPopup();
3209 if (popupElement) {
3210 if (textareaWidth > initialPopupWidth) {
3211 popupElement.style.width = `${textareaWidth}px`;
3212 } else {
3213 applyNumericalStyle(popupElement, 'width', params.width);
3214 }
3215 }
3216 };
3217 new MutationObserver(textareaResizeHandler).observe(textareaElement, {
3218 attributes: true,
3219 attributeFilter: ['style']
3220 });
3221 }
3222 });
3223 return textareaElement;
3224 };
3225
3226 /**
3227 * @param {SweetAlert} instance
3228 * @param {SweetAlertOptions} params
3229 */
3230 const renderContent = (instance, params) => {
3231 const htmlContainer = getHtmlContainer();
3232 if (!htmlContainer) {
3233 return;
3234 }
3235 showWhenInnerHtmlPresent(htmlContainer);
3236 applyCustomClass(htmlContainer, params, 'htmlContainer');
3237
3238 // Content as HTML
3239 if (params.html) {
3240 parseHtmlToContainer(params.html, htmlContainer);
3241 show(htmlContainer, 'block');
3242 }
3243
3244 // Content as plain text
3245 else if (params.text) {
3246 htmlContainer.textContent = params.text;
3247 show(htmlContainer, 'block');
3248 }
3249
3250 // No content
3251 else {
3252 hide(htmlContainer);
3253 }
3254 renderInput(instance, params);
3255 };
3256
3257 /**
3258 * @param {SweetAlert} instance
3259 * @param {SweetAlertOptions} params
3260 */
3261 const renderFooter = (instance, params) => {
3262 const footer = getFooter();
3263 if (!footer) {
3264 return;
3265 }
3266 showWhenInnerHtmlPresent(footer);
3267 toggle(footer, Boolean(params.footer), 'block');
3268 if (params.footer) {
3269 parseHtmlToContainer(params.footer, footer);
3270 }
3271
3272 // Custom class
3273 applyCustomClass(footer, params, 'footer');
3274 };
3275
3276 /**
3277 * @param {SweetAlert} instance
3278 * @param {SweetAlertOptions} params
3279 */
3280 const renderIcon = (instance, params) => {
3281 const innerParams = privateProps.innerParams.get(instance);
3282 const icon = getIcon();
3283 if (!icon) {
3284 return;
3285 }
3286
3287 // if the given icon already rendered, apply the styling without re-rendering the icon
3288 if (innerParams && params.icon === innerParams.icon) {
3289 // Custom or default content
3290 setContent(icon, params);
3291 applyStyles(icon, params);
3292 return;
3293 }
3294 if (!params.icon && !params.iconHtml) {
3295 hide(icon);
3296 return;
3297 }
3298 if (params.icon && Object.keys(iconTypes).indexOf(params.icon) === -1) {
3299 error(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${params.icon}"`);
3300 hide(icon);
3301 return;
3302 }
3303 show(icon);
3304
3305 // Custom or default content
3306 setContent(icon, params);
3307 applyStyles(icon, params);
3308
3309 // Animate icon
3310 addClass(icon, params.showClass && params.showClass.icon);
3311
3312 // Re-adjust the success icon on system theme change
3313 const colorSchemeQueryList = window.matchMedia('(prefers-color-scheme: dark)');
3314 colorSchemeQueryList.addEventListener('change', adjustSuccessIconBackgroundColor);
3315 };
3316
3317 /**
3318 * @param {HTMLElement} icon
3319 * @param {SweetAlertOptions} params
3320 */
3321 const applyStyles = (icon, params) => {
3322 for (const [iconType, iconClassName] of Object.entries(iconTypes)) {
3323 if (params.icon !== iconType) {
3324 removeClass(icon, iconClassName);
3325 }
3326 }
3327 addClass(icon, params.icon && iconTypes[params.icon]);
3328
3329 // Icon color
3330 setColor(icon, params);
3331
3332 // Success icon background color
3333 adjustSuccessIconBackgroundColor();
3334
3335 // Custom class
3336 applyCustomClass(icon, params, 'icon');
3337 };
3338
3339 // Adjust success icon background color to match the popup background color
3340 const adjustSuccessIconBackgroundColor = () => {
3341 const popup = getPopup();
3342 if (!popup) {
3343 return;
3344 }
3345 const popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color');
3346 /** @type {NodeListOf<HTMLElement>} */
3347 const successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix');
3348 for (let i = 0; i < successIconParts.length; i++) {
3349 successIconParts[i].style.backgroundColor = popupBackgroundColor;
3350 }
3351 };
3352
3353 /**
3354 *
3355 * @param {SweetAlertOptions} params
3356 * @returns {string}
3357 */
3358 const successIconHtml = params => `
3359 ${params.animation ? '<div class="swal2-success-circular-line-left"></div>' : ''}
3360 <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
3361 <div class="swal2-success-ring"></div>
3362 ${params.animation ? '<div class="swal2-success-fix"></div>' : ''}
3363 ${params.animation ? '<div class="swal2-success-circular-line-right"></div>' : ''}
3364 `;
3365 const errorIconHtml = `
3366 <span class="swal2-x-mark">
3367 <span class="swal2-x-mark-line-left"></span>
3368 <span class="swal2-x-mark-line-right"></span>
3369 </span>
3370 `;
3371
3372 /**
3373 * @param {HTMLElement} icon
3374 * @param {SweetAlertOptions} params
3375 */
3376 const setContent = (icon, params) => {
3377 if (!params.icon && !params.iconHtml) {
3378 return;
3379 }
3380 let oldContent = icon.innerHTML;
3381 let newContent = '';
3382 if (params.iconHtml) {
3383 newContent = iconContent(params.iconHtml);
3384 } else if (params.icon === 'success') {
3385 newContent = successIconHtml(params);
3386 oldContent = oldContent.replace(/ style=".*?"/g, ''); // undo adjustSuccessIconBackgroundColor()
3387 } else if (params.icon === 'error') {
3388 newContent = errorIconHtml;
3389 } else if (params.icon) {
3390 const defaultIconHtml = {
3391 question: '?',
3392 warning: '!',
3393 info: 'i'
3394 };
3395 newContent = iconContent(defaultIconHtml[params.icon]);
3396 }
3397 if (oldContent.trim() !== newContent.trim()) {
3398 setInnerHtml(icon, newContent);
3399 }
3400 };
3401
3402 /**
3403 * @param {HTMLElement} icon
3404 * @param {SweetAlertOptions} params
3405 */
3406 const setColor = (icon, params) => {
3407 if (!params.iconColor) {
3408 return;
3409 }
3410 icon.style.color = params.iconColor;
3411 icon.style.borderColor = params.iconColor;
3412 for (const sel of ['.swal2-success-line-tip', '.swal2-success-line-long', '.swal2-x-mark-line-left', '.swal2-x-mark-line-right']) {
3413 setStyle(icon, sel, 'background-color', params.iconColor);
3414 }
3415 setStyle(icon, '.swal2-success-ring', 'border-color', params.iconColor);
3416 };
3417
3418 /**
3419 * @param {string} content
3420 * @returns {string}
3421 */
3422 const iconContent = content => `<div class="${swalClasses['icon-content']}">${content}</div>`;
3423
3424 /**
3425 * @param {SweetAlert} instance
3426 * @param {SweetAlertOptions} params
3427 */
3428 const renderImage = (instance, params) => {
3429 const image = getImage();
3430 if (!image) {
3431 return;
3432 }
3433 if (!params.imageUrl) {
3434 hide(image);
3435 return;
3436 }
3437 show(image, '');
3438
3439 // Src, alt
3440 image.setAttribute('src', params.imageUrl);
3441 image.setAttribute('alt', params.imageAlt || '');
3442
3443 // Width, height
3444 applyNumericalStyle(image, 'width', params.imageWidth);
3445 applyNumericalStyle(image, 'height', params.imageHeight);
3446
3447 // Class
3448 image.className = swalClasses.image;
3449 applyCustomClass(image, params, 'image');
3450 };
3451
3452 let dragging = false;
3453 let mousedownX = 0;
3454 let mousedownY = 0;
3455 let initialX = 0;
3456 let initialY = 0;
3457
3458 /**
3459 * @param {HTMLElement} popup
3460 */
3461 const addDraggableListeners = popup => {
3462 popup.addEventListener('mousedown', down);
3463 document.body.addEventListener('mousemove', move);
3464 popup.addEventListener('mouseup', up);
3465 popup.addEventListener('touchstart', down);
3466 document.body.addEventListener('touchmove', move);
3467 popup.addEventListener('touchend', up);
3468 };
3469
3470 /**
3471 * @param {HTMLElement} popup
3472 */
3473 const removeDraggableListeners = popup => {
3474 popup.removeEventListener('mousedown', down);
3475 document.body.removeEventListener('mousemove', move);
3476 popup.removeEventListener('mouseup', up);
3477 popup.removeEventListener('touchstart', down);
3478 document.body.removeEventListener('touchmove', move);
3479 popup.removeEventListener('touchend', up);
3480 };
3481
3482 /**
3483 * @param {MouseEvent | TouchEvent} event
3484 */
3485 const down = event => {
3486 const popup = getPopup();
3487 if (!popup) {
3488 return;
3489 }
3490 const icon = getIcon();
3491 if (event.target === popup || icon && icon.contains(/** @type {HTMLElement} */event.target)) {
3492 dragging = true;
3493 const clientXY = getClientXY(event);
3494 mousedownX = clientXY.clientX;
3495 mousedownY = clientXY.clientY;
3496 initialX = parseInt(popup.style.insetInlineStart) || 0;
3497 initialY = parseInt(popup.style.insetBlockStart) || 0;
3498 addClass(popup, 'swal2-dragging');
3499 }
3500 };
3501
3502 /**
3503 * @param {MouseEvent | TouchEvent} event
3504 */
3505 const move = event => {
3506 const popup = getPopup();
3507 if (!popup) {
3508 return;
3509 }
3510 if (dragging) {
3511 let {
3512 clientX,
3513 clientY
3514 } = getClientXY(event);
3515 const deltaX = clientX - mousedownX;
3516 // In RTL mode, negate the horizontal delta since insetInlineStart refers to the right edge
3517 popup.style.insetInlineStart = `${initialX + (globalState.isRTL ? -deltaX : deltaX)}px`;
3518 popup.style.insetBlockStart = `${initialY + (clientY - mousedownY)}px`;
3519 }
3520 };
3521 const up = () => {
3522 const popup = getPopup();
3523 dragging = false;
3524 removeClass(popup, 'swal2-dragging');
3525 };
3526
3527 /**
3528 * @param {MouseEvent | TouchEvent} event
3529 * @returns {{ clientX: number, clientY: number }}
3530 */
3531 const getClientXY = event => {
3532 let clientX = 0,
3533 clientY = 0;
3534 if (event.type.startsWith('mouse')) {
3535 clientX = /** @type {MouseEvent} */event.clientX;
3536 clientY = /** @type {MouseEvent} */event.clientY;
3537 } else if (event.type.startsWith('touch')) {
3538 clientX = /** @type {TouchEvent} */event.touches[0].clientX;
3539 clientY = /** @type {TouchEvent} */event.touches[0].clientY;
3540 }
3541 return {
3542 clientX,
3543 clientY
3544 };
3545 };
3546
3547 /**
3548 * @param {SweetAlert} instance
3549 * @param {SweetAlertOptions} params
3550 */
3551 const renderPopup = (instance, params) => {
3552 const container = getContainer();
3553 const popup = getPopup();
3554 if (!container || !popup) {
3555 return;
3556 }
3557
3558 // Width
3559 // https://github.com/sweetalert2/sweetalert2/issues/2170
3560 if (params.toast) {
3561 applyNumericalStyle(container, 'width', params.width);
3562 popup.style.width = '100%';
3563 const loader = getLoader();
3564 if (loader) {
3565 popup.insertBefore(loader, getIcon());
3566 }
3567 } else {
3568 applyNumericalStyle(popup, 'width', params.width);
3569 }
3570
3571 // Padding
3572 applyNumericalStyle(popup, 'padding', params.padding);
3573
3574 // Color
3575 if (params.color) {
3576 popup.style.color = params.color;
3577 }
3578
3579 // Background
3580 if (params.background) {
3581 popup.style.background = params.background;
3582 }
3583 hide(getValidationMessage());
3584
3585 // Classes
3586 addClasses$1(popup, params);
3587 if (params.draggable && !params.toast) {
3588 addClass(popup, swalClasses.draggable);
3589 addDraggableListeners(popup);
3590 } else {
3591 removeClass(popup, swalClasses.draggable);
3592 removeDraggableListeners(popup);
3593 }
3594 };
3595
3596 /**
3597 * @param {HTMLElement} popup
3598 * @param {SweetAlertOptions} params
3599 */
3600 const addClasses$1 = (popup, params) => {
3601 const showClass = params.showClass || {};
3602 // Default Class + showClass when updating Swal.update({})
3603 popup.className = `${swalClasses.popup} ${isVisible$1(popup) ? showClass.popup : ''}`;
3604 if (params.toast) {
3605 addClass([document.documentElement, document.body], swalClasses['toast-shown']);
3606 addClass(popup, swalClasses.toast);
3607 } else {
3608 addClass(popup, swalClasses.modal);
3609 }
3610
3611 // Custom class
3612 applyCustomClass(popup, params, 'popup');
3613 // TODO: remove in the next major
3614 if (typeof params.customClass === 'string') {
3615 addClass(popup, params.customClass);
3616 }
3617
3618 // Icon class (#1842)
3619 if (params.icon) {
3620 addClass(popup, swalClasses[`icon-${params.icon}`]);
3621 }
3622 };
3623
3624 /**
3625 * @param {SweetAlert} instance
3626 * @param {SweetAlertOptions} params
3627 */
3628 const renderProgressSteps = (instance, params) => {
3629 const progressStepsContainer = getProgressSteps();
3630 if (!progressStepsContainer) {
3631 return;
3632 }
3633 const {
3634 progressSteps,
3635 currentProgressStep
3636 } = params;
3637 if (!progressSteps || progressSteps.length === 0 || currentProgressStep === undefined) {
3638 hide(progressStepsContainer);
3639 return;
3640 }
3641 show(progressStepsContainer);
3642 progressStepsContainer.textContent = '';
3643 if (currentProgressStep >= progressSteps.length) {
3644 warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)');
3645 }
3646 progressSteps.forEach((step, index) => {
3647 const stepEl = createStepElement(step);
3648 progressStepsContainer.appendChild(stepEl);
3649 if (index === currentProgressStep) {
3650 addClass(stepEl, swalClasses['active-progress-step']);
3651 }
3652 if (index !== progressSteps.length - 1) {
3653 const lineEl = createLineElement(params);
3654 progressStepsContainer.appendChild(lineEl);
3655 }
3656 });
3657 };
3658
3659 /**
3660 * @param {string} step
3661 * @returns {HTMLLIElement}
3662 */
3663 const createStepElement = step => {
3664 const stepEl = document.createElement('li');
3665 addClass(stepEl, swalClasses['progress-step']);
3666 setInnerHtml(stepEl, step);
3667 return stepEl;
3668 };
3669
3670 /**
3671 * @param {SweetAlertOptions} params
3672 * @returns {HTMLLIElement}
3673 */
3674 const createLineElement = params => {
3675 const lineEl = document.createElement('li');
3676 addClass(lineEl, swalClasses['progress-step-line']);
3677 if (params.progressStepsDistance) {
3678 applyNumericalStyle(lineEl, 'width', params.progressStepsDistance);
3679 }
3680 return lineEl;
3681 };
3682
3683 /**
3684 * @param {SweetAlert} instance
3685 * @param {SweetAlertOptions} params
3686 */
3687 const renderTitle = (instance, params) => {
3688 const title = getTitle();
3689 if (!title) {
3690 return;
3691 }
3692 showWhenInnerHtmlPresent(title);
3693 toggle(title, Boolean(params.title || params.titleText), 'block');
3694 if (params.title) {
3695 parseHtmlToContainer(params.title, title);
3696 }
3697 if (params.titleText) {
3698 title.innerText = params.titleText;
3699 }
3700
3701 // Custom class
3702 applyCustomClass(title, params, 'title');
3703 };
3704
3705 /**
3706 * @param {SweetAlert} instance
3707 * @param {SweetAlertOptions} params
3708 */
3709 const render = (instance, params) => {
3710 var _globalState$eventEmi;
3711 renderPopup(instance, params);
3712 renderContainer(instance, params);
3713 renderProgressSteps(instance, params);
3714 renderIcon(instance, params);
3715 renderImage(instance, params);
3716 renderTitle(instance, params);
3717 renderCloseButton(instance, params);
3718 renderContent(instance, params);
3719 renderActions(instance, params);
3720 renderFooter(instance, params);
3721 const popup = getPopup();
3722 if (typeof params.didRender === 'function' && popup) {
3723 params.didRender(popup);
3724 }
3725 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('didRender', popup);
3726 };
3727
3728 /*
3729 * Global function to determine if SweetAlert2 popup is shown
3730 */
3731 const isVisible = () => {
3732 return isVisible$1(getPopup());
3733 };
3734
3735 /*
3736 * Global function to click 'Confirm' button
3737 */
3738 const clickConfirm = () => {
3739 var _dom$getConfirmButton;
3740 return (_dom$getConfirmButton = getConfirmButton()) === null || _dom$getConfirmButton === void 0 ? void 0 : _dom$getConfirmButton.click();
3741 };
3742
3743 /*
3744 * Global function to click 'Deny' button
3745 */
3746 const clickDeny = () => {
3747 var _dom$getDenyButton;
3748 return (_dom$getDenyButton = getDenyButton()) === null || _dom$getDenyButton === void 0 ? void 0 : _dom$getDenyButton.click();
3749 };
3750
3751 /*
3752 * Global function to click 'Cancel' button
3753 */
3754 const clickCancel = () => {
3755 var _dom$getCancelButton;
3756 return (_dom$getCancelButton = getCancelButton()) === null || _dom$getCancelButton === void 0 ? void 0 : _dom$getCancelButton.click();
3757 };
3758
3759 /** @type {Record<DismissReason, DismissReason>} */
3760 const DismissReason = Object.freeze({
3761 cancel: 'cancel',
3762 backdrop: 'backdrop',
3763 close: 'close',
3764 esc: 'esc',
3765 timer: 'timer'
3766 });
3767
3768 /**
3769 * @param {GlobalState} globalState
3770 */
3771 const removeKeydownHandler = globalState => {
3772 if (globalState.keydownTarget && globalState.keydownHandlerAdded && globalState.keydownHandler) {
3773 const handler = /** @type {EventListenerOrEventListenerObject} */ /** @type {unknown} */globalState.keydownHandler;
3774 globalState.keydownTarget.removeEventListener('keydown', handler, {
3775 capture: globalState.keydownListenerCapture
3776 });
3777 globalState.keydownHandlerAdded = false;
3778 }
3779 };
3780
3781 /**
3782 * @param {GlobalState} globalState
3783 * @param {SweetAlertOptions} innerParams
3784 * @param {(dismiss: DismissReason) => void} dismissWith
3785 */
3786 const addKeydownHandler = (globalState, innerParams, dismissWith) => {
3787 removeKeydownHandler(globalState);
3788 if (!innerParams.toast) {
3789 /** @type {(this: HTMLElement, event: KeyboardEvent) => void} */
3790 const handler = e => keydownHandler(innerParams, e, dismissWith);
3791 globalState.keydownHandler = handler;
3792 const target = innerParams.keydownListenerCapture ? window : getPopup();
3793 if (target) {
3794 globalState.keydownTarget = target;
3795 globalState.keydownListenerCapture = innerParams.keydownListenerCapture;
3796 const eventHandler = /** @type {EventListenerOrEventListenerObject} */ /** @type {unknown} */handler;
3797 globalState.keydownTarget.addEventListener('keydown', eventHandler, {
3798 capture: globalState.keydownListenerCapture
3799 });
3800 globalState.keydownHandlerAdded = true;
3801 }
3802 }
3803 };
3804
3805 /**
3806 * @param {number} index
3807 * @param {number} increment
3808 */
3809 const setFocus = (index, increment) => {
3810 var _dom$getPopup;
3811 const focusableElements = getFocusableElements();
3812 // search for visible elements and select the next possible match
3813 if (focusableElements.length) {
3814 index = index + increment;
3815
3816 // shift + tab when .swal2-popup is focused
3817 if (index === -2) {
3818 index = focusableElements.length - 1;
3819 }
3820
3821 // rollover to first item
3822 if (index === focusableElements.length) {
3823 index = 0;
3824
3825 // go to last item
3826 } else if (index === -1) {
3827 index = focusableElements.length - 1;
3828 }
3829 focusableElements[index].focus();
3830 return;
3831 }
3832 // no visible focusable elements, focus the popup
3833 (_dom$getPopup = getPopup()) === null || _dom$getPopup === void 0 || _dom$getPopup.focus();
3834 };
3835 const arrowKeysNextButton = ['ArrowRight', 'ArrowDown'];
3836 const arrowKeysPreviousButton = ['ArrowLeft', 'ArrowUp'];
3837
3838 /**
3839 * @param {SweetAlertOptions} innerParams
3840 * @param {KeyboardEvent} event
3841 * @param {(dismiss: DismissReason) => void} dismissWith
3842 */
3843 const keydownHandler = (innerParams, event, dismissWith) => {
3844 if (!innerParams) {
3845 return; // This instance has already been destroyed
3846 }
3847
3848 // Ignore keydown during IME composition
3849 // https://developer.mozilla.org/en-US/docs/Web/API/Document/keydown_event#ignoring_keydown_during_ime_composition
3850 // https://github.com/sweetalert2/sweetalert2/issues/720
3851 // https://github.com/sweetalert2/sweetalert2/issues/2406
3852 if (event.isComposing || event.keyCode === 229) {
3853 return;
3854 }
3855 if (innerParams.stopKeydownPropagation) {
3856 event.stopPropagation();
3857 }
3858
3859 // ENTER
3860 if (event.key === 'Enter') {
3861 handleEnter(event, innerParams);
3862 }
3863
3864 // TAB
3865 else if (event.key === 'Tab') {
3866 handleTab(event);
3867 }
3868
3869 // ARROWS - switch focus between buttons
3870 else if ([...arrowKeysNextButton, ...arrowKeysPreviousButton].includes(event.key)) {
3871 handleArrows(event.key);
3872 }
3873
3874 // ESC
3875 else if (event.key === 'Escape') {
3876 handleEsc(event, innerParams, dismissWith);
3877 }
3878 };
3879
3880 /**
3881 * @param {KeyboardEvent} event
3882 * @param {SweetAlertOptions} innerParams
3883 */
3884 const handleEnter = (event, innerParams) => {
3885 // https://github.com/sweetalert2/sweetalert2/issues/2386
3886 if (!callIfFunction(innerParams.allowEnterKey)) {
3887 return;
3888 }
3889 const popup = getPopup();
3890 if (!popup || !innerParams.input) {
3891 return;
3892 }
3893 const input = getInput$1(popup, innerParams.input);
3894 if (event.target && input && event.target instanceof HTMLElement && event.target.outerHTML === input.outerHTML) {
3895 if (['textarea', 'file'].includes(innerParams.input)) {
3896 return; // do not submit
3897 }
3898 clickConfirm();
3899 event.preventDefault();
3900 }
3901 };
3902
3903 /**
3904 * @param {KeyboardEvent} event
3905 */
3906 const handleTab = event => {
3907 const targetElement = event.target;
3908 const focusableElements = getFocusableElements();
3909 let btnIndex = -1;
3910 for (let i = 0; i < focusableElements.length; i++) {
3911 if (targetElement === focusableElements[i]) {
3912 btnIndex = i;
3913 break;
3914 }
3915 }
3916
3917 // Cycle to the next button
3918 if (!event.shiftKey) {
3919 setFocus(btnIndex, 1);
3920 }
3921
3922 // Cycle to the prev button
3923 else {
3924 setFocus(btnIndex, -1);
3925 }
3926 event.stopPropagation();
3927 event.preventDefault();
3928 };
3929
3930 /**
3931 * @param {string} key
3932 */
3933 const handleArrows = key => {
3934 const actions = getActions();
3935 const confirmButton = getConfirmButton();
3936 const denyButton = getDenyButton();
3937 const cancelButton = getCancelButton();
3938 if (!actions || !confirmButton || !denyButton || !cancelButton) {
3939 return;
3940 }
3941 /** @type HTMLElement[] */
3942 const buttons = [confirmButton, denyButton, cancelButton];
3943 if (document.activeElement instanceof HTMLElement && !buttons.includes(document.activeElement)) {
3944 return;
3945 }
3946 const sibling = arrowKeysNextButton.includes(key) ? 'nextElementSibling' : 'previousElementSibling';
3947 let buttonToFocus = document.activeElement;
3948 if (!buttonToFocus) {
3949 return;
3950 }
3951 for (let i = 0; i < actions.children.length; i++) {
3952 buttonToFocus = buttonToFocus[sibling];
3953 if (!buttonToFocus) {
3954 return;
3955 }
3956 if (buttonToFocus instanceof HTMLButtonElement && isVisible$1(buttonToFocus)) {
3957 break;
3958 }
3959 }
3960 if (buttonToFocus instanceof HTMLButtonElement) {
3961 buttonToFocus.focus();
3962 }
3963 };
3964
3965 /**
3966 * @param {KeyboardEvent} event
3967 * @param {SweetAlertOptions} innerParams
3968 * @param {(dismiss: DismissReason) => void} dismissWith
3969 */
3970 const handleEsc = (event, innerParams, dismissWith) => {
3971 event.preventDefault();
3972 if (callIfFunction(innerParams.allowEscapeKey)) {
3973 dismissWith(DismissReason.esc);
3974 }
3975 };
3976
3977 /**
3978 * This module contains `WeakMap`s for each effectively-"private property" that a `Swal` has.
3979 * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')`
3980 * This is the approach that Babel will probably take to implement private methods/fields
3981 * https://github.com/tc39/proposal-private-methods
3982 * https://github.com/babel/babel/pull/7555
3983 * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module*
3984 * then we can use that language feature.
3985 */
3986
3987 var privateMethods = {
3988 swalPromiseResolve: new WeakMap(),
3989 swalPromiseReject: new WeakMap()
3990 };
3991
3992 // From https://developer.paciellogroup.com/blog/2018/06/the-current-state-of-modal-dialog-accessibility/
3993 // Adding aria-hidden="true" to elements outside of the active modal dialog ensures that
3994 // elements not within the active modal dialog will not be surfaced if a user opens a screen
3995 // reader’s list of elements (headings, form controls, landmarks, etc.) in the document.
3996
3997 const setAriaHidden = () => {
3998 const container = getContainer();
3999 const bodyChildren = Array.from(document.body.children);
4000 bodyChildren.forEach(el => {
4001 if (el.contains(container)) {
4002 return;
4003 }
4004 if (el.hasAttribute('aria-hidden')) {
4005 el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden') || '');
4006 }
4007 el.setAttribute('aria-hidden', 'true');
4008 });
4009 };
4010 const unsetAriaHidden = () => {
4011 const bodyChildren = Array.from(document.body.children);
4012 bodyChildren.forEach(el => {
4013 if (el.hasAttribute('data-previous-aria-hidden')) {
4014 el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden') || '');
4015 el.removeAttribute('data-previous-aria-hidden');
4016 } else {
4017 el.removeAttribute('aria-hidden');
4018 }
4019 });
4020 };
4021
4022 // @ts-ignore
4023 const isSafariOrIOS = typeof window !== 'undefined' && Boolean(window.GestureEvent); // true for Safari desktop + all iOS browsers https://stackoverflow.com/a/70585394
4024
4025 /**
4026 * Fix iOS scrolling
4027 * http://stackoverflow.com/q/39626302
4028 */
4029 const iOSfix = () => {
4030 if (isSafariOrIOS && !hasClass(document.body, swalClasses.iosfix)) {
4031 const offset = document.body.scrollTop;
4032 document.body.style.top = `${offset * -1}px`;
4033 addClass(document.body, swalClasses.iosfix);
4034 lockBodyScroll();
4035 }
4036 };
4037
4038 /**
4039 * https://github.com/sweetalert2/sweetalert2/issues/1246
4040 */
4041 const lockBodyScroll = () => {
4042 const container = getContainer();
4043 if (!container) {
4044 return;
4045 }
4046 /** @type {boolean} */
4047 let preventTouchMove;
4048 /**
4049 * @param {TouchEvent} event
4050 */
4051 container.ontouchstart = event => {
4052 preventTouchMove = shouldPreventTouchMove(event);
4053 };
4054 /**
4055 * @param {TouchEvent} event
4056 */
4057 container.ontouchmove = event => {
4058 if (preventTouchMove) {
4059 event.preventDefault();
4060 event.stopPropagation();
4061 }
4062 };
4063 };
4064
4065 /**
4066 * @param {TouchEvent} event
4067 * @returns {boolean}
4068 */
4069 const shouldPreventTouchMove = event => {
4070 const target = event.target;
4071 const container = getContainer();
4072 const htmlContainer = getHtmlContainer();
4073 if (!container || !htmlContainer) {
4074 return false;
4075 }
4076 if (isStylus(event) || isZoom(event)) {
4077 return false;
4078 }
4079 if (target === container) {
4080 return true;
4081 }
4082 if (!isScrollable(container) && target instanceof HTMLElement && !selfOrParentIsScrollable(target, htmlContainer) &&
4083 // #2823
4084 target.tagName !== 'INPUT' &&
4085 // #1603
4086 target.tagName !== 'TEXTAREA' &&
4087 // #2266
4088 !(isScrollable(htmlContainer) &&
4089 // #1944
4090 htmlContainer.contains(target))) {
4091 return true;
4092 }
4093 return false;
4094 };
4095
4096 /**
4097 * https://github.com/sweetalert2/sweetalert2/issues/1786
4098 *
4099 * @param {TouchEvent} event
4100 * @returns {boolean}
4101 */
4102 const isStylus = event => {
4103 return Boolean(event.touches && event.touches.length &&
4104 // @ts-ignore - touchType is not a standard property
4105 event.touches[0].touchType === 'stylus');
4106 };
4107
4108 /**
4109 * https://github.com/sweetalert2/sweetalert2/issues/1891
4110 *
4111 * @param {TouchEvent} event
4112 * @returns {boolean}
4113 */
4114 const isZoom = event => {
4115 return event.touches && event.touches.length > 1;
4116 };
4117 const undoIOSfix = () => {
4118 if (hasClass(document.body, swalClasses.iosfix)) {
4119 const offset = parseInt(document.body.style.top, 10);
4120 removeClass(document.body, swalClasses.iosfix);
4121 document.body.style.top = '';
4122 document.body.scrollTop = offset * -1;
4123 }
4124 };
4125
4126 /**
4127 * Measure scrollbar width for padding body during modal show/hide
4128 * https://github.com/twbs/bootstrap/blob/master/js/src/modal.js
4129 *
4130 * @returns {number}
4131 */
4132 const measureScrollbar = () => {
4133 const scrollDiv = document.createElement('div');
4134 scrollDiv.className = swalClasses['scrollbar-measure'];
4135 document.body.appendChild(scrollDiv);
4136 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
4137 document.body.removeChild(scrollDiv);
4138 return scrollbarWidth;
4139 };
4140
4141 /**
4142 * Remember state in cases where opening and handling a modal will fiddle with it.
4143 * @type {number | null}
4144 */
4145 let previousBodyPadding = null;
4146
4147 /**
4148 * @param {string} initialBodyOverflow
4149 */
4150 const replaceScrollbarWithPadding = initialBodyOverflow => {
4151 // for queues, do not do this more than once
4152 if (previousBodyPadding !== null) {
4153 return;
4154 }
4155 // if the body has overflow
4156 if (document.body.scrollHeight > window.innerHeight || initialBodyOverflow === 'scroll' // https://github.com/sweetalert2/sweetalert2/issues/2663
4157 ) {
4158 // add padding so the content doesn't shift after removal of scrollbar
4159 previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'));
4160 document.body.style.paddingRight = `${previousBodyPadding + measureScrollbar()}px`;
4161 }
4162 };
4163 const undoReplaceScrollbarWithPadding = () => {
4164 if (previousBodyPadding !== null) {
4165 document.body.style.paddingRight = `${previousBodyPadding}px`;
4166 previousBodyPadding = null;
4167 }
4168 };
4169
4170 /**
4171 * @param {SweetAlert} instance
4172 * @param {HTMLElement} container
4173 * @param {boolean} returnFocus
4174 * @param {(() => void) | undefined} didClose
4175 */
4176 function removePopupAndResetState(instance, container, returnFocus, didClose) {
4177 if (isToast()) {
4178 triggerDidCloseAndDispose(instance, didClose);
4179 } else {
4180 restoreActiveElement(returnFocus).then(() => triggerDidCloseAndDispose(instance, didClose));
4181 removeKeydownHandler(globalState);
4182 }
4183
4184 // workaround for https://github.com/sweetalert2/sweetalert2/issues/2088
4185 // for some reason removing the container in Safari will scroll the document to bottom
4186 if (isSafariOrIOS) {
4187 container.setAttribute('style', 'display:none !important');
4188 container.removeAttribute('class');
4189 container.innerHTML = '';
4190 } else {
4191 container.remove();
4192 }
4193 if (isModal()) {
4194 undoReplaceScrollbarWithPadding();
4195 undoIOSfix();
4196 unsetAriaHidden();
4197 }
4198 removeBodyClasses();
4199 }
4200
4201 /**
4202 * Remove SweetAlert2 classes from body
4203 */
4204 function removeBodyClasses() {
4205 removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown']]);
4206 }
4207
4208 /**
4209 * Instance method to close sweetAlert
4210 *
4211 * @param {SweetAlertResult | undefined} resolveValue
4212 * @this {SweetAlert}
4213 */
4214 function close(resolveValue) {
4215 resolveValue = prepareResolveValue(resolveValue);
4216 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(this);
4217 const didClose = triggerClosePopup(this);
4218 if (this.isAwaitingPromise) {
4219 // A swal awaiting for a promise (after a click on Confirm or Deny) cannot be dismissed anymore #2335
4220 if (!resolveValue.isDismissed) {
4221 handleAwaitingPromise(this);
4222 swalPromiseResolve(resolveValue);
4223 }
4224 } else if (didClose) {
4225 // Resolve Swal promise
4226 swalPromiseResolve(resolveValue);
4227 }
4228 }
4229
4230 /**
4231 * @param {SweetAlert} instance
4232 * @returns {boolean}
4233 */
4234 const triggerClosePopup = instance => {
4235 const popup = getPopup();
4236 if (!popup) {
4237 return false;
4238 }
4239 const innerParams = privateProps.innerParams.get(instance);
4240 if (!innerParams || hasClass(popup, innerParams.hideClass.popup)) {
4241 return false;
4242 }
4243 removeClass(popup, innerParams.showClass.popup);
4244 addClass(popup, innerParams.hideClass.popup);
4245 const backdrop = getContainer();
4246 removeClass(backdrop, innerParams.showClass.backdrop);
4247 addClass(backdrop, innerParams.hideClass.backdrop);
4248 handlePopupAnimation(instance, popup, innerParams);
4249 return true;
4250 };
4251
4252 /**
4253 * @param {Error | string} error
4254 * @this {SweetAlert}
4255 */
4256 function rejectPromise(error) {
4257 const rejectPromise = privateMethods.swalPromiseReject.get(this);
4258 handleAwaitingPromise(this);
4259 if (rejectPromise) {
4260 // Reject Swal promise
4261 rejectPromise(error);
4262 }
4263 }
4264
4265 /**
4266 * @param {SweetAlert} instance
4267 */
4268 const handleAwaitingPromise = instance => {
4269 if (instance.isAwaitingPromise) {
4270 // @ts-ignore
4271 delete instance.isAwaitingPromise;
4272 // The instance might have been previously partly destroyed, we must resume the destroy process in this case #2335
4273 if (!privateProps.innerParams.get(instance)) {
4274 instance._destroy();
4275 }
4276 }
4277 };
4278
4279 /**
4280 * @param {SweetAlertResult | undefined} resolveValue
4281 * @returns {SweetAlertResult}
4282 */
4283 const prepareResolveValue = resolveValue => {
4284 // When user calls Swal.close()
4285 if (typeof resolveValue === 'undefined') {
4286 return {
4287 isConfirmed: false,
4288 isDenied: false,
4289 isDismissed: true
4290 };
4291 }
4292 return Object.assign({
4293 isConfirmed: false,
4294 isDenied: false,
4295 isDismissed: false
4296 }, resolveValue);
4297 };
4298
4299 /**
4300 * @param {SweetAlert} instance
4301 * @param {HTMLElement} popup
4302 * @param {SweetAlertOptions} innerParams
4303 */
4304 const handlePopupAnimation = (instance, popup, innerParams) => {
4305 var _globalState$eventEmi;
4306 const container = getContainer();
4307 // If animation is supported, animate
4308 const animationIsSupported = hasCssAnimation(popup);
4309 if (typeof innerParams.willClose === 'function') {
4310 innerParams.willClose(popup);
4311 }
4312 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('willClose', popup);
4313 if (animationIsSupported && container) {
4314 animatePopup(instance, popup, container, Boolean(innerParams.returnFocus), innerParams.didClose);
4315 } else if (container) {
4316 // Otherwise, remove immediately
4317 removePopupAndResetState(instance, container, Boolean(innerParams.returnFocus), innerParams.didClose);
4318 }
4319 };
4320
4321 /**
4322 * @param {SweetAlert} instance
4323 * @param {HTMLElement} popup
4324 * @param {HTMLElement} container
4325 * @param {boolean} returnFocus
4326 * @param {(() => void) | undefined} didClose
4327 */
4328 const animatePopup = (instance, popup, container, returnFocus, didClose) => {
4329 globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, returnFocus, didClose);
4330 /**
4331 * @param {AnimationEvent | TransitionEvent} e
4332 */
4333 const swalCloseAnimationFinished = function (e) {
4334 if (e.target === popup) {
4335 var _globalState$swalClos;
4336 (_globalState$swalClos = globalState.swalCloseEventFinishedCallback) === null || _globalState$swalClos === void 0 || _globalState$swalClos.call(globalState);
4337 delete globalState.swalCloseEventFinishedCallback;
4338 popup.removeEventListener('animationend', swalCloseAnimationFinished);
4339 popup.removeEventListener('transitionend', swalCloseAnimationFinished);
4340 }
4341 };
4342 popup.addEventListener('animationend', swalCloseAnimationFinished);
4343 popup.addEventListener('transitionend', swalCloseAnimationFinished);
4344 };
4345
4346 /**
4347 * @param {SweetAlert} instance
4348 * @param {(() => void) | undefined} didClose
4349 */
4350 const triggerDidCloseAndDispose = (instance, didClose) => {
4351 setTimeout(() => {
4352 var _globalState$eventEmi2;
4353 if (typeof didClose === 'function') {
4354 didClose.bind(instance.params)();
4355 }
4356 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit('didClose');
4357 // instance might have been destroyed already
4358 if (instance._destroy) {
4359 instance._destroy();
4360 }
4361 });
4362 };
4363
4364 /**
4365 * Shows loader (spinner), this is useful with AJAX requests.
4366 * By default the loader be shown instead of the "Confirm" button.
4367 *
4368 * @param {HTMLButtonElement | null} [buttonToReplace]
4369 */
4370 const showLoading = buttonToReplace => {
4371 let popup = getPopup();
4372 if (!popup) {
4373 new Swal();
4374 }
4375 popup = getPopup();
4376 if (!popup) {
4377 return;
4378 }
4379 const loader = getLoader();
4380 if (isToast()) {
4381 hide(getIcon());
4382 } else {
4383 replaceButton(popup, buttonToReplace);
4384 }
4385 show(loader);
4386 popup.setAttribute('data-loading', 'true');
4387 popup.setAttribute('aria-busy', 'true');
4388 popup.focus();
4389 };
4390
4391 /**
4392 * @param {HTMLElement} popup
4393 * @param {HTMLButtonElement | null} [buttonToReplace]
4394 */
4395 const replaceButton = (popup, buttonToReplace) => {
4396 const actions = getActions();
4397 const loader = getLoader();
4398 if (!actions || !loader) {
4399 return;
4400 }
4401 if (!buttonToReplace && isVisible$1(getConfirmButton())) {
4402 buttonToReplace = getConfirmButton();
4403 }
4404 show(actions);
4405 if (buttonToReplace) {
4406 hide(buttonToReplace);
4407 loader.setAttribute('data-button-to-replace', buttonToReplace.className);
4408 actions.insertBefore(loader, buttonToReplace);
4409 }
4410 addClass([popup, actions], swalClasses.loading);
4411 };
4412
4413 /**
4414 * @param {SweetAlert} instance
4415 * @param {SweetAlertOptions} params
4416 */
4417 const handleInputOptionsAndValue = (instance, params) => {
4418 if (params.input === 'select' || params.input === 'radio') {
4419 handleInputOptions(instance, params);
4420 } else if (['text', 'email', 'number', 'tel', 'textarea'].some(i => i === params.input) && (hasToPromiseFn(params.inputValue) || isPromise(params.inputValue))) {
4421 showLoading(getConfirmButton());
4422 handleInputValue(instance, params);
4423 }
4424 };
4425
4426 /**
4427 * @param {SweetAlert} instance
4428 * @param {SweetAlertOptions} innerParams
4429 * @returns {SweetAlertInputValue}
4430 */
4431 const getInputValue = (instance, innerParams) => {
4432 const input = instance.getInput();
4433 if (!input) {
4434 return null;
4435 }
4436 switch (innerParams.input) {
4437 case 'checkbox':
4438 return getCheckboxValue(input);
4439 case 'radio':
4440 return getRadioValue(input);
4441 case 'file':
4442 return getFileValue(input);
4443 default:
4444 return innerParams.inputAutoTrim ? input.value.trim() : input.value;
4445 }
4446 };
4447
4448 /**
4449 * @param {HTMLInputElement} input
4450 * @returns {number}
4451 */
4452 const getCheckboxValue = input => input.checked ? 1 : 0;
4453
4454 /**
4455 * @param {HTMLInputElement} input
4456 * @returns {string | null}
4457 */
4458 const getRadioValue = input => input.checked ? input.value : null;
4459
4460 /**
4461 * @param {HTMLInputElement} input
4462 * @returns {FileList | File | null}
4463 */
4464 const getFileValue = input => input.files && input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null;
4465
4466 /**
4467 * @param {SweetAlert} instance
4468 * @param {SweetAlertOptions} params
4469 */
4470 const handleInputOptions = (instance, params) => {
4471 const popup = getPopup();
4472 if (!popup) {
4473 return;
4474 }
4475 /**
4476 * @param {*} inputOptions
4477 */
4478 const processInputOptions = inputOptions => {
4479 if (params.input === 'select') {
4480 populateSelectOptions(popup, formatInputOptions(inputOptions), params);
4481 } else if (params.input === 'radio') {
4482 populateRadioOptions(popup, formatInputOptions(inputOptions), params);
4483 }
4484 };
4485 if (hasToPromiseFn(params.inputOptions) || isPromise(params.inputOptions)) {
4486 showLoading(getConfirmButton());
4487 asPromise(params.inputOptions).then(inputOptions => {
4488 instance.hideLoading();
4489 processInputOptions(inputOptions);
4490 });
4491 } else if (typeof params.inputOptions === 'object') {
4492 processInputOptions(params.inputOptions);
4493 } else {
4494 error(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof params.inputOptions}`);
4495 }
4496 };
4497
4498 /**
4499 * @param {SweetAlert} instance
4500 * @param {SweetAlertOptions} params
4501 */
4502 const handleInputValue = (instance, params) => {
4503 const input = instance.getInput();
4504 if (!input) {
4505 return;
4506 }
4507 hide(input);
4508 asPromise(params.inputValue).then(inputValue => {
4509 input.value = params.input === 'number' ? `${parseFloat(inputValue) || 0}` : `${inputValue}`;
4510 show(input);
4511 input.focus();
4512 instance.hideLoading();
4513 }).catch(err => {
4514 error(`Error in inputValue promise: ${err}`);
4515 input.value = '';
4516 show(input);
4517 input.focus();
4518 instance.hideLoading();
4519 });
4520 };
4521
4522 /**
4523 * @param {HTMLElement} popup
4524 * @param {InputOptionFlattened[]} inputOptions
4525 * @param {SweetAlertOptions} params
4526 */
4527 function populateSelectOptions(popup, inputOptions, params) {
4528 const select = getDirectChildByClass(popup, swalClasses.select);
4529 if (!select) {
4530 return;
4531 }
4532 /**
4533 * @param {HTMLElement} parent
4534 * @param {string} optionLabel
4535 * @param {string} optionValue
4536 */
4537 const renderOption = (parent, optionLabel, optionValue) => {
4538 const option = document.createElement('option');
4539 option.value = optionValue;
4540 setInnerHtml(option, optionLabel);
4541 option.selected = isSelected(optionValue, params.inputValue);
4542 parent.appendChild(option);
4543 };
4544 inputOptions.forEach(inputOption => {
4545 const optionValue = inputOption[0];
4546 const optionLabel = inputOption[1];
4547 // <optgroup> spec:
4548 // https://www.w3.org/TR/html401/interact/forms.html#h-17.6
4549 // "...all OPTGROUP elements must be specified directly within a SELECT element (i.e., groups may not be nested)..."
4550 // check whether this is a <optgroup>
4551 if (Array.isArray(optionLabel)) {
4552 // if it is an array, then it is an <optgroup>
4553 const optgroup = document.createElement('optgroup');
4554 optgroup.label = optionValue;
4555 optgroup.disabled = false; // not configurable for now
4556 select.appendChild(optgroup);
4557 optionLabel.forEach(o => renderOption(optgroup, o[1], o[0]));
4558 } else {
4559 // case of <option>
4560 renderOption(select, optionLabel, optionValue);
4561 }
4562 });
4563 select.focus();
4564 }
4565
4566 /**
4567 * @param {HTMLElement} popup
4568 * @param {InputOptionFlattened[]} inputOptions
4569 * @param {SweetAlertOptions} params
4570 */
4571 function populateRadioOptions(popup, inputOptions, params) {
4572 const radio = getDirectChildByClass(popup, swalClasses.radio);
4573 if (!radio) {
4574 return;
4575 }
4576 inputOptions.forEach(inputOption => {
4577 const radioValue = inputOption[0];
4578 const radioLabel = inputOption[1];
4579 const radioInput = document.createElement('input');
4580 const radioLabelElement = document.createElement('label');
4581 radioInput.type = 'radio';
4582 radioInput.name = swalClasses.radio;
4583 radioInput.value = radioValue;
4584 if (isSelected(radioValue, params.inputValue)) {
4585 radioInput.checked = true;
4586 }
4587 const label = document.createElement('span');
4588 setInnerHtml(label, radioLabel);
4589 label.className = swalClasses.label;
4590 radioLabelElement.appendChild(radioInput);
4591 radioLabelElement.appendChild(label);
4592 radio.appendChild(radioLabelElement);
4593 });
4594 const radios = radio.querySelectorAll('input');
4595 if (radios.length) {
4596 radios[0].focus();
4597 }
4598 }
4599
4600 /**
4601 * Converts `inputOptions` into an array of `[value, label]`s
4602 *
4603 * @param {*} inputOptions
4604 * @typedef {string[]} InputOptionFlattened
4605 * @returns {InputOptionFlattened[]}
4606 */
4607 const formatInputOptions = inputOptions => {
4608 /** @type {InputOptionFlattened[]} */
4609 const result = [];
4610 if (inputOptions instanceof Map) {
4611 inputOptions.forEach((value, key) => {
4612 let valueFormatted = value;
4613 if (typeof valueFormatted === 'object') {
4614 // case of <optgroup>
4615 valueFormatted = formatInputOptions(valueFormatted);
4616 }
4617 result.push([key, valueFormatted]);
4618 });
4619 } else {
4620 Object.keys(inputOptions).forEach(key => {
4621 let valueFormatted = inputOptions[key];
4622 if (typeof valueFormatted === 'object') {
4623 // case of <optgroup>
4624 valueFormatted = formatInputOptions(valueFormatted);
4625 }
4626 result.push([key, valueFormatted]);
4627 });
4628 }
4629 return result;
4630 };
4631
4632 /**
4633 * @param {string} optionValue
4634 * @param {SweetAlertInputValue} inputValue
4635 * @returns {boolean}
4636 */
4637 const isSelected = (optionValue, inputValue) => {
4638 return Boolean(inputValue) && inputValue !== null && inputValue !== undefined && inputValue.toString() === optionValue.toString();
4639 };
4640
4641 /**
4642 * @param {SweetAlert} instance
4643 */
4644 const handleConfirmButtonClick = instance => {
4645 const innerParams = privateProps.innerParams.get(instance);
4646 instance.disableButtons();
4647 if (innerParams.input) {
4648 handleConfirmOrDenyWithInput(instance, 'confirm');
4649 } else {
4650 confirm(instance, true);
4651 }
4652 };
4653
4654 /**
4655 * @param {SweetAlert} instance
4656 */
4657 const handleDenyButtonClick = instance => {
4658 const innerParams = privateProps.innerParams.get(instance);
4659 instance.disableButtons();
4660 if (innerParams.returnInputValueOnDeny) {
4661 handleConfirmOrDenyWithInput(instance, 'deny');
4662 } else {
4663 deny(instance, false);
4664 }
4665 };
4666
4667 /**
4668 * @param {SweetAlert} instance
4669 * @param {(dismiss: DismissReason) => void} dismissWith
4670 */
4671 const handleCancelButtonClick = (instance, dismissWith) => {
4672 instance.disableButtons();
4673 dismissWith(DismissReason.cancel);
4674 };
4675
4676 /**
4677 * @param {SweetAlert} instance
4678 * @param {'confirm' | 'deny'} type
4679 */
4680 const handleConfirmOrDenyWithInput = (instance, type) => {
4681 const innerParams = privateProps.innerParams.get(instance);
4682 if (!innerParams.input) {
4683 error(`The "input" parameter is needed to be set when using returnInputValueOn${capitalizeFirstLetter(type)}`);
4684 return;
4685 }
4686 const input = instance.getInput();
4687 const inputValue = getInputValue(instance, innerParams);
4688 if (innerParams.inputValidator) {
4689 handleInputValidator(instance, inputValue, type);
4690 } else if (input && !input.checkValidity()) {
4691 instance.enableButtons();
4692 instance.showValidationMessage(innerParams.validationMessage || input.validationMessage);
4693 } else if (type === 'deny') {
4694 deny(instance, inputValue);
4695 } else {
4696 confirm(instance, inputValue);
4697 }
4698 };
4699
4700 /**
4701 * @param {SweetAlert} instance
4702 * @param {SweetAlertInputValue} inputValue
4703 * @param {'confirm' | 'deny'} type
4704 */
4705 const handleInputValidator = (instance, inputValue, type) => {
4706 const innerParams = privateProps.innerParams.get(instance);
4707 instance.disableInput();
4708 const validationPromise = Promise.resolve().then(() => asPromise(innerParams.inputValidator(inputValue, innerParams.validationMessage)));
4709 validationPromise.then(validationMessage => {
4710 instance.enableButtons();
4711 instance.enableInput();
4712 if (validationMessage) {
4713 instance.showValidationMessage(validationMessage);
4714 } else if (type === 'deny') {
4715 deny(instance, inputValue);
4716 } else {
4717 confirm(instance, inputValue);
4718 }
4719 });
4720 };
4721
4722 /**
4723 * @param {SweetAlert} instance
4724 * @param {*} value
4725 */
4726 const deny = (instance, value) => {
4727 const innerParams = privateProps.innerParams.get(instance);
4728 if (innerParams.showLoaderOnDeny) {
4729 showLoading(getDenyButton());
4730 }
4731 if (innerParams.preDeny) {
4732 instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preDeny's promise is received
4733 const preDenyPromise = Promise.resolve().then(() => asPromise(innerParams.preDeny(value, innerParams.validationMessage)));
4734 preDenyPromise.then(preDenyValue => {
4735 if (preDenyValue === false) {
4736 instance.hideLoading();
4737 handleAwaitingPromise(instance);
4738 } else {
4739 instance.close(/** @type SweetAlertResult */{
4740 isDenied: true,
4741 value: typeof preDenyValue === 'undefined' ? value : preDenyValue
4742 });
4743 }
4744 }).catch(error => rejectWith(instance, error));
4745 } else {
4746 instance.close(/** @type SweetAlertResult */{
4747 isDenied: true,
4748 value
4749 });
4750 }
4751 };
4752
4753 /**
4754 * @param {SweetAlert} instance
4755 * @param {*} value
4756 */
4757 const succeedWith = (instance, value) => {
4758 instance.close(/** @type SweetAlertResult */{
4759 isConfirmed: true,
4760 value
4761 });
4762 };
4763
4764 /**
4765 *
4766 * @param {SweetAlert} instance
4767 * @param {string} error
4768 */
4769 const rejectWith = (instance, error) => {
4770 instance.rejectPromise(error);
4771 };
4772
4773 /**
4774 *
4775 * @param {SweetAlert} instance
4776 * @param {*} value
4777 */
4778 const confirm = (instance, value) => {
4779 const innerParams = privateProps.innerParams.get(instance);
4780 if (innerParams.showLoaderOnConfirm) {
4781 showLoading();
4782 }
4783 if (innerParams.preConfirm) {
4784 instance.resetValidationMessage();
4785 instance.isAwaitingPromise = true; // Flagging the instance as awaiting a promise so it's own promise's reject/resolve methods doesn't get destroyed until the result from this preConfirm's promise is received
4786 const preConfirmPromise = Promise.resolve().then(() => asPromise(innerParams.preConfirm(value, innerParams.validationMessage)));
4787 preConfirmPromise.then(preConfirmValue => {
4788 if (isVisible$1(getValidationMessage()) || preConfirmValue === false) {
4789 instance.hideLoading();
4790 handleAwaitingPromise(instance);
4791 } else {
4792 succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue);
4793 }
4794 }).catch(error => rejectWith(instance, error));
4795 } else {
4796 succeedWith(instance, value);
4797 }
4798 };
4799
4800 /**
4801 * Hides loader and shows back the button which was hidden by .showLoading()
4802 * @this {SweetAlert}
4803 */
4804 function hideLoading() {
4805 // do nothing if popup is closed
4806 const innerParams = privateProps.innerParams.get(this);
4807 if (!innerParams) {
4808 return;
4809 }
4810 const domCache = privateProps.domCache.get(this);
4811 hide(domCache.loader);
4812 if (isToast()) {
4813 if (innerParams.icon) {
4814 show(getIcon());
4815 }
4816 } else {
4817 showRelatedButton(domCache);
4818 }
4819 removeClass([domCache.popup, domCache.actions], swalClasses.loading);
4820 domCache.popup.removeAttribute('aria-busy');
4821 domCache.popup.removeAttribute('data-loading');
4822 domCache.confirmButton.disabled = false;
4823 domCache.denyButton.disabled = false;
4824 domCache.cancelButton.disabled = false;
4825 }
4826
4827 /**
4828 * @param {DomCache} domCache
4829 */
4830 const showRelatedButton = domCache => {
4831 const dataButtonToReplace = domCache.loader.getAttribute('data-button-to-replace');
4832 const buttonToReplace = dataButtonToReplace ? domCache.popup.getElementsByClassName(dataButtonToReplace) : [];
4833 if (buttonToReplace.length) {
4834 show(/** @type {HTMLElement} */buttonToReplace[0], 'inline-block');
4835 } else if (allButtonsAreHidden()) {
4836 hide(domCache.actions);
4837 }
4838 };
4839
4840 /**
4841 * Gets the input DOM node, this method works with input parameter.
4842 *
4843 * @returns {HTMLInputElement | null}
4844 * @this {SweetAlert}
4845 */
4846 function getInput() {
4847 const innerParams = privateProps.innerParams.get(this);
4848 const domCache = privateProps.domCache.get(this);
4849 if (!domCache) {
4850 return null;
4851 }
4852 return getInput$1(domCache.popup, innerParams.input);
4853 }
4854
4855 /**
4856 * @param {SweetAlert} instance
4857 * @param {string[]} buttons
4858 * @param {boolean} disabled
4859 */
4860 function setButtonsDisabled(instance, buttons, disabled) {
4861 const domCache = privateProps.domCache.get(instance);
4862 buttons.forEach(button => {
4863 domCache[button].disabled = disabled;
4864 });
4865 }
4866
4867 /**
4868 * @param {HTMLInputElement | null} input
4869 * @param {boolean} disabled
4870 */
4871 function setInputDisabled(input, disabled) {
4872 const popup = getPopup();
4873 if (!popup || !input) {
4874 return;
4875 }
4876 if (input.type === 'radio') {
4877 /** @type {NodeListOf<HTMLInputElement>} */
4878 const radios = popup.querySelectorAll(`[name="${swalClasses.radio}"]`);
4879 for (let i = 0; i < radios.length; i++) {
4880 radios[i].disabled = disabled;
4881 }
4882 } else {
4883 input.disabled = disabled;
4884 }
4885 }
4886
4887 /**
4888 * Enable all the buttons
4889 * @this {SweetAlert}
4890 */
4891 function enableButtons() {
4892 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], false);
4893 }
4894
4895 /**
4896 * Disable all the buttons
4897 * @this {SweetAlert}
4898 */
4899 function disableButtons() {
4900 setButtonsDisabled(this, ['confirmButton', 'denyButton', 'cancelButton'], true);
4901 }
4902
4903 /**
4904 * Enable the input field
4905 * @this {SweetAlert}
4906 */
4907 function enableInput() {
4908 setInputDisabled(this.getInput(), false);
4909 }
4910
4911 /**
4912 * Disable the input field
4913 * @this {SweetAlert}
4914 */
4915 function disableInput() {
4916 setInputDisabled(this.getInput(), true);
4917 }
4918
4919 /**
4920 * Show block with validation message
4921 *
4922 * @param {string} error
4923 * @this {SweetAlert}
4924 */
4925 function showValidationMessage(error) {
4926 const domCache = privateProps.domCache.get(this);
4927 const params = privateProps.innerParams.get(this);
4928 setInnerHtml(domCache.validationMessage, error);
4929 domCache.validationMessage.className = swalClasses['validation-message'];
4930 if (params.customClass && params.customClass.validationMessage) {
4931 addClass(domCache.validationMessage, params.customClass.validationMessage);
4932 }
4933 show(domCache.validationMessage);
4934 const input = this.getInput();
4935 if (input) {
4936 input.setAttribute('aria-invalid', 'true');
4937 input.setAttribute('aria-describedby', swalClasses['validation-message']);
4938 focusInput(input);
4939 addClass(input, swalClasses.inputerror);
4940 }
4941 }
4942
4943 /**
4944 * Hide block with validation message
4945 *
4946 * @this {SweetAlert}
4947 */
4948 function resetValidationMessage() {
4949 const domCache = privateProps.domCache.get(this);
4950 if (domCache.validationMessage) {
4951 hide(domCache.validationMessage);
4952 }
4953 const input = this.getInput();
4954 if (input) {
4955 input.removeAttribute('aria-invalid');
4956 input.removeAttribute('aria-describedby');
4957 removeClass(input, swalClasses.inputerror);
4958 }
4959 }
4960
4961 const defaultParams = {
4962 title: '',
4963 titleText: '',
4964 text: '',
4965 html: '',
4966 footer: '',
4967 icon: undefined,
4968 iconColor: undefined,
4969 iconHtml: undefined,
4970 template: undefined,
4971 toast: false,
4972 draggable: false,
4973 animation: true,
4974 theme: 'light',
4975 showClass: {
4976 popup: 'swal2-show',
4977 backdrop: 'swal2-backdrop-show',
4978 icon: 'swal2-icon-show'
4979 },
4980 hideClass: {
4981 popup: 'swal2-hide',
4982 backdrop: 'swal2-backdrop-hide',
4983 icon: 'swal2-icon-hide'
4984 },
4985 customClass: {},
4986 target: 'body',
4987 color: undefined,
4988 backdrop: true,
4989 heightAuto: true,
4990 allowOutsideClick: true,
4991 allowEscapeKey: true,
4992 allowEnterKey: true,
4993 stopKeydownPropagation: true,
4994 keydownListenerCapture: false,
4995 showConfirmButton: true,
4996 showDenyButton: false,
4997 showCancelButton: false,
4998 preConfirm: undefined,
4999 preDeny: undefined,
5000 confirmButtonText: 'OK',
5001 confirmButtonAriaLabel: '',
5002 confirmButtonColor: undefined,
5003 denyButtonText: 'No',
5004 denyButtonAriaLabel: '',
5005 denyButtonColor: undefined,
5006 cancelButtonText: 'Cancel',
5007 cancelButtonAriaLabel: '',
5008 cancelButtonColor: undefined,
5009 buttonsStyling: true,
5010 reverseButtons: false,
5011 focusConfirm: true,
5012 focusDeny: false,
5013 focusCancel: false,
5014 returnFocus: true,
5015 showCloseButton: false,
5016 closeButtonHtml: '&times;',
5017 closeButtonAriaLabel: 'Close this dialog',
5018 loaderHtml: '',
5019 showLoaderOnConfirm: false,
5020 showLoaderOnDeny: false,
5021 imageUrl: undefined,
5022 imageWidth: undefined,
5023 imageHeight: undefined,
5024 imageAlt: '',
5025 timer: undefined,
5026 timerProgressBar: false,
5027 width: undefined,
5028 padding: undefined,
5029 background: undefined,
5030 input: undefined,
5031 inputPlaceholder: '',
5032 inputLabel: '',
5033 inputValue: '',
5034 inputOptions: {},
5035 inputAutoFocus: true,
5036 inputAutoTrim: true,
5037 inputAttributes: {},
5038 inputValidator: undefined,
5039 returnInputValueOnDeny: false,
5040 validationMessage: undefined,
5041 grow: false,
5042 position: 'center',
5043 progressSteps: [],
5044 currentProgressStep: undefined,
5045 progressStepsDistance: undefined,
5046 willOpen: undefined,
5047 didOpen: undefined,
5048 didRender: undefined,
5049 willClose: undefined,
5050 didClose: undefined,
5051 didDestroy: undefined,
5052 scrollbarPadding: true,
5053 topLayer: false
5054 };
5055 const updatableParams = ['allowEscapeKey', 'allowOutsideClick', 'background', 'buttonsStyling', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonText', 'closeButtonAriaLabel', 'closeButtonHtml', 'color', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonText', 'currentProgressStep', 'customClass', 'denyButtonAriaLabel', 'denyButtonColor', 'denyButtonText', 'didClose', 'didDestroy', 'draggable', 'footer', 'hideClass', 'html', 'icon', 'iconColor', 'iconHtml', 'imageAlt', 'imageHeight', 'imageUrl', 'imageWidth', 'preConfirm', 'preDeny', 'progressSteps', 'returnFocus', 'reverseButtons', 'showCancelButton', 'showCloseButton', 'showConfirmButton', 'showDenyButton', 'text', 'title', 'titleText', 'theme', 'willClose'];
5056
5057 /** @type {Record<string, string | undefined>} */
5058 const deprecatedParams = {
5059 allowEnterKey: undefined
5060 };
5061 const toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'draggable', 'focusConfirm', 'focusDeny', 'focusCancel', 'returnFocus', 'heightAuto', 'keydownListenerCapture'];
5062
5063 /**
5064 * Is valid parameter
5065 *
5066 * @param {string} paramName
5067 * @returns {boolean}
5068 */
5069 const isValidParameter = paramName => {
5070 return Object.prototype.hasOwnProperty.call(defaultParams, paramName);
5071 };
5072
5073 /**
5074 * Is valid parameter for Swal.update() method
5075 *
5076 * @param {string} paramName
5077 * @returns {boolean}
5078 */
5079 const isUpdatableParameter = paramName => {
5080 return updatableParams.indexOf(paramName) !== -1;
5081 };
5082
5083 /**
5084 * Is deprecated parameter
5085 *
5086 * @param {string} paramName
5087 * @returns {string | undefined}
5088 */
5089 const isDeprecatedParameter = paramName => {
5090 return deprecatedParams[paramName];
5091 };
5092
5093 /**
5094 * @param {string} param
5095 */
5096 const checkIfParamIsValid = param => {
5097 if (!isValidParameter(param)) {
5098 warn(`Unknown parameter "${param}"`);
5099 }
5100 };
5101
5102 /**
5103 * @param {string} param
5104 */
5105 const checkIfToastParamIsValid = param => {
5106 if (toastIncompatibleParams.includes(param)) {
5107 warn(`The parameter "${param}" is incompatible with toasts`);
5108 }
5109 };
5110
5111 /**
5112 * @param {string} param
5113 */
5114 const checkIfParamIsDeprecated = param => {
5115 const isDeprecated = isDeprecatedParameter(param);
5116 if (isDeprecated) {
5117 warnAboutDeprecation(param, isDeprecated);
5118 }
5119 };
5120
5121 /**
5122 * Show relevant warnings for given params
5123 *
5124 * @param {SweetAlertOptions} params
5125 */
5126 const showWarningsForParams = params => {
5127 if (params.backdrop === false && params.allowOutsideClick) {
5128 warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');
5129 }
5130 if (params.theme && !['light', 'dark', 'auto', 'minimal', 'borderless', 'bootstrap-4', 'bootstrap-4-light', 'bootstrap-4-dark', 'bootstrap-5', 'bootstrap-5-light', 'bootstrap-5-dark', 'material-ui', 'material-ui-light', 'material-ui-dark', 'embed-iframe', 'bulma', 'bulma-light', 'bulma-dark'].includes(params.theme)) {
5131 warn(`Invalid theme "${params.theme}"`);
5132 }
5133 for (const param in params) {
5134 checkIfParamIsValid(param);
5135 if (params.toast) {
5136 checkIfToastParamIsValid(param);
5137 }
5138 checkIfParamIsDeprecated(param);
5139 }
5140 };
5141
5142 /**
5143 * Updates popup parameters.
5144 *
5145 * @this {any}
5146 * @param {SweetAlertOptions} params
5147 */
5148 function update(params) {
5149 const container = getContainer();
5150 const popup = getPopup();
5151 const innerParams = privateProps.innerParams.get(this);
5152 if (!popup || hasClass(popup, innerParams.hideClass.popup)) {
5153 warn(`You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.`);
5154 return;
5155 }
5156 const validUpdatableParams = filterValidParams(params);
5157 const updatedParams = Object.assign({}, innerParams, validUpdatableParams);
5158 showWarningsForParams(updatedParams);
5159 if (container) {
5160 container.dataset['swal2Theme'] = updatedParams.theme;
5161 }
5162 render(this, updatedParams);
5163 privateProps.innerParams.set(this, updatedParams);
5164 Object.defineProperties(this, {
5165 params: {
5166 value: Object.assign({}, this.params, params),
5167 writable: false,
5168 enumerable: true
5169 }
5170 });
5171 }
5172
5173 /**
5174 * @param {SweetAlertOptions} params
5175 * @returns {SweetAlertOptions}
5176 */
5177 const filterValidParams = params => {
5178 /** @type {Record<string, any>} */
5179 const validUpdatableParams = {};
5180 Object.keys(params).forEach(param => {
5181 if (isUpdatableParameter(param)) {
5182 const typedParams = /** @type {Record<string, any>} */params;
5183 validUpdatableParams[param] = typedParams[param];
5184 } else {
5185 warn(`Invalid parameter to update: ${param}`);
5186 }
5187 });
5188 return validUpdatableParams;
5189 };
5190
5191 /**
5192 * Dispose the current SweetAlert2 instance
5193 * @this {SweetAlert}
5194 */
5195 function _destroy() {
5196 var _globalState$eventEmi;
5197 const domCache = privateProps.domCache.get(this);
5198 const innerParams = privateProps.innerParams.get(this);
5199 if (!innerParams) {
5200 disposeWeakMaps(this); // The WeakMaps might have been partly destroyed, we must recall it to dispose any remaining WeakMaps #2335
5201 return; // This instance has already been destroyed
5202 }
5203
5204 // Check if there is another Swal closing
5205 if (domCache.popup && globalState.swalCloseEventFinishedCallback) {
5206 globalState.swalCloseEventFinishedCallback();
5207 delete globalState.swalCloseEventFinishedCallback;
5208 }
5209 if (typeof innerParams.didDestroy === 'function') {
5210 innerParams.didDestroy();
5211 }
5212 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('didDestroy');
5213 disposeSwal(this);
5214 }
5215
5216 /**
5217 * @param {SweetAlert} instance
5218 */
5219 const disposeSwal = instance => {
5220 disposeWeakMaps(instance);
5221 // Unset this.params so GC will dispose it (#1569)
5222 // @ts-ignore
5223 delete instance.params;
5224 // Unset globalState props so GC will dispose globalState (#1569)
5225 delete globalState.keydownHandler;
5226 delete globalState.keydownTarget;
5227 // Unset currentInstance
5228 delete globalState.currentInstance;
5229 };
5230
5231 /**
5232 * @param {SweetAlert} instance
5233 */
5234 const disposeWeakMaps = instance => {
5235 // If the current instance is awaiting a promise result, we keep the privateMethods to call them once the promise result is retrieved #2335
5236 if (instance.isAwaitingPromise) {
5237 unsetWeakMaps(privateProps, instance);
5238 instance.isAwaitingPromise = true;
5239 } else {
5240 unsetWeakMaps(privateMethods, instance);
5241 unsetWeakMaps(privateProps, instance);
5242
5243 // @ts-ignore
5244 delete instance.isAwaitingPromise;
5245 // Unset instance methods
5246 // @ts-ignore
5247 delete instance.disableButtons;
5248 // @ts-ignore
5249 delete instance.enableButtons;
5250 // @ts-ignore
5251 delete instance.getInput;
5252 // @ts-ignore
5253 delete instance.disableInput;
5254 // @ts-ignore
5255 delete instance.enableInput;
5256 // @ts-ignore
5257 delete instance.hideLoading;
5258 // @ts-ignore
5259 delete instance.disableLoading;
5260 // @ts-ignore
5261 delete instance.showValidationMessage;
5262 // @ts-ignore
5263 delete instance.resetValidationMessage;
5264 // @ts-ignore
5265 delete instance.close;
5266 // @ts-ignore
5267 delete instance.closePopup;
5268 // @ts-ignore
5269 delete instance.closeModal;
5270 // @ts-ignore
5271 delete instance.closeToast;
5272 // @ts-ignore
5273 delete instance.rejectPromise;
5274 // @ts-ignore
5275 delete instance.update;
5276 // @ts-ignore
5277 delete instance._destroy;
5278 }
5279 };
5280
5281 /**
5282 * @param {Record<string, WeakMap<any, any>>} obj
5283 * @param {SweetAlert} instance
5284 */
5285 const unsetWeakMaps = (obj, instance) => {
5286 for (const i in obj) {
5287 obj[i].delete(instance);
5288 }
5289 };
5290
5291 var instanceMethods = /*#__PURE__*/Object.freeze({
5292 __proto__: null,
5293 _destroy: _destroy,
5294 close: close,
5295 closeModal: close,
5296 closePopup: close,
5297 closeToast: close,
5298 disableButtons: disableButtons,
5299 disableInput: disableInput,
5300 disableLoading: hideLoading,
5301 enableButtons: enableButtons,
5302 enableInput: enableInput,
5303 getInput: getInput,
5304 handleAwaitingPromise: handleAwaitingPromise,
5305 hideLoading: hideLoading,
5306 rejectPromise: rejectPromise,
5307 resetValidationMessage: resetValidationMessage,
5308 showValidationMessage: showValidationMessage,
5309 update: update
5310 });
5311
5312 /**
5313 * @param {SweetAlertOptions} innerParams
5314 * @param {DomCache} domCache
5315 * @param {(dismiss: DismissReason) => void} dismissWith
5316 */
5317 const handlePopupClick = (innerParams, domCache, dismissWith) => {
5318 if (innerParams.toast) {
5319 handleToastClick(innerParams, domCache, dismissWith);
5320 } else {
5321 // Ignore click events that had mousedown on the popup but mouseup on the container
5322 // This can happen when the user drags a slider
5323 handleModalMousedown(domCache);
5324
5325 // Ignore click events that had mousedown on the container but mouseup on the popup
5326 handleContainerMousedown(domCache);
5327 handleModalClick(innerParams, domCache, dismissWith);
5328 }
5329 };
5330
5331 /**
5332 * @param {SweetAlertOptions} innerParams
5333 * @param {DomCache} domCache
5334 * @param {(dismiss: DismissReason) => void} dismissWith
5335 */
5336 const handleToastClick = (innerParams, domCache, dismissWith) => {
5337 // Closing toast by internal click
5338 domCache.popup.onclick = () => {
5339 if (innerParams && (isAnyButtonShown(innerParams) || innerParams.timer || innerParams.input)) {
5340 return;
5341 }
5342 dismissWith(DismissReason.close);
5343 };
5344 };
5345
5346 /**
5347 * @param {SweetAlertOptions} innerParams
5348 * @returns {boolean}
5349 */
5350 const isAnyButtonShown = innerParams => {
5351 return Boolean(innerParams.showConfirmButton || innerParams.showDenyButton || innerParams.showCancelButton || innerParams.showCloseButton);
5352 };
5353 let ignoreOutsideClick = false;
5354
5355 /**
5356 * @param {DomCache} domCache
5357 */
5358 const handleModalMousedown = domCache => {
5359 domCache.popup.onmousedown = () => {
5360 domCache.container.onmouseup = function (e) {
5361 domCache.container.onmouseup = () => {};
5362 // We only check if the mouseup target is the container because usually it doesn't
5363 // have any other direct children aside of the popup
5364 if (e.target === domCache.container) {
5365 ignoreOutsideClick = true;
5366 }
5367 };
5368 };
5369 };
5370
5371 /**
5372 * @param {DomCache} domCache
5373 */
5374 const handleContainerMousedown = domCache => {
5375 domCache.container.onmousedown = e => {
5376 // prevent the modal text from being selected on double click on the container (allowOutsideClick: false)
5377 if (e.target === domCache.container) {
5378 e.preventDefault();
5379 }
5380 domCache.popup.onmouseup = function (e) {
5381 domCache.popup.onmouseup = () => {};
5382 // We also need to check if the mouseup target is a child of the popup
5383 if (e.target === domCache.popup || e.target instanceof HTMLElement && domCache.popup.contains(e.target)) {
5384 ignoreOutsideClick = true;
5385 }
5386 };
5387 };
5388 };
5389
5390 /**
5391 * @param {SweetAlertOptions} innerParams
5392 * @param {DomCache} domCache
5393 * @param {(dismiss: DismissReason) => void} dismissWith
5394 */
5395 const handleModalClick = (innerParams, domCache, dismissWith) => {
5396 domCache.container.onclick = e => {
5397 if (ignoreOutsideClick) {
5398 ignoreOutsideClick = false;
5399 return;
5400 }
5401 if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) {
5402 dismissWith(DismissReason.backdrop);
5403 }
5404 };
5405 };
5406
5407 /**
5408 * @param {any} elem
5409 * @returns {boolean}
5410 */
5411 const isJqueryElement = elem => typeof elem === 'object' && elem.jquery;
5412
5413 /**
5414 * @param {any} elem
5415 * @returns {boolean}
5416 */
5417 const isElement = elem => elem instanceof Element || isJqueryElement(elem);
5418
5419 /**
5420 * @param {any[]} args
5421 * @returns {SweetAlertOptions}
5422 */
5423 const argsToParams = args => {
5424 /** @type {Record<string, any>} */
5425 const params = {};
5426 if (typeof args[0] === 'object' && !isElement(args[0])) {
5427 Object.assign(params, args[0]);
5428 } else {
5429 ['title', 'html', 'icon'].forEach((name, index) => {
5430 const arg = args[index];
5431 if (typeof arg === 'string' || isElement(arg)) {
5432 params[name] = arg;
5433 } else if (arg !== undefined) {
5434 error(`Unexpected type of ${name}! Expected "string" or "Element", got ${typeof arg}`);
5435 }
5436 });
5437 }
5438 return params;
5439 };
5440
5441 /**
5442 * Main method to create a new SweetAlert2 popup
5443 *
5444 * @this {new (...args: any[]) => any}
5445 * @param {...SweetAlertOptions} args
5446 * @returns {Promise<SweetAlertResult>}
5447 */
5448 function fire(...args) {
5449 return new this(...args);
5450 }
5451
5452 /**
5453 * Returns an extended version of `Swal` containing `params` as defaults.
5454 * Useful for reusing Swal configuration.
5455 *
5456 * For example:
5457 *
5458 * Before:
5459 * const textPromptOptions = { input: 'text', showCancelButton: true }
5460 * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' })
5461 * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' })
5462 *
5463 * After:
5464 * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true })
5465 * const {value: firstName} = await TextPrompt('What is your first name?')
5466 * const {value: lastName} = await TextPrompt('What is your last name?')
5467 *
5468 * @param {SweetAlertOptions} mixinParams
5469 * @returns {SweetAlert}
5470 * @this {typeof import('../SweetAlert.js').SweetAlert}
5471 */
5472 function mixin(mixinParams) {
5473 // @ts-ignore: 'this' refers to the SweetAlert constructor
5474 class MixinSwal extends this {
5475 /**
5476 * @param {any} params
5477 * @param {any} priorityMixinParams
5478 */
5479 _main(params, priorityMixinParams) {
5480 return super._main(params, Object.assign({}, mixinParams, priorityMixinParams));
5481 }
5482 }
5483 // @ts-ignore
5484 return MixinSwal;
5485 }
5486
5487 /**
5488 * If `timer` parameter is set, returns number of milliseconds of timer remained.
5489 * Otherwise, returns undefined.
5490 *
5491 * @returns {number | undefined}
5492 */
5493 const getTimerLeft = () => {
5494 return globalState.timeout && globalState.timeout.getTimerLeft();
5495 };
5496
5497 /**
5498 * Stop timer. Returns number of milliseconds of timer remained.
5499 * If `timer` parameter isn't set, returns undefined.
5500 *
5501 * @returns {number | undefined}
5502 */
5503 const stopTimer = () => {
5504 if (globalState.timeout) {
5505 stopTimerProgressBar();
5506 return globalState.timeout.stop();
5507 }
5508 };
5509
5510 /**
5511 * Resume timer. Returns number of milliseconds of timer remained.
5512 * If `timer` parameter isn't set, returns undefined.
5513 *
5514 * @returns {number | undefined}
5515 */
5516 const resumeTimer = () => {
5517 if (globalState.timeout) {
5518 const remaining = globalState.timeout.start();
5519 animateTimerProgressBar(remaining);
5520 return remaining;
5521 }
5522 };
5523
5524 /**
5525 * Resume timer. Returns number of milliseconds of timer remained.
5526 * If `timer` parameter isn't set, returns undefined.
5527 *
5528 * @returns {number | undefined}
5529 */
5530 const toggleTimer = () => {
5531 const timer = globalState.timeout;
5532 return timer && (timer.running ? stopTimer() : resumeTimer());
5533 };
5534
5535 /**
5536 * Increase timer. Returns number of milliseconds of an updated timer.
5537 * If `timer` parameter isn't set, returns undefined.
5538 *
5539 * @param {number} ms
5540 * @returns {number | undefined}
5541 */
5542 const increaseTimer = ms => {
5543 if (globalState.timeout) {
5544 const remaining = globalState.timeout.increase(ms);
5545 animateTimerProgressBar(remaining, true);
5546 return remaining;
5547 }
5548 };
5549
5550 /**
5551 * Check if timer is running. Returns true if timer is running
5552 * or false if timer is paused or stopped.
5553 * If `timer` parameter isn't set, returns undefined
5554 *
5555 * @returns {boolean}
5556 */
5557 const isTimerRunning = () => {
5558 return Boolean(globalState.timeout && globalState.timeout.isRunning());
5559 };
5560
5561 let bodyClickListenerAdded = false;
5562 /** @type {Record<string, any>} */
5563 const clickHandlers = {};
5564
5565 /**
5566 * @this {any}
5567 * @param {string} attr
5568 */
5569 function bindClickHandler(attr = 'data-swal-template') {
5570 clickHandlers[attr] = this;
5571 if (!bodyClickListenerAdded) {
5572 document.body.addEventListener('click', bodyClickListener);
5573 bodyClickListenerAdded = true;
5574 }
5575 }
5576
5577 /**
5578 * @param {MouseEvent} event
5579 */
5580 const bodyClickListener = event => {
5581 for (let el = /** @type {any} */event.target; el && el !== document; el = el.parentNode) {
5582 for (const attr in clickHandlers) {
5583 const template = el.getAttribute && el.getAttribute(attr);
5584 if (template) {
5585 clickHandlers[attr].fire({
5586 template
5587 });
5588 return;
5589 }
5590 }
5591 }
5592 };
5593
5594 // Source: https://gist.github.com/mudge/5830382?permalink_comment_id=2691957#gistcomment-2691957
5595
5596 class EventEmitter {
5597 constructor() {
5598 /** @type {Events} */
5599 this.events = {};
5600 }
5601
5602 /**
5603 * @param {string} eventName
5604 * @returns {EventHandlers}
5605 */
5606 _getHandlersByEventName(eventName) {
5607 if (typeof this.events[eventName] === 'undefined') {
5608 // not Set because we need to keep the FIFO order
5609 // https://github.com/sweetalert2/sweetalert2/pull/2763#discussion_r1748990334
5610 this.events[eventName] = [];
5611 }
5612 return this.events[eventName];
5613 }
5614
5615 /**
5616 * @param {string} eventName
5617 * @param {EventHandler} eventHandler
5618 */
5619 on(eventName, eventHandler) {
5620 const currentHandlers = this._getHandlersByEventName(eventName);
5621 if (!currentHandlers.includes(eventHandler)) {
5622 currentHandlers.push(eventHandler);
5623 }
5624 }
5625
5626 /**
5627 * @param {string} eventName
5628 * @param {EventHandler} eventHandler
5629 */
5630 once(eventName, eventHandler) {
5631 /**
5632 * @param {...any} args
5633 */
5634 const onceFn = (...args) => {
5635 this.removeListener(eventName, onceFn);
5636 // @ts-ignore
5637 eventHandler.apply(this, args);
5638 };
5639 this.on(eventName, onceFn);
5640 }
5641
5642 /**
5643 * @param {string} eventName
5644 * @param {...any} args
5645 */
5646 emit(eventName, ...args) {
5647 this._getHandlersByEventName(eventName).forEach(
5648 /**
5649 * @param {EventHandler} eventHandler
5650 */
5651 eventHandler => {
5652 try {
5653 // @ts-ignore
5654 eventHandler.apply(this, args);
5655 } catch (error) {
5656 console.error(error);
5657 }
5658 });
5659 }
5660
5661 /**
5662 * @param {string} eventName
5663 * @param {EventHandler} eventHandler
5664 */
5665 removeListener(eventName, eventHandler) {
5666 const currentHandlers = this._getHandlersByEventName(eventName);
5667 const index = currentHandlers.indexOf(eventHandler);
5668 if (index > -1) {
5669 currentHandlers.splice(index, 1);
5670 }
5671 }
5672
5673 /**
5674 * @param {string} eventName
5675 */
5676 removeAllListeners(eventName) {
5677 if (this.events[eventName] !== undefined) {
5678 // https://github.com/sweetalert2/sweetalert2/pull/2763#discussion_r1749239222
5679 this.events[eventName].length = 0;
5680 }
5681 }
5682 reset() {
5683 this.events = {};
5684 }
5685 }
5686
5687 globalState.eventEmitter = new EventEmitter();
5688
5689 /**
5690 * @param {string} eventName
5691 * @param {EventHandler} eventHandler
5692 */
5693 const on = (eventName, eventHandler) => {
5694 if (globalState.eventEmitter) {
5695 globalState.eventEmitter.on(eventName, eventHandler);
5696 }
5697 };
5698
5699 /**
5700 * @param {string} eventName
5701 * @param {EventHandler} eventHandler
5702 */
5703 const once = (eventName, eventHandler) => {
5704 if (globalState.eventEmitter) {
5705 globalState.eventEmitter.once(eventName, eventHandler);
5706 }
5707 };
5708
5709 /**
5710 * @param {string} [eventName]
5711 * @param {EventHandler} [eventHandler]
5712 */
5713 const off = (eventName, eventHandler) => {
5714 if (!globalState.eventEmitter) {
5715 return;
5716 }
5717
5718 // Remove all handlers for all events
5719 if (!eventName) {
5720 globalState.eventEmitter.reset();
5721 return;
5722 }
5723 if (eventHandler) {
5724 // Remove a specific handler
5725 globalState.eventEmitter.removeListener(eventName, eventHandler);
5726 } else {
5727 // Remove all handlers for a specific event
5728 globalState.eventEmitter.removeAllListeners(eventName);
5729 }
5730 };
5731
5732 var staticMethods = /*#__PURE__*/Object.freeze({
5733 __proto__: null,
5734 argsToParams: argsToParams,
5735 bindClickHandler: bindClickHandler,
5736 clickCancel: clickCancel,
5737 clickConfirm: clickConfirm,
5738 clickDeny: clickDeny,
5739 enableLoading: showLoading,
5740 fire: fire,
5741 getActions: getActions,
5742 getCancelButton: getCancelButton,
5743 getCloseButton: getCloseButton,
5744 getConfirmButton: getConfirmButton,
5745 getContainer: getContainer,
5746 getDenyButton: getDenyButton,
5747 getFocusableElements: getFocusableElements,
5748 getFooter: getFooter,
5749 getHtmlContainer: getHtmlContainer,
5750 getIcon: getIcon,
5751 getIconContent: getIconContent,
5752 getImage: getImage,
5753 getInputLabel: getInputLabel,
5754 getLoader: getLoader,
5755 getPopup: getPopup,
5756 getProgressSteps: getProgressSteps,
5757 getTimerLeft: getTimerLeft,
5758 getTimerProgressBar: getTimerProgressBar,
5759 getTitle: getTitle,
5760 getValidationMessage: getValidationMessage,
5761 increaseTimer: increaseTimer,
5762 isDeprecatedParameter: isDeprecatedParameter,
5763 isLoading: isLoading,
5764 isTimerRunning: isTimerRunning,
5765 isUpdatableParameter: isUpdatableParameter,
5766 isValidParameter: isValidParameter,
5767 isVisible: isVisible,
5768 mixin: mixin,
5769 off: off,
5770 on: on,
5771 once: once,
5772 resumeTimer: resumeTimer,
5773 showLoading: showLoading,
5774 stopTimer: stopTimer,
5775 toggleTimer: toggleTimer
5776 });
5777
5778 class Timer {
5779 /**
5780 * @param {() => void} callback
5781 * @param {number} delay
5782 */
5783 constructor(callback, delay) {
5784 this.callback = callback;
5785 this.remaining = delay;
5786 this.running = false;
5787 this.start();
5788 }
5789
5790 /**
5791 * @returns {number}
5792 */
5793 start() {
5794 if (!this.running) {
5795 this.running = true;
5796 this.started = new Date();
5797 this.id = setTimeout(this.callback, this.remaining);
5798 }
5799 return this.remaining;
5800 }
5801
5802 /**
5803 * @returns {number}
5804 */
5805 stop() {
5806 if (this.started && this.running) {
5807 this.running = false;
5808 clearTimeout(this.id);
5809 this.remaining -= new Date().getTime() - this.started.getTime();
5810 }
5811 return this.remaining;
5812 }
5813
5814 /**
5815 * @param {number} n
5816 * @returns {number}
5817 */
5818 increase(n) {
5819 const running = this.running;
5820 if (running) {
5821 this.stop();
5822 }
5823 this.remaining += n;
5824 if (running) {
5825 this.start();
5826 }
5827 return this.remaining;
5828 }
5829
5830 /**
5831 * @returns {number}
5832 */
5833 getTimerLeft() {
5834 if (this.running) {
5835 this.stop();
5836 this.start();
5837 }
5838 return this.remaining;
5839 }
5840
5841 /**
5842 * @returns {boolean}
5843 */
5844 isRunning() {
5845 return this.running;
5846 }
5847 }
5848
5849 const swalStringParams = ['swal-title', 'swal-html', 'swal-footer'];
5850
5851 /**
5852 * @param {SweetAlertOptions} params
5853 * @returns {SweetAlertOptions}
5854 */
5855 const getTemplateParams = params => {
5856 const template = typeof params.template === 'string' ? (/** @type {HTMLTemplateElement} */document.querySelector(params.template)) : params.template;
5857 if (!template) {
5858 return {};
5859 }
5860 /** @type {DocumentFragment} */
5861 const templateContent = template.content;
5862 showWarningsForElements(templateContent);
5863 const result = Object.assign(getSwalParams(templateContent), getSwalFunctionParams(templateContent), getSwalButtons(templateContent), getSwalImage(templateContent), getSwalIcon(templateContent), getSwalInput(templateContent), getSwalStringParams(templateContent, swalStringParams));
5864 return result;
5865 };
5866
5867 /**
5868 * @param {DocumentFragment} templateContent
5869 * @returns {Record<string, string | boolean | number>}
5870 */
5871 const getSwalParams = templateContent => {
5872 /** @type {Record<string, string | boolean | number>} */
5873 const result = {};
5874 /** @type {HTMLElement[]} */
5875 const swalParams = Array.from(templateContent.querySelectorAll('swal-param'));
5876 swalParams.forEach(param => {
5877 showWarningsForAttributes(param, ['name', 'value']);
5878 const paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
5879 const value = param.getAttribute('value');
5880 if (!paramName || !value) {
5881 return;
5882 }
5883 if (paramName in defaultParams && typeof defaultParams[(/** @type {keyof typeof defaultParams} */paramName)] === 'boolean') {
5884 result[paramName] = value !== 'false';
5885 } else if (paramName in defaultParams && typeof defaultParams[(/** @type {keyof typeof defaultParams} */paramName)] === 'object') {
5886 result[paramName] = JSON.parse(value);
5887 } else {
5888 result[paramName] = value;
5889 }
5890 });
5891 return result;
5892 };
5893
5894 /**
5895 * @param {DocumentFragment} templateContent
5896 * @returns {Record<string, () => void>}
5897 */
5898 const getSwalFunctionParams = templateContent => {
5899 /** @type {Record<string, () => void>} */
5900 const result = {};
5901 /** @type {HTMLElement[]} */
5902 const swalFunctions = Array.from(templateContent.querySelectorAll('swal-function-param'));
5903 swalFunctions.forEach(param => {
5904 const paramName = /** @type {keyof SweetAlertOptions} */param.getAttribute('name');
5905 const value = param.getAttribute('value');
5906 if (!paramName || !value) {
5907 return;
5908 }
5909 result[paramName] = new Function(`return ${value}`)();
5910 });
5911 return result;
5912 };
5913
5914 /**
5915 * @param {DocumentFragment} templateContent
5916 * @returns {Record<string, string | boolean>}
5917 */
5918 const getSwalButtons = templateContent => {
5919 /** @type {Record<string, string | boolean>} */
5920 const result = {};
5921 /** @type {HTMLElement[]} */
5922 const swalButtons = Array.from(templateContent.querySelectorAll('swal-button'));
5923 swalButtons.forEach(button => {
5924 showWarningsForAttributes(button, ['type', 'color', 'aria-label']);
5925 const type = button.getAttribute('type');
5926 if (!type || !['confirm', 'cancel', 'deny'].includes(type)) {
5927 return;
5928 }
5929 result[`${type}ButtonText`] = button.innerHTML;
5930 result[`show${capitalizeFirstLetter(type)}Button`] = true;
5931 if (button.hasAttribute('color')) {
5932 const color = button.getAttribute('color');
5933 if (color !== null) {
5934 result[`${type}ButtonColor`] = color;
5935 }
5936 }
5937 if (button.hasAttribute('aria-label')) {
5938 const ariaLabel = button.getAttribute('aria-label');
5939 if (ariaLabel !== null) {
5940 result[`${type}ButtonAriaLabel`] = ariaLabel;
5941 }
5942 }
5943 });
5944 return result;
5945 };
5946
5947 /**
5948 * @param {DocumentFragment} templateContent
5949 * @returns {Pick<SweetAlertOptions, 'imageUrl' | 'imageWidth' | 'imageHeight' | 'imageAlt'>}
5950 */
5951 const getSwalImage = templateContent => {
5952 const result = {};
5953 /** @type {HTMLElement | null} */
5954 const image = templateContent.querySelector('swal-image');
5955 if (image) {
5956 showWarningsForAttributes(image, ['src', 'width', 'height', 'alt']);
5957 if (image.hasAttribute('src')) {
5958 result.imageUrl = image.getAttribute('src') || undefined;
5959 }
5960 if (image.hasAttribute('width')) {
5961 result.imageWidth = image.getAttribute('width') || undefined;
5962 }
5963 if (image.hasAttribute('height')) {
5964 result.imageHeight = image.getAttribute('height') || undefined;
5965 }
5966 if (image.hasAttribute('alt')) {
5967 result.imageAlt = image.getAttribute('alt') || undefined;
5968 }
5969 }
5970 return result;
5971 };
5972
5973 /**
5974 * @param {DocumentFragment} templateContent
5975 * @returns {object}
5976 */
5977 const getSwalIcon = templateContent => {
5978 const result = {};
5979 /** @type {HTMLElement | null} */
5980 const icon = templateContent.querySelector('swal-icon');
5981 if (icon) {
5982 showWarningsForAttributes(icon, ['type', 'color']);
5983 if (icon.hasAttribute('type')) {
5984 result.icon = icon.getAttribute('type');
5985 }
5986 if (icon.hasAttribute('color')) {
5987 result.iconColor = icon.getAttribute('color');
5988 }
5989 result.iconHtml = icon.innerHTML;
5990 }
5991 return result;
5992 };
5993
5994 /**
5995 * @param {DocumentFragment} templateContent
5996 * @returns {object}
5997 */
5998 const getSwalInput = templateContent => {
5999 /** @type {Record<string, any>} */
6000 const result = {};
6001 /** @type {HTMLElement | null} */
6002 const input = templateContent.querySelector('swal-input');
6003 if (input) {
6004 showWarningsForAttributes(input, ['type', 'label', 'placeholder', 'value']);
6005 result.input = input.getAttribute('type') || 'text';
6006 if (input.hasAttribute('label')) {
6007 result.inputLabel = input.getAttribute('label');
6008 }
6009 if (input.hasAttribute('placeholder')) {
6010 result.inputPlaceholder = input.getAttribute('placeholder');
6011 }
6012 if (input.hasAttribute('value')) {
6013 result.inputValue = input.getAttribute('value');
6014 }
6015 }
6016 /** @type {HTMLElement[]} */
6017 const inputOptions = Array.from(templateContent.querySelectorAll('swal-input-option'));
6018 if (inputOptions.length) {
6019 result.inputOptions = {};
6020 inputOptions.forEach(option => {
6021 showWarningsForAttributes(option, ['value']);
6022 const optionValue = option.getAttribute('value');
6023 if (!optionValue) {
6024 return;
6025 }
6026 const optionName = option.innerHTML;
6027 result.inputOptions[optionValue] = optionName;
6028 });
6029 }
6030 return result;
6031 };
6032
6033 /**
6034 * @param {DocumentFragment} templateContent
6035 * @param {string[]} paramNames
6036 * @returns {Record<string, string>}
6037 */
6038 const getSwalStringParams = (templateContent, paramNames) => {
6039 /** @type {Record<string, string>} */
6040 const result = {};
6041 for (const i in paramNames) {
6042 const paramName = paramNames[i];
6043 /** @type {HTMLElement | null} */
6044 const tag = templateContent.querySelector(paramName);
6045 if (tag) {
6046 showWarningsForAttributes(tag, []);
6047 result[paramName.replace(/^swal-/, '')] = tag.innerHTML.trim();
6048 }
6049 }
6050 return result;
6051 };
6052
6053 /**
6054 * @param {DocumentFragment} templateContent
6055 */
6056 const showWarningsForElements = templateContent => {
6057 const allowedElements = swalStringParams.concat(['swal-param', 'swal-function-param', 'swal-button', 'swal-image', 'swal-icon', 'swal-input', 'swal-input-option']);
6058 Array.from(templateContent.children).forEach(el => {
6059 const tagName = el.tagName.toLowerCase();
6060 if (!allowedElements.includes(tagName)) {
6061 warn(`Unrecognized element <${tagName}>`);
6062 }
6063 });
6064 };
6065
6066 /**
6067 * @param {HTMLElement} el
6068 * @param {string[]} allowedAttributes
6069 */
6070 const showWarningsForAttributes = (el, allowedAttributes) => {
6071 Array.from(el.attributes).forEach(attribute => {
6072 if (allowedAttributes.indexOf(attribute.name) === -1) {
6073 warn([`Unrecognized attribute "${attribute.name}" on <${el.tagName.toLowerCase()}>.`, `${allowedAttributes.length ? `Allowed attributes are: ${allowedAttributes.join(', ')}` : 'To set the value, use HTML within the element.'}`]);
6074 }
6075 });
6076 };
6077
6078 const SHOW_CLASS_TIMEOUT = 10;
6079
6080 /**
6081 * Open popup, add necessary classes and styles, fix scrollbar
6082 *
6083 * @param {SweetAlertOptions} params
6084 */
6085 const openPopup = params => {
6086 var _globalState$eventEmi, _globalState$eventEmi2;
6087 const container = getContainer();
6088 const popup = getPopup();
6089 if (!container || !popup) {
6090 return;
6091 }
6092 if (typeof params.willOpen === 'function') {
6093 params.willOpen(popup);
6094 }
6095 (_globalState$eventEmi = globalState.eventEmitter) === null || _globalState$eventEmi === void 0 || _globalState$eventEmi.emit('willOpen', popup);
6096 const bodyStyles = window.getComputedStyle(document.body);
6097 const initialBodyOverflow = bodyStyles.overflowY;
6098 addClasses(container, popup, params);
6099
6100 // scrolling is 'hidden' until animation is done, after that 'auto'
6101 setTimeout(() => {
6102 setScrollingVisibility(container, popup);
6103 }, SHOW_CLASS_TIMEOUT);
6104 if (isModal()) {
6105 // Using ternary instead of ?? operator for Webpack 4 compatibility
6106 fixScrollContainer(container, params.scrollbarPadding !== undefined ? params.scrollbarPadding : false, initialBodyOverflow);
6107 setAriaHidden();
6108 }
6109 if (!isToast() && !globalState.previousActiveElement) {
6110 globalState.previousActiveElement = document.activeElement;
6111 }
6112 if (typeof params.didOpen === 'function') {
6113 const didOpen = params.didOpen;
6114 setTimeout(() => didOpen(popup));
6115 }
6116 (_globalState$eventEmi2 = globalState.eventEmitter) === null || _globalState$eventEmi2 === void 0 || _globalState$eventEmi2.emit('didOpen', popup);
6117 };
6118
6119 /**
6120 * @param {Event} event
6121 */
6122 const swalOpenAnimationFinished = event => {
6123 const popup = getPopup();
6124 if (!popup || event.target !== popup) {
6125 return;
6126 }
6127 const container = getContainer();
6128 if (!container) {
6129 return;
6130 }
6131 popup.removeEventListener('animationend', swalOpenAnimationFinished);
6132 popup.removeEventListener('transitionend', swalOpenAnimationFinished);
6133 container.style.overflowY = 'auto';
6134
6135 // no-transition is added in init() in case one swal is opened right after another
6136 removeClass(container, swalClasses['no-transition']);
6137 };
6138
6139 /**
6140 * @param {HTMLElement} container
6141 * @param {HTMLElement} popup
6142 */
6143 const setScrollingVisibility = (container, popup) => {
6144 if (hasCssAnimation(popup)) {
6145 container.style.overflowY = 'hidden';
6146 popup.addEventListener('animationend', swalOpenAnimationFinished);
6147 popup.addEventListener('transitionend', swalOpenAnimationFinished);
6148 } else {
6149 container.style.overflowY = 'auto';
6150 }
6151 };
6152
6153 /**
6154 * @param {HTMLElement} container
6155 * @param {boolean} scrollbarPadding
6156 * @param {string} initialBodyOverflow
6157 */
6158 const fixScrollContainer = (container, scrollbarPadding, initialBodyOverflow) => {
6159 iOSfix();
6160 if (scrollbarPadding && initialBodyOverflow !== 'hidden') {
6161 replaceScrollbarWithPadding(initialBodyOverflow);
6162 }
6163
6164 // sweetalert2/issues/1247
6165 setTimeout(() => {
6166 container.scrollTop = 0;
6167 });
6168 };
6169
6170 /**
6171 * @param {HTMLElement} container
6172 * @param {HTMLElement} popup
6173 * @param {SweetAlertOptions} params
6174 */
6175 const addClasses = (container, popup, params) => {
6176 var _params$showClass;
6177 if ((_params$showClass = params.showClass) !== null && _params$showClass !== void 0 && _params$showClass.backdrop) {
6178 addClass(container, params.showClass.backdrop);
6179 }
6180 if (params.animation) {
6181 // this workaround with opacity is needed for https://github.com/sweetalert2/sweetalert2/issues/2059
6182 popup.style.setProperty('opacity', '0', 'important');
6183 show(popup, 'grid');
6184 setTimeout(() => {
6185 var _params$showClass2;
6186 // Animate popup right after showing it
6187 if ((_params$showClass2 = params.showClass) !== null && _params$showClass2 !== void 0 && _params$showClass2.popup) {
6188 addClass(popup, params.showClass.popup);
6189 }
6190 // and remove the opacity workaround
6191 popup.style.removeProperty('opacity');
6192 }, SHOW_CLASS_TIMEOUT); // 10ms in order to fix #2062
6193 } else {
6194 show(popup, 'grid');
6195 }
6196 addClass([document.documentElement, document.body], swalClasses.shown);
6197 if (params.heightAuto && params.backdrop && !params.toast) {
6198 addClass([document.documentElement, document.body], swalClasses['height-auto']);
6199 }
6200 };
6201
6202 var defaultInputValidators = {
6203 /**
6204 * @param {string} string
6205 * @param {string} [validationMessage]
6206 * @returns {Promise<string | void>}
6207 */
6208 email: (string, validationMessage) => {
6209 return /^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address');
6210 },
6211 /**
6212 * @param {string} string
6213 * @param {string} [validationMessage]
6214 * @returns {Promise<string | void>}
6215 */
6216 url: (string, validationMessage) => {
6217 // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 and #2013
6218 return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL');
6219 }
6220 };
6221
6222 /**
6223 * @param {SweetAlertOptions} params
6224 */
6225 function setDefaultInputValidators(params) {
6226 // Use default `inputValidator` for supported input types if not provided
6227 if (params.inputValidator) {
6228 return;
6229 }
6230 if (params.input === 'email') {
6231 params.inputValidator = defaultInputValidators['email'];
6232 }
6233 if (params.input === 'url') {
6234 params.inputValidator = defaultInputValidators['url'];
6235 }
6236 }
6237
6238 /**
6239 * @param {SweetAlertOptions} params
6240 */
6241 function validateCustomTargetElement(params) {
6242 // Determine if the custom target element is valid
6243 if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) {
6244 warn('Target parameter is not valid, defaulting to "body"');
6245 params.target = 'body';
6246 }
6247 }
6248
6249 /**
6250 * Set type, text and actions on popup
6251 *
6252 * @param {SweetAlertOptions} params
6253 */
6254 function setParameters(params) {
6255 setDefaultInputValidators(params);
6256
6257 // showLoaderOnConfirm && preConfirm
6258 if (params.showLoaderOnConfirm && !params.preConfirm) {
6259 warn('showLoaderOnConfirm is set to true, but preConfirm is not defined.\n' + 'showLoaderOnConfirm should be used together with preConfirm, see usage example:\n' + 'https://sweetalert2.github.io/#ajax-request');
6260 }
6261 validateCustomTargetElement(params);
6262
6263 // Replace newlines with <br> in title
6264 if (typeof params.title === 'string') {
6265 params.title = params.title.split('\n').join('<br />');
6266 }
6267 init(params);
6268 }
6269
6270 /** @type {SweetAlert} */
6271 let currentInstance;
6272 var _promise = /*#__PURE__*/new WeakMap();
6273 class SweetAlert {
6274 /**
6275 * @param {...(SweetAlertOptions | string)} args
6276 * @this {SweetAlert}
6277 */
6278 constructor(...args) {
6279 /**
6280 * @type {Promise<SweetAlertResult>}
6281 */
6282 _classPrivateFieldInitSpec(this, _promise, /** @type {Promise<SweetAlertResult>} */Promise.resolve({
6283 isConfirmed: false,
6284 isDenied: false,
6285 isDismissed: true
6286 }));
6287 // Prevent run in Node env
6288 if (typeof window === 'undefined') {
6289 return;
6290 }
6291 currentInstance = this;
6292
6293 // @ts-ignore
6294 const outerParams = Object.freeze(this.constructor.argsToParams(args));
6295
6296 /** @type {Readonly<SweetAlertOptions>} */
6297 this.params = outerParams;
6298
6299 /** @type {boolean} */
6300 this.isAwaitingPromise = false;
6301 _classPrivateFieldSet2(_promise, this, this._main(currentInstance.params));
6302 }
6303
6304 /**
6305 * @param {any} userParams
6306 * @param {any} mixinParams
6307 */
6308 _main(userParams, mixinParams = {}) {
6309 showWarningsForParams(Object.assign({}, mixinParams, userParams));
6310 if (globalState.currentInstance) {
6311 const swalPromiseResolve = privateMethods.swalPromiseResolve.get(globalState.currentInstance);
6312 const {
6313 isAwaitingPromise
6314 } = globalState.currentInstance;
6315 globalState.currentInstance._destroy();
6316 if (!isAwaitingPromise) {
6317 swalPromiseResolve({
6318 isDismissed: true
6319 });
6320 }
6321 if (isModal()) {
6322 unsetAriaHidden();
6323 }
6324 }
6325 globalState.currentInstance = currentInstance;
6326 const innerParams = prepareParams(userParams, mixinParams);
6327 setParameters(innerParams);
6328 Object.freeze(innerParams);
6329
6330 // clear the previous timer
6331 if (globalState.timeout) {
6332 globalState.timeout.stop();
6333 delete globalState.timeout;
6334 }
6335
6336 // clear the restore focus timeout
6337 clearTimeout(globalState.restoreFocusTimeout);
6338 const domCache = populateDomCache(currentInstance);
6339 render(currentInstance, innerParams);
6340 privateProps.innerParams.set(currentInstance, innerParams);
6341 return swalPromise(currentInstance, domCache, innerParams);
6342 }
6343
6344 // `catch` cannot be the name of a module export, so we define our thenable methods here instead
6345 /**
6346 * @param {any} onFulfilled
6347 */
6348 then(onFulfilled) {
6349 return _classPrivateFieldGet2(_promise, this).then(onFulfilled);
6350 }
6351
6352 /**
6353 * @param {any} onFinally
6354 */
6355 finally(onFinally) {
6356 return _classPrivateFieldGet2(_promise, this).finally(onFinally);
6357 }
6358 }
6359
6360 /**
6361 * @param {SweetAlert} instance
6362 * @param {DomCache} domCache
6363 * @param {SweetAlertOptions} innerParams
6364 * @returns {Promise<SweetAlertResult>}
6365 */
6366 const swalPromise = (instance, domCache, innerParams) => {
6367 return new Promise((resolve, reject) => {
6368 // functions to handle all closings/dismissals
6369 /**
6370 * @param {DismissReason} dismiss
6371 */
6372 const dismissWith = dismiss => {
6373 instance.close({
6374 isDismissed: true,
6375 dismiss,
6376 isConfirmed: false,
6377 isDenied: false
6378 });
6379 };
6380 privateMethods.swalPromiseResolve.set(instance, resolve);
6381 privateMethods.swalPromiseReject.set(instance, reject);
6382 domCache.confirmButton.onclick = () => {
6383 handleConfirmButtonClick(instance);
6384 };
6385 domCache.denyButton.onclick = () => {
6386 handleDenyButtonClick(instance);
6387 };
6388 domCache.cancelButton.onclick = () => {
6389 handleCancelButtonClick(instance, dismissWith);
6390 };
6391 domCache.closeButton.onclick = () => {
6392 dismissWith(DismissReason.close);
6393 };
6394 handlePopupClick(innerParams, domCache, dismissWith);
6395 addKeydownHandler(globalState, innerParams, dismissWith);
6396 handleInputOptionsAndValue(instance, innerParams);
6397 openPopup(innerParams);
6398 setupTimer(globalState, innerParams, dismissWith);
6399 initFocus(domCache, innerParams);
6400
6401 // Scroll container to top on open (#1247, #1946)
6402 setTimeout(() => {
6403 domCache.container.scrollTop = 0;
6404 });
6405 });
6406 };
6407
6408 /**
6409 * @param {SweetAlertOptions} userParams
6410 * @param {SweetAlertOptions} mixinParams
6411 * @returns {SweetAlertOptions}
6412 */
6413 const prepareParams = (userParams, mixinParams) => {
6414 const templateParams = getTemplateParams(userParams);
6415 const params = Object.assign({}, defaultParams, mixinParams, templateParams, userParams); // precedence is described in #2131
6416 params.showClass = Object.assign({}, defaultParams.showClass, params.showClass);
6417 params.hideClass = Object.assign({}, defaultParams.hideClass, params.hideClass);
6418 if (params.animation === false) {
6419 params.showClass = {
6420 backdrop: 'swal2-noanimation'
6421 };
6422 params.hideClass = {};
6423 }
6424 return params;
6425 };
6426
6427 /**
6428 * @param {SweetAlert} instance
6429 * @returns {DomCache}
6430 */
6431 const populateDomCache = instance => {
6432 const domCache = /** @type {DomCache} */{
6433 popup: (/** @type {HTMLElement} */getPopup()),
6434 container: (/** @type {HTMLElement} */getContainer()),
6435 actions: (/** @type {HTMLElement} */getActions()),
6436 confirmButton: (/** @type {HTMLElement} */getConfirmButton()),
6437 denyButton: (/** @type {HTMLElement} */getDenyButton()),
6438 cancelButton: (/** @type {HTMLElement} */getCancelButton()),
6439 loader: (/** @type {HTMLElement} */getLoader()),
6440 closeButton: (/** @type {HTMLElement} */getCloseButton()),
6441 validationMessage: (/** @type {HTMLElement} */getValidationMessage()),
6442 progressSteps: (/** @type {HTMLElement} */getProgressSteps())
6443 };
6444 privateProps.domCache.set(instance, domCache);
6445 return domCache;
6446 };
6447
6448 /**
6449 * @param {GlobalState} globalState
6450 * @param {SweetAlertOptions} innerParams
6451 * @param {(dismiss: DismissReason) => void} dismissWith
6452 */
6453 const setupTimer = (globalState, innerParams, dismissWith) => {
6454 const timerProgressBar = getTimerProgressBar();
6455 hide(timerProgressBar);
6456 if (innerParams.timer) {
6457 globalState.timeout = new Timer(() => {
6458 dismissWith('timer');
6459 delete globalState.timeout;
6460 }, innerParams.timer);
6461 if (innerParams.timerProgressBar && timerProgressBar) {
6462 show(timerProgressBar);
6463 applyCustomClass(timerProgressBar, innerParams, 'timerProgressBar');
6464 setTimeout(() => {
6465 if (globalState.timeout && globalState.timeout.running) {
6466 // timer can be already stopped or unset at this point
6467 animateTimerProgressBar(/** @type {number} */innerParams.timer);
6468 }
6469 });
6470 }
6471 }
6472 };
6473
6474 /**
6475 * Initialize focus in the popup:
6476 *
6477 * 1. If `toast` is `true`, don't steal focus from the document.
6478 * 2. Else if there is an [autofocus] element, focus it.
6479 * 3. Else if `focusConfirm` is `true` and confirm button is visible, focus it.
6480 * 4. Else if `focusDeny` is `true` and deny button is visible, focus it.
6481 * 5. Else if `focusCancel` is `true` and cancel button is visible, focus it.
6482 * 6. Else focus the first focusable element in a popup (if any).
6483 *
6484 * @param {DomCache} domCache
6485 * @param {SweetAlertOptions} innerParams
6486 */
6487 const initFocus = (domCache, innerParams) => {
6488 if (innerParams.toast) {
6489 return;
6490 }
6491 // TODO: this is dumb, remove `allowEnterKey` param in the next major version
6492 if (!callIfFunction(innerParams.allowEnterKey)) {
6493 warnAboutDeprecation('allowEnterKey');
6494 blurActiveElement();
6495 return;
6496 }
6497 if (focusAutofocus(domCache)) {
6498 return;
6499 }
6500 if (focusButton(domCache, innerParams)) {
6501 return;
6502 }
6503 setFocus(-1, 1);
6504 };
6505
6506 /**
6507 * @param {DomCache} domCache
6508 * @returns {boolean}
6509 */
6510 const focusAutofocus = domCache => {
6511 const autofocusElements = Array.from(domCache.popup.querySelectorAll('[autofocus]'));
6512 for (const autofocusElement of autofocusElements) {
6513 if (autofocusElement instanceof HTMLElement && isVisible$1(autofocusElement)) {
6514 autofocusElement.focus();
6515 return true;
6516 }
6517 }
6518 return false;
6519 };
6520
6521 /**
6522 * @param {DomCache} domCache
6523 * @param {SweetAlertOptions} innerParams
6524 * @returns {boolean}
6525 */
6526 const focusButton = (domCache, innerParams) => {
6527 if (innerParams.focusDeny && isVisible$1(domCache.denyButton)) {
6528 domCache.denyButton.focus();
6529 return true;
6530 }
6531 if (innerParams.focusCancel && isVisible$1(domCache.cancelButton)) {
6532 domCache.cancelButton.focus();
6533 return true;
6534 }
6535 if (innerParams.focusConfirm && isVisible$1(domCache.confirmButton)) {
6536 domCache.confirmButton.focus();
6537 return true;
6538 }
6539 return false;
6540 };
6541 const blurActiveElement = () => {
6542 if (document.activeElement instanceof HTMLElement && typeof document.activeElement.blur === 'function') {
6543 document.activeElement.blur();
6544 }
6545 };
6546
6547 // Assign instance methods from src/instanceMethods/*.js to prototype
6548 SweetAlert.prototype.disableButtons = disableButtons;
6549 SweetAlert.prototype.enableButtons = enableButtons;
6550 SweetAlert.prototype.getInput = getInput;
6551 SweetAlert.prototype.disableInput = disableInput;
6552 SweetAlert.prototype.enableInput = enableInput;
6553 SweetAlert.prototype.hideLoading = hideLoading;
6554 SweetAlert.prototype.disableLoading = hideLoading;
6555 SweetAlert.prototype.showValidationMessage = showValidationMessage;
6556 SweetAlert.prototype.resetValidationMessage = resetValidationMessage;
6557 SweetAlert.prototype.close = close;
6558 SweetAlert.prototype.closePopup = close;
6559 SweetAlert.prototype.closeModal = close;
6560 SweetAlert.prototype.closeToast = close;
6561 SweetAlert.prototype.rejectPromise = rejectPromise;
6562 SweetAlert.prototype.update = update;
6563 SweetAlert.prototype._destroy = _destroy;
6564
6565 // Assign static methods from src/staticMethods/*.js to constructor
6566 Object.assign(SweetAlert, staticMethods);
6567
6568 // Proxy to instance methods to constructor, for now, for backwards compatibility
6569 Object.keys(instanceMethods).forEach(key => {
6570 /**
6571 * @param {...(SweetAlertOptions | string | undefined)} args
6572 * @returns {SweetAlertResult | Promise<SweetAlertResult> | undefined}
6573 */
6574 // @ts-ignore: Dynamic property assignment for backwards compatibility
6575 SweetAlert[key] = function (...args) {
6576 // @ts-ignore
6577 if (currentInstance && currentInstance[key]) {
6578 // @ts-ignore
6579 return currentInstance[key](...args);
6580 }
6581 return undefined;
6582 };
6583 });
6584 SweetAlert.DismissReason = DismissReason;
6585 SweetAlert.version = '11.26.17';
6586
6587 const Swal = SweetAlert;
6588 // @ts-ignore
6589 Swal.default = Swal;
6590
6591 return Swal;
6592
6593 }));
6594 if (typeof this !== 'undefined' && this.Sweetalert2){this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2}
6595 "undefined"!=typeof document&&function(e,t){var n=e.createElement("style");if(e.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=t);else try{n.innerHTML=t}catch(e){n.innerText=t}}(document,":root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-icon-animations: true;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;--swal2-close-button-focus-box-shadow: inset var(--swal2-outline);--swal2-close-button-hover-transform: none;--swal2-actions-justify-content: center;--swal2-actions-width: auto;--swal2-actions-margin: 1.25em auto 0;--swal2-actions-padding: 0;--swal2-actions-border-radius: 0;--swal2-actions-background: transparent;--swal2-action-button-transition: background-color 0.2s, box-shadow 0.2s;--swal2-action-button-hover: black 10%;--swal2-action-button-active: black 10%;--swal2-confirm-button-box-shadow: none;--swal2-confirm-button-border-radius: 0.25em;--swal2-confirm-button-background-color: #7066e0;--swal2-confirm-button-color: #fff;--swal2-deny-button-box-shadow: none;--swal2-deny-button-border-radius: 0.25em;--swal2-deny-button-background-color: #dc3741;--swal2-deny-button-color: #fff;--swal2-cancel-button-box-shadow: none;--swal2-cancel-button-border-radius: 0.25em;--swal2-cancel-button-background-color: #6e7881;--swal2-cancel-button-color: #fff;--swal2-toast-show-animation: swal2-toast-show 0.5s;--swal2-toast-hide-animation: swal2-toast-hide 0.1s forwards;--swal2-toast-border: none;--swal2-toast-box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.075), 0 1px 2px hsl(0deg 0% 0% / 0.075), 1px 2px 4px hsl(0deg 0% 0% / 0.075), 1px 3px 8px hsl(0deg 0% 0% / 0.075), 2px 4px 16px hsl(0deg 0% 0% / 0.075)}[data-swal2-theme=dark]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}@media(prefers-color-scheme: dark){[data-swal2-theme=auto]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px var(--swal2-backdrop)}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:\"top-start top top-end\" \"center-start center center-end\" \"bottom-start bottom-center bottom-end\";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:var(--swal2-container-padding);overflow-x:hidden;transition:var(--swal2-backdrop-transition);-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:var(--swal2-backdrop)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container)[popover]{width:auto;border:0}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:var(--swal2-width);max-width:100%;padding:var(--swal2-padding);border:var(--swal2-border);border-radius:var(--swal2-border-radius);background:var(--swal2-background);color:var(--swal2-color);font-family:inherit;font-size:1rem;container-name:swal2-popup}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable{cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable div:where(.swal2-icon){cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging{cursor:grabbing}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging div:where(.swal2-icon){cursor:grabbing}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:var(--swal2-title-padding);color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;overflow-wrap:break-word;cursor:initial}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:var(--swal2-actions-justify-content);width:var(--swal2-actions-width);margin:var(--swal2-actions-margin);padding:var(--swal2-actions-padding);border-radius:var(--swal2-actions-border-radius);background:var(--swal2-actions-background)}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:var(--swal2-action-button-transition);border:none;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border-radius:var(--swal2-confirm-button-border-radius);background:initial;background-color:var(--swal2-confirm-button-background-color);box-shadow:var(--swal2-confirm-button-box-shadow);color:var(--swal2-confirm-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border-radius:var(--swal2-deny-button-border-radius);background:initial;background-color:var(--swal2-deny-button-background-color);box-shadow:var(--swal2-deny-button-box-shadow);color:var(--swal2-deny-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):active{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border-radius:var(--swal2-cancel-button-border-radius);background:initial;background-color:var(--swal2-cancel-button-background-color);box-shadow:var(--swal2-cancel-button-box-shadow);color:var(--swal2-cancel-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none;box-shadow:var(--swal2-action-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-styled)[disabled]:not(.swal2-loading){opacity:.4}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid var(--swal2-footer-border-color);background:var(--swal2-footer-background);color:var(--swal2-footer-color);font-size:1em;text-align:center;cursor:initial}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:var(--swal2-border-radius);border-bottom-left-radius:var(--swal2-border-radius)}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:var(--swal2-timer-progress-bar-background)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em;cursor:initial}div:where(.swal2-container) button:where(.swal2-close){position:var(--swal2-close-button-position);inset:var(--swal2-close-button-inset);z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:var(--swal2-close-button-transition);border:none;border-radius:var(--swal2-border-radius);outline:var(--swal2-close-button-outline);background:rgba(0,0,0,0);color:var(--swal2-close-button-color);font-family:monospace;font-size:var(--swal2-close-button-font-size);cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:var(--swal2-close-button-hover-transform);background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:var(--swal2-close-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-html-container){z-index:1;justify-content:center;margin:0;padding:var(--swal2-html-container-padding);overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;overflow-wrap:break-word;word-break:break-word;cursor:initial}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:var(--swal2-input-transition);border:var(--swal2-input-border);border-radius:var(--swal2-input-border-radius);background:var(--swal2-input-background);box-shadow:var(--swal2-input-box-shadow);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):hover,div:where(.swal2-container) input:where(.swal2-file):hover,div:where(.swal2-container) textarea:where(.swal2-textarea):hover{box-shadow:var(--swal2-input-hover-box-shadow)}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:var(--swal2-input-focus-border);outline:none;box-shadow:var(--swal2-input-focus-box-shadow)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:var(--swal2-background)}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:var(--swal2-input-background);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:var(--swal2-input-background);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:var(--swal2-background);color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:var(--swal2-validation-message-background);color:var(--swal2-validation-message-color);font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:\"!\";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:var(--swal2-progress-step-background);color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:var(--swal2-progress-step-background)}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;zoom:var(--swal2-icon-zoom);border:.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}}div:where(.swal2-icon).swal2-warning{border-color:#f8bb86;color:#f8bb86}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}}div:where(.swal2-icon).swal2-info{border-color:#3fc3ee;color:#3fc3ee}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}}div:where(.swal2-icon).swal2-question{border-color:#87adbd;color:#87adbd}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:var(--swal2-show-animation)}.swal2-hide{animation:var(--swal2-hide-animation)}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;border:var(--swal2-toast-border);background:var(--swal2-background);box-shadow:var(--swal2-toast-box-shadow);pointer-events:all}.swal2-toast>*{grid-column:2}.swal2-toast h2:where(.swal2-title){margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-toast .swal2-loading{justify-content:center}.swal2-toast input:where(.swal2-input){height:2em;margin:.5em;font-size:1em}.swal2-toast .swal2-validation-message{font-size:1em}.swal2-toast div:where(.swal2-footer){margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-toast button:where(.swal2-close){grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-toast div:where(.swal2-html-container){margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-toast div:where(.swal2-html-container):empty{padding:0}.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-toast div:where(.swal2-actions){justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-toast button:where(.swal2-styled){margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}@container swal2-popup style(--swal2-icon-animations:true){.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}}.swal2-toast.swal2-show{animation:var(--swal2-toast-show-animation)}.swal2-toast.swal2-hide{animation:var(--swal2-toast-hide-animation)}@keyframes swal2-show{0%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}100%{transform:translate3d(0, 0, 0) scale(1);opacity:1}}@keyframes swal2-hide{0%{transform:translate3d(0, 0, 0) scale(1);opacity:1}100%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}");
6596
6597 /***/ },
6598
6599 /***/ "./node_modules/toastify-js/src/toastify.js"
6600 /*!**************************************************!*\
6601 !*** ./node_modules/toastify-js/src/toastify.js ***!
6602 \**************************************************/
6603 (module) {
6604
6605 /*!
6606 * Toastify js 1.12.0
6607 * https://github.com/apvarun/toastify-js
6608 * @license MIT licensed
6609 *
6610 * Copyright (C) 2018 Varun A P
6611 */
6612 (function(root, factory) {
6613 if ( true && module.exports) {
6614 module.exports = factory();
6615 } else {
6616 root.Toastify = factory();
6617 }
6618 })(this, function(global) {
6619 // Object initialization
6620 var Toastify = function(options) {
6621 // Returning a new init object
6622 return new Toastify.lib.init(options);
6623 },
6624 // Library version
6625 version = "1.12.0";
6626
6627 // Set the default global options
6628 Toastify.defaults = {
6629 oldestFirst: true,
6630 text: "Toastify is awesome!",
6631 node: undefined,
6632 duration: 3000,
6633 selector: undefined,
6634 callback: function () {
6635 },
6636 destination: undefined,
6637 newWindow: false,
6638 close: false,
6639 gravity: "toastify-top",
6640 positionLeft: false,
6641 position: '',
6642 backgroundColor: '',
6643 avatar: "",
6644 className: "",
6645 stopOnFocus: true,
6646 onClick: function () {
6647 },
6648 offset: {x: 0, y: 0},
6649 escapeMarkup: true,
6650 ariaLive: 'polite',
6651 style: {background: ''}
6652 };
6653
6654 // Defining the prototype of the object
6655 Toastify.lib = Toastify.prototype = {
6656 toastify: version,
6657
6658 constructor: Toastify,
6659
6660 // Initializing the object with required parameters
6661 init: function(options) {
6662 // Verifying and validating the input object
6663 if (!options) {
6664 options = {};
6665 }
6666
6667 // Creating the options object
6668 this.options = {};
6669
6670 this.toastElement = null;
6671
6672 // Validating the options
6673 this.options.text = options.text || Toastify.defaults.text; // Display message
6674 this.options.node = options.node || Toastify.defaults.node; // Display content as node
6675 this.options.duration = options.duration === 0 ? 0 : options.duration || Toastify.defaults.duration; // Display duration
6676 this.options.selector = options.selector || Toastify.defaults.selector; // Parent selector
6677 this.options.callback = options.callback || Toastify.defaults.callback; // Callback after display
6678 this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination
6679 this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window
6680 this.options.close = options.close || Toastify.defaults.close; // Show toast close icon
6681 this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom
6682 this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right
6683 this.options.position = options.position || Toastify.defaults.position; // toast position - left or right
6684 this.options.backgroundColor = options.backgroundColor || Toastify.defaults.backgroundColor; // toast background color
6685 this.options.avatar = options.avatar || Toastify.defaults.avatar; // img element src - url or a path
6686 this.options.className = options.className || Toastify.defaults.className; // additional class names for the toast
6687 this.options.stopOnFocus = options.stopOnFocus === undefined ? Toastify.defaults.stopOnFocus : options.stopOnFocus; // stop timeout on focus
6688 this.options.onClick = options.onClick || Toastify.defaults.onClick; // Callback after click
6689 this.options.offset = options.offset || Toastify.defaults.offset; // toast offset
6690 this.options.escapeMarkup = options.escapeMarkup !== undefined ? options.escapeMarkup : Toastify.defaults.escapeMarkup;
6691 this.options.ariaLive = options.ariaLive || Toastify.defaults.ariaLive;
6692 this.options.style = options.style || Toastify.defaults.style;
6693 if(options.backgroundColor) {
6694 this.options.style.background = options.backgroundColor;
6695 }
6696
6697 // Returning the current object for chaining functions
6698 return this;
6699 },
6700
6701 // Building the DOM element
6702 buildToast: function() {
6703 // Validating if the options are defined
6704 if (!this.options) {
6705 throw "Toastify is not initialized";
6706 }
6707
6708 // Creating the DOM object
6709 var divElement = document.createElement("div");
6710 divElement.className = "toastify on " + this.options.className;
6711
6712 // Positioning toast to left or right or center
6713 if (!!this.options.position) {
6714 divElement.className += " toastify-" + this.options.position;
6715 } else {
6716 // To be depreciated in further versions
6717 if (this.options.positionLeft === true) {
6718 divElement.className += " toastify-left";
6719 console.warn('Property `positionLeft` will be depreciated in further versions. Please use `position` instead.')
6720 } else {
6721 // Default position
6722 divElement.className += " toastify-right";
6723 }
6724 }
6725
6726 // Assigning gravity of element
6727 divElement.className += " " + this.options.gravity;
6728
6729 if (this.options.backgroundColor) {
6730 // This is being deprecated in favor of using the style HTML DOM property
6731 console.warn('DEPRECATION NOTICE: "backgroundColor" is being deprecated. Please use the "style.background" property.');
6732 }
6733
6734 // Loop through our style object and apply styles to divElement
6735 for (var property in this.options.style) {
6736 divElement.style[property] = this.options.style[property];
6737 }
6738
6739 // Announce the toast to screen readers
6740 if (this.options.ariaLive) {
6741 divElement.setAttribute('aria-live', this.options.ariaLive)
6742 }
6743
6744 // Adding the toast message/node
6745 if (this.options.node && this.options.node.nodeType === Node.ELEMENT_NODE) {
6746 // If we have a valid node, we insert it
6747 divElement.appendChild(this.options.node)
6748 } else {
6749 if (this.options.escapeMarkup) {
6750 divElement.innerText = this.options.text;
6751 } else {
6752 divElement.innerHTML = this.options.text;
6753 }
6754
6755 if (this.options.avatar !== "") {
6756 var avatarElement = document.createElement("img");
6757 avatarElement.src = this.options.avatar;
6758
6759 avatarElement.className = "toastify-avatar";
6760
6761 if (this.options.position == "left" || this.options.positionLeft === true) {
6762 // Adding close icon on the left of content
6763 divElement.appendChild(avatarElement);
6764 } else {
6765 // Adding close icon on the right of content
6766 divElement.insertAdjacentElement("afterbegin", avatarElement);
6767 }
6768 }
6769 }
6770
6771 // Adding a close icon to the toast
6772 if (this.options.close === true) {
6773 // Create a span for close element
6774 var closeElement = document.createElement("button");
6775 closeElement.type = "button";
6776 closeElement.setAttribute("aria-label", "Close");
6777 closeElement.className = "toast-close";
6778 closeElement.innerHTML = "&#10006;";
6779
6780 // Triggering the removal of toast from DOM on close click
6781 closeElement.addEventListener(
6782 "click",
6783 function(event) {
6784 event.stopPropagation();
6785 this.removeElement(this.toastElement);
6786 window.clearTimeout(this.toastElement.timeOutValue);
6787 }.bind(this)
6788 );
6789
6790 //Calculating screen width
6791 var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
6792
6793 // Adding the close icon to the toast element
6794 // Display on the right if screen width is less than or equal to 360px
6795 if ((this.options.position == "left" || this.options.positionLeft === true) && width > 360) {
6796 // Adding close icon on the left of content
6797 divElement.insertAdjacentElement("afterbegin", closeElement);
6798 } else {
6799 // Adding close icon on the right of content
6800 divElement.appendChild(closeElement);
6801 }
6802 }
6803
6804 // Clear timeout while toast is focused
6805 if (this.options.stopOnFocus && this.options.duration > 0) {
6806 var self = this;
6807 // stop countdown
6808 divElement.addEventListener(
6809 "mouseover",
6810 function(event) {
6811 window.clearTimeout(divElement.timeOutValue);
6812 }
6813 )
6814 // add back the timeout
6815 divElement.addEventListener(
6816 "mouseleave",
6817 function() {
6818 divElement.timeOutValue = window.setTimeout(
6819 function() {
6820 // Remove the toast from DOM
6821 self.removeElement(divElement);
6822 },
6823 self.options.duration
6824 )
6825 }
6826 )
6827 }
6828
6829 // Adding an on-click destination path
6830 if (typeof this.options.destination !== "undefined") {
6831 divElement.addEventListener(
6832 "click",
6833 function(event) {
6834 event.stopPropagation();
6835 if (this.options.newWindow === true) {
6836 window.open(this.options.destination, "_blank");
6837 } else {
6838 window.location = this.options.destination;
6839 }
6840 }.bind(this)
6841 );
6842 }
6843
6844 if (typeof this.options.onClick === "function" && typeof this.options.destination === "undefined") {
6845 divElement.addEventListener(
6846 "click",
6847 function(event) {
6848 event.stopPropagation();
6849 this.options.onClick();
6850 }.bind(this)
6851 );
6852 }
6853
6854 // Adding offset
6855 if(typeof this.options.offset === "object") {
6856
6857 var x = getAxisOffsetAValue("x", this.options);
6858 var y = getAxisOffsetAValue("y", this.options);
6859
6860 var xOffset = this.options.position == "left" ? x : "-" + x;
6861 var yOffset = this.options.gravity == "toastify-top" ? y : "-" + y;
6862
6863 divElement.style.transform = "translate(" + xOffset + "," + yOffset + ")";
6864
6865 }
6866
6867 // Returning the generated element
6868 return divElement;
6869 },
6870
6871 // Displaying the toast
6872 showToast: function() {
6873 // Creating the DOM object for the toast
6874 this.toastElement = this.buildToast();
6875
6876 // Getting the root element to with the toast needs to be added
6877 var rootElement;
6878 if (typeof this.options.selector === "string") {
6879 rootElement = document.getElementById(this.options.selector);
6880 } else if (this.options.selector instanceof HTMLElement || (typeof ShadowRoot !== 'undefined' && this.options.selector instanceof ShadowRoot)) {
6881 rootElement = this.options.selector;
6882 } else {
6883 rootElement = document.body;
6884 }
6885
6886 // Validating if root element is present in DOM
6887 if (!rootElement) {
6888 throw "Root element is not defined";
6889 }
6890
6891 // Adding the DOM element
6892 var elementToInsert = Toastify.defaults.oldestFirst ? rootElement.firstChild : rootElement.lastChild;
6893 rootElement.insertBefore(this.toastElement, elementToInsert);
6894
6895 // Repositioning the toasts in case multiple toasts are present
6896 Toastify.reposition();
6897
6898 if (this.options.duration > 0) {
6899 this.toastElement.timeOutValue = window.setTimeout(
6900 function() {
6901 // Remove the toast from DOM
6902 this.removeElement(this.toastElement);
6903 }.bind(this),
6904 this.options.duration
6905 ); // Binding `this` for function invocation
6906 }
6907
6908 // Supporting function chaining
6909 return this;
6910 },
6911
6912 hideToast: function() {
6913 if (this.toastElement.timeOutValue) {
6914 clearTimeout(this.toastElement.timeOutValue);
6915 }
6916 this.removeElement(this.toastElement);
6917 },
6918
6919 // Removing the element from the DOM
6920 removeElement: function(toastElement) {
6921 // Hiding the element
6922 // toastElement.classList.remove("on");
6923 toastElement.className = toastElement.className.replace(" on", "");
6924
6925 // Removing the element from DOM after transition end
6926 window.setTimeout(
6927 function() {
6928 // remove options node if any
6929 if (this.options.node && this.options.node.parentNode) {
6930 this.options.node.parentNode.removeChild(this.options.node);
6931 }
6932
6933 // Remove the element from the DOM, only when the parent node was not removed before.
6934 if (toastElement.parentNode) {
6935 toastElement.parentNode.removeChild(toastElement);
6936 }
6937
6938 // Calling the callback function
6939 this.options.callback.call(toastElement);
6940
6941 // Repositioning the toasts again
6942 Toastify.reposition();
6943 }.bind(this),
6944 400
6945 ); // Binding `this` for function invocation
6946 },
6947 };
6948
6949 // Positioning the toasts on the DOM
6950 Toastify.reposition = function() {
6951
6952 // Top margins with gravity
6953 var topLeftOffsetSize = {
6954 top: 15,
6955 bottom: 15,
6956 };
6957 var topRightOffsetSize = {
6958 top: 15,
6959 bottom: 15,
6960 };
6961 var offsetSize = {
6962 top: 15,
6963 bottom: 15,
6964 };
6965
6966 // Get all toast messages on the DOM
6967 var allToasts = document.getElementsByClassName("toastify");
6968
6969 var classUsed;
6970
6971 // Modifying the position of each toast element
6972 for (var i = 0; i < allToasts.length; i++) {
6973 // Getting the applied gravity
6974 if (containsClass(allToasts[i], "toastify-top") === true) {
6975 classUsed = "toastify-top";
6976 } else {
6977 classUsed = "toastify-bottom";
6978 }
6979
6980 var height = allToasts[i].offsetHeight;
6981 classUsed = classUsed.substr(9, classUsed.length-1)
6982 // Spacing between toasts
6983 var offset = 15;
6984
6985 var width = window.innerWidth > 0 ? window.innerWidth : screen.width;
6986
6987 // Show toast in center if screen with less than or equal to 360px
6988 if (width <= 360) {
6989 // Setting the position
6990 allToasts[i].style[classUsed] = offsetSize[classUsed] + "px";
6991
6992 offsetSize[classUsed] += height + offset;
6993 } else {
6994 if (containsClass(allToasts[i], "toastify-left") === true) {
6995 // Setting the position
6996 allToasts[i].style[classUsed] = topLeftOffsetSize[classUsed] + "px";
6997
6998 topLeftOffsetSize[classUsed] += height + offset;
6999 } else {
7000 // Setting the position
7001 allToasts[i].style[classUsed] = topRightOffsetSize[classUsed] + "px";
7002
7003 topRightOffsetSize[classUsed] += height + offset;
7004 }
7005 }
7006 }
7007
7008 // Supporting function chaining
7009 return this;
7010 };
7011
7012 // Helper function to get offset.
7013 function getAxisOffsetAValue(axis, options) {
7014
7015 if(options.offset[axis]) {
7016 if(isNaN(options.offset[axis])) {
7017 return options.offset[axis];
7018 }
7019 else {
7020 return options.offset[axis] + 'px';
7021 }
7022 }
7023
7024 return '0px';
7025
7026 }
7027
7028 function containsClass(elem, yourClass) {
7029 if (!elem || typeof yourClass !== "string") {
7030 return false;
7031 } else if (
7032 elem.className &&
7033 elem.className
7034 .trim()
7035 .split(/\s+/gi)
7036 .indexOf(yourClass) > -1
7037 ) {
7038 return true;
7039 } else {
7040 return false;
7041 }
7042 }
7043
7044 // Setting up the prototype for the init object
7045 Toastify.lib.init.prototype = Toastify.lib;
7046
7047 // Returning the Toastify function to be assigned to the window object/module
7048 return Toastify;
7049 });
7050
7051
7052 /***/ }
7053
7054 /******/ });
7055 /************************************************************************/
7056 /******/ // The module cache
7057 /******/ var __webpack_module_cache__ = {};
7058 /******/
7059 /******/ // The require function
7060 /******/ function __webpack_require__(moduleId) {
7061 /******/ // Check if module is in cache
7062 /******/ var cachedModule = __webpack_module_cache__[moduleId];
7063 /******/ if (cachedModule !== undefined) {
7064 /******/ return cachedModule.exports;
7065 /******/ }
7066 /******/ // Create a new module (and put it into the cache)
7067 /******/ var module = __webpack_module_cache__[moduleId] = {
7068 /******/ id: moduleId,
7069 /******/ // no module.loaded needed
7070 /******/ exports: {}
7071 /******/ };
7072 /******/
7073 /******/ // Execute the module function
7074 /******/ if (!(moduleId in __webpack_modules__)) {
7075 /******/ delete __webpack_module_cache__[moduleId];
7076 /******/ var e = new Error("Cannot find module '" + moduleId + "'");
7077 /******/ e.code = 'MODULE_NOT_FOUND';
7078 /******/ throw e;
7079 /******/ }
7080 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
7081 /******/
7082 /******/ // Return the exports of the module
7083 /******/ return module.exports;
7084 /******/ }
7085 /******/
7086 /************************************************************************/
7087 /******/ /* webpack/runtime/compat get default export */
7088 /******/ (() => {
7089 /******/ // getDefaultExport function for compatibility with non-harmony modules
7090 /******/ __webpack_require__.n = (module) => {
7091 /******/ var getter = module && module.__esModule ?
7092 /******/ () => (module['default']) :
7093 /******/ () => (module);
7094 /******/ __webpack_require__.d(getter, { a: getter });
7095 /******/ return getter;
7096 /******/ };
7097 /******/ })();
7098 /******/
7099 /******/ /* webpack/runtime/define property getters */
7100 /******/ (() => {
7101 /******/ // define getter functions for harmony exports
7102 /******/ __webpack_require__.d = (exports, definition) => {
7103 /******/ for(var key in definition) {
7104 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
7105 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
7106 /******/ }
7107 /******/ }
7108 /******/ };
7109 /******/ })();
7110 /******/
7111 /******/ /* webpack/runtime/hasOwnProperty shorthand */
7112 /******/ (() => {
7113 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
7114 /******/ })();
7115 /******/
7116 /******/ /* webpack/runtime/make namespace object */
7117 /******/ (() => {
7118 /******/ // define __esModule on exports
7119 /******/ __webpack_require__.r = (exports) => {
7120 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
7121 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7122 /******/ }
7123 /******/ Object.defineProperty(exports, '__esModule', { value: true });
7124 /******/ };
7125 /******/ })();
7126 /******/
7127 /******/ /* webpack/runtime/nonce */
7128 /******/ (() => {
7129 /******/ __webpack_require__.nc = undefined;
7130 /******/ })();
7131 /******/
7132 /************************************************************************/
7133 var __webpack_exports__ = {};
7134 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
7135 (() => {
7136 "use strict";
7137 /*!**********************************************!*\
7138 !*** ./assets/src/js/admin/admin-courses.js ***!
7139 \**********************************************/
7140 __webpack_require__.r(__webpack_exports__);
7141 /* harmony import */ var _courses_generate_with_ai_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./courses/generate-with-ai.js */ "./assets/src/js/admin/courses/generate-with-ai.js");
7142 /* harmony import */ var _courses_view_students_modal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./courses/view-students-modal.js */ "./assets/src/js/admin/courses/view-students-modal.js");
7143 /**
7144 * Admin Courses JS
7145 *
7146 * @since 4.3.0
7147 * @version 1.0.1
7148 */
7149
7150
7151
7152 new _courses_generate_with_ai_js__WEBPACK_IMPORTED_MODULE_0__.CreateCourseViaAI();
7153 new _courses_view_students_modal_js__WEBPACK_IMPORTED_MODULE_1__.ViewStudentsModal();
7154 })();
7155
7156 /******/ })()
7157 ;
7158 //# sourceMappingURL=admin-courses.js.map