From 19bb34e77956da0f6e71250162eb44dba2adc0c2 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Wed, 29 Oct 2025 07:18:27 -0400 Subject: [PATCH 1/6] feat(biobank): Complete new module file structure and add OrderIndex to specimen protocols --- SQL/0000-00-06-BiobankTables.sql | 2 + ..._add-order-index-to-specimen-protocols.sql | 41 +++++++++++++++++++ modules/biobank/php/optionsendpoint.class.inc | 8 ++-- modules/biobank/php/specimendao.class.inc | 6 +-- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 SQL/New_patches/2025-10-29_add-order-index-to-specimen-protocols.sql diff --git a/SQL/0000-00-06-BiobankTables.sql b/SQL/0000-00-06-BiobankTables.sql index b7cd3b8bf25..c75bf6f4cb5 100644 --- a/SQL/0000-00-06-BiobankTables.sql +++ b/SQL/0000-00-06-BiobankTables.sql @@ -182,7 +182,9 @@ CREATE TABLE `biobank_specimen_protocol_attribute_rel` ( `SpecimenAttributeID` int(10) unsigned NOT NULL, `Required` tinyint(1) DEFAULT NULL, `showInDataTable` tinyint(1) DEFAULT NULL, + `OrderIndex` INT UNSIGNED NOT NULL, PRIMARY KEY (`SpecimenProtocolID`,`SpecimenAttributeID`), + UNIQUE KEY `UK_SpecimenProtocolId_OrderIndex` (`SpecimenProtocolID`, `OrderIndex`), KEY `FK_biobank_specimen_protocol_attribute_rel_SpecimenAttributeID` (`SpecimenAttributeID`), CONSTRAINT `FK_biobank_specimen_protocol_attribute__rel_SpecimenProtocolID` FOREIGN KEY (`SpecimenProtocolID`) REFERENCES `biobank_specimen_protocol` (`SpecimenProtocolID`), CONSTRAINT `FK_biobank_specimen_protocol_attribute_rel_SpecimenAttributeID` FOREIGN KEY (`SpecimenAttributeID`) REFERENCES `biobank_specimen_attribute` (`SpecimenAttributeID`) diff --git a/SQL/New_patches/2025-10-29_add-order-index-to-specimen-protocols.sql b/SQL/New_patches/2025-10-29_add-order-index-to-specimen-protocols.sql new file mode 100644 index 00000000000..29f1ecd91c3 --- /dev/null +++ b/SQL/New_patches/2025-10-29_add-order-index-to-specimen-protocols.sql @@ -0,0 +1,41 @@ +-- Step 1: Add the column allowing NULL (temporarily) +-- This allows the operation to succeed on a table that already has existing rows. +ALTER TABLE biobank_specimen_protocol_attribute_rel +ADD COLUMN OrderIndex INT UNSIGNED NULL; + +-- Step 2: Populate the existing rows with unique, non-NULL OrderIndex values. +-- This uses a variable-based method to assign a sequential number (0, 1, 2, ...) +-- to each row within the same SpecimenProtocolID group. + +SET @r := -1; +SET @g := 0; + +-- A temporary table/derived table is used to calculate the unique index for each group +UPDATE biobank_specimen_protocol_attribute_rel AS t1 +INNER JOIN ( + SELECT + t2.SpecimenProtocolID, + t2.SpecimenAttributeID, + @r := CASE WHEN @g = t2.SpecimenProtocolID THEN @r + 1 ELSE 0 END AS new_OrderIndex, + @g := t2.SpecimenProtocolID AS current_group + FROM + biobank_specimen_protocol_attribute_rel AS t2 + ORDER BY + t2.SpecimenProtocolID, t2.SpecimenAttributeID + +) AS ranked_data +ON t1.SpecimenProtocolID = ranked_data.SpecimenProtocolID +AND t1.SpecimenAttributeID = ranked_data.SpecimenAttributeID +SET t1.OrderIndex = ranked_data.new_OrderIndex; + +-- Step 3: Enforce the constraints (NOT NULL and UNIQUE). +-- Now that every row has a valid, unique value, these operations will succeed. + +-- 3a. Add the UNIQUE Constraint +ALTER TABLE biobank_specimen_protocol_attribute_rel +ADD CONSTRAINT UK_SpecimenProtocolId_OrderIndex +UNIQUE (SpecimenProtocolID, OrderIndex); + +-- 3b. Change the Column to NOT NULL +ALTER TABLE biobank_specimen_protocol_attribute_rel +MODIFY COLUMN OrderIndex INT UNSIGNED NOT NULL; diff --git a/modules/biobank/php/optionsendpoint.class.inc b/modules/biobank/php/optionsendpoint.class.inc index 7ee3daa5e10..02bb385a1e3 100644 --- a/modules/biobank/php/optionsendpoint.class.inc +++ b/modules/biobank/php/optionsendpoint.class.inc @@ -141,11 +141,11 @@ class OptionsEndpoint extends \NDB_Page implements RequestHandlerInterface $query = "SELECT c.CandID as id, PSCID as pscid, Sex as sex, - GROUP_CONCAT(DISTINCT DiagnosisID) as diagnosisIds, + GROUP_CONCAT(DISTINCT DxEvolutionID) as diagnosisIds, GROUP_CONCAT(DISTINCT s.ID) as sessionIds FROM candidate c - LEFT JOIN session s USING (CandID) - LEFT JOIN candidate_diagnosis_rel USING (CandID) + LEFT JOIN session s ON s.CandidateID=c.CandID + LEFT JOIN candidate_diagnosis_evolution_rel cedr on cedr.CandidateID=c.CandID WHERE s.CenterID IN ($userCenters) AND s.ProjectID IN ($userProjects) GROUP BY @@ -163,7 +163,7 @@ class OptionsEndpoint extends \NDB_Page implements RequestHandlerInterface // XXX: This should eventually be replaced by a call directly to a // Candidate endpoint or Candidate controller that will be able to // provide Diagnosis Options. - $query = 'SELECT DiagnosisID as id, Name as label FROM diagnosis'; + $query = 'SELECT DxEvolutionID as id, Name as label FROM diagnosis_evolution'; $diagnoses = $db->pselectWithIndexKey($query, [], 'id'); $sessionQuery = "SELECT diff --git a/modules/biobank/php/specimendao.class.inc b/modules/biobank/php/specimendao.class.inc index f0f111a9701..eed160ccd31 100644 --- a/modules/biobank/php/specimendao.class.inc +++ b/modules/biobank/php/specimendao.class.inc @@ -115,7 +115,7 @@ class SpecimenDAO extends \LORIS\Data\ProvisionerInstance as ParentSpecimenIDs, GROUP_CONCAT(DISTINCT bc2.Barcode) as ParentSpecimenBarcodes, - s.CandID as CandidateID, + s.CandidateID, c.PSCID as CandidatePSCID, bs.SessionID, s.CenterID as SessionCenterID, @@ -154,7 +154,7 @@ class SpecimenDAO extends \LORIS\Data\ProvisionerInstance LEFT JOIN session s ON bs.SessionID=s.ID LEFT JOIN candidate c - ON s.CandID=c.CandID + ON s.CandidateID=c.CandID LEFT JOIN biobank_specimen_pool_rel bspor ON bs.SpecimenID=bspor.SpecimenID LEFT JOIN biobank_specimen_collection bsc @@ -561,7 +561,7 @@ class SpecimenDAO extends \LORIS\Data\ProvisionerInstance SELECT IFNULL(MAX(bs.SampleNumber), 0) AS max_sample_number FROM biobank_specimen bs JOIN session s ON bs.SessionID = s.ID - WHERE s.CandID = :candId + WHERE s.CandidateID = :candId "; $sampleNumber = $this->db->pselectOneInt($query, ['candId' => $candId]); From 008c0a19f591ed3da7b3e05f1630af497078eb0e Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Wed, 29 Oct 2025 12:29:31 -0400 Subject: [PATCH 2/6] fixing static tests --- modules/biobank/php/optionsendpoint.class.inc | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/modules/biobank/php/optionsendpoint.class.inc b/modules/biobank/php/optionsendpoint.class.inc index 02bb385a1e3..d08d494fce6 100644 --- a/modules/biobank/php/optionsendpoint.class.inc +++ b/modules/biobank/php/optionsendpoint.class.inc @@ -138,18 +138,25 @@ class OptionsEndpoint extends \NDB_Page implements RequestHandlerInterface // TODO: This should eventually be replaced by a call directly to a // Candidate endpoint or Candidate controller that will be able to // provide Candidate Objects. - $query = "SELECT c.CandID as id, - PSCID as pscid, - Sex as sex, - GROUP_CONCAT(DISTINCT DxEvolutionID) as diagnosisIds, - GROUP_CONCAT(DISTINCT s.ID) as sessionIds - FROM candidate c - LEFT JOIN session s ON s.CandidateID=c.CandID - LEFT JOIN candidate_diagnosis_evolution_rel cedr on cedr.CandidateID=c.CandID - WHERE s.CenterID IN ($userCenters) - AND s.ProjectID IN ($userProjects) - GROUP BY - CandID"; + $query = " + SELECT + c.CandID as id, + PSCID as pscid, + Sex as sex, + GROUP_CONCAT(DISTINCT DxEvolutionID) as diagnosisIds, + GROUP_CONCAT(DISTINCT s.ID) as sessionIds + FROM + candidate c + LEFT JOIN session s + ON s.CandidateID=c.CandID + LEFT JOIN candidate_diagnosis_evolution_rel cedr + ON cedr.CandidateID=c.CandID + WHERE + s.CenterID IN ($userCenters) + AND s.ProjectID IN ($userProjects) + GROUP BY + CandID + "; $candidates = $db->pselectWithIndexKey($query, [], 'id'); foreach ($candidates as $id => $candidate) { $candidates[$id]['diagnosisIds'] = $candidate['diagnosisIds'] From e47a29ace84fb1e6f23bca1b6c38e8a6ade9d8c5 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Wed, 29 Oct 2025 12:40:30 -0400 Subject: [PATCH 3/6] resolving static tests --- modules/biobank/php/optionsendpoint.class.inc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/biobank/php/optionsendpoint.class.inc b/modules/biobank/php/optionsendpoint.class.inc index d08d494fce6..a1487fd7c83 100644 --- a/modules/biobank/php/optionsendpoint.class.inc +++ b/modules/biobank/php/optionsendpoint.class.inc @@ -170,7 +170,13 @@ class OptionsEndpoint extends \NDB_Page implements RequestHandlerInterface // XXX: This should eventually be replaced by a call directly to a // Candidate endpoint or Candidate controller that will be able to // provide Diagnosis Options. - $query = 'SELECT DxEvolutionID as id, Name as label FROM diagnosis_evolution'; + $query = ' + SELECT + DxEvolutionID as id, + Name as label + FROM + diagnosis_evolution + '; $diagnoses = $db->pselectWithIndexKey($query, [], 'id'); $sessionQuery = "SELECT From 078a171c21bacaab15e986aa799d11511fa0872f Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Wed, 29 Oct 2025 13:42:50 -0400 Subject: [PATCH 4/6] addressed rida's review --- modules/biobank/js/biobankIndex.js | 25151 ++++++++++++++++ modules/biobank/php/optionsendpoint.class.inc | 6 +- modules/biobank/php/specimendao.class.inc | 2 +- 3 files changed, 25155 insertions(+), 4 deletions(-) create mode 100644 modules/biobank/js/biobankIndex.js diff --git a/modules/biobank/js/biobankIndex.js b/modules/biobank/js/biobankIndex.js new file mode 100644 index 00000000000..b726ab663bd --- /dev/null +++ b/modules/biobank/js/biobankIndex.js @@ -0,0 +1,25151 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./jsx/DataTable.js": +/*!**************************!*\ + !*** ./jsx/DataTable.js ***! + \**************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); +var _typeof3 = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js")); +var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); +var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); +var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); +var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); +var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); +var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); +var _PaginationLinks = _interopRequireDefault(__webpack_require__(/*! jsx/PaginationLinks */ "./jsx/PaginationLinks.js")); +var _reactAddonsCreateFragment = _interopRequireDefault(__webpack_require__(/*! react-addons-create-fragment */ "./node_modules/react-addons-create-fragment/index.js")); +var _Form = __webpack_require__(/*! jsx/Form */ "./jsx/Form.js"); +var _reactI18next = __webpack_require__(/*! react-i18next */ "./node_modules/react-i18next/dist/es/index.js"); +function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } +function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } +function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } +function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +/** + * Data Table component + * Displays a set of data that is receives via props. + */ +var DataTable = /*#__PURE__*/function (_Component) { + (0, _inherits2["default"])(DataTable, _Component); + var _super = _createSuper(DataTable); + /** + * @constructor + * @param {object} props - React Component properties + */ + function DataTable(props) { + var _this; + (0, _classCallCheck2["default"])(this, DataTable); + _this = _super.call(this, props); + _this.state = { + page: { + number: 1, + rows: 20 + }, + sort: { + column: -1, + ascending: true + } + }; + _this.changePage = _this.changePage.bind((0, _assertThisInitialized2["default"])(_this)); + _this.setSortColumn = _this.setSortColumn.bind((0, _assertThisInitialized2["default"])(_this)); + _this.updateSortColumn = _this.updateSortColumn.bind((0, _assertThisInitialized2["default"])(_this)); + _this.toggleSortOrder = _this.toggleSortOrder.bind((0, _assertThisInitialized2["default"])(_this)); + _this.updatePageNumber = _this.updatePageNumber.bind((0, _assertThisInitialized2["default"])(_this)); + _this.updatePageRows = _this.updatePageRows.bind((0, _assertThisInitialized2["default"])(_this)); + _this.downloadCSV = _this.downloadCSV.bind((0, _assertThisInitialized2["default"])(_this)); + _this.getFilteredRowIndexes = _this.getFilteredRowIndexes.bind((0, _assertThisInitialized2["default"])(_this)); + _this.sortRows = _this.sortRows.bind((0, _assertThisInitialized2["default"])(_this)); + _this.hasFilterKeyword = _this.hasFilterKeyword.bind((0, _assertThisInitialized2["default"])(_this)); + _this.renderActions = _this.renderActions.bind((0, _assertThisInitialized2["default"])(_this)); + return _this; + } + + /** + * Set the component page variable + * to a new value + * + * @param {number} i - Page index + */ + (0, _createClass2["default"])(DataTable, [{ + key: "changePage", + value: function changePage(i) { + var page = this.state.page; + page.number = i; + this.setState({ + page: page + }); + } + + /** + * Update the sort column + * If component sort.column is already set to column + * Toggle sort.ascending + * + * @param {number} column - The column index + */ + }, { + key: "setSortColumn", + value: function setSortColumn(column) { + if (this.state.sort.column === column) { + this.toggleSortOrder(); + } else { + this.updateSortColumn(column); + } + } + + /** + * Update the sort column + * + * @param {number} column - The column index + */ + }, { + key: "updateSortColumn", + value: function updateSortColumn(column) { + var sort = this.state.sort; + sort.column = column; + this.setState({ + sort: sort + }); + } + + /** + * Toggle sort.ascending + */ + }, { + key: "toggleSortOrder", + value: function toggleSortOrder() { + var sort = this.state.sort; + sort.ascending = !sort.ascending; + this.setState({ + sort: sort + }); + } + + /** + * Updates page state + * + * @param {number} number - Number of page + */ + }, { + key: "updatePageNumber", + value: function updatePageNumber(number) { + var page = this.state.page; + page.number = number; + this.setState({ + page: page + }); + } + + /** + * Update number of rows per page + * + * @param {object} e - Event from which to abstract value + */ + }, { + key: "updatePageRows", + value: function updatePageRows(e) { + var page = Object.assign({}, this.state.page); + page.rows = e.target.value; + page.number = 1; + this.setState({ + page: page + }); + } + + /** + * Export the filtered rows and columns into a csv + * + * @param {number[]} filteredRowIndexes - The filtered Row Indexes + */ + }, { + key: "downloadCSV", + value: function downloadCSV(filteredRowIndexes) { + var _this2 = this; + var csvData = filteredRowIndexes.map(function (id) { + return _this2.props.data[id]; + }); + // Map cell data to proper values if applicable. + if (this.props.getMappedCell) { + csvData = csvData.map(function (row, i) { + return _this2.props.fields.flatMap(function (field, j) { + return _this2.props.getMappedCell(field.label, row[j], row, _this2.props.fields.map(function (val) { + return val.label; + }), j); + }); + }); + } + var csvworker = new Worker(loris.BaseURL + '/js/workers/savecsv.js'); + csvworker.addEventListener('message', function (e) { + var dataURL; + var dataDate; + var link; + if (e.data.cmd === 'SaveCSV') { + dataDate = new Date().toISOString(); + dataURL = window.URL.createObjectURL(e.data.message); + link = document.createElement('a'); + link.download = 'data-' + dataDate + '.csv'; + link.type = 'text/csv'; + link.href = dataURL; + document.body.appendChild(link); + $(link)[0].click(); + document.body.removeChild(link); + } + }); + var headerList = this.props.fields.map(function (field) { + return field.label; + }); + csvworker.postMessage({ + cmd: 'SaveFile', + data: csvData, + headers: headerList, + identifiers: this.props.RowNameMap + }); + } + + /** + * Get the Filtered Row Indexes + */ + }, { + key: "getFilteredRowIndexes", + value: function getFilteredRowIndexes() { + var useKeyword = false; + var filterValuesCount = Object.keys(this.props.filters).length; + var tableData = this.props.data; + var fieldData = this.props.fields; + var filteredIndexes = []; + + // If there are no filters set, use all the data. + var hasFilters = filterValuesCount !== 0; + if (hasFilters === false) { + for (var i = 0; i < tableData.length; i++) { + filteredIndexes.push(i); + } + return filteredIndexes; + } + if (this.props.filters.keyword) { + useKeyword = true; + } + if (useKeyword) { + filterValuesCount -= 1; + } + for (var _i = 0; _i < tableData.length; _i++) { + var headerCount = 0; + var keywordMatch = 0; + for (var j = 0; j < fieldData.length; j++) { + var data = tableData[_i] ? tableData[_i][j] : null; + if (this.hasFilterKeyword((fieldData[j].filter || {}).name, data)) { + headerCount++; + } + if (useKeyword) { + if (this.hasFilterKeyword('keyword', data)) { + keywordMatch++; + } + } + } + if (headerCount === filterValuesCount && (useKeyword === true && keywordMatch > 0 || useKeyword === false && keywordMatch === 0)) { + filteredIndexes.push(_i); + } + } + return filteredIndexes; + } + + /** + * Sort the given rows according to the sort configuration + * + * @param {number[]} rowIndexes - The row indexes + * @return {object[]} + */ + }, { + key: "sortRows", + value: function sortRows(rowIndexes) { + var _this3 = this; + var index = []; + for (var i = 0; i < rowIndexes.length; i++) { + var idx = rowIndexes[i]; + var val = this.props.data[idx][this.state.sort.column] || undefined; + + // If sortColumn is equal to default No. column, set value to be + // index + 1 + if (this.state.sort.column === -1) { + val = idx + 1; + } + var isString = typeof val === 'string' || val instanceof String; + var isNumber = !isNaN(val) && (0, _typeof2["default"])(val) !== 'object'; + if (val === '.') { + // hack to handle non-existent items in DQT + val = null; + } else if (isNumber) { + // perform type conversion (from string to int/float) + val = Number(val); + } else if (isString) { + // if string with text convert to lowercase + val = val.toLowerCase(); + } else if (Array.isArray(val)) { + val = val.join(', '); + } else { + val = undefined; + } + if (this.props.RowNameMap) { + index.push({ + RowIdx: idx, + Value: val, + Content: this.props.RowNameMap[idx] + }); + } else { + index.push({ + RowIdx: idx, + Value: val, + Content: idx + 1 + }); + } + } + index.sort(function (a, b) { + if (_this3.state.sort.ascending) { + if (a.Value === b.Value) { + // If all values are equal, sort by rownum + if (a.RowIdx < b.RowIdx) return -1; + if (a.RowIdx > b.RowIdx) return 1; + } + // Check if null values + if (a.Value === null || typeof a.Value === 'undefined') return -1; + if (b.Value === null || typeof b.Value === 'undefined') return 1; + + // Sort by value + if (a.Value < b.Value) return -1; + if (a.Value > b.Value) return 1; + } else { + if (a.Value === b.Value) { + // If all values are equal, sort by rownum + if (a.RowIdx < b.RowIdx) return 1; + if (a.RowIdx > b.RowIdx) return -1; + } + // Check if null values + if (a.Value === null || typeof a.Value === 'undefined') return 1; + if (b.Value === null || typeof b.Value === 'undefined') return -1; + + // Sort by value + if (a.Value < b.Value) return 1; + if (a.Value > b.Value) return -1; + } + // They're equal.. + return 0; + }); + return index; + } + + /** + * Searches for the filter keyword in the column cell + * + * Note: Search is case-insensitive. + * + * @param {string} name field name + * @param {string} data search string + * @return {boolean} true, if filter value is found to be a substring + * of one of the column values, false otherwise. + */ + }, { + key: "hasFilterKeyword", + value: function hasFilterKeyword(name, data) { + var filterData = null; + var exactMatch = false; + var opposite = false; + var result = false; + var searchKey = null; + var searchString = null; + if (this.props.filters[name]) { + filterData = this.props.filters[name].value; + exactMatch = this.props.filters[name].exactMatch; + opposite = this.props.filters[name].opposite; + } + + // Handle null inputs + if (filterData === null || data === null) { + return false; + } + + // Handle numeric inputs + if (typeof filterData === 'number') { + var intData = Number.parseInt(data, 10); + result = filterData === intData; + } + + // Handle string inputs + if (typeof filterData === 'string') { + searchKey = filterData.toLowerCase(); + switch ((0, _typeof2["default"])(data)) { + case 'object': + // Handles the case where the data is an array (typeof 'object') + // and you want to search through it for + // the string you are filtering by + var searchArray = data.map(function (e) { + return e.toLowerCase(); + }); + if (exactMatch) { + result = searchArray.includes(searchKey); + } else { + result = searchArray.find(function (e) { + return e.indexOf(searchKey) > -1; + }) !== undefined; + } + break; + default: + searchString = data ? data.toString().toLowerCase() : ''; + if (exactMatch) { + result = searchString === searchKey; + } else if (opposite) { + result = searchString !== searchKey; + } else { + result = searchString.indexOf(searchKey) > -1; + } + break; + } + } + + // Handle boolean inputs + if (typeof filterData === 'boolean') { + result = filterData === data; + } + + // Handle array inputs for multiselects + if ((0, _typeof2["default"])(filterData) === 'object') { + var match = false; + for (var i = 0; i < filterData.length; i += 1) { + searchKey = filterData[i].toLowerCase(); + searchString = data ? data.toString().toLowerCase() : ''; + var _searchArray = searchString.split(','); + match = _searchArray.includes(searchKey); + if (match) { + result = true; + } + } + } + return result; + } + + /** + * Called by React when the component has been rendered on the page. + */ + }, { + key: "componentDidMount", + value: function componentDidMount() { + if (!this.props.noDynamicTable) { + $('.dynamictable').DynamicTable(); + } + } + + /** + * Renders the Actions buttons. + * + * @return {string[]|void} - Array of React Elements + */ + }, { + key: "renderActions", + value: function renderActions() { + if (this.props.actions) { + return this.props.actions.map(function (action, key) { + if (action.show !== false) { + return /*#__PURE__*/_react["default"].createElement(_Form.CTA, { + key: key, + label: action.label, + onUserInput: action.action + }); + } + }); + } + } + + /** + * Renders the React component. + * + * @return {JSX} - React markup for the component + */ + }, { + key: "render", + value: function render() { + var _this4 = this; + if ((this.props.data === null || this.props.data.length === 0) && !this.props.nullTableShow) { + return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", { + className: "row" + }, /*#__PURE__*/_react["default"].createElement("div", { + className: "col-xs-12" + }, /*#__PURE__*/_react["default"].createElement("div", { + className: "pull-right", + style: { + marginRight: '10px' + } + }, this.renderActions()))), /*#__PURE__*/_react["default"].createElement("div", { + className: "alert alert-info no-result-found-panel" + }, /*#__PURE__*/_react["default"].createElement("strong", null, "No result found."))); + } + var rowsPerPage = this.state.page.rows; + var headers = this.props.hide.defaultColumn === true ? [] : [/*#__PURE__*/_react["default"].createElement("th", { + key: "th_col_0", + onClick: function onClick() { + _this4.setSortColumn(-1); + } + }, this.props.rowNumLabel)]; + var _loop = function _loop(i) { + if (_this4.props.fields[i].show === true) { + var colIndex = i + 1; + if (_this4.props.fields[i].freezeColumn === true) { + headers.push( /*#__PURE__*/_react["default"].createElement("th", { + key: 'th_col_' + colIndex, + id: _this4.props.freezeColumn, + onClick: function onClick() { + _this4.setSortColumn(i); + } + }, _this4.props.fields[i].label)); + } else { + headers.push( /*#__PURE__*/_react["default"].createElement("th", { + key: 'th_col_' + colIndex, + onClick: function onClick() { + _this4.setSortColumn(i); + } + }, _this4.props.fields[i].label)); + } + } + }; + for (var i = 0; i < this.props.fields.length; i += 1) { + _loop(i); + } + var rows = []; + var filteredRowIndexes = this.getFilteredRowIndexes(); + var filteredCount = filteredRowIndexes.length; + var index = this.sortRows(filteredRowIndexes); + var currentPageRow = rowsPerPage * (this.state.page.number - 1); + + // Format each cell for the data table. + var _loop2 = function _loop2(_i2) { + var rowIndex = index[_i2].RowIdx; + var rowData = _this4.props.data[rowIndex]; + var curRow = []; + + // Iterates through headers to populate row columns + // with corresponding data + var _loop3 = function _loop3(j) { + if (_this4.props.fields[j].show === false) { + return "continue"; + } + var celldata = rowData[j]; + var cell = null; + var row = {}; + _this4.props.fields.forEach(function (field, k) { + return row[field.label] = rowData[k]; + }); + var headers = _this4.props.fields.map(function (val) { + return val.label; + }); + + // Get custom cell formatting if available + if (_this4.props.getFormattedCell) { + cell = _this4.props.getFormattedCell(_this4.props.fields[j].label, celldata, row, headers, j); + } else { + cell = /*#__PURE__*/_react["default"].createElement("td", null, celldata); + } + if (cell !== null) { + curRow.push( /*#__PURE__*/_react["default"].cloneElement(cell, { + key: 'td_col_' + j + })); + } else { + curRow.push((0, _reactAddonsCreateFragment["default"])({ + celldata: celldata + })); + } + }; + for (var j = 0; j < _this4.props.fields.length; j += 1) { + var _ret = _loop3(j); + if (_ret === "continue") continue; + } + var rowIndexDisplay = index[_i2].Content; + rows.push( /*#__PURE__*/_react["default"].createElement("tr", { + key: 'tr_' + rowIndex, + colSpan: headers.length + }, _this4.props.hide.defaultColumn === true ? null : /*#__PURE__*/_react["default"].createElement("td", { + key: 'td_' + rowIndex + }, rowIndexDisplay), curRow)); + }; + for (var _i2 = currentPageRow; _i2 < filteredCount && rows.length < rowsPerPage; _i2++) { + _loop2(_i2); + } + var rowsPerPageDropdown = /*#__PURE__*/_react["default"].createElement("select", { + className: "input-sm perPage", + onChange: this.updatePageRows, + value: this.state.page.rows + }, /*#__PURE__*/_react["default"].createElement("option", null, "20"), /*#__PURE__*/_react["default"].createElement("option", null, "50"), /*#__PURE__*/_react["default"].createElement("option", null, "100"), /*#__PURE__*/_react["default"].createElement("option", null, "1000"), /*#__PURE__*/_react["default"].createElement("option", null, "5000"), /*#__PURE__*/_react["default"].createElement("option", null, "10000")); + + // This doesn't feel like a very robust way to handle the dropdown. + // It's not clear if there's any good way to structure this for locales that + // use RTL languages or prefer a different kind of parenthesis. + var changeRowsDropdown = /*#__PURE__*/_react["default"].createElement("span", null, "(", this.props.t('Maximum rows per page:'), " ", rowsPerPageDropdown, ")"); + var header = this.props.hide.rowsPerPage === true ? '' : /*#__PURE__*/_react["default"].createElement("div", { + className: "table-header" + }, /*#__PURE__*/_react["default"].createElement("div", { + className: "row" + }, /*#__PURE__*/_react["default"].createElement("div", { + style: { + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', + flexWrap: 'wrap', + padding: '5px 15px' + } + }, /*#__PURE__*/_react["default"].createElement("div", { + style: { + order: '1', + padding: '5px 0' + } + }, this.props.t('{{pageCount}} rows displayed of {{totalCount}}.', { + pageCount: rows.length, + totalCount: filteredCount + }), changeRowsDropdown), /*#__PURE__*/_react["default"].createElement("div", { + style: { + order: '2', + display: 'flex', + justifyContent: 'flex-end', + alignItems: 'center', + flexWrap: 'wrap', + padding: '5px 0', + marginLeft: 'auto' + } + }, this.renderActions(), this.props.hide.downloadCSV === true ? '' : /*#__PURE__*/_react["default"].createElement("button", { + className: "btn btn-primary", + onClick: this.downloadCSV.bind(null, filteredRowIndexes) + }, this.props.t('Download Data as CSV')), /*#__PURE__*/_react["default"].createElement(_PaginationLinks["default"], { + Total: filteredCount, + onChangePage: this.changePage, + RowsPerPage: rowsPerPage, + Active: this.state.page.number + }))))); + var footer = /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", { + className: "row" + }, /*#__PURE__*/_react["default"].createElement("div", { + style: { + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', + flexWrap: 'wrap', + padding: '5px 15px' + } + }, /*#__PURE__*/_react["default"].createElement("div", { + style: { + order: '1', + padding: '5px 0' + } + }, this.props.t('{{pageCount}} rows displayed of {{totalCount}}.', { + pageCount: rows.length, + totalCount: filteredCount + }), changeRowsDropdown), /*#__PURE__*/_react["default"].createElement("div", { + style: { + order: '2', + padding: '5px 0', + marginLeft: 'auto' + } + }, /*#__PURE__*/_react["default"].createElement(_PaginationLinks["default"], { + Total: filteredCount, + onChangePage: this.changePage, + RowsPerPage: rowsPerPage, + Active: this.state.page.number + }))))); + return /*#__PURE__*/_react["default"].createElement("div", { + style: { + margin: '14px' + } + }, header, /*#__PURE__*/_react["default"].createElement("table", { + className: "table table-hover table-primary table-bordered dynamictable", + id: "dynamictable" + }, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", { + className: "info" + }, headers)), this.props.folder, /*#__PURE__*/_react["default"].createElement("tbody", null, rows)), footer); + } + }]); + return DataTable; +}(_react.Component); +DataTable.propTypes = { + data: _propTypes["default"].array.isRequired, + rowNumLabel: _propTypes["default"].string, + // Function of which returns a JSX element for a table cell, takes + // parameters of the form: func(ColumnName, CellData, EntireRowData) + getFormattedCell: _propTypes["default"].func, + onSort: _propTypes["default"].func, + actions: _propTypes["default"].array, + hide: _propTypes["default"].object, + nullTableShow: _propTypes["default"].bool, + noDynamicTable: _propTypes["default"].bool, + getMappedCell: _propTypes["default"].func, + fields: _propTypes["default"].array, + RowNameMap: _propTypes["default"].array, + filters: _propTypes["default"].object, + freezeColumn: _propTypes["default"].string, + loading: _propTypes["default"].element, + folder: _propTypes["default"].element, + // Provided by withTranslation HOC + t: _propTypes["default"].func +}; +DataTable.defaultProps = { + headers: [], + data: {}, + rowNumLabel: 'No.', + filters: {}, + hide: { + rowsPerPage: false, + downloadCSV: false, + defaultColumn: false + }, + nullTableShow: false, + noDynamicTable: false +}; +var _default = exports["default"] = (0, _reactI18next.withTranslation)(['loris'])(DataTable); + +/***/ }), + +/***/ "./jsx/Filter.js": +/*!***********************!*\ + !*** ./jsx/Filter.js ***! + \***********************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); +var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); +var _Form = __webpack_require__(/*! jsx/Form */ "./jsx/Form.js"); +var _DateTimePartialElement = _interopRequireDefault(__webpack_require__(/*! jsx/form/DateTimePartialElement */ "./jsx/form/DateTimePartialElement.tsx")); +var _reactI18next = __webpack_require__(/*! react-i18next */ "./node_modules/react-i18next/dist/es/index.js"); +function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } +function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } +/** + * Filter component + * A wrapper for form elements inside a selection filter. + * + * Constructs filter fields based on this.props.fields configuration object + * + * Alters the filter object and sends it to parent on every update. + * + * @param {props} props + * @return {JSX} + */ +function Filter(props) { + /** + * Takes query params from url and triggers an update of the fields that are + * associated with those params, if they exist. + */ + (0, _react.useEffect)(function () { + var searchParams = new URLSearchParams(location.search); + searchParams.forEach(function (value, name) { + // This checks to make sure the filter actually exists + if (props.fields.find(function (field) { + return (field.filter || {}).name == name; + })) { + onFieldUpdate(name, searchParams.getAll(name)); + } + }); + }, []); + + /** + * Sets filter object to reflect values of input fields. + * + * @param {string} name - form element type (i.e component name) + * @param {string} value - the name of the form element + */ + var onFieldUpdate = function onFieldUpdate(name, value) { + var _JSON$parse = JSON.parse(JSON.stringify(props)), + fields = _JSON$parse.fields; + var type = fields.find(function (field) { + return (field.filter || {}).name == name; + }).filter.type; + var exactMatch = !(type === 'text' || type === 'date' || type === 'datetime' || type === 'multiselect'); + if (value === null || value === '' || value.constructor === Array && value.length === 0 || type === 'checkbox' && value === false) { + props.removeFilter(name); + } else { + props.addFilter(name, value, exactMatch); + } + }; + + /** + * Renders the filters based on the defined fields. + * + * @return {array} + */ + var renderFilterFields = function renderFilterFields() { + return props.fields.reduce(function (result, field) { + var filter = field.filter; + if (filter && filter.hide !== true) { + var element; + switch (filter.type) { + case 'text': + element = /*#__PURE__*/_react["default"].createElement(_Form.TextboxElement, null); + break; + case 'select': + element = /*#__PURE__*/_react["default"].createElement(_Form.SelectElement, { + options: filter.options, + sortByValue: filter.sortByValue, + autoSelect: false + }); + break; + case 'multiselect': + element = /*#__PURE__*/_react["default"].createElement(_Form.SelectElement, { + options: filter.options, + sortByValue: filter.sortByValue, + multiple: true, + emptyOption: false + }); + break; + case 'numeric': + element = /*#__PURE__*/_react["default"].createElement(_Form.NumericElement, { + options: filter.options + }); + break; + case 'date': + element = /*#__PURE__*/_react["default"].createElement(_Form.DateElement, null); + break; + case 'datetime': + element = /*#__PURE__*/_react["default"].createElement(_DateTimePartialElement["default"], null); + break; + case 'checkbox': + element = /*#__PURE__*/_react["default"].createElement(_Form.CheckboxElement, null); + break; + case 'time': + element = /*#__PURE__*/_react["default"].createElement(_Form.TimeElement, null); + break; + default: + element = /*#__PURE__*/_react["default"].createElement(_Form.TextboxElement, null); + } + + // The value prop has to default to false if the first two options + // are undefined so that the checkbox component is a controlled input + // element with a starting default value + result.push( /*#__PURE__*/_react["default"].cloneElement(element, { + key: filter.name, + name: filter.name, + label: field.label, + value: (props.filters[filter.name] || {}).value || null, + onUserInput: onFieldUpdate + })); + } + return result; + }, []); + }; + var filterPresets = function filterPresets() { + if (props.filterPresets) { + var presets = props.filterPresets.map(function (preset) { + var handleClick = function handleClick() { + return props.updateFilters(preset.filter); + }; + return /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("a", { + onClick: handleClick + }, preset.label)); + }); + return /*#__PURE__*/_react["default"].createElement("li", { + className: "dropdown" + }, /*#__PURE__*/_react["default"].createElement("a", { + className: "dropdown-toggle", + "data-toggle": "dropdown", + role: "button" + }, "Load Filter Preset ", /*#__PURE__*/_react["default"].createElement("span", { + className: "caret" + })), /*#__PURE__*/_react["default"].createElement("ul", { + className: "dropdown-menu", + role: "menu" + }, presets)); + } + }; + var filterActions = /*#__PURE__*/_react["default"].createElement("ul", { + className: "nav nav-tabs navbar-right", + style: { + borderBottom: 'none' + } + }, filterPresets(), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("a", { + role: "button", + name: "reset", + onClick: props.clearFilters + }, props.t('Clear Filters')))); + return /*#__PURE__*/_react["default"].createElement(_Form.FormElement, { + id: props.id, + name: props.name + }, /*#__PURE__*/_react["default"].createElement(_Form.FieldsetElement, { + columns: props.columns, + legend: props.title + }, filterActions, renderFilterFields())); +} +Filter.defaultProps = { + id: null, + clearFilter: function clearFilter() { + console.warn('onUpdate() callback is not set!'); + }, + columns: 1 +}; +Filter.propTypes = { + filters: _propTypes["default"].object.isRequired, + clearFilter: _propTypes["default"].func.isRequired, + id: _propTypes["default"].string, + name: _propTypes["default"].string, + columns: _propTypes["default"].number, + title: _propTypes["default"].string, + fields: _propTypes["default"].array.isRequired, + removeFilter: _propTypes["default"].func, + addFilter: _propTypes["default"].func, + filterPresets: _propTypes["default"].array, + updateFilters: _propTypes["default"].func, + clearFilters: _propTypes["default"].func, + // Provided by withTranslation HOC + t: _propTypes["default"].func +}; +var _default = exports["default"] = (0, _reactI18next.withTranslation)(['loris'])(Filter); + +/***/ }), + +/***/ "./jsx/FilterableDataTable.js": +/*!************************************!*\ + !*** ./jsx/FilterableDataTable.js ***! + \************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); +var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js")); +var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); +var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); +var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); +var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); +var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); +var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); +var _Panel = _interopRequireDefault(__webpack_require__(/*! jsx/Panel */ "./jsx/Panel.js")); +var _DataTable = _interopRequireDefault(__webpack_require__(/*! jsx/DataTable */ "./jsx/DataTable.js")); +var _Filter = _interopRequireDefault(__webpack_require__(/*! jsx/Filter */ "./jsx/Filter.js")); +var _ProgressBar = _interopRequireDefault(__webpack_require__(/*! jsx/ProgressBar */ "./jsx/ProgressBar.js")); +var _reactI18next = __webpack_require__(/*! react-i18next */ "./node_modules/react-i18next/dist/es/index.js"); +function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } +function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } +function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } +function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +/** + * FilterableDataTable component. + * A wrapper for all datatables that handles filtering. + * + * Handles the updating and clearing of the filter state based on changes sent + * from the FitlerForm. + * + * Passes the Filter to the Datatable. + * + * Deprecates Filter Form. + */ +var FilterableDataTable = /*#__PURE__*/function (_Component) { + (0, _inherits2["default"])(FilterableDataTable, _Component); + var _super = _createSuper(FilterableDataTable); + /** + * @constructor + * @param {object} props - React Component properties + */ + function FilterableDataTable(props) { + var _this; + (0, _classCallCheck2["default"])(this, FilterableDataTable); + _this = _super.call(this, props); + _this.state = { + filters: {} + }; + _this.updateFilters = _this.updateFilters.bind((0, _assertThisInitialized2["default"])(_this)); + _this.clearFilters = _this.clearFilters.bind((0, _assertThisInitialized2["default"])(_this)); + _this.validFilters = _this.validFilters.bind((0, _assertThisInitialized2["default"])(_this)); + _this.addFilter = _this.addFilter.bind((0, _assertThisInitialized2["default"])(_this)); + _this.removeFilter = _this.removeFilter.bind((0, _assertThisInitialized2["default"])(_this)); + return _this; + } + + /** + * Updates filter state + * + * @param {object} filters + */ + (0, _createClass2["default"])(FilterableDataTable, [{ + key: "updateFilters", + value: function updateFilters(filters) { + this.updateQueryParams(filters); + this.setState({ + filters: filters + }); + if (this.props.updateFilterCallback) { + this.props.updateFilterCallback(filters); + } + } + + /** + * Updates URL Query Params + * + * @param {object} filters + */ + }, { + key: "updateQueryParams", + value: function updateQueryParams(filters) { + var searchParams = new URLSearchParams(); + Object.entries(filters).forEach(function (_ref) { + var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), + name = _ref2[0], + filter = _ref2[1]; + if (filter.value.constructor === Array) { + filter.value.forEach(function (v) { + return searchParams.append(name, v); + }); + } else { + searchParams.set(name, filter.value); + } + }); + history.replaceState({}, '', "?".concat(searchParams.toString())); + } + + /** + * Add new filter to the filter object + * + * @param {string} name + * @param {*} value + * @param {boolean} exactMatch + */ + }, { + key: "addFilter", + value: function addFilter(name, value, exactMatch) { + var filters = this.state.filters; + filters[name] = { + value: value, + exactMatch: exactMatch + }; + this.updateFilters(filters); + } + + /** + * Remove filter from the filter object + * + * @param {string} name + */ + }, { + key: "removeFilter", + value: function removeFilter(name) { + var filters = this.state.filters; + delete filters[name]; + this.updateFilters(filters); + } + + /** + * Sets Filter to empty object + */ + }, { + key: "clearFilters", + value: function clearFilters() { + this.updateFilters({}); + } + + /** + * Returns the filter state, with filters that are + * set to an invalid option removed from the returned + * filters + * + * @return {object} + */ + }, { + key: "validFilters", + value: function validFilters() { + var _this2 = this; + var filters = {}; + this.props.fields.forEach(function (field) { + if (!field.filter) { + return; + } + var filtername = field.filter.name; + var filterval = _this2.state.filters[filtername]; + if (!filterval) { + return; + } + if (field.filter.type !== 'select') { + filters[filtername] = filterval; + return; + } + if (!(filterval.value in field.filter.options)) { + return; + } + filters[filtername] = filterval; + }); + return filters; + } + + /** + * Renders the React component. + * + * @return {JSX} - React markup for the component + */ + }, { + key: "render", + value: function render() { + var filters = this.validFilters(); + var filter = /*#__PURE__*/_react["default"].createElement(_Filter["default"], { + name: this.props.name + '_filter', + id: this.props.name + '_filter', + columns: this.props.columns, + filters: filters, + title: this.props.t('Selection Filter'), + filterPresets: this.props.filterPresets, + fields: this.props.fields, + addFilter: this.addFilter, + updateFilters: this.updateFilters, + removeFilter: this.removeFilter, + clearFilters: this.clearFilters + }); + var progress = this.props.progress; + var dataTable = !isNaN(progress) && progress < 100 ? /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], { + value: progress + }) : /*#__PURE__*/_react["default"].createElement(_DataTable["default"], { + data: this.props.data, + fields: this.props.fields, + filters: filters, + actions: this.props.actions, + loading: this.props.loading, + getFormattedCell: this.props.getFormattedCell, + getMappedCell: this.props.getMappedCell, + folder: this.props.folder, + nullTableShow: this.props.nullTableShow, + noDynamicTable: this.props.noDynamicTable + }); + return /*#__PURE__*/_react["default"].createElement(_Panel["default"], { + title: this.props.title + }, filter, this.props.children, dataTable); + } + }]); + return FilterableDataTable; +}(_react.Component); +FilterableDataTable.defaultProps = { + columns: 3, + noDynamicTable: false +}; +FilterableDataTable.propTypes = { + name: _propTypes["default"].string.isRequired, + title: _propTypes["default"].string, + data: _propTypes["default"].array.isRequired, + filterPresets: _propTypes["default"].object, + fields: _propTypes["default"].array.isRequired, + columns: _propTypes["default"].number, + getFormattedCell: _propTypes["default"].func, + actions: _propTypes["default"].array, + updateFilterCallback: _propTypes["default"].func, + noDynamicTable: _propTypes["default"].bool, + loading: _propTypes["default"].element, + progress: _propTypes["default"].number, + getMappedCell: _propTypes["default"].func, + folder: _propTypes["default"].element, + nullTableShow: _propTypes["default"].element, + children: _propTypes["default"].node, + // Provided by withTranslation HOC + t: _propTypes["default"].func +}; +var _default = exports["default"] = (0, _reactI18next.withTranslation)(['loris'])(FilterableDataTable); + +/***/ }), + +/***/ "./jsx/Form.js": +/*!*********************!*\ + !*** ./jsx/Form.js ***! + \*********************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); +var _typeof3 = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = exports.TimeElement = exports.TextboxElement = exports.TextareaElement = exports.TagsElement = exports.StaticElement = exports.SliderElement = exports.SelectElement = exports.SearchableDropdown = exports.RadioElement = exports.PasswordElement = exports.NumericElement = exports.LorisElement = exports.LinkElement = exports.HeaderElement = exports.FormElement = exports.FileElement = exports.FieldsetElement = exports.EmailElement = exports.DateTimeElement = exports.DateElement = exports.CheckboxElement = exports.CTA = exports.ButtonElement = void 0; +var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js")); +var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js")); +var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); +var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); +var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); +var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); +var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); +var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); +var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); +var _InputLabel = _interopRequireDefault(__webpack_require__(/*! jsx/form/InputLabel */ "./jsx/form/InputLabel.tsx")); +function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } +function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } +function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } +function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** + * This file contains React components for Loris form elements. + * + * @author Loris Team + * @version 1.0.0 + */ +/** + * Form Component. + * React wrapper for
element that accepts children react components + * + * The form elements can be passed in two ways: + * 1. A `this.props.formElements` JSON object + * 2. Form components nested directly inside + * + * Note that if both are passed `this.props.formElements` is displayed first. + * + */ +var FormElement = exports.FormElement = /*#__PURE__*/function (_Component) { + (0, _inherits2["default"])(FormElement, _Component); + var _super = _createSuper(FormElement); + /** + * @constructor + * @param {object} props - React Component properties + */ + function FormElement(props) { + var _this; + (0, _classCallCheck2["default"])(this, FormElement); + _this = _super.call(this, props); + _this.getFormElements = _this.getFormElements.bind((0, _assertThisInitialized2["default"])(_this)); + _this.handleSubmit = _this.handleSubmit.bind((0, _assertThisInitialized2["default"])(_this)); + return _this; + } + + /** + * Get form elements + * + * @return {JSX[]} - An array of element React markup + */ + (0, _createClass2["default"])(FormElement, [{ + key: "getFormElements", + value: function getFormElements() { + var formElementsHTML = []; + var columns = this.props.columns; + var maxColumnSize = 12; + var colSize = Math.floor(maxColumnSize / columns); + var colClass = 'col-xs-12 col-sm-' + colSize + ' col-md-' + colSize; + + // Render elements from JSON + var filter = this.props.formElements; + Object.keys(filter).forEach(function (objKey, index) { + var userInput = this.props.onUserInput ? this.props.onUserInput : filter[objKey].onUserInput; + var value = filter[objKey].value ? filter[objKey].value : ''; + formElementsHTML.push( /*#__PURE__*/_react["default"].createElement("div", { + key: 'el_' + index, + className: colClass + }, /*#__PURE__*/_react["default"].createElement(LorisElement, { + element: filter[objKey], + onUserInput: userInput, + value: value + }))); + }.bind(this)); + + // Render elements from React + _react["default"].Children.forEach(this.props.children, function (child, key) { + // If child is plain HTML, insert it as full size. + // Useful for inserting
to split form sections + var elementClass = 'col-xs-12 col-sm-12 col-md-12'; + + // If child is form element use appropriate size + if ( /*#__PURE__*/_react["default"].isValidElement(child) && typeof child.type === 'function') { + elementClass = colClass; + } + formElementsHTML.push( /*#__PURE__*/_react["default"].createElement("div", { + key: 'el_child_' + key, + className: elementClass + }, child)); + }); + return formElementsHTML; + } + + /** + * Execute onSubmit + * + * @param {object} e - Event + */ + }, { + key: "handleSubmit", + value: function handleSubmit(e) { + // Override default submit if property is set + if (this.props.onSubmit) { + e.preventDefault(); + this.props.onSubmit(e); + } + } + + /** + * Renders the React component. + * + * @return {JSX} - React markup for the component + */ + }, { + key: "render", + value: function render() { + var encType = this.props.fileUpload ? 'multipart/form-data' : null; + + // Generate form elements + var formElements = this.getFormElements(); + + // Flexbox is set to ensure that columns of different heights + // are displayed proportionally on the screen + var rowStyles = { + display: 'flex', + flexWrap: 'wrap' + }; + return /*#__PURE__*/_react["default"].createElement("form", { + name: this.props.name, + id: this.props.id, + className: this.props["class"], + method: this.props.method, + action: this.props.action, + encType: encType, + onSubmit: this.handleSubmit + }, /*#__PURE__*/_react["default"].createElement("div", { + className: "row", + style: rowStyles + }, formElements)); + } + }]); + return FormElement; +}(_react.Component); +FormElement.propTypes = { + name: _propTypes["default"].string.isRequired, + id: _propTypes["default"].string, + method: _propTypes["default"].oneOf(['POST', 'GET']), + action: _propTypes["default"].string, + "class": _propTypes["default"].string, + columns: _propTypes["default"].number, + formElements: _propTypes["default"].shape({ + elementName: _propTypes["default"].shape({ + name: _propTypes["default"].string, + type: _propTypes["default"].string + }) + }), + onSubmit: _propTypes["default"].func, + onUserInput: _propTypes["default"].func, + children: _propTypes["default"].node, + fileUpload: _propTypes["default"].bool +}; +FormElement.defaultProps = { + name: null, + id: null, + method: 'POST', + action: undefined, + "class": 'form-horizontal', + columns: 1, + fileUpload: false, + formElements: {}, + onSubmit: function onSubmit() { + console.warn('onSubmit() callback is not set!'); + } +}; + +/** + * FieldsetElement Component. + * React wrapper for
element that is nested inside , + * and accepts child react components. A fieldset groups related elements in a form. + * + * The form elements can be passed by nesting Form components directly inside . + * + */ +var FieldsetElement = exports.FieldsetElement = /*#__PURE__*/function (_Component2) { + (0, _inherits2["default"])(FieldsetElement, _Component2); + var _super2 = _createSuper(FieldsetElement); + /** + * @constructor + * @param {object} props - React Component properties + */ + function FieldsetElement(props) { + var _this2; + (0, _classCallCheck2["default"])(this, FieldsetElement); + _this2 = _super2.call(this, props); + _this2.getFormElements = _this2.getFormElements.bind((0, _assertThisInitialized2["default"])(_this2)); + return _this2; + } + + /** + * Get form elements + * + * @return {JSX[]} - An array of element React markup + */ + (0, _createClass2["default"])(FieldsetElement, [{ + key: "getFormElements", + value: function getFormElements() { + var formElementsHTML = []; + var columns = this.props.columns; + var maxColumnSize = 12; + var colSize = Math.floor(maxColumnSize / columns); + var colClass = 'col-xs-12 col-sm-' + colSize + ' col-md-' + colSize; + + // Render elements from React + _react["default"].Children.forEach(this.props.children, function (child, key) { + // If child is plain HTML, insert it as full size. + // Useful for inserting
to split form sections + var elementClass = 'col-xs-12 col-sm-12 col-md-12'; + + // If child is form element use appropriate size + if ( /*#__PURE__*/_react["default"].isValidElement(child) && typeof child.type === 'function') { + elementClass = colClass; + } + formElementsHTML.push( /*#__PURE__*/_react["default"].createElement("div", { + key: 'el_child_' + key, + className: elementClass + }, child)); + }); + return formElementsHTML; + } + + /** + * Renders the React component. + * + * @return {JSX} - React markup for the component + */ + }, { + key: "render", + value: function render() { + // Generate form elements + var formElements = this.getFormElements(); + return /*#__PURE__*/_react["default"].createElement("fieldset", { + name: this.props.name + }, /*#__PURE__*/_react["default"].createElement("legend", null, this.props.legend), formElements); + } + }]); + return FieldsetElement; +}(_react.Component); +FieldsetElement.propTypes = { + columns: _propTypes["default"].number, + name: _propTypes["default"].string, + legend: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]), + children: _propTypes["default"].node +}; +FieldsetElement.defaultProps = { + columns: 1, + legend: 'Selection Filter' +}; + +/** + * Search Component + * React wrapper for a searchable dropdown + */ +var SearchableDropdown = exports.SearchableDropdown = /*#__PURE__*/function (_Component3) { + (0, _inherits2["default"])(SearchableDropdown, _Component3); + var _super3 = _createSuper(SearchableDropdown); + /** + * @constructor + * @param {object} props - React Component properties + */ + function SearchableDropdown(props) { + var _this3; + (0, _classCallCheck2["default"])(this, SearchableDropdown); + _this3 = _super3.call(this, props); + _this3.state = { + currentInput: '' + }; + _this3.getKeyFromValue = _this3.getKeyFromValue.bind((0, _assertThisInitialized2["default"])(_this3)); + _this3.handleChange = _this3.handleChange.bind((0, _assertThisInitialized2["default"])(_this3)); + _this3.handleBlur = _this3.handleBlur.bind((0, _assertThisInitialized2["default"])(_this3)); + return _this3; + } + + /** + * Get key from value + * + * @param {string} value + * @return {string} + */ + (0, _createClass2["default"])(SearchableDropdown, [{ + key: "getKeyFromValue", + value: function getKeyFromValue(value) { + var options = this.props.options; + return Object.keys(options).find(function (o) { + return options[o] === value; + }); + } + + /** + * Handle change + * + * @param {object} e - Event + */ + }, { + key: "handleChange", + value: function handleChange(e) { + var value = this.getKeyFromValue(e.target.value); + // if not in strict mode and key value is undefined (i.e., not in options prop) + // set value equal to e.target.value + if (!this.props.strictSearch && value === undefined) { + value = e.target.value; + } + this.setState({ + currentInput: e.target.value + }); + this.props.onUserInput(this.props.name, value); + } + + /** + * Handle blur + * + * @param {object} e - Event + */ + }, { + key: "handleBlur", + value: function handleBlur(e) { + // null out entry if not present in options in strict mode + if (this.props.strictSearch) { + var value = e.target.value; + var options = this.props.options; + if (Object.values(options).indexOf(value) === -1) { + // empty string out both the hidden value as well as the input text + this.setState({ + currentInput: '' + }); + this.props.onUserInput(this.props.name, ''); + } + } + } + + /** + * Called by React when the component is updated. + * + * @param {object} prevProps - Previous React Component properties + */ + }, { + key: "componentDidUpdate", + value: function componentDidUpdate(prevProps) { + // need to clear out currentInput for when props.value gets wiped + // if the previous value prop contained data and the current one doesn't + // clear currentInput + if (prevProps.value && !this.props.value) { + this.setState({ + currentInput: '' + }); + } + } + + /** + * Renders the React component. + * + * @return {JSX} - React markup for the component + */ + }, { + key: "render", + value: function render() { + var sortByValue = this.props.sortByValue; + var options = this.props.options; + var strictMessage = 'Entry must be included in provided list of options.'; + var errorMessage = null; + var elementClass = 'row form-group'; + + // Add error message + if (this.props.errorMessage) { + errorMessage = /*#__PURE__*/_react["default"].createElement("span", null, this.props.errorMessage); + elementClass = 'row form-group has-error'; + } else if (this.props.required && this.props.value === '') { + var msg = 'This field is required!'; + msg += this.props.strictSearch ? ' ' + strictMessage : ''; + errorMessage = /*#__PURE__*/_react["default"].createElement("span", null, msg); + elementClass = 'row form-group has-error'; + } else if (this.props.strictSearch && this.props.value === '') { + errorMessage = /*#__PURE__*/_react["default"].createElement("span", null, strictMessage); + elementClass = 'row form-group has-error'; + } + + // determine value to place into text input + var value = ''; + // use value in options if valid + if (this.props.value !== undefined && Object.keys(options).indexOf(this.props.value) > -1) { + value = options[this.props.value]; + // else, use input text value + } else if (this.state.currentInput) { + value = this.state.currentInput; + } + var newOptions = {}; + var optionList = []; + if (sortByValue) { + for (var key in options) { + if (options.hasOwnProperty(key)) { + newOptions[options[key]] = key; + } + } + optionList = Object.keys(newOptions).sort().map(function (option) { + return /*#__PURE__*/_react["default"].createElement("option", { + value: option, + key: newOptions[option] + }); + }); + } else { + optionList = Object.keys(options).map(function (option) { + return /*#__PURE__*/_react["default"].createElement("option", { + value: options[option], + key: option + }); + }); + } + return /*#__PURE__*/_react["default"].createElement("div", { + className: elementClass + }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], { + label: this.props.label, + required: this.props.required + }), /*#__PURE__*/_react["default"].createElement("div", { + className: "col-sm-9" + }, /*#__PURE__*/_react["default"].createElement("input", { + type: "text", + name: this.props.name + '_input', + value: value, + id: this.props.id, + list: this.props.name + '_list', + className: "form-control", + placeholder: this.props.placeHolder, + onChange: this.handleChange, + onBlur: this.handleBlur, + disabled: this.props.disabled, + required: this.props.required + }), /*#__PURE__*/_react["default"].createElement("datalist", { + id: this.props.name + '_list' + }, optionList), errorMessage)); + } + }]); + return SearchableDropdown; +}(_react.Component); +SearchableDropdown.propTypes = { + name: _propTypes["default"].string.isRequired, + options: _propTypes["default"].object.isRequired, + id: _propTypes["default"].string, + // strictSearch, if set to true, will require that only options + // provided in the options prop can be submitted + strictSearch: _propTypes["default"].bool, + label: _propTypes["default"].string, + value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array]), + "class": _propTypes["default"].string, + disabled: _propTypes["default"].bool, + required: _propTypes["default"].bool, + errorMessage: _propTypes["default"].string, + placeHolder: _propTypes["default"].string, + onUserInput: _propTypes["default"].func, + sortByValue: _propTypes["default"].bool +}; +SearchableDropdown.defaultProps = { + name: '', + options: {}, + strictSearch: true, + label: '', + value: undefined, + id: null, + "class": '', + disabled: false, + required: false, + sortByValue: true, + errorMessage: null, + placeHolder: '', + onUserInput: function onUserInput() { + console.warn('onUserInput() callback is not set'); + } +}; + +/** + * Select Component + * React wrapper for a simple or 'multiple' \n
\n \n
\n \n \n
\n
\n
\n \n").replace(/(^|\n)\s*/g, ''); + +var resetOldContainer = function resetOldContainer() { + var oldContainer = getContainer(); + + if (!oldContainer) { + return; + } + + oldContainer.parentNode.removeChild(oldContainer); + removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); +}; + +var oldInputVal; // IE11 workaround, see #1109 for details + +var resetValidationMessage = function resetValidationMessage(e) { + if (Swal.isVisible() && oldInputVal !== e.target.value) { + Swal.resetValidationMessage(); + } + + oldInputVal = e.target.value; +}; + +var addInputChangeListeners = function addInputChangeListeners() { + var content = getContent(); + var input = getChildByClass(content, swalClasses.input); + var file = getChildByClass(content, swalClasses.file); + var range = content.querySelector(".".concat(swalClasses.range, " input")); + var rangeOutput = content.querySelector(".".concat(swalClasses.range, " output")); + var select = getChildByClass(content, swalClasses.select); + var checkbox = content.querySelector(".".concat(swalClasses.checkbox, " input")); + var textarea = getChildByClass(content, swalClasses.textarea); + input.oninput = resetValidationMessage; + file.onchange = resetValidationMessage; + select.onchange = resetValidationMessage; + checkbox.onchange = resetValidationMessage; + textarea.oninput = resetValidationMessage; + + range.oninput = function (e) { + resetValidationMessage(e); + rangeOutput.value = range.value; + }; + + range.onchange = function (e) { + resetValidationMessage(e); + range.nextSibling.value = range.value; + }; +}; + +var getTarget = function getTarget(target) { + return typeof target === 'string' ? document.querySelector(target) : target; +}; + +var setupAccessibility = function setupAccessibility(params) { + var popup = getPopup(); + popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); + popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); + + if (!params.toast) { + popup.setAttribute('aria-modal', 'true'); + } +}; + +var setupRTL = function setupRTL(targetElement) { + if (window.getComputedStyle(targetElement).direction === 'rtl') { + addClass(getContainer(), swalClasses.rtl); + } +}; +/* + * Add modal + backdrop to DOM + */ + + +var init = function init(params) { + // Clean up the old popup container if it exists + resetOldContainer(); + /* istanbul ignore if */ + + if (isNodeEnv()) { + error('SweetAlert2 requires document to initialize'); + return; + } + + var container = document.createElement('div'); + container.className = swalClasses.container; + container.innerHTML = sweetHTML; + var targetElement = getTarget(params.target); + targetElement.appendChild(container); + setupAccessibility(params); + setupRTL(targetElement); + addInputChangeListeners(); +}; + +var parseHtmlToContainer = function parseHtmlToContainer(param, target) { + // DOM element + if (param instanceof HTMLElement) { + target.appendChild(param); // JQuery element(s) + } else if (_typeof(param) === 'object') { + handleJqueryElem(target, param); // Plain string + } else if (param) { + target.innerHTML = param; + } +}; + +var handleJqueryElem = function handleJqueryElem(target, elem) { + target.innerHTML = ''; + + if (0 in elem) { + for (var i = 0; i in elem; i++) { + target.appendChild(elem[i].cloneNode(true)); + } + } else { + target.appendChild(elem.cloneNode(true)); + } +}; + +var animationEndEvent = function () { + // Prevent run in Node env + + /* istanbul ignore if */ + if (isNodeEnv()) { + return false; + } + + var testEl = document.createElement('div'); + var transEndEventNames = { + WebkitAnimation: 'webkitAnimationEnd', + OAnimation: 'oAnimationEnd oanimationend', + animation: 'animationend' + }; + + for (var i in transEndEventNames) { + if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') { + return transEndEventNames[i]; + } + } + + return false; +}(); + +// Measure width of scrollbar +// https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286 +var measureScrollbar = function measureScrollbar() { + var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; + + if (supportsTouch) { + return 0; + } + + var scrollDiv = document.createElement('div'); + scrollDiv.style.width = '50px'; + scrollDiv.style.height = '50px'; + scrollDiv.style.overflow = 'scroll'; + document.body.appendChild(scrollDiv); + var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; + document.body.removeChild(scrollDiv); + return scrollbarWidth; +}; + +var renderActions = function renderActions(instance, params) { + var actions = getActions(); + var confirmButton = getConfirmButton(); + var cancelButton = getCancelButton(); // Actions (buttons) wrapper + + if (!params.showConfirmButton && !params.showCancelButton) { + hide(actions); + } // Custom class + + + applyCustomClass(actions, params.customClass, 'actions'); // Render confirm button + + renderButton(confirmButton, 'confirm', params); // render Cancel Button + + renderButton(cancelButton, 'cancel', params); + + if (params.buttonsStyling) { + handleButtonsStyling(confirmButton, cancelButton, params); + } else { + removeClass([confirmButton, cancelButton], swalClasses.styled); + confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = ''; + cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = ''; + } + + if (params.reverseButtons) { + confirmButton.parentNode.insertBefore(cancelButton, confirmButton); + } +}; + +function handleButtonsStyling(confirmButton, cancelButton, params) { + addClass([confirmButton, cancelButton], swalClasses.styled); // Buttons background colors + + if (params.confirmButtonColor) { + confirmButton.style.backgroundColor = params.confirmButtonColor; + } + + if (params.cancelButtonColor) { + cancelButton.style.backgroundColor = params.cancelButtonColor; + } // Loading state + + + var confirmButtonBackgroundColor = window.getComputedStyle(confirmButton).getPropertyValue('background-color'); + confirmButton.style.borderLeftColor = confirmButtonBackgroundColor; + confirmButton.style.borderRightColor = confirmButtonBackgroundColor; +} + +function renderButton(button, buttonType, params) { + toggle(button, params['showC' + buttonType.substring(1) + 'Button'], 'inline-block'); + button.innerHTML = params[buttonType + 'ButtonText']; // Set caption text + + button.setAttribute('aria-label', params[buttonType + 'ButtonAriaLabel']); // ARIA label + // Add buttons custom classes + + button.className = swalClasses[buttonType]; + applyCustomClass(button, params.customClass, buttonType + 'Button'); + addClass(button, params[buttonType + 'ButtonClass']); +} + +function handleBackdropParam(container, backdrop) { + if (typeof backdrop === 'string') { + container.style.background = backdrop; + } else if (!backdrop) { + addClass([document.documentElement, document.body], swalClasses['no-backdrop']); + } +} + +function handlePositionParam(container, position) { + if (position in swalClasses) { + addClass(container, swalClasses[position]); + } else { + warn('The "position" parameter is not valid, defaulting to "center"'); + addClass(container, swalClasses.center); + } +} + +function handleGrowParam(container, grow) { + if (grow && typeof grow === 'string') { + var growClass = 'grow-' + grow; + + if (growClass in swalClasses) { + addClass(container, swalClasses[growClass]); + } + } +} + +var renderContainer = function renderContainer(instance, params) { + var container = getContainer(); + + if (!container) { + return; + } + + handleBackdropParam(container, params.backdrop); + + if (!params.backdrop && params.allowOutsideClick) { + warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'); + } + + handlePositionParam(container, params.position); + handleGrowParam(container, params.grow); // Custom class + + applyCustomClass(container, params.customClass, 'container'); + + if (params.customContainerClass) { + // @deprecated + addClass(container, params.customContainerClass); + } +}; + +/** + * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has. + * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` + * This is the approach that Babel will probably take to implement private methods/fields + * https://github.com/tc39/proposal-private-methods + * https://github.com/babel/babel/pull/7555 + * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* + * then we can use that language feature. + */ +var privateProps = { + promise: new WeakMap(), + innerParams: new WeakMap(), + domCache: new WeakMap() +}; + +var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; +var renderInput = function renderInput(instance, params) { + var content = getContent(); + var innerParams = privateProps.innerParams.get(instance); + var rerender = !innerParams || params.input !== innerParams.input; + inputTypes.forEach(function (inputType) { + var inputClass = swalClasses[inputType]; + var inputContainer = getChildByClass(content, inputClass); // set attributes + + setAttributes(inputType, params.inputAttributes); // set class + + inputContainer.className = inputClass; + + if (rerender) { + hide(inputContainer); + } + }); + + if (params.input) { + if (rerender) { + showInput(params); + } // set custom class + + + setCustomClass(params); + } +}; + +var showInput = function showInput(params) { + if (!renderInputType[params.input]) { + return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\"")); + } + + var inputContainer = getInputContainer(params.input); + var input = renderInputType[params.input](inputContainer, params); + show(input); // input autofocus + + setTimeout(function () { + focusInput(input); + }); +}; + +var removeAttributes = function removeAttributes(input) { + for (var i = 0; i < input.attributes.length; i++) { + var attrName = input.attributes[i].name; + + if (!(['type', 'value', 'style'].indexOf(attrName) !== -1)) { + input.removeAttribute(attrName); + } + } +}; + +var setAttributes = function setAttributes(inputType, inputAttributes) { + var input = getInput(getContent(), inputType); + + if (!input) { + return; + } + + removeAttributes(input); + + for (var attr in inputAttributes) { + // Do not set a placeholder for + // it'll crash Edge, #1298 + if (inputType === 'range' && attr === 'placeholder') { + continue; + } + + input.setAttribute(attr, inputAttributes[attr]); + } +}; + +var setCustomClass = function setCustomClass(params) { + var inputContainer = getInputContainer(params.input); + + if (params.inputClass) { + addClass(inputContainer, params.inputClass); + } + + if (params.customClass) { + addClass(inputContainer, params.customClass.input); + } +}; + +var setInputPlaceholder = function setInputPlaceholder(input, params) { + if (!input.placeholder || params.inputPlaceholder) { + input.placeholder = params.inputPlaceholder; + } +}; + +var getInputContainer = function getInputContainer(inputType) { + var inputClass = swalClasses[inputType] ? swalClasses[inputType] : swalClasses.input; + return getChildByClass(getContent(), inputClass); +}; + +var renderInputType = {}; + +renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = function (input, params) { + if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') { + input.value = params.inputValue; + } else if (!isPromise(params.inputValue)) { + warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(params.inputValue), "\"")); + } + + setInputPlaceholder(input, params); + input.type = params.input; + return input; +}; + +renderInputType.file = function (input, params) { + setInputPlaceholder(input, params); + return input; +}; + +renderInputType.range = function (range, params) { + var rangeInput = range.querySelector('input'); + var rangeOutput = range.querySelector('output'); + rangeInput.value = params.inputValue; + rangeInput.type = params.input; + rangeOutput.value = params.inputValue; + return range; +}; + +renderInputType.select = function (select, params) { + select.innerHTML = ''; + + if (params.inputPlaceholder) { + var placeholder = document.createElement('option'); + placeholder.innerHTML = params.inputPlaceholder; + placeholder.value = ''; + placeholder.disabled = true; + placeholder.selected = true; + select.appendChild(placeholder); + } + + return select; +}; + +renderInputType.radio = function (radio) { + radio.innerHTML = ''; + return radio; +}; + +renderInputType.checkbox = function (checkboxContainer, params) { + var checkbox = getInput(getContent(), 'checkbox'); + checkbox.value = 1; + checkbox.id = swalClasses.checkbox; + checkbox.checked = Boolean(params.inputValue); + var label = checkboxContainer.querySelector('span'); + label.innerHTML = params.inputPlaceholder; + return checkboxContainer; +}; + +renderInputType.textarea = function (textarea, params) { + textarea.value = params.inputValue; + setInputPlaceholder(textarea, params); + + if ('MutationObserver' in window) { + // #1699 + var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); + var popupPadding = parseInt(window.getComputedStyle(getPopup()).paddingLeft) + parseInt(window.getComputedStyle(getPopup()).paddingRight); + + var outputsize = function outputsize() { + var contentWidth = textarea.offsetWidth + popupPadding; + + if (contentWidth > initialPopupWidth) { + getPopup().style.width = contentWidth + 'px'; + } else { + getPopup().style.width = null; + } + }; + + new MutationObserver(outputsize).observe(textarea, { + attributes: true, + attributeFilter: ['style'] + }); + } + + return textarea; +}; + +var renderContent = function renderContent(instance, params) { + var content = getContent().querySelector('#' + swalClasses.content); // Content as HTML + + if (params.html) { + parseHtmlToContainer(params.html, content); + show(content, 'block'); // Content as plain text + } else if (params.text) { + content.textContent = params.text; + show(content, 'block'); // No content + } else { + hide(content); + } + + renderInput(instance, params); // Custom class + + applyCustomClass(getContent(), params.customClass, 'content'); +}; + +var renderFooter = function renderFooter(instance, params) { + var footer = getFooter(); + toggle(footer, params.footer); + + if (params.footer) { + parseHtmlToContainer(params.footer, footer); + } // Custom class + + + applyCustomClass(footer, params.customClass, 'footer'); +}; + +var renderCloseButton = function renderCloseButton(instance, params) { + var closeButton = getCloseButton(); + closeButton.innerHTML = params.closeButtonHtml; // Custom class + + applyCustomClass(closeButton, params.customClass, 'closeButton'); + toggle(closeButton, params.showCloseButton); + closeButton.setAttribute('aria-label', params.closeButtonAriaLabel); +}; + +var renderIcon = function renderIcon(instance, params) { + var innerParams = privateProps.innerParams.get(instance); // if the icon with the given type already rendered, + // apply the custom class without re-rendering the icon + + if (innerParams && params.type === innerParams.type && getIcon()) { + applyCustomClass(getIcon(), params.customClass, 'icon'); + return; + } + + hideAllIcons(); + + if (!params.type) { + return; + } + + adjustSuccessIconBackgoundColor(); + + if (Object.keys(iconTypes).indexOf(params.type) !== -1) { + var icon = elementBySelector(".".concat(swalClasses.icon, ".").concat(iconTypes[params.type])); + show(icon); // Custom class + + applyCustomClass(icon, params.customClass, 'icon'); // Animate icon + + toggleClass(icon, "swal2-animate-".concat(params.type, "-icon"), params.animation); + } else { + error("Unknown type! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.type, "\"")); + } +}; + +var hideAllIcons = function hideAllIcons() { + var icons = getIcons(); + + for (var i = 0; i < icons.length; i++) { + hide(icons[i]); + } +}; // Adjust success icon background color to match the popup background color + + +var adjustSuccessIconBackgoundColor = function adjustSuccessIconBackgoundColor() { + var popup = getPopup(); + var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); + var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); + + for (var i = 0; i < successIconParts.length; i++) { + successIconParts[i].style.backgroundColor = popupBackgroundColor; + } +}; + +var renderImage = function renderImage(instance, params) { + var image = getImage(); + + if (!params.imageUrl) { + return hide(image); + } + + show(image); // Src, alt + + image.setAttribute('src', params.imageUrl); + image.setAttribute('alt', params.imageAlt); // Width, height + + applyNumericalStyle(image, 'width', params.imageWidth); + applyNumericalStyle(image, 'height', params.imageHeight); // Class + + image.className = swalClasses.image; + applyCustomClass(image, params.customClass, 'image'); + + if (params.imageClass) { + addClass(image, params.imageClass); + } +}; + +var createStepElement = function createStepElement(step) { + var stepEl = document.createElement('li'); + addClass(stepEl, swalClasses['progress-step']); + stepEl.innerHTML = step; + return stepEl; +}; + +var createLineElement = function createLineElement(params) { + var lineEl = document.createElement('li'); + addClass(lineEl, swalClasses['progress-step-line']); + + if (params.progressStepsDistance) { + lineEl.style.width = params.progressStepsDistance; + } + + return lineEl; +}; + +var renderProgressSteps = function renderProgressSteps(instance, params) { + var progressStepsContainer = getProgressSteps(); + + if (!params.progressSteps || params.progressSteps.length === 0) { + return hide(progressStepsContainer); + } + + show(progressStepsContainer); + progressStepsContainer.innerHTML = ''; + var currentProgressStep = parseInt(params.currentProgressStep === null ? Swal.getQueueStep() : params.currentProgressStep); + + if (currentProgressStep >= params.progressSteps.length) { + warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); + } + + params.progressSteps.forEach(function (step, index) { + var stepEl = createStepElement(step); + progressStepsContainer.appendChild(stepEl); + + if (index === currentProgressStep) { + addClass(stepEl, swalClasses['active-progress-step']); + } + + if (index !== params.progressSteps.length - 1) { + var lineEl = createLineElement(step); + progressStepsContainer.appendChild(lineEl); + } + }); +}; + +var renderTitle = function renderTitle(instance, params) { + var title = getTitle(); + toggle(title, params.title || params.titleText); + + if (params.title) { + parseHtmlToContainer(params.title, title); + } + + if (params.titleText) { + title.innerText = params.titleText; + } // Custom class + + + applyCustomClass(title, params.customClass, 'title'); +}; + +var renderHeader = function renderHeader(instance, params) { + var header = getHeader(); // Custom class + + applyCustomClass(header, params.customClass, 'header'); // Progress steps + + renderProgressSteps(instance, params); // Icon + + renderIcon(instance, params); // Image + + renderImage(instance, params); // Title + + renderTitle(instance, params); // Close button + + renderCloseButton(instance, params); +}; + +var renderPopup = function renderPopup(instance, params) { + var popup = getPopup(); // Width + + applyNumericalStyle(popup, 'width', params.width); // Padding + + applyNumericalStyle(popup, 'padding', params.padding); // Background + + if (params.background) { + popup.style.background = params.background; + } // Default Class + + + popup.className = swalClasses.popup; + + if (params.toast) { + addClass([document.documentElement, document.body], swalClasses['toast-shown']); + addClass(popup, swalClasses.toast); + } else { + addClass(popup, swalClasses.modal); + } // Custom class + + + applyCustomClass(popup, params.customClass, 'popup'); + + if (typeof params.customClass === 'string') { + addClass(popup, params.customClass); + } // CSS animation + + + toggleClass(popup, swalClasses.noanimation, !params.animation); +}; + +var render = function render(instance, params) { + renderPopup(instance, params); + renderContainer(instance, params); + renderHeader(instance, params); + renderContent(instance, params); + renderActions(instance, params); + renderFooter(instance, params); + + if (typeof params.onRender === 'function') { + params.onRender(getPopup()); + } +}; + +/* + * Global function to determine if SweetAlert2 popup is shown + */ + +var isVisible$1 = function isVisible$$1() { + return isVisible(getPopup()); +}; +/* + * Global function to click 'Confirm' button + */ + +var clickConfirm = function clickConfirm() { + return getConfirmButton() && getConfirmButton().click(); +}; +/* + * Global function to click 'Cancel' button + */ + +var clickCancel = function clickCancel() { + return getCancelButton() && getCancelButton().click(); +}; + +function fire() { + var Swal = this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + return _construct(Swal, args); +} + +/** + * Returns an extended version of `Swal` containing `params` as defaults. + * Useful for reusing Swal configuration. + * + * For example: + * + * Before: + * const textPromptOptions = { input: 'text', showCancelButton: true } + * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) + * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) + * + * After: + * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) + * const {value: firstName} = await TextPrompt('What is your first name?') + * const {value: lastName} = await TextPrompt('What is your last name?') + * + * @param mixinParams + */ +function mixin(mixinParams) { + var MixinSwal = + /*#__PURE__*/ + function (_this) { + _inherits(MixinSwal, _this); + + function MixinSwal() { + _classCallCheck(this, MixinSwal); + + return _possibleConstructorReturn(this, _getPrototypeOf(MixinSwal).apply(this, arguments)); + } + + _createClass(MixinSwal, [{ + key: "_main", + value: function _main(params) { + return _get(_getPrototypeOf(MixinSwal.prototype), "_main", this).call(this, _extends({}, mixinParams, params)); + } + }]); + + return MixinSwal; + }(this); + + return MixinSwal; +} + +// private global state for the queue feature +var currentSteps = []; +/* + * Global function for chaining sweetAlert popups + */ + +var queue = function queue(steps) { + var Swal = this; + currentSteps = steps; + + var resetAndResolve = function resetAndResolve(resolve, value) { + currentSteps = []; + document.body.removeAttribute('data-swal2-queue-step'); + resolve(value); + }; + + var queueResult = []; + return new Promise(function (resolve) { + (function step(i, callback) { + if (i < currentSteps.length) { + document.body.setAttribute('data-swal2-queue-step', i); + Swal.fire(currentSteps[i]).then(function (result) { + if (typeof result.value !== 'undefined') { + queueResult.push(result.value); + step(i + 1, callback); + } else { + resetAndResolve(resolve, { + dismiss: result.dismiss + }); + } + }); + } else { + resetAndResolve(resolve, { + value: queueResult + }); + } + })(0); + }); +}; +/* + * Global function for getting the index of current popup in queue + */ + +var getQueueStep = function getQueueStep() { + return document.body.getAttribute('data-swal2-queue-step'); +}; +/* + * Global function for inserting a popup to the queue + */ + +var insertQueueStep = function insertQueueStep(step, index) { + if (index && index < currentSteps.length) { + return currentSteps.splice(index, 0, step); + } + + return currentSteps.push(step); +}; +/* + * Global function for deleting a popup from the queue + */ + +var deleteQueueStep = function deleteQueueStep(index) { + if (typeof currentSteps[index] !== 'undefined') { + currentSteps.splice(index, 1); + } +}; + +/** + * Show spinner instead of Confirm button and disable Cancel button + */ + +var showLoading = function showLoading() { + var popup = getPopup(); + + if (!popup) { + Swal.fire(''); + } + + popup = getPopup(); + var actions = getActions(); + var confirmButton = getConfirmButton(); + var cancelButton = getCancelButton(); + show(actions); + show(confirmButton); + addClass([popup, actions], swalClasses.loading); + confirmButton.disabled = true; + cancelButton.disabled = true; + popup.setAttribute('data-loading', true); + popup.setAttribute('aria-busy', true); + popup.focus(); +}; + +var RESTORE_FOCUS_TIMEOUT = 100; + +var globalState = {}; +var focusPreviousActiveElement = function focusPreviousActiveElement() { + if (globalState.previousActiveElement && globalState.previousActiveElement.focus) { + globalState.previousActiveElement.focus(); + globalState.previousActiveElement = null; + } else if (document.body) { + document.body.focus(); + } +}; // Restore previous active (focused) element + + +var restoreActiveElement = function restoreActiveElement() { + return new Promise(function (resolve) { + var x = window.scrollX; + var y = window.scrollY; + globalState.restoreFocusTimeout = setTimeout(function () { + focusPreviousActiveElement(); + resolve(); + }, RESTORE_FOCUS_TIMEOUT); // issues/900 + + if (typeof x !== 'undefined' && typeof y !== 'undefined') { + // IE doesn't have scrollX/scrollY support + window.scrollTo(x, y); + } + }); +}; + +/** + * If `timer` parameter is set, returns number of milliseconds of timer remained. + * Otherwise, returns undefined. + */ + +var getTimerLeft = function getTimerLeft() { + return globalState.timeout && globalState.timeout.getTimerLeft(); +}; +/** + * Stop timer. Returns number of milliseconds of timer remained. + * If `timer` parameter isn't set, returns undefined. + */ + +var stopTimer = function stopTimer() { + return globalState.timeout && globalState.timeout.stop(); +}; +/** + * Resume timer. Returns number of milliseconds of timer remained. + * If `timer` parameter isn't set, returns undefined. + */ + +var resumeTimer = function resumeTimer() { + return globalState.timeout && globalState.timeout.start(); +}; +/** + * Resume timer. Returns number of milliseconds of timer remained. + * If `timer` parameter isn't set, returns undefined. + */ + +var toggleTimer = function toggleTimer() { + var timer = globalState.timeout; + return timer && (timer.running ? timer.stop() : timer.start()); +}; +/** + * Increase timer. Returns number of milliseconds of an updated timer. + * If `timer` parameter isn't set, returns undefined. + */ + +var increaseTimer = function increaseTimer(n) { + return globalState.timeout && globalState.timeout.increase(n); +}; +/** + * Check if timer is running. Returns true if timer is running + * or false if timer is paused or stopped. + * If `timer` parameter isn't set, returns undefined + */ + +var isTimerRunning = function isTimerRunning() { + return globalState.timeout && globalState.timeout.isRunning(); +}; + +var defaultParams = { + title: '', + titleText: '', + text: '', + html: '', + footer: '', + type: null, + toast: false, + customClass: '', + customContainerClass: '', + target: 'body', + backdrop: true, + animation: true, + heightAuto: true, + allowOutsideClick: true, + allowEscapeKey: true, + allowEnterKey: true, + stopKeydownPropagation: true, + keydownListenerCapture: false, + showConfirmButton: true, + showCancelButton: false, + preConfirm: null, + confirmButtonText: 'OK', + confirmButtonAriaLabel: '', + confirmButtonColor: null, + confirmButtonClass: '', + cancelButtonText: 'Cancel', + cancelButtonAriaLabel: '', + cancelButtonColor: null, + cancelButtonClass: '', + buttonsStyling: true, + reverseButtons: false, + focusConfirm: true, + focusCancel: false, + showCloseButton: false, + closeButtonHtml: '×', + closeButtonAriaLabel: 'Close this dialog', + showLoaderOnConfirm: false, + imageUrl: null, + imageWidth: null, + imageHeight: null, + imageAlt: '', + imageClass: '', + timer: null, + width: null, + padding: null, + background: null, + input: null, + inputPlaceholder: '', + inputValue: '', + inputOptions: {}, + inputAutoTrim: true, + inputClass: '', + inputAttributes: {}, + inputValidator: null, + validationMessage: null, + grow: false, + position: 'center', + progressSteps: [], + currentProgressStep: null, + progressStepsDistance: null, + onBeforeOpen: null, + onOpen: null, + onRender: null, + onClose: null, + onAfterClose: null, + scrollbarPadding: true +}; +var updatableParams = ['title', 'titleText', 'text', 'html', 'type', 'customClass', 'showConfirmButton', 'showCancelButton', 'confirmButtonText', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonClass', 'cancelButtonText', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonClass', 'buttonsStyling', 'reverseButtons', 'imageUrl', 'imageWidth', 'imageHeigth', 'imageAlt', 'imageClass', 'progressSteps', 'currentProgressStep']; +var deprecatedParams = { + customContainerClass: 'customClass', + confirmButtonClass: 'customClass', + cancelButtonClass: 'customClass', + imageClass: 'customClass', + inputClass: 'customClass' +}; +var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusCancel', 'heightAuto', 'keydownListenerCapture']; +/** + * Is valid parameter + * @param {String} paramName + */ + +var isValidParameter = function isValidParameter(paramName) { + return Object.prototype.hasOwnProperty.call(defaultParams, paramName); +}; +/** + * Is valid parameter for Swal.update() method + * @param {String} paramName + */ + +var isUpdatableParameter = function isUpdatableParameter(paramName) { + return updatableParams.indexOf(paramName) !== -1; +}; +/** + * Is deprecated parameter + * @param {String} paramName + */ + +var isDeprecatedParameter = function isDeprecatedParameter(paramName) { + return deprecatedParams[paramName]; +}; + +var checkIfParamIsValid = function checkIfParamIsValid(param) { + if (!isValidParameter(param)) { + warn("Unknown parameter \"".concat(param, "\"")); + } +}; + +var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) { + if (toastIncompatibleParams.indexOf(param) !== -1) { + warn("The parameter \"".concat(param, "\" is incompatible with toasts")); + } +}; + +var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) { + if (isDeprecatedParameter(param)) { + warnAboutDepreation(param, isDeprecatedParameter(param)); + } +}; +/** + * Show relevant warnings for given params + * + * @param params + */ + + +var showWarningsForParams = function showWarningsForParams(params) { + for (var param in params) { + checkIfParamIsValid(param); + + if (params.toast) { + checkIfToastParamIsValid(param); + } + + checkIfParamIsDeprecated(); + } +}; + + + +var staticMethods = Object.freeze({ + isValidParameter: isValidParameter, + isUpdatableParameter: isUpdatableParameter, + isDeprecatedParameter: isDeprecatedParameter, + argsToParams: argsToParams, + isVisible: isVisible$1, + clickConfirm: clickConfirm, + clickCancel: clickCancel, + getContainer: getContainer, + getPopup: getPopup, + getTitle: getTitle, + getContent: getContent, + getImage: getImage, + getIcon: getIcon, + getIcons: getIcons, + getCloseButton: getCloseButton, + getActions: getActions, + getConfirmButton: getConfirmButton, + getCancelButton: getCancelButton, + getHeader: getHeader, + getFooter: getFooter, + getFocusableElements: getFocusableElements, + getValidationMessage: getValidationMessage, + isLoading: isLoading, + fire: fire, + mixin: mixin, + queue: queue, + getQueueStep: getQueueStep, + insertQueueStep: insertQueueStep, + deleteQueueStep: deleteQueueStep, + showLoading: showLoading, + enableLoading: showLoading, + getTimerLeft: getTimerLeft, + stopTimer: stopTimer, + resumeTimer: resumeTimer, + toggleTimer: toggleTimer, + increaseTimer: increaseTimer, + isTimerRunning: isTimerRunning +}); + +/** + * Enables buttons and hide loader. + */ + +function hideLoading() { + var innerParams = privateProps.innerParams.get(this); + var domCache = privateProps.domCache.get(this); + + if (!innerParams.showConfirmButton) { + hide(domCache.confirmButton); + + if (!innerParams.showCancelButton) { + hide(domCache.actions); + } + } + + removeClass([domCache.popup, domCache.actions], swalClasses.loading); + domCache.popup.removeAttribute('aria-busy'); + domCache.popup.removeAttribute('data-loading'); + domCache.confirmButton.disabled = false; + domCache.cancelButton.disabled = false; +} + +function getInput$1(instance) { + var innerParams = privateProps.innerParams.get(instance || this); + var domCache = privateProps.domCache.get(instance || this); + + if (!domCache) { + return null; + } + + return getInput(domCache.content, innerParams.input); +} + +var fixScrollbar = function fixScrollbar() { + // for queues, do not do this more than once + if (states.previousBodyPadding !== null) { + return; + } // if the body has overflow + + + if (document.body.scrollHeight > window.innerHeight) { + // add padding so the content doesn't shift after removal of scrollbar + states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); + document.body.style.paddingRight = states.previousBodyPadding + measureScrollbar() + 'px'; + } +}; +var undoScrollbar = function undoScrollbar() { + if (states.previousBodyPadding !== null) { + document.body.style.paddingRight = states.previousBodyPadding + 'px'; + states.previousBodyPadding = null; + } +}; + +/* istanbul ignore next */ + +var iOSfix = function iOSfix() { + var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; + + if (iOS && !hasClass(document.body, swalClasses.iosfix)) { + var offset = document.body.scrollTop; + document.body.style.top = offset * -1 + 'px'; + addClass(document.body, swalClasses.iosfix); + lockBodyScroll(); + } +}; + +var lockBodyScroll = function lockBodyScroll() { + // #1246 + var container = getContainer(); + var preventTouchMove; + + container.ontouchstart = function (e) { + preventTouchMove = e.target === container || !isScrollable(container) && e.target.tagName !== 'INPUT' // #1603 + ; + }; + + container.ontouchmove = function (e) { + if (preventTouchMove) { + e.preventDefault(); + e.stopPropagation(); + } + }; +}; +/* istanbul ignore next */ + + +var undoIOSfix = function undoIOSfix() { + if (hasClass(document.body, swalClasses.iosfix)) { + var offset = parseInt(document.body.style.top, 10); + removeClass(document.body, swalClasses.iosfix); + document.body.style.top = ''; + document.body.scrollTop = offset * -1; + } +}; + +var isIE11 = function isIE11() { + return !!window.MSInputMethodContext && !!document.documentMode; +}; // Fix IE11 centering sweetalert2/issues/933 + +/* istanbul ignore next */ + + +var fixVerticalPositionIE = function fixVerticalPositionIE() { + var container = getContainer(); + var popup = getPopup(); + container.style.removeProperty('align-items'); + + if (popup.offsetTop < 0) { + container.style.alignItems = 'flex-start'; + } +}; +/* istanbul ignore next */ + + +var IEfix = function IEfix() { + if (typeof window !== 'undefined' && isIE11()) { + fixVerticalPositionIE(); + window.addEventListener('resize', fixVerticalPositionIE); + } +}; +/* istanbul ignore next */ + +var undoIEfix = function undoIEfix() { + if (typeof window !== 'undefined' && isIE11()) { + window.removeEventListener('resize', fixVerticalPositionIE); + } +}; + +// Adding aria-hidden="true" to elements outside of the active modal dialog ensures that +// elements not within the active modal dialog will not be surfaced if a user opens a screen +// reader’s list of elements (headings, form controls, landmarks, etc.) in the document. + +var setAriaHidden = function setAriaHidden() { + var bodyChildren = toArray(document.body.children); + bodyChildren.forEach(function (el) { + if (el === getContainer() || contains(el, getContainer())) { + return; + } + + if (el.hasAttribute('aria-hidden')) { + el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden')); + } + + el.setAttribute('aria-hidden', 'true'); + }); +}; +var unsetAriaHidden = function unsetAriaHidden() { + var bodyChildren = toArray(document.body.children); + bodyChildren.forEach(function (el) { + if (el.hasAttribute('data-previous-aria-hidden')) { + el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden')); + el.removeAttribute('data-previous-aria-hidden'); + } else { + el.removeAttribute('aria-hidden'); + } + }); +}; + +/** + * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has. + * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` + * This is the approach that Babel will probably take to implement private methods/fields + * https://github.com/tc39/proposal-private-methods + * https://github.com/babel/babel/pull/7555 + * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* + * then we can use that language feature. + */ +var privateMethods = { + swalPromiseResolve: new WeakMap() +}; + +/* + * Instance method to close sweetAlert + */ + +function removePopupAndResetState(instance, container, isToast, onAfterClose) { + if (isToast) { + triggerOnAfterCloseAndDispose(instance, onAfterClose); + } else { + restoreActiveElement().then(function () { + return triggerOnAfterCloseAndDispose(instance, onAfterClose); + }); + globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { + capture: globalState.keydownListenerCapture + }); + globalState.keydownHandlerAdded = false; + } + + if (container.parentNode) { + container.parentNode.removeChild(container); + } + + if (isModal()) { + undoScrollbar(); + undoIOSfix(); + undoIEfix(); + unsetAriaHidden(); + } + + removeBodyClasses(); +} + +function removeBodyClasses() { + removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['toast-column']]); +} + +function disposeSwal(instance) { + // Unset this.params so GC will dispose it (#1569) + delete instance.params; // Unset globalState props so GC will dispose globalState (#1569) + + delete globalState.keydownHandler; + delete globalState.keydownTarget; // Unset WeakMaps so GC will be able to dispose them (#1569) + + unsetWeakMaps(privateProps); + unsetWeakMaps(privateMethods); +} + +function close(resolveValue) { + var popup = getPopup(); + + if (!popup || hasClass(popup, swalClasses.hide)) { + return; + } + + var innerParams = privateProps.innerParams.get(this); + + if (!innerParams) { + return; + } + + var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); + removeClass(popup, swalClasses.show); + addClass(popup, swalClasses.hide); + handlePopupAnimation(this, popup, innerParams); // Resolve Swal promise + + swalPromiseResolve(resolveValue || {}); +} + +var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) { + var container = getContainer(); // If animation is supported, animate + + var animationIsSupported = animationEndEvent && hasCssAnimation(popup); + var onClose = innerParams.onClose, + onAfterClose = innerParams.onAfterClose; + + if (onClose !== null && typeof onClose === 'function') { + onClose(popup); + } + + if (animationIsSupported) { + animatePopup(instance, popup, container, onAfterClose); + } else { + // Otherwise, remove immediately + removePopupAndResetState(instance, container, isToast(), onAfterClose); + } +}; + +var animatePopup = function animatePopup(instance, popup, container, onAfterClose) { + globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, isToast(), onAfterClose); + popup.addEventListener(animationEndEvent, function (e) { + if (e.target === popup) { + globalState.swalCloseEventFinishedCallback(); + delete globalState.swalCloseEventFinishedCallback; + } + }); +}; + +var unsetWeakMaps = function unsetWeakMaps(obj) { + for (var i in obj) { + obj[i] = new WeakMap(); + } +}; + +var triggerOnAfterCloseAndDispose = function triggerOnAfterCloseAndDispose(instance, onAfterClose) { + setTimeout(function () { + if (onAfterClose !== null && typeof onAfterClose === 'function') { + onAfterClose(); + } + + if (!getPopup()) { + disposeSwal(instance); + } + }); +}; + +function setButtonsDisabled(instance, buttons, disabled) { + var domCache = privateProps.domCache.get(instance); + buttons.forEach(function (button) { + domCache[button].disabled = disabled; + }); +} + +function setInputDisabled(input, disabled) { + if (!input) { + return false; + } + + if (input.type === 'radio') { + var radiosContainer = input.parentNode.parentNode; + var radios = radiosContainer.querySelectorAll('input'); + + for (var i = 0; i < radios.length; i++) { + radios[i].disabled = disabled; + } + } else { + input.disabled = disabled; + } +} + +function enableButtons() { + setButtonsDisabled(this, ['confirmButton', 'cancelButton'], false); +} +function disableButtons() { + setButtonsDisabled(this, ['confirmButton', 'cancelButton'], true); +} // @deprecated + +function enableConfirmButton() { + warnAboutDepreation('Swal.enableConfirmButton()', "Swal.getConfirmButton().removeAttribute('disabled')"); + setButtonsDisabled(this, ['confirmButton'], false); +} // @deprecated + +function disableConfirmButton() { + warnAboutDepreation('Swal.disableConfirmButton()', "Swal.getConfirmButton().setAttribute('disabled', '')"); + setButtonsDisabled(this, ['confirmButton'], true); +} +function enableInput() { + return setInputDisabled(this.getInput(), false); +} +function disableInput() { + return setInputDisabled(this.getInput(), true); +} + +function showValidationMessage(error) { + var domCache = privateProps.domCache.get(this); + domCache.validationMessage.innerHTML = error; + var popupComputedStyle = window.getComputedStyle(domCache.popup); + domCache.validationMessage.style.marginLeft = "-".concat(popupComputedStyle.getPropertyValue('padding-left')); + domCache.validationMessage.style.marginRight = "-".concat(popupComputedStyle.getPropertyValue('padding-right')); + show(domCache.validationMessage); + var input = this.getInput(); + + if (input) { + input.setAttribute('aria-invalid', true); + input.setAttribute('aria-describedBy', swalClasses['validation-message']); + focusInput(input); + addClass(input, swalClasses.inputerror); + } +} // Hide block with validation message + +function resetValidationMessage$1() { + var domCache = privateProps.domCache.get(this); + + if (domCache.validationMessage) { + hide(domCache.validationMessage); + } + + var input = this.getInput(); + + if (input) { + input.removeAttribute('aria-invalid'); + input.removeAttribute('aria-describedBy'); + removeClass(input, swalClasses.inputerror); + } +} + +function getProgressSteps$1() { + warnAboutDepreation('Swal.getProgressSteps()', "const swalInstance = Swal.fire({progressSteps: ['1', '2', '3']}); const progressSteps = swalInstance.params.progressSteps"); + var innerParams = privateProps.innerParams.get(this); + return innerParams.progressSteps; +} +function setProgressSteps(progressSteps) { + warnAboutDepreation('Swal.setProgressSteps()', 'Swal.update()'); + var innerParams = privateProps.innerParams.get(this); + + var updatedParams = _extends({}, innerParams, { + progressSteps: progressSteps + }); + + renderProgressSteps(this, updatedParams); + privateProps.innerParams.set(this, updatedParams); +} +function showProgressSteps() { + var domCache = privateProps.domCache.get(this); + show(domCache.progressSteps); +} +function hideProgressSteps() { + var domCache = privateProps.domCache.get(this); + hide(domCache.progressSteps); +} + +var Timer = +/*#__PURE__*/ +function () { + function Timer(callback, delay) { + _classCallCheck(this, Timer); + + this.callback = callback; + this.remaining = delay; + this.running = false; + this.start(); + } + + _createClass(Timer, [{ + key: "start", + value: function start() { + if (!this.running) { + this.running = true; + this.started = new Date(); + this.id = setTimeout(this.callback, this.remaining); + } + + return this.remaining; + } + }, { + key: "stop", + value: function stop() { + if (this.running) { + this.running = false; + clearTimeout(this.id); + this.remaining -= new Date() - this.started; + } + + return this.remaining; + } + }, { + key: "increase", + value: function increase(n) { + var running = this.running; + + if (running) { + this.stop(); + } + + this.remaining += n; + + if (running) { + this.start(); + } + + return this.remaining; + } + }, { + key: "getTimerLeft", + value: function getTimerLeft() { + if (this.running) { + this.stop(); + this.start(); + } + + return this.remaining; + } + }, { + key: "isRunning", + value: function isRunning() { + return this.running; + } + }]); + + return Timer; +}(); + +var defaultInputValidators = { + email: function email(string, validationMessage) { + return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address'); + }, + url: function url(string, validationMessage) { + // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 + return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL'); + } +}; + +function setDefaultInputValidators(params) { + // Use default `inputValidator` for supported input types if not provided + if (!params.inputValidator) { + Object.keys(defaultInputValidators).forEach(function (key) { + if (params.input === key) { + params.inputValidator = defaultInputValidators[key]; + } + }); + } +} + +function validateCustomTargetElement(params) { + // Determine if the custom target element is valid + if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { + warn('Target parameter is not valid, defaulting to "body"'); + params.target = 'body'; + } +} +/** + * Set type, text and actions on popup + * + * @param params + * @returns {boolean} + */ + + +function setParameters(params) { + setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm + + if (params.showLoaderOnConfirm && !params.preConfirm) { + 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'); + } // params.animation will be actually used in renderPopup.js + // but in case when params.animation is a function, we need to call that function + // before popup (re)initialization, so it'll be possible to check Swal.isVisible() + // inside the params.animation function + + + params.animation = callIfFunction(params.animation); + validateCustomTargetElement(params); // Replace newlines with
in title + + if (typeof params.title === 'string') { + params.title = params.title.split('\n').join('
'); + } + + init(params); +} + +function swalOpenAnimationFinished(popup, container) { + popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished); + container.style.overflowY = 'auto'; +} +/** + * Open popup, add necessary classes and styles, fix scrollbar + * + * @param {Array} params + */ + + +var openPopup = function openPopup(params) { + var container = getContainer(); + var popup = getPopup(); + + if (typeof params.onBeforeOpen === 'function') { + params.onBeforeOpen(popup); + } + + addClasses(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto' + + setScrollingVisibility(container, popup); + + if (isModal()) { + fixScrollContainer(container, params.scrollbarPadding); + } + + if (!isToast() && !globalState.previousActiveElement) { + globalState.previousActiveElement = document.activeElement; + } + + if (typeof params.onOpen === 'function') { + setTimeout(function () { + return params.onOpen(popup); + }); + } +}; + +var setScrollingVisibility = function setScrollingVisibility(container, popup) { + if (animationEndEvent && hasCssAnimation(popup)) { + container.style.overflowY = 'hidden'; + popup.addEventListener(animationEndEvent, swalOpenAnimationFinished.bind(null, popup, container)); + } else { + container.style.overflowY = 'auto'; + } +}; + +var fixScrollContainer = function fixScrollContainer(container, scrollbarPadding) { + iOSfix(); + IEfix(); + setAriaHidden(); + + if (scrollbarPadding) { + fixScrollbar(); + } // sweetalert2/issues/1247 + + + setTimeout(function () { + container.scrollTop = 0; + }); +}; + +var addClasses = function addClasses(container, popup, params) { + if (params.animation) { + addClass(popup, swalClasses.show); + } + + show(popup); + addClass([document.documentElement, document.body, container], swalClasses.shown); + + if (params.heightAuto && params.backdrop && !params.toast) { + addClass([document.documentElement, document.body], swalClasses['height-auto']); + } +}; + +var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) { + if (params.input === 'select' || params.input === 'radio') { + handleInputOptions(instance, params); + } else if (['text', 'email', 'number', 'tel', 'textarea'].indexOf(params.input) !== -1 && isPromise(params.inputValue)) { + handleInputValue(instance, params); + } +}; +var getInputValue = function getInputValue(instance, innerParams) { + var input = instance.getInput(); + + if (!input) { + return null; + } + + switch (innerParams.input) { + case 'checkbox': + return getCheckboxValue(input); + + case 'radio': + return getRadioValue(input); + + case 'file': + return getFileValue(input); + + default: + return innerParams.inputAutoTrim ? input.value.trim() : input.value; + } +}; + +var getCheckboxValue = function getCheckboxValue(input) { + return input.checked ? 1 : 0; +}; + +var getRadioValue = function getRadioValue(input) { + return input.checked ? input.value : null; +}; + +var getFileValue = function getFileValue(input) { + return input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; +}; + +var handleInputOptions = function handleInputOptions(instance, params) { + var content = getContent(); + + var processInputOptions = function processInputOptions(inputOptions) { + return populateInputOptions[params.input](content, formatInputOptions(inputOptions), params); + }; + + if (isPromise(params.inputOptions)) { + showLoading(); + params.inputOptions.then(function (inputOptions) { + instance.hideLoading(); + processInputOptions(inputOptions); + }); + } else if (_typeof(params.inputOptions) === 'object') { + processInputOptions(params.inputOptions); + } else { + error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions))); + } +}; + +var handleInputValue = function handleInputValue(instance, params) { + var input = instance.getInput(); + hide(input); + params.inputValue.then(function (inputValue) { + input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : inputValue + ''; + show(input); + input.focus(); + instance.hideLoading(); + })["catch"](function (err) { + error('Error in inputValue promise: ' + err); + input.value = ''; + show(input); + input.focus(); + instance.hideLoading(); + }); +}; + +var populateInputOptions = { + select: function select(content, inputOptions, params) { + var select = getChildByClass(content, swalClasses.select); + inputOptions.forEach(function (inputOption) { + var optionValue = inputOption[0]; + var optionLabel = inputOption[1]; + var option = document.createElement('option'); + option.value = optionValue; + option.innerHTML = optionLabel; + + if (params.inputValue.toString() === optionValue.toString()) { + option.selected = true; + } + + select.appendChild(option); + }); + select.focus(); + }, + radio: function radio(content, inputOptions, params) { + var radio = getChildByClass(content, swalClasses.radio); + inputOptions.forEach(function (inputOption) { + var radioValue = inputOption[0]; + var radioLabel = inputOption[1]; + var radioInput = document.createElement('input'); + var radioLabelElement = document.createElement('label'); + radioInput.type = 'radio'; + radioInput.name = swalClasses.radio; + radioInput.value = radioValue; + + if (params.inputValue.toString() === radioValue.toString()) { + radioInput.checked = true; + } + + var label = document.createElement('span'); + label.innerHTML = radioLabel; + label.className = swalClasses.label; + radioLabelElement.appendChild(radioInput); + radioLabelElement.appendChild(label); + radio.appendChild(radioLabelElement); + }); + var radios = radio.querySelectorAll('input'); + + if (radios.length) { + radios[0].focus(); + } + } +}; +/** + * Converts `inputOptions` into an array of `[value, label]`s + * @param inputOptions + */ + +var formatInputOptions = function formatInputOptions(inputOptions) { + var result = []; + + if (typeof Map !== 'undefined' && inputOptions instanceof Map) { + inputOptions.forEach(function (value, key) { + result.push([key, value]); + }); + } else { + Object.keys(inputOptions).forEach(function (key) { + result.push([key, inputOptions[key]]); + }); + } + + return result; +}; + +var handleConfirmButtonClick = function handleConfirmButtonClick(instance, innerParams) { + instance.disableButtons(); + + if (innerParams.input) { + handleConfirmWithInput(instance, innerParams); + } else { + confirm(instance, innerParams, true); + } +}; +var handleCancelButtonClick = function handleCancelButtonClick(instance, dismissWith) { + instance.disableButtons(); + dismissWith(DismissReason.cancel); +}; + +var handleConfirmWithInput = function handleConfirmWithInput(instance, innerParams) { + var inputValue = getInputValue(instance, innerParams); + + if (innerParams.inputValidator) { + instance.disableInput(); + var validationPromise = Promise.resolve().then(function () { + return innerParams.inputValidator(inputValue, innerParams.validationMessage); + }); + validationPromise.then(function (validationMessage) { + instance.enableButtons(); + instance.enableInput(); + + if (validationMessage) { + instance.showValidationMessage(validationMessage); + } else { + confirm(instance, innerParams, inputValue); + } + }); + } else if (!instance.getInput().checkValidity()) { + instance.enableButtons(); + instance.showValidationMessage(innerParams.validationMessage); + } else { + confirm(instance, innerParams, inputValue); + } +}; + +var succeedWith = function succeedWith(instance, value) { + instance.closePopup({ + value: value + }); +}; + +var confirm = function confirm(instance, innerParams, value) { + if (innerParams.showLoaderOnConfirm) { + showLoading(); // TODO: make showLoading an *instance* method + } + + if (innerParams.preConfirm) { + instance.resetValidationMessage(); + var preConfirmPromise = Promise.resolve().then(function () { + return innerParams.preConfirm(value, innerParams.validationMessage); + }); + preConfirmPromise.then(function (preConfirmValue) { + if (isVisible(getValidationMessage()) || preConfirmValue === false) { + instance.hideLoading(); + } else { + succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue); + } + }); + } else { + succeedWith(instance, value); + } +}; + +var addKeydownHandler = function addKeydownHandler(instance, globalState, innerParams, dismissWith) { + if (globalState.keydownTarget && globalState.keydownHandlerAdded) { + globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { + capture: globalState.keydownListenerCapture + }); + globalState.keydownHandlerAdded = false; + } + + if (!innerParams.toast) { + globalState.keydownHandler = function (e) { + return keydownHandler(instance, e, innerParams, dismissWith); + }; + + globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); + globalState.keydownListenerCapture = innerParams.keydownListenerCapture; + globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { + capture: globalState.keydownListenerCapture + }); + globalState.keydownHandlerAdded = true; + } +}; // Focus handling + +var setFocus = function setFocus(innerParams, index, increment) { + var focusableElements = getFocusableElements(); // search for visible elements and select the next possible match + + for (var i = 0; i < focusableElements.length; i++) { + index = index + increment; // rollover to first item + + if (index === focusableElements.length) { + index = 0; // go to last item + } else if (index === -1) { + index = focusableElements.length - 1; + } + + return focusableElements[index].focus(); + } // no visible focusable elements, focus the popup + + + getPopup().focus(); +}; +var arrowKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Left', 'Right', 'Up', 'Down' // IE11 +]; +var escKeys = ['Escape', 'Esc' // IE11 +]; + +var keydownHandler = function keydownHandler(instance, e, innerParams, dismissWith) { + if (innerParams.stopKeydownPropagation) { + e.stopPropagation(); + } // ENTER + + + if (e.key === 'Enter') { + handleEnter(instance, e, innerParams); // TAB + } else if (e.key === 'Tab') { + handleTab(e, innerParams); // ARROWS - switch focus between buttons + } else if (arrowKeys.indexOf(e.key) !== -1) { + handleArrows(); // ESC + } else if (escKeys.indexOf(e.key) !== -1) { + handleEsc(e, innerParams, dismissWith); + } +}; + +var handleEnter = function handleEnter(instance, e, innerParams) { + // #720 #721 + if (e.isComposing) { + return; + } + + if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) { + if (['textarea', 'file'].indexOf(innerParams.input) !== -1) { + return; // do not submit + } + + clickConfirm(); + e.preventDefault(); + } +}; + +var handleTab = function handleTab(e, innerParams) { + var targetElement = e.target; + var focusableElements = getFocusableElements(); + var btnIndex = -1; + + for (var i = 0; i < focusableElements.length; i++) { + if (targetElement === focusableElements[i]) { + btnIndex = i; + break; + } + } + + if (!e.shiftKey) { + // Cycle to the next button + setFocus(innerParams, btnIndex, 1); + } else { + // Cycle to the prev button + setFocus(innerParams, btnIndex, -1); + } + + e.stopPropagation(); + e.preventDefault(); +}; + +var handleArrows = function handleArrows() { + var confirmButton = getConfirmButton(); + var cancelButton = getCancelButton(); // focus Cancel button if Confirm button is currently focused + + if (document.activeElement === confirmButton && isVisible(cancelButton)) { + cancelButton.focus(); // and vice versa + } else if (document.activeElement === cancelButton && isVisible(confirmButton)) { + confirmButton.focus(); + } +}; + +var handleEsc = function handleEsc(e, innerParams, dismissWith) { + if (callIfFunction(innerParams.allowEscapeKey)) { + e.preventDefault(); + dismissWith(DismissReason.esc); + } +}; + +var handlePopupClick = function handlePopupClick(domCache, innerParams, dismissWith) { + if (innerParams.toast) { + handleToastClick(domCache, innerParams, dismissWith); + } else { + // Ignore click events that had mousedown on the popup but mouseup on the container + // This can happen when the user drags a slider + handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup + + handleContainerMousedown(domCache); + handleModalClick(domCache, innerParams, dismissWith); + } +}; + +var handleToastClick = function handleToastClick(domCache, innerParams, dismissWith) { + // Closing toast by internal click + domCache.popup.onclick = function () { + if (innerParams.showConfirmButton || innerParams.showCancelButton || innerParams.showCloseButton || innerParams.input) { + return; + } + + dismissWith(DismissReason.close); + }; +}; + +var ignoreOutsideClick = false; + +var handleModalMousedown = function handleModalMousedown(domCache) { + domCache.popup.onmousedown = function () { + domCache.container.onmouseup = function (e) { + domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't + // have any other direct children aside of the popup + + if (e.target === domCache.container) { + ignoreOutsideClick = true; + } + }; + }; +}; + +var handleContainerMousedown = function handleContainerMousedown(domCache) { + domCache.container.onmousedown = function () { + domCache.popup.onmouseup = function (e) { + domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup + + if (e.target === domCache.popup || domCache.popup.contains(e.target)) { + ignoreOutsideClick = true; + } + }; + }; +}; + +var handleModalClick = function handleModalClick(domCache, innerParams, dismissWith) { + domCache.container.onclick = function (e) { + if (ignoreOutsideClick) { + ignoreOutsideClick = false; + return; + } + + if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { + dismissWith(DismissReason.backdrop); + } + }; +}; + +function _main(userParams) { + showWarningsForParams(userParams); // Check if there is another Swal closing + + if (getPopup() && globalState.swalCloseEventFinishedCallback) { + globalState.swalCloseEventFinishedCallback(); + delete globalState.swalCloseEventFinishedCallback; + } // Check if there is a swal disposal defer timer + + + if (globalState.deferDisposalTimer) { + clearTimeout(globalState.deferDisposalTimer); + delete globalState.deferDisposalTimer; + } + + var innerParams = _extends({}, defaultParams, userParams); + + setParameters(innerParams); + Object.freeze(innerParams); // clear the previous timer + + if (globalState.timeout) { + globalState.timeout.stop(); + delete globalState.timeout; + } // clear the restore focus timeout + + + clearTimeout(globalState.restoreFocusTimeout); + var domCache = populateDomCache(this); + render(this, innerParams); + privateProps.innerParams.set(this, innerParams); + return swalPromise(this, domCache, innerParams); +} + +var swalPromise = function swalPromise(instance, domCache, innerParams) { + return new Promise(function (resolve) { + // functions to handle all closings/dismissals + var dismissWith = function dismissWith(dismiss) { + instance.closePopup({ + dismiss: dismiss + }); + }; + + privateMethods.swalPromiseResolve.set(instance, resolve); + setupTimer(globalState, innerParams, dismissWith); + + domCache.confirmButton.onclick = function () { + return handleConfirmButtonClick(instance, innerParams); + }; + + domCache.cancelButton.onclick = function () { + return handleCancelButtonClick(instance, dismissWith); + }; + + domCache.closeButton.onclick = function () { + return dismissWith(DismissReason.close); + }; + + handlePopupClick(domCache, innerParams, dismissWith); + addKeydownHandler(instance, globalState, innerParams, dismissWith); + + if (innerParams.toast && (innerParams.input || innerParams.footer || innerParams.showCloseButton)) { + addClass(document.body, swalClasses['toast-column']); + } else { + removeClass(document.body, swalClasses['toast-column']); + } + + handleInputOptionsAndValue(instance, innerParams); + openPopup(innerParams); + initFocus(domCache, innerParams); // Scroll container to top on open (#1247) + + domCache.container.scrollTop = 0; + }); +}; + +var populateDomCache = function populateDomCache(instance) { + var domCache = { + popup: getPopup(), + container: getContainer(), + content: getContent(), + actions: getActions(), + confirmButton: getConfirmButton(), + cancelButton: getCancelButton(), + closeButton: getCloseButton(), + validationMessage: getValidationMessage(), + progressSteps: getProgressSteps() + }; + privateProps.domCache.set(instance, domCache); + return domCache; +}; + +var setupTimer = function setupTimer(globalState$$1, innerParams, dismissWith) { + if (innerParams.timer) { + globalState$$1.timeout = new Timer(function () { + dismissWith('timer'); + delete globalState$$1.timeout; + }, innerParams.timer); + } +}; + +var initFocus = function initFocus(domCache, innerParams) { + if (innerParams.toast) { + return; + } + + if (!callIfFunction(innerParams.allowEnterKey)) { + return blurActiveElement(); + } + + if (innerParams.focusCancel && isVisible(domCache.cancelButton)) { + return domCache.cancelButton.focus(); + } + + if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) { + return domCache.confirmButton.focus(); + } + + setFocus(innerParams, -1, 1); +}; + +var blurActiveElement = function blurActiveElement() { + if (document.activeElement && typeof document.activeElement.blur === 'function') { + document.activeElement.blur(); + } +}; + +/** + * Updates popup parameters. + */ + +function update(params) { + var popup = getPopup(); + + if (!popup || hasClass(popup, swalClasses.hide)) { + return 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."); + } + + var validUpdatableParams = {}; // assign valid params from `params` to `defaults` + + Object.keys(params).forEach(function (param) { + if (Swal.isUpdatableParameter(param)) { + validUpdatableParams[param] = params[param]; + } else { + warn("Invalid parameter to update: \"".concat(param, "\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js")); + } + }); + var innerParams = privateProps.innerParams.get(this); + + var updatedParams = _extends({}, innerParams, validUpdatableParams); + + render(this, updatedParams); + privateProps.innerParams.set(this, updatedParams); + Object.defineProperties(this, { + params: { + value: _extends({}, this.params, params), + writable: false, + enumerable: true + } + }); +} + + + +var instanceMethods = Object.freeze({ + hideLoading: hideLoading, + disableLoading: hideLoading, + getInput: getInput$1, + close: close, + closePopup: close, + closeModal: close, + closeToast: close, + enableButtons: enableButtons, + disableButtons: disableButtons, + enableConfirmButton: enableConfirmButton, + disableConfirmButton: disableConfirmButton, + enableInput: enableInput, + disableInput: disableInput, + showValidationMessage: showValidationMessage, + resetValidationMessage: resetValidationMessage$1, + getProgressSteps: getProgressSteps$1, + setProgressSteps: setProgressSteps, + showProgressSteps: showProgressSteps, + hideProgressSteps: hideProgressSteps, + _main: _main, + update: update +}); + +var currentInstance; // SweetAlert constructor + +function SweetAlert() { + // Prevent run in Node env + + /* istanbul ignore if */ + if (typeof window === 'undefined') { + return; + } // Check for the existence of Promise + + /* istanbul ignore if */ + + + if (typeof Promise === 'undefined') { + error('This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)'); + } + + currentInstance = this; + + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + + var outerParams = Object.freeze(this.constructor.argsToParams(args)); + Object.defineProperties(this, { + params: { + value: outerParams, + writable: false, + enumerable: true, + configurable: true + } + }); + + var promise = this._main(this.params); + + privateProps.promise.set(this, promise); +} // `catch` cannot be the name of a module export, so we define our thenable methods here instead + + +SweetAlert.prototype.then = function (onFulfilled) { + var promise = privateProps.promise.get(this); + return promise.then(onFulfilled); +}; + +SweetAlert.prototype["finally"] = function (onFinally) { + var promise = privateProps.promise.get(this); + return promise["finally"](onFinally); +}; // Assign instance methods from src/instanceMethods/*.js to prototype + + +_extends(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor + + +_extends(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility + + +Object.keys(instanceMethods).forEach(function (key) { + SweetAlert[key] = function () { + if (currentInstance) { + var _currentInstance; + + return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments); + } + }; +}); +SweetAlert.DismissReason = DismissReason; +SweetAlert.version = '8.19.0'; + +var Swal = SweetAlert; +Swal["default"] = Swal; + +return Swal; + +}))); +if (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2} + +"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,"@charset \"UTF-8\";.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon::before{display:flex;align-items:center;font-size:2em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon::before{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;width:auto;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 .0625em #fff,0 0 0 .125em rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;transition:background-color .1s;background-color:transparent;-webkit-overflow-scrolling:touch}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-container.swal2-shown{background-color:rgba(0,0,0,.4)}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:\"\";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;outline:initial;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:inherit}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:inherit;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.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}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon::before{display:flex;align-items:center;height:92%;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.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}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning::before{content:\"!\"}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info::before{content:\"i\"}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question::before{content:\"?\"}.swal2-icon.swal2-question.swal2-arabic-question-mark::before{content:\"؟\"}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.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)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.875em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-animate-error-icon{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-animate-error-icon .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-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:-.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-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-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}}@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}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-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:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@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:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@-webkit-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-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}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-shown{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent}body.swal2-no-backdrop .swal2-shown>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-shown.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-top-left,body.swal2-no-backdrop .swal2-shown.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-top-end,body.swal2-no-backdrop .swal2-shown.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-shown.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-left,body.swal2-no-backdrop .swal2-shown.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-end,body.swal2-no-backdrop .swal2-shown.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom-left,body.swal2-no-backdrop .swal2-shown.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-bottom-end,body.swal2-no-backdrop .swal2-shown.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-shown{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}"); + +/***/ }), + +/***/ "./node_modules/tiny-warning/dist/tiny-warning.esm.js": +/*!************************************************************!*\ + !*** ./node_modules/tiny-warning/dist/tiny-warning.esm.js ***! + \************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +var isProduction = "development" === 'production'; +function warning(condition, message) { + if (!isProduction) { + if (condition) { + return; + } + + var text = "Warning: " + message; + + if (typeof console !== 'undefined') { + console.warn(text); + } + + try { + throw Error(text); + } catch (x) {} + } +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (warning); + + +/***/ }), + +/***/ "./node_modules/value-equal/esm/value-equal.js": +/*!*****************************************************!*\ + !*** ./node_modules/value-equal/esm/value-equal.js ***! + \*****************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +function valueOf(obj) { + return obj.valueOf ? obj.valueOf() : Object.prototype.valueOf.call(obj); +} + +function valueEqual(a, b) { + // Test for strict equality first. + if (a === b) return true; + + // Otherwise, if either of them == null they are not equal. + if (a == null || b == null) return false; + + if (Array.isArray(a)) { + return ( + Array.isArray(b) && + a.length === b.length && + a.every(function(item, index) { + return valueEqual(item, b[index]); + }) + ); + } + + if (typeof a === 'object' || typeof b === 'object') { + var aValue = valueOf(a); + var bValue = valueOf(b); + + if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); + + return Object.keys(Object.assign({}, a, b)).every(function(key) { + return valueEqual(a[key], b[key]); + }); + } + + return false; +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (valueEqual); + + +/***/ }), + +/***/ "./node_modules/void-elements/index.js": +/*!*********************************************!*\ + !*** ./node_modules/void-elements/index.js ***! + \*********************************************/ +/***/ ((module) => { + +/** + * This file automatically generated from `pre-publish.js`. + * Do not manually edit. + */ + +module.exports = { + "area": true, + "base": true, + "br": true, + "col": true, + "embed": true, + "hr": true, + "img": true, + "input": true, + "link": true, + "meta": true, + "param": true, + "source": true, + "track": true, + "wbr": true +}; + + +/***/ }), + +/***/ "react": +/*!************************!*\ + !*** external "React" ***! + \************************/ +/***/ ((module) => { + +"use strict"; +module.exports = window["React"]; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***! + \*****************************************************************/ +/***/ ((module) => { + +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} +module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js": +/*!***************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***! + \***************************************************************/ +/***/ ((module) => { + +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***! + \******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return arrayLikeToArray(r); +} +module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! + \**********************************************************************/ +/***/ ((module) => { + +function _assertThisInitialized(e) { + if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + return e; +} +module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js": +/*!*****************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! + \*****************************************************************/ +/***/ ((module) => { + +function asyncGeneratorStep(n, t, e, r, o, a, c) { + try { + var i = n[a](c), + u = i.value; + } catch (n) { + return void e(n); + } + i.done ? t(u) : Promise.resolve(u).then(r, o); +} +function _asyncToGenerator(n) { + return function () { + var t = this, + e = arguments; + return new Promise(function (r, o) { + var a = n.apply(t, e); + function _next(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "next", n); + } + function _throw(n) { + asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); + } + _next(void 0); + }); + }; +} +module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js": +/*!***************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***! + \***************************************************************/ +/***/ ((module) => { + +function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} +module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/createClass.js": +/*!************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/createClass.js ***! + \************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/toPropertyKey.js"); +function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); + } +} +function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} +module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/defineProperty.js": +/*!***************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***! + \***************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/toPropertyKey.js"); +function _defineProperty(e, r, t) { + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : e[r] = t, e; +} +module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/extends.js": +/*!********************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/extends.js ***! + \********************************************************/ +/***/ ((module) => { + +function _extends() { + return module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, module.exports.__esModule = true, module.exports["default"] = module.exports, _extends.apply(null, arguments); +} +module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js": +/*!***************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! + \***************************************************************/ +/***/ ((module) => { + +function _getPrototypeOf(t) { + return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { + return t.__proto__ || Object.getPrototypeOf(t); + }, module.exports.__esModule = true, module.exports["default"] = module.exports, _getPrototypeOf(t); +} +module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/inherits.js": +/*!*********************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/inherits.js ***! + \*********************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js"); +function _inherits(t, e) { + if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); + t.prototype = Object.create(e && e.prototype, { + constructor: { + value: t, + writable: !0, + configurable: !0 + } + }), Object.defineProperty(t, "prototype", { + writable: !1 + }), e && setPrototypeOf(t, e); +} +module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js": +/*!**********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! + \**********************************************************************/ +/***/ ((module) => { + +function _interopRequireDefault(e) { + return e && e.__esModule ? e : { + "default": e + }; +} +module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js": +/*!****************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***! + \****************************************************************/ +/***/ ((module) => { + +function _iterableToArray(r) { + if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); +} +module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": +/*!*********************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! + \*********************************************************************/ +/***/ ((module) => { + +function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} +module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js": +/*!****************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***! + \****************************************************************/ +/***/ ((module) => { + +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***! + \******************************************************************/ +/***/ ((module) => { + +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": +/*!**************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! + \**************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); +var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); +function _possibleConstructorReturn(t, e) { + if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; + if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); + return assertThisInitialized(t); +} +module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***! + \*******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); +function _regeneratorRuntime() { + "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ + module.exports = _regeneratorRuntime = function _regeneratorRuntime() { + return e; + }, module.exports.__esModule = true, module.exports["default"] = module.exports; + var t, + e = {}, + r = Object.prototype, + n = r.hasOwnProperty, + o = Object.defineProperty || function (t, e, r) { + t[e] = r.value; + }, + i = "function" == typeof Symbol ? Symbol : {}, + a = i.iterator || "@@iterator", + c = i.asyncIterator || "@@asyncIterator", + u = i.toStringTag || "@@toStringTag"; + function define(t, e, r) { + return Object.defineProperty(t, e, { + value: r, + enumerable: !0, + configurable: !0, + writable: !0 + }), t[e]; + } + try { + define({}, ""); + } catch (t) { + define = function define(t, e, r) { + return t[e] = r; + }; + } + function wrap(t, e, r, n) { + var i = e && e.prototype instanceof Generator ? e : Generator, + a = Object.create(i.prototype), + c = new Context(n || []); + return o(a, "_invoke", { + value: makeInvokeMethod(t, r, c) + }), a; + } + function tryCatch(t, e, r) { + try { + return { + type: "normal", + arg: t.call(e, r) + }; + } catch (t) { + return { + type: "throw", + arg: t + }; + } + } + e.wrap = wrap; + var h = "suspendedStart", + l = "suspendedYield", + f = "executing", + s = "completed", + y = {}; + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + var p = {}; + define(p, a, function () { + return this; + }); + var d = Object.getPrototypeOf, + v = d && d(d(values([]))); + v && v !== r && n.call(v, a) && (p = v); + var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); + function defineIteratorMethods(t) { + ["next", "throw", "return"].forEach(function (e) { + define(t, e, function (t) { + return this._invoke(e, t); + }); + }); + } + function AsyncIterator(t, e) { + function invoke(r, o, i, a) { + var c = tryCatch(t[r], t, o); + if ("throw" !== c.type) { + var u = c.arg, + h = u.value; + return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { + invoke("next", t, i, a); + }, function (t) { + invoke("throw", t, i, a); + }) : e.resolve(h).then(function (t) { + u.value = t, i(u); + }, function (t) { + return invoke("throw", t, i, a); + }); + } + a(c.arg); + } + var r; + o(this, "_invoke", { + value: function value(t, n) { + function callInvokeWithMethodAndArg() { + return new e(function (e, r) { + invoke(t, n, e, r); + }); + } + return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); + } + }); + } + function makeInvokeMethod(e, r, n) { + var o = h; + return function (i, a) { + if (o === f) throw Error("Generator is already running"); + if (o === s) { + if ("throw" === i) throw a; + return { + value: t, + done: !0 + }; + } + for (n.method = i, n.arg = a;;) { + var c = n.delegate; + if (c) { + var u = maybeInvokeDelegate(c, n); + if (u) { + if (u === y) continue; + return u; + } + } + if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { + if (o === h) throw o = s, n.arg; + n.dispatchException(n.arg); + } else "return" === n.method && n.abrupt("return", n.arg); + o = f; + var p = tryCatch(e, r, n); + if ("normal" === p.type) { + if (o = n.done ? s : l, p.arg === y) continue; + return { + value: p.arg, + done: n.done + }; + } + "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); + } + }; + } + function maybeInvokeDelegate(e, r) { + var n = r.method, + o = e.iterator[n]; + if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; + var i = tryCatch(o, e.iterator, r.arg); + if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; + var a = i.arg; + return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); + } + function pushTryEntry(t) { + var e = { + tryLoc: t[0] + }; + 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); + } + function resetTryEntry(t) { + var e = t.completion || {}; + e.type = "normal", delete e.arg, t.completion = e; + } + function Context(t) { + this.tryEntries = [{ + tryLoc: "root" + }], t.forEach(pushTryEntry, this), this.reset(!0); + } + function values(e) { + if (e || "" === e) { + var r = e[a]; + if (r) return r.call(e); + if ("function" == typeof e.next) return e; + if (!isNaN(e.length)) { + var o = -1, + i = function next() { + for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; + return next.value = t, next.done = !0, next; + }; + return i.next = i; + } + } + throw new TypeError(_typeof(e) + " is not iterable"); + } + return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { + value: GeneratorFunctionPrototype, + configurable: !0 + }), o(GeneratorFunctionPrototype, "constructor", { + value: GeneratorFunction, + configurable: !0 + }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { + var e = "function" == typeof t && t.constructor; + return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); + }, e.mark = function (t) { + return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; + }, e.awrap = function (t) { + return { + __await: t + }; + }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { + return this; + }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { + void 0 === i && (i = Promise); + var a = new AsyncIterator(wrap(t, r, n, o), i); + return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { + return t.done ? t.value : a.next(); + }); + }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { + return this; + }), define(g, "toString", function () { + return "[object Generator]"; + }), e.keys = function (t) { + var e = Object(t), + r = []; + for (var n in e) r.push(n); + return r.reverse(), function next() { + for (; r.length;) { + var t = r.pop(); + if (t in e) return next.value = t, next.done = !1, next; + } + return next.done = !0, next; + }; + }, e.values = values, Context.prototype = { + constructor: Context, + reset: function reset(e) { + if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); + }, + stop: function stop() { + this.done = !0; + var t = this.tryEntries[0].completion; + if ("throw" === t.type) throw t.arg; + return this.rval; + }, + dispatchException: function dispatchException(e) { + if (this.done) throw e; + var r = this; + function handle(n, o) { + return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; + } + for (var o = this.tryEntries.length - 1; o >= 0; --o) { + var i = this.tryEntries[o], + a = i.completion; + if ("root" === i.tryLoc) return handle("end"); + if (i.tryLoc <= this.prev) { + var c = n.call(i, "catchLoc"), + u = n.call(i, "finallyLoc"); + if (c && u) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } else if (c) { + if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); + } else { + if (!u) throw Error("try statement without catch or finally"); + if (this.prev < i.finallyLoc) return handle(i.finallyLoc); + } + } + } + }, + abrupt: function abrupt(t, e) { + for (var r = this.tryEntries.length - 1; r >= 0; --r) { + var o = this.tryEntries[r]; + if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { + var i = o; + break; + } + } + i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); + var a = i ? i.completion : {}; + return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); + }, + complete: function complete(t, e) { + if ("throw" === t.type) throw t.arg; + return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; + }, + finish: function finish(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; + } + }, + "catch": function _catch(t) { + for (var e = this.tryEntries.length - 1; e >= 0; --e) { + var r = this.tryEntries[e]; + if (r.tryLoc === t) { + var n = r.completion; + if ("throw" === n.type) { + var o = n.arg; + resetTryEntry(r); + } + return o; + } + } + throw Error("illegal catch attempt"); + }, + delegateYield: function delegateYield(e, r, n) { + return this.delegate = { + iterator: values(e), + resultName: r, + nextLoc: n + }, "next" === this.method && (this.arg = t), y; + } + }, e; +} +module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js": +/*!***************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! + \***************************************************************/ +/***/ ((module) => { + +function _setPrototypeOf(t, e) { + return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, module.exports.__esModule = true, module.exports["default"] = module.exports, _setPrototypeOf(t, e); +} +module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js": +/*!**************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***! + \**************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js"); +var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"); +var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); +var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js"); +function _slicedToArray(r, e) { + return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest(); +} +module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***! + \******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js"); +var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/iterableToArray.js"); +var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); +var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js"); +function _toConsumableArray(r) { + return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread(); +} +module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/toPrimitive.js": +/*!************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***! + \************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); +function toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[Symbol.toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/toPropertyKey.js": +/*!**************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***! + \**************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); +var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/toPrimitive.js"); +function toPropertyKey(t) { + var i = toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/typeof.js": +/*!*******************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! + \*******************************************************/ +/***/ ((module) => { + +function _typeof(o) { + "@babel/helpers - typeof"; + + return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); +} +module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js": +/*!***************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***! + \***************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0; + } +} +module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; + +/***/ }), + +/***/ "./node_modules/@babel/runtime/regenerator/index.js": +/*!**********************************************************!*\ + !*** ./node_modules/@babel/runtime/regenerator/index.js ***! + \**********************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// TODO(Babel 8): Remove this file. + +var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js")(); +module.exports = runtime; + +// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= +try { + regeneratorRuntime = runtime; +} catch (accidentalStrictMode) { + if (typeof globalThis === "object") { + globalThis.regeneratorRuntime = runtime; + } else { + Function("r", "regeneratorRuntime = r")(runtime); + } +} + + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": +/*!************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _extends) +/* harmony export */ }); +function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, _extends.apply(null, arguments); +} + + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js": +/*!******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***! + \******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _inheritsLoose) +/* harmony export */ }); +/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); + +function _inheritsLoose(t, o) { + t.prototype = Object.create(o.prototype), t.prototype.constructor = t, (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t, o); +} + + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": +/*!*********************************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _objectWithoutPropertiesLoose) +/* harmony export */ }); +function _objectWithoutPropertiesLoose(r, e) { + if (null == r) return {}; + var t = {}; + for (var n in r) if ({}.hasOwnProperty.call(r, n)) { + if (-1 !== e.indexOf(n)) continue; + t[n] = r[n]; + } + return t; +} + + +/***/ }), + +/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": +/*!*******************************************************************!*\ + !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ _setPrototypeOf) +/* harmony export */ }); +function _setPrototypeOf(t, e) { + return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { + return t.__proto__ = e, t; + }, _setPrototypeOf(t, e); +} + + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/I18nextProvider.js": +/*!***************************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/I18nextProvider.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ I18nextProvider: () => (/* binding */ I18nextProvider) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); + + +function I18nextProvider({ + i18n, + defaultNS, + children +}) { + const value = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ + i18n, + defaultNS + }), [i18n, defaultNS]); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_context_js__WEBPACK_IMPORTED_MODULE_1__.I18nContext.Provider, { + value + }, children); +} + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/Trans.js": +/*!*****************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/Trans.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Trans: () => (/* binding */ Trans), +/* harmony export */ nodesToString: () => (/* reexport safe */ _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__.nodesToString) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransWithoutContext.js */ "./node_modules/react-i18next/dist/es/TransWithoutContext.js"); +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); + + + + +function Trans({ + children, + count, + parent, + i18nKey, + context, + tOptions = {}, + values, + defaults, + components, + ns, + i18n: i18nFromProps, + t: tFromProps, + shouldUnescape, + ...additionalProps +}) { + const { + i18n: i18nFromContext, + defaultNS: defaultNSFromContext + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_js__WEBPACK_IMPORTED_MODULE_2__.I18nContext) || {}; + const i18n = i18nFromProps || i18nFromContext || (0,_context_js__WEBPACK_IMPORTED_MODULE_2__.getI18n)(); + const t = tFromProps || i18n?.t.bind(i18n); + return (0,_TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__.Trans)({ + children, + count, + parent, + i18nKey, + context, + tOptions, + values, + defaults, + components, + ns: ns || t?.ns || defaultNSFromContext || i18n?.options?.defaultNS, + i18n, + t: tFromProps, + shouldUnescape, + ...additionalProps + }); +} + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/TransWithoutContext.js": +/*!*******************************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/TransWithoutContext.js ***! + \*******************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Trans: () => (/* binding */ Trans), +/* harmony export */ nodesToString: () => (/* binding */ nodesToString) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var html_parse_stringify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! html-parse-stringify */ "./node_modules/html-parse-stringify/dist/html-parse-stringify.module.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); +/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); +/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); + + + + + +const hasChildren = (node, checkLength) => { + if (!node) return false; + const base = node.props?.children ?? node.children; + if (checkLength) return base.length > 0; + return !!base; +}; +const getChildren = node => { + if (!node) return []; + const children = node.props?.children ?? node.children; + return node.props?.i18nIsDynamicList ? getAsArray(children) : children; +}; +const hasValidReactChildren = children => Array.isArray(children) && children.every(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement); +const getAsArray = data => Array.isArray(data) ? data : [data]; +const mergeProps = (source, target) => { + const newTarget = { + ...target + }; + newTarget.props = Object.assign(source.props, target.props); + return newTarget; +}; +const nodesToString = (children, i18nOptions, i18n, i18nKey) => { + if (!children) return ''; + let stringNode = ''; + const childrenArray = getAsArray(children); + const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : []; + childrenArray.forEach((child, childIndex) => { + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(child)) { + stringNode += `${child}`; + return; + } + if ((0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(child)) { + const { + props, + type + } = child; + const childPropsCount = Object.keys(props).length; + const shouldKeepChild = keepArray.indexOf(type) > -1; + const childChildren = props.children; + if (!childChildren && shouldKeepChild && !childPropsCount) { + stringNode += `<${type}/>`; + return; + } + if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) { + stringNode += `<${childIndex}>`; + return; + } + if (shouldKeepChild && childPropsCount === 1 && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(childChildren)) { + stringNode += `<${type}>${childChildren}`; + return; + } + const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey); + stringNode += `<${childIndex}>${content}`; + return; + } + if (child === null) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warn)(i18n, 'TRANS_NULL_VALUE', `Passed in a null value as child`, { + i18nKey + }); + return; + } + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child)) { + const { + format, + ...clone + } = child; + const keys = Object.keys(clone); + if (keys.length === 1) { + const value = format ? `${keys[0]}, ${format}` : keys[0]; + stringNode += `{{${value}}}`; + return; + } + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warn)(i18n, 'TRANS_INVALID_OBJ', `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, { + i18nKey, + child + }); + return; + } + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warn)(i18n, 'TRANS_INVALID_VAR', `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, { + i18nKey, + child + }); + }); + return stringNode; +}; +const renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) => { + if (targetString === '') return []; + const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || []; + const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map(keep => `<${keep}`).join('|')).test(targetString); + if (!children && !emptyChildrenButNeedsHandling && !shouldUnescape) return [targetString]; + const data = {}; + const getData = childs => { + const childrenArray = getAsArray(childs); + childrenArray.forEach(child => { + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(child)) return; + if (hasChildren(child)) getData(getChildren(child));else if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child) && !(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(child)) Object.assign(data, child); + }); + }; + getData(children); + const ast = html_parse_stringify__WEBPACK_IMPORTED_MODULE_1__["default"].parse(`<0>${targetString}`); + const opts = { + ...data, + ...combinedTOpts + }; + const renderInner = (child, node, rootReactNode) => { + const childs = getChildren(child); + const mappedChildren = mapAST(childs, node.children, rootReactNode); + return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren; + }; + const pushTranslatedJSX = (child, inner, mem, i, isVoid) => { + if (child.dummy) { + child.children = inner; + mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(child, { + key: i + }, isVoid ? undefined : inner)); + } else { + mem.push(...react__WEBPACK_IMPORTED_MODULE_0__.Children.map([child], c => { + const props = { + ...c.props + }; + delete props.i18nIsDynamicList; + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(c.type, { + ...props, + key: i, + ref: c.ref + }, isVoid ? null : inner); + })); + } + }; + const mapAST = (reactNode, astNode, rootReactNode) => { + const reactNodes = getAsArray(reactNode); + const astNodes = getAsArray(astNode); + return astNodes.reduce((mem, node, i) => { + const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language); + if (node.type === 'tag') { + let tmp = reactNodes[parseInt(node.name, 10)]; + if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name]; + if (!tmp) tmp = {}; + const child = Object.keys(node.attrs).length !== 0 ? mergeProps({ + props: node.attrs + }, tmp) : tmp; + const isElement = (0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(child); + const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement; + const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child) && child.dummy && !isElement; + const isKnownComponent = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(children) && Object.hasOwnProperty.call(children, node.name); + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(child)) { + const value = i18n.services.interpolator.interpolate(child, opts, i18n.language); + mem.push(value); + } else if (hasChildren(child) || isValidTranslationWithChildren) { + const inner = renderInner(child, node, rootReactNode); + pushTranslatedJSX(child, inner, mem, i); + } else if (isEmptyTransWithHTML) { + const inner = mapAST(reactNodes, node.children, rootReactNode); + pushTranslatedJSX(child, inner, mem, i); + } else if (Number.isNaN(parseFloat(node.name))) { + if (isKnownComponent) { + const inner = renderInner(child, node, rootReactNode); + pushTranslatedJSX(child, inner, mem, i, node.voidElement); + } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) { + if (node.voidElement) { + mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(node.name, { + key: `${node.name}-${i}` + })); + } else { + const inner = mapAST(reactNodes, node.children, rootReactNode); + mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(node.name, { + key: `${node.name}-${i}` + }, inner)); + } + } else if (node.voidElement) { + mem.push(`<${node.name} />`); + } else { + const inner = mapAST(reactNodes, node.children, rootReactNode); + mem.push(`<${node.name}>${inner}`); + } + } else if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child) && !isElement) { + const content = node.children[0] ? translationContent : null; + if (content) mem.push(content); + } else { + pushTranslatedJSX(child, translationContent, mem, i, node.children.length !== 1 || !translationContent); + } + } else if (node.type === 'text') { + const wrapTextNodes = i18nOptions.transWrapTextNodes; + const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language); + if (wrapTextNodes) { + mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(wrapTextNodes, { + key: `${node.name}-${i}` + }, content)); + } else { + mem.push(content); + } + } + return mem; + }, []); + }; + const result = mapAST([{ + dummy: true, + children: children || [] + }], ast, getAsArray(children || [])); + return getChildren(result[0]); +}; +const fixComponentProps = (component, index, translation) => { + const componentKey = component.key || index; + const comp = (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(component, { + key: componentKey + }); + if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) { + return comp; + } + function Componentized() { + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, comp); + } + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Componentized, { + key: componentKey + }); +}; +const generateArrayComponents = (components, translation) => components.map((c, index) => fixComponentProps(c, index, translation)); +const generateObjectComponents = (components, translation) => { + const componentMap = {}; + Object.keys(components).forEach(c => { + Object.assign(componentMap, { + [c]: fixComponentProps(components[c], c, translation) + }); + }); + return componentMap; +}; +const generateComponents = (components, translation, i18n, i18nKey) => { + if (!components) return null; + if (Array.isArray(components)) { + return generateArrayComponents(components, translation); + } + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(components)) { + return generateObjectComponents(components, translation); + } + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'TRANS_INVALID_COMPONENTS', ` "components" prop expects an object or array`, { + i18nKey + }); + return null; +}; +function Trans({ + children, + count, + parent, + i18nKey, + context, + tOptions = {}, + values, + defaults, + components, + ns, + i18n: i18nFromProps, + t: tFromProps, + shouldUnescape, + ...additionalProps +}) { + const i18n = i18nFromProps || (0,_i18nInstance_js__WEBPACK_IMPORTED_MODULE_4__.getI18n)(); + if (!i18n) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'NO_I18NEXT_INSTANCE', `Trans: You need to pass in an i18next instance using i18nextReactModule`, { + i18nKey + }); + return children; + } + const t = tFromProps || i18n.t.bind(i18n) || (k => k); + const reactI18nextOptions = { + ...(0,_defaults_js__WEBPACK_IMPORTED_MODULE_3__.getDefaults)(), + ...i18n.options?.react + }; + let namespaces = ns || t.ns || i18n.options?.defaultNS; + namespaces = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(namespaces) ? [namespaces] : namespaces || ['translation']; + const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey); + const defaultValue = defaults || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey; + const { + hashTransKey + } = reactI18nextOptions; + const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue); + if (i18n.options?.interpolation?.defaultVariables) { + values = values && Object.keys(values).length > 0 ? { + ...values, + ...i18n.options.interpolation.defaultVariables + } : { + ...i18n.options.interpolation.defaultVariables + }; + } + const interpolationOverride = values || count !== undefined && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : { + interpolation: { + ...tOptions.interpolation, + prefix: '#$?', + suffix: '?$#' + } + }; + const combinedTOpts = { + ...tOptions, + context: context || tOptions.context, + count, + ...values, + ...interpolationOverride, + defaultValue, + ns: namespaces + }; + const translation = key ? t(key, combinedTOpts) : defaultValue; + const generatedComponents = generateComponents(components, translation, i18n, i18nKey); + const content = renderNodes(generatedComponents || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape); + const useAsParent = parent ?? reactI18nextOptions.defaultTransParent; + return useAsParent ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(useAsParent, additionalProps, content) : content; +} + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/Translation.js": +/*!***********************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/Translation.js ***! + \***********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Translation: () => (/* binding */ Translation) +/* harmony export */ }); +/* harmony import */ var _useTranslation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./useTranslation.js */ "./node_modules/react-i18next/dist/es/useTranslation.js"); + +const Translation = ({ + ns, + children, + ...options +}) => { + const [t, i18n, ready] = (0,_useTranslation_js__WEBPACK_IMPORTED_MODULE_0__.useTranslation)(ns, options); + return children(t, { + i18n, + lng: i18n.language + }, ready); +}; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/context.js": +/*!*******************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/context.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ I18nContext: () => (/* binding */ I18nContext), +/* harmony export */ ReportNamespaces: () => (/* binding */ ReportNamespaces), +/* harmony export */ composeInitialProps: () => (/* binding */ composeInitialProps), +/* harmony export */ getDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_1__.getDefaults), +/* harmony export */ getI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__.getI18n), +/* harmony export */ getInitialProps: () => (/* binding */ getInitialProps), +/* harmony export */ initReactI18next: () => (/* reexport safe */ _initReactI18next_js__WEBPACK_IMPORTED_MODULE_3__.initReactI18next), +/* harmony export */ setDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_1__.setDefaults), +/* harmony export */ setI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__.setI18n) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); +/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); +/* harmony import */ var _initReactI18next_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./initReactI18next.js */ "./node_modules/react-i18next/dist/es/initReactI18next.js"); + + + + + +const I18nContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(); +class ReportNamespaces { + constructor() { + this.usedNamespaces = {}; + } + addUsedNamespaces(namespaces) { + namespaces.forEach(ns => { + if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true; + }); + } + getUsedNamespaces() { + return Object.keys(this.usedNamespaces); + } +} +const composeInitialProps = ForComponent => async ctx => { + const componentsInitialProps = (await ForComponent.getInitialProps?.(ctx)) ?? {}; + const i18nInitialProps = getInitialProps(); + return { + ...componentsInitialProps, + ...i18nInitialProps + }; +}; +const getInitialProps = () => { + const i18n = (0,_i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__.getI18n)(); + const namespaces = i18n.reportNamespaces?.getUsedNamespaces() ?? []; + const ret = {}; + const initialI18nStore = {}; + i18n.languages.forEach(l => { + initialI18nStore[l] = {}; + namespaces.forEach(ns => { + initialI18nStore[l][ns] = i18n.getResourceBundle(l, ns) || {}; + }); + }); + ret.initialI18nStore = initialI18nStore; + ret.initialLanguage = i18n.language; + return ret; +}; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/defaults.js": +/*!********************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/defaults.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ getDefaults: () => (/* binding */ getDefaults), +/* harmony export */ setDefaults: () => (/* binding */ setDefaults) +/* harmony export */ }); +/* harmony import */ var _unescape_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./unescape.js */ "./node_modules/react-i18next/dist/es/unescape.js"); + +let defaultOptions = { + bindI18n: 'languageChanged', + bindI18nStore: '', + transEmptyNodeValue: '', + transSupportBasicHtmlNodes: true, + transWrapTextNodes: '', + transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], + useSuspense: true, + unescape: _unescape_js__WEBPACK_IMPORTED_MODULE_0__.unescape +}; +const setDefaults = (options = {}) => { + defaultOptions = { + ...defaultOptions, + ...options + }; +}; +const getDefaults = () => defaultOptions; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/i18nInstance.js": +/*!************************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/i18nInstance.js ***! + \************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ getI18n: () => (/* binding */ getI18n), +/* harmony export */ setI18n: () => (/* binding */ setI18n) +/* harmony export */ }); +let i18nInstance; +const setI18n = instance => { + i18nInstance = instance; +}; +const getI18n = () => i18nInstance; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/index.js": +/*!*****************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/index.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ I18nContext: () => (/* reexport safe */ _context_js__WEBPACK_IMPORTED_MODULE_11__.I18nContext), +/* harmony export */ I18nextProvider: () => (/* reexport safe */ _I18nextProvider_js__WEBPACK_IMPORTED_MODULE_5__.I18nextProvider), +/* harmony export */ Trans: () => (/* reexport safe */ _Trans_js__WEBPACK_IMPORTED_MODULE_0__.Trans), +/* harmony export */ TransWithoutContext: () => (/* reexport safe */ _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__.Trans), +/* harmony export */ Translation: () => (/* reexport safe */ _Translation_js__WEBPACK_IMPORTED_MODULE_4__.Translation), +/* harmony export */ composeInitialProps: () => (/* reexport safe */ _context_js__WEBPACK_IMPORTED_MODULE_11__.composeInitialProps), +/* harmony export */ date: () => (/* binding */ date), +/* harmony export */ getDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_9__.getDefaults), +/* harmony export */ getI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_10__.getI18n), +/* harmony export */ getInitialProps: () => (/* reexport safe */ _context_js__WEBPACK_IMPORTED_MODULE_11__.getInitialProps), +/* harmony export */ initReactI18next: () => (/* reexport safe */ _initReactI18next_js__WEBPACK_IMPORTED_MODULE_8__.initReactI18next), +/* harmony export */ number: () => (/* binding */ number), +/* harmony export */ plural: () => (/* binding */ plural), +/* harmony export */ select: () => (/* binding */ select), +/* harmony export */ selectOrdinal: () => (/* binding */ selectOrdinal), +/* harmony export */ setDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_9__.setDefaults), +/* harmony export */ setI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_10__.setI18n), +/* harmony export */ time: () => (/* binding */ time), +/* harmony export */ useSSR: () => (/* reexport safe */ _useSSR_js__WEBPACK_IMPORTED_MODULE_7__.useSSR), +/* harmony export */ useTranslation: () => (/* reexport safe */ _useTranslation_js__WEBPACK_IMPORTED_MODULE_2__.useTranslation), +/* harmony export */ withSSR: () => (/* reexport safe */ _withSSR_js__WEBPACK_IMPORTED_MODULE_6__.withSSR), +/* harmony export */ withTranslation: () => (/* reexport safe */ _withTranslation_js__WEBPACK_IMPORTED_MODULE_3__.withTranslation) +/* harmony export */ }); +/* harmony import */ var _Trans_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Trans.js */ "./node_modules/react-i18next/dist/es/Trans.js"); +/* harmony import */ var _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransWithoutContext.js */ "./node_modules/react-i18next/dist/es/TransWithoutContext.js"); +/* harmony import */ var _useTranslation_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./useTranslation.js */ "./node_modules/react-i18next/dist/es/useTranslation.js"); +/* harmony import */ var _withTranslation_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./withTranslation.js */ "./node_modules/react-i18next/dist/es/withTranslation.js"); +/* harmony import */ var _Translation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Translation.js */ "./node_modules/react-i18next/dist/es/Translation.js"); +/* harmony import */ var _I18nextProvider_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./I18nextProvider.js */ "./node_modules/react-i18next/dist/es/I18nextProvider.js"); +/* harmony import */ var _withSSR_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./withSSR.js */ "./node_modules/react-i18next/dist/es/withSSR.js"); +/* harmony import */ var _useSSR_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./useSSR.js */ "./node_modules/react-i18next/dist/es/useSSR.js"); +/* harmony import */ var _initReactI18next_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./initReactI18next.js */ "./node_modules/react-i18next/dist/es/initReactI18next.js"); +/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); +/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); + + + + + + + + + + + + +const date = () => ''; +const time = () => ''; +const number = () => ''; +const select = () => ''; +const plural = () => ''; +const selectOrdinal = () => ''; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/initReactI18next.js": +/*!****************************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/initReactI18next.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ initReactI18next: () => (/* binding */ initReactI18next) +/* harmony export */ }); +/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); +/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); + + +const initReactI18next = { + type: '3rdParty', + init(instance) { + (0,_defaults_js__WEBPACK_IMPORTED_MODULE_0__.setDefaults)(instance.options.react); + (0,_i18nInstance_js__WEBPACK_IMPORTED_MODULE_1__.setI18n)(instance); + } +}; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/unescape.js": +/*!********************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/unescape.js ***! + \********************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ unescape: () => (/* binding */ unescape) +/* harmony export */ }); +const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g; +const htmlEntities = { + '&': '&', + '&': '&', + '<': '<', + '<': '<', + '>': '>', + '>': '>', + ''': "'", + ''': "'", + '"': '"', + '"': '"', + ' ': ' ', + ' ': ' ', + '©': '©', + '©': '©', + '®': '®', + '®': '®', + '…': '…', + '…': '…', + '/': '/', + '/': '/' +}; +const unescapeHtmlEntity = m => htmlEntities[m]; +const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity); + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/useSSR.js": +/*!******************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/useSSR.js ***! + \******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ useSSR: () => (/* binding */ useSSR) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); + + +const useSSR = (initialI18nStore, initialLanguage, props = {}) => { + const { + i18n: i18nFromProps + } = props; + const { + i18n: i18nFromContext + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_js__WEBPACK_IMPORTED_MODULE_1__.I18nContext) || {}; + const i18n = i18nFromProps || i18nFromContext || (0,_context_js__WEBPACK_IMPORTED_MODULE_1__.getI18n)(); + if (i18n.options?.isClone) return; + if (initialI18nStore && !i18n.initializedStoreOnce) { + i18n.services.resourceStore.data = initialI18nStore; + i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources) => { + Object.keys(lngResources).forEach(ns => { + if (mem.indexOf(ns) < 0) mem.push(ns); + }); + return mem; + }, i18n.options.ns); + i18n.initializedStoreOnce = true; + i18n.isInitialized = true; + } + if (initialLanguage && !i18n.initializedLanguageOnce) { + i18n.changeLanguage(initialLanguage); + i18n.initializedLanguageOnce = true; + } +}; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/useTranslation.js": +/*!**************************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/useTranslation.js ***! + \**************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ useTranslation: () => (/* binding */ useTranslation) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); + + + +const usePrevious = (value, ignore) => { + const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + ref.current = ignore ? ref.current : value; + }, [value, ignore]); + return ref.current; +}; +const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix); +const useMemoizedT = (i18n, language, namespace, keyPrefix) => (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]); +const useTranslation = (ns, props = {}) => { + const { + i18n: i18nFromProps + } = props; + const { + i18n: i18nFromContext, + defaultNS: defaultNSFromContext + } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_js__WEBPACK_IMPORTED_MODULE_1__.I18nContext) || {}; + const i18n = i18nFromProps || i18nFromContext || (0,_context_js__WEBPACK_IMPORTED_MODULE_1__.getI18n)(); + if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new _context_js__WEBPACK_IMPORTED_MODULE_1__.ReportNamespaces(); + if (!i18n) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'NO_I18NEXT_INSTANCE', 'useTranslation: You will need to pass in an i18next instance by using initReactI18next'); + const notReadyT = (k, optsOrDefaultValue) => { + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(optsOrDefaultValue)) return optsOrDefaultValue; + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(optsOrDefaultValue) && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue; + return Array.isArray(k) ? k[k.length - 1] : k; + }; + const retNotReady = [notReadyT, {}, false]; + retNotReady.t = notReadyT; + retNotReady.i18n = {}; + retNotReady.ready = false; + return retNotReady; + } + if (i18n.options.react?.wait) (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'DEPRECATED_OPTION', 'useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.'); + const i18nOptions = { + ...(0,_context_js__WEBPACK_IMPORTED_MODULE_1__.getDefaults)(), + ...i18n.options.react, + ...props + }; + const { + useSuspense, + keyPrefix + } = i18nOptions; + let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS; + namespaces = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(namespaces) ? [namespaces] : namespaces || ['translation']; + i18n.reportNamespaces.addUsedNamespaces?.(namespaces); + const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.hasLoadedNamespace)(n, i18n, i18nOptions)); + const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); + const getT = () => memoGetT; + const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); + const [t, setT] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(getT); + let joinedNS = namespaces.join(); + if (props.lng) joinedNS = `${props.lng}${joinedNS}`; + const previousJoinedNS = usePrevious(joinedNS); + const isMounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(true); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const { + bindI18n, + bindI18nStore + } = i18nOptions; + isMounted.current = true; + if (!ready && !useSuspense) { + if (props.lng) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadLanguages)(i18n, props.lng, namespaces, () => { + if (isMounted.current) setT(getNewT); + }); + } else { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadNamespaces)(i18n, namespaces, () => { + if (isMounted.current) setT(getNewT); + }); + } + } + if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) { + setT(getNewT); + } + const boundReset = () => { + if (isMounted.current) setT(getNewT); + }; + if (bindI18n) i18n?.on(bindI18n, boundReset); + if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset); + return () => { + isMounted.current = false; + if (i18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset)); + if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset)); + }; + }, [i18n, joinedNS]); + (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (isMounted.current && ready) { + setT(getT); + } + }, [i18n, keyPrefix, ready]); + const ret = [t, i18n, ready]; + ret.t = t; + ret.i18n = i18n; + ret.ready = ready; + if (ready) return ret; + if (!ready && !useSuspense) return ret; + throw new Promise(resolve => { + if (props.lng) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadLanguages)(i18n, props.lng, namespaces, () => resolve()); + } else { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadNamespaces)(i18n, namespaces, () => resolve()); + } + }); +}; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/utils.js": +/*!*****************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/utils.js ***! + \*****************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ getDisplayName: () => (/* binding */ getDisplayName), +/* harmony export */ hasLoadedNamespace: () => (/* binding */ hasLoadedNamespace), +/* harmony export */ isObject: () => (/* binding */ isObject), +/* harmony export */ isString: () => (/* binding */ isString), +/* harmony export */ loadLanguages: () => (/* binding */ loadLanguages), +/* harmony export */ loadNamespaces: () => (/* binding */ loadNamespaces), +/* harmony export */ warn: () => (/* binding */ warn), +/* harmony export */ warnOnce: () => (/* binding */ warnOnce) +/* harmony export */ }); +const warn = (i18n, code, msg, rest) => { + const args = [msg, { + code, + ...(rest || {}) + }]; + if (i18n?.services?.logger?.forward) { + return i18n.services.logger.forward(args, 'warn', 'react-i18next::', true); + } + if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`; + if (i18n?.services?.logger?.warn) { + i18n.services.logger.warn(...args); + } else if (console?.warn) { + console.warn(...args); + } +}; +const alreadyWarned = {}; +const warnOnce = (i18n, code, msg, rest) => { + if (isString(msg) && alreadyWarned[msg]) return; + if (isString(msg)) alreadyWarned[msg] = new Date(); + warn(i18n, code, msg, rest); +}; +const loadedClb = (i18n, cb) => () => { + if (i18n.isInitialized) { + cb(); + } else { + const initialized = () => { + setTimeout(() => { + i18n.off('initialized', initialized); + }, 0); + cb(); + }; + i18n.on('initialized', initialized); + } +}; +const loadNamespaces = (i18n, ns, cb) => { + i18n.loadNamespaces(ns, loadedClb(i18n, cb)); +}; +const loadLanguages = (i18n, lng, ns, cb) => { + if (isString(ns)) ns = [ns]; + if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb); + ns.forEach(n => { + if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n); + }); + i18n.loadLanguages(lng, loadedClb(i18n, cb)); +}; +const hasLoadedNamespace = (ns, i18n, options = {}) => { + if (!i18n.languages || !i18n.languages.length) { + warnOnce(i18n, 'NO_LANGUAGES', 'i18n.languages were undefined or empty', { + languages: i18n.languages + }); + return true; + } + return i18n.hasLoadedNamespace(ns, { + lng: options.lng, + precheck: (i18nInstance, loadNotPending) => { + if (options.bindI18n?.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false; + } + }); +}; +const getDisplayName = Component => Component.displayName || Component.name || (isString(Component) && Component.length > 0 ? Component : 'Unknown'); +const isString = obj => typeof obj === 'string'; +const isObject = obj => typeof obj === 'object' && obj !== null; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/withSSR.js": +/*!*******************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/withSSR.js ***! + \*******************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ withSSR: () => (/* binding */ withSSR) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _useSSR_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useSSR.js */ "./node_modules/react-i18next/dist/es/useSSR.js"); +/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); + + + + +const withSSR = () => function Extend(WrappedComponent) { + function I18nextWithSSR({ + initialI18nStore, + initialLanguage, + ...rest + }) { + (0,_useSSR_js__WEBPACK_IMPORTED_MODULE_1__.useSSR)(initialI18nStore, initialLanguage); + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(WrappedComponent, { + ...rest + }); + } + I18nextWithSSR.getInitialProps = (0,_context_js__WEBPACK_IMPORTED_MODULE_2__.composeInitialProps)(WrappedComponent); + I18nextWithSSR.displayName = `withI18nextSSR(${(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.getDisplayName)(WrappedComponent)})`; + I18nextWithSSR.WrappedComponent = WrappedComponent; + return I18nextWithSSR; +}; + +/***/ }), + +/***/ "./node_modules/react-i18next/dist/es/withTranslation.js": +/*!***************************************************************!*\ + !*** ./node_modules/react-i18next/dist/es/withTranslation.js ***! + \***************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ withTranslation: () => (/* binding */ withTranslation) +/* harmony export */ }); +/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); +/* harmony import */ var _useTranslation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useTranslation.js */ "./node_modules/react-i18next/dist/es/useTranslation.js"); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); + + + +const withTranslation = (ns, options = {}) => function Extend(WrappedComponent) { + function I18nextWithTranslation({ + forwardedRef, + ...rest + }) { + const [t, i18n, ready] = (0,_useTranslation_js__WEBPACK_IMPORTED_MODULE_1__.useTranslation)(ns, { + ...rest, + keyPrefix: options.keyPrefix + }); + const passDownProps = { + ...rest, + t, + i18n, + tReady: ready + }; + if (options.withRef && forwardedRef) { + passDownProps.ref = forwardedRef; + } else if (!options.withRef && forwardedRef) { + passDownProps.forwardedRef = forwardedRef; + } + return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(WrappedComponent, passDownProps); + } + I18nextWithTranslation.displayName = `withI18nextTranslation(${(0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getDisplayName)(WrappedComponent)})`; + I18nextWithTranslation.WrappedComponent = WrappedComponent; + const forwardRef = (props, ref) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(I18nextWithTranslation, Object.assign({}, props, { + forwardedRef: ref + })); + return options.withRef ? (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(forwardRef) : I18nextWithTranslation; +}; + +/***/ }), + +/***/ "./node_modules/tiny-invariant/dist/esm/tiny-invariant.js": +/*!****************************************************************!*\ + !*** ./node_modules/tiny-invariant/dist/esm/tiny-invariant.js ***! + \****************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ invariant) +/* harmony export */ }); +var isProduction = "development" === 'production'; +var prefix = 'Invariant failed'; +function invariant(condition, message) { + if (condition) { + return; + } + if (isProduction) { + throw new Error(prefix); + } + var provided = typeof message === 'function' ? message() : message; + var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix; + throw new Error(value); +} + + + + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ (() => { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = (module) => { +/******/ var getter = module && module.__esModule ? +/******/ () => (module['default']) : +/******/ () => (module); +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/global */ +/******/ (() => { +/******/ __webpack_require__.g = (function() { +/******/ if (typeof globalThis === 'object') return globalThis; +/******/ try { +/******/ return this || new Function('return this')(); +/******/ } catch (e) { +/******/ if (typeof window === 'object') return window; +/******/ } +/******/ })(); +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be in strict mode. +(() => { +"use strict"; +/*!*********************************************!*\ + !*** ./modules/biobank/jsx/biobankIndex.js ***! + \*********************************************/ + + +var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); +var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js")); +var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js")); +var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js")); +var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js")); +var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js")); +var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); +var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); +var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); +var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); +var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); +var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); +var _react = __webpack_require__(/*! react */ "react"); +var _reactRouterDom = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/esm/react-router-dom.js"); +var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); +var _sweetalert = _interopRequireDefault(__webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js")); +var _filter = _interopRequireDefault(__webpack_require__(/*! ./filter */ "./modules/biobank/jsx/filter.js")); +var _barcodePage = _interopRequireDefault(__webpack_require__(/*! ./barcodePage */ "./modules/biobank/jsx/barcodePage.js")); +var _helpers = __webpack_require__(/*! ./helpers.js */ "./modules/biobank/jsx/helpers.js"); +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } +function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +/** + * The main React entrypoint for the biobank module. This component + * renders the index page. + */ +var BiobankIndex = /*#__PURE__*/function (_Component) { + (0, _inherits2["default"])(BiobankIndex, _Component); + var _super = _createSuper(BiobankIndex); + /** + * Constructor + */ + function BiobankIndex() { + var _this; + (0, _classCallCheck2["default"])(this, BiobankIndex); + _this = _super.call(this); + _this.state = { + data: { + containers: {}, + pools: {}, + specimens: {} + }, + loading: 0, + options: { + candidatesSessions: {}, + candidates: {}, + centers: {}, + container: { + types: {}, + typesPrimary: {}, + typesNonPrimary: {}, + dimensions: {}, + stati: {} + }, + diagnoses: {}, + examiners: {}, + users: {}, + projects: {}, + sessions: {}, + specimen: { + types: {}, + typeUnits: {}, + typeContainerTypes: {}, + protocols: {}, + protocolAttributes: {}, + protocolContainers: {}, + processes: {}, + processAttributes: {}, + attributes: {}, + attributeDatatypes: {}, + attributesOptions: {}, + units: {} + }, + shipment: { + statuses: {}, + types: {} + } + } + }; + _this.printLabel = _this.printLabel.bind((0, _assertThisInitialized2["default"])(_this)); + _this.routeBarcode = _this.routeBarcode.bind((0, _assertThisInitialized2["default"])(_this)); + _this.setData = _this.setData.bind((0, _assertThisInitialized2["default"])(_this)); + _this.increaseCoordinate = _this.increaseCoordinate.bind((0, _assertThisInitialized2["default"])(_this)); + _this.updateSpecimen = _this.updateSpecimen.bind((0, _assertThisInitialized2["default"])(_this)); + _this.updateSpecimens = _this.updateSpecimens.bind((0, _assertThisInitialized2["default"])(_this)); + _this.editSpecimens = _this.editSpecimens.bind((0, _assertThisInitialized2["default"])(_this)); + _this.updateContainer = _this.updateContainer.bind((0, _assertThisInitialized2["default"])(_this)); + _this.createPool = _this.createPool.bind((0, _assertThisInitialized2["default"])(_this)); + _this.saveBatchEdit = _this.saveBatchEdit.bind((0, _assertThisInitialized2["default"])(_this)); + _this.createSpecimens = _this.createSpecimens.bind((0, _assertThisInitialized2["default"])(_this)); + _this.createContainers = _this.createContainers.bind((0, _assertThisInitialized2["default"])(_this)); + _this.validateSpecimen = _this.validateSpecimen.bind((0, _assertThisInitialized2["default"])(_this)); + _this.validateProcess = _this.validateProcess.bind((0, _assertThisInitialized2["default"])(_this)); + _this.validateContainer = _this.validateContainer.bind((0, _assertThisInitialized2["default"])(_this)); + return _this; + } + + /** + * React lifecycle method + */ + (0, _createClass2["default"])(BiobankIndex, [{ + key: "componentDidMount", + value: function () { + var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() { + var _this2 = this; + var updateProgress, specimens, containers, pools, options, data; + return _regenerator["default"].wrap(function _callee$(_context) { + while (1) { + switch (_context.prev = _context.next) { + case 0: + updateProgress = function updateProgress(loading) { + return _this2.setState({ + loading: loading + }); + }; + specimens = (0, _helpers.getStream)(this.props.specimenAPI, updateProgress); + containers = (0, _helpers.get)(this.props.containerAPI); + pools = (0, _helpers.get)(this.props.poolAPI); + _context.next = 6; + return (0, _helpers.get)(this.props.optionsAPI); + case 6: + options = _context.sent; + this.setState({ + options: options + }); + data = this.state.data; + _context.next = 11; + return containers; + case 11: + data.containers = _context.sent; + _context.next = 14; + return specimens; + case 14: + data.specimens = _context.sent; + _context.next = 17; + return pools; + case 17: + data.pools = _context.sent; + this.setState({ + data: data + }); + updateProgress(100); + case 20: + case "end": + return _context.stop(); + } + } + }, _callee, this); + })); + function componentDidMount() { + return _componentDidMount.apply(this, arguments); + } + return componentDidMount; + }() + /** + * Sets data for entities + * + * @param {string} type - the type of entity + * @param {object} entities - the entities to set + * @return {Promise} + */ + }, { + key: "setData", + value: function setData(type, entities) { + var _this3 = this; + return new Promise(function (resolve) { + var data = (0, _helpers.clone)(_this3.state.data); + entities.forEach(function (entity) { + return data[type][entity.id] = entity; + }); + _this3.setState({ + data: data + }, resolve()); + }); + } + + /** + * Send a request to a server to print a label + * + * @param {object} labelParams - the properties of the label to print + * @return {Promise} + */ + }, { + key: "printLabel", + value: function printLabel(labelParams) { + return (0, _helpers.post)(labelParams, this.props.labelAPI, 'POST'); + } + + /** + * Find the appropriate container for a barcode. + * + * @param {string} barcode - the value to route + * @return {object} + */ + }, { + key: "routeBarcode", + value: function routeBarcode(barcode) { + var container = Object.values(this.state.data.containers).find(function (container) { + return container.barcode == barcode; + }); + var specimen = Object.values(this.state.data.specimens).find(function (specimen) { + return specimen.containerId == container.id; + }); + return { + container: container, + specimen: specimen + }; + } + + /** + * Send a request to update a single specimen on the server after + * validating it + * + * @param {object} specimen - the specimen to update + * @return {Promise} + */ + }, { + key: "updateSpecimen", + value: function updateSpecimen(specimen) { + var _this4 = this; + var errors = this.validateSpecimen(specimen); + if (!(0, _helpers.isEmpty)(errors)) { + return Promise.reject({ + specimen: errors + }); + } + return (0, _helpers.post)(specimen, this.props.specimenAPI, 'PUT').then(function (specimens) { + return _this4.setData('specimens', specimens); + }); + } + + /** + * Update multiple specimens at once + * + * @param {array} list - the list of specimens to update + * @return {Promise} + */ + }, { + key: "updateSpecimens", + value: function updateSpecimens(list) { + var _this5 = this; + var updateList = list.map(function (specimen) { + return function () { + return _this5.updateSpecimen(specimen); + }; + }); + return Promise.all(updateList.map(function (updateSpecimen) { + return updateSpecimen(); + })); + } + + /** + * Edit a list of specimens + * + * @param {array} list - a list of specimens + * @return {Promise} + */ + }, { + key: "editSpecimens", + value: function editSpecimens(list) { + var _this6 = this; + var errors = {}; + errors.specimen = this.validateSpecimen(list[0].specimen); + errors.container = this.validateContainer(list[0].container); + if (!(0, _helpers.isEmpty)(errors.specimen) || !(0, _helpers.isEmpty)(errors.container)) { + return Promise.reject(errors); + } + var specimenList = list.map(function (item) { + return function () { + return _this6.updateSpecimen(item.specimen); + }; + }); + var containerList = list.map(function (item) { + return function () { + return _this6.updateContainer(item.container); + }; + }); + return Promise.all(specimenList.map(function (item) { + return item(); + })).then(function () { + return Promise.all(containerList.map(function (item) { + return item(); + })); + }); + } + + /** + * Sends a request to update a container on the server + * + * @param {object} container - the container to update + * @return {Promise} + */ + }, { + key: "updateContainer", + value: function updateContainer(container) { + var _this7 = this; + var errors = this.validateContainer(container); + if (!(0, _helpers.isEmpty)(errors)) { + return Promise.reject({ + container: errors + }); + } + return (0, _helpers.post)(container, this.props.containerAPI, 'PUT').then(function (containers) { + return _this7.setData('containers', containers); + }); + } + + /** + * Increase the coordinates of a container to put it in the + * next available slot. + * + * @param {object} coordinate - the coordinate to increment + * @param {number} parentContainerId - the parent container + * @return {number} + */ + }, { + key: "increaseCoordinate", + value: function increaseCoordinate(coordinate, parentContainerId) { + var containers = this.state.data.containers; + var childCoordinates = containers[parentContainerId].childContainerIds.reduce(function (result, id) { + var container = containers[id]; + if (container.coordinate) { + result[container.coordinate] = id; + } + return result; + }, {}); + var increment = function increment(coord) { + coord++; + if (childCoordinates.hasOwnProperty(coord)) { + coord = increment(coord); + } + return coord; + }; + return increment(coordinate); + } + + /** + * Create a batch of specimens + * + * @param {object} list - list of specimens + * @param {object} current - holds current state for specific values + * @param {boolean} print - whether the barcodes should be printed + * @return {Promise} + */ + }, { + key: "createSpecimens", + value: function createSpecimens(list, current, print) { + var _this8 = this; + var _this$state = this.state, + options = _this$state.options, + data = _this$state.data; + var centerId = current.centerId; + var availableId = Object.keys(options.container.stati).find(function (key) { + return options.container.stati[key].label === 'Available'; + }); + var errors = { + specimen: {}, + container: {}, + list: {} + }; + var isError = false; + Object.keys(list).reduce(function (coord, key) { + // set specimen values + var specimen = list[key]; + specimen.candidateId = current.candidateId; + specimen.sessionId = current.sessionId; + specimen.quantity = specimen.collection.quantity; + specimen.unitId = specimen.collection.unitId; + specimen.collection.centerId = centerId; + if ((options.specimen.types[specimen.typeId] || {}).freezeThaw == 1) { + specimen.fTCycle = 0; + } + specimen.parentSpecimenIds = current.parentSpecimenIds || null; + + // set container values + var container = specimen.container; + container.statusId = availableId; + container.temperature = 20; + container.centerId = centerId; + container.originId = centerId; + + // If the container is assigned to a parent, place it sequentially in the + // parent container and inherit the status, temperature and centerId. + if (current.container.parentContainerId) { + var containerParentId = current.container.parentContainerId; + container.parentContainerId = current.container.parentContainerId; + var parentContainer = data.containers[containerParentId]; + var dims = options.container.dimensions; + var dimensions = dims[parentContainer.dimensionId]; + var capacity = dimensions.x * dimensions.y * dimensions.z; + coord = _this8.increaseCoordinate(coord, current.container.parentContainerId); + if (coord <= capacity) { + container.coordinate = parseInt(coord); + } else { + container.coordinate = null; + } + container.statusId = parentContainer.statusId; + container.temperature = parentContainer.temperature; + container.centerId = parentContainer.centerId; + } + + // if specimen type id is not set yet, this will throw an error + if (specimen.typeId) {} + specimen.container = container; + list[key] = specimen; + + // this is so the global params (sessionId, candidateId, etc.) show errors + // as well. + errors.container = _this8.validateContainer(container, key); + errors.specimen = _this8.validateSpecimen(specimen, key); + if (!(0, _helpers.isEmpty)(errors.container)) { + errors.list[key] = { + container: errors.container + }; + } + if (!(0, _helpers.isEmpty)(errors.specimen)) { + errors.list[key] = _objectSpread(_objectSpread({}, errors.list[key]), {}, { + specimen: errors.specimen + }); + } + if (!(0, _helpers.isEmpty)(errors.list[key])) { + isError = true; + } + return coord; + }, 0); + if (isError) { + return Promise.reject(errors); + } + var printBarcodes = function printBarcodes(entities) { + return new Promise(function (resolve) { + if (print) { + _sweetalert["default"].fire({ + title: 'Print Barcodes?', + type: 'question', + confirmButtonText: 'Yes', + cancelButtonText: 'No', + showCancelButton: true + }).then(function (result) { + if (result.value) { + var labelParams = []; + Object.values(entities.specimens).forEach(function (specimen) { + labelParams.push({ + barcode: specimen.barcode, + type: options.specimen.types[specimen.typeId].label, + pscid: specimen.candidatePSCID, + sampleNumber: specimen.sampleNumber + }); + }); + return _this8.printLabel(labelParams); + } + }).then(function () { + return resolve(); + })["catch"](function (error) { + console.error('Printing error:', error); + resolve(); + }); + } else { + resolve(); + } + }); + }; + return (0, _helpers.post)(list, this.props.specimenAPI, 'POST').then(function (entities) { + return printBarcodes(entities).then(function () { + _this8.setData('containers', entities.containers); + _this8.setData('specimens', entities.specimens); + }); + }).then(function () { + return Promise.resolve(); + }); + } + + /** + * Create containers + * + * @param {object} list - list of containers + * @param {object} current - values held in current state + * @param {object} errors - list of errors + * @return {Promise} + */ + }, { + key: "createContainers", + value: function createContainers(list, current, errors) { + var _this9 = this; + var stati = this.state.options.container.stati; + var availableId = Object.keys(stati).find(function (key) { + return stati[key].label === 'Available'; + }); + var isError = false; + Object.entries(list).forEach(function (_ref) { + var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), + key = _ref2[0], + container = _ref2[1]; + container.statusId = availableId; + container.temperature = 20; + container.originId = current.centerId; + container.centerId = current.centerId; + errors.container = _this9.validateContainer(container, key); + errors.list[key] = _this9.validateContainer(container, key); + if (!(0, _helpers.isEmpty)(errors.list[key])) { + isError = true; + } + }); + if (isError) { + return Promise.reject(errors); + } + return (0, _helpers.post)(list, this.props.containerAPI, 'POST').then(function (containers) { + return _this9.setData('containers', containers); + }).then(function () { + return Promise.resolve(); + }); + } + + /** + * Create a new pool + * + * @param {object} pool - the pool to create + * @param {object} list - the specimens to add to the pool + * @return {Promise} + */ + }, { + key: "createPool", + value: function createPool(pool, list) { + var _this10 = this; + var stati = this.state.options.container.stati; + var dispensedId = Object.keys(stati).find(function (key) { + return stati[key].label === 'Dispensed'; + }); + var update = Object.values(list).reduce(function (result, item) { + item.container.statusId = dispensedId; + item.specimen.quantity = '0'; + + // XXX: By updating the container and specimen after, it's causing issues + // if they don't meet validation. The error is being thrown only after the + // pool has already been saved to the database! Not sure how to resolve this. + return [].concat((0, _toConsumableArray2["default"])(result), [function () { + return _this10.updateContainer(item.container, false); + }, function () { + return _this10.updateSpecimen(item.specimen, false); + }]); + }, []); + var errors = this.validatePool(pool); + if (!(0, _helpers.isEmpty)(errors)) { + return Promise.reject(errors); + } + return (0, _helpers.post)(pool, this.props.poolAPI, 'POST').then(function (pools) { + return _this10.setData('pools', pools); + }).then(function () { + return Promise.all(update.map(function (update) { + return update(); + })); + }); + } + + /** + * Save a batch of edits + * + * @param {object} list - a list of edits + * @return {Promise} + */ + }, { + key: "saveBatchEdit", + value: function saveBatchEdit(list) { + var _this11 = this; + var saveList = list.map(function (specimen) { + return function () { + return (0, _helpers.post)(specimen, _this11.props.specimenAPI, 'PUT'); + }; + }); + var errors = this.validateSpecimen(list[0]); + if (!(0, _helpers.isEmpty)(errors)) { + return Promise.reject(errors); + } + return Promise.all(saveList.map(function (item) { + return item(); + })).then(function (data) { + return Promise.all(data.map(function (item) { + return _this11.setData('specimens', item); + })); + }).then(function () { + return _sweetalert["default"].fire('Batch Preparation Successful!', '', 'success'); + }); + } + + /** + * Validate a specimen + * + * @param {object} specimen - the specimen to validate + * @return {object} an object of errors + */ + }, { + key: "validateSpecimen", + value: function validateSpecimen(specimen) { + var errors = {}; + var required = ['typeId', 'quantity', 'unitId', 'candidateId', 'sessionId', 'collection']; + var _float = ['quantity']; + var positive = ['quantity', 'fTCycle']; + var integer = ['fTCycle']; + required.map(function (field) { + // TODO: seems like for certain cases it needs to be !== null + if (!specimen[field]) { + errors[field] = 'This field is required! '; + } + }); + _float.map(function (field) { + if (isNaN(parseInt(specimen[field])) || !isFinite(specimen[field])) { + errors[field] = 'This field must be a number! '; + } + }); + positive.map(function (field) { + if (specimen[field] != null && specimen[field] < 0) { + errors[field] = 'This field must not be negative!'; + } + }); + integer.map(function (field) { + if (specimen[field] != null && !/^\+?(0|[1-9]\d*)$/.test(specimen[field])) { + errors[field] = 'This field must be an integer!'; + } + }); + var optspecimen = this.state.options.specimen; + errors.collection = this.validateProcess(specimen.collection, optspecimen.protocolAttributes[specimen.collection.protocolId], ['protocolId', 'examinerId', 'quantity', 'unitId', 'centerId', 'date', 'time'], ['quantity']); + + // collection should only be set if there are errors associated with it. + if ((0, _helpers.isEmpty)(errors.collection)) { + delete errors.collection; + } + if (specimen.preparation) { + errors.preparation = this.validateProcess(specimen.preparation, optspecimen.protocolAttributes[specimen.preparation.protocolId], ['protocolId', 'examinerId', 'centerId', 'date', 'time']); + } + if ((0, _helpers.isEmpty)(errors.preparation)) { + delete errors.preparation; + } + if (specimen.analysis) { + errors.analysis = this.validateProcess(specimen.analysis, optspecimen.protocolAttributes[specimen.analysis.protocolId], ['protocolId', 'examinerId', 'centerId', 'date', 'time']); + } + if ((0, _helpers.isEmpty)(errors.analysis)) { + delete errors.analysis; + } + return errors; + } + + /** + * Validate a process + * + * @param {object} process - the process to validate + * @param {object} attributes - the attributes of the process + * @param {array} required - the required fields + * @param {array} number - an array of fields that must be numbers + * @return {object} errors + */ + }, { + key: "validateProcess", + value: function validateProcess(process, attributes, required, number) { + var errors = {}; + var regex; + + // validate required fields + required && required.map(function (field) { + if (!process[field]) { + errors[field] = 'This field is required! '; + } + }); + + // validate floats + number && number.map(function (field) { + if (isNaN(parseInt(process[field])) || !isFinite(process[field])) { + errors[field] = 'This field must be a number! '; + } + }); + + // validate date + regex = /^[12]\d{3}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/; + if (regex.test(process.date) === false) { + errors.date = 'This field must be a valid date! '; + } + + // validate time + regex = /^([01]\d|2[0-3]):([0-5]\d)$/; + if (regex.test(process.time) === false) { + errors.time = 'This field must be a valid time! '; + } + + // validate custom attributes + if (!(0, _helpers.isEmpty)(process.data)) { + errors.data = {}; + var specimenopts = this.state.options.specimen; + var datatypes = specimenopts.attributeDatatypes; + + // FIXME: This if statement was introduced because certain processes have + // a data object even though their protocol isn't associated with attributes. + // This is a sign of bad importing/configuration and should be fixed in + // configuration rather than here. + if (attributes) { + Object.values(attributes).forEach(function (attribute) { + // validate required + if (attribute.required == 1 && !process.data[attribute.id]) { + errors.data[attribute.id] = 'This field is required!'; + } + var dataTypeId = attribute.datatypeId; + // validate number + if (datatypes[dataTypeId].datatype === 'number') { + if (isNaN(parseInt(process.data[attribute.id])) || !isFinite(process.data[attribute.id])) { + errors.data[attribute.id] = 'This field must be a number!'; + } + } + + // validate date + if (datatypes[dataTypeId].datatype === 'date') { + regex = /^[12]\d{3}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/; + if (regex.test(process.data[attribute.id]) === false) { + errors.data[attribute.id] = 'This field must be a valid date! '; + } + } + + // validate time + if (datatypes[dataTypeId].datatype === 'time') { + regex = /^([01]\d|2[0-3]):([0-5]\d)$/; + if (regex.test(process.data[attribute.id]) === false) { + errors.data[attribute.id] = 'This field must be a valid time! '; + } + } + + // TODO: Eventually introduce file validation. + }); + } + + if ((0, _helpers.isEmpty)(errors.data)) { + delete errors.data; + } + } + return errors; + } + + /** + * Validate a container object + * + * @param {object} container - the container to validate + * @return {object} - an object full of errors + */ + }, { + key: "validateContainer", + value: function validateContainer(container) { + var errors = {}; + var required = ['barcode', 'typeId', 'temperature', 'statusId', 'centerId']; + var _float2 = ['temperature']; + required.map(function (field) { + if (!container[field]) { + errors[field] = 'This field is required! '; + } + }); + _float2.map(function (field) { + if (isNaN(parseInt(container[field])) || !isFinite(container[field])) { + errors[field] = 'This field must be a number! '; + } + }); + Object.values(this.state.data.containers).map(function (c) { + if (container.barcode === c.barcode && container.id !== c.id) { + errors.barcode = 'Barcode must be unique.'; + } + }); + + // TODO: Regex barcode check will eventually go here. + // The regex is not currently in the schema and should be implemented here + // when it is. + + return errors; + } + + /** + * Validate a pool of speciments + * + * @param {object} pool - The pool to validate + * @return {object} an object of any errors + */ + }, { + key: "validatePool", + value: function validatePool(pool) { + var regex; + var errors = {}; + var required = ['label', 'quantity', 'unitId', 'date', 'time']; + required.forEach(function (field) { + if (!pool[field]) { + errors[field] = 'This field is required! '; + } + }); + if (isNaN(parseInt(pool.quantity)) || !isFinite(pool.quantity)) { + errors.quantity = 'This field must be a number! '; + } + + // validate date + regex = /^[12]\d{3}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/; + if (regex.test(pool.date) === false) { + errors.date = 'This field must be a valid date! '; + } + + // validate time + regex = /^([01]\d|2[0-3]):([0-5]\d)$/; + if (regex.test(pool.time) === false) { + errors.time = 'This field must be a valid time! '; + } + if (pool.specimenIds == null || pool.specimenIds.length < 2) { + errors.total = 'Pooling requires at least 2 specimens'; + } + return errors; + } + + /** + * Render React component + * + * @return {JSX} + */ + }, { + key: "render", + value: function render() { + var _this12 = this; + var barcode = function barcode(props) { + var target = _this12.routeBarcode(props.match.params.barcode); + return /*#__PURE__*/React.createElement(_barcodePage["default"], { + history: props.history, + specimen: target.specimen, + container: target.container, + data: _this12.state.data, + options: _this12.state.options, + updateSpecimen: _this12.updateSpecimen, + updateContainer: _this12.updateContainer, + createSpecimens: _this12.createSpecimens, + createContainers: _this12.createContainers, + printLabel: _this12.printLabel, + increaseCoordinate: _this12.increaseCoordinate, + loading: _this12.state.loading + }); + }; + var filter = function filter(props) { + return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_filter["default"], { + history: props.history, + data: _this12.state.data, + setData: _this12.setData, + options: _this12.state.options, + increaseCoordinate: _this12.increaseCoordinate, + createPool: _this12.createPool, + createContainers: _this12.createContainers, + createSpecimens: _this12.createSpecimens, + editSpecimens: _this12.editSpecimens, + updateSpecimens: _this12.updateSpecimens, + loading: _this12.state.loading + })); + }; + return /*#__PURE__*/React.createElement(_reactRouterDom.BrowserRouter, { + basename: "/biobank" + }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_reactRouterDom.Switch, null, /*#__PURE__*/React.createElement(_reactRouterDom.Route, { + exact: true, + path: "/", + render: filter + }), /*#__PURE__*/React.createElement(_reactRouterDom.Route, { + exact: true, + path: "/barcode=:barcode", + render: barcode + })))); + } + }]); + return BiobankIndex; +}(_react.Component); // biobankIndex.propTypes +BiobankIndex.propTypes = { + specimenAPI: _propTypes["default"].object.isRequired, + containerAPI: _propTypes["default"].object.isRequired, + poolAPI: _propTypes["default"].object.isRequired, + optionsAPI: _propTypes["default"].object.isRequired, + labelAPI: _propTypes["default"].object.isRequired +}; +window.addEventListener('load', function () { + var biobank = "".concat(loris.BaseURL, "/biobank/"); + ReactDOM.render( /*#__PURE__*/React.createElement(BiobankIndex, { + specimenAPI: "".concat(biobank, "specimenendpoint/"), + containerAPI: "".concat(biobank, "containerendpoint/"), + poolAPI: "".concat(biobank, "poolendpoint/"), + optionsAPI: "".concat(biobank, "optionsendpoint/"), + labelAPI: "".concat(loris.BaseURL).concat(loris.config('printEndpoint')) + }), document.getElementById('lorisworkspace')); +}); +})(); + +((window.lorisjs = window.lorisjs || {}).biobank = window.lorisjs.biobank || {}).biobankIndex = __webpack_exports__; +/******/ })() +; +//# sourceMappingURL=biobankIndex.js.map \ No newline at end of file diff --git a/modules/biobank/php/optionsendpoint.class.inc b/modules/biobank/php/optionsendpoint.class.inc index a1487fd7c83..908028daa46 100644 --- a/modules/biobank/php/optionsendpoint.class.inc +++ b/modules/biobank/php/optionsendpoint.class.inc @@ -148,9 +148,9 @@ class OptionsEndpoint extends \NDB_Page implements RequestHandlerInterface FROM candidate c LEFT JOIN session s - ON s.CandidateID=c.CandID - LEFT JOIN candidate_diagnosis_evolution_rel cedr - ON cedr.CandidateID=c.CandID + ON s.CandidateID=c.ID + LEFT JOIN candidate_diagnosis_evolution_rel cder + ON cder.CandidateID=c.ID WHERE s.CenterID IN ($userCenters) AND s.ProjectID IN ($userProjects) diff --git a/modules/biobank/php/specimendao.class.inc b/modules/biobank/php/specimendao.class.inc index eed160ccd31..ac4af15ac82 100644 --- a/modules/biobank/php/specimendao.class.inc +++ b/modules/biobank/php/specimendao.class.inc @@ -154,7 +154,7 @@ class SpecimenDAO extends \LORIS\Data\ProvisionerInstance LEFT JOIN session s ON bs.SessionID=s.ID LEFT JOIN candidate c - ON s.CandidateID=c.CandID + ON s.CandidateID=c.ID LEFT JOIN biobank_specimen_pool_rel bspor ON bs.SpecimenID=bspor.SpecimenID LEFT JOIN biobank_specimen_collection bsc From c1148a4d0189cb14f43caf5fed141ac54c66f747 Mon Sep 17 00:00:00 2001 From: Rida Abou-Haidar Date: Mon, 24 Nov 2025 07:17:15 -0500 Subject: [PATCH 5/6] added default values for shipment type --- SQL/0000-00-06-BiobankTables.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/SQL/0000-00-06-BiobankTables.sql b/SQL/0000-00-06-BiobankTables.sql index c75bf6f4cb5..311fc8b4d1b 100644 --- a/SQL/0000-00-06-BiobankTables.sql +++ b/SQL/0000-00-06-BiobankTables.sql @@ -401,6 +401,7 @@ VALUES (1,'Blood Collection',1,1), INSERT INTO `biobank_specimen_type_unit_rel` VALUES (1,1),(2,2); INSERT INTO `biobank_specimen_type_parent` VALUES (2,1); INSERT INTO `biobank_specimen_type_container_type_rel` VALUES (1,1),(2,1); +INSERT INTO `shipment_type` VALUES (1, 'Gel Pack Container'),(2, 'Insulated Foam Box'),(3, 'Dry Shipper'); -- Insert ConfigSettings for label printing endpoint INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, Label, OrderNumber) VALUES ('biobank', 'Settings related to the biobank module', 1, 0, 'Biobank', 16); From 1a6df7cfa0374037fbb8fb390a63665f47eec140 Mon Sep 17 00:00:00 2001 From: Henri Rabalais Date: Mon, 24 Nov 2025 07:29:39 -0500 Subject: [PATCH 6/6] removed compiled file biobankIndex.js from repo --- modules/biobank/js/biobankIndex.js | 25151 --------------------------- 1 file changed, 25151 deletions(-) delete mode 100644 modules/biobank/js/biobankIndex.js diff --git a/modules/biobank/js/biobankIndex.js b/modules/biobank/js/biobankIndex.js deleted file mode 100644 index b726ab663bd..00000000000 --- a/modules/biobank/js/biobankIndex.js +++ /dev/null @@ -1,25151 +0,0 @@ -/******/ (() => { // webpackBootstrap -/******/ var __webpack_modules__ = ({ - -/***/ "./jsx/DataTable.js": -/*!**************************!*\ - !*** ./jsx/DataTable.js ***! - \**************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); -var _typeof3 = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js")); -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); -var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); -var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); -var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); -var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); -var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); -var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); -var _PaginationLinks = _interopRequireDefault(__webpack_require__(/*! jsx/PaginationLinks */ "./jsx/PaginationLinks.js")); -var _reactAddonsCreateFragment = _interopRequireDefault(__webpack_require__(/*! react-addons-create-fragment */ "./node_modules/react-addons-create-fragment/index.js")); -var _Form = __webpack_require__(/*! jsx/Form */ "./jsx/Form.js"); -var _reactI18next = __webpack_require__(/*! react-i18next */ "./node_modules/react-i18next/dist/es/index.js"); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } -function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } -/** - * Data Table component - * Displays a set of data that is receives via props. - */ -var DataTable = /*#__PURE__*/function (_Component) { - (0, _inherits2["default"])(DataTable, _Component); - var _super = _createSuper(DataTable); - /** - * @constructor - * @param {object} props - React Component properties - */ - function DataTable(props) { - var _this; - (0, _classCallCheck2["default"])(this, DataTable); - _this = _super.call(this, props); - _this.state = { - page: { - number: 1, - rows: 20 - }, - sort: { - column: -1, - ascending: true - } - }; - _this.changePage = _this.changePage.bind((0, _assertThisInitialized2["default"])(_this)); - _this.setSortColumn = _this.setSortColumn.bind((0, _assertThisInitialized2["default"])(_this)); - _this.updateSortColumn = _this.updateSortColumn.bind((0, _assertThisInitialized2["default"])(_this)); - _this.toggleSortOrder = _this.toggleSortOrder.bind((0, _assertThisInitialized2["default"])(_this)); - _this.updatePageNumber = _this.updatePageNumber.bind((0, _assertThisInitialized2["default"])(_this)); - _this.updatePageRows = _this.updatePageRows.bind((0, _assertThisInitialized2["default"])(_this)); - _this.downloadCSV = _this.downloadCSV.bind((0, _assertThisInitialized2["default"])(_this)); - _this.getFilteredRowIndexes = _this.getFilteredRowIndexes.bind((0, _assertThisInitialized2["default"])(_this)); - _this.sortRows = _this.sortRows.bind((0, _assertThisInitialized2["default"])(_this)); - _this.hasFilterKeyword = _this.hasFilterKeyword.bind((0, _assertThisInitialized2["default"])(_this)); - _this.renderActions = _this.renderActions.bind((0, _assertThisInitialized2["default"])(_this)); - return _this; - } - - /** - * Set the component page variable - * to a new value - * - * @param {number} i - Page index - */ - (0, _createClass2["default"])(DataTable, [{ - key: "changePage", - value: function changePage(i) { - var page = this.state.page; - page.number = i; - this.setState({ - page: page - }); - } - - /** - * Update the sort column - * If component sort.column is already set to column - * Toggle sort.ascending - * - * @param {number} column - The column index - */ - }, { - key: "setSortColumn", - value: function setSortColumn(column) { - if (this.state.sort.column === column) { - this.toggleSortOrder(); - } else { - this.updateSortColumn(column); - } - } - - /** - * Update the sort column - * - * @param {number} column - The column index - */ - }, { - key: "updateSortColumn", - value: function updateSortColumn(column) { - var sort = this.state.sort; - sort.column = column; - this.setState({ - sort: sort - }); - } - - /** - * Toggle sort.ascending - */ - }, { - key: "toggleSortOrder", - value: function toggleSortOrder() { - var sort = this.state.sort; - sort.ascending = !sort.ascending; - this.setState({ - sort: sort - }); - } - - /** - * Updates page state - * - * @param {number} number - Number of page - */ - }, { - key: "updatePageNumber", - value: function updatePageNumber(number) { - var page = this.state.page; - page.number = number; - this.setState({ - page: page - }); - } - - /** - * Update number of rows per page - * - * @param {object} e - Event from which to abstract value - */ - }, { - key: "updatePageRows", - value: function updatePageRows(e) { - var page = Object.assign({}, this.state.page); - page.rows = e.target.value; - page.number = 1; - this.setState({ - page: page - }); - } - - /** - * Export the filtered rows and columns into a csv - * - * @param {number[]} filteredRowIndexes - The filtered Row Indexes - */ - }, { - key: "downloadCSV", - value: function downloadCSV(filteredRowIndexes) { - var _this2 = this; - var csvData = filteredRowIndexes.map(function (id) { - return _this2.props.data[id]; - }); - // Map cell data to proper values if applicable. - if (this.props.getMappedCell) { - csvData = csvData.map(function (row, i) { - return _this2.props.fields.flatMap(function (field, j) { - return _this2.props.getMappedCell(field.label, row[j], row, _this2.props.fields.map(function (val) { - return val.label; - }), j); - }); - }); - } - var csvworker = new Worker(loris.BaseURL + '/js/workers/savecsv.js'); - csvworker.addEventListener('message', function (e) { - var dataURL; - var dataDate; - var link; - if (e.data.cmd === 'SaveCSV') { - dataDate = new Date().toISOString(); - dataURL = window.URL.createObjectURL(e.data.message); - link = document.createElement('a'); - link.download = 'data-' + dataDate + '.csv'; - link.type = 'text/csv'; - link.href = dataURL; - document.body.appendChild(link); - $(link)[0].click(); - document.body.removeChild(link); - } - }); - var headerList = this.props.fields.map(function (field) { - return field.label; - }); - csvworker.postMessage({ - cmd: 'SaveFile', - data: csvData, - headers: headerList, - identifiers: this.props.RowNameMap - }); - } - - /** - * Get the Filtered Row Indexes - */ - }, { - key: "getFilteredRowIndexes", - value: function getFilteredRowIndexes() { - var useKeyword = false; - var filterValuesCount = Object.keys(this.props.filters).length; - var tableData = this.props.data; - var fieldData = this.props.fields; - var filteredIndexes = []; - - // If there are no filters set, use all the data. - var hasFilters = filterValuesCount !== 0; - if (hasFilters === false) { - for (var i = 0; i < tableData.length; i++) { - filteredIndexes.push(i); - } - return filteredIndexes; - } - if (this.props.filters.keyword) { - useKeyword = true; - } - if (useKeyword) { - filterValuesCount -= 1; - } - for (var _i = 0; _i < tableData.length; _i++) { - var headerCount = 0; - var keywordMatch = 0; - for (var j = 0; j < fieldData.length; j++) { - var data = tableData[_i] ? tableData[_i][j] : null; - if (this.hasFilterKeyword((fieldData[j].filter || {}).name, data)) { - headerCount++; - } - if (useKeyword) { - if (this.hasFilterKeyword('keyword', data)) { - keywordMatch++; - } - } - } - if (headerCount === filterValuesCount && (useKeyword === true && keywordMatch > 0 || useKeyword === false && keywordMatch === 0)) { - filteredIndexes.push(_i); - } - } - return filteredIndexes; - } - - /** - * Sort the given rows according to the sort configuration - * - * @param {number[]} rowIndexes - The row indexes - * @return {object[]} - */ - }, { - key: "sortRows", - value: function sortRows(rowIndexes) { - var _this3 = this; - var index = []; - for (var i = 0; i < rowIndexes.length; i++) { - var idx = rowIndexes[i]; - var val = this.props.data[idx][this.state.sort.column] || undefined; - - // If sortColumn is equal to default No. column, set value to be - // index + 1 - if (this.state.sort.column === -1) { - val = idx + 1; - } - var isString = typeof val === 'string' || val instanceof String; - var isNumber = !isNaN(val) && (0, _typeof2["default"])(val) !== 'object'; - if (val === '.') { - // hack to handle non-existent items in DQT - val = null; - } else if (isNumber) { - // perform type conversion (from string to int/float) - val = Number(val); - } else if (isString) { - // if string with text convert to lowercase - val = val.toLowerCase(); - } else if (Array.isArray(val)) { - val = val.join(', '); - } else { - val = undefined; - } - if (this.props.RowNameMap) { - index.push({ - RowIdx: idx, - Value: val, - Content: this.props.RowNameMap[idx] - }); - } else { - index.push({ - RowIdx: idx, - Value: val, - Content: idx + 1 - }); - } - } - index.sort(function (a, b) { - if (_this3.state.sort.ascending) { - if (a.Value === b.Value) { - // If all values are equal, sort by rownum - if (a.RowIdx < b.RowIdx) return -1; - if (a.RowIdx > b.RowIdx) return 1; - } - // Check if null values - if (a.Value === null || typeof a.Value === 'undefined') return -1; - if (b.Value === null || typeof b.Value === 'undefined') return 1; - - // Sort by value - if (a.Value < b.Value) return -1; - if (a.Value > b.Value) return 1; - } else { - if (a.Value === b.Value) { - // If all values are equal, sort by rownum - if (a.RowIdx < b.RowIdx) return 1; - if (a.RowIdx > b.RowIdx) return -1; - } - // Check if null values - if (a.Value === null || typeof a.Value === 'undefined') return 1; - if (b.Value === null || typeof b.Value === 'undefined') return -1; - - // Sort by value - if (a.Value < b.Value) return 1; - if (a.Value > b.Value) return -1; - } - // They're equal.. - return 0; - }); - return index; - } - - /** - * Searches for the filter keyword in the column cell - * - * Note: Search is case-insensitive. - * - * @param {string} name field name - * @param {string} data search string - * @return {boolean} true, if filter value is found to be a substring - * of one of the column values, false otherwise. - */ - }, { - key: "hasFilterKeyword", - value: function hasFilterKeyword(name, data) { - var filterData = null; - var exactMatch = false; - var opposite = false; - var result = false; - var searchKey = null; - var searchString = null; - if (this.props.filters[name]) { - filterData = this.props.filters[name].value; - exactMatch = this.props.filters[name].exactMatch; - opposite = this.props.filters[name].opposite; - } - - // Handle null inputs - if (filterData === null || data === null) { - return false; - } - - // Handle numeric inputs - if (typeof filterData === 'number') { - var intData = Number.parseInt(data, 10); - result = filterData === intData; - } - - // Handle string inputs - if (typeof filterData === 'string') { - searchKey = filterData.toLowerCase(); - switch ((0, _typeof2["default"])(data)) { - case 'object': - // Handles the case where the data is an array (typeof 'object') - // and you want to search through it for - // the string you are filtering by - var searchArray = data.map(function (e) { - return e.toLowerCase(); - }); - if (exactMatch) { - result = searchArray.includes(searchKey); - } else { - result = searchArray.find(function (e) { - return e.indexOf(searchKey) > -1; - }) !== undefined; - } - break; - default: - searchString = data ? data.toString().toLowerCase() : ''; - if (exactMatch) { - result = searchString === searchKey; - } else if (opposite) { - result = searchString !== searchKey; - } else { - result = searchString.indexOf(searchKey) > -1; - } - break; - } - } - - // Handle boolean inputs - if (typeof filterData === 'boolean') { - result = filterData === data; - } - - // Handle array inputs for multiselects - if ((0, _typeof2["default"])(filterData) === 'object') { - var match = false; - for (var i = 0; i < filterData.length; i += 1) { - searchKey = filterData[i].toLowerCase(); - searchString = data ? data.toString().toLowerCase() : ''; - var _searchArray = searchString.split(','); - match = _searchArray.includes(searchKey); - if (match) { - result = true; - } - } - } - return result; - } - - /** - * Called by React when the component has been rendered on the page. - */ - }, { - key: "componentDidMount", - value: function componentDidMount() { - if (!this.props.noDynamicTable) { - $('.dynamictable').DynamicTable(); - } - } - - /** - * Renders the Actions buttons. - * - * @return {string[]|void} - Array of React Elements - */ - }, { - key: "renderActions", - value: function renderActions() { - if (this.props.actions) { - return this.props.actions.map(function (action, key) { - if (action.show !== false) { - return /*#__PURE__*/_react["default"].createElement(_Form.CTA, { - key: key, - label: action.label, - onUserInput: action.action - }); - } - }); - } - } - - /** - * Renders the React component. - * - * @return {JSX} - React markup for the component - */ - }, { - key: "render", - value: function render() { - var _this4 = this; - if ((this.props.data === null || this.props.data.length === 0) && !this.props.nullTableShow) { - return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", { - className: "row" - }, /*#__PURE__*/_react["default"].createElement("div", { - className: "col-xs-12" - }, /*#__PURE__*/_react["default"].createElement("div", { - className: "pull-right", - style: { - marginRight: '10px' - } - }, this.renderActions()))), /*#__PURE__*/_react["default"].createElement("div", { - className: "alert alert-info no-result-found-panel" - }, /*#__PURE__*/_react["default"].createElement("strong", null, "No result found."))); - } - var rowsPerPage = this.state.page.rows; - var headers = this.props.hide.defaultColumn === true ? [] : [/*#__PURE__*/_react["default"].createElement("th", { - key: "th_col_0", - onClick: function onClick() { - _this4.setSortColumn(-1); - } - }, this.props.rowNumLabel)]; - var _loop = function _loop(i) { - if (_this4.props.fields[i].show === true) { - var colIndex = i + 1; - if (_this4.props.fields[i].freezeColumn === true) { - headers.push( /*#__PURE__*/_react["default"].createElement("th", { - key: 'th_col_' + colIndex, - id: _this4.props.freezeColumn, - onClick: function onClick() { - _this4.setSortColumn(i); - } - }, _this4.props.fields[i].label)); - } else { - headers.push( /*#__PURE__*/_react["default"].createElement("th", { - key: 'th_col_' + colIndex, - onClick: function onClick() { - _this4.setSortColumn(i); - } - }, _this4.props.fields[i].label)); - } - } - }; - for (var i = 0; i < this.props.fields.length; i += 1) { - _loop(i); - } - var rows = []; - var filteredRowIndexes = this.getFilteredRowIndexes(); - var filteredCount = filteredRowIndexes.length; - var index = this.sortRows(filteredRowIndexes); - var currentPageRow = rowsPerPage * (this.state.page.number - 1); - - // Format each cell for the data table. - var _loop2 = function _loop2(_i2) { - var rowIndex = index[_i2].RowIdx; - var rowData = _this4.props.data[rowIndex]; - var curRow = []; - - // Iterates through headers to populate row columns - // with corresponding data - var _loop3 = function _loop3(j) { - if (_this4.props.fields[j].show === false) { - return "continue"; - } - var celldata = rowData[j]; - var cell = null; - var row = {}; - _this4.props.fields.forEach(function (field, k) { - return row[field.label] = rowData[k]; - }); - var headers = _this4.props.fields.map(function (val) { - return val.label; - }); - - // Get custom cell formatting if available - if (_this4.props.getFormattedCell) { - cell = _this4.props.getFormattedCell(_this4.props.fields[j].label, celldata, row, headers, j); - } else { - cell = /*#__PURE__*/_react["default"].createElement("td", null, celldata); - } - if (cell !== null) { - curRow.push( /*#__PURE__*/_react["default"].cloneElement(cell, { - key: 'td_col_' + j - })); - } else { - curRow.push((0, _reactAddonsCreateFragment["default"])({ - celldata: celldata - })); - } - }; - for (var j = 0; j < _this4.props.fields.length; j += 1) { - var _ret = _loop3(j); - if (_ret === "continue") continue; - } - var rowIndexDisplay = index[_i2].Content; - rows.push( /*#__PURE__*/_react["default"].createElement("tr", { - key: 'tr_' + rowIndex, - colSpan: headers.length - }, _this4.props.hide.defaultColumn === true ? null : /*#__PURE__*/_react["default"].createElement("td", { - key: 'td_' + rowIndex - }, rowIndexDisplay), curRow)); - }; - for (var _i2 = currentPageRow; _i2 < filteredCount && rows.length < rowsPerPage; _i2++) { - _loop2(_i2); - } - var rowsPerPageDropdown = /*#__PURE__*/_react["default"].createElement("select", { - className: "input-sm perPage", - onChange: this.updatePageRows, - value: this.state.page.rows - }, /*#__PURE__*/_react["default"].createElement("option", null, "20"), /*#__PURE__*/_react["default"].createElement("option", null, "50"), /*#__PURE__*/_react["default"].createElement("option", null, "100"), /*#__PURE__*/_react["default"].createElement("option", null, "1000"), /*#__PURE__*/_react["default"].createElement("option", null, "5000"), /*#__PURE__*/_react["default"].createElement("option", null, "10000")); - - // This doesn't feel like a very robust way to handle the dropdown. - // It's not clear if there's any good way to structure this for locales that - // use RTL languages or prefer a different kind of parenthesis. - var changeRowsDropdown = /*#__PURE__*/_react["default"].createElement("span", null, "(", this.props.t('Maximum rows per page:'), " ", rowsPerPageDropdown, ")"); - var header = this.props.hide.rowsPerPage === true ? '' : /*#__PURE__*/_react["default"].createElement("div", { - className: "table-header" - }, /*#__PURE__*/_react["default"].createElement("div", { - className: "row" - }, /*#__PURE__*/_react["default"].createElement("div", { - style: { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - flexWrap: 'wrap', - padding: '5px 15px' - } - }, /*#__PURE__*/_react["default"].createElement("div", { - style: { - order: '1', - padding: '5px 0' - } - }, this.props.t('{{pageCount}} rows displayed of {{totalCount}}.', { - pageCount: rows.length, - totalCount: filteredCount - }), changeRowsDropdown), /*#__PURE__*/_react["default"].createElement("div", { - style: { - order: '2', - display: 'flex', - justifyContent: 'flex-end', - alignItems: 'center', - flexWrap: 'wrap', - padding: '5px 0', - marginLeft: 'auto' - } - }, this.renderActions(), this.props.hide.downloadCSV === true ? '' : /*#__PURE__*/_react["default"].createElement("button", { - className: "btn btn-primary", - onClick: this.downloadCSV.bind(null, filteredRowIndexes) - }, this.props.t('Download Data as CSV')), /*#__PURE__*/_react["default"].createElement(_PaginationLinks["default"], { - Total: filteredCount, - onChangePage: this.changePage, - RowsPerPage: rowsPerPage, - Active: this.state.page.number - }))))); - var footer = /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", { - className: "row" - }, /*#__PURE__*/_react["default"].createElement("div", { - style: { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - flexWrap: 'wrap', - padding: '5px 15px' - } - }, /*#__PURE__*/_react["default"].createElement("div", { - style: { - order: '1', - padding: '5px 0' - } - }, this.props.t('{{pageCount}} rows displayed of {{totalCount}}.', { - pageCount: rows.length, - totalCount: filteredCount - }), changeRowsDropdown), /*#__PURE__*/_react["default"].createElement("div", { - style: { - order: '2', - padding: '5px 0', - marginLeft: 'auto' - } - }, /*#__PURE__*/_react["default"].createElement(_PaginationLinks["default"], { - Total: filteredCount, - onChangePage: this.changePage, - RowsPerPage: rowsPerPage, - Active: this.state.page.number - }))))); - return /*#__PURE__*/_react["default"].createElement("div", { - style: { - margin: '14px' - } - }, header, /*#__PURE__*/_react["default"].createElement("table", { - className: "table table-hover table-primary table-bordered dynamictable", - id: "dynamictable" - }, /*#__PURE__*/_react["default"].createElement("thead", null, /*#__PURE__*/_react["default"].createElement("tr", { - className: "info" - }, headers)), this.props.folder, /*#__PURE__*/_react["default"].createElement("tbody", null, rows)), footer); - } - }]); - return DataTable; -}(_react.Component); -DataTable.propTypes = { - data: _propTypes["default"].array.isRequired, - rowNumLabel: _propTypes["default"].string, - // Function of which returns a JSX element for a table cell, takes - // parameters of the form: func(ColumnName, CellData, EntireRowData) - getFormattedCell: _propTypes["default"].func, - onSort: _propTypes["default"].func, - actions: _propTypes["default"].array, - hide: _propTypes["default"].object, - nullTableShow: _propTypes["default"].bool, - noDynamicTable: _propTypes["default"].bool, - getMappedCell: _propTypes["default"].func, - fields: _propTypes["default"].array, - RowNameMap: _propTypes["default"].array, - filters: _propTypes["default"].object, - freezeColumn: _propTypes["default"].string, - loading: _propTypes["default"].element, - folder: _propTypes["default"].element, - // Provided by withTranslation HOC - t: _propTypes["default"].func -}; -DataTable.defaultProps = { - headers: [], - data: {}, - rowNumLabel: 'No.', - filters: {}, - hide: { - rowsPerPage: false, - downloadCSV: false, - defaultColumn: false - }, - nullTableShow: false, - noDynamicTable: false -}; -var _default = exports["default"] = (0, _reactI18next.withTranslation)(['loris'])(DataTable); - -/***/ }), - -/***/ "./jsx/Filter.js": -/*!***********************!*\ - !*** ./jsx/Filter.js ***! - \***********************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); -var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); -var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); -var _Form = __webpack_require__(/*! jsx/Form */ "./jsx/Form.js"); -var _DateTimePartialElement = _interopRequireDefault(__webpack_require__(/*! jsx/form/DateTimePartialElement */ "./jsx/form/DateTimePartialElement.tsx")); -var _reactI18next = __webpack_require__(/*! react-i18next */ "./node_modules/react-i18next/dist/es/index.js"); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } -/** - * Filter component - * A wrapper for form elements inside a selection filter. - * - * Constructs filter fields based on this.props.fields configuration object - * - * Alters the filter object and sends it to parent on every update. - * - * @param {props} props - * @return {JSX} - */ -function Filter(props) { - /** - * Takes query params from url and triggers an update of the fields that are - * associated with those params, if they exist. - */ - (0, _react.useEffect)(function () { - var searchParams = new URLSearchParams(location.search); - searchParams.forEach(function (value, name) { - // This checks to make sure the filter actually exists - if (props.fields.find(function (field) { - return (field.filter || {}).name == name; - })) { - onFieldUpdate(name, searchParams.getAll(name)); - } - }); - }, []); - - /** - * Sets filter object to reflect values of input fields. - * - * @param {string} name - form element type (i.e component name) - * @param {string} value - the name of the form element - */ - var onFieldUpdate = function onFieldUpdate(name, value) { - var _JSON$parse = JSON.parse(JSON.stringify(props)), - fields = _JSON$parse.fields; - var type = fields.find(function (field) { - return (field.filter || {}).name == name; - }).filter.type; - var exactMatch = !(type === 'text' || type === 'date' || type === 'datetime' || type === 'multiselect'); - if (value === null || value === '' || value.constructor === Array && value.length === 0 || type === 'checkbox' && value === false) { - props.removeFilter(name); - } else { - props.addFilter(name, value, exactMatch); - } - }; - - /** - * Renders the filters based on the defined fields. - * - * @return {array} - */ - var renderFilterFields = function renderFilterFields() { - return props.fields.reduce(function (result, field) { - var filter = field.filter; - if (filter && filter.hide !== true) { - var element; - switch (filter.type) { - case 'text': - element = /*#__PURE__*/_react["default"].createElement(_Form.TextboxElement, null); - break; - case 'select': - element = /*#__PURE__*/_react["default"].createElement(_Form.SelectElement, { - options: filter.options, - sortByValue: filter.sortByValue, - autoSelect: false - }); - break; - case 'multiselect': - element = /*#__PURE__*/_react["default"].createElement(_Form.SelectElement, { - options: filter.options, - sortByValue: filter.sortByValue, - multiple: true, - emptyOption: false - }); - break; - case 'numeric': - element = /*#__PURE__*/_react["default"].createElement(_Form.NumericElement, { - options: filter.options - }); - break; - case 'date': - element = /*#__PURE__*/_react["default"].createElement(_Form.DateElement, null); - break; - case 'datetime': - element = /*#__PURE__*/_react["default"].createElement(_DateTimePartialElement["default"], null); - break; - case 'checkbox': - element = /*#__PURE__*/_react["default"].createElement(_Form.CheckboxElement, null); - break; - case 'time': - element = /*#__PURE__*/_react["default"].createElement(_Form.TimeElement, null); - break; - default: - element = /*#__PURE__*/_react["default"].createElement(_Form.TextboxElement, null); - } - - // The value prop has to default to false if the first two options - // are undefined so that the checkbox component is a controlled input - // element with a starting default value - result.push( /*#__PURE__*/_react["default"].cloneElement(element, { - key: filter.name, - name: filter.name, - label: field.label, - value: (props.filters[filter.name] || {}).value || null, - onUserInput: onFieldUpdate - })); - } - return result; - }, []); - }; - var filterPresets = function filterPresets() { - if (props.filterPresets) { - var presets = props.filterPresets.map(function (preset) { - var handleClick = function handleClick() { - return props.updateFilters(preset.filter); - }; - return /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("a", { - onClick: handleClick - }, preset.label)); - }); - return /*#__PURE__*/_react["default"].createElement("li", { - className: "dropdown" - }, /*#__PURE__*/_react["default"].createElement("a", { - className: "dropdown-toggle", - "data-toggle": "dropdown", - role: "button" - }, "Load Filter Preset ", /*#__PURE__*/_react["default"].createElement("span", { - className: "caret" - })), /*#__PURE__*/_react["default"].createElement("ul", { - className: "dropdown-menu", - role: "menu" - }, presets)); - } - }; - var filterActions = /*#__PURE__*/_react["default"].createElement("ul", { - className: "nav nav-tabs navbar-right", - style: { - borderBottom: 'none' - } - }, filterPresets(), /*#__PURE__*/_react["default"].createElement("li", null, /*#__PURE__*/_react["default"].createElement("a", { - role: "button", - name: "reset", - onClick: props.clearFilters - }, props.t('Clear Filters')))); - return /*#__PURE__*/_react["default"].createElement(_Form.FormElement, { - id: props.id, - name: props.name - }, /*#__PURE__*/_react["default"].createElement(_Form.FieldsetElement, { - columns: props.columns, - legend: props.title - }, filterActions, renderFilterFields())); -} -Filter.defaultProps = { - id: null, - clearFilter: function clearFilter() { - console.warn('onUpdate() callback is not set!'); - }, - columns: 1 -}; -Filter.propTypes = { - filters: _propTypes["default"].object.isRequired, - clearFilter: _propTypes["default"].func.isRequired, - id: _propTypes["default"].string, - name: _propTypes["default"].string, - columns: _propTypes["default"].number, - title: _propTypes["default"].string, - fields: _propTypes["default"].array.isRequired, - removeFilter: _propTypes["default"].func, - addFilter: _propTypes["default"].func, - filterPresets: _propTypes["default"].array, - updateFilters: _propTypes["default"].func, - clearFilters: _propTypes["default"].func, - // Provided by withTranslation HOC - t: _propTypes["default"].func -}; -var _default = exports["default"] = (0, _reactI18next.withTranslation)(['loris'])(Filter); - -/***/ }), - -/***/ "./jsx/FilterableDataTable.js": -/*!************************************!*\ - !*** ./jsx/FilterableDataTable.js ***! - \************************************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); -var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = void 0; -var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js")); -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); -var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); -var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); -var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); -var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); -var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); -var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); -var _Panel = _interopRequireDefault(__webpack_require__(/*! jsx/Panel */ "./jsx/Panel.js")); -var _DataTable = _interopRequireDefault(__webpack_require__(/*! jsx/DataTable */ "./jsx/DataTable.js")); -var _Filter = _interopRequireDefault(__webpack_require__(/*! jsx/Filter */ "./jsx/Filter.js")); -var _ProgressBar = _interopRequireDefault(__webpack_require__(/*! jsx/ProgressBar */ "./jsx/ProgressBar.js")); -var _reactI18next = __webpack_require__(/*! react-i18next */ "./node_modules/react-i18next/dist/es/index.js"); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } -function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } -/** - * FilterableDataTable component. - * A wrapper for all datatables that handles filtering. - * - * Handles the updating and clearing of the filter state based on changes sent - * from the FitlerForm. - * - * Passes the Filter to the Datatable. - * - * Deprecates Filter Form. - */ -var FilterableDataTable = /*#__PURE__*/function (_Component) { - (0, _inherits2["default"])(FilterableDataTable, _Component); - var _super = _createSuper(FilterableDataTable); - /** - * @constructor - * @param {object} props - React Component properties - */ - function FilterableDataTable(props) { - var _this; - (0, _classCallCheck2["default"])(this, FilterableDataTable); - _this = _super.call(this, props); - _this.state = { - filters: {} - }; - _this.updateFilters = _this.updateFilters.bind((0, _assertThisInitialized2["default"])(_this)); - _this.clearFilters = _this.clearFilters.bind((0, _assertThisInitialized2["default"])(_this)); - _this.validFilters = _this.validFilters.bind((0, _assertThisInitialized2["default"])(_this)); - _this.addFilter = _this.addFilter.bind((0, _assertThisInitialized2["default"])(_this)); - _this.removeFilter = _this.removeFilter.bind((0, _assertThisInitialized2["default"])(_this)); - return _this; - } - - /** - * Updates filter state - * - * @param {object} filters - */ - (0, _createClass2["default"])(FilterableDataTable, [{ - key: "updateFilters", - value: function updateFilters(filters) { - this.updateQueryParams(filters); - this.setState({ - filters: filters - }); - if (this.props.updateFilterCallback) { - this.props.updateFilterCallback(filters); - } - } - - /** - * Updates URL Query Params - * - * @param {object} filters - */ - }, { - key: "updateQueryParams", - value: function updateQueryParams(filters) { - var searchParams = new URLSearchParams(); - Object.entries(filters).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - name = _ref2[0], - filter = _ref2[1]; - if (filter.value.constructor === Array) { - filter.value.forEach(function (v) { - return searchParams.append(name, v); - }); - } else { - searchParams.set(name, filter.value); - } - }); - history.replaceState({}, '', "?".concat(searchParams.toString())); - } - - /** - * Add new filter to the filter object - * - * @param {string} name - * @param {*} value - * @param {boolean} exactMatch - */ - }, { - key: "addFilter", - value: function addFilter(name, value, exactMatch) { - var filters = this.state.filters; - filters[name] = { - value: value, - exactMatch: exactMatch - }; - this.updateFilters(filters); - } - - /** - * Remove filter from the filter object - * - * @param {string} name - */ - }, { - key: "removeFilter", - value: function removeFilter(name) { - var filters = this.state.filters; - delete filters[name]; - this.updateFilters(filters); - } - - /** - * Sets Filter to empty object - */ - }, { - key: "clearFilters", - value: function clearFilters() { - this.updateFilters({}); - } - - /** - * Returns the filter state, with filters that are - * set to an invalid option removed from the returned - * filters - * - * @return {object} - */ - }, { - key: "validFilters", - value: function validFilters() { - var _this2 = this; - var filters = {}; - this.props.fields.forEach(function (field) { - if (!field.filter) { - return; - } - var filtername = field.filter.name; - var filterval = _this2.state.filters[filtername]; - if (!filterval) { - return; - } - if (field.filter.type !== 'select') { - filters[filtername] = filterval; - return; - } - if (!(filterval.value in field.filter.options)) { - return; - } - filters[filtername] = filterval; - }); - return filters; - } - - /** - * Renders the React component. - * - * @return {JSX} - React markup for the component - */ - }, { - key: "render", - value: function render() { - var filters = this.validFilters(); - var filter = /*#__PURE__*/_react["default"].createElement(_Filter["default"], { - name: this.props.name + '_filter', - id: this.props.name + '_filter', - columns: this.props.columns, - filters: filters, - title: this.props.t('Selection Filter'), - filterPresets: this.props.filterPresets, - fields: this.props.fields, - addFilter: this.addFilter, - updateFilters: this.updateFilters, - removeFilter: this.removeFilter, - clearFilters: this.clearFilters - }); - var progress = this.props.progress; - var dataTable = !isNaN(progress) && progress < 100 ? /*#__PURE__*/_react["default"].createElement(_ProgressBar["default"], { - value: progress - }) : /*#__PURE__*/_react["default"].createElement(_DataTable["default"], { - data: this.props.data, - fields: this.props.fields, - filters: filters, - actions: this.props.actions, - loading: this.props.loading, - getFormattedCell: this.props.getFormattedCell, - getMappedCell: this.props.getMappedCell, - folder: this.props.folder, - nullTableShow: this.props.nullTableShow, - noDynamicTable: this.props.noDynamicTable - }); - return /*#__PURE__*/_react["default"].createElement(_Panel["default"], { - title: this.props.title - }, filter, this.props.children, dataTable); - } - }]); - return FilterableDataTable; -}(_react.Component); -FilterableDataTable.defaultProps = { - columns: 3, - noDynamicTable: false -}; -FilterableDataTable.propTypes = { - name: _propTypes["default"].string.isRequired, - title: _propTypes["default"].string, - data: _propTypes["default"].array.isRequired, - filterPresets: _propTypes["default"].object, - fields: _propTypes["default"].array.isRequired, - columns: _propTypes["default"].number, - getFormattedCell: _propTypes["default"].func, - actions: _propTypes["default"].array, - updateFilterCallback: _propTypes["default"].func, - noDynamicTable: _propTypes["default"].bool, - loading: _propTypes["default"].element, - progress: _propTypes["default"].number, - getMappedCell: _propTypes["default"].func, - folder: _propTypes["default"].element, - nullTableShow: _propTypes["default"].element, - children: _propTypes["default"].node, - // Provided by withTranslation HOC - t: _propTypes["default"].func -}; -var _default = exports["default"] = (0, _reactI18next.withTranslation)(['loris'])(FilterableDataTable); - -/***/ }), - -/***/ "./jsx/Form.js": -/*!*********************!*\ - !*** ./jsx/Form.js ***! - \*********************/ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { - -"use strict"; - - -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); -var _typeof3 = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); -Object.defineProperty(exports, "__esModule", ({ - value: true -})); -exports["default"] = exports.TimeElement = exports.TextboxElement = exports.TextareaElement = exports.TagsElement = exports.StaticElement = exports.SliderElement = exports.SelectElement = exports.SearchableDropdown = exports.RadioElement = exports.PasswordElement = exports.NumericElement = exports.LorisElement = exports.LinkElement = exports.HeaderElement = exports.FormElement = exports.FileElement = exports.FieldsetElement = exports.EmailElement = exports.DateTimeElement = exports.DateElement = exports.CheckboxElement = exports.CTA = exports.ButtonElement = void 0; -var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js")); -var _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js")); -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); -var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); -var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); -var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); -var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); -var _react = _interopRequireWildcard(__webpack_require__(/*! react */ "react")); -var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); -var _InputLabel = _interopRequireDefault(__webpack_require__(/*! jsx/form/InputLabel */ "./jsx/form/InputLabel.tsx")); -function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } -function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) { if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } } return n["default"] = e, t && t.set(e, n), n; } -function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** - * This file contains React components for Loris form elements. - * - * @author Loris Team - * @version 1.0.0 - */ -/** - * Form Component. - * React wrapper for element that accepts children react components - * - * The form elements can be passed in two ways: - * 1. A `this.props.formElements` JSON object - * 2. Form components nested directly inside - * - * Note that if both are passed `this.props.formElements` is displayed first. - * - */ -var FormElement = exports.FormElement = /*#__PURE__*/function (_Component) { - (0, _inherits2["default"])(FormElement, _Component); - var _super = _createSuper(FormElement); - /** - * @constructor - * @param {object} props - React Component properties - */ - function FormElement(props) { - var _this; - (0, _classCallCheck2["default"])(this, FormElement); - _this = _super.call(this, props); - _this.getFormElements = _this.getFormElements.bind((0, _assertThisInitialized2["default"])(_this)); - _this.handleSubmit = _this.handleSubmit.bind((0, _assertThisInitialized2["default"])(_this)); - return _this; - } - - /** - * Get form elements - * - * @return {JSX[]} - An array of element React markup - */ - (0, _createClass2["default"])(FormElement, [{ - key: "getFormElements", - value: function getFormElements() { - var formElementsHTML = []; - var columns = this.props.columns; - var maxColumnSize = 12; - var colSize = Math.floor(maxColumnSize / columns); - var colClass = 'col-xs-12 col-sm-' + colSize + ' col-md-' + colSize; - - // Render elements from JSON - var filter = this.props.formElements; - Object.keys(filter).forEach(function (objKey, index) { - var userInput = this.props.onUserInput ? this.props.onUserInput : filter[objKey].onUserInput; - var value = filter[objKey].value ? filter[objKey].value : ''; - formElementsHTML.push( /*#__PURE__*/_react["default"].createElement("div", { - key: 'el_' + index, - className: colClass - }, /*#__PURE__*/_react["default"].createElement(LorisElement, { - element: filter[objKey], - onUserInput: userInput, - value: value - }))); - }.bind(this)); - - // Render elements from React - _react["default"].Children.forEach(this.props.children, function (child, key) { - // If child is plain HTML, insert it as full size. - // Useful for inserting
to split form sections - var elementClass = 'col-xs-12 col-sm-12 col-md-12'; - - // If child is form element use appropriate size - if ( /*#__PURE__*/_react["default"].isValidElement(child) && typeof child.type === 'function') { - elementClass = colClass; - } - formElementsHTML.push( /*#__PURE__*/_react["default"].createElement("div", { - key: 'el_child_' + key, - className: elementClass - }, child)); - }); - return formElementsHTML; - } - - /** - * Execute onSubmit - * - * @param {object} e - Event - */ - }, { - key: "handleSubmit", - value: function handleSubmit(e) { - // Override default submit if property is set - if (this.props.onSubmit) { - e.preventDefault(); - this.props.onSubmit(e); - } - } - - /** - * Renders the React component. - * - * @return {JSX} - React markup for the component - */ - }, { - key: "render", - value: function render() { - var encType = this.props.fileUpload ? 'multipart/form-data' : null; - - // Generate form elements - var formElements = this.getFormElements(); - - // Flexbox is set to ensure that columns of different heights - // are displayed proportionally on the screen - var rowStyles = { - display: 'flex', - flexWrap: 'wrap' - }; - return /*#__PURE__*/_react["default"].createElement("form", { - name: this.props.name, - id: this.props.id, - className: this.props["class"], - method: this.props.method, - action: this.props.action, - encType: encType, - onSubmit: this.handleSubmit - }, /*#__PURE__*/_react["default"].createElement("div", { - className: "row", - style: rowStyles - }, formElements)); - } - }]); - return FormElement; -}(_react.Component); -FormElement.propTypes = { - name: _propTypes["default"].string.isRequired, - id: _propTypes["default"].string, - method: _propTypes["default"].oneOf(['POST', 'GET']), - action: _propTypes["default"].string, - "class": _propTypes["default"].string, - columns: _propTypes["default"].number, - formElements: _propTypes["default"].shape({ - elementName: _propTypes["default"].shape({ - name: _propTypes["default"].string, - type: _propTypes["default"].string - }) - }), - onSubmit: _propTypes["default"].func, - onUserInput: _propTypes["default"].func, - children: _propTypes["default"].node, - fileUpload: _propTypes["default"].bool -}; -FormElement.defaultProps = { - name: null, - id: null, - method: 'POST', - action: undefined, - "class": 'form-horizontal', - columns: 1, - fileUpload: false, - formElements: {}, - onSubmit: function onSubmit() { - console.warn('onSubmit() callback is not set!'); - } -}; - -/** - * FieldsetElement Component. - * React wrapper for
element that is nested inside , - * and accepts child react components. A fieldset groups related elements in a form. - * - * The form elements can be passed by nesting Form components directly inside . - * - */ -var FieldsetElement = exports.FieldsetElement = /*#__PURE__*/function (_Component2) { - (0, _inherits2["default"])(FieldsetElement, _Component2); - var _super2 = _createSuper(FieldsetElement); - /** - * @constructor - * @param {object} props - React Component properties - */ - function FieldsetElement(props) { - var _this2; - (0, _classCallCheck2["default"])(this, FieldsetElement); - _this2 = _super2.call(this, props); - _this2.getFormElements = _this2.getFormElements.bind((0, _assertThisInitialized2["default"])(_this2)); - return _this2; - } - - /** - * Get form elements - * - * @return {JSX[]} - An array of element React markup - */ - (0, _createClass2["default"])(FieldsetElement, [{ - key: "getFormElements", - value: function getFormElements() { - var formElementsHTML = []; - var columns = this.props.columns; - var maxColumnSize = 12; - var colSize = Math.floor(maxColumnSize / columns); - var colClass = 'col-xs-12 col-sm-' + colSize + ' col-md-' + colSize; - - // Render elements from React - _react["default"].Children.forEach(this.props.children, function (child, key) { - // If child is plain HTML, insert it as full size. - // Useful for inserting
to split form sections - var elementClass = 'col-xs-12 col-sm-12 col-md-12'; - - // If child is form element use appropriate size - if ( /*#__PURE__*/_react["default"].isValidElement(child) && typeof child.type === 'function') { - elementClass = colClass; - } - formElementsHTML.push( /*#__PURE__*/_react["default"].createElement("div", { - key: 'el_child_' + key, - className: elementClass - }, child)); - }); - return formElementsHTML; - } - - /** - * Renders the React component. - * - * @return {JSX} - React markup for the component - */ - }, { - key: "render", - value: function render() { - // Generate form elements - var formElements = this.getFormElements(); - return /*#__PURE__*/_react["default"].createElement("fieldset", { - name: this.props.name - }, /*#__PURE__*/_react["default"].createElement("legend", null, this.props.legend), formElements); - } - }]); - return FieldsetElement; -}(_react.Component); -FieldsetElement.propTypes = { - columns: _propTypes["default"].number, - name: _propTypes["default"].string, - legend: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]), - children: _propTypes["default"].node -}; -FieldsetElement.defaultProps = { - columns: 1, - legend: 'Selection Filter' -}; - -/** - * Search Component - * React wrapper for a searchable dropdown - */ -var SearchableDropdown = exports.SearchableDropdown = /*#__PURE__*/function (_Component3) { - (0, _inherits2["default"])(SearchableDropdown, _Component3); - var _super3 = _createSuper(SearchableDropdown); - /** - * @constructor - * @param {object} props - React Component properties - */ - function SearchableDropdown(props) { - var _this3; - (0, _classCallCheck2["default"])(this, SearchableDropdown); - _this3 = _super3.call(this, props); - _this3.state = { - currentInput: '' - }; - _this3.getKeyFromValue = _this3.getKeyFromValue.bind((0, _assertThisInitialized2["default"])(_this3)); - _this3.handleChange = _this3.handleChange.bind((0, _assertThisInitialized2["default"])(_this3)); - _this3.handleBlur = _this3.handleBlur.bind((0, _assertThisInitialized2["default"])(_this3)); - return _this3; - } - - /** - * Get key from value - * - * @param {string} value - * @return {string} - */ - (0, _createClass2["default"])(SearchableDropdown, [{ - key: "getKeyFromValue", - value: function getKeyFromValue(value) { - var options = this.props.options; - return Object.keys(options).find(function (o) { - return options[o] === value; - }); - } - - /** - * Handle change - * - * @param {object} e - Event - */ - }, { - key: "handleChange", - value: function handleChange(e) { - var value = this.getKeyFromValue(e.target.value); - // if not in strict mode and key value is undefined (i.e., not in options prop) - // set value equal to e.target.value - if (!this.props.strictSearch && value === undefined) { - value = e.target.value; - } - this.setState({ - currentInput: e.target.value - }); - this.props.onUserInput(this.props.name, value); - } - - /** - * Handle blur - * - * @param {object} e - Event - */ - }, { - key: "handleBlur", - value: function handleBlur(e) { - // null out entry if not present in options in strict mode - if (this.props.strictSearch) { - var value = e.target.value; - var options = this.props.options; - if (Object.values(options).indexOf(value) === -1) { - // empty string out both the hidden value as well as the input text - this.setState({ - currentInput: '' - }); - this.props.onUserInput(this.props.name, ''); - } - } - } - - /** - * Called by React when the component is updated. - * - * @param {object} prevProps - Previous React Component properties - */ - }, { - key: "componentDidUpdate", - value: function componentDidUpdate(prevProps) { - // need to clear out currentInput for when props.value gets wiped - // if the previous value prop contained data and the current one doesn't - // clear currentInput - if (prevProps.value && !this.props.value) { - this.setState({ - currentInput: '' - }); - } - } - - /** - * Renders the React component. - * - * @return {JSX} - React markup for the component - */ - }, { - key: "render", - value: function render() { - var sortByValue = this.props.sortByValue; - var options = this.props.options; - var strictMessage = 'Entry must be included in provided list of options.'; - var errorMessage = null; - var elementClass = 'row form-group'; - - // Add error message - if (this.props.errorMessage) { - errorMessage = /*#__PURE__*/_react["default"].createElement("span", null, this.props.errorMessage); - elementClass = 'row form-group has-error'; - } else if (this.props.required && this.props.value === '') { - var msg = 'This field is required!'; - msg += this.props.strictSearch ? ' ' + strictMessage : ''; - errorMessage = /*#__PURE__*/_react["default"].createElement("span", null, msg); - elementClass = 'row form-group has-error'; - } else if (this.props.strictSearch && this.props.value === '') { - errorMessage = /*#__PURE__*/_react["default"].createElement("span", null, strictMessage); - elementClass = 'row form-group has-error'; - } - - // determine value to place into text input - var value = ''; - // use value in options if valid - if (this.props.value !== undefined && Object.keys(options).indexOf(this.props.value) > -1) { - value = options[this.props.value]; - // else, use input text value - } else if (this.state.currentInput) { - value = this.state.currentInput; - } - var newOptions = {}; - var optionList = []; - if (sortByValue) { - for (var key in options) { - if (options.hasOwnProperty(key)) { - newOptions[options[key]] = key; - } - } - optionList = Object.keys(newOptions).sort().map(function (option) { - return /*#__PURE__*/_react["default"].createElement("option", { - value: option, - key: newOptions[option] - }); - }); - } else { - optionList = Object.keys(options).map(function (option) { - return /*#__PURE__*/_react["default"].createElement("option", { - value: options[option], - key: option - }); - }); - } - return /*#__PURE__*/_react["default"].createElement("div", { - className: elementClass - }, /*#__PURE__*/_react["default"].createElement(_InputLabel["default"], { - label: this.props.label, - required: this.props.required - }), /*#__PURE__*/_react["default"].createElement("div", { - className: "col-sm-9" - }, /*#__PURE__*/_react["default"].createElement("input", { - type: "text", - name: this.props.name + '_input', - value: value, - id: this.props.id, - list: this.props.name + '_list', - className: "form-control", - placeholder: this.props.placeHolder, - onChange: this.handleChange, - onBlur: this.handleBlur, - disabled: this.props.disabled, - required: this.props.required - }), /*#__PURE__*/_react["default"].createElement("datalist", { - id: this.props.name + '_list' - }, optionList), errorMessage)); - } - }]); - return SearchableDropdown; -}(_react.Component); -SearchableDropdown.propTypes = { - name: _propTypes["default"].string.isRequired, - options: _propTypes["default"].object.isRequired, - id: _propTypes["default"].string, - // strictSearch, if set to true, will require that only options - // provided in the options prop can be submitted - strictSearch: _propTypes["default"].bool, - label: _propTypes["default"].string, - value: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].array]), - "class": _propTypes["default"].string, - disabled: _propTypes["default"].bool, - required: _propTypes["default"].bool, - errorMessage: _propTypes["default"].string, - placeHolder: _propTypes["default"].string, - onUserInput: _propTypes["default"].func, - sortByValue: _propTypes["default"].bool -}; -SearchableDropdown.defaultProps = { - name: '', - options: {}, - strictSearch: true, - label: '', - value: undefined, - id: null, - "class": '', - disabled: false, - required: false, - sortByValue: true, - errorMessage: null, - placeHolder: '', - onUserInput: function onUserInput() { - console.warn('onUserInput() callback is not set'); - } -}; - -/** - * Select Component - * React wrapper for a simple or 'multiple' \n
\n \n
\n \n \n
\n
\n
\n \n").replace(/(^|\n)\s*/g, ''); - -var resetOldContainer = function resetOldContainer() { - var oldContainer = getContainer(); - - if (!oldContainer) { - return; - } - - oldContainer.parentNode.removeChild(oldContainer); - removeClass([document.documentElement, document.body], [swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['has-column']]); -}; - -var oldInputVal; // IE11 workaround, see #1109 for details - -var resetValidationMessage = function resetValidationMessage(e) { - if (Swal.isVisible() && oldInputVal !== e.target.value) { - Swal.resetValidationMessage(); - } - - oldInputVal = e.target.value; -}; - -var addInputChangeListeners = function addInputChangeListeners() { - var content = getContent(); - var input = getChildByClass(content, swalClasses.input); - var file = getChildByClass(content, swalClasses.file); - var range = content.querySelector(".".concat(swalClasses.range, " input")); - var rangeOutput = content.querySelector(".".concat(swalClasses.range, " output")); - var select = getChildByClass(content, swalClasses.select); - var checkbox = content.querySelector(".".concat(swalClasses.checkbox, " input")); - var textarea = getChildByClass(content, swalClasses.textarea); - input.oninput = resetValidationMessage; - file.onchange = resetValidationMessage; - select.onchange = resetValidationMessage; - checkbox.onchange = resetValidationMessage; - textarea.oninput = resetValidationMessage; - - range.oninput = function (e) { - resetValidationMessage(e); - rangeOutput.value = range.value; - }; - - range.onchange = function (e) { - resetValidationMessage(e); - range.nextSibling.value = range.value; - }; -}; - -var getTarget = function getTarget(target) { - return typeof target === 'string' ? document.querySelector(target) : target; -}; - -var setupAccessibility = function setupAccessibility(params) { - var popup = getPopup(); - popup.setAttribute('role', params.toast ? 'alert' : 'dialog'); - popup.setAttribute('aria-live', params.toast ? 'polite' : 'assertive'); - - if (!params.toast) { - popup.setAttribute('aria-modal', 'true'); - } -}; - -var setupRTL = function setupRTL(targetElement) { - if (window.getComputedStyle(targetElement).direction === 'rtl') { - addClass(getContainer(), swalClasses.rtl); - } -}; -/* - * Add modal + backdrop to DOM - */ - - -var init = function init(params) { - // Clean up the old popup container if it exists - resetOldContainer(); - /* istanbul ignore if */ - - if (isNodeEnv()) { - error('SweetAlert2 requires document to initialize'); - return; - } - - var container = document.createElement('div'); - container.className = swalClasses.container; - container.innerHTML = sweetHTML; - var targetElement = getTarget(params.target); - targetElement.appendChild(container); - setupAccessibility(params); - setupRTL(targetElement); - addInputChangeListeners(); -}; - -var parseHtmlToContainer = function parseHtmlToContainer(param, target) { - // DOM element - if (param instanceof HTMLElement) { - target.appendChild(param); // JQuery element(s) - } else if (_typeof(param) === 'object') { - handleJqueryElem(target, param); // Plain string - } else if (param) { - target.innerHTML = param; - } -}; - -var handleJqueryElem = function handleJqueryElem(target, elem) { - target.innerHTML = ''; - - if (0 in elem) { - for (var i = 0; i in elem; i++) { - target.appendChild(elem[i].cloneNode(true)); - } - } else { - target.appendChild(elem.cloneNode(true)); - } -}; - -var animationEndEvent = function () { - // Prevent run in Node env - - /* istanbul ignore if */ - if (isNodeEnv()) { - return false; - } - - var testEl = document.createElement('div'); - var transEndEventNames = { - WebkitAnimation: 'webkitAnimationEnd', - OAnimation: 'oAnimationEnd oanimationend', - animation: 'animationend' - }; - - for (var i in transEndEventNames) { - if (Object.prototype.hasOwnProperty.call(transEndEventNames, i) && typeof testEl.style[i] !== 'undefined') { - return transEndEventNames[i]; - } - } - - return false; -}(); - -// Measure width of scrollbar -// https://github.com/twbs/bootstrap/blob/master/js/modal.js#L279-L286 -var measureScrollbar = function measureScrollbar() { - var supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints; - - if (supportsTouch) { - return 0; - } - - var scrollDiv = document.createElement('div'); - scrollDiv.style.width = '50px'; - scrollDiv.style.height = '50px'; - scrollDiv.style.overflow = 'scroll'; - document.body.appendChild(scrollDiv); - var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; - document.body.removeChild(scrollDiv); - return scrollbarWidth; -}; - -var renderActions = function renderActions(instance, params) { - var actions = getActions(); - var confirmButton = getConfirmButton(); - var cancelButton = getCancelButton(); // Actions (buttons) wrapper - - if (!params.showConfirmButton && !params.showCancelButton) { - hide(actions); - } // Custom class - - - applyCustomClass(actions, params.customClass, 'actions'); // Render confirm button - - renderButton(confirmButton, 'confirm', params); // render Cancel Button - - renderButton(cancelButton, 'cancel', params); - - if (params.buttonsStyling) { - handleButtonsStyling(confirmButton, cancelButton, params); - } else { - removeClass([confirmButton, cancelButton], swalClasses.styled); - confirmButton.style.backgroundColor = confirmButton.style.borderLeftColor = confirmButton.style.borderRightColor = ''; - cancelButton.style.backgroundColor = cancelButton.style.borderLeftColor = cancelButton.style.borderRightColor = ''; - } - - if (params.reverseButtons) { - confirmButton.parentNode.insertBefore(cancelButton, confirmButton); - } -}; - -function handleButtonsStyling(confirmButton, cancelButton, params) { - addClass([confirmButton, cancelButton], swalClasses.styled); // Buttons background colors - - if (params.confirmButtonColor) { - confirmButton.style.backgroundColor = params.confirmButtonColor; - } - - if (params.cancelButtonColor) { - cancelButton.style.backgroundColor = params.cancelButtonColor; - } // Loading state - - - var confirmButtonBackgroundColor = window.getComputedStyle(confirmButton).getPropertyValue('background-color'); - confirmButton.style.borderLeftColor = confirmButtonBackgroundColor; - confirmButton.style.borderRightColor = confirmButtonBackgroundColor; -} - -function renderButton(button, buttonType, params) { - toggle(button, params['showC' + buttonType.substring(1) + 'Button'], 'inline-block'); - button.innerHTML = params[buttonType + 'ButtonText']; // Set caption text - - button.setAttribute('aria-label', params[buttonType + 'ButtonAriaLabel']); // ARIA label - // Add buttons custom classes - - button.className = swalClasses[buttonType]; - applyCustomClass(button, params.customClass, buttonType + 'Button'); - addClass(button, params[buttonType + 'ButtonClass']); -} - -function handleBackdropParam(container, backdrop) { - if (typeof backdrop === 'string') { - container.style.background = backdrop; - } else if (!backdrop) { - addClass([document.documentElement, document.body], swalClasses['no-backdrop']); - } -} - -function handlePositionParam(container, position) { - if (position in swalClasses) { - addClass(container, swalClasses[position]); - } else { - warn('The "position" parameter is not valid, defaulting to "center"'); - addClass(container, swalClasses.center); - } -} - -function handleGrowParam(container, grow) { - if (grow && typeof grow === 'string') { - var growClass = 'grow-' + grow; - - if (growClass in swalClasses) { - addClass(container, swalClasses[growClass]); - } - } -} - -var renderContainer = function renderContainer(instance, params) { - var container = getContainer(); - - if (!container) { - return; - } - - handleBackdropParam(container, params.backdrop); - - if (!params.backdrop && params.allowOutsideClick) { - warn('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'); - } - - handlePositionParam(container, params.position); - handleGrowParam(container, params.grow); // Custom class - - applyCustomClass(container, params.customClass, 'container'); - - if (params.customContainerClass) { - // @deprecated - addClass(container, params.customContainerClass); - } -}; - -/** - * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has. - * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` - * This is the approach that Babel will probably take to implement private methods/fields - * https://github.com/tc39/proposal-private-methods - * https://github.com/babel/babel/pull/7555 - * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* - * then we can use that language feature. - */ -var privateProps = { - promise: new WeakMap(), - innerParams: new WeakMap(), - domCache: new WeakMap() -}; - -var inputTypes = ['input', 'file', 'range', 'select', 'radio', 'checkbox', 'textarea']; -var renderInput = function renderInput(instance, params) { - var content = getContent(); - var innerParams = privateProps.innerParams.get(instance); - var rerender = !innerParams || params.input !== innerParams.input; - inputTypes.forEach(function (inputType) { - var inputClass = swalClasses[inputType]; - var inputContainer = getChildByClass(content, inputClass); // set attributes - - setAttributes(inputType, params.inputAttributes); // set class - - inputContainer.className = inputClass; - - if (rerender) { - hide(inputContainer); - } - }); - - if (params.input) { - if (rerender) { - showInput(params); - } // set custom class - - - setCustomClass(params); - } -}; - -var showInput = function showInput(params) { - if (!renderInputType[params.input]) { - return error("Unexpected type of input! Expected \"text\", \"email\", \"password\", \"number\", \"tel\", \"select\", \"radio\", \"checkbox\", \"textarea\", \"file\" or \"url\", got \"".concat(params.input, "\"")); - } - - var inputContainer = getInputContainer(params.input); - var input = renderInputType[params.input](inputContainer, params); - show(input); // input autofocus - - setTimeout(function () { - focusInput(input); - }); -}; - -var removeAttributes = function removeAttributes(input) { - for (var i = 0; i < input.attributes.length; i++) { - var attrName = input.attributes[i].name; - - if (!(['type', 'value', 'style'].indexOf(attrName) !== -1)) { - input.removeAttribute(attrName); - } - } -}; - -var setAttributes = function setAttributes(inputType, inputAttributes) { - var input = getInput(getContent(), inputType); - - if (!input) { - return; - } - - removeAttributes(input); - - for (var attr in inputAttributes) { - // Do not set a placeholder for - // it'll crash Edge, #1298 - if (inputType === 'range' && attr === 'placeholder') { - continue; - } - - input.setAttribute(attr, inputAttributes[attr]); - } -}; - -var setCustomClass = function setCustomClass(params) { - var inputContainer = getInputContainer(params.input); - - if (params.inputClass) { - addClass(inputContainer, params.inputClass); - } - - if (params.customClass) { - addClass(inputContainer, params.customClass.input); - } -}; - -var setInputPlaceholder = function setInputPlaceholder(input, params) { - if (!input.placeholder || params.inputPlaceholder) { - input.placeholder = params.inputPlaceholder; - } -}; - -var getInputContainer = function getInputContainer(inputType) { - var inputClass = swalClasses[inputType] ? swalClasses[inputType] : swalClasses.input; - return getChildByClass(getContent(), inputClass); -}; - -var renderInputType = {}; - -renderInputType.text = renderInputType.email = renderInputType.password = renderInputType.number = renderInputType.tel = renderInputType.url = function (input, params) { - if (typeof params.inputValue === 'string' || typeof params.inputValue === 'number') { - input.value = params.inputValue; - } else if (!isPromise(params.inputValue)) { - warn("Unexpected type of inputValue! Expected \"string\", \"number\" or \"Promise\", got \"".concat(_typeof(params.inputValue), "\"")); - } - - setInputPlaceholder(input, params); - input.type = params.input; - return input; -}; - -renderInputType.file = function (input, params) { - setInputPlaceholder(input, params); - return input; -}; - -renderInputType.range = function (range, params) { - var rangeInput = range.querySelector('input'); - var rangeOutput = range.querySelector('output'); - rangeInput.value = params.inputValue; - rangeInput.type = params.input; - rangeOutput.value = params.inputValue; - return range; -}; - -renderInputType.select = function (select, params) { - select.innerHTML = ''; - - if (params.inputPlaceholder) { - var placeholder = document.createElement('option'); - placeholder.innerHTML = params.inputPlaceholder; - placeholder.value = ''; - placeholder.disabled = true; - placeholder.selected = true; - select.appendChild(placeholder); - } - - return select; -}; - -renderInputType.radio = function (radio) { - radio.innerHTML = ''; - return radio; -}; - -renderInputType.checkbox = function (checkboxContainer, params) { - var checkbox = getInput(getContent(), 'checkbox'); - checkbox.value = 1; - checkbox.id = swalClasses.checkbox; - checkbox.checked = Boolean(params.inputValue); - var label = checkboxContainer.querySelector('span'); - label.innerHTML = params.inputPlaceholder; - return checkboxContainer; -}; - -renderInputType.textarea = function (textarea, params) { - textarea.value = params.inputValue; - setInputPlaceholder(textarea, params); - - if ('MutationObserver' in window) { - // #1699 - var initialPopupWidth = parseInt(window.getComputedStyle(getPopup()).width); - var popupPadding = parseInt(window.getComputedStyle(getPopup()).paddingLeft) + parseInt(window.getComputedStyle(getPopup()).paddingRight); - - var outputsize = function outputsize() { - var contentWidth = textarea.offsetWidth + popupPadding; - - if (contentWidth > initialPopupWidth) { - getPopup().style.width = contentWidth + 'px'; - } else { - getPopup().style.width = null; - } - }; - - new MutationObserver(outputsize).observe(textarea, { - attributes: true, - attributeFilter: ['style'] - }); - } - - return textarea; -}; - -var renderContent = function renderContent(instance, params) { - var content = getContent().querySelector('#' + swalClasses.content); // Content as HTML - - if (params.html) { - parseHtmlToContainer(params.html, content); - show(content, 'block'); // Content as plain text - } else if (params.text) { - content.textContent = params.text; - show(content, 'block'); // No content - } else { - hide(content); - } - - renderInput(instance, params); // Custom class - - applyCustomClass(getContent(), params.customClass, 'content'); -}; - -var renderFooter = function renderFooter(instance, params) { - var footer = getFooter(); - toggle(footer, params.footer); - - if (params.footer) { - parseHtmlToContainer(params.footer, footer); - } // Custom class - - - applyCustomClass(footer, params.customClass, 'footer'); -}; - -var renderCloseButton = function renderCloseButton(instance, params) { - var closeButton = getCloseButton(); - closeButton.innerHTML = params.closeButtonHtml; // Custom class - - applyCustomClass(closeButton, params.customClass, 'closeButton'); - toggle(closeButton, params.showCloseButton); - closeButton.setAttribute('aria-label', params.closeButtonAriaLabel); -}; - -var renderIcon = function renderIcon(instance, params) { - var innerParams = privateProps.innerParams.get(instance); // if the icon with the given type already rendered, - // apply the custom class without re-rendering the icon - - if (innerParams && params.type === innerParams.type && getIcon()) { - applyCustomClass(getIcon(), params.customClass, 'icon'); - return; - } - - hideAllIcons(); - - if (!params.type) { - return; - } - - adjustSuccessIconBackgoundColor(); - - if (Object.keys(iconTypes).indexOf(params.type) !== -1) { - var icon = elementBySelector(".".concat(swalClasses.icon, ".").concat(iconTypes[params.type])); - show(icon); // Custom class - - applyCustomClass(icon, params.customClass, 'icon'); // Animate icon - - toggleClass(icon, "swal2-animate-".concat(params.type, "-icon"), params.animation); - } else { - error("Unknown type! Expected \"success\", \"error\", \"warning\", \"info\" or \"question\", got \"".concat(params.type, "\"")); - } -}; - -var hideAllIcons = function hideAllIcons() { - var icons = getIcons(); - - for (var i = 0; i < icons.length; i++) { - hide(icons[i]); - } -}; // Adjust success icon background color to match the popup background color - - -var adjustSuccessIconBackgoundColor = function adjustSuccessIconBackgoundColor() { - var popup = getPopup(); - var popupBackgroundColor = window.getComputedStyle(popup).getPropertyValue('background-color'); - var successIconParts = popup.querySelectorAll('[class^=swal2-success-circular-line], .swal2-success-fix'); - - for (var i = 0; i < successIconParts.length; i++) { - successIconParts[i].style.backgroundColor = popupBackgroundColor; - } -}; - -var renderImage = function renderImage(instance, params) { - var image = getImage(); - - if (!params.imageUrl) { - return hide(image); - } - - show(image); // Src, alt - - image.setAttribute('src', params.imageUrl); - image.setAttribute('alt', params.imageAlt); // Width, height - - applyNumericalStyle(image, 'width', params.imageWidth); - applyNumericalStyle(image, 'height', params.imageHeight); // Class - - image.className = swalClasses.image; - applyCustomClass(image, params.customClass, 'image'); - - if (params.imageClass) { - addClass(image, params.imageClass); - } -}; - -var createStepElement = function createStepElement(step) { - var stepEl = document.createElement('li'); - addClass(stepEl, swalClasses['progress-step']); - stepEl.innerHTML = step; - return stepEl; -}; - -var createLineElement = function createLineElement(params) { - var lineEl = document.createElement('li'); - addClass(lineEl, swalClasses['progress-step-line']); - - if (params.progressStepsDistance) { - lineEl.style.width = params.progressStepsDistance; - } - - return lineEl; -}; - -var renderProgressSteps = function renderProgressSteps(instance, params) { - var progressStepsContainer = getProgressSteps(); - - if (!params.progressSteps || params.progressSteps.length === 0) { - return hide(progressStepsContainer); - } - - show(progressStepsContainer); - progressStepsContainer.innerHTML = ''; - var currentProgressStep = parseInt(params.currentProgressStep === null ? Swal.getQueueStep() : params.currentProgressStep); - - if (currentProgressStep >= params.progressSteps.length) { - warn('Invalid currentProgressStep parameter, it should be less than progressSteps.length ' + '(currentProgressStep like JS arrays starts from 0)'); - } - - params.progressSteps.forEach(function (step, index) { - var stepEl = createStepElement(step); - progressStepsContainer.appendChild(stepEl); - - if (index === currentProgressStep) { - addClass(stepEl, swalClasses['active-progress-step']); - } - - if (index !== params.progressSteps.length - 1) { - var lineEl = createLineElement(step); - progressStepsContainer.appendChild(lineEl); - } - }); -}; - -var renderTitle = function renderTitle(instance, params) { - var title = getTitle(); - toggle(title, params.title || params.titleText); - - if (params.title) { - parseHtmlToContainer(params.title, title); - } - - if (params.titleText) { - title.innerText = params.titleText; - } // Custom class - - - applyCustomClass(title, params.customClass, 'title'); -}; - -var renderHeader = function renderHeader(instance, params) { - var header = getHeader(); // Custom class - - applyCustomClass(header, params.customClass, 'header'); // Progress steps - - renderProgressSteps(instance, params); // Icon - - renderIcon(instance, params); // Image - - renderImage(instance, params); // Title - - renderTitle(instance, params); // Close button - - renderCloseButton(instance, params); -}; - -var renderPopup = function renderPopup(instance, params) { - var popup = getPopup(); // Width - - applyNumericalStyle(popup, 'width', params.width); // Padding - - applyNumericalStyle(popup, 'padding', params.padding); // Background - - if (params.background) { - popup.style.background = params.background; - } // Default Class - - - popup.className = swalClasses.popup; - - if (params.toast) { - addClass([document.documentElement, document.body], swalClasses['toast-shown']); - addClass(popup, swalClasses.toast); - } else { - addClass(popup, swalClasses.modal); - } // Custom class - - - applyCustomClass(popup, params.customClass, 'popup'); - - if (typeof params.customClass === 'string') { - addClass(popup, params.customClass); - } // CSS animation - - - toggleClass(popup, swalClasses.noanimation, !params.animation); -}; - -var render = function render(instance, params) { - renderPopup(instance, params); - renderContainer(instance, params); - renderHeader(instance, params); - renderContent(instance, params); - renderActions(instance, params); - renderFooter(instance, params); - - if (typeof params.onRender === 'function') { - params.onRender(getPopup()); - } -}; - -/* - * Global function to determine if SweetAlert2 popup is shown - */ - -var isVisible$1 = function isVisible$$1() { - return isVisible(getPopup()); -}; -/* - * Global function to click 'Confirm' button - */ - -var clickConfirm = function clickConfirm() { - return getConfirmButton() && getConfirmButton().click(); -}; -/* - * Global function to click 'Cancel' button - */ - -var clickCancel = function clickCancel() { - return getCancelButton() && getCancelButton().click(); -}; - -function fire() { - var Swal = this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return _construct(Swal, args); -} - -/** - * Returns an extended version of `Swal` containing `params` as defaults. - * Useful for reusing Swal configuration. - * - * For example: - * - * Before: - * const textPromptOptions = { input: 'text', showCancelButton: true } - * const {value: firstName} = await Swal.fire({ ...textPromptOptions, title: 'What is your first name?' }) - * const {value: lastName} = await Swal.fire({ ...textPromptOptions, title: 'What is your last name?' }) - * - * After: - * const TextPrompt = Swal.mixin({ input: 'text', showCancelButton: true }) - * const {value: firstName} = await TextPrompt('What is your first name?') - * const {value: lastName} = await TextPrompt('What is your last name?') - * - * @param mixinParams - */ -function mixin(mixinParams) { - var MixinSwal = - /*#__PURE__*/ - function (_this) { - _inherits(MixinSwal, _this); - - function MixinSwal() { - _classCallCheck(this, MixinSwal); - - return _possibleConstructorReturn(this, _getPrototypeOf(MixinSwal).apply(this, arguments)); - } - - _createClass(MixinSwal, [{ - key: "_main", - value: function _main(params) { - return _get(_getPrototypeOf(MixinSwal.prototype), "_main", this).call(this, _extends({}, mixinParams, params)); - } - }]); - - return MixinSwal; - }(this); - - return MixinSwal; -} - -// private global state for the queue feature -var currentSteps = []; -/* - * Global function for chaining sweetAlert popups - */ - -var queue = function queue(steps) { - var Swal = this; - currentSteps = steps; - - var resetAndResolve = function resetAndResolve(resolve, value) { - currentSteps = []; - document.body.removeAttribute('data-swal2-queue-step'); - resolve(value); - }; - - var queueResult = []; - return new Promise(function (resolve) { - (function step(i, callback) { - if (i < currentSteps.length) { - document.body.setAttribute('data-swal2-queue-step', i); - Swal.fire(currentSteps[i]).then(function (result) { - if (typeof result.value !== 'undefined') { - queueResult.push(result.value); - step(i + 1, callback); - } else { - resetAndResolve(resolve, { - dismiss: result.dismiss - }); - } - }); - } else { - resetAndResolve(resolve, { - value: queueResult - }); - } - })(0); - }); -}; -/* - * Global function for getting the index of current popup in queue - */ - -var getQueueStep = function getQueueStep() { - return document.body.getAttribute('data-swal2-queue-step'); -}; -/* - * Global function for inserting a popup to the queue - */ - -var insertQueueStep = function insertQueueStep(step, index) { - if (index && index < currentSteps.length) { - return currentSteps.splice(index, 0, step); - } - - return currentSteps.push(step); -}; -/* - * Global function for deleting a popup from the queue - */ - -var deleteQueueStep = function deleteQueueStep(index) { - if (typeof currentSteps[index] !== 'undefined') { - currentSteps.splice(index, 1); - } -}; - -/** - * Show spinner instead of Confirm button and disable Cancel button - */ - -var showLoading = function showLoading() { - var popup = getPopup(); - - if (!popup) { - Swal.fire(''); - } - - popup = getPopup(); - var actions = getActions(); - var confirmButton = getConfirmButton(); - var cancelButton = getCancelButton(); - show(actions); - show(confirmButton); - addClass([popup, actions], swalClasses.loading); - confirmButton.disabled = true; - cancelButton.disabled = true; - popup.setAttribute('data-loading', true); - popup.setAttribute('aria-busy', true); - popup.focus(); -}; - -var RESTORE_FOCUS_TIMEOUT = 100; - -var globalState = {}; -var focusPreviousActiveElement = function focusPreviousActiveElement() { - if (globalState.previousActiveElement && globalState.previousActiveElement.focus) { - globalState.previousActiveElement.focus(); - globalState.previousActiveElement = null; - } else if (document.body) { - document.body.focus(); - } -}; // Restore previous active (focused) element - - -var restoreActiveElement = function restoreActiveElement() { - return new Promise(function (resolve) { - var x = window.scrollX; - var y = window.scrollY; - globalState.restoreFocusTimeout = setTimeout(function () { - focusPreviousActiveElement(); - resolve(); - }, RESTORE_FOCUS_TIMEOUT); // issues/900 - - if (typeof x !== 'undefined' && typeof y !== 'undefined') { - // IE doesn't have scrollX/scrollY support - window.scrollTo(x, y); - } - }); -}; - -/** - * If `timer` parameter is set, returns number of milliseconds of timer remained. - * Otherwise, returns undefined. - */ - -var getTimerLeft = function getTimerLeft() { - return globalState.timeout && globalState.timeout.getTimerLeft(); -}; -/** - * Stop timer. Returns number of milliseconds of timer remained. - * If `timer` parameter isn't set, returns undefined. - */ - -var stopTimer = function stopTimer() { - return globalState.timeout && globalState.timeout.stop(); -}; -/** - * Resume timer. Returns number of milliseconds of timer remained. - * If `timer` parameter isn't set, returns undefined. - */ - -var resumeTimer = function resumeTimer() { - return globalState.timeout && globalState.timeout.start(); -}; -/** - * Resume timer. Returns number of milliseconds of timer remained. - * If `timer` parameter isn't set, returns undefined. - */ - -var toggleTimer = function toggleTimer() { - var timer = globalState.timeout; - return timer && (timer.running ? timer.stop() : timer.start()); -}; -/** - * Increase timer. Returns number of milliseconds of an updated timer. - * If `timer` parameter isn't set, returns undefined. - */ - -var increaseTimer = function increaseTimer(n) { - return globalState.timeout && globalState.timeout.increase(n); -}; -/** - * Check if timer is running. Returns true if timer is running - * or false if timer is paused or stopped. - * If `timer` parameter isn't set, returns undefined - */ - -var isTimerRunning = function isTimerRunning() { - return globalState.timeout && globalState.timeout.isRunning(); -}; - -var defaultParams = { - title: '', - titleText: '', - text: '', - html: '', - footer: '', - type: null, - toast: false, - customClass: '', - customContainerClass: '', - target: 'body', - backdrop: true, - animation: true, - heightAuto: true, - allowOutsideClick: true, - allowEscapeKey: true, - allowEnterKey: true, - stopKeydownPropagation: true, - keydownListenerCapture: false, - showConfirmButton: true, - showCancelButton: false, - preConfirm: null, - confirmButtonText: 'OK', - confirmButtonAriaLabel: '', - confirmButtonColor: null, - confirmButtonClass: '', - cancelButtonText: 'Cancel', - cancelButtonAriaLabel: '', - cancelButtonColor: null, - cancelButtonClass: '', - buttonsStyling: true, - reverseButtons: false, - focusConfirm: true, - focusCancel: false, - showCloseButton: false, - closeButtonHtml: '×', - closeButtonAriaLabel: 'Close this dialog', - showLoaderOnConfirm: false, - imageUrl: null, - imageWidth: null, - imageHeight: null, - imageAlt: '', - imageClass: '', - timer: null, - width: null, - padding: null, - background: null, - input: null, - inputPlaceholder: '', - inputValue: '', - inputOptions: {}, - inputAutoTrim: true, - inputClass: '', - inputAttributes: {}, - inputValidator: null, - validationMessage: null, - grow: false, - position: 'center', - progressSteps: [], - currentProgressStep: null, - progressStepsDistance: null, - onBeforeOpen: null, - onOpen: null, - onRender: null, - onClose: null, - onAfterClose: null, - scrollbarPadding: true -}; -var updatableParams = ['title', 'titleText', 'text', 'html', 'type', 'customClass', 'showConfirmButton', 'showCancelButton', 'confirmButtonText', 'confirmButtonAriaLabel', 'confirmButtonColor', 'confirmButtonClass', 'cancelButtonText', 'cancelButtonAriaLabel', 'cancelButtonColor', 'cancelButtonClass', 'buttonsStyling', 'reverseButtons', 'imageUrl', 'imageWidth', 'imageHeigth', 'imageAlt', 'imageClass', 'progressSteps', 'currentProgressStep']; -var deprecatedParams = { - customContainerClass: 'customClass', - confirmButtonClass: 'customClass', - cancelButtonClass: 'customClass', - imageClass: 'customClass', - inputClass: 'customClass' -}; -var toastIncompatibleParams = ['allowOutsideClick', 'allowEnterKey', 'backdrop', 'focusConfirm', 'focusCancel', 'heightAuto', 'keydownListenerCapture']; -/** - * Is valid parameter - * @param {String} paramName - */ - -var isValidParameter = function isValidParameter(paramName) { - return Object.prototype.hasOwnProperty.call(defaultParams, paramName); -}; -/** - * Is valid parameter for Swal.update() method - * @param {String} paramName - */ - -var isUpdatableParameter = function isUpdatableParameter(paramName) { - return updatableParams.indexOf(paramName) !== -1; -}; -/** - * Is deprecated parameter - * @param {String} paramName - */ - -var isDeprecatedParameter = function isDeprecatedParameter(paramName) { - return deprecatedParams[paramName]; -}; - -var checkIfParamIsValid = function checkIfParamIsValid(param) { - if (!isValidParameter(param)) { - warn("Unknown parameter \"".concat(param, "\"")); - } -}; - -var checkIfToastParamIsValid = function checkIfToastParamIsValid(param) { - if (toastIncompatibleParams.indexOf(param) !== -1) { - warn("The parameter \"".concat(param, "\" is incompatible with toasts")); - } -}; - -var checkIfParamIsDeprecated = function checkIfParamIsDeprecated(param) { - if (isDeprecatedParameter(param)) { - warnAboutDepreation(param, isDeprecatedParameter(param)); - } -}; -/** - * Show relevant warnings for given params - * - * @param params - */ - - -var showWarningsForParams = function showWarningsForParams(params) { - for (var param in params) { - checkIfParamIsValid(param); - - if (params.toast) { - checkIfToastParamIsValid(param); - } - - checkIfParamIsDeprecated(); - } -}; - - - -var staticMethods = Object.freeze({ - isValidParameter: isValidParameter, - isUpdatableParameter: isUpdatableParameter, - isDeprecatedParameter: isDeprecatedParameter, - argsToParams: argsToParams, - isVisible: isVisible$1, - clickConfirm: clickConfirm, - clickCancel: clickCancel, - getContainer: getContainer, - getPopup: getPopup, - getTitle: getTitle, - getContent: getContent, - getImage: getImage, - getIcon: getIcon, - getIcons: getIcons, - getCloseButton: getCloseButton, - getActions: getActions, - getConfirmButton: getConfirmButton, - getCancelButton: getCancelButton, - getHeader: getHeader, - getFooter: getFooter, - getFocusableElements: getFocusableElements, - getValidationMessage: getValidationMessage, - isLoading: isLoading, - fire: fire, - mixin: mixin, - queue: queue, - getQueueStep: getQueueStep, - insertQueueStep: insertQueueStep, - deleteQueueStep: deleteQueueStep, - showLoading: showLoading, - enableLoading: showLoading, - getTimerLeft: getTimerLeft, - stopTimer: stopTimer, - resumeTimer: resumeTimer, - toggleTimer: toggleTimer, - increaseTimer: increaseTimer, - isTimerRunning: isTimerRunning -}); - -/** - * Enables buttons and hide loader. - */ - -function hideLoading() { - var innerParams = privateProps.innerParams.get(this); - var domCache = privateProps.domCache.get(this); - - if (!innerParams.showConfirmButton) { - hide(domCache.confirmButton); - - if (!innerParams.showCancelButton) { - hide(domCache.actions); - } - } - - removeClass([domCache.popup, domCache.actions], swalClasses.loading); - domCache.popup.removeAttribute('aria-busy'); - domCache.popup.removeAttribute('data-loading'); - domCache.confirmButton.disabled = false; - domCache.cancelButton.disabled = false; -} - -function getInput$1(instance) { - var innerParams = privateProps.innerParams.get(instance || this); - var domCache = privateProps.domCache.get(instance || this); - - if (!domCache) { - return null; - } - - return getInput(domCache.content, innerParams.input); -} - -var fixScrollbar = function fixScrollbar() { - // for queues, do not do this more than once - if (states.previousBodyPadding !== null) { - return; - } // if the body has overflow - - - if (document.body.scrollHeight > window.innerHeight) { - // add padding so the content doesn't shift after removal of scrollbar - states.previousBodyPadding = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right')); - document.body.style.paddingRight = states.previousBodyPadding + measureScrollbar() + 'px'; - } -}; -var undoScrollbar = function undoScrollbar() { - if (states.previousBodyPadding !== null) { - document.body.style.paddingRight = states.previousBodyPadding + 'px'; - states.previousBodyPadding = null; - } -}; - -/* istanbul ignore next */ - -var iOSfix = function iOSfix() { - var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream || navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1; - - if (iOS && !hasClass(document.body, swalClasses.iosfix)) { - var offset = document.body.scrollTop; - document.body.style.top = offset * -1 + 'px'; - addClass(document.body, swalClasses.iosfix); - lockBodyScroll(); - } -}; - -var lockBodyScroll = function lockBodyScroll() { - // #1246 - var container = getContainer(); - var preventTouchMove; - - container.ontouchstart = function (e) { - preventTouchMove = e.target === container || !isScrollable(container) && e.target.tagName !== 'INPUT' // #1603 - ; - }; - - container.ontouchmove = function (e) { - if (preventTouchMove) { - e.preventDefault(); - e.stopPropagation(); - } - }; -}; -/* istanbul ignore next */ - - -var undoIOSfix = function undoIOSfix() { - if (hasClass(document.body, swalClasses.iosfix)) { - var offset = parseInt(document.body.style.top, 10); - removeClass(document.body, swalClasses.iosfix); - document.body.style.top = ''; - document.body.scrollTop = offset * -1; - } -}; - -var isIE11 = function isIE11() { - return !!window.MSInputMethodContext && !!document.documentMode; -}; // Fix IE11 centering sweetalert2/issues/933 - -/* istanbul ignore next */ - - -var fixVerticalPositionIE = function fixVerticalPositionIE() { - var container = getContainer(); - var popup = getPopup(); - container.style.removeProperty('align-items'); - - if (popup.offsetTop < 0) { - container.style.alignItems = 'flex-start'; - } -}; -/* istanbul ignore next */ - - -var IEfix = function IEfix() { - if (typeof window !== 'undefined' && isIE11()) { - fixVerticalPositionIE(); - window.addEventListener('resize', fixVerticalPositionIE); - } -}; -/* istanbul ignore next */ - -var undoIEfix = function undoIEfix() { - if (typeof window !== 'undefined' && isIE11()) { - window.removeEventListener('resize', fixVerticalPositionIE); - } -}; - -// Adding aria-hidden="true" to elements outside of the active modal dialog ensures that -// elements not within the active modal dialog will not be surfaced if a user opens a screen -// reader’s list of elements (headings, form controls, landmarks, etc.) in the document. - -var setAriaHidden = function setAriaHidden() { - var bodyChildren = toArray(document.body.children); - bodyChildren.forEach(function (el) { - if (el === getContainer() || contains(el, getContainer())) { - return; - } - - if (el.hasAttribute('aria-hidden')) { - el.setAttribute('data-previous-aria-hidden', el.getAttribute('aria-hidden')); - } - - el.setAttribute('aria-hidden', 'true'); - }); -}; -var unsetAriaHidden = function unsetAriaHidden() { - var bodyChildren = toArray(document.body.children); - bodyChildren.forEach(function (el) { - if (el.hasAttribute('data-previous-aria-hidden')) { - el.setAttribute('aria-hidden', el.getAttribute('data-previous-aria-hidden')); - el.removeAttribute('data-previous-aria-hidden'); - } else { - el.removeAttribute('aria-hidden'); - } - }); -}; - -/** - * This module containts `WeakMap`s for each effectively-"private property" that a `Swal` has. - * For example, to set the private property "foo" of `this` to "bar", you can `privateProps.foo.set(this, 'bar')` - * This is the approach that Babel will probably take to implement private methods/fields - * https://github.com/tc39/proposal-private-methods - * https://github.com/babel/babel/pull/7555 - * Once we have the changes from that PR in Babel, and our core class fits reasonable in *one module* - * then we can use that language feature. - */ -var privateMethods = { - swalPromiseResolve: new WeakMap() -}; - -/* - * Instance method to close sweetAlert - */ - -function removePopupAndResetState(instance, container, isToast, onAfterClose) { - if (isToast) { - triggerOnAfterCloseAndDispose(instance, onAfterClose); - } else { - restoreActiveElement().then(function () { - return triggerOnAfterCloseAndDispose(instance, onAfterClose); - }); - globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = false; - } - - if (container.parentNode) { - container.parentNode.removeChild(container); - } - - if (isModal()) { - undoScrollbar(); - undoIOSfix(); - undoIEfix(); - unsetAriaHidden(); - } - - removeBodyClasses(); -} - -function removeBodyClasses() { - removeClass([document.documentElement, document.body], [swalClasses.shown, swalClasses['height-auto'], swalClasses['no-backdrop'], swalClasses['toast-shown'], swalClasses['toast-column']]); -} - -function disposeSwal(instance) { - // Unset this.params so GC will dispose it (#1569) - delete instance.params; // Unset globalState props so GC will dispose globalState (#1569) - - delete globalState.keydownHandler; - delete globalState.keydownTarget; // Unset WeakMaps so GC will be able to dispose them (#1569) - - unsetWeakMaps(privateProps); - unsetWeakMaps(privateMethods); -} - -function close(resolveValue) { - var popup = getPopup(); - - if (!popup || hasClass(popup, swalClasses.hide)) { - return; - } - - var innerParams = privateProps.innerParams.get(this); - - if (!innerParams) { - return; - } - - var swalPromiseResolve = privateMethods.swalPromiseResolve.get(this); - removeClass(popup, swalClasses.show); - addClass(popup, swalClasses.hide); - handlePopupAnimation(this, popup, innerParams); // Resolve Swal promise - - swalPromiseResolve(resolveValue || {}); -} - -var handlePopupAnimation = function handlePopupAnimation(instance, popup, innerParams) { - var container = getContainer(); // If animation is supported, animate - - var animationIsSupported = animationEndEvent && hasCssAnimation(popup); - var onClose = innerParams.onClose, - onAfterClose = innerParams.onAfterClose; - - if (onClose !== null && typeof onClose === 'function') { - onClose(popup); - } - - if (animationIsSupported) { - animatePopup(instance, popup, container, onAfterClose); - } else { - // Otherwise, remove immediately - removePopupAndResetState(instance, container, isToast(), onAfterClose); - } -}; - -var animatePopup = function animatePopup(instance, popup, container, onAfterClose) { - globalState.swalCloseEventFinishedCallback = removePopupAndResetState.bind(null, instance, container, isToast(), onAfterClose); - popup.addEventListener(animationEndEvent, function (e) { - if (e.target === popup) { - globalState.swalCloseEventFinishedCallback(); - delete globalState.swalCloseEventFinishedCallback; - } - }); -}; - -var unsetWeakMaps = function unsetWeakMaps(obj) { - for (var i in obj) { - obj[i] = new WeakMap(); - } -}; - -var triggerOnAfterCloseAndDispose = function triggerOnAfterCloseAndDispose(instance, onAfterClose) { - setTimeout(function () { - if (onAfterClose !== null && typeof onAfterClose === 'function') { - onAfterClose(); - } - - if (!getPopup()) { - disposeSwal(instance); - } - }); -}; - -function setButtonsDisabled(instance, buttons, disabled) { - var domCache = privateProps.domCache.get(instance); - buttons.forEach(function (button) { - domCache[button].disabled = disabled; - }); -} - -function setInputDisabled(input, disabled) { - if (!input) { - return false; - } - - if (input.type === 'radio') { - var radiosContainer = input.parentNode.parentNode; - var radios = radiosContainer.querySelectorAll('input'); - - for (var i = 0; i < radios.length; i++) { - radios[i].disabled = disabled; - } - } else { - input.disabled = disabled; - } -} - -function enableButtons() { - setButtonsDisabled(this, ['confirmButton', 'cancelButton'], false); -} -function disableButtons() { - setButtonsDisabled(this, ['confirmButton', 'cancelButton'], true); -} // @deprecated - -function enableConfirmButton() { - warnAboutDepreation('Swal.enableConfirmButton()', "Swal.getConfirmButton().removeAttribute('disabled')"); - setButtonsDisabled(this, ['confirmButton'], false); -} // @deprecated - -function disableConfirmButton() { - warnAboutDepreation('Swal.disableConfirmButton()', "Swal.getConfirmButton().setAttribute('disabled', '')"); - setButtonsDisabled(this, ['confirmButton'], true); -} -function enableInput() { - return setInputDisabled(this.getInput(), false); -} -function disableInput() { - return setInputDisabled(this.getInput(), true); -} - -function showValidationMessage(error) { - var domCache = privateProps.domCache.get(this); - domCache.validationMessage.innerHTML = error; - var popupComputedStyle = window.getComputedStyle(domCache.popup); - domCache.validationMessage.style.marginLeft = "-".concat(popupComputedStyle.getPropertyValue('padding-left')); - domCache.validationMessage.style.marginRight = "-".concat(popupComputedStyle.getPropertyValue('padding-right')); - show(domCache.validationMessage); - var input = this.getInput(); - - if (input) { - input.setAttribute('aria-invalid', true); - input.setAttribute('aria-describedBy', swalClasses['validation-message']); - focusInput(input); - addClass(input, swalClasses.inputerror); - } -} // Hide block with validation message - -function resetValidationMessage$1() { - var domCache = privateProps.domCache.get(this); - - if (domCache.validationMessage) { - hide(domCache.validationMessage); - } - - var input = this.getInput(); - - if (input) { - input.removeAttribute('aria-invalid'); - input.removeAttribute('aria-describedBy'); - removeClass(input, swalClasses.inputerror); - } -} - -function getProgressSteps$1() { - warnAboutDepreation('Swal.getProgressSteps()', "const swalInstance = Swal.fire({progressSteps: ['1', '2', '3']}); const progressSteps = swalInstance.params.progressSteps"); - var innerParams = privateProps.innerParams.get(this); - return innerParams.progressSteps; -} -function setProgressSteps(progressSteps) { - warnAboutDepreation('Swal.setProgressSteps()', 'Swal.update()'); - var innerParams = privateProps.innerParams.get(this); - - var updatedParams = _extends({}, innerParams, { - progressSteps: progressSteps - }); - - renderProgressSteps(this, updatedParams); - privateProps.innerParams.set(this, updatedParams); -} -function showProgressSteps() { - var domCache = privateProps.domCache.get(this); - show(domCache.progressSteps); -} -function hideProgressSteps() { - var domCache = privateProps.domCache.get(this); - hide(domCache.progressSteps); -} - -var Timer = -/*#__PURE__*/ -function () { - function Timer(callback, delay) { - _classCallCheck(this, Timer); - - this.callback = callback; - this.remaining = delay; - this.running = false; - this.start(); - } - - _createClass(Timer, [{ - key: "start", - value: function start() { - if (!this.running) { - this.running = true; - this.started = new Date(); - this.id = setTimeout(this.callback, this.remaining); - } - - return this.remaining; - } - }, { - key: "stop", - value: function stop() { - if (this.running) { - this.running = false; - clearTimeout(this.id); - this.remaining -= new Date() - this.started; - } - - return this.remaining; - } - }, { - key: "increase", - value: function increase(n) { - var running = this.running; - - if (running) { - this.stop(); - } - - this.remaining += n; - - if (running) { - this.start(); - } - - return this.remaining; - } - }, { - key: "getTimerLeft", - value: function getTimerLeft() { - if (this.running) { - this.stop(); - this.start(); - } - - return this.remaining; - } - }, { - key: "isRunning", - value: function isRunning() { - return this.running; - } - }]); - - return Timer; -}(); - -var defaultInputValidators = { - email: function email(string, validationMessage) { - return /^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid email address'); - }, - url: function url(string, validationMessage) { - // taken from https://stackoverflow.com/a/3809435 with a small change from #1306 - return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(string) ? Promise.resolve() : Promise.resolve(validationMessage || 'Invalid URL'); - } -}; - -function setDefaultInputValidators(params) { - // Use default `inputValidator` for supported input types if not provided - if (!params.inputValidator) { - Object.keys(defaultInputValidators).forEach(function (key) { - if (params.input === key) { - params.inputValidator = defaultInputValidators[key]; - } - }); - } -} - -function validateCustomTargetElement(params) { - // Determine if the custom target element is valid - if (!params.target || typeof params.target === 'string' && !document.querySelector(params.target) || typeof params.target !== 'string' && !params.target.appendChild) { - warn('Target parameter is not valid, defaulting to "body"'); - params.target = 'body'; - } -} -/** - * Set type, text and actions on popup - * - * @param params - * @returns {boolean} - */ - - -function setParameters(params) { - setDefaultInputValidators(params); // showLoaderOnConfirm && preConfirm - - if (params.showLoaderOnConfirm && !params.preConfirm) { - 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'); - } // params.animation will be actually used in renderPopup.js - // but in case when params.animation is a function, we need to call that function - // before popup (re)initialization, so it'll be possible to check Swal.isVisible() - // inside the params.animation function - - - params.animation = callIfFunction(params.animation); - validateCustomTargetElement(params); // Replace newlines with
in title - - if (typeof params.title === 'string') { - params.title = params.title.split('\n').join('
'); - } - - init(params); -} - -function swalOpenAnimationFinished(popup, container) { - popup.removeEventListener(animationEndEvent, swalOpenAnimationFinished); - container.style.overflowY = 'auto'; -} -/** - * Open popup, add necessary classes and styles, fix scrollbar - * - * @param {Array} params - */ - - -var openPopup = function openPopup(params) { - var container = getContainer(); - var popup = getPopup(); - - if (typeof params.onBeforeOpen === 'function') { - params.onBeforeOpen(popup); - } - - addClasses(container, popup, params); // scrolling is 'hidden' until animation is done, after that 'auto' - - setScrollingVisibility(container, popup); - - if (isModal()) { - fixScrollContainer(container, params.scrollbarPadding); - } - - if (!isToast() && !globalState.previousActiveElement) { - globalState.previousActiveElement = document.activeElement; - } - - if (typeof params.onOpen === 'function') { - setTimeout(function () { - return params.onOpen(popup); - }); - } -}; - -var setScrollingVisibility = function setScrollingVisibility(container, popup) { - if (animationEndEvent && hasCssAnimation(popup)) { - container.style.overflowY = 'hidden'; - popup.addEventListener(animationEndEvent, swalOpenAnimationFinished.bind(null, popup, container)); - } else { - container.style.overflowY = 'auto'; - } -}; - -var fixScrollContainer = function fixScrollContainer(container, scrollbarPadding) { - iOSfix(); - IEfix(); - setAriaHidden(); - - if (scrollbarPadding) { - fixScrollbar(); - } // sweetalert2/issues/1247 - - - setTimeout(function () { - container.scrollTop = 0; - }); -}; - -var addClasses = function addClasses(container, popup, params) { - if (params.animation) { - addClass(popup, swalClasses.show); - } - - show(popup); - addClass([document.documentElement, document.body, container], swalClasses.shown); - - if (params.heightAuto && params.backdrop && !params.toast) { - addClass([document.documentElement, document.body], swalClasses['height-auto']); - } -}; - -var handleInputOptionsAndValue = function handleInputOptionsAndValue(instance, params) { - if (params.input === 'select' || params.input === 'radio') { - handleInputOptions(instance, params); - } else if (['text', 'email', 'number', 'tel', 'textarea'].indexOf(params.input) !== -1 && isPromise(params.inputValue)) { - handleInputValue(instance, params); - } -}; -var getInputValue = function getInputValue(instance, innerParams) { - var input = instance.getInput(); - - if (!input) { - return null; - } - - switch (innerParams.input) { - case 'checkbox': - return getCheckboxValue(input); - - case 'radio': - return getRadioValue(input); - - case 'file': - return getFileValue(input); - - default: - return innerParams.inputAutoTrim ? input.value.trim() : input.value; - } -}; - -var getCheckboxValue = function getCheckboxValue(input) { - return input.checked ? 1 : 0; -}; - -var getRadioValue = function getRadioValue(input) { - return input.checked ? input.value : null; -}; - -var getFileValue = function getFileValue(input) { - return input.files.length ? input.getAttribute('multiple') !== null ? input.files : input.files[0] : null; -}; - -var handleInputOptions = function handleInputOptions(instance, params) { - var content = getContent(); - - var processInputOptions = function processInputOptions(inputOptions) { - return populateInputOptions[params.input](content, formatInputOptions(inputOptions), params); - }; - - if (isPromise(params.inputOptions)) { - showLoading(); - params.inputOptions.then(function (inputOptions) { - instance.hideLoading(); - processInputOptions(inputOptions); - }); - } else if (_typeof(params.inputOptions) === 'object') { - processInputOptions(params.inputOptions); - } else { - error("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(_typeof(params.inputOptions))); - } -}; - -var handleInputValue = function handleInputValue(instance, params) { - var input = instance.getInput(); - hide(input); - params.inputValue.then(function (inputValue) { - input.value = params.input === 'number' ? parseFloat(inputValue) || 0 : inputValue + ''; - show(input); - input.focus(); - instance.hideLoading(); - })["catch"](function (err) { - error('Error in inputValue promise: ' + err); - input.value = ''; - show(input); - input.focus(); - instance.hideLoading(); - }); -}; - -var populateInputOptions = { - select: function select(content, inputOptions, params) { - var select = getChildByClass(content, swalClasses.select); - inputOptions.forEach(function (inputOption) { - var optionValue = inputOption[0]; - var optionLabel = inputOption[1]; - var option = document.createElement('option'); - option.value = optionValue; - option.innerHTML = optionLabel; - - if (params.inputValue.toString() === optionValue.toString()) { - option.selected = true; - } - - select.appendChild(option); - }); - select.focus(); - }, - radio: function radio(content, inputOptions, params) { - var radio = getChildByClass(content, swalClasses.radio); - inputOptions.forEach(function (inputOption) { - var radioValue = inputOption[0]; - var radioLabel = inputOption[1]; - var radioInput = document.createElement('input'); - var radioLabelElement = document.createElement('label'); - radioInput.type = 'radio'; - radioInput.name = swalClasses.radio; - radioInput.value = radioValue; - - if (params.inputValue.toString() === radioValue.toString()) { - radioInput.checked = true; - } - - var label = document.createElement('span'); - label.innerHTML = radioLabel; - label.className = swalClasses.label; - radioLabelElement.appendChild(radioInput); - radioLabelElement.appendChild(label); - radio.appendChild(radioLabelElement); - }); - var radios = radio.querySelectorAll('input'); - - if (radios.length) { - radios[0].focus(); - } - } -}; -/** - * Converts `inputOptions` into an array of `[value, label]`s - * @param inputOptions - */ - -var formatInputOptions = function formatInputOptions(inputOptions) { - var result = []; - - if (typeof Map !== 'undefined' && inputOptions instanceof Map) { - inputOptions.forEach(function (value, key) { - result.push([key, value]); - }); - } else { - Object.keys(inputOptions).forEach(function (key) { - result.push([key, inputOptions[key]]); - }); - } - - return result; -}; - -var handleConfirmButtonClick = function handleConfirmButtonClick(instance, innerParams) { - instance.disableButtons(); - - if (innerParams.input) { - handleConfirmWithInput(instance, innerParams); - } else { - confirm(instance, innerParams, true); - } -}; -var handleCancelButtonClick = function handleCancelButtonClick(instance, dismissWith) { - instance.disableButtons(); - dismissWith(DismissReason.cancel); -}; - -var handleConfirmWithInput = function handleConfirmWithInput(instance, innerParams) { - var inputValue = getInputValue(instance, innerParams); - - if (innerParams.inputValidator) { - instance.disableInput(); - var validationPromise = Promise.resolve().then(function () { - return innerParams.inputValidator(inputValue, innerParams.validationMessage); - }); - validationPromise.then(function (validationMessage) { - instance.enableButtons(); - instance.enableInput(); - - if (validationMessage) { - instance.showValidationMessage(validationMessage); - } else { - confirm(instance, innerParams, inputValue); - } - }); - } else if (!instance.getInput().checkValidity()) { - instance.enableButtons(); - instance.showValidationMessage(innerParams.validationMessage); - } else { - confirm(instance, innerParams, inputValue); - } -}; - -var succeedWith = function succeedWith(instance, value) { - instance.closePopup({ - value: value - }); -}; - -var confirm = function confirm(instance, innerParams, value) { - if (innerParams.showLoaderOnConfirm) { - showLoading(); // TODO: make showLoading an *instance* method - } - - if (innerParams.preConfirm) { - instance.resetValidationMessage(); - var preConfirmPromise = Promise.resolve().then(function () { - return innerParams.preConfirm(value, innerParams.validationMessage); - }); - preConfirmPromise.then(function (preConfirmValue) { - if (isVisible(getValidationMessage()) || preConfirmValue === false) { - instance.hideLoading(); - } else { - succeedWith(instance, typeof preConfirmValue === 'undefined' ? value : preConfirmValue); - } - }); - } else { - succeedWith(instance, value); - } -}; - -var addKeydownHandler = function addKeydownHandler(instance, globalState, innerParams, dismissWith) { - if (globalState.keydownTarget && globalState.keydownHandlerAdded) { - globalState.keydownTarget.removeEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = false; - } - - if (!innerParams.toast) { - globalState.keydownHandler = function (e) { - return keydownHandler(instance, e, innerParams, dismissWith); - }; - - globalState.keydownTarget = innerParams.keydownListenerCapture ? window : getPopup(); - globalState.keydownListenerCapture = innerParams.keydownListenerCapture; - globalState.keydownTarget.addEventListener('keydown', globalState.keydownHandler, { - capture: globalState.keydownListenerCapture - }); - globalState.keydownHandlerAdded = true; - } -}; // Focus handling - -var setFocus = function setFocus(innerParams, index, increment) { - var focusableElements = getFocusableElements(); // search for visible elements and select the next possible match - - for (var i = 0; i < focusableElements.length; i++) { - index = index + increment; // rollover to first item - - if (index === focusableElements.length) { - index = 0; // go to last item - } else if (index === -1) { - index = focusableElements.length - 1; - } - - return focusableElements[index].focus(); - } // no visible focusable elements, focus the popup - - - getPopup().focus(); -}; -var arrowKeys = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Left', 'Right', 'Up', 'Down' // IE11 -]; -var escKeys = ['Escape', 'Esc' // IE11 -]; - -var keydownHandler = function keydownHandler(instance, e, innerParams, dismissWith) { - if (innerParams.stopKeydownPropagation) { - e.stopPropagation(); - } // ENTER - - - if (e.key === 'Enter') { - handleEnter(instance, e, innerParams); // TAB - } else if (e.key === 'Tab') { - handleTab(e, innerParams); // ARROWS - switch focus between buttons - } else if (arrowKeys.indexOf(e.key) !== -1) { - handleArrows(); // ESC - } else if (escKeys.indexOf(e.key) !== -1) { - handleEsc(e, innerParams, dismissWith); - } -}; - -var handleEnter = function handleEnter(instance, e, innerParams) { - // #720 #721 - if (e.isComposing) { - return; - } - - if (e.target && instance.getInput() && e.target.outerHTML === instance.getInput().outerHTML) { - if (['textarea', 'file'].indexOf(innerParams.input) !== -1) { - return; // do not submit - } - - clickConfirm(); - e.preventDefault(); - } -}; - -var handleTab = function handleTab(e, innerParams) { - var targetElement = e.target; - var focusableElements = getFocusableElements(); - var btnIndex = -1; - - for (var i = 0; i < focusableElements.length; i++) { - if (targetElement === focusableElements[i]) { - btnIndex = i; - break; - } - } - - if (!e.shiftKey) { - // Cycle to the next button - setFocus(innerParams, btnIndex, 1); - } else { - // Cycle to the prev button - setFocus(innerParams, btnIndex, -1); - } - - e.stopPropagation(); - e.preventDefault(); -}; - -var handleArrows = function handleArrows() { - var confirmButton = getConfirmButton(); - var cancelButton = getCancelButton(); // focus Cancel button if Confirm button is currently focused - - if (document.activeElement === confirmButton && isVisible(cancelButton)) { - cancelButton.focus(); // and vice versa - } else if (document.activeElement === cancelButton && isVisible(confirmButton)) { - confirmButton.focus(); - } -}; - -var handleEsc = function handleEsc(e, innerParams, dismissWith) { - if (callIfFunction(innerParams.allowEscapeKey)) { - e.preventDefault(); - dismissWith(DismissReason.esc); - } -}; - -var handlePopupClick = function handlePopupClick(domCache, innerParams, dismissWith) { - if (innerParams.toast) { - handleToastClick(domCache, innerParams, dismissWith); - } else { - // Ignore click events that had mousedown on the popup but mouseup on the container - // This can happen when the user drags a slider - handleModalMousedown(domCache); // Ignore click events that had mousedown on the container but mouseup on the popup - - handleContainerMousedown(domCache); - handleModalClick(domCache, innerParams, dismissWith); - } -}; - -var handleToastClick = function handleToastClick(domCache, innerParams, dismissWith) { - // Closing toast by internal click - domCache.popup.onclick = function () { - if (innerParams.showConfirmButton || innerParams.showCancelButton || innerParams.showCloseButton || innerParams.input) { - return; - } - - dismissWith(DismissReason.close); - }; -}; - -var ignoreOutsideClick = false; - -var handleModalMousedown = function handleModalMousedown(domCache) { - domCache.popup.onmousedown = function () { - domCache.container.onmouseup = function (e) { - domCache.container.onmouseup = undefined; // We only check if the mouseup target is the container because usually it doesn't - // have any other direct children aside of the popup - - if (e.target === domCache.container) { - ignoreOutsideClick = true; - } - }; - }; -}; - -var handleContainerMousedown = function handleContainerMousedown(domCache) { - domCache.container.onmousedown = function () { - domCache.popup.onmouseup = function (e) { - domCache.popup.onmouseup = undefined; // We also need to check if the mouseup target is a child of the popup - - if (e.target === domCache.popup || domCache.popup.contains(e.target)) { - ignoreOutsideClick = true; - } - }; - }; -}; - -var handleModalClick = function handleModalClick(domCache, innerParams, dismissWith) { - domCache.container.onclick = function (e) { - if (ignoreOutsideClick) { - ignoreOutsideClick = false; - return; - } - - if (e.target === domCache.container && callIfFunction(innerParams.allowOutsideClick)) { - dismissWith(DismissReason.backdrop); - } - }; -}; - -function _main(userParams) { - showWarningsForParams(userParams); // Check if there is another Swal closing - - if (getPopup() && globalState.swalCloseEventFinishedCallback) { - globalState.swalCloseEventFinishedCallback(); - delete globalState.swalCloseEventFinishedCallback; - } // Check if there is a swal disposal defer timer - - - if (globalState.deferDisposalTimer) { - clearTimeout(globalState.deferDisposalTimer); - delete globalState.deferDisposalTimer; - } - - var innerParams = _extends({}, defaultParams, userParams); - - setParameters(innerParams); - Object.freeze(innerParams); // clear the previous timer - - if (globalState.timeout) { - globalState.timeout.stop(); - delete globalState.timeout; - } // clear the restore focus timeout - - - clearTimeout(globalState.restoreFocusTimeout); - var domCache = populateDomCache(this); - render(this, innerParams); - privateProps.innerParams.set(this, innerParams); - return swalPromise(this, domCache, innerParams); -} - -var swalPromise = function swalPromise(instance, domCache, innerParams) { - return new Promise(function (resolve) { - // functions to handle all closings/dismissals - var dismissWith = function dismissWith(dismiss) { - instance.closePopup({ - dismiss: dismiss - }); - }; - - privateMethods.swalPromiseResolve.set(instance, resolve); - setupTimer(globalState, innerParams, dismissWith); - - domCache.confirmButton.onclick = function () { - return handleConfirmButtonClick(instance, innerParams); - }; - - domCache.cancelButton.onclick = function () { - return handleCancelButtonClick(instance, dismissWith); - }; - - domCache.closeButton.onclick = function () { - return dismissWith(DismissReason.close); - }; - - handlePopupClick(domCache, innerParams, dismissWith); - addKeydownHandler(instance, globalState, innerParams, dismissWith); - - if (innerParams.toast && (innerParams.input || innerParams.footer || innerParams.showCloseButton)) { - addClass(document.body, swalClasses['toast-column']); - } else { - removeClass(document.body, swalClasses['toast-column']); - } - - handleInputOptionsAndValue(instance, innerParams); - openPopup(innerParams); - initFocus(domCache, innerParams); // Scroll container to top on open (#1247) - - domCache.container.scrollTop = 0; - }); -}; - -var populateDomCache = function populateDomCache(instance) { - var domCache = { - popup: getPopup(), - container: getContainer(), - content: getContent(), - actions: getActions(), - confirmButton: getConfirmButton(), - cancelButton: getCancelButton(), - closeButton: getCloseButton(), - validationMessage: getValidationMessage(), - progressSteps: getProgressSteps() - }; - privateProps.domCache.set(instance, domCache); - return domCache; -}; - -var setupTimer = function setupTimer(globalState$$1, innerParams, dismissWith) { - if (innerParams.timer) { - globalState$$1.timeout = new Timer(function () { - dismissWith('timer'); - delete globalState$$1.timeout; - }, innerParams.timer); - } -}; - -var initFocus = function initFocus(domCache, innerParams) { - if (innerParams.toast) { - return; - } - - if (!callIfFunction(innerParams.allowEnterKey)) { - return blurActiveElement(); - } - - if (innerParams.focusCancel && isVisible(domCache.cancelButton)) { - return domCache.cancelButton.focus(); - } - - if (innerParams.focusConfirm && isVisible(domCache.confirmButton)) { - return domCache.confirmButton.focus(); - } - - setFocus(innerParams, -1, 1); -}; - -var blurActiveElement = function blurActiveElement() { - if (document.activeElement && typeof document.activeElement.blur === 'function') { - document.activeElement.blur(); - } -}; - -/** - * Updates popup parameters. - */ - -function update(params) { - var popup = getPopup(); - - if (!popup || hasClass(popup, swalClasses.hide)) { - return 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."); - } - - var validUpdatableParams = {}; // assign valid params from `params` to `defaults` - - Object.keys(params).forEach(function (param) { - if (Swal.isUpdatableParameter(param)) { - validUpdatableParams[param] = params[param]; - } else { - warn("Invalid parameter to update: \"".concat(param, "\". Updatable params are listed here: https://github.com/sweetalert2/sweetalert2/blob/master/src/utils/params.js")); - } - }); - var innerParams = privateProps.innerParams.get(this); - - var updatedParams = _extends({}, innerParams, validUpdatableParams); - - render(this, updatedParams); - privateProps.innerParams.set(this, updatedParams); - Object.defineProperties(this, { - params: { - value: _extends({}, this.params, params), - writable: false, - enumerable: true - } - }); -} - - - -var instanceMethods = Object.freeze({ - hideLoading: hideLoading, - disableLoading: hideLoading, - getInput: getInput$1, - close: close, - closePopup: close, - closeModal: close, - closeToast: close, - enableButtons: enableButtons, - disableButtons: disableButtons, - enableConfirmButton: enableConfirmButton, - disableConfirmButton: disableConfirmButton, - enableInput: enableInput, - disableInput: disableInput, - showValidationMessage: showValidationMessage, - resetValidationMessage: resetValidationMessage$1, - getProgressSteps: getProgressSteps$1, - setProgressSteps: setProgressSteps, - showProgressSteps: showProgressSteps, - hideProgressSteps: hideProgressSteps, - _main: _main, - update: update -}); - -var currentInstance; // SweetAlert constructor - -function SweetAlert() { - // Prevent run in Node env - - /* istanbul ignore if */ - if (typeof window === 'undefined') { - return; - } // Check for the existence of Promise - - /* istanbul ignore if */ - - - if (typeof Promise === 'undefined') { - error('This package requires a Promise library, please include a shim to enable it in this browser (See: https://github.com/sweetalert2/sweetalert2/wiki/Migration-from-SweetAlert-to-SweetAlert2#1-ie-support)'); - } - - currentInstance = this; - - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - var outerParams = Object.freeze(this.constructor.argsToParams(args)); - Object.defineProperties(this, { - params: { - value: outerParams, - writable: false, - enumerable: true, - configurable: true - } - }); - - var promise = this._main(this.params); - - privateProps.promise.set(this, promise); -} // `catch` cannot be the name of a module export, so we define our thenable methods here instead - - -SweetAlert.prototype.then = function (onFulfilled) { - var promise = privateProps.promise.get(this); - return promise.then(onFulfilled); -}; - -SweetAlert.prototype["finally"] = function (onFinally) { - var promise = privateProps.promise.get(this); - return promise["finally"](onFinally); -}; // Assign instance methods from src/instanceMethods/*.js to prototype - - -_extends(SweetAlert.prototype, instanceMethods); // Assign static methods from src/staticMethods/*.js to constructor - - -_extends(SweetAlert, staticMethods); // Proxy to instance methods to constructor, for now, for backwards compatibility - - -Object.keys(instanceMethods).forEach(function (key) { - SweetAlert[key] = function () { - if (currentInstance) { - var _currentInstance; - - return (_currentInstance = currentInstance)[key].apply(_currentInstance, arguments); - } - }; -}); -SweetAlert.DismissReason = DismissReason; -SweetAlert.version = '8.19.0'; - -var Swal = SweetAlert; -Swal["default"] = Swal; - -return Swal; - -}))); -if (typeof this !== 'undefined' && this.Sweetalert2){ this.swal = this.sweetAlert = this.Swal = this.SweetAlert = this.Sweetalert2} - -"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,"@charset \"UTF-8\";.swal2-popup.swal2-toast{flex-direction:row;align-items:center;width:auto;padding:.625em;overflow-y:hidden;box-shadow:0 0 .625em #d9d9d9}.swal2-popup.swal2-toast .swal2-header{flex-direction:row}.swal2-popup.swal2-toast .swal2-title{flex-grow:1;justify-content:flex-start;margin:0 .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{position:static;width:.8em;height:.8em;line-height:.8}.swal2-popup.swal2-toast .swal2-content{justify-content:flex-start;font-size:1em}.swal2-popup.swal2-toast .swal2-icon{width:2em;min-width:2em;height:2em;margin:0}.swal2-popup.swal2-toast .swal2-icon::before{display:flex;align-items:center;font-size:2em;font-weight:700}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-popup.swal2-toast .swal2-icon::before{font-size:.25em}}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{flex-basis:auto!important;width:auto;height:auto;margin:0 .3125em}.swal2-popup.swal2-toast .swal2-styled{margin:0 .3125em;padding:.3125em .625em;font-size:1em}.swal2-popup.swal2-toast .swal2-styled:focus{box-shadow:0 0 0 .0625em #fff,0 0 0 .125em rgba(50,100,150,.4)}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-container{display:flex;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;flex-direction:row;align-items:center;justify-content:center;padding:.625em;overflow-x:hidden;transition:background-color .1s;background-color:transparent;-webkit-overflow-scrolling:touch}.swal2-container.swal2-top{align-items:flex-start}.swal2-container.swal2-top-left,.swal2-container.swal2-top-start{align-items:flex-start;justify-content:flex-start}.swal2-container.swal2-top-end,.swal2-container.swal2-top-right{align-items:flex-start;justify-content:flex-end}.swal2-container.swal2-center{align-items:center}.swal2-container.swal2-center-left,.swal2-container.swal2-center-start{align-items:center;justify-content:flex-start}.swal2-container.swal2-center-end,.swal2-container.swal2-center-right{align-items:center;justify-content:flex-end}.swal2-container.swal2-bottom{align-items:flex-end}.swal2-container.swal2-bottom-left,.swal2-container.swal2-bottom-start{align-items:flex-end;justify-content:flex-start}.swal2-container.swal2-bottom-end,.swal2-container.swal2-bottom-right{align-items:flex-end;justify-content:flex-end}.swal2-container.swal2-bottom-end>:first-child,.swal2-container.swal2-bottom-left>:first-child,.swal2-container.swal2-bottom-right>:first-child,.swal2-container.swal2-bottom-start>:first-child,.swal2-container.swal2-bottom>:first-child{margin-top:auto}.swal2-container.swal2-grow-fullscreen>.swal2-modal{display:flex!important;flex:1;align-self:stretch;justify-content:center}.swal2-container.swal2-grow-row>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container.swal2-grow-column{flex:1;flex-direction:column}.swal2-container.swal2-grow-column.swal2-bottom,.swal2-container.swal2-grow-column.swal2-center,.swal2-container.swal2-grow-column.swal2-top{align-items:center}.swal2-container.swal2-grow-column.swal2-bottom-left,.swal2-container.swal2-grow-column.swal2-bottom-start,.swal2-container.swal2-grow-column.swal2-center-left,.swal2-container.swal2-grow-column.swal2-center-start,.swal2-container.swal2-grow-column.swal2-top-left,.swal2-container.swal2-grow-column.swal2-top-start{align-items:flex-start}.swal2-container.swal2-grow-column.swal2-bottom-end,.swal2-container.swal2-grow-column.swal2-bottom-right,.swal2-container.swal2-grow-column.swal2-center-end,.swal2-container.swal2-grow-column.swal2-center-right,.swal2-container.swal2-grow-column.swal2-top-end,.swal2-container.swal2-grow-column.swal2-top-right{align-items:flex-end}.swal2-container.swal2-grow-column>.swal2-modal{display:flex!important;flex:1;align-content:center;justify-content:center}.swal2-container:not(.swal2-top):not(.swal2-top-start):not(.swal2-top-end):not(.swal2-top-left):not(.swal2-top-right):not(.swal2-center-start):not(.swal2-center-end):not(.swal2-center-left):not(.swal2-center-right):not(.swal2-bottom):not(.swal2-bottom-start):not(.swal2-bottom-end):not(.swal2-bottom-left):not(.swal2-bottom-right):not(.swal2-grow-fullscreen)>.swal2-modal{margin:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-container .swal2-modal{margin:0!important}}.swal2-container.swal2-shown{background-color:rgba(0,0,0,.4)}.swal2-popup{display:none;position:relative;box-sizing:border-box;flex-direction:column;justify-content:center;width:32em;max-width:100%;padding:1.25em;border:none;border-radius:.3125em;background:#fff;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-header{display:flex;flex-direction:column;align-items:center}.swal2-title{position:relative;max-width:100%;margin:0 0 .4em;padding:0;color:#595959;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;flex-wrap:wrap;align-items:center;justify-content:center;width:100%;margin:1.25em auto 0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-actions.swal2-loading .swal2-styled.swal2-confirm{box-sizing:border-box;width:2.5em;height:2.5em;margin:.46875em;padding:0;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:.25em solid transparent;border-radius:100%;border-color:transparent;background-color:transparent!important;color:transparent;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-actions.swal2-loading .swal2-styled.swal2-cancel{margin-right:30px;margin-left:30px}.swal2-actions.swal2-loading :not(.swal2-styled).swal2-confirm::after{content:\"\";display:inline-block;width:15px;height:15px;margin-left:5px;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border:3px solid #999;border-radius:50%;border-right-color:transparent;box-shadow:1px 1px 1px #fff}.swal2-styled{margin:.3125em;padding:.625em 2em;box-shadow:none;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#3085d6;color:#fff;font-size:1.0625em}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#aaa;color:#fff;font-size:1.0625em}.swal2-styled:focus{outline:0;box-shadow:0 0 0 2px #fff,0 0 0 4px rgba(50,100,150,.4)}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1.25em 0 0;padding:1em 0 0;border-top:1px solid #eee;color:#545454;font-size:1em}.swal2-image{max-width:100%;margin:1.25em auto}.swal2-close{position:absolute;z-index:2;top:0;right:0;justify-content:center;width:1.2em;height:1.2em;padding:0;overflow:hidden;transition:color .1s ease-out;border:none;border-radius:0;outline:initial;background:0 0;color:#ccc;font-family:serif;font-size:2.5em;line-height:1.2;cursor:pointer}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-content{z-index:1;justify-content:center;margin:0;padding:0;color:#545454;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em auto}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:100%;transition:border-color .3s,box-shadow .3s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:0 0 3px #c4e6f5}.swal2-file::-webkit-input-placeholder,.swal2-input::-webkit-input-placeholder,.swal2-textarea::-webkit-input-placeholder{color:#ccc}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::-ms-input-placeholder,.swal2-input::-ms-input-placeholder,.swal2-textarea::-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em auto;background:inherit}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-input[type=number]{max-width:10em}.swal2-file{background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:inherit;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{margin:0 .4em}.swal2-validation-message{display:none;align-items:center;justify-content:center;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.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}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:1.25em auto 1.875em;border:.25em solid transparent;border-radius:50%;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon::before{display:flex;align-items:center;height:92%;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.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}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning::before{content:\"!\"}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info::before{content:\"i\"}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question::before{content:\"?\"}.swal2-icon.swal2-question.swal2-arabic-question-mark::before{content:\"؟\"}.swal2-icon.swal2-success{border-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.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)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.875em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-progress-steps{align-items:center;margin:0 0 1.25em;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;width:2em;height:2em;border-radius:2em;background:#3085d6;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#3085d6}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;width:2.5em;height:.4em;margin:0 -1px;background:#3085d6}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-show.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-hide.swal2-noanimation{-webkit-animation:none;animation:none}.swal2-rtl .swal2-close{right:auto;left:0}.swal2-animate-success-icon .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-animate-success-icon .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-animate-success-icon .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-animate-error-icon{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-animate-error-icon .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}@supports (-ms-accelerator:true){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.swal2-range input{width:100%!important}.swal2-range output{display:none}}@-moz-document url-prefix(){.swal2-close:focus{outline:2px solid rgba(50,100,150,.4)}}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-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:-.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-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-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}}@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}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-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:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@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:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.875em;width:1.5625em}}@-webkit-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-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}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-shown{top:auto;right:auto;bottom:auto;left:auto;max-width:calc(100% - .625em * 2);background-color:transparent}body.swal2-no-backdrop .swal2-shown>.swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}body.swal2-no-backdrop .swal2-shown.swal2-top{top:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-top-left,body.swal2-no-backdrop .swal2-shown.swal2-top-start{top:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-top-end,body.swal2-no-backdrop .swal2-shown.swal2-top-right{top:0;right:0}body.swal2-no-backdrop .swal2-shown.swal2-center{top:50%;left:50%;transform:translate(-50%,-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-left,body.swal2-no-backdrop .swal2-shown.swal2-center-start{top:50%;left:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-center-end,body.swal2-no-backdrop .swal2-shown.swal2-center-right{top:50%;right:0;transform:translateY(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom{bottom:0;left:50%;transform:translateX(-50%)}body.swal2-no-backdrop .swal2-shown.swal2-bottom-left,body.swal2-no-backdrop .swal2-shown.swal2-bottom-start{bottom:0;left:0}body.swal2-no-backdrop .swal2-shown.swal2-bottom-end,body.swal2-no-backdrop .swal2-shown.swal2-bottom-right{right:0;bottom:0}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-shown{background-color:transparent}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}body.swal2-toast-column .swal2-toast{flex-direction:column;align-items:stretch}body.swal2-toast-column .swal2-toast .swal2-actions{flex:1;align-self:stretch;height:2.2em;margin-top:.3125em}body.swal2-toast-column .swal2-toast .swal2-loading{justify-content:center}body.swal2-toast-column .swal2-toast .swal2-input{height:2em;margin:.3125em auto;font-size:1em}body.swal2-toast-column .swal2-toast .swal2-validation-message{font-size:1em}"); - -/***/ }), - -/***/ "./node_modules/tiny-warning/dist/tiny-warning.esm.js": -/*!************************************************************!*\ - !*** ./node_modules/tiny-warning/dist/tiny-warning.esm.js ***! - \************************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -var isProduction = "development" === 'production'; -function warning(condition, message) { - if (!isProduction) { - if (condition) { - return; - } - - var text = "Warning: " + message; - - if (typeof console !== 'undefined') { - console.warn(text); - } - - try { - throw Error(text); - } catch (x) {} - } -} - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (warning); - - -/***/ }), - -/***/ "./node_modules/value-equal/esm/value-equal.js": -/*!*****************************************************!*\ - !*** ./node_modules/value-equal/esm/value-equal.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) -/* harmony export */ }); -function valueOf(obj) { - return obj.valueOf ? obj.valueOf() : Object.prototype.valueOf.call(obj); -} - -function valueEqual(a, b) { - // Test for strict equality first. - if (a === b) return true; - - // Otherwise, if either of them == null they are not equal. - if (a == null || b == null) return false; - - if (Array.isArray(a)) { - return ( - Array.isArray(b) && - a.length === b.length && - a.every(function(item, index) { - return valueEqual(item, b[index]); - }) - ); - } - - if (typeof a === 'object' || typeof b === 'object') { - var aValue = valueOf(a); - var bValue = valueOf(b); - - if (aValue !== a || bValue !== b) return valueEqual(aValue, bValue); - - return Object.keys(Object.assign({}, a, b)).every(function(key) { - return valueEqual(a[key], b[key]); - }); - } - - return false; -} - -/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (valueEqual); - - -/***/ }), - -/***/ "./node_modules/void-elements/index.js": -/*!*********************************************!*\ - !*** ./node_modules/void-elements/index.js ***! - \*********************************************/ -/***/ ((module) => { - -/** - * This file automatically generated from `pre-publish.js`. - * Do not manually edit. - */ - -module.exports = { - "area": true, - "base": true, - "br": true, - "col": true, - "embed": true, - "hr": true, - "img": true, - "input": true, - "link": true, - "meta": true, - "param": true, - "source": true, - "track": true, - "wbr": true -}; - - -/***/ }), - -/***/ "react": -/*!************************!*\ - !*** external "React" ***! - \************************/ -/***/ ((module) => { - -"use strict"; -module.exports = window["React"]; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***! - \*****************************************************************/ -/***/ ((module) => { - -function _arrayLikeToArray(r, a) { - (null == a || a > r.length) && (a = r.length); - for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; - return n; -} -module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/arrayWithHoles.js ***! - \***************************************************************/ -/***/ ((module) => { - -function _arrayWithHoles(r) { - if (Array.isArray(r)) return r; -} -module.exports = _arrayWithHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js": -/*!******************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); -function _arrayWithoutHoles(r) { - if (Array.isArray(r)) return arrayLikeToArray(r); -} -module.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! - \**********************************************************************/ -/***/ ((module) => { - -function _assertThisInitialized(e) { - if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - return e; -} -module.exports = _assertThisInitialized, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js": -/*!*****************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/asyncToGenerator.js ***! - \*****************************************************************/ -/***/ ((module) => { - -function asyncGeneratorStep(n, t, e, r, o, a, c) { - try { - var i = n[a](c), - u = i.value; - } catch (n) { - return void e(n); - } - i.done ? t(u) : Promise.resolve(u).then(r, o); -} -function _asyncToGenerator(n) { - return function () { - var t = this, - e = arguments; - return new Promise(function (r, o) { - var a = n.apply(t, e); - function _next(n) { - asyncGeneratorStep(a, r, o, _next, _throw, "next", n); - } - function _throw(n) { - asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); - } - _next(void 0); - }); - }; -} -module.exports = _asyncToGenerator, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***! - \***************************************************************/ -/***/ ((module) => { - -function _classCallCheck(a, n) { - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); -} -module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/createClass.js": -/*!************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/createClass.js ***! - \************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/toPropertyKey.js"); -function _defineProperties(e, r) { - for (var t = 0; t < r.length; t++) { - var o = r[t]; - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o); - } -} -function _createClass(e, r, t) { - return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { - writable: !1 - }), e; -} -module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/defineProperty.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***! - \***************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/toPropertyKey.js"); -function _defineProperty(e, r, t) { - return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, { - value: t, - enumerable: !0, - configurable: !0, - writable: !0 - }) : e[r] = t, e; -} -module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/extends.js": -/*!********************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/extends.js ***! - \********************************************************/ -/***/ ((module) => { - -function _extends() { - return module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) { - for (var e = 1; e < arguments.length; e++) { - var t = arguments[e]; - for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); - } - return n; - }, module.exports.__esModule = true, module.exports["default"] = module.exports, _extends.apply(null, arguments); -} -module.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! - \***************************************************************/ -/***/ ((module) => { - -function _getPrototypeOf(t) { - return module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { - return t.__proto__ || Object.getPrototypeOf(t); - }, module.exports.__esModule = true, module.exports["default"] = module.exports, _getPrototypeOf(t); -} -module.exports = _getPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/inherits.js": -/*!*********************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/inherits.js ***! - \*********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js"); -function _inherits(t, e) { - if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); - t.prototype = Object.create(e && e.prototype, { - constructor: { - value: t, - writable: !0, - configurable: !0 - } - }), Object.defineProperty(t, "prototype", { - writable: !1 - }), e && setPrototypeOf(t, e); -} -module.exports = _inherits, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js": -/*!**********************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! - \**********************************************************************/ -/***/ ((module) => { - -function _interopRequireDefault(e) { - return e && e.__esModule ? e : { - "default": e - }; -} -module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/iterableToArray.js": -/*!****************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***! - \****************************************************************/ -/***/ ((module) => { - -function _iterableToArray(r) { - if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); -} -module.exports = _iterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js": -/*!*********************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js ***! - \*********************************************************************/ -/***/ ((module) => { - -function _iterableToArrayLimit(r, l) { - var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; - if (null != t) { - var e, - n, - i, - u, - a = [], - f = !0, - o = !1; - try { - if (i = (t = t.call(r)).next, 0 === l) { - if (Object(t) !== t) return; - f = !1; - } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); - } catch (r) { - o = !0, n = r; - } finally { - try { - if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; - } finally { - if (o) throw n; - } - } - return a; - } -} -module.exports = _iterableToArrayLimit, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/nonIterableRest.js": -/*!****************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/nonIterableRest.js ***! - \****************************************************************/ -/***/ ((module) => { - -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _nonIterableRest, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js": -/*!******************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***! - \******************************************************************/ -/***/ ((module) => { - -function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} -module.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": -/*!**************************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! - \**************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); -var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); -function _possibleConstructorReturn(t, e) { - if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; - if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); - return assertThisInitialized(t); -} -module.exports = _possibleConstructorReturn, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/regeneratorRuntime.js ***! - \*******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); -function _regeneratorRuntime() { - "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ - module.exports = _regeneratorRuntime = function _regeneratorRuntime() { - return e; - }, module.exports.__esModule = true, module.exports["default"] = module.exports; - var t, - e = {}, - r = Object.prototype, - n = r.hasOwnProperty, - o = Object.defineProperty || function (t, e, r) { - t[e] = r.value; - }, - i = "function" == typeof Symbol ? Symbol : {}, - a = i.iterator || "@@iterator", - c = i.asyncIterator || "@@asyncIterator", - u = i.toStringTag || "@@toStringTag"; - function define(t, e, r) { - return Object.defineProperty(t, e, { - value: r, - enumerable: !0, - configurable: !0, - writable: !0 - }), t[e]; - } - try { - define({}, ""); - } catch (t) { - define = function define(t, e, r) { - return t[e] = r; - }; - } - function wrap(t, e, r, n) { - var i = e && e.prototype instanceof Generator ? e : Generator, - a = Object.create(i.prototype), - c = new Context(n || []); - return o(a, "_invoke", { - value: makeInvokeMethod(t, r, c) - }), a; - } - function tryCatch(t, e, r) { - try { - return { - type: "normal", - arg: t.call(e, r) - }; - } catch (t) { - return { - type: "throw", - arg: t - }; - } - } - e.wrap = wrap; - var h = "suspendedStart", - l = "suspendedYield", - f = "executing", - s = "completed", - y = {}; - function Generator() {} - function GeneratorFunction() {} - function GeneratorFunctionPrototype() {} - var p = {}; - define(p, a, function () { - return this; - }); - var d = Object.getPrototypeOf, - v = d && d(d(values([]))); - v && v !== r && n.call(v, a) && (p = v); - var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); - function defineIteratorMethods(t) { - ["next", "throw", "return"].forEach(function (e) { - define(t, e, function (t) { - return this._invoke(e, t); - }); - }); - } - function AsyncIterator(t, e) { - function invoke(r, o, i, a) { - var c = tryCatch(t[r], t, o); - if ("throw" !== c.type) { - var u = c.arg, - h = u.value; - return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { - invoke("next", t, i, a); - }, function (t) { - invoke("throw", t, i, a); - }) : e.resolve(h).then(function (t) { - u.value = t, i(u); - }, function (t) { - return invoke("throw", t, i, a); - }); - } - a(c.arg); - } - var r; - o(this, "_invoke", { - value: function value(t, n) { - function callInvokeWithMethodAndArg() { - return new e(function (e, r) { - invoke(t, n, e, r); - }); - } - return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); - } - }); - } - function makeInvokeMethod(e, r, n) { - var o = h; - return function (i, a) { - if (o === f) throw Error("Generator is already running"); - if (o === s) { - if ("throw" === i) throw a; - return { - value: t, - done: !0 - }; - } - for (n.method = i, n.arg = a;;) { - var c = n.delegate; - if (c) { - var u = maybeInvokeDelegate(c, n); - if (u) { - if (u === y) continue; - return u; - } - } - if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { - if (o === h) throw o = s, n.arg; - n.dispatchException(n.arg); - } else "return" === n.method && n.abrupt("return", n.arg); - o = f; - var p = tryCatch(e, r, n); - if ("normal" === p.type) { - if (o = n.done ? s : l, p.arg === y) continue; - return { - value: p.arg, - done: n.done - }; - } - "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); - } - }; - } - function maybeInvokeDelegate(e, r) { - var n = r.method, - o = e.iterator[n]; - if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; - var i = tryCatch(o, e.iterator, r.arg); - if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; - var a = i.arg; - return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); - } - function pushTryEntry(t) { - var e = { - tryLoc: t[0] - }; - 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); - } - function resetTryEntry(t) { - var e = t.completion || {}; - e.type = "normal", delete e.arg, t.completion = e; - } - function Context(t) { - this.tryEntries = [{ - tryLoc: "root" - }], t.forEach(pushTryEntry, this), this.reset(!0); - } - function values(e) { - if (e || "" === e) { - var r = e[a]; - if (r) return r.call(e); - if ("function" == typeof e.next) return e; - if (!isNaN(e.length)) { - var o = -1, - i = function next() { - for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; - return next.value = t, next.done = !0, next; - }; - return i.next = i; - } - } - throw new TypeError(_typeof(e) + " is not iterable"); - } - return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { - value: GeneratorFunctionPrototype, - configurable: !0 - }), o(GeneratorFunctionPrototype, "constructor", { - value: GeneratorFunction, - configurable: !0 - }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { - var e = "function" == typeof t && t.constructor; - return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); - }, e.mark = function (t) { - return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; - }, e.awrap = function (t) { - return { - __await: t - }; - }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { - return this; - }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { - void 0 === i && (i = Promise); - var a = new AsyncIterator(wrap(t, r, n, o), i); - return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { - return t.done ? t.value : a.next(); - }); - }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { - return this; - }), define(g, "toString", function () { - return "[object Generator]"; - }), e.keys = function (t) { - var e = Object(t), - r = []; - for (var n in e) r.push(n); - return r.reverse(), function next() { - for (; r.length;) { - var t = r.pop(); - if (t in e) return next.value = t, next.done = !1, next; - } - return next.done = !0, next; - }; - }, e.values = values, Context.prototype = { - constructor: Context, - reset: function reset(e) { - if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); - }, - stop: function stop() { - this.done = !0; - var t = this.tryEntries[0].completion; - if ("throw" === t.type) throw t.arg; - return this.rval; - }, - dispatchException: function dispatchException(e) { - if (this.done) throw e; - var r = this; - function handle(n, o) { - return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; - } - for (var o = this.tryEntries.length - 1; o >= 0; --o) { - var i = this.tryEntries[o], - a = i.completion; - if ("root" === i.tryLoc) return handle("end"); - if (i.tryLoc <= this.prev) { - var c = n.call(i, "catchLoc"), - u = n.call(i, "finallyLoc"); - if (c && u) { - if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); - if (this.prev < i.finallyLoc) return handle(i.finallyLoc); - } else if (c) { - if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); - } else { - if (!u) throw Error("try statement without catch or finally"); - if (this.prev < i.finallyLoc) return handle(i.finallyLoc); - } - } - } - }, - abrupt: function abrupt(t, e) { - for (var r = this.tryEntries.length - 1; r >= 0; --r) { - var o = this.tryEntries[r]; - if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { - var i = o; - break; - } - } - i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); - var a = i ? i.completion : {}; - return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); - }, - complete: function complete(t, e) { - if ("throw" === t.type) throw t.arg; - return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; - }, - finish: function finish(t) { - for (var e = this.tryEntries.length - 1; e >= 0; --e) { - var r = this.tryEntries[e]; - if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; - } - }, - "catch": function _catch(t) { - for (var e = this.tryEntries.length - 1; e >= 0; --e) { - var r = this.tryEntries[e]; - if (r.tryLoc === t) { - var n = r.completion; - if ("throw" === n.type) { - var o = n.arg; - resetTryEntry(r); - } - return o; - } - } - throw Error("illegal catch attempt"); - }, - delegateYield: function delegateYield(e, r, n) { - return this.delegate = { - iterator: values(e), - resultName: r, - nextLoc: n - }, "next" === this.method && (this.arg = t), y; - } - }, e; -} -module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js": -/*!***************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! - \***************************************************************/ -/***/ ((module) => { - -function _setPrototypeOf(t, e) { - return module.exports = _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { - return t.__proto__ = e, t; - }, module.exports.__esModule = true, module.exports["default"] = module.exports, _setPrototypeOf(t, e); -} -module.exports = _setPrototypeOf, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/slicedToArray.js": -/*!**************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/slicedToArray.js ***! - \**************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithHoles.js"); -var iterableToArrayLimit = __webpack_require__(/*! ./iterableToArrayLimit.js */ "./node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"); -var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); -var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "./node_modules/@babel/runtime/helpers/nonIterableRest.js"); -function _slicedToArray(r, e) { - return arrayWithHoles(r) || iterableToArrayLimit(r, e) || unsupportedIterableToArray(r, e) || nonIterableRest(); -} -module.exports = _slicedToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/toConsumableArray.js": -/*!******************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***! - \******************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ "./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js"); -var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "./node_modules/@babel/runtime/helpers/iterableToArray.js"); -var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js"); -var nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ "./node_modules/@babel/runtime/helpers/nonIterableSpread.js"); -function _toConsumableArray(r) { - return arrayWithoutHoles(r) || iterableToArray(r) || unsupportedIterableToArray(r) || nonIterableSpread(); -} -module.exports = _toConsumableArray, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/toPrimitive.js": -/*!************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***! - \************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); -function toPrimitive(t, r) { - if ("object" != _typeof(t) || !t) return t; - var e = t[Symbol.toPrimitive]; - if (void 0 !== e) { - var i = e.call(t, r || "default"); - if ("object" != _typeof(i)) return i; - throw new TypeError("@@toPrimitive must return a primitive value."); - } - return ("string" === r ? String : Number)(t); -} -module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/toPropertyKey.js": -/*!**************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***! - \**************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var _typeof = (__webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/typeof.js")["default"]); -var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/toPrimitive.js"); -function toPropertyKey(t) { - var i = toPrimitive(t, "string"); - return "symbol" == _typeof(i) ? i : i + ""; -} -module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/typeof.js": -/*!*******************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! - \*******************************************************/ -/***/ ((module) => { - -function _typeof(o) { - "@babel/helpers - typeof"; - - return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { - return typeof o; - } : function (o) { - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; - }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o); -} -module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js": -/*!***************************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***! - \***************************************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "./node_modules/@babel/runtime/helpers/arrayLikeToArray.js"); -function _unsupportedIterableToArray(r, a) { - if (r) { - if ("string" == typeof r) return arrayLikeToArray(r, a); - var t = {}.toString.call(r).slice(8, -1); - return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? arrayLikeToArray(r, a) : void 0; - } -} -module.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports["default"] = module.exports; - -/***/ }), - -/***/ "./node_modules/@babel/runtime/regenerator/index.js": -/*!**********************************************************!*\ - !*** ./node_modules/@babel/runtime/regenerator/index.js ***! - \**********************************************************/ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -// TODO(Babel 8): Remove this file. - -var runtime = __webpack_require__(/*! ../helpers/regeneratorRuntime */ "./node_modules/@babel/runtime/helpers/regeneratorRuntime.js")(); -module.exports = runtime; - -// Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736= -try { - regeneratorRuntime = runtime; -} catch (accidentalStrictMode) { - if (typeof globalThis === "object") { - globalThis.regeneratorRuntime = runtime; - } else { - Function("r", "regeneratorRuntime = r")(runtime); - } -} - - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": -/*!************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! - \************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ _extends) -/* harmony export */ }); -function _extends() { - return _extends = Object.assign ? Object.assign.bind() : function (n) { - for (var e = 1; e < arguments.length; e++) { - var t = arguments[e]; - for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); - } - return n; - }, _extends.apply(null, arguments); -} - - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js": -/*!******************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js ***! - \******************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ _inheritsLoose) -/* harmony export */ }); -/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js"); - -function _inheritsLoose(t, o) { - t.prototype = Object.create(o.prototype), t.prototype.constructor = t, (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(t, o); -} - - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": -/*!*********************************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! - \*********************************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ _objectWithoutPropertiesLoose) -/* harmony export */ }); -function _objectWithoutPropertiesLoose(r, e) { - if (null == r) return {}; - var t = {}; - for (var n in r) if ({}.hasOwnProperty.call(r, n)) { - if (-1 !== e.indexOf(n)) continue; - t[n] = r[n]; - } - return t; -} - - -/***/ }), - -/***/ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js": -/*!*******************************************************************!*\ - !*** ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ _setPrototypeOf) -/* harmony export */ }); -function _setPrototypeOf(t, e) { - return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { - return t.__proto__ = e, t; - }, _setPrototypeOf(t, e); -} - - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/I18nextProvider.js": -/*!***************************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/I18nextProvider.js ***! - \***************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ I18nextProvider: () => (/* binding */ I18nextProvider) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); - - -function I18nextProvider({ - i18n, - defaultNS, - children -}) { - const value = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({ - i18n, - defaultNS - }), [i18n, defaultNS]); - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_context_js__WEBPACK_IMPORTED_MODULE_1__.I18nContext.Provider, { - value - }, children); -} - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/Trans.js": -/*!*****************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/Trans.js ***! - \*****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Trans: () => (/* binding */ Trans), -/* harmony export */ nodesToString: () => (/* reexport safe */ _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__.nodesToString) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransWithoutContext.js */ "./node_modules/react-i18next/dist/es/TransWithoutContext.js"); -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); - - - - -function Trans({ - children, - count, - parent, - i18nKey, - context, - tOptions = {}, - values, - defaults, - components, - ns, - i18n: i18nFromProps, - t: tFromProps, - shouldUnescape, - ...additionalProps -}) { - const { - i18n: i18nFromContext, - defaultNS: defaultNSFromContext - } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_js__WEBPACK_IMPORTED_MODULE_2__.I18nContext) || {}; - const i18n = i18nFromProps || i18nFromContext || (0,_context_js__WEBPACK_IMPORTED_MODULE_2__.getI18n)(); - const t = tFromProps || i18n?.t.bind(i18n); - return (0,_TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__.Trans)({ - children, - count, - parent, - i18nKey, - context, - tOptions, - values, - defaults, - components, - ns: ns || t?.ns || defaultNSFromContext || i18n?.options?.defaultNS, - i18n, - t: tFromProps, - shouldUnescape, - ...additionalProps - }); -} - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/TransWithoutContext.js": -/*!*******************************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/TransWithoutContext.js ***! - \*******************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Trans: () => (/* binding */ Trans), -/* harmony export */ nodesToString: () => (/* binding */ nodesToString) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var html_parse_stringify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! html-parse-stringify */ "./node_modules/html-parse-stringify/dist/html-parse-stringify.module.js"); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); -/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); -/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); - - - - - -const hasChildren = (node, checkLength) => { - if (!node) return false; - const base = node.props?.children ?? node.children; - if (checkLength) return base.length > 0; - return !!base; -}; -const getChildren = node => { - if (!node) return []; - const children = node.props?.children ?? node.children; - return node.props?.i18nIsDynamicList ? getAsArray(children) : children; -}; -const hasValidReactChildren = children => Array.isArray(children) && children.every(react__WEBPACK_IMPORTED_MODULE_0__.isValidElement); -const getAsArray = data => Array.isArray(data) ? data : [data]; -const mergeProps = (source, target) => { - const newTarget = { - ...target - }; - newTarget.props = Object.assign(source.props, target.props); - return newTarget; -}; -const nodesToString = (children, i18nOptions, i18n, i18nKey) => { - if (!children) return ''; - let stringNode = ''; - const childrenArray = getAsArray(children); - const keepArray = i18nOptions?.transSupportBasicHtmlNodes ? i18nOptions.transKeepBasicHtmlNodesFor ?? [] : []; - childrenArray.forEach((child, childIndex) => { - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(child)) { - stringNode += `${child}`; - return; - } - if ((0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(child)) { - const { - props, - type - } = child; - const childPropsCount = Object.keys(props).length; - const shouldKeepChild = keepArray.indexOf(type) > -1; - const childChildren = props.children; - if (!childChildren && shouldKeepChild && !childPropsCount) { - stringNode += `<${type}/>`; - return; - } - if (!childChildren && (!shouldKeepChild || childPropsCount) || props.i18nIsDynamicList) { - stringNode += `<${childIndex}>`; - return; - } - if (shouldKeepChild && childPropsCount === 1 && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(childChildren)) { - stringNode += `<${type}>${childChildren}`; - return; - } - const content = nodesToString(childChildren, i18nOptions, i18n, i18nKey); - stringNode += `<${childIndex}>${content}`; - return; - } - if (child === null) { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warn)(i18n, 'TRANS_NULL_VALUE', `Passed in a null value as child`, { - i18nKey - }); - return; - } - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child)) { - const { - format, - ...clone - } = child; - const keys = Object.keys(clone); - if (keys.length === 1) { - const value = format ? `${keys[0]}, ${format}` : keys[0]; - stringNode += `{{${value}}}`; - return; - } - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warn)(i18n, 'TRANS_INVALID_OBJ', `Invalid child - Object should only have keys {{ value, format }} (format is optional).`, { - i18nKey, - child - }); - return; - } - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warn)(i18n, 'TRANS_INVALID_VAR', `Passed in a variable like {number} - pass variables for interpolation as full objects like {{number}}.`, { - i18nKey, - child - }); - }); - return stringNode; -}; -const renderNodes = (children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) => { - if (targetString === '') return []; - const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || []; - const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.map(keep => `<${keep}`).join('|')).test(targetString); - if (!children && !emptyChildrenButNeedsHandling && !shouldUnescape) return [targetString]; - const data = {}; - const getData = childs => { - const childrenArray = getAsArray(childs); - childrenArray.forEach(child => { - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(child)) return; - if (hasChildren(child)) getData(getChildren(child));else if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child) && !(0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(child)) Object.assign(data, child); - }); - }; - getData(children); - const ast = html_parse_stringify__WEBPACK_IMPORTED_MODULE_1__["default"].parse(`<0>${targetString}`); - const opts = { - ...data, - ...combinedTOpts - }; - const renderInner = (child, node, rootReactNode) => { - const childs = getChildren(child); - const mappedChildren = mapAST(childs, node.children, rootReactNode); - return hasValidReactChildren(childs) && mappedChildren.length === 0 || child.props?.i18nIsDynamicList ? childs : mappedChildren; - }; - const pushTranslatedJSX = (child, inner, mem, i, isVoid) => { - if (child.dummy) { - child.children = inner; - mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(child, { - key: i - }, isVoid ? undefined : inner)); - } else { - mem.push(...react__WEBPACK_IMPORTED_MODULE_0__.Children.map([child], c => { - const props = { - ...c.props - }; - delete props.i18nIsDynamicList; - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(c.type, { - ...props, - key: i, - ref: c.ref - }, isVoid ? null : inner); - })); - } - }; - const mapAST = (reactNode, astNode, rootReactNode) => { - const reactNodes = getAsArray(reactNode); - const astNodes = getAsArray(astNode); - return astNodes.reduce((mem, node, i) => { - const translationContent = node.children?.[0]?.content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language); - if (node.type === 'tag') { - let tmp = reactNodes[parseInt(node.name, 10)]; - if (rootReactNode.length === 1 && !tmp) tmp = rootReactNode[0][node.name]; - if (!tmp) tmp = {}; - const child = Object.keys(node.attrs).length !== 0 ? mergeProps({ - props: node.attrs - }, tmp) : tmp; - const isElement = (0,react__WEBPACK_IMPORTED_MODULE_0__.isValidElement)(child); - const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement; - const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child) && child.dummy && !isElement; - const isKnownComponent = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(children) && Object.hasOwnProperty.call(children, node.name); - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(child)) { - const value = i18n.services.interpolator.interpolate(child, opts, i18n.language); - mem.push(value); - } else if (hasChildren(child) || isValidTranslationWithChildren) { - const inner = renderInner(child, node, rootReactNode); - pushTranslatedJSX(child, inner, mem, i); - } else if (isEmptyTransWithHTML) { - const inner = mapAST(reactNodes, node.children, rootReactNode); - pushTranslatedJSX(child, inner, mem, i); - } else if (Number.isNaN(parseFloat(node.name))) { - if (isKnownComponent) { - const inner = renderInner(child, node, rootReactNode); - pushTranslatedJSX(child, inner, mem, i, node.voidElement); - } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) { - if (node.voidElement) { - mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(node.name, { - key: `${node.name}-${i}` - })); - } else { - const inner = mapAST(reactNodes, node.children, rootReactNode); - mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(node.name, { - key: `${node.name}-${i}` - }, inner)); - } - } else if (node.voidElement) { - mem.push(`<${node.name} />`); - } else { - const inner = mapAST(reactNodes, node.children, rootReactNode); - mem.push(`<${node.name}>${inner}`); - } - } else if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(child) && !isElement) { - const content = node.children[0] ? translationContent : null; - if (content) mem.push(content); - } else { - pushTranslatedJSX(child, translationContent, mem, i, node.children.length !== 1 || !translationContent); - } - } else if (node.type === 'text') { - const wrapTextNodes = i18nOptions.transWrapTextNodes; - const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language); - if (wrapTextNodes) { - mem.push((0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(wrapTextNodes, { - key: `${node.name}-${i}` - }, content)); - } else { - mem.push(content); - } - } - return mem; - }, []); - }; - const result = mapAST([{ - dummy: true, - children: children || [] - }], ast, getAsArray(children || [])); - return getChildren(result[0]); -}; -const fixComponentProps = (component, index, translation) => { - const componentKey = component.key || index; - const comp = (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(component, { - key: componentKey - }); - if (!comp.props || !comp.props.children || translation.indexOf(`${index}/>`) < 0 && translation.indexOf(`${index} />`) < 0) { - return comp; - } - function Componentized() { - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, comp); - } - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Componentized, { - key: componentKey - }); -}; -const generateArrayComponents = (components, translation) => components.map((c, index) => fixComponentProps(c, index, translation)); -const generateObjectComponents = (components, translation) => { - const componentMap = {}; - Object.keys(components).forEach(c => { - Object.assign(componentMap, { - [c]: fixComponentProps(components[c], c, translation) - }); - }); - return componentMap; -}; -const generateComponents = (components, translation, i18n, i18nKey) => { - if (!components) return null; - if (Array.isArray(components)) { - return generateArrayComponents(components, translation); - } - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(components)) { - return generateObjectComponents(components, translation); - } - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'TRANS_INVALID_COMPONENTS', ` "components" prop expects an object or array`, { - i18nKey - }); - return null; -}; -function Trans({ - children, - count, - parent, - i18nKey, - context, - tOptions = {}, - values, - defaults, - components, - ns, - i18n: i18nFromProps, - t: tFromProps, - shouldUnescape, - ...additionalProps -}) { - const i18n = i18nFromProps || (0,_i18nInstance_js__WEBPACK_IMPORTED_MODULE_4__.getI18n)(); - if (!i18n) { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'NO_I18NEXT_INSTANCE', `Trans: You need to pass in an i18next instance using i18nextReactModule`, { - i18nKey - }); - return children; - } - const t = tFromProps || i18n.t.bind(i18n) || (k => k); - const reactI18nextOptions = { - ...(0,_defaults_js__WEBPACK_IMPORTED_MODULE_3__.getDefaults)(), - ...i18n.options?.react - }; - let namespaces = ns || t.ns || i18n.options?.defaultNS; - namespaces = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(namespaces) ? [namespaces] : namespaces || ['translation']; - const nodeAsString = nodesToString(children, reactI18nextOptions, i18n, i18nKey); - const defaultValue = defaults || nodeAsString || reactI18nextOptions.transEmptyNodeValue || i18nKey; - const { - hashTransKey - } = reactI18nextOptions; - const key = i18nKey || (hashTransKey ? hashTransKey(nodeAsString || defaultValue) : nodeAsString || defaultValue); - if (i18n.options?.interpolation?.defaultVariables) { - values = values && Object.keys(values).length > 0 ? { - ...values, - ...i18n.options.interpolation.defaultVariables - } : { - ...i18n.options.interpolation.defaultVariables - }; - } - const interpolationOverride = values || count !== undefined && !i18n.options?.interpolation?.alwaysFormat || !children ? tOptions.interpolation : { - interpolation: { - ...tOptions.interpolation, - prefix: '#$?', - suffix: '?$#' - } - }; - const combinedTOpts = { - ...tOptions, - context: context || tOptions.context, - count, - ...values, - ...interpolationOverride, - defaultValue, - ns: namespaces - }; - const translation = key ? t(key, combinedTOpts) : defaultValue; - const generatedComponents = generateComponents(components, translation, i18n, i18nKey); - const content = renderNodes(generatedComponents || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape); - const useAsParent = parent ?? reactI18nextOptions.defaultTransParent; - return useAsParent ? (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(useAsParent, additionalProps, content) : content; -} - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/Translation.js": -/*!***********************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/Translation.js ***! - \***********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ Translation: () => (/* binding */ Translation) -/* harmony export */ }); -/* harmony import */ var _useTranslation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./useTranslation.js */ "./node_modules/react-i18next/dist/es/useTranslation.js"); - -const Translation = ({ - ns, - children, - ...options -}) => { - const [t, i18n, ready] = (0,_useTranslation_js__WEBPACK_IMPORTED_MODULE_0__.useTranslation)(ns, options); - return children(t, { - i18n, - lng: i18n.language - }, ready); -}; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/context.js": -/*!*******************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/context.js ***! - \*******************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ I18nContext: () => (/* binding */ I18nContext), -/* harmony export */ ReportNamespaces: () => (/* binding */ ReportNamespaces), -/* harmony export */ composeInitialProps: () => (/* binding */ composeInitialProps), -/* harmony export */ getDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_1__.getDefaults), -/* harmony export */ getI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__.getI18n), -/* harmony export */ getInitialProps: () => (/* binding */ getInitialProps), -/* harmony export */ initReactI18next: () => (/* reexport safe */ _initReactI18next_js__WEBPACK_IMPORTED_MODULE_3__.initReactI18next), -/* harmony export */ setDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_1__.setDefaults), -/* harmony export */ setI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__.setI18n) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); -/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); -/* harmony import */ var _initReactI18next_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./initReactI18next.js */ "./node_modules/react-i18next/dist/es/initReactI18next.js"); - - - - - -const I18nContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(); -class ReportNamespaces { - constructor() { - this.usedNamespaces = {}; - } - addUsedNamespaces(namespaces) { - namespaces.forEach(ns => { - if (!this.usedNamespaces[ns]) this.usedNamespaces[ns] = true; - }); - } - getUsedNamespaces() { - return Object.keys(this.usedNamespaces); - } -} -const composeInitialProps = ForComponent => async ctx => { - const componentsInitialProps = (await ForComponent.getInitialProps?.(ctx)) ?? {}; - const i18nInitialProps = getInitialProps(); - return { - ...componentsInitialProps, - ...i18nInitialProps - }; -}; -const getInitialProps = () => { - const i18n = (0,_i18nInstance_js__WEBPACK_IMPORTED_MODULE_2__.getI18n)(); - const namespaces = i18n.reportNamespaces?.getUsedNamespaces() ?? []; - const ret = {}; - const initialI18nStore = {}; - i18n.languages.forEach(l => { - initialI18nStore[l] = {}; - namespaces.forEach(ns => { - initialI18nStore[l][ns] = i18n.getResourceBundle(l, ns) || {}; - }); - }); - ret.initialI18nStore = initialI18nStore; - ret.initialLanguage = i18n.language; - return ret; -}; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/defaults.js": -/*!********************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/defaults.js ***! - \********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ getDefaults: () => (/* binding */ getDefaults), -/* harmony export */ setDefaults: () => (/* binding */ setDefaults) -/* harmony export */ }); -/* harmony import */ var _unescape_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./unescape.js */ "./node_modules/react-i18next/dist/es/unescape.js"); - -let defaultOptions = { - bindI18n: 'languageChanged', - bindI18nStore: '', - transEmptyNodeValue: '', - transSupportBasicHtmlNodes: true, - transWrapTextNodes: '', - transKeepBasicHtmlNodesFor: ['br', 'strong', 'i', 'p'], - useSuspense: true, - unescape: _unescape_js__WEBPACK_IMPORTED_MODULE_0__.unescape -}; -const setDefaults = (options = {}) => { - defaultOptions = { - ...defaultOptions, - ...options - }; -}; -const getDefaults = () => defaultOptions; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/i18nInstance.js": -/*!************************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/i18nInstance.js ***! - \************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ getI18n: () => (/* binding */ getI18n), -/* harmony export */ setI18n: () => (/* binding */ setI18n) -/* harmony export */ }); -let i18nInstance; -const setI18n = instance => { - i18nInstance = instance; -}; -const getI18n = () => i18nInstance; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/index.js": -/*!*****************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/index.js ***! - \*****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ I18nContext: () => (/* reexport safe */ _context_js__WEBPACK_IMPORTED_MODULE_11__.I18nContext), -/* harmony export */ I18nextProvider: () => (/* reexport safe */ _I18nextProvider_js__WEBPACK_IMPORTED_MODULE_5__.I18nextProvider), -/* harmony export */ Trans: () => (/* reexport safe */ _Trans_js__WEBPACK_IMPORTED_MODULE_0__.Trans), -/* harmony export */ TransWithoutContext: () => (/* reexport safe */ _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__.Trans), -/* harmony export */ Translation: () => (/* reexport safe */ _Translation_js__WEBPACK_IMPORTED_MODULE_4__.Translation), -/* harmony export */ composeInitialProps: () => (/* reexport safe */ _context_js__WEBPACK_IMPORTED_MODULE_11__.composeInitialProps), -/* harmony export */ date: () => (/* binding */ date), -/* harmony export */ getDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_9__.getDefaults), -/* harmony export */ getI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_10__.getI18n), -/* harmony export */ getInitialProps: () => (/* reexport safe */ _context_js__WEBPACK_IMPORTED_MODULE_11__.getInitialProps), -/* harmony export */ initReactI18next: () => (/* reexport safe */ _initReactI18next_js__WEBPACK_IMPORTED_MODULE_8__.initReactI18next), -/* harmony export */ number: () => (/* binding */ number), -/* harmony export */ plural: () => (/* binding */ plural), -/* harmony export */ select: () => (/* binding */ select), -/* harmony export */ selectOrdinal: () => (/* binding */ selectOrdinal), -/* harmony export */ setDefaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_9__.setDefaults), -/* harmony export */ setI18n: () => (/* reexport safe */ _i18nInstance_js__WEBPACK_IMPORTED_MODULE_10__.setI18n), -/* harmony export */ time: () => (/* binding */ time), -/* harmony export */ useSSR: () => (/* reexport safe */ _useSSR_js__WEBPACK_IMPORTED_MODULE_7__.useSSR), -/* harmony export */ useTranslation: () => (/* reexport safe */ _useTranslation_js__WEBPACK_IMPORTED_MODULE_2__.useTranslation), -/* harmony export */ withSSR: () => (/* reexport safe */ _withSSR_js__WEBPACK_IMPORTED_MODULE_6__.withSSR), -/* harmony export */ withTranslation: () => (/* reexport safe */ _withTranslation_js__WEBPACK_IMPORTED_MODULE_3__.withTranslation) -/* harmony export */ }); -/* harmony import */ var _Trans_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Trans.js */ "./node_modules/react-i18next/dist/es/Trans.js"); -/* harmony import */ var _TransWithoutContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./TransWithoutContext.js */ "./node_modules/react-i18next/dist/es/TransWithoutContext.js"); -/* harmony import */ var _useTranslation_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./useTranslation.js */ "./node_modules/react-i18next/dist/es/useTranslation.js"); -/* harmony import */ var _withTranslation_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./withTranslation.js */ "./node_modules/react-i18next/dist/es/withTranslation.js"); -/* harmony import */ var _Translation_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Translation.js */ "./node_modules/react-i18next/dist/es/Translation.js"); -/* harmony import */ var _I18nextProvider_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./I18nextProvider.js */ "./node_modules/react-i18next/dist/es/I18nextProvider.js"); -/* harmony import */ var _withSSR_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./withSSR.js */ "./node_modules/react-i18next/dist/es/withSSR.js"); -/* harmony import */ var _useSSR_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./useSSR.js */ "./node_modules/react-i18next/dist/es/useSSR.js"); -/* harmony import */ var _initReactI18next_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./initReactI18next.js */ "./node_modules/react-i18next/dist/es/initReactI18next.js"); -/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); -/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); - - - - - - - - - - - - -const date = () => ''; -const time = () => ''; -const number = () => ''; -const select = () => ''; -const plural = () => ''; -const selectOrdinal = () => ''; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/initReactI18next.js": -/*!****************************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/initReactI18next.js ***! - \****************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ initReactI18next: () => (/* binding */ initReactI18next) -/* harmony export */ }); -/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/react-i18next/dist/es/defaults.js"); -/* harmony import */ var _i18nInstance_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./i18nInstance.js */ "./node_modules/react-i18next/dist/es/i18nInstance.js"); - - -const initReactI18next = { - type: '3rdParty', - init(instance) { - (0,_defaults_js__WEBPACK_IMPORTED_MODULE_0__.setDefaults)(instance.options.react); - (0,_i18nInstance_js__WEBPACK_IMPORTED_MODULE_1__.setI18n)(instance); - } -}; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/unescape.js": -/*!********************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/unescape.js ***! - \********************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ unescape: () => (/* binding */ unescape) -/* harmony export */ }); -const matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g; -const htmlEntities = { - '&': '&', - '&': '&', - '<': '<', - '<': '<', - '>': '>', - '>': '>', - ''': "'", - ''': "'", - '"': '"', - '"': '"', - ' ': ' ', - ' ': ' ', - '©': '©', - '©': '©', - '®': '®', - '®': '®', - '…': '…', - '…': '…', - '/': '/', - '/': '/' -}; -const unescapeHtmlEntity = m => htmlEntities[m]; -const unescape = text => text.replace(matchHtmlEntity, unescapeHtmlEntity); - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/useSSR.js": -/*!******************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/useSSR.js ***! - \******************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ useSSR: () => (/* binding */ useSSR) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); - - -const useSSR = (initialI18nStore, initialLanguage, props = {}) => { - const { - i18n: i18nFromProps - } = props; - const { - i18n: i18nFromContext - } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_js__WEBPACK_IMPORTED_MODULE_1__.I18nContext) || {}; - const i18n = i18nFromProps || i18nFromContext || (0,_context_js__WEBPACK_IMPORTED_MODULE_1__.getI18n)(); - if (i18n.options?.isClone) return; - if (initialI18nStore && !i18n.initializedStoreOnce) { - i18n.services.resourceStore.data = initialI18nStore; - i18n.options.ns = Object.values(initialI18nStore).reduce((mem, lngResources) => { - Object.keys(lngResources).forEach(ns => { - if (mem.indexOf(ns) < 0) mem.push(ns); - }); - return mem; - }, i18n.options.ns); - i18n.initializedStoreOnce = true; - i18n.isInitialized = true; - } - if (initialLanguage && !i18n.initializedLanguageOnce) { - i18n.changeLanguage(initialLanguage); - i18n.initializedLanguageOnce = true; - } -}; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/useTranslation.js": -/*!**************************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/useTranslation.js ***! - \**************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ useTranslation: () => (/* binding */ useTranslation) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); - - - -const usePrevious = (value, ignore) => { - const ref = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - ref.current = ignore ? ref.current : value; - }, [value, ignore]); - return ref.current; -}; -const alwaysNewT = (i18n, language, namespace, keyPrefix) => i18n.getFixedT(language, namespace, keyPrefix); -const useMemoizedT = (i18n, language, namespace, keyPrefix) => (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]); -const useTranslation = (ns, props = {}) => { - const { - i18n: i18nFromProps - } = props; - const { - i18n: i18nFromContext, - defaultNS: defaultNSFromContext - } = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_js__WEBPACK_IMPORTED_MODULE_1__.I18nContext) || {}; - const i18n = i18nFromProps || i18nFromContext || (0,_context_js__WEBPACK_IMPORTED_MODULE_1__.getI18n)(); - if (i18n && !i18n.reportNamespaces) i18n.reportNamespaces = new _context_js__WEBPACK_IMPORTED_MODULE_1__.ReportNamespaces(); - if (!i18n) { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'NO_I18NEXT_INSTANCE', 'useTranslation: You will need to pass in an i18next instance by using initReactI18next'); - const notReadyT = (k, optsOrDefaultValue) => { - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(optsOrDefaultValue)) return optsOrDefaultValue; - if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isObject)(optsOrDefaultValue) && (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(optsOrDefaultValue.defaultValue)) return optsOrDefaultValue.defaultValue; - return Array.isArray(k) ? k[k.length - 1] : k; - }; - const retNotReady = [notReadyT, {}, false]; - retNotReady.t = notReadyT; - retNotReady.i18n = {}; - retNotReady.ready = false; - return retNotReady; - } - if (i18n.options.react?.wait) (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.warnOnce)(i18n, 'DEPRECATED_OPTION', 'useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.'); - const i18nOptions = { - ...(0,_context_js__WEBPACK_IMPORTED_MODULE_1__.getDefaults)(), - ...i18n.options.react, - ...props - }; - const { - useSuspense, - keyPrefix - } = i18nOptions; - let namespaces = ns || defaultNSFromContext || i18n.options?.defaultNS; - namespaces = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isString)(namespaces) ? [namespaces] : namespaces || ['translation']; - i18n.reportNamespaces.addUsedNamespaces?.(namespaces); - const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(n => (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.hasLoadedNamespace)(n, i18n, i18nOptions)); - const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); - const getT = () => memoGetT; - const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === 'fallback' ? namespaces : namespaces[0], keyPrefix); - const [t, setT] = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(getT); - let joinedNS = namespaces.join(); - if (props.lng) joinedNS = `${props.lng}${joinedNS}`; - const previousJoinedNS = usePrevious(joinedNS); - const isMounted = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(true); - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - const { - bindI18n, - bindI18nStore - } = i18nOptions; - isMounted.current = true; - if (!ready && !useSuspense) { - if (props.lng) { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadLanguages)(i18n, props.lng, namespaces, () => { - if (isMounted.current) setT(getNewT); - }); - } else { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadNamespaces)(i18n, namespaces, () => { - if (isMounted.current) setT(getNewT); - }); - } - } - if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) { - setT(getNewT); - } - const boundReset = () => { - if (isMounted.current) setT(getNewT); - }; - if (bindI18n) i18n?.on(bindI18n, boundReset); - if (bindI18nStore) i18n?.store.on(bindI18nStore, boundReset); - return () => { - isMounted.current = false; - if (i18n) bindI18n?.split(' ').forEach(e => i18n.off(e, boundReset)); - if (bindI18nStore && i18n) bindI18nStore.split(' ').forEach(e => i18n.store.off(e, boundReset)); - }; - }, [i18n, joinedNS]); - (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { - if (isMounted.current && ready) { - setT(getT); - } - }, [i18n, keyPrefix, ready]); - const ret = [t, i18n, ready]; - ret.t = t; - ret.i18n = i18n; - ret.ready = ready; - if (ready) return ret; - if (!ready && !useSuspense) return ret; - throw new Promise(resolve => { - if (props.lng) { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadLanguages)(i18n, props.lng, namespaces, () => resolve()); - } else { - (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.loadNamespaces)(i18n, namespaces, () => resolve()); - } - }); -}; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/utils.js": -/*!*****************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/utils.js ***! - \*****************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ getDisplayName: () => (/* binding */ getDisplayName), -/* harmony export */ hasLoadedNamespace: () => (/* binding */ hasLoadedNamespace), -/* harmony export */ isObject: () => (/* binding */ isObject), -/* harmony export */ isString: () => (/* binding */ isString), -/* harmony export */ loadLanguages: () => (/* binding */ loadLanguages), -/* harmony export */ loadNamespaces: () => (/* binding */ loadNamespaces), -/* harmony export */ warn: () => (/* binding */ warn), -/* harmony export */ warnOnce: () => (/* binding */ warnOnce) -/* harmony export */ }); -const warn = (i18n, code, msg, rest) => { - const args = [msg, { - code, - ...(rest || {}) - }]; - if (i18n?.services?.logger?.forward) { - return i18n.services.logger.forward(args, 'warn', 'react-i18next::', true); - } - if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`; - if (i18n?.services?.logger?.warn) { - i18n.services.logger.warn(...args); - } else if (console?.warn) { - console.warn(...args); - } -}; -const alreadyWarned = {}; -const warnOnce = (i18n, code, msg, rest) => { - if (isString(msg) && alreadyWarned[msg]) return; - if (isString(msg)) alreadyWarned[msg] = new Date(); - warn(i18n, code, msg, rest); -}; -const loadedClb = (i18n, cb) => () => { - if (i18n.isInitialized) { - cb(); - } else { - const initialized = () => { - setTimeout(() => { - i18n.off('initialized', initialized); - }, 0); - cb(); - }; - i18n.on('initialized', initialized); - } -}; -const loadNamespaces = (i18n, ns, cb) => { - i18n.loadNamespaces(ns, loadedClb(i18n, cb)); -}; -const loadLanguages = (i18n, lng, ns, cb) => { - if (isString(ns)) ns = [ns]; - if (i18n.options.preload && i18n.options.preload.indexOf(lng) > -1) return loadNamespaces(i18n, ns, cb); - ns.forEach(n => { - if (i18n.options.ns.indexOf(n) < 0) i18n.options.ns.push(n); - }); - i18n.loadLanguages(lng, loadedClb(i18n, cb)); -}; -const hasLoadedNamespace = (ns, i18n, options = {}) => { - if (!i18n.languages || !i18n.languages.length) { - warnOnce(i18n, 'NO_LANGUAGES', 'i18n.languages were undefined or empty', { - languages: i18n.languages - }); - return true; - } - return i18n.hasLoadedNamespace(ns, { - lng: options.lng, - precheck: (i18nInstance, loadNotPending) => { - if (options.bindI18n?.indexOf('languageChanging') > -1 && i18nInstance.services.backendConnector.backend && i18nInstance.isLanguageChangingTo && !loadNotPending(i18nInstance.isLanguageChangingTo, ns)) return false; - } - }); -}; -const getDisplayName = Component => Component.displayName || Component.name || (isString(Component) && Component.length > 0 ? Component : 'Unknown'); -const isString = obj => typeof obj === 'string'; -const isObject = obj => typeof obj === 'object' && obj !== null; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/withSSR.js": -/*!*******************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/withSSR.js ***! - \*******************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ withSSR: () => (/* binding */ withSSR) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _useSSR_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useSSR.js */ "./node_modules/react-i18next/dist/es/useSSR.js"); -/* harmony import */ var _context_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./context.js */ "./node_modules/react-i18next/dist/es/context.js"); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); - - - - -const withSSR = () => function Extend(WrappedComponent) { - function I18nextWithSSR({ - initialI18nStore, - initialLanguage, - ...rest - }) { - (0,_useSSR_js__WEBPACK_IMPORTED_MODULE_1__.useSSR)(initialI18nStore, initialLanguage); - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(WrappedComponent, { - ...rest - }); - } - I18nextWithSSR.getInitialProps = (0,_context_js__WEBPACK_IMPORTED_MODULE_2__.composeInitialProps)(WrappedComponent); - I18nextWithSSR.displayName = `withI18nextSSR(${(0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.getDisplayName)(WrappedComponent)})`; - I18nextWithSSR.WrappedComponent = WrappedComponent; - return I18nextWithSSR; -}; - -/***/ }), - -/***/ "./node_modules/react-i18next/dist/es/withTranslation.js": -/*!***************************************************************!*\ - !*** ./node_modules/react-i18next/dist/es/withTranslation.js ***! - \***************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ withTranslation: () => (/* binding */ withTranslation) -/* harmony export */ }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); -/* harmony import */ var _useTranslation_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useTranslation.js */ "./node_modules/react-i18next/dist/es/useTranslation.js"); -/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ "./node_modules/react-i18next/dist/es/utils.js"); - - - -const withTranslation = (ns, options = {}) => function Extend(WrappedComponent) { - function I18nextWithTranslation({ - forwardedRef, - ...rest - }) { - const [t, i18n, ready] = (0,_useTranslation_js__WEBPACK_IMPORTED_MODULE_1__.useTranslation)(ns, { - ...rest, - keyPrefix: options.keyPrefix - }); - const passDownProps = { - ...rest, - t, - i18n, - tReady: ready - }; - if (options.withRef && forwardedRef) { - passDownProps.ref = forwardedRef; - } else if (!options.withRef && forwardedRef) { - passDownProps.forwardedRef = forwardedRef; - } - return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(WrappedComponent, passDownProps); - } - I18nextWithTranslation.displayName = `withI18nextTranslation(${(0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.getDisplayName)(WrappedComponent)})`; - I18nextWithTranslation.WrappedComponent = WrappedComponent; - const forwardRef = (props, ref) => (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(I18nextWithTranslation, Object.assign({}, props, { - forwardedRef: ref - })); - return options.withRef ? (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(forwardRef) : I18nextWithTranslation; -}; - -/***/ }), - -/***/ "./node_modules/tiny-invariant/dist/esm/tiny-invariant.js": -/*!****************************************************************!*\ - !*** ./node_modules/tiny-invariant/dist/esm/tiny-invariant.js ***! - \****************************************************************/ -/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export */ __webpack_require__.d(__webpack_exports__, { -/* harmony export */ "default": () => (/* binding */ invariant) -/* harmony export */ }); -var isProduction = "development" === 'production'; -var prefix = 'Invariant failed'; -function invariant(condition, message) { - if (condition) { - return; - } - if (isProduction) { - throw new Error(prefix); - } - var provided = typeof message === 'function' ? message() : message; - var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix; - throw new Error(value); -} - - - - -/***/ }) - -/******/ }); -/************************************************************************/ -/******/ // The module cache -/******/ var __webpack_module_cache__ = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ // Check if module is in cache -/******/ var cachedModule = __webpack_module_cache__[moduleId]; -/******/ if (cachedModule !== undefined) { -/******/ return cachedModule.exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/define property getters */ -/******/ (() => { -/******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = (exports, definition) => { -/******/ for(var key in definition) { -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); -/******/ } -/******/ } -/******/ }; -/******/ })(); -/******/ -/******/ /* webpack/runtime/global */ -/******/ (() => { -/******/ __webpack_require__.g = (function() { -/******/ if (typeof globalThis === 'object') return globalThis; -/******/ try { -/******/ return this || new Function('return this')(); -/******/ } catch (e) { -/******/ if (typeof window === 'object') return window; -/******/ } -/******/ })(); -/******/ })(); -/******/ -/******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ (() => { -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) -/******/ })(); -/******/ -/******/ /* webpack/runtime/make namespace object */ -/******/ (() => { -/******/ // define __esModule on exports -/******/ __webpack_require__.r = (exports) => { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ })(); -/******/ -/************************************************************************/ -var __webpack_exports__ = {}; -// This entry need to be wrapped in an IIFE because it need to be in strict mode. -(() => { -"use strict"; -/*!*********************************************!*\ - !*** ./modules/biobank/jsx/biobankIndex.js ***! - \*********************************************/ - - -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); -var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js")); -var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js")); -var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/@babel/runtime/helpers/slicedToArray.js")); -var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js")); -var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js")); -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); -var _assertThisInitialized2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js")); -var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); -var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); -var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); -var _react = __webpack_require__(/*! react */ "react"); -var _reactRouterDom = __webpack_require__(/*! react-router-dom */ "./node_modules/react-router-dom/esm/react-router-dom.js"); -var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); -var _sweetalert = _interopRequireDefault(__webpack_require__(/*! sweetalert2 */ "./node_modules/sweetalert2/dist/sweetalert2.all.js")); -var _filter = _interopRequireDefault(__webpack_require__(/*! ./filter */ "./modules/biobank/jsx/filter.js")); -var _barcodePage = _interopRequireDefault(__webpack_require__(/*! ./barcodePage */ "./modules/biobank/jsx/barcodePage.js")); -var _helpers = __webpack_require__(/*! ./helpers.js */ "./modules/biobank/jsx/helpers.js"); -function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } -function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } -function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } -function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } -/** - * The main React entrypoint for the biobank module. This component - * renders the index page. - */ -var BiobankIndex = /*#__PURE__*/function (_Component) { - (0, _inherits2["default"])(BiobankIndex, _Component); - var _super = _createSuper(BiobankIndex); - /** - * Constructor - */ - function BiobankIndex() { - var _this; - (0, _classCallCheck2["default"])(this, BiobankIndex); - _this = _super.call(this); - _this.state = { - data: { - containers: {}, - pools: {}, - specimens: {} - }, - loading: 0, - options: { - candidatesSessions: {}, - candidates: {}, - centers: {}, - container: { - types: {}, - typesPrimary: {}, - typesNonPrimary: {}, - dimensions: {}, - stati: {} - }, - diagnoses: {}, - examiners: {}, - users: {}, - projects: {}, - sessions: {}, - specimen: { - types: {}, - typeUnits: {}, - typeContainerTypes: {}, - protocols: {}, - protocolAttributes: {}, - protocolContainers: {}, - processes: {}, - processAttributes: {}, - attributes: {}, - attributeDatatypes: {}, - attributesOptions: {}, - units: {} - }, - shipment: { - statuses: {}, - types: {} - } - } - }; - _this.printLabel = _this.printLabel.bind((0, _assertThisInitialized2["default"])(_this)); - _this.routeBarcode = _this.routeBarcode.bind((0, _assertThisInitialized2["default"])(_this)); - _this.setData = _this.setData.bind((0, _assertThisInitialized2["default"])(_this)); - _this.increaseCoordinate = _this.increaseCoordinate.bind((0, _assertThisInitialized2["default"])(_this)); - _this.updateSpecimen = _this.updateSpecimen.bind((0, _assertThisInitialized2["default"])(_this)); - _this.updateSpecimens = _this.updateSpecimens.bind((0, _assertThisInitialized2["default"])(_this)); - _this.editSpecimens = _this.editSpecimens.bind((0, _assertThisInitialized2["default"])(_this)); - _this.updateContainer = _this.updateContainer.bind((0, _assertThisInitialized2["default"])(_this)); - _this.createPool = _this.createPool.bind((0, _assertThisInitialized2["default"])(_this)); - _this.saveBatchEdit = _this.saveBatchEdit.bind((0, _assertThisInitialized2["default"])(_this)); - _this.createSpecimens = _this.createSpecimens.bind((0, _assertThisInitialized2["default"])(_this)); - _this.createContainers = _this.createContainers.bind((0, _assertThisInitialized2["default"])(_this)); - _this.validateSpecimen = _this.validateSpecimen.bind((0, _assertThisInitialized2["default"])(_this)); - _this.validateProcess = _this.validateProcess.bind((0, _assertThisInitialized2["default"])(_this)); - _this.validateContainer = _this.validateContainer.bind((0, _assertThisInitialized2["default"])(_this)); - return _this; - } - - /** - * React lifecycle method - */ - (0, _createClass2["default"])(BiobankIndex, [{ - key: "componentDidMount", - value: function () { - var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() { - var _this2 = this; - var updateProgress, specimens, containers, pools, options, data; - return _regenerator["default"].wrap(function _callee$(_context) { - while (1) { - switch (_context.prev = _context.next) { - case 0: - updateProgress = function updateProgress(loading) { - return _this2.setState({ - loading: loading - }); - }; - specimens = (0, _helpers.getStream)(this.props.specimenAPI, updateProgress); - containers = (0, _helpers.get)(this.props.containerAPI); - pools = (0, _helpers.get)(this.props.poolAPI); - _context.next = 6; - return (0, _helpers.get)(this.props.optionsAPI); - case 6: - options = _context.sent; - this.setState({ - options: options - }); - data = this.state.data; - _context.next = 11; - return containers; - case 11: - data.containers = _context.sent; - _context.next = 14; - return specimens; - case 14: - data.specimens = _context.sent; - _context.next = 17; - return pools; - case 17: - data.pools = _context.sent; - this.setState({ - data: data - }); - updateProgress(100); - case 20: - case "end": - return _context.stop(); - } - } - }, _callee, this); - })); - function componentDidMount() { - return _componentDidMount.apply(this, arguments); - } - return componentDidMount; - }() - /** - * Sets data for entities - * - * @param {string} type - the type of entity - * @param {object} entities - the entities to set - * @return {Promise} - */ - }, { - key: "setData", - value: function setData(type, entities) { - var _this3 = this; - return new Promise(function (resolve) { - var data = (0, _helpers.clone)(_this3.state.data); - entities.forEach(function (entity) { - return data[type][entity.id] = entity; - }); - _this3.setState({ - data: data - }, resolve()); - }); - } - - /** - * Send a request to a server to print a label - * - * @param {object} labelParams - the properties of the label to print - * @return {Promise} - */ - }, { - key: "printLabel", - value: function printLabel(labelParams) { - return (0, _helpers.post)(labelParams, this.props.labelAPI, 'POST'); - } - - /** - * Find the appropriate container for a barcode. - * - * @param {string} barcode - the value to route - * @return {object} - */ - }, { - key: "routeBarcode", - value: function routeBarcode(barcode) { - var container = Object.values(this.state.data.containers).find(function (container) { - return container.barcode == barcode; - }); - var specimen = Object.values(this.state.data.specimens).find(function (specimen) { - return specimen.containerId == container.id; - }); - return { - container: container, - specimen: specimen - }; - } - - /** - * Send a request to update a single specimen on the server after - * validating it - * - * @param {object} specimen - the specimen to update - * @return {Promise} - */ - }, { - key: "updateSpecimen", - value: function updateSpecimen(specimen) { - var _this4 = this; - var errors = this.validateSpecimen(specimen); - if (!(0, _helpers.isEmpty)(errors)) { - return Promise.reject({ - specimen: errors - }); - } - return (0, _helpers.post)(specimen, this.props.specimenAPI, 'PUT').then(function (specimens) { - return _this4.setData('specimens', specimens); - }); - } - - /** - * Update multiple specimens at once - * - * @param {array} list - the list of specimens to update - * @return {Promise} - */ - }, { - key: "updateSpecimens", - value: function updateSpecimens(list) { - var _this5 = this; - var updateList = list.map(function (specimen) { - return function () { - return _this5.updateSpecimen(specimen); - }; - }); - return Promise.all(updateList.map(function (updateSpecimen) { - return updateSpecimen(); - })); - } - - /** - * Edit a list of specimens - * - * @param {array} list - a list of specimens - * @return {Promise} - */ - }, { - key: "editSpecimens", - value: function editSpecimens(list) { - var _this6 = this; - var errors = {}; - errors.specimen = this.validateSpecimen(list[0].specimen); - errors.container = this.validateContainer(list[0].container); - if (!(0, _helpers.isEmpty)(errors.specimen) || !(0, _helpers.isEmpty)(errors.container)) { - return Promise.reject(errors); - } - var specimenList = list.map(function (item) { - return function () { - return _this6.updateSpecimen(item.specimen); - }; - }); - var containerList = list.map(function (item) { - return function () { - return _this6.updateContainer(item.container); - }; - }); - return Promise.all(specimenList.map(function (item) { - return item(); - })).then(function () { - return Promise.all(containerList.map(function (item) { - return item(); - })); - }); - } - - /** - * Sends a request to update a container on the server - * - * @param {object} container - the container to update - * @return {Promise} - */ - }, { - key: "updateContainer", - value: function updateContainer(container) { - var _this7 = this; - var errors = this.validateContainer(container); - if (!(0, _helpers.isEmpty)(errors)) { - return Promise.reject({ - container: errors - }); - } - return (0, _helpers.post)(container, this.props.containerAPI, 'PUT').then(function (containers) { - return _this7.setData('containers', containers); - }); - } - - /** - * Increase the coordinates of a container to put it in the - * next available slot. - * - * @param {object} coordinate - the coordinate to increment - * @param {number} parentContainerId - the parent container - * @return {number} - */ - }, { - key: "increaseCoordinate", - value: function increaseCoordinate(coordinate, parentContainerId) { - var containers = this.state.data.containers; - var childCoordinates = containers[parentContainerId].childContainerIds.reduce(function (result, id) { - var container = containers[id]; - if (container.coordinate) { - result[container.coordinate] = id; - } - return result; - }, {}); - var increment = function increment(coord) { - coord++; - if (childCoordinates.hasOwnProperty(coord)) { - coord = increment(coord); - } - return coord; - }; - return increment(coordinate); - } - - /** - * Create a batch of specimens - * - * @param {object} list - list of specimens - * @param {object} current - holds current state for specific values - * @param {boolean} print - whether the barcodes should be printed - * @return {Promise} - */ - }, { - key: "createSpecimens", - value: function createSpecimens(list, current, print) { - var _this8 = this; - var _this$state = this.state, - options = _this$state.options, - data = _this$state.data; - var centerId = current.centerId; - var availableId = Object.keys(options.container.stati).find(function (key) { - return options.container.stati[key].label === 'Available'; - }); - var errors = { - specimen: {}, - container: {}, - list: {} - }; - var isError = false; - Object.keys(list).reduce(function (coord, key) { - // set specimen values - var specimen = list[key]; - specimen.candidateId = current.candidateId; - specimen.sessionId = current.sessionId; - specimen.quantity = specimen.collection.quantity; - specimen.unitId = specimen.collection.unitId; - specimen.collection.centerId = centerId; - if ((options.specimen.types[specimen.typeId] || {}).freezeThaw == 1) { - specimen.fTCycle = 0; - } - specimen.parentSpecimenIds = current.parentSpecimenIds || null; - - // set container values - var container = specimen.container; - container.statusId = availableId; - container.temperature = 20; - container.centerId = centerId; - container.originId = centerId; - - // If the container is assigned to a parent, place it sequentially in the - // parent container and inherit the status, temperature and centerId. - if (current.container.parentContainerId) { - var containerParentId = current.container.parentContainerId; - container.parentContainerId = current.container.parentContainerId; - var parentContainer = data.containers[containerParentId]; - var dims = options.container.dimensions; - var dimensions = dims[parentContainer.dimensionId]; - var capacity = dimensions.x * dimensions.y * dimensions.z; - coord = _this8.increaseCoordinate(coord, current.container.parentContainerId); - if (coord <= capacity) { - container.coordinate = parseInt(coord); - } else { - container.coordinate = null; - } - container.statusId = parentContainer.statusId; - container.temperature = parentContainer.temperature; - container.centerId = parentContainer.centerId; - } - - // if specimen type id is not set yet, this will throw an error - if (specimen.typeId) {} - specimen.container = container; - list[key] = specimen; - - // this is so the global params (sessionId, candidateId, etc.) show errors - // as well. - errors.container = _this8.validateContainer(container, key); - errors.specimen = _this8.validateSpecimen(specimen, key); - if (!(0, _helpers.isEmpty)(errors.container)) { - errors.list[key] = { - container: errors.container - }; - } - if (!(0, _helpers.isEmpty)(errors.specimen)) { - errors.list[key] = _objectSpread(_objectSpread({}, errors.list[key]), {}, { - specimen: errors.specimen - }); - } - if (!(0, _helpers.isEmpty)(errors.list[key])) { - isError = true; - } - return coord; - }, 0); - if (isError) { - return Promise.reject(errors); - } - var printBarcodes = function printBarcodes(entities) { - return new Promise(function (resolve) { - if (print) { - _sweetalert["default"].fire({ - title: 'Print Barcodes?', - type: 'question', - confirmButtonText: 'Yes', - cancelButtonText: 'No', - showCancelButton: true - }).then(function (result) { - if (result.value) { - var labelParams = []; - Object.values(entities.specimens).forEach(function (specimen) { - labelParams.push({ - barcode: specimen.barcode, - type: options.specimen.types[specimen.typeId].label, - pscid: specimen.candidatePSCID, - sampleNumber: specimen.sampleNumber - }); - }); - return _this8.printLabel(labelParams); - } - }).then(function () { - return resolve(); - })["catch"](function (error) { - console.error('Printing error:', error); - resolve(); - }); - } else { - resolve(); - } - }); - }; - return (0, _helpers.post)(list, this.props.specimenAPI, 'POST').then(function (entities) { - return printBarcodes(entities).then(function () { - _this8.setData('containers', entities.containers); - _this8.setData('specimens', entities.specimens); - }); - }).then(function () { - return Promise.resolve(); - }); - } - - /** - * Create containers - * - * @param {object} list - list of containers - * @param {object} current - values held in current state - * @param {object} errors - list of errors - * @return {Promise} - */ - }, { - key: "createContainers", - value: function createContainers(list, current, errors) { - var _this9 = this; - var stati = this.state.options.container.stati; - var availableId = Object.keys(stati).find(function (key) { - return stati[key].label === 'Available'; - }); - var isError = false; - Object.entries(list).forEach(function (_ref) { - var _ref2 = (0, _slicedToArray2["default"])(_ref, 2), - key = _ref2[0], - container = _ref2[1]; - container.statusId = availableId; - container.temperature = 20; - container.originId = current.centerId; - container.centerId = current.centerId; - errors.container = _this9.validateContainer(container, key); - errors.list[key] = _this9.validateContainer(container, key); - if (!(0, _helpers.isEmpty)(errors.list[key])) { - isError = true; - } - }); - if (isError) { - return Promise.reject(errors); - } - return (0, _helpers.post)(list, this.props.containerAPI, 'POST').then(function (containers) { - return _this9.setData('containers', containers); - }).then(function () { - return Promise.resolve(); - }); - } - - /** - * Create a new pool - * - * @param {object} pool - the pool to create - * @param {object} list - the specimens to add to the pool - * @return {Promise} - */ - }, { - key: "createPool", - value: function createPool(pool, list) { - var _this10 = this; - var stati = this.state.options.container.stati; - var dispensedId = Object.keys(stati).find(function (key) { - return stati[key].label === 'Dispensed'; - }); - var update = Object.values(list).reduce(function (result, item) { - item.container.statusId = dispensedId; - item.specimen.quantity = '0'; - - // XXX: By updating the container and specimen after, it's causing issues - // if they don't meet validation. The error is being thrown only after the - // pool has already been saved to the database! Not sure how to resolve this. - return [].concat((0, _toConsumableArray2["default"])(result), [function () { - return _this10.updateContainer(item.container, false); - }, function () { - return _this10.updateSpecimen(item.specimen, false); - }]); - }, []); - var errors = this.validatePool(pool); - if (!(0, _helpers.isEmpty)(errors)) { - return Promise.reject(errors); - } - return (0, _helpers.post)(pool, this.props.poolAPI, 'POST').then(function (pools) { - return _this10.setData('pools', pools); - }).then(function () { - return Promise.all(update.map(function (update) { - return update(); - })); - }); - } - - /** - * Save a batch of edits - * - * @param {object} list - a list of edits - * @return {Promise} - */ - }, { - key: "saveBatchEdit", - value: function saveBatchEdit(list) { - var _this11 = this; - var saveList = list.map(function (specimen) { - return function () { - return (0, _helpers.post)(specimen, _this11.props.specimenAPI, 'PUT'); - }; - }); - var errors = this.validateSpecimen(list[0]); - if (!(0, _helpers.isEmpty)(errors)) { - return Promise.reject(errors); - } - return Promise.all(saveList.map(function (item) { - return item(); - })).then(function (data) { - return Promise.all(data.map(function (item) { - return _this11.setData('specimens', item); - })); - }).then(function () { - return _sweetalert["default"].fire('Batch Preparation Successful!', '', 'success'); - }); - } - - /** - * Validate a specimen - * - * @param {object} specimen - the specimen to validate - * @return {object} an object of errors - */ - }, { - key: "validateSpecimen", - value: function validateSpecimen(specimen) { - var errors = {}; - var required = ['typeId', 'quantity', 'unitId', 'candidateId', 'sessionId', 'collection']; - var _float = ['quantity']; - var positive = ['quantity', 'fTCycle']; - var integer = ['fTCycle']; - required.map(function (field) { - // TODO: seems like for certain cases it needs to be !== null - if (!specimen[field]) { - errors[field] = 'This field is required! '; - } - }); - _float.map(function (field) { - if (isNaN(parseInt(specimen[field])) || !isFinite(specimen[field])) { - errors[field] = 'This field must be a number! '; - } - }); - positive.map(function (field) { - if (specimen[field] != null && specimen[field] < 0) { - errors[field] = 'This field must not be negative!'; - } - }); - integer.map(function (field) { - if (specimen[field] != null && !/^\+?(0|[1-9]\d*)$/.test(specimen[field])) { - errors[field] = 'This field must be an integer!'; - } - }); - var optspecimen = this.state.options.specimen; - errors.collection = this.validateProcess(specimen.collection, optspecimen.protocolAttributes[specimen.collection.protocolId], ['protocolId', 'examinerId', 'quantity', 'unitId', 'centerId', 'date', 'time'], ['quantity']); - - // collection should only be set if there are errors associated with it. - if ((0, _helpers.isEmpty)(errors.collection)) { - delete errors.collection; - } - if (specimen.preparation) { - errors.preparation = this.validateProcess(specimen.preparation, optspecimen.protocolAttributes[specimen.preparation.protocolId], ['protocolId', 'examinerId', 'centerId', 'date', 'time']); - } - if ((0, _helpers.isEmpty)(errors.preparation)) { - delete errors.preparation; - } - if (specimen.analysis) { - errors.analysis = this.validateProcess(specimen.analysis, optspecimen.protocolAttributes[specimen.analysis.protocolId], ['protocolId', 'examinerId', 'centerId', 'date', 'time']); - } - if ((0, _helpers.isEmpty)(errors.analysis)) { - delete errors.analysis; - } - return errors; - } - - /** - * Validate a process - * - * @param {object} process - the process to validate - * @param {object} attributes - the attributes of the process - * @param {array} required - the required fields - * @param {array} number - an array of fields that must be numbers - * @return {object} errors - */ - }, { - key: "validateProcess", - value: function validateProcess(process, attributes, required, number) { - var errors = {}; - var regex; - - // validate required fields - required && required.map(function (field) { - if (!process[field]) { - errors[field] = 'This field is required! '; - } - }); - - // validate floats - number && number.map(function (field) { - if (isNaN(parseInt(process[field])) || !isFinite(process[field])) { - errors[field] = 'This field must be a number! '; - } - }); - - // validate date - regex = /^[12]\d{3}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/; - if (regex.test(process.date) === false) { - errors.date = 'This field must be a valid date! '; - } - - // validate time - regex = /^([01]\d|2[0-3]):([0-5]\d)$/; - if (regex.test(process.time) === false) { - errors.time = 'This field must be a valid time! '; - } - - // validate custom attributes - if (!(0, _helpers.isEmpty)(process.data)) { - errors.data = {}; - var specimenopts = this.state.options.specimen; - var datatypes = specimenopts.attributeDatatypes; - - // FIXME: This if statement was introduced because certain processes have - // a data object even though their protocol isn't associated with attributes. - // This is a sign of bad importing/configuration and should be fixed in - // configuration rather than here. - if (attributes) { - Object.values(attributes).forEach(function (attribute) { - // validate required - if (attribute.required == 1 && !process.data[attribute.id]) { - errors.data[attribute.id] = 'This field is required!'; - } - var dataTypeId = attribute.datatypeId; - // validate number - if (datatypes[dataTypeId].datatype === 'number') { - if (isNaN(parseInt(process.data[attribute.id])) || !isFinite(process.data[attribute.id])) { - errors.data[attribute.id] = 'This field must be a number!'; - } - } - - // validate date - if (datatypes[dataTypeId].datatype === 'date') { - regex = /^[12]\d{3}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/; - if (regex.test(process.data[attribute.id]) === false) { - errors.data[attribute.id] = 'This field must be a valid date! '; - } - } - - // validate time - if (datatypes[dataTypeId].datatype === 'time') { - regex = /^([01]\d|2[0-3]):([0-5]\d)$/; - if (regex.test(process.data[attribute.id]) === false) { - errors.data[attribute.id] = 'This field must be a valid time! '; - } - } - - // TODO: Eventually introduce file validation. - }); - } - - if ((0, _helpers.isEmpty)(errors.data)) { - delete errors.data; - } - } - return errors; - } - - /** - * Validate a container object - * - * @param {object} container - the container to validate - * @return {object} - an object full of errors - */ - }, { - key: "validateContainer", - value: function validateContainer(container) { - var errors = {}; - var required = ['barcode', 'typeId', 'temperature', 'statusId', 'centerId']; - var _float2 = ['temperature']; - required.map(function (field) { - if (!container[field]) { - errors[field] = 'This field is required! '; - } - }); - _float2.map(function (field) { - if (isNaN(parseInt(container[field])) || !isFinite(container[field])) { - errors[field] = 'This field must be a number! '; - } - }); - Object.values(this.state.data.containers).map(function (c) { - if (container.barcode === c.barcode && container.id !== c.id) { - errors.barcode = 'Barcode must be unique.'; - } - }); - - // TODO: Regex barcode check will eventually go here. - // The regex is not currently in the schema and should be implemented here - // when it is. - - return errors; - } - - /** - * Validate a pool of speciments - * - * @param {object} pool - The pool to validate - * @return {object} an object of any errors - */ - }, { - key: "validatePool", - value: function validatePool(pool) { - var regex; - var errors = {}; - var required = ['label', 'quantity', 'unitId', 'date', 'time']; - required.forEach(function (field) { - if (!pool[field]) { - errors[field] = 'This field is required! '; - } - }); - if (isNaN(parseInt(pool.quantity)) || !isFinite(pool.quantity)) { - errors.quantity = 'This field must be a number! '; - } - - // validate date - regex = /^[12]\d{3}\-(0[1-9]|1[012])\-(0[1-9]|[12][0-9]|3[01])$/; - if (regex.test(pool.date) === false) { - errors.date = 'This field must be a valid date! '; - } - - // validate time - regex = /^([01]\d|2[0-3]):([0-5]\d)$/; - if (regex.test(pool.time) === false) { - errors.time = 'This field must be a valid time! '; - } - if (pool.specimenIds == null || pool.specimenIds.length < 2) { - errors.total = 'Pooling requires at least 2 specimens'; - } - return errors; - } - - /** - * Render React component - * - * @return {JSX} - */ - }, { - key: "render", - value: function render() { - var _this12 = this; - var barcode = function barcode(props) { - var target = _this12.routeBarcode(props.match.params.barcode); - return /*#__PURE__*/React.createElement(_barcodePage["default"], { - history: props.history, - specimen: target.specimen, - container: target.container, - data: _this12.state.data, - options: _this12.state.options, - updateSpecimen: _this12.updateSpecimen, - updateContainer: _this12.updateContainer, - createSpecimens: _this12.createSpecimens, - createContainers: _this12.createContainers, - printLabel: _this12.printLabel, - increaseCoordinate: _this12.increaseCoordinate, - loading: _this12.state.loading - }); - }; - var filter = function filter(props) { - return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_filter["default"], { - history: props.history, - data: _this12.state.data, - setData: _this12.setData, - options: _this12.state.options, - increaseCoordinate: _this12.increaseCoordinate, - createPool: _this12.createPool, - createContainers: _this12.createContainers, - createSpecimens: _this12.createSpecimens, - editSpecimens: _this12.editSpecimens, - updateSpecimens: _this12.updateSpecimens, - loading: _this12.state.loading - })); - }; - return /*#__PURE__*/React.createElement(_reactRouterDom.BrowserRouter, { - basename: "/biobank" - }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(_reactRouterDom.Switch, null, /*#__PURE__*/React.createElement(_reactRouterDom.Route, { - exact: true, - path: "/", - render: filter - }), /*#__PURE__*/React.createElement(_reactRouterDom.Route, { - exact: true, - path: "/barcode=:barcode", - render: barcode - })))); - } - }]); - return BiobankIndex; -}(_react.Component); // biobankIndex.propTypes -BiobankIndex.propTypes = { - specimenAPI: _propTypes["default"].object.isRequired, - containerAPI: _propTypes["default"].object.isRequired, - poolAPI: _propTypes["default"].object.isRequired, - optionsAPI: _propTypes["default"].object.isRequired, - labelAPI: _propTypes["default"].object.isRequired -}; -window.addEventListener('load', function () { - var biobank = "".concat(loris.BaseURL, "/biobank/"); - ReactDOM.render( /*#__PURE__*/React.createElement(BiobankIndex, { - specimenAPI: "".concat(biobank, "specimenendpoint/"), - containerAPI: "".concat(biobank, "containerendpoint/"), - poolAPI: "".concat(biobank, "poolendpoint/"), - optionsAPI: "".concat(biobank, "optionsendpoint/"), - labelAPI: "".concat(loris.BaseURL).concat(loris.config('printEndpoint')) - }), document.getElementById('lorisworkspace')); -}); -})(); - -((window.lorisjs = window.lorisjs || {}).biobank = window.lorisjs.biobank || {}).biobankIndex = __webpack_exports__; -/******/ })() -; -//# sourceMappingURL=biobankIndex.js.map \ No newline at end of file