diff --git a/package.json b/package.json
index d1b7771..1d68a53 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "choices.js",
- "version": "5.0.0",
+ "version": "5.1.0",
"description": "A vanilla JS customisable text input/select box plugin",
"main": "./public/assets/scripts/choices.min.js",
"types": "./types/index.d.ts",
diff --git a/public/assets/scripts/choices.js b/public/assets/scripts/choices.js
index aac6c15..e0f208c 100644
--- a/public/assets/scripts/choices.js
+++ b/public/assets/scripts/choices.js
@@ -802,7 +802,7 @@ var TEMPLATES = {
var _classNames3;
localClasses = (0, _classnames.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames3, globalClasses.placeholder, data.placeholder), _classNames3));
- return (0, _utils.strToEl)("\n
\n ").concat(data.label, "\n
\n "));
+ return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n
\n "));
}
return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n
\n "));
@@ -839,7 +839,7 @@ var TEMPLATES = {
return (0, _utils.strToEl)("\n \n ").concat(label, "\n
\n "));
},
option: function option(data) {
- return (0, _utils.strToEl)("\n \n "));
+ return (0, _utils.strToEl)("\n \n "));
}
};
exports.TEMPLATES = TEMPLATES;
@@ -3701,14 +3701,12 @@ function () {
label: o.innerHTML,
selected: o.selected,
disabled: o.disabled || o.parentNode.disabled,
- placeholder: o.hasAttribute('placeholder')
+ placeholder: o.hasAttribute('placeholder'),
+ customProperties: o.getAttribute('data-custom-properties')
});
}); // If sorting is enabled or the user is searching, filter choices
- if (this.config.shouldSort) {
- allChoices.sort(filter);
- } // Determine whether there is a selected choice
-
+ if (this.config.shouldSort) allChoices.sort(filter); // Determine whether there is a selected choice
var hasSelectedChoice = allChoices.some(function (choice) {
return choice.selected;
@@ -3897,7 +3895,7 @@ module.exports = Choices;
/***/ (function(module, exports, __webpack_require__) {
/*!
- * Fuse.js v3.4.1 - Lightweight fuzzy-search (http://fusejs.io)
+ * Fuse.js v3.4.2 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
@@ -4004,14 +4002,16 @@ return /******/ (function(modules) { // webpackBootstrap
/*! no static exports found */
/***/ (function(module, exports) {
-module.exports = (matchmask = [], minMatchCharLength = 1) => {
- let matchedIndices = [];
- let start = -1;
- let end = -1;
- let i = 0;
+module.exports = function () {
+ var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
+ var matchedIndices = [];
+ var start = -1;
+ var end = -1;
+ var i = 0;
- for (let len = matchmask.length; i < len; i += 1) {
- let match = matchmask[i];
+ for (var len = matchmask.length; i < len; i += 1) {
+ var match = matchmask[i];
if (match && start === -1) {
start = i;
@@ -4043,16 +4043,16 @@ module.exports = (matchmask = [], minMatchCharLength = 1) => {
/*! no static exports found */
/***/ (function(module, exports) {
-module.exports = pattern => {
- let mask = {};
- let len = pattern.length;
+module.exports = function (pattern) {
+ var mask = {};
+ var len = pattern.length;
- for (let i = 0; i < len; i += 1) {
+ for (var i = 0; i < len; i += 1) {
mask[pattern.charAt(i)] = 0;
}
- for (let i = 0; i < len; i += 1) {
- mask[pattern.charAt(i)] |= 1 << len - i - 1;
+ for (var _i = 0; _i < len; _i += 1) {
+ mask[pattern.charAt(_i)] |= 1 << len - _i - 1;
}
return mask;
@@ -4067,17 +4067,18 @@ module.exports = pattern => {
/*! no static exports found */
/***/ (function(module, exports) {
-const SPECIAL_CHARS_REGEX = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
+var SPECIAL_CHARS_REGEX = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;
-module.exports = (text, pattern, tokenSeparator = / +/g) => {
- let regex = new RegExp(pattern.replace(SPECIAL_CHARS_REGEX, '\\$&').replace(tokenSeparator, '|'));
- let matches = text.match(regex);
- let isMatch = !!matches;
- let matchedIndices = [];
+module.exports = function (text, pattern) {
+ var tokenSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : / +/g;
+ var regex = new RegExp(pattern.replace(SPECIAL_CHARS_REGEX, '\\$&').replace(tokenSeparator, '|'));
+ var matches = text.match(regex);
+ var isMatch = !!matches;
+ var matchedIndices = [];
if (isMatch) {
- for (let i = 0, matchesLen = matches.length; i < matchesLen; i += 1) {
- let match = matches[i];
+ for (var i = 0, matchesLen = matches.length; i < matchesLen; i += 1) {
+ var match = matches[i];
matchedIndices.push([text.indexOf(match), match.length - 1]);
}
}
@@ -4085,8 +4086,8 @@ module.exports = (text, pattern, tokenSeparator = / +/g) => {
return {
// TODO: revisit this score
score: isMatch ? 0.5 : 1,
- isMatch,
- matchedIndices
+ isMatch: isMatch,
+ matchedIndices: matchedIndices
};
};
@@ -4099,14 +4100,17 @@ module.exports = (text, pattern, tokenSeparator = / +/g) => {
/*! no static exports found */
/***/ (function(module, exports) {
-module.exports = (pattern, {
- errors = 0,
- currentLocation = 0,
- expectedLocation = 0,
- distance = 100
-}) => {
- const accuracy = errors / pattern.length;
- const proximity = Math.abs(expectedLocation - currentLocation);
+module.exports = function (pattern, _ref) {
+ var _ref$errors = _ref.errors,
+ errors = _ref$errors === void 0 ? 0 : _ref$errors,
+ _ref$currentLocation = _ref.currentLocation,
+ currentLocation = _ref$currentLocation === void 0 ? 0 : _ref$currentLocation,
+ _ref$expectedLocation = _ref.expectedLocation,
+ expectedLocation = _ref$expectedLocation === void 0 ? 0 : _ref$expectedLocation,
+ _ref$distance = _ref.distance,
+ distance = _ref$distance === void 0 ? 100 : _ref$distance;
+ var accuracy = errors / pattern.length;
+ var proximity = Math.abs(expectedLocation - currentLocation);
if (!distance) {
// Dodge divide by zero error.
@@ -4125,77 +4129,82 @@ module.exports = (pattern, {
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
-const bitapScore = __webpack_require__(/*! ./bitap_score */ "./src/bitap/bitap_score.js");
+var bitapScore = __webpack_require__(/*! ./bitap_score */ "./src/bitap/bitap_score.js");
-const matchedIndices = __webpack_require__(/*! ./bitap_matched_indices */ "./src/bitap/bitap_matched_indices.js");
+var matchedIndices = __webpack_require__(/*! ./bitap_matched_indices */ "./src/bitap/bitap_matched_indices.js");
-module.exports = (text, pattern, patternAlphabet, {
- location = 0,
- distance = 100,
- threshold = 0.6,
- findAllMatches = false,
- minMatchCharLength = 1
-}) => {
- const expectedLocation = location; // Set starting location at beginning text and initialize the alphabet.
+module.exports = function (text, pattern, patternAlphabet, _ref) {
+ var _ref$location = _ref.location,
+ location = _ref$location === void 0 ? 0 : _ref$location,
+ _ref$distance = _ref.distance,
+ distance = _ref$distance === void 0 ? 100 : _ref$distance,
+ _ref$threshold = _ref.threshold,
+ threshold = _ref$threshold === void 0 ? 0.6 : _ref$threshold,
+ _ref$findAllMatches = _ref.findAllMatches,
+ findAllMatches = _ref$findAllMatches === void 0 ? false : _ref$findAllMatches,
+ _ref$minMatchCharLeng = _ref.minMatchCharLength,
+ minMatchCharLength = _ref$minMatchCharLeng === void 0 ? 1 : _ref$minMatchCharLeng;
+ var expectedLocation = location; // Set starting location at beginning text and initialize the alphabet.
- const textLen = text.length; // Highest score beyond which we give up.
+ var textLen = text.length; // Highest score beyond which we give up.
- let currentThreshold = threshold; // Is there a nearby exact match? (speedup)
+ var currentThreshold = threshold; // Is there a nearby exact match? (speedup)
- let bestLocation = text.indexOf(pattern, expectedLocation);
- const patternLen = pattern.length; // a mask of the matches
+ var bestLocation = text.indexOf(pattern, expectedLocation);
+ var patternLen = pattern.length; // a mask of the matches
- const matchMask = [];
+ var matchMask = [];
- for (let i = 0; i < textLen; i += 1) {
+ for (var i = 0; i < textLen; i += 1) {
matchMask[i] = 0;
}
if (bestLocation !== -1) {
- let score = bitapScore(pattern, {
+ var score = bitapScore(pattern, {
errors: 0,
currentLocation: bestLocation,
- expectedLocation,
- distance
+ expectedLocation: expectedLocation,
+ distance: distance
});
currentThreshold = Math.min(score, currentThreshold); // What about in the other direction? (speed up)
bestLocation = text.lastIndexOf(pattern, expectedLocation + patternLen);
if (bestLocation !== -1) {
- let score = bitapScore(pattern, {
+ var _score = bitapScore(pattern, {
errors: 0,
currentLocation: bestLocation,
- expectedLocation,
- distance
+ expectedLocation: expectedLocation,
+ distance: distance
});
- currentThreshold = Math.min(score, currentThreshold);
+
+ currentThreshold = Math.min(_score, currentThreshold);
}
} // Reset the best location
bestLocation = -1;
- let lastBitArr = [];
- let finalScore = 1;
- let binMax = patternLen + textLen;
- const mask = 1 << patternLen - 1;
+ var lastBitArr = [];
+ var finalScore = 1;
+ var binMax = patternLen + textLen;
+ var mask = 1 << patternLen - 1;
- for (let i = 0; i < patternLen; i += 1) {
+ for (var _i = 0; _i < patternLen; _i += 1) {
// Scan for the best match; each iteration allows for one more error.
// Run a binary search to determine how far from the match location we can stray
// at this error level.
- let binMin = 0;
- let binMid = binMax;
+ var binMin = 0;
+ var binMid = binMax;
while (binMin < binMid) {
- const score = bitapScore(pattern, {
- errors: i,
+ var _score3 = bitapScore(pattern, {
+ errors: _i,
currentLocation: expectedLocation + binMid,
- expectedLocation,
- distance
+ expectedLocation: expectedLocation,
+ distance: distance
});
- if (score <= currentThreshold) {
+ if (_score3 <= currentThreshold) {
binMin = binMid;
} else {
binMax = binMid;
@@ -4206,15 +4215,15 @@ module.exports = (text, pattern, patternAlphabet, {
binMax = binMid;
- let start = Math.max(1, expectedLocation - binMid + 1);
- let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array
+ var start = Math.max(1, expectedLocation - binMid + 1);
+ var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array
- let bitArr = Array(finish + 2);
- bitArr[finish + 1] = (1 << i) - 1;
+ var bitArr = Array(finish + 2);
+ bitArr[finish + 1] = (1 << _i) - 1;
- for (let j = finish; j >= start; j -= 1) {
- let currentLocation = j - 1;
- let charMatch = patternAlphabet[text.charAt(currentLocation)];
+ for (var j = finish; j >= start; j -= 1) {
+ var currentLocation = j - 1;
+ var charMatch = patternAlphabet[text.charAt(currentLocation)];
if (charMatch) {
matchMask[currentLocation] = 1;
@@ -4223,16 +4232,16 @@ module.exports = (text, pattern, patternAlphabet, {
bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch; // Subsequent passes: fuzzy match
- if (i !== 0) {
+ if (_i !== 0) {
bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];
}
if (bitArr[j] & mask) {
finalScore = bitapScore(pattern, {
- errors: i,
- currentLocation,
- expectedLocation,
- distance
+ errors: _i,
+ currentLocation: currentLocation,
+ expectedLocation: expectedLocation,
+ distance: distance
}); // This match will almost certainly be better than any existing match.
// But check anyway.
@@ -4252,14 +4261,15 @@ module.exports = (text, pattern, patternAlphabet, {
} // No hope for a (better) match at greater error levels.
- const score = bitapScore(pattern, {
- errors: i + 1,
+ var _score2 = bitapScore(pattern, {
+ errors: _i + 1,
currentLocation: expectedLocation,
- expectedLocation,
- distance
+ expectedLocation: expectedLocation,
+ distance: distance
}); // console.log('score', score, finalScore)
- if (score > currentThreshold) {
+
+ if (_score2 > currentThreshold) {
break;
}
@@ -4284,46 +4294,50 @@ module.exports = (text, pattern, patternAlphabet, {
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
-const bitapRegexSearch = __webpack_require__(/*! ./bitap_regex_search */ "./src/bitap/bitap_regex_search.js");
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-const bitapSearch = __webpack_require__(/*! ./bitap_search */ "./src/bitap/bitap_search.js");
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
-const patternAlphabet = __webpack_require__(/*! ./bitap_pattern_alphabet */ "./src/bitap/bitap_pattern_alphabet.js");
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var bitapRegexSearch = __webpack_require__(/*! ./bitap_regex_search */ "./src/bitap/bitap_regex_search.js");
+
+var bitapSearch = __webpack_require__(/*! ./bitap_search */ "./src/bitap/bitap_search.js");
+
+var patternAlphabet = __webpack_require__(/*! ./bitap_pattern_alphabet */ "./src/bitap/bitap_pattern_alphabet.js");
+
+var Bitap =
+/*#__PURE__*/
+function () {
+ function Bitap(pattern, _ref) {
+ var _ref$location = _ref.location,
+ location = _ref$location === void 0 ? 0 : _ref$location,
+ _ref$distance = _ref.distance,
+ distance = _ref$distance === void 0 ? 100 : _ref$distance,
+ _ref$threshold = _ref.threshold,
+ threshold = _ref$threshold === void 0 ? 0.6 : _ref$threshold,
+ _ref$maxPatternLength = _ref.maxPatternLength,
+ maxPatternLength = _ref$maxPatternLength === void 0 ? 32 : _ref$maxPatternLength,
+ _ref$isCaseSensitive = _ref.isCaseSensitive,
+ isCaseSensitive = _ref$isCaseSensitive === void 0 ? false : _ref$isCaseSensitive,
+ _ref$tokenSeparator = _ref.tokenSeparator,
+ tokenSeparator = _ref$tokenSeparator === void 0 ? / +/g : _ref$tokenSeparator,
+ _ref$findAllMatches = _ref.findAllMatches,
+ findAllMatches = _ref$findAllMatches === void 0 ? false : _ref$findAllMatches,
+ _ref$minMatchCharLeng = _ref.minMatchCharLength,
+ minMatchCharLength = _ref$minMatchCharLeng === void 0 ? 1 : _ref$minMatchCharLeng;
+
+ _classCallCheck(this, Bitap);
-class Bitap {
- constructor(pattern, {
- // Approximately where in the text is the pattern expected to be found?
- location = 0,
- // Determines how close the match must be to the fuzzy location (specified above).
- // An exact letter match which is 'distance' characters away from the fuzzy location
- // would score as a complete mismatch. A distance of '0' requires the match be at
- // the exact location specified, a threshold of '1000' would require a perfect match
- // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
- distance = 100,
- // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
- // (of both letters and location), a threshold of '1.0' would match anything.
- threshold = 0.6,
- // Machine word size
- maxPatternLength = 32,
- // Indicates whether comparisons should be case sensitive.
- isCaseSensitive = false,
- // Regex used to separate words when searching. Only applicable when `tokenize` is `true`.
- tokenSeparator = / +/g,
- // When true, the algorithm continues searching to the end of the input even if a perfect
- // match is found before the end of the same input.
- findAllMatches = false,
- // Minimum number of characters that must be matched before a result is considered a match
- minMatchCharLength = 1
- }) {
this.options = {
- location,
- distance,
- threshold,
- maxPatternLength,
- isCaseSensitive,
- tokenSeparator,
- findAllMatches,
- minMatchCharLength
+ location: location,
+ distance: distance,
+ threshold: threshold,
+ maxPatternLength: maxPatternLength,
+ isCaseSensitive: isCaseSensitive,
+ tokenSeparator: tokenSeparator,
+ findAllMatches: findAllMatches,
+ minMatchCharLength: minMatchCharLength
};
this.pattern = this.options.isCaseSensitive ? pattern : pattern.toLowerCase();
@@ -4332,48 +4346,50 @@ class Bitap {
}
}
- search(text) {
- if (!this.options.isCaseSensitive) {
- text = text.toLowerCase();
- } // Exact match
+ _createClass(Bitap, [{
+ key: "search",
+ value: function search(text) {
+ if (!this.options.isCaseSensitive) {
+ text = text.toLowerCase();
+ } // Exact match
- if (this.pattern === text) {
- return {
- isMatch: true,
- score: 0,
- matchedIndices: [[0, text.length - 1]]
- };
- } // When pattern length is greater than the machine word length, just do a a regex comparison
+ if (this.pattern === text) {
+ return {
+ isMatch: true,
+ score: 0,
+ matchedIndices: [[0, text.length - 1]]
+ };
+ } // When pattern length is greater than the machine word length, just do a a regex comparison
- const {
- maxPatternLength,
- tokenSeparator
- } = this.options;
+ var _this$options = this.options,
+ maxPatternLength = _this$options.maxPatternLength,
+ tokenSeparator = _this$options.tokenSeparator;
- if (this.pattern.length > maxPatternLength) {
- return bitapRegexSearch(text, this.pattern, tokenSeparator);
- } // Otherwise, use Bitap algorithm
+ if (this.pattern.length > maxPatternLength) {
+ return bitapRegexSearch(text, this.pattern, tokenSeparator);
+ } // Otherwise, use Bitap algorithm
- const {
- location,
- distance,
- threshold,
- findAllMatches,
- minMatchCharLength
- } = this.options;
- return bitapSearch(text, this.pattern, this.patternAlphabet, {
- location,
- distance,
- threshold,
- findAllMatches,
- minMatchCharLength
- });
- }
+ var _this$options2 = this.options,
+ location = _this$options2.location,
+ distance = _this$options2.distance,
+ threshold = _this$options2.threshold,
+ findAllMatches = _this$options2.findAllMatches,
+ minMatchCharLength = _this$options2.minMatchCharLength;
+ return bitapSearch(text, this.pattern, this.patternAlphabet, {
+ location: location,
+ distance: distance,
+ threshold: threshold,
+ findAllMatches: findAllMatches,
+ minMatchCharLength: minMatchCharLength
+ });
+ }
+ }]);
-} // let x = new Bitap("od mn war", {})
+ return Bitap;
+}(); // let x = new Bitap("od mn war", {})
// let result = x.search("Old Man's War")
// console.log(result)
@@ -4389,30 +4405,30 @@ module.exports = Bitap;
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
-const isArray = __webpack_require__(/*! ./is_array */ "./src/helpers/is_array.js");
+var isArray = __webpack_require__(/*! ./is_array */ "./src/helpers/is_array.js");
-const deepValue = (obj, path, list) => {
+var deepValue = function deepValue(obj, path, list) {
if (!path) {
// If there's no path left, we've gotten to the object we care about.
list.push(obj);
} else {
- const dotIndex = path.indexOf('.');
- let firstSegment = path;
- let remaining = null;
+ var dotIndex = path.indexOf('.');
+ var firstSegment = path;
+ var remaining = null;
if (dotIndex !== -1) {
firstSegment = path.slice(0, dotIndex);
remaining = path.slice(dotIndex + 1);
}
- const value = obj[firstSegment];
+ var value = obj[firstSegment];
if (value !== null && value !== undefined) {
if (!remaining && (typeof value === 'string' || typeof value === 'number')) {
list.push(value.toString());
} else if (isArray(value)) {
// Search each item in the array.
- for (let i = 0, len = value.length; i < len; i += 1) {
+ for (var i = 0, len = value.length; i < len; i += 1) {
deepValue(value[i], remaining, list);
}
} else if (remaining) {
@@ -4425,7 +4441,7 @@ const deepValue = (obj, path, list) => {
return list;
};
-module.exports = (obj, path) => {
+module.exports = function (obj, path) {
return deepValue(obj, path, []);
};
@@ -4438,7 +4454,9 @@ module.exports = (obj, path) => {
/*! no static exports found */
/***/ (function(module, exports) {
-module.exports = obj => !Array.isArray ? Object.prototype.toString.call(obj) === '[object Array]' : Array.isArray(obj);
+module.exports = function (obj) {
+ return !Array.isArray ? Object.prototype.toString.call(obj) === '[object Array]' : Array.isArray(obj);
+};
/***/ }),
@@ -4449,476 +4467,502 @@ module.exports = obj => !Array.isArray ? Object.prototype.toString.call(obj) ===
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
-const Bitap = __webpack_require__(/*! ./bitap */ "./src/bitap/index.js");
+function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
-const deepValue = __webpack_require__(/*! ./helpers/deep_value */ "./src/helpers/deep_value.js");
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-const isArray = __webpack_require__(/*! ./helpers/is_array */ "./src/helpers/is_array.js");
+function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
+
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
+
+var Bitap = __webpack_require__(/*! ./bitap */ "./src/bitap/index.js");
+
+var deepValue = __webpack_require__(/*! ./helpers/deep_value */ "./src/helpers/deep_value.js");
+
+var isArray = __webpack_require__(/*! ./helpers/is_array */ "./src/helpers/is_array.js");
+
+var Fuse =
+/*#__PURE__*/
+function () {
+ function Fuse(list, _ref) {
+ var _ref$location = _ref.location,
+ location = _ref$location === void 0 ? 0 : _ref$location,
+ _ref$distance = _ref.distance,
+ distance = _ref$distance === void 0 ? 100 : _ref$distance,
+ _ref$threshold = _ref.threshold,
+ threshold = _ref$threshold === void 0 ? 0.6 : _ref$threshold,
+ _ref$maxPatternLength = _ref.maxPatternLength,
+ maxPatternLength = _ref$maxPatternLength === void 0 ? 32 : _ref$maxPatternLength,
+ _ref$caseSensitive = _ref.caseSensitive,
+ caseSensitive = _ref$caseSensitive === void 0 ? false : _ref$caseSensitive,
+ _ref$tokenSeparator = _ref.tokenSeparator,
+ tokenSeparator = _ref$tokenSeparator === void 0 ? / +/g : _ref$tokenSeparator,
+ _ref$findAllMatches = _ref.findAllMatches,
+ findAllMatches = _ref$findAllMatches === void 0 ? false : _ref$findAllMatches,
+ _ref$minMatchCharLeng = _ref.minMatchCharLength,
+ minMatchCharLength = _ref$minMatchCharLeng === void 0 ? 1 : _ref$minMatchCharLeng,
+ _ref$id = _ref.id,
+ id = _ref$id === void 0 ? null : _ref$id,
+ _ref$keys = _ref.keys,
+ keys = _ref$keys === void 0 ? [] : _ref$keys,
+ _ref$shouldSort = _ref.shouldSort,
+ shouldSort = _ref$shouldSort === void 0 ? true : _ref$shouldSort,
+ _ref$getFn = _ref.getFn,
+ getFn = _ref$getFn === void 0 ? deepValue : _ref$getFn,
+ _ref$sortFn = _ref.sortFn,
+ sortFn = _ref$sortFn === void 0 ? function (a, b) {
+ return a.score - b.score;
+ } : _ref$sortFn,
+ _ref$tokenize = _ref.tokenize,
+ tokenize = _ref$tokenize === void 0 ? false : _ref$tokenize,
+ _ref$matchAllTokens = _ref.matchAllTokens,
+ matchAllTokens = _ref$matchAllTokens === void 0 ? false : _ref$matchAllTokens,
+ _ref$includeMatches = _ref.includeMatches,
+ includeMatches = _ref$includeMatches === void 0 ? false : _ref$includeMatches,
+ _ref$includeScore = _ref.includeScore,
+ includeScore = _ref$includeScore === void 0 ? false : _ref$includeScore,
+ _ref$verbose = _ref.verbose,
+ verbose = _ref$verbose === void 0 ? false : _ref$verbose;
+
+ _classCallCheck(this, Fuse);
-class Fuse {
- constructor(list, {
- // Approximately where in the text is the pattern expected to be found?
- location = 0,
- // Determines how close the match must be to the fuzzy location (specified above).
- // An exact letter match which is 'distance' characters away from the fuzzy location
- // would score as a complete mismatch. A distance of '0' requires the match be at
- // the exact location specified, a threshold of '1000' would require a perfect match
- // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold.
- distance = 100,
- // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match
- // (of both letters and location), a threshold of '1.0' would match anything.
- threshold = 0.6,
- // Machine word size
- maxPatternLength = 32,
- // Indicates whether comparisons should be case sensitive.
- caseSensitive = false,
- // Regex used to separate words when searching. Only applicable when `tokenize` is `true`.
- tokenSeparator = / +/g,
- // When true, the algorithm continues searching to the end of the input even if a perfect
- // match is found before the end of the same input.
- findAllMatches = false,
- // Minimum number of characters that must be matched before a result is considered a match
- minMatchCharLength = 1,
- // The name of the identifier property. If specified, the returned result will be a list
- // of the items' dentifiers, otherwise it will be a list of the items.
- id = null,
- // List of properties that will be searched. This also supports nested properties.
- keys = [],
- // Whether to sort the result list, by score
- shouldSort = true,
- // The get function to use when fetching an object's properties.
- // The default will search nested paths *ie foo.bar.baz*
- getFn = deepValue,
- // Default sort function
- sortFn = (a, b) => a.score - b.score,
- // When true, the search algorithm will search individual words **and** the full string,
- // computing the final score as a function of both. Note that when `tokenize` is `true`,
- // the `threshold`, `distance`, and `location` are inconsequential for individual tokens.
- tokenize = false,
- // When true, the result set will only include records that match all tokens. Will only work
- // if `tokenize` is also true.
- matchAllTokens = false,
- includeMatches = false,
- includeScore = false,
- // Will print to the console. Useful for debugging.
- verbose = false
- }) {
this.options = {
- location,
- distance,
- threshold,
- maxPatternLength,
+ location: location,
+ distance: distance,
+ threshold: threshold,
+ maxPatternLength: maxPatternLength,
isCaseSensitive: caseSensitive,
- tokenSeparator,
- findAllMatches,
- minMatchCharLength,
- id,
- keys,
- includeMatches,
- includeScore,
- shouldSort,
- getFn,
- sortFn,
- verbose,
- tokenize,
- matchAllTokens
+ tokenSeparator: tokenSeparator,
+ findAllMatches: findAllMatches,
+ minMatchCharLength: minMatchCharLength,
+ id: id,
+ keys: keys,
+ includeMatches: includeMatches,
+ includeScore: includeScore,
+ shouldSort: shouldSort,
+ getFn: getFn,
+ sortFn: sortFn,
+ verbose: verbose,
+ tokenize: tokenize,
+ matchAllTokens: matchAllTokens
};
this.setCollection(list);
}
- setCollection(list) {
- this.list = list;
- return list;
- }
-
- search(pattern, opts = {
- limit: false
- }) {
- this._log(`---------\nSearch pattern: "${pattern}"`);
-
- const {
- tokenSearchers,
- fullSearcher
- } = this._prepareSearchers(pattern);
-
- let {
- weights,
- results
- } = this._search(tokenSearchers, fullSearcher);
-
- this._computeScore(weights, results);
-
- if (this.options.shouldSort) {
- this._sort(results);
+ _createClass(Fuse, [{
+ key: "setCollection",
+ value: function setCollection(list) {
+ this.list = list;
+ return list;
}
+ }, {
+ key: "search",
+ value: function search(pattern) {
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
+ limit: false
+ };
- if (opts.limit && typeof opts.limit === 'number') {
- results = results.slice(0, opts.limit);
- }
+ this._log("---------\nSearch pattern: \"".concat(pattern, "\""));
- return this._format(results);
- }
+ var _this$_prepareSearche = this._prepareSearchers(pattern),
+ tokenSearchers = _this$_prepareSearche.tokenSearchers,
+ fullSearcher = _this$_prepareSearche.fullSearcher;
- _prepareSearchers(pattern = '') {
- const tokenSearchers = [];
+ var _this$_search = this._search(tokenSearchers, fullSearcher),
+ weights = _this$_search.weights,
+ results = _this$_search.results;
- if (this.options.tokenize) {
- // Tokenize on the separator
- const tokens = pattern.split(this.options.tokenSeparator);
+ this._computeScore(weights, results);
- for (let i = 0, len = tokens.length; i < len; i += 1) {
- tokenSearchers.push(new Bitap(tokens[i], this.options));
+ if (this.options.shouldSort) {
+ this._sort(results);
}
+
+ if (opts.limit && typeof opts.limit === 'number') {
+ results = results.slice(0, opts.limit);
+ }
+
+ return this._format(results);
}
+ }, {
+ key: "_prepareSearchers",
+ value: function _prepareSearchers() {
+ var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ var tokenSearchers = [];
- let fullSearcher = new Bitap(pattern, this.options);
- return {
- tokenSearchers,
- fullSearcher
- };
- }
+ if (this.options.tokenize) {
+ // Tokenize on the separator
+ var tokens = pattern.split(this.options.tokenSeparator);
- _search(tokenSearchers = [], fullSearcher) {
- const list = this.list;
- const resultMap = {};
- const results = []; // Check the first item in the list, if it's a string, then we assume
- // that every item in the list is also a string, and thus it's a flattened array.
+ for (var i = 0, len = tokens.length; i < len; i += 1) {
+ tokenSearchers.push(new Bitap(tokens[i], this.options));
+ }
+ }
- if (typeof list[0] === 'string') {
- // Iterate over every item
- for (let i = 0, len = list.length; i < len; i += 1) {
- this._analyze({
- key: '',
- value: list[i],
- record: i,
- index: i
- }, {
- resultMap,
- results,
- tokenSearchers,
- fullSearcher
- });
+ var fullSearcher = new Bitap(pattern, this.options);
+ return {
+ tokenSearchers: tokenSearchers,
+ fullSearcher: fullSearcher
+ };
+ }
+ }, {
+ key: "_search",
+ value: function _search() {
+ var tokenSearchers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var fullSearcher = arguments.length > 1 ? arguments[1] : undefined;
+ var list = this.list;
+ var resultMap = {};
+ var results = []; // Check the first item in the list, if it's a string, then we assume
+ // that every item in the list is also a string, and thus it's a flattened array.
+
+ if (typeof list[0] === 'string') {
+ // Iterate over every item
+ for (var i = 0, len = list.length; i < len; i += 1) {
+ this._analyze({
+ key: '',
+ value: list[i],
+ record: i,
+ index: i
+ }, {
+ resultMap: resultMap,
+ results: results,
+ tokenSearchers: tokenSearchers,
+ fullSearcher: fullSearcher
+ });
+ }
+
+ return {
+ weights: null,
+ results: results
+ };
+ } // Otherwise, the first item is an Object (hopefully), and thus the searching
+ // is done on the values of the keys of each item.
+
+
+ var weights = {};
+
+ for (var _i = 0, _len = list.length; _i < _len; _i += 1) {
+ var item = list[_i]; // Iterate over every key
+
+ for (var j = 0, keysLen = this.options.keys.length; j < keysLen; j += 1) {
+ var key = this.options.keys[j];
+
+ if (typeof key !== 'string') {
+ weights[key.name] = {
+ weight: 1 - key.weight || 1
+ };
+
+ if (key.weight <= 0 || key.weight > 1) {
+ throw new Error('Key weight has to be > 0 and <= 1');
+ }
+
+ key = key.name;
+ } else {
+ weights[key] = {
+ weight: 1
+ };
+ }
+
+ this._analyze({
+ key: key,
+ value: this.options.getFn(item, key),
+ record: item,
+ index: _i
+ }, {
+ resultMap: resultMap,
+ results: results,
+ tokenSearchers: tokenSearchers,
+ fullSearcher: fullSearcher
+ });
+ }
}
return {
- weights: null,
- results
+ weights: weights,
+ results: results
};
- } // Otherwise, the first item is an Object (hopefully), and thus the searching
- // is done on the values of the keys of each item.
-
-
- const weights = {};
-
- for (let i = 0, len = list.length; i < len; i += 1) {
- let item = list[i]; // Iterate over every key
-
- for (let j = 0, keysLen = this.options.keys.length; j < keysLen; j += 1) {
- let key = this.options.keys[j];
-
- if (typeof key !== 'string') {
- weights[key.name] = {
- weight: 1 - key.weight || 1
- };
-
- if (key.weight <= 0 || key.weight > 1) {
- throw new Error('Key weight has to be > 0 and <= 1');
- }
-
- key = key.name;
- } else {
- weights[key] = {
- weight: 1
- };
- }
-
- this._analyze({
- key,
- value: this.options.getFn(item, key),
- record: item,
- index: i
- }, {
- resultMap,
- results,
- tokenSearchers,
- fullSearcher
- });
- }
}
-
- return {
- weights,
- results
- };
- }
-
- _analyze({
- key,
- arrayIndex = -1,
- value,
- record,
- index
}, {
- tokenSearchers = [],
- fullSearcher = [],
- resultMap = {},
- results = []
- }) {
- // Check if the texvaluet can be searched
- if (value === undefined || value === null) {
- return;
- }
+ key: "_analyze",
+ value: function _analyze(_ref2, _ref3) {
+ var key = _ref2.key,
+ _ref2$arrayIndex = _ref2.arrayIndex,
+ arrayIndex = _ref2$arrayIndex === void 0 ? -1 : _ref2$arrayIndex,
+ value = _ref2.value,
+ record = _ref2.record,
+ index = _ref2.index;
+ var _ref3$tokenSearchers = _ref3.tokenSearchers,
+ tokenSearchers = _ref3$tokenSearchers === void 0 ? [] : _ref3$tokenSearchers,
+ _ref3$fullSearcher = _ref3.fullSearcher,
+ fullSearcher = _ref3$fullSearcher === void 0 ? [] : _ref3$fullSearcher,
+ _ref3$resultMap = _ref3.resultMap,
+ resultMap = _ref3$resultMap === void 0 ? {} : _ref3$resultMap,
+ _ref3$results = _ref3.results,
+ results = _ref3$results === void 0 ? [] : _ref3$results;
- let exists = false;
- let averageScore = -1;
- let numTextMatches = 0;
+ // Check if the texvaluet can be searched
+ if (value === undefined || value === null) {
+ return;
+ }
- if (typeof value === 'string') {
- this._log(`\nKey: ${key === '' ? '-' : key}`);
+ var exists = false;
+ var averageScore = -1;
+ var numTextMatches = 0;
- let mainSearchResult = fullSearcher.search(value);
+ if (typeof value === 'string') {
+ this._log("\nKey: ".concat(key === '' ? '-' : key));
- this._log(`Full text: "${value}", score: ${mainSearchResult.score}`);
+ var mainSearchResult = fullSearcher.search(value);
- if (this.options.tokenize) {
- let words = value.split(this.options.tokenSeparator);
- let scores = [];
+ this._log("Full text: \"".concat(value, "\", score: ").concat(mainSearchResult.score));
- for (let i = 0; i < tokenSearchers.length; i += 1) {
- let tokenSearcher = tokenSearchers[i];
+ if (this.options.tokenize) {
+ var words = value.split(this.options.tokenSeparator);
+ var scores = [];
- this._log(`\nPattern: "${tokenSearcher.pattern}"`); // let tokenScores = []
+ for (var i = 0; i < tokenSearchers.length; i += 1) {
+ var tokenSearcher = tokenSearchers[i];
+
+ this._log("\nPattern: \"".concat(tokenSearcher.pattern, "\"")); // let tokenScores = []
- let hasMatchInText = false;
+ var hasMatchInText = false;
- for (let j = 0; j < words.length; j += 1) {
- let word = words[j];
- let tokenSearchResult = tokenSearcher.search(word);
- let obj = {};
+ for (var j = 0; j < words.length; j += 1) {
+ var word = words[j];
+ var tokenSearchResult = tokenSearcher.search(word);
+ var obj = {};
- if (tokenSearchResult.isMatch) {
- obj[word] = tokenSearchResult.score;
- exists = true;
- hasMatchInText = true;
- scores.push(tokenSearchResult.score);
- } else {
- obj[word] = 1;
+ if (tokenSearchResult.isMatch) {
+ obj[word] = tokenSearchResult.score;
+ exists = true;
+ hasMatchInText = true;
+ scores.push(tokenSearchResult.score);
+ } else {
+ obj[word] = 1;
- if (!this.options.matchAllTokens) {
- scores.push(1);
+ if (!this.options.matchAllTokens) {
+ scores.push(1);
+ }
}
+
+ this._log("Token: \"".concat(word, "\", score: ").concat(obj[word])); // tokenScores.push(obj)
+
}
- this._log(`Token: "${word}", score: ${obj[word]}`); // tokenScores.push(obj)
-
+ if (hasMatchInText) {
+ numTextMatches += 1;
+ }
}
- if (hasMatchInText) {
- numTextMatches += 1;
+ averageScore = scores[0];
+ var scoresLen = scores.length;
+
+ for (var _i2 = 1; _i2 < scoresLen; _i2 += 1) {
+ averageScore += scores[_i2];
}
+
+ averageScore = averageScore / scoresLen;
+
+ this._log('Token score average:', averageScore);
}
- averageScore = scores[0];
- let scoresLen = scores.length;
+ var finalScore = mainSearchResult.score;
- for (let i = 1; i < scoresLen; i += 1) {
- averageScore += scores[i];
+ if (averageScore > -1) {
+ finalScore = (finalScore + averageScore) / 2;
}
- averageScore = averageScore / scoresLen;
+ this._log('Score average:', finalScore);
- this._log('Token score average:', averageScore);
- }
+ var checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true;
- let finalScore = mainSearchResult.score;
-
- if (averageScore > -1) {
- finalScore = (finalScore + averageScore) / 2;
- }
-
- this._log('Score average:', finalScore);
-
- let checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true;
-
- this._log(`\nCheck Matches: ${checkTextMatches}`); // If a match is found, add the item to , including its score
+ this._log("\nCheck Matches: ".concat(checkTextMatches)); // If a match is found, add the item to , including its score
- if ((exists || mainSearchResult.isMatch) && checkTextMatches) {
- // Check if the item already exists in our results
- let existingResult = resultMap[index];
+ if ((exists || mainSearchResult.isMatch) && checkTextMatches) {
+ // Check if the item already exists in our results
+ var existingResult = resultMap[index];
- if (existingResult) {
- // Use the lowest score
- // existingResult.score, bitapResult.score
- existingResult.output.push({
- key,
- arrayIndex,
- value,
- score: finalScore,
- matchedIndices: mainSearchResult.matchedIndices
- });
- } else {
- // Add it to the raw result list
- resultMap[index] = {
- item: record,
- output: [{
- key,
- arrayIndex,
- value,
+ if (existingResult) {
+ // Use the lowest score
+ // existingResult.score, bitapResult.score
+ existingResult.output.push({
+ key: key,
+ arrayIndex: arrayIndex,
+ value: value,
score: finalScore,
matchedIndices: mainSearchResult.matchedIndices
- }]
- };
- results.push(resultMap[index]);
+ });
+ } else {
+ // Add it to the raw result list
+ resultMap[index] = {
+ item: record,
+ output: [{
+ key: key,
+ arrayIndex: arrayIndex,
+ value: value,
+ score: finalScore,
+ matchedIndices: mainSearchResult.matchedIndices
+ }]
+ };
+ results.push(resultMap[index]);
+ }
+ }
+ } else if (isArray(value)) {
+ for (var _i3 = 0, len = value.length; _i3 < len; _i3 += 1) {
+ this._analyze({
+ key: key,
+ arrayIndex: _i3,
+ value: value[_i3],
+ record: record,
+ index: index
+ }, {
+ resultMap: resultMap,
+ results: results,
+ tokenSearchers: tokenSearchers,
+ fullSearcher: fullSearcher
+ });
}
}
- } else if (isArray(value)) {
- for (let i = 0, len = value.length; i < len; i += 1) {
- this._analyze({
- key,
- arrayIndex: i,
- value: value[i],
- record,
- index
- }, {
- resultMap,
- results,
- tokenSearchers,
- fullSearcher
+ }
+ }, {
+ key: "_computeScore",
+ value: function _computeScore(weights, results) {
+ this._log('\n\nComputing score:\n');
+
+ for (var i = 0, len = results.length; i < len; i += 1) {
+ var output = results[i].output;
+ var scoreLen = output.length;
+ var currScore = 1;
+ var bestScore = 1;
+
+ for (var j = 0; j < scoreLen; j += 1) {
+ var weight = weights ? weights[output[j].key].weight : 1;
+ var score = weight === 1 ? output[j].score : output[j].score || 0.001;
+ var nScore = score * weight;
+
+ if (weight !== 1) {
+ bestScore = Math.min(bestScore, nScore);
+ } else {
+ output[j].nScore = nScore;
+ currScore *= nScore;
+ }
+ }
+
+ results[i].score = bestScore === 1 ? currScore : bestScore;
+
+ this._log(results[i]);
+ }
+ }
+ }, {
+ key: "_sort",
+ value: function _sort(results) {
+ this._log('\n\nSorting....');
+
+ results.sort(this.options.sortFn);
+ }
+ }, {
+ key: "_format",
+ value: function _format(results) {
+ var finalOutput = [];
+
+ if (this.options.verbose) {
+ var cache = [];
+
+ this._log('\n\nOutput:\n\n', JSON.stringify(results, function (key, value) {
+ if (_typeof(value) === 'object' && value !== null) {
+ if (cache.indexOf(value) !== -1) {
+ // Circular reference found, discard key
+ return;
+ } // Store value in our collection
+
+
+ cache.push(value);
+ }
+
+ return value;
+ }));
+
+ cache = null;
+ }
+
+ var transformers = [];
+
+ if (this.options.includeMatches) {
+ transformers.push(function (result, data) {
+ var output = result.output;
+ data.matches = [];
+
+ for (var i = 0, len = output.length; i < len; i += 1) {
+ var item = output[i];
+
+ if (item.matchedIndices.length === 0) {
+ continue;
+ }
+
+ var obj = {
+ indices: item.matchedIndices,
+ value: item.value
+ };
+
+ if (item.key) {
+ obj.key = item.key;
+ }
+
+ if (item.hasOwnProperty('arrayIndex') && item.arrayIndex > -1) {
+ obj.arrayIndex = item.arrayIndex;
+ }
+
+ data.matches.push(obj);
+ }
});
}
- }
- }
- _computeScore(weights, results) {
- this._log('\n\nComputing score:\n');
-
- for (let i = 0, len = results.length; i < len; i += 1) {
- const output = results[i].output;
- const scoreLen = output.length;
- let currScore = 1;
- let bestScore = 1;
-
- for (let j = 0; j < scoreLen; j += 1) {
- let weight = weights ? weights[output[j].key].weight : 1;
- let score = weight === 1 ? output[j].score : output[j].score || 0.001;
- let nScore = score * weight;
-
- if (weight !== 1) {
- bestScore = Math.min(bestScore, nScore);
- } else {
- output[j].nScore = nScore;
- currScore *= nScore;
- }
+ if (this.options.includeScore) {
+ transformers.push(function (result, data) {
+ data.score = result.score;
+ });
}
- results[i].score = bestScore === 1 ? currScore : bestScore;
+ for (var i = 0, len = results.length; i < len; i += 1) {
+ var result = results[i];
- this._log(results[i]);
- }
- }
-
- _sort(results) {
- this._log('\n\nSorting....');
-
- results.sort(this.options.sortFn);
- }
-
- _format(results) {
- const finalOutput = [];
-
- if (this.options.verbose) {
- let cache = [];
-
- this._log('\n\nOutput:\n\n', JSON.stringify(results, function (key, value) {
- if (typeof value === 'object' && value !== null) {
- if (cache.indexOf(value) !== -1) {
- // Circular reference found, discard key
- return;
- } // Store value in our collection
-
-
- cache.push(value);
+ if (this.options.id) {
+ result.item = this.options.getFn(result.item, this.options.id)[0];
}
- return value;
- }));
-
- cache = null;
- }
-
- let transformers = [];
-
- if (this.options.includeMatches) {
- transformers.push((result, data) => {
- const output = result.output;
- data.matches = [];
-
- for (let i = 0, len = output.length; i < len; i += 1) {
- let item = output[i];
-
- if (item.matchedIndices.length === 0) {
- continue;
- }
-
- let obj = {
- indices: item.matchedIndices,
- value: item.value
- };
-
- if (item.key) {
- obj.key = item.key;
- }
-
- if (item.hasOwnProperty('arrayIndex') && item.arrayIndex > -1) {
- obj.arrayIndex = item.arrayIndex;
- }
-
- data.matches.push(obj);
+ if (!transformers.length) {
+ finalOutput.push(result.item);
+ continue;
}
- });
- }
- if (this.options.includeScore) {
- transformers.push((result, data) => {
- data.score = result.score;
- });
- }
+ var data = {
+ item: result.item
+ };
- for (let i = 0, len = results.length; i < len; i += 1) {
- const result = results[i];
+ for (var j = 0, _len2 = transformers.length; j < _len2; j += 1) {
+ transformers[j](result, data);
+ }
- if (this.options.id) {
- result.item = this.options.getFn(result.item, this.options.id)[0];
+ finalOutput.push(data);
}
- if (!transformers.length) {
- finalOutput.push(result.item);
- continue;
- }
-
- const data = {
- item: result.item
- };
-
- for (let j = 0, len = transformers.length; j < len; j += 1) {
- transformers[j](result, data);
- }
-
- finalOutput.push(data);
+ return finalOutput;
}
+ }, {
+ key: "_log",
+ value: function _log() {
+ if (this.options.verbose) {
+ var _console;
- return finalOutput;
- }
-
- _log() {
- if (this.options.verbose) {
- console.log(...arguments);
+ (_console = console).log.apply(_console, arguments);
+ }
}
- }
+ }]);
-}
+ return Fuse;
+}();
module.exports = Fuse;
diff --git a/public/assets/scripts/choices.min.js b/public/assets/scripts/choices.min.js
index 05a72bc..14790a5 100644
--- a/public/assets/scripts/choices.min.js
+++ b/public/assets/scripts/choices.min.js
@@ -1,7 +1,7 @@
-/*! choices.js v5.0.0 | (c) 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Choices=t():e.Choices=t()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/public/assets/scripts/",n(n.s=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.doKeysMatch=t.cloneObject=t.existsInArray=t.isIE11=t.fetchFromObject=t.reduceToValues=t.getWindowHeight=t.regexFilter=t.dispatchEvent=t.sortByScore=t.sortByAlpha=t.calcWidthOfInput=t.strToEl=t.stripHTML=t.isScrolledIntoView=t.getAdjacentEl=t.findAncestorByAttrName=t.findAncestor=t.wrap=t.extend=t.isElement=t.isType=t.getType=t.generateId=t.generateChars=t.getRandomNumber=void 0;var i=function(e,t){return Math.floor(Math.random()*(t-e)+e)};t.getRandomNumber=i;var r=function(e){for(var t="",n=0;n2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var i=e.parentNode.parentNode,r=Array.from(i.querySelectorAll(t)),o=r.indexOf(e);return r[o+(n>0?1:-1)]}};t.isScrolledIntoView=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e)return n>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop};var a=function(e){return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/".concat(a(n),""));if(r.style.position="absolute",r.style.padding="0",r.style.top="-9999px",r.style.left="-9999px",r.style.width="auto",r.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var o=window.getComputedStyle(e);o&&(r.style.fontSize=o.fontSize,r.style.fontFamily=o.fontFamily,r.style.fontWeight=o.fontWeight,r.style.fontStyle=o.fontStyle,r.style.letterSpacing=o.letterSpacing,r.style.textTransform=o.textTransform,r.style.padding=o.padding)}document.body.appendChild(r),requestAnimationFrame(function(){n&&r.offsetWidth!==e.offsetWidth&&(i=r.offsetWidth+4),document.body.removeChild(r),t.call(void 0,"".concat(i,"px"))})}else t.call(void 0,"".concat(i,"px"))};t.sortByAlpha=function(e,t){var n=(e.label||e.value).toLowerCase(),i=(t.label||t.value).toLowerCase();return ni?1:0};t.sortByScore=function(e,t){return e.score-t.score};t.dispatchEvent=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0});return e.dispatchEvent(i)};t.regexFilter=function(e,t){return!(!e||!t)&&new RegExp(t.source,"i").test(e)};t.getWindowHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)};t.reduceToValues=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.reduce(function(e,n){return e.push(n[t]),e},[])};t.fetchFromObject=function e(t,n){var i=n.indexOf(".");return i>-1?e(t[n.substring(0,i)],n.substr(i+1)):t[n]};t.isIE11=function(){return!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/))};t.existsInArray=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value";return e.some(function(e){return s("String",t)?e[n]===t.trim():e[n]===t})};t.cloneObject=function(e){return JSON.parse(JSON.stringify(e))};t.doKeysMatch=function(e,t){var n=Object.keys(e).sort(),i=Object.keys(t).sort();return JSON.stringify(n)===JSON.stringify(i)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCROLLING_SPEED=t.KEY_CODES=t.ACTION_TYPES=t.EVENTS=t.DEFAULT_CONFIG=t.DEFAULT_CLASSNAMES=void 0;var i=n(0),r={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"};t.DEFAULT_CLASSNAMES=r;var o={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,removeItems:!0,removeItemButton:!1,editItems:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,regexFilter:null,shouldSort:!0,shouldSortItems:!1,sortFn:i.sortByAlpha,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",addItemText:function(e){return'Press Enter to add "'.concat((0,i.stripHTML)(e),'"')},maxItemText:function(e){return"Only ".concat(e," values can be added")},itemComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:r};t.DEFAULT_CONFIG=o;t.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"};t.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"};t.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34};t.SCROLLING_SPEED=4},function(e,t,n){"use strict";(function(e,i){var r,o=n(7);r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var s=Object(o.a)(r);t.a=s}).call(this,n(3),n(16)(e))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function r(e,t){for(var n=0;n\n \n '))},containerInner:function(e){return(0,o.strToEl)('\n \n '))},itemList:function(e,t){var n,i=(0,r.default)(e.list,(s(n={},e.listSingle,t),s(n,e.listItems,!t),n));return(0,o.strToEl)('\n \n '))},placeholder:function(e,t){return(0,o.strToEl)('\n \n ').concat(t,"\n
\n "))},item:function(e,t,n){var i,a,l=t.active?'aria-selected="true"':"",c=t.disabled?'aria-disabled="true"':"",u=(0,r.default)(e.item,(s(i={},e.highlightedState,t.highlighted),s(i,e.itemSelectable,!t.highlighted),s(i,e.placeholder,t.placeholder),i));return n?(u=(0,r.default)(e.item,(s(a={},e.highlightedState,t.highlighted),s(a,e.itemSelectable,!t.disabled),s(a,e.placeholder,t.placeholder),a)),(0,o.strToEl)('\n \n ").concat(t.label,'\x3c!--\n --\x3e\n
\n "))):(0,o.strToEl)('\n \n ").concat(t.label,"\n
\n "))},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return(0,o.strToEl)('\n \n
\n "))},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",i=(0,r.default)(e.group,s({},e.itemDisabled,t.disabled));return(0,o.strToEl)('\n \n "))},choice:function(e,t,n){var i,a=t.groupId>0?'role="treeitem"':'role="option"',l=(0,r.default)(e.item,e.itemChoice,(s(i={},e.itemDisabled,t.disabled),s(i,e.itemSelectable,!t.disabled),s(i,e.placeholder,t.placeholder),i));return(0,o.strToEl)('\n \n ").concat(t.label,"\n
\n "))},input:function(e){var t=(0,r.default)(e.input,e.inputCloned);return(0,o.strToEl)('\n \n '))},dropdown:function(e){var t=(0,r.default)(e.list,e.listDropdown);return(0,o.strToEl)('\n \n
\n '))},notice:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=(0,r.default)(e.item,e.itemChoice,(s(n={},e.noResults,"no-results"===i),s(n,e.noChoices,"no-choices"===i),n));return(0,o.strToEl)('\n \n ').concat(t,"\n
\n "))},option:function(e){return(0,o.strToEl)('\n \n "))}};t.TEMPLATES=a;var l=a;t.default=l},function(e,t,n){"use strict";n.r(t);var i=n(8),r="object"==typeof self&&self&&self.Object===Object&&self,o=(i.a||r||Function("return this")()).Symbol,s=Object.prototype,a=s.hasOwnProperty,l=s.toString,c=o?o.toStringTag:void 0;var u=function(e){var t=a.call(e,c),n=e[c];try{e[c]=void 0;var i=!0}catch(e){}var r=l.call(e);return i&&(t?e[c]=n:delete e[c]),r},h=Object.prototype.toString;var d=function(e){return h.call(e)},f="[object Null]",p="[object Undefined]",v=o?o.toStringTag:void 0;var m=function(e){return null==e?void 0===e?p:f:v&&v in Object(e)?u(e):d(e)};var g=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object);var _=function(e){return null!=e&&"object"==typeof e},y="[object Object]",b=Function.prototype,E=Object.prototype,S=b.toString,I=E.hasOwnProperty,O=S.call(Object);var C=function(e){if(!_(e)||m(e)!=y)return!1;var t=g(e);if(null===t)return!0;var n=I.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&S.call(n)==O},T=n(2),w={INIT:"@@redux/INIT"};function A(e,t,n){var i;if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(A)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var r=e,o=t,s=[],a=s,l=!1;function c(){a===s&&(a=s.slice())}function u(){return o}function h(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return c(),a.push(e),function(){if(t){t=!1,c();var n=a.indexOf(e);a.splice(n,1)}}}function d(e){if(!C(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,o=r(o,e)}finally{l=!1}for(var t=s=a,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var i=!1,r={},a=0;a0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,p.isType)("String",t)){var i=Array.from(document.querySelectorAll(t));if(i.length>1)return this._generateInstances(i,n)}this.config=r.default.all([a.DEFAULT_CONFIG,e.userDefaults,n],{arrayMerge:function(e,t){return[].concat(t)}}),(0,p.doKeysMatch)(this.config,a.DEFAULT_CONFIG)||console.warn("Unknown config option(s) passed"),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto");var l=(0,p.isType)("String",t)?document.querySelector(t):t;return l?(this._isTextElement="text"===l.type,this._isSelectOneElement="select-one"===l.type,this._isSelectMultipleElement="select-multiple"===l.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new s.WrappedInput({element:l,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new s.WrappedSelect({element:l,classNames:this.config.classNames})),this.passedElement?(!0===this.config.shouldSortItems&&this._isSelectOneElement&&!this.config.silent&&console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."),this.initialised=!1,this._store=new o.default(this.render),this._initialState={},this._currentState={},this._prevState={},this._currentValue="",this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=(0,p.generateId)(this.passedElement.element,"choices-"),this._direction=this.passedElement.element.getAttribute("dir")||"ltr",this._idNames={itemChoice:"item-choice"},this._presetChoices=this.config.choices,this._presetItems=this.config.items,this.passedElement.value&&(this._presetItems=this._presetItems.concat(this.passedElement.value.split(this.config.delimiter))),this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onAKey=this._onAKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),"active"===this.passedElement.element.getAttribute("data-choice")&&console.warn("Trying to initialise Choices on element already initialised"),void this.init()):console.error("Passed element was of an invalid type")):console.error("Could not find passed element or passed element was of an invalid type")}var t,n,v;return t=e,(n=[{key:"init",value:function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=(0,p.cloneObject)(this._store.state),this._store.subscribe(this._render),this._render(),this._addEventListeners(),(!this.config.addItems||this.passedElement.element.hasAttribute("disabled"))&&this.disable(),this.initialised=!0;var e=this.config.callbackOnInit;e&&(0,p.isType)("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._isSelectElement&&(this.passedElement.options=this._presetChoices),this.clearStore(),this.config.templates=null,this.initialised=!1)}},{key:"enable",value:function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this}},{key:"disable",value:function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var n=e.id,i=e.groupId,r=void 0===i?-1:i,o=e.value,s=void 0===o?"":o,l=e.label,c=void 0===l?"":l,h=r>=0?this._store.getGroupById(r):null;return this._store.dispatch((0,u.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:n,value:s,label:c,groupValue:h&&h.value?h.value:null}),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,n=e.groupId,i=void 0===n?-1:n,r=e.value,o=void 0===r?"":r,s=e.label,l=void 0===s?"":s,c=i>=0?this._store.getGroupById(i):null;return this._store.dispatch((0,u.highlightItem)(t,!1)),this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:t,value:o,label:l,groupValue:c&&c.value?c.value:null}),this}},{key:"highlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.unhighlightItem(t)}),this}},{key:"removeActiveItemsByValue",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.value===e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeActiveItems",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.id!==e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._store.highlightedActiveItems.forEach(function(n){e._removeItem(n),t&&e._triggerChange(n.value)}),this}},{key:"showDropdown",value:function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame(function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow()),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(a.EVENTS.showDropdown,{})}),this)}},{key:"hideDropdown",value:function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(a.EVENTS.hideDropdown,{})}),this):this}},{key:"toggleDropdown",value:function(){return this.dropdown.isActive?this.hideDropdown():this.showDropdown(),this}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this._store.activeItems.reduce(function(t,n){var i=e?n.value:n;return t.push(i),t},[]);return this._isSelectOneElement?t[0]:t}},{key:"setValue",value:function(e){var t=this;return this.initialised?([].concat(e).forEach(function(e){return t._setChoiceOrItem(e)}),this):this}},{key:"setChoiceByValue",value:function(e){var t=this;return!this.initialised||this._isTextElement?this:(((0,p.isType)("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._isSelectElement||!t.length||!n)return this;r&&this._clearChoices(),this.containerOuter.removeLoadingState();return this._setLoading(!0),t.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:t[n],label:t[i],isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),this._setLoading(!1),this}},{key:"clearStore",value:function(){return this._store.dispatch((0,d.clearAll)()),this}},{key:"clearInput",value:function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0))),this}},{key:"ajax",value:function(e){var t=this;return this.initialised&&this._isSelectElement&&e?(requestAnimationFrame(function(){return t._handleLoadingState(!0)}),e(this._ajaxCallback()),this):this}},{key:"_render",value:function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,n=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),n&&this._renderItems(),this._prevState=this._currentState)}}},{key:"_renderChoices",value:function(){var e=this,t=this._store,n=t.activeGroups,i=t.activeChoices,r=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),n.length>=1&&!this._isSearching){var o=i.filter(function(e){return!0===e.placeholder&&-1===e.groupId});o.length>=1&&(r=this._createChoicesFragment(o,r)),r=this._createGroupsFragment(n,i,r)}else i.length>=1&&(r=this._createChoicesFragment(i,r));if(r.childNodes&&r.childNodes.length>0){var s=this._store.activeItems,a=this._canAddItem(s,this.input.value);a.response?(this.choiceList.append(r),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",a.notice))}else{var l,c;this._isSearching?(c=(0,p.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,l=this._getTemplate("notice",c,"no-results")):(c=(0,p.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,l=this._getTemplate("notice",c,"no-choices")),this.choiceList.append(l)}}},{key:"_renderItems",value:function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)}},{key:"_createGroupsFragment",value:function(e,t,n){var i=this,r=n||document.createDocumentFragment();return this.config.shouldSort&&e.sort(this.config.sortFn),e.forEach(function(e){var n=function(e){return t.filter(function(t){return i._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===i.config.renderSelectedChoices||!t.selected)})}(e);if(n.length>=1){var o=i._getTemplate("choiceGroup",e);r.appendChild(o),i._createChoicesFragment(n,r,!0)}}),r}},{key:"_createChoicesFragment",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t||document.createDocumentFragment(),o=this.config,s=o.renderSelectedChoices,a=o.searchResultLimit,l=o.renderChoiceLimit,c=this._isSearching?p.sortByScore:this.config.sortFn,u=function(e){if("auto"!==s||(n._isSelectOneElement||!e.selected)){var t=n._getTemplate("choice",e,n.config.itemSelectText);r.appendChild(t)}},h=e;"auto"!==s||this._isSelectOneElement||(h=e.filter(function(e){return!e.selected}));var d=h.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),f=d.placeholderChoices,v=d.normalChoices;(this.config.shouldSort||this._isSearching)&&v.sort(c);var m=h.length,g=[].concat(f,v);this._isSearching?m=a:l>0&&!i&&(m=l);for(var _=0;_1&&void 0!==arguments[1]?arguments[1]:null,i=this.config,r=i.shouldSortItems,o=i.sortFn,s=i.removeItemButton,a=n||document.createDocumentFragment();r&&!this._isSelectOneElement&&e.sort(o),this._isTextElement?this.passedElement.value=e:this.passedElement.options=e;return e.forEach(function(e){return function(e){var n=t._getTemplate("item",e,s);a.appendChild(n)}(e)}),a}},{key:"_triggerChange",value:function(e){null!=e&&this.passedElement.triggerEvent(a.EVENTS.change,{value:e})}},{key:"_selectPlaceholderChoice",value:function(){var e=this._store.placeholderChoice;e&&(this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder}),this._triggerChange(e.value))}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var n=t.parentNode.getAttribute("data-id"),i=e.find(function(e){return e.id===parseInt(n,10)});this._removeItem(i),this._triggerChange(i.value),this._isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_handleItemAction",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this._isSelectOneElement){var r=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(r,10)||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)}),this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var n=t.getAttribute("data-id"),i=this._store.getChoiceById(n),r=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.isActive;if(i.keyCode=r,this.passedElement.triggerEvent(a.EVENTS.choice,{choice:i}),i&&!i.selected&&!i.disabled)this._canAddItem(e,i.value).response&&(this._addItem({value:i.value,label:i.label,choiceId:i.id,groupId:i.groupId,customProperties:i.customProperties,placeholder:i.placeholder,keyCode:i.keyCode}),this._triggerChange(i.value));this.clearInput(),o&&this._isSelectOneElement&&(this.hideDropdown(!0),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],n=e.some(function(e){return e.highlighted});this.config.editItems&&!n&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_setLoading",value:function(e){this._store.dispatch((0,f.setIsLoading)(e))}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild(".".concat(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t.innerHTML=this._placeholderValue||"":this.input.placeholder=this._placeholderValue||"")}},{key:"_handleSearch",value:function(e){if(e&&this.input.isFocussed){var t=this._store.choices,n=this.config,i=n.searchFloor,r=n.searchChoices,o=t.some(function(e){return!e.active});if(e&&e.length>=i){var s=r?this._searchChoices(e):0;this.passedElement.triggerEvent(a.EVENTS.search,{value:e,resultCount:s})}else o&&(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0)))}}},{key:"_canAddItem",value:function(e,t){var n=!0,i=(0,p.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=(0,p.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=(0,p.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.config.regexFilter&&this._isTextElement&&this.config.addItems&&n&&(n=(0,p.regexFilter)(t,this.config.regexFilter)),!this.config.duplicateItemsAllowed&&r&&n&&(n=!1,i=(0,p.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText)}return{response:n,notice:i}}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,n,i){if(t&&n){var r=(0,p.isType)("Object",t)?[t]:t;r&&(0,p.isType)("Array",r)&&r.length?(e._handleLoadingState(!1),e._setLoading(!0),r.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:(0,p.fetchFromObject)(t,n),label:(0,p.fetchFromObject)(t,i),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),e._setLoading(!1),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=(0,p.isType)("String",e)?e.trim():e,n=(0,p.isType)("String",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(n," "))return 0;var r=this._store.searchableChoices,o=t,s=[].concat(this.config.searchFields),a=Object.assign(this.config.fuseOptions,{keys:s}),l=new i.default(r,a).search(o);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,c.filterChoices)(l)),l.length}},{key:"_addEventListeners",value:function(){document.addEventListener("keyup",this._onKeyUp),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("click",this._onClick),document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),document.addEventListener("mousedown",this._onMouseDown),document.addEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus),this.containerOuter.element.addEventListener("blur",this._onBlur)),this.input.element.addEventListener("focus",this._onFocus),this.input.element.addEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset),this.input.addEventListeners()}},{key:"_removeEventListeners",value:function(){document.removeEventListener("keyup",this._onKeyUp),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("click",this._onClick),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),document.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()}},{key:"_onKeyDown",value:function(e){var t,n=e.target,i=e.keyCode,r=e.ctrlKey,o=e.metaKey;if(n===this.input.element||this.containerOuter.element.contains(n)){var s=this._store.activeItems,l=this.input.isFocussed,c=this.dropdown.isActive,u=this.itemList.hasChildren,h=String.fromCharCode(i),d=a.KEY_CODES.BACK_KEY,f=a.KEY_CODES.DELETE_KEY,p=a.KEY_CODES.ENTER_KEY,v=a.KEY_CODES.A_KEY,g=a.KEY_CODES.ESC_KEY,_=a.KEY_CODES.UP_KEY,y=a.KEY_CODES.DOWN_KEY,b=a.KEY_CODES.PAGE_UP_KEY,E=a.KEY_CODES.PAGE_DOWN_KEY,S=r||o;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var I=(m(t={},v,this._onAKey),m(t,p,this._onEnterKey),m(t,g,this._onEscapeKey),m(t,_,this._onDirectionKey),m(t,b,this._onDirectionKey),m(t,y,this._onDirectionKey),m(t,E,this._onDirectionKey),m(t,f,this._onDeleteKey),m(t,d,this._onDeleteKey),t);I[i]&&I[i]({event:e,target:n,keyCode:i,metaKey:o,activeItems:s,hasFocusedInput:l,hasActiveDropdown:c,hasItems:u,hasCtrlDownKeyPressed:S})}}},{key:"_onKeyUp",value:function(e){var t=e.target,n=e.keyCode;if(t===this.input.element){var i=this.input.value,r=this._store.activeItems,o=this._canAddItem(r,i);if(this._isTextElement)if(i){if(o.notice){var s=this._getTemplate("notice",o.notice);this.dropdown.element.innerHTML=s.outerHTML}!0===o.response?this.showDropdown(!0):o.notice||this.hideDropdown(!0)}else this.hideDropdown(!0);else{var l=a.KEY_CODES.BACK_KEY,u=a.KEY_CODES.DELETE_KEY;n!==l&&n!==u||t.value?this._canSearch&&o.response&&this._handleSearch(this.input.value):!this._isTextElement&&this._isSearching&&(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0)))}this._canSearch=this.config.searchEnabled}}},{key:"_onAKey",value:function(e){var t=e.hasItems;e.hasCtrlDownKeyPressed&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())}},{key:"_onEnterKey",value:function(e){var t=e.event,n=e.target,i=e.activeItems,r=e.hasActiveDropdown,o=a.KEY_CODES.ENTER_KEY;if(this._isTextElement&&n.value){var s=this.input.value;this._canAddItem(i,s).response&&(this.hideDropdown(!0),this._addItem({value:s}),this._triggerChange(s),this.clearInput())}if(n.hasAttribute("data-button")&&(this._handleButtonAction(i,n),t.preventDefault()),r){var l=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));l&&(i[0]&&(i[0].keyCode=o),this._handleChoiceAction(i,l)),t.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),t.preventDefault())}},{key:"_onEscapeKey",value:function(e){e.hasActiveDropdown&&(this.hideDropdown(!0),this.containerOuter.focus())}},{key:"_onDirectionKey",value:function(e){var t=e.event,n=e.hasActiveDropdown,i=e.keyCode,r=e.metaKey,o=a.KEY_CODES.DOWN_KEY,s=a.KEY_CODES.PAGE_UP_KEY,l=a.KEY_CODES.PAGE_DOWN_KEY;if(n||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c,u=i===o||i===l?1:-1;if(r||i===l||i===s)c=u>0?Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():this.dropdown.element.querySelector("[data-choice-selectable]");else{var h=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));c=h?(0,p.getAdjacentEl)(h,"[data-choice-selectable]",u):this.dropdown.element.querySelector("[data-choice-selectable]")}c&&((0,p.isScrolledIntoView)(c,this.choiceList.element,u)||this.choiceList.scrollToChoice(c,u),this._highlightChoice(c)),t.preventDefault()}}},{key:"_onDeleteKey",value:function(e){var t=e.event,n=e.target,i=e.hasFocusedInput,r=e.activeItems;!i||n.value||this._isSelectOneElement||(this._handleBackspace(r),t.preventDefault())}},{key:"_onTouchMove",value:function(){!0===this._wasTap&&(this._wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=e.target||e.touches[0].target;!0===this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&!this._isSelectOneElement&&(this._isTextElement?this.input.focus():this.showDropdown()),e.stopPropagation());this._wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target,n=e.shiftKey;if(t===this.choiceList&&(0,p.isIE11)()&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var i=this._store.activeItems,r=n,o=(0,p.findAncestorByAttrName)(t,"data-button"),s=(0,p.findAncestorByAttrName)(t,"data-item"),a=(0,p.findAncestorByAttrName)(t,"data-choice");o?this._handleButtonAction(i,o):s?this._handleItemAction(i,s,r):a&&this._handleChoiceAction(i,a),e.preventDefault()}}},{key:"_onMouseOver",value:function(e){var t=e.target;(t===this.dropdown||this.dropdown.element.contains(t))&&t.hasAttribute("data-choice")&&this._highlightChoice(t)}},{key:"_onClick",value:function(e){var t=e.target;this.containerOuter.element.contains(t)?this.dropdown.isActive||this.containerOuter.isDisabled?this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),this.containerOuter.focus()):(this._store.highlightedActiveItems&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))}},{key:"_onFocus",value:function(e){var t=this,n=e.target;this.containerOuter.element.contains(n)&&{text:function(){n===t.input.element&&t.containerOuter.addFocusState()},"select-one":function(){t.containerOuter.addFocusState(),n===t.input.element&&t.showDropdown(!0)},"select-multiple":function(){n===t.input.element&&(t.showDropdown(!0),t.containerOuter.addFocusState())}}[this.passedElement.element.type]()}},{key:"_onBlur",value:function(e){var t=this,n=e.target;if(this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var i=this._store.activeItems.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),i&&t.unhighlightAll(),t.hideDropdown(!0))},"select-one":function(){t.containerOuter.removeFocusState(),(n===t.input.element||n===t.containerOuter.element&&!t._canSearch)&&t.hideDropdown(!0)},"select-multiple":function(){n===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(!0),i&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()}},{key:"_onFormReset",value:function(){this._store.dispatch((0,d.resetTo)(this._initialState))}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var i=t;Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))).forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),i?this._highlightPosition=n.indexOf(i):(i=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(i=n[0]),i.classList.add(this.config.classNames.highlightedState),i.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(a.EVENTS.highlightChoice,{el:i}),this.dropdown.isActive&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}}},{key:"_addItem",value:function(e){var t=e.value,n=e.label,i=void 0===n?null:n,r=e.choiceId,o=void 0===r?-1:r,s=e.groupId,l=void 0===s?-1:s,c=e.customProperties,h=void 0===c?null:c,d=e.placeholder,f=void 0!==d&&d,v=e.keyCode,m=void 0===v?null:v,g=(0,p.isType)("String",t)?t.trim():t,_=m,y=h,b=this._store.items,E=i||g,S=parseInt(o,10)||-1,I=l>=0?this._store.getGroupById(l):null,O=b?b.length+1:1;return this.config.prependValue&&(g=this.config.prependValue+g.toString()),this.config.appendValue&&(g+=this.config.appendValue.toString()),this._store.dispatch((0,u.addItem)({value:g,label:E,id:O,choiceId:S,groupId:l,customProperties:h,placeholder:f,keyCode:_})),this._isSelectOneElement&&this.removeActiveItems(O),this.passedElement.triggerEvent(a.EVENTS.addItem,{id:O,value:g,label:E,customProperties:y,groupValue:I&&I.value?I.value:void 0,keyCode:_}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,p.isType)("Object",e))return this;var t=e.id,n=e.value,i=e.label,r=e.choiceId,o=e.groupId,s=o>=0?this._store.getGroupById(o):null;return this._store.dispatch((0,u.removeItem)(t,r)),s&&s.value?this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:n,label:i,groupValue:s.value}):this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:n,label:i}),this}},{key:"_addChoice",value:function(e){var t=e.value,n=e.label,i=void 0===n?null:n,r=e.isSelected,o=void 0!==r&&r,s=e.isDisabled,a=void 0!==s&&s,l=e.groupId,u=void 0===l?-1:l,h=e.customProperties,d=void 0===h?null:h,f=e.placeholder,p=void 0!==f&&f,v=e.keyCode,m=void 0===v?null:v;if(null!=t){var g=this._store.choices,_=i||t,y=g?g.length+1:1,b="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(y);this._store.dispatch((0,c.addChoice)({value:t,label:_,id:y,groupId:u,disabled:a,elementId:b,customProperties:d,placeholder:p,keyCode:m})),o&&this._addItem({value:t,label:_,choiceId:y,customProperties:d,placeholder:p,keyCode:m})}}},{key:"_clearChoices",value:function(){this._store.dispatch((0,c.clearChoices)())}},{key:"_addGroup",value:function(e){var t=this,n=e.group,i=e.id,r=e.valueKey,o=void 0===r?"value":r,s=e.labelKey,a=void 0===s?"label":s,l=(0,p.isType)("Object",n)?n.choices:Array.from(n.getElementsByTagName("OPTION")),c=i||Math.floor((new Date).valueOf()*Math.random()),u=!!n.disabled&&n.disabled;if(l){this._store.dispatch((0,h.addGroup)(n.label,c,!0,u));l.forEach(function(e){var n=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[o],label:(0,p.isType)("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:n,groupId:c,customProperties:e.customProperties,placeholder:e.placeholder})})}else this._store.dispatch((0,h.addGroup)(n.label,n.id,!1,n.disabled))}},{key:"_getTemplate",value:function(e){var t;if(!e)return null;for(var n=this.config,i=n.templates,r=n.classNames,o=arguments.length,s=new Array(o>1?o-1:0),a=1;a2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var i=e.parentNode.parentNode,r=Array.from(i.querySelectorAll(t)),o=r.indexOf(e);return r[o+(n>0?1:-1)]}};t.isScrolledIntoView=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e)return n>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop};var a=function(e){return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/".concat(a(n),""));if(r.style.position="absolute",r.style.padding="0",r.style.top="-9999px",r.style.left="-9999px",r.style.width="auto",r.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var o=window.getComputedStyle(e);o&&(r.style.fontSize=o.fontSize,r.style.fontFamily=o.fontFamily,r.style.fontWeight=o.fontWeight,r.style.fontStyle=o.fontStyle,r.style.letterSpacing=o.letterSpacing,r.style.textTransform=o.textTransform,r.style.padding=o.padding)}document.body.appendChild(r),requestAnimationFrame(function(){n&&r.offsetWidth!==e.offsetWidth&&(i=r.offsetWidth+4),document.body.removeChild(r),t.call(void 0,"".concat(i,"px"))})}else t.call(void 0,"".concat(i,"px"))};t.sortByAlpha=function(e,t){var n=(e.label||e.value).toLowerCase(),i=(t.label||t.value).toLowerCase();return ni?1:0};t.sortByScore=function(e,t){return e.score-t.score};t.dispatchEvent=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0});return e.dispatchEvent(i)};t.regexFilter=function(e,t){return!(!e||!t)&&new RegExp(t.source,"i").test(e)};t.getWindowHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)};t.reduceToValues=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value";return e.reduce(function(e,n){return e.push(n[t]),e},[])};t.fetchFromObject=function e(t,n){var i=n.indexOf(".");return i>-1?e(t[n.substring(0,i)],n.substr(i+1)):t[n]};t.isIE11=function(){return!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/))};t.existsInArray=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value";return e.some(function(e){return s("String",t)?e[n]===t.trim():e[n]===t})};t.cloneObject=function(e){return JSON.parse(JSON.stringify(e))};t.doKeysMatch=function(e,t){var n=Object.keys(e).sort(),i=Object.keys(t).sort();return JSON.stringify(n)===JSON.stringify(i)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCROLLING_SPEED=t.KEY_CODES=t.ACTION_TYPES=t.EVENTS=t.DEFAULT_CONFIG=t.DEFAULT_CLASSNAMES=void 0;var i=n(0),r={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"};t.DEFAULT_CLASSNAMES=r;var o={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,removeItems:!0,removeItemButton:!1,editItems:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,regexFilter:null,shouldSort:!0,shouldSortItems:!1,sortFn:i.sortByAlpha,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",uniqueItemText:"Only unique values can be added",addItemText:function(e){return'Press Enter to add "'.concat((0,i.stripHTML)(e),'"')},maxItemText:function(e){return"Only ".concat(e," values can be added")},itemComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:r};t.DEFAULT_CONFIG=o;t.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"};t.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"};t.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34};t.SCROLLING_SPEED=4},function(e,t,n){"use strict";(function(e,i){var r,o=n(7);r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var s=Object(o.a)(r);t.a=s}).call(this,n(3),n(16)(e))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function r(e,t){for(var n=0;n\n \n '))},containerInner:function(e){return(0,o.strToEl)('\n \n '))},itemList:function(e,t){var n,i=(0,r.default)(e.list,(s(n={},e.listSingle,t),s(n,e.listItems,!t),n));return(0,o.strToEl)('\n \n '))},placeholder:function(e,t){return(0,o.strToEl)('\n \n ').concat(t,"\n
\n "))},item:function(e,t,n){var i,a,c=t.active?'aria-selected="true"':"",l=t.disabled?'aria-disabled="true"':"",u=(0,r.default)(e.item,(s(i={},e.highlightedState,t.highlighted),s(i,e.itemSelectable,!t.highlighted),s(i,e.placeholder,t.placeholder),i));return n?(u=(0,r.default)(e.item,(s(a={},e.highlightedState,t.highlighted),s(a,e.itemSelectable,!t.disabled),s(a,e.placeholder,t.placeholder),a)),(0,o.strToEl)('\n \n ").concat(t.label,'\x3c!--\n --\x3e\n
\n "))):(0,o.strToEl)('\n \n ").concat(t.label,"\n
\n "))},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return(0,o.strToEl)('\n \n
\n "))},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",i=(0,r.default)(e.group,s({},e.itemDisabled,t.disabled));return(0,o.strToEl)('\n \n "))},choice:function(e,t,n){var i,a=t.groupId>0?'role="treeitem"':'role="option"',c=(0,r.default)(e.item,e.itemChoice,(s(i={},e.itemDisabled,t.disabled),s(i,e.itemSelectable,!t.disabled),s(i,e.placeholder,t.placeholder),i));return(0,o.strToEl)('\n \n ").concat(t.label,"\n
\n "))},input:function(e){var t=(0,r.default)(e.input,e.inputCloned);return(0,o.strToEl)('\n \n '))},dropdown:function(e){var t=(0,r.default)(e.list,e.listDropdown);return(0,o.strToEl)('\n \n
\n '))},notice:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=(0,r.default)(e.item,e.itemChoice,(s(n={},e.noResults,"no-results"===i),s(n,e.noChoices,"no-choices"===i),n));return(0,o.strToEl)('\n \n ').concat(t,"\n
\n "))},option:function(e){return(0,o.strToEl)('\n \n "))}};t.TEMPLATES=a;var c=a;t.default=c},function(e,t,n){"use strict";n.r(t);var i=n(8),r="object"==typeof self&&self&&self.Object===Object&&self,o=(i.a||r||Function("return this")()).Symbol,s=Object.prototype,a=s.hasOwnProperty,c=s.toString,l=o?o.toStringTag:void 0;var u=function(e){var t=a.call(e,l),n=e[l];try{e[l]=void 0;var i=!0}catch(e){}var r=c.call(e);return i&&(t?e[l]=n:delete e[l]),r},h=Object.prototype.toString;var d=function(e){return h.call(e)},f="[object Null]",p="[object Undefined]",v=o?o.toStringTag:void 0;var m=function(e){return null==e?void 0===e?p:f:v&&v in Object(e)?u(e):d(e)};var g=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object);var y=function(e){return null!=e&&"object"==typeof e},_="[object Object]",b=Function.prototype,E=Object.prototype,S=b.toString,I=E.hasOwnProperty,O=S.call(Object);var C=function(e){if(!y(e)||m(e)!=_)return!1;var t=g(e);if(null===t)return!0;var n=I.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&S.call(n)==O},w=n(2),T={INIT:"@@redux/INIT"};function k(e,t,n){var i;if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(k)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var r=e,o=t,s=[],a=s,c=!1;function l(){a===s&&(a=s.slice())}function u(){return o}function h(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return l(),a.push(e),function(){if(t){t=!1,l();var n=a.indexOf(e);a.splice(n,1)}}}function d(e){if(!C(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(c)throw new Error("Reducers may not dispatch actions.");try{c=!0,o=r(o,e)}finally{c=!1}for(var t=s=a,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var i=!1,r={},a=0;a0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,p.isType)("String",t)){var i=Array.from(document.querySelectorAll(t));if(i.length>1)return this._generateInstances(i,n)}this.config=r.default.all([a.DEFAULT_CONFIG,e.userDefaults,n],{arrayMerge:function(e,t){return[].concat(t)}}),(0,p.doKeysMatch)(this.config,a.DEFAULT_CONFIG)||console.warn("Unknown config option(s) passed"),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto");var c=(0,p.isType)("String",t)?document.querySelector(t):t;return c?(this._isTextElement="text"===c.type,this._isSelectOneElement="select-one"===c.type,this._isSelectMultipleElement="select-multiple"===c.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new s.WrappedInput({element:c,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new s.WrappedSelect({element:c,classNames:this.config.classNames})),this.passedElement?(!0===this.config.shouldSortItems&&this._isSelectOneElement&&!this.config.silent&&console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."),this.initialised=!1,this._store=new o.default(this.render),this._initialState={},this._currentState={},this._prevState={},this._currentValue="",this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=(0,p.generateId)(this.passedElement.element,"choices-"),this._direction=this.passedElement.element.getAttribute("dir")||"ltr",this._idNames={itemChoice:"item-choice"},this._presetChoices=this.config.choices,this._presetItems=this.config.items,this.passedElement.value&&(this._presetItems=this._presetItems.concat(this.passedElement.value.split(this.config.delimiter))),this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this._onFormReset=this._onFormReset.bind(this),this._onAKey=this._onAKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),"active"===this.passedElement.element.getAttribute("data-choice")&&console.warn("Trying to initialise Choices on element already initialised"),void this.init()):console.error("Passed element was of an invalid type")):console.error("Could not find passed element or passed element was of an invalid type")}var t,n,v;return t=e,(n=[{key:"init",value:function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=(0,p.cloneObject)(this._store.state),this._store.subscribe(this._render),this._render(),this._addEventListeners(),(!this.config.addItems||this.passedElement.element.hasAttribute("disabled"))&&this.disable(),this.initialised=!0;var e=this.config.callbackOnInit;e&&(0,p.isType)("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._isSelectElement&&(this.passedElement.options=this._presetChoices),this.clearStore(),this.config.templates=null,this.initialised=!1)}},{key:"enable",value:function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this}},{key:"disable",value:function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var n=e.id,i=e.groupId,r=void 0===i?-1:i,o=e.value,s=void 0===o?"":o,c=e.label,l=void 0===c?"":c,h=r>=0?this._store.getGroupById(r):null;return this._store.dispatch((0,u.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:n,value:s,label:l,groupValue:h&&h.value?h.value:null}),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,n=e.groupId,i=void 0===n?-1:n,r=e.value,o=void 0===r?"":r,s=e.label,c=void 0===s?"":s,l=i>=0?this._store.getGroupById(i):null;return this._store.dispatch((0,u.highlightItem)(t,!1)),this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:t,value:o,label:c,groupValue:l&&l.value?l.value:null}),this}},{key:"highlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.unhighlightItem(t)}),this}},{key:"removeActiveItemsByValue",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.value===e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeActiveItems",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.id!==e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._store.highlightedActiveItems.forEach(function(n){e._removeItem(n),t&&e._triggerChange(n.value)}),this}},{key:"showDropdown",value:function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame(function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow()),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(a.EVENTS.showDropdown,{})}),this)}},{key:"hideDropdown",value:function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(a.EVENTS.hideDropdown,{})}),this):this}},{key:"toggleDropdown",value:function(){return this.dropdown.isActive?this.hideDropdown():this.showDropdown(),this}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this._store.activeItems.reduce(function(t,n){var i=e?n.value:n;return t.push(i),t},[]);return this._isSelectOneElement?t[0]:t}},{key:"setValue",value:function(e){var t=this;return this.initialised?([].concat(e).forEach(function(e){return t._setChoiceOrItem(e)}),this):this}},{key:"setChoiceByValue",value:function(e){var t=this;return!this.initialised||this._isTextElement?this:(((0,p.isType)("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._isSelectElement||!t.length||!n)return this;r&&this._clearChoices(),this.containerOuter.removeLoadingState();return this._setLoading(!0),t.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:t[n],label:t[i],isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),this._setLoading(!1),this}},{key:"clearStore",value:function(){return this._store.dispatch((0,d.clearAll)()),this}},{key:"clearInput",value:function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,l.activateChoices)(!0))),this}},{key:"ajax",value:function(e){var t=this;return this.initialised&&this._isSelectElement&&e?(requestAnimationFrame(function(){return t._handleLoadingState(!0)}),e(this._ajaxCallback()),this):this}},{key:"_render",value:function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,n=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),n&&this._renderItems(),this._prevState=this._currentState)}}},{key:"_renderChoices",value:function(){var e=this,t=this._store,n=t.activeGroups,i=t.activeChoices,r=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),n.length>=1&&!this._isSearching){var o=i.filter(function(e){return!0===e.placeholder&&-1===e.groupId});o.length>=1&&(r=this._createChoicesFragment(o,r)),r=this._createGroupsFragment(n,i,r)}else i.length>=1&&(r=this._createChoicesFragment(i,r));if(r.childNodes&&r.childNodes.length>0){var s=this._store.activeItems,a=this._canAddItem(s,this.input.value);a.response?(this.choiceList.append(r),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",a.notice))}else{var c,l;this._isSearching?(l=(0,p.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,c=this._getTemplate("notice",l,"no-results")):(l=(0,p.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,c=this._getTemplate("notice",l,"no-choices")),this.choiceList.append(c)}}},{key:"_renderItems",value:function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)}},{key:"_createGroupsFragment",value:function(e,t,n){var i=this,r=n||document.createDocumentFragment();return this.config.shouldSort&&e.sort(this.config.sortFn),e.forEach(function(e){var n=function(e){return t.filter(function(t){return i._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===i.config.renderSelectedChoices||!t.selected)})}(e);if(n.length>=1){var o=i._getTemplate("choiceGroup",e);r.appendChild(o),i._createChoicesFragment(n,r,!0)}}),r}},{key:"_createChoicesFragment",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t||document.createDocumentFragment(),o=this.config,s=o.renderSelectedChoices,a=o.searchResultLimit,c=o.renderChoiceLimit,l=this._isSearching?p.sortByScore:this.config.sortFn,u=function(e){if("auto"!==s||(n._isSelectOneElement||!e.selected)){var t=n._getTemplate("choice",e,n.config.itemSelectText);r.appendChild(t)}},h=e;"auto"!==s||this._isSelectOneElement||(h=e.filter(function(e){return!e.selected}));var d=h.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),f=d.placeholderChoices,v=d.normalChoices;(this.config.shouldSort||this._isSearching)&&v.sort(l);var m=h.length,g=[].concat(f,v);this._isSearching?m=a:c>0&&!i&&(m=c);for(var y=0;y1&&void 0!==arguments[1]?arguments[1]:null,i=this.config,r=i.shouldSortItems,o=i.sortFn,s=i.removeItemButton,a=n||document.createDocumentFragment();r&&!this._isSelectOneElement&&e.sort(o),this._isTextElement?this.passedElement.value=e:this.passedElement.options=e;return e.forEach(function(e){return function(e){var n=t._getTemplate("item",e,s);a.appendChild(n)}(e)}),a}},{key:"_triggerChange",value:function(e){null!=e&&this.passedElement.triggerEvent(a.EVENTS.change,{value:e})}},{key:"_selectPlaceholderChoice",value:function(){var e=this._store.placeholderChoice;e&&(this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder:e.placeholder}),this._triggerChange(e.value))}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var n=t.parentNode.getAttribute("data-id"),i=e.find(function(e){return e.id===parseInt(n,10)});this._removeItem(i),this._triggerChange(i.value),this._isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_handleItemAction",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this._isSelectOneElement){var r=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(r,10)||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)}),this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var n=t.getAttribute("data-id"),i=this._store.getChoiceById(n),r=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.isActive;if(i.keyCode=r,this.passedElement.triggerEvent(a.EVENTS.choice,{choice:i}),i&&!i.selected&&!i.disabled)this._canAddItem(e,i.value).response&&(this._addItem({value:i.value,label:i.label,choiceId:i.id,groupId:i.groupId,customProperties:i.customProperties,placeholder:i.placeholder,keyCode:i.keyCode}),this._triggerChange(i.value));this.clearInput(),o&&this._isSelectOneElement&&(this.hideDropdown(!0),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],n=e.some(function(e){return e.highlighted});this.config.editItems&&!n&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_setLoading",value:function(e){this._store.dispatch((0,f.setIsLoading)(e))}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild(".".concat(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t.innerHTML=this._placeholderValue||"":this.input.placeholder=this._placeholderValue||"")}},{key:"_handleSearch",value:function(e){if(e&&this.input.isFocussed){var t=this._store.choices,n=this.config,i=n.searchFloor,r=n.searchChoices,o=t.some(function(e){return!e.active});if(e&&e.length>=i){var s=r?this._searchChoices(e):0;this.passedElement.triggerEvent(a.EVENTS.search,{value:e,resultCount:s})}else o&&(this._isSearching=!1,this._store.dispatch((0,l.activateChoices)(!0)))}}},{key:"_canAddItem",value:function(e,t){var n=!0,i=(0,p.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=(0,p.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=(0,p.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.config.regexFilter&&this._isTextElement&&this.config.addItems&&n&&(n=(0,p.regexFilter)(t,this.config.regexFilter)),!this.config.duplicateItemsAllowed&&r&&n&&(n=!1,i=(0,p.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText)}return{response:n,notice:i}}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,n,i){if(t&&n){var r=(0,p.isType)("Object",t)?[t]:t;r&&(0,p.isType)("Array",r)&&r.length?(e._handleLoadingState(!1),e._setLoading(!0),r.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:(0,p.fetchFromObject)(t,n),label:(0,p.fetchFromObject)(t,i),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),e._setLoading(!1),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=(0,p.isType)("String",e)?e.trim():e,n=(0,p.isType)("String",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(n," "))return 0;var r=this._store.searchableChoices,o=t,s=[].concat(this.config.searchFields),a=Object.assign(this.config.fuseOptions,{keys:s}),c=new i.default(r,a).search(o);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,l.filterChoices)(c)),c.length}},{key:"_addEventListeners",value:function(){document.addEventListener("keyup",this._onKeyUp),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("click",this._onClick),document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),document.addEventListener("mousedown",this._onMouseDown),document.addEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus),this.containerOuter.element.addEventListener("blur",this._onBlur)),this.input.element.addEventListener("focus",this._onFocus),this.input.element.addEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset),this.input.addEventListeners()}},{key:"_removeEventListeners",value:function(){document.removeEventListener("keyup",this._onKeyUp),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("click",this._onClick),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),document.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mouseover",this._onMouseOver),this._isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()}},{key:"_onKeyDown",value:function(e){var t,n=e.target,i=e.keyCode,r=e.ctrlKey,o=e.metaKey;if(n===this.input.element||this.containerOuter.element.contains(n)){var s=this._store.activeItems,c=this.input.isFocussed,l=this.dropdown.isActive,u=this.itemList.hasChildren,h=String.fromCharCode(i),d=a.KEY_CODES.BACK_KEY,f=a.KEY_CODES.DELETE_KEY,p=a.KEY_CODES.ENTER_KEY,v=a.KEY_CODES.A_KEY,g=a.KEY_CODES.ESC_KEY,y=a.KEY_CODES.UP_KEY,_=a.KEY_CODES.DOWN_KEY,b=a.KEY_CODES.PAGE_UP_KEY,E=a.KEY_CODES.PAGE_DOWN_KEY,S=r||o;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var I=(m(t={},v,this._onAKey),m(t,p,this._onEnterKey),m(t,g,this._onEscapeKey),m(t,y,this._onDirectionKey),m(t,b,this._onDirectionKey),m(t,_,this._onDirectionKey),m(t,E,this._onDirectionKey),m(t,f,this._onDeleteKey),m(t,d,this._onDeleteKey),t);I[i]&&I[i]({event:e,target:n,keyCode:i,metaKey:o,activeItems:s,hasFocusedInput:c,hasActiveDropdown:l,hasItems:u,hasCtrlDownKeyPressed:S})}}},{key:"_onKeyUp",value:function(e){var t=e.target,n=e.keyCode;if(t===this.input.element){var i=this.input.value,r=this._store.activeItems,o=this._canAddItem(r,i);if(this._isTextElement)if(i){if(o.notice){var s=this._getTemplate("notice",o.notice);this.dropdown.element.innerHTML=s.outerHTML}!0===o.response?this.showDropdown(!0):o.notice||this.hideDropdown(!0)}else this.hideDropdown(!0);else{var c=a.KEY_CODES.BACK_KEY,u=a.KEY_CODES.DELETE_KEY;n!==c&&n!==u||t.value?this._canSearch&&o.response&&this._handleSearch(this.input.value):!this._isTextElement&&this._isSearching&&(this._isSearching=!1,this._store.dispatch((0,l.activateChoices)(!0)))}this._canSearch=this.config.searchEnabled}}},{key:"_onAKey",value:function(e){var t=e.hasItems;e.hasCtrlDownKeyPressed&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())}},{key:"_onEnterKey",value:function(e){var t=e.event,n=e.target,i=e.activeItems,r=e.hasActiveDropdown,o=a.KEY_CODES.ENTER_KEY;if(this._isTextElement&&n.value){var s=this.input.value;this._canAddItem(i,s).response&&(this.hideDropdown(!0),this._addItem({value:s}),this._triggerChange(s),this.clearInput())}if(n.hasAttribute("data-button")&&(this._handleButtonAction(i,n),t.preventDefault()),r){var c=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));c&&(i[0]&&(i[0].keyCode=o),this._handleChoiceAction(i,c)),t.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),t.preventDefault())}},{key:"_onEscapeKey",value:function(e){e.hasActiveDropdown&&(this.hideDropdown(!0),this.containerOuter.focus())}},{key:"_onDirectionKey",value:function(e){var t=e.event,n=e.hasActiveDropdown,i=e.keyCode,r=e.metaKey,o=a.KEY_CODES.DOWN_KEY,s=a.KEY_CODES.PAGE_UP_KEY,c=a.KEY_CODES.PAGE_DOWN_KEY;if(n||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var l,u=i===o||i===c?1:-1;if(r||i===c||i===s)l=u>0?Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():this.dropdown.element.querySelector("[data-choice-selectable]");else{var h=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));l=h?(0,p.getAdjacentEl)(h,"[data-choice-selectable]",u):this.dropdown.element.querySelector("[data-choice-selectable]")}l&&((0,p.isScrolledIntoView)(l,this.choiceList.element,u)||this.choiceList.scrollToChoice(l,u),this._highlightChoice(l)),t.preventDefault()}}},{key:"_onDeleteKey",value:function(e){var t=e.event,n=e.target,i=e.hasFocusedInput,r=e.activeItems;!i||n.value||this._isSelectOneElement||(this._handleBackspace(r),t.preventDefault())}},{key:"_onTouchMove",value:function(){!0===this._wasTap&&(this._wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=e.target||e.touches[0].target;!0===this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&!this._isSelectOneElement&&(this._isTextElement?this.input.focus():this.showDropdown()),e.stopPropagation());this._wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target,n=e.shiftKey;if(t===this.choiceList&&(0,p.isIE11)()&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var i=this._store.activeItems,r=n,o=(0,p.findAncestorByAttrName)(t,"data-button"),s=(0,p.findAncestorByAttrName)(t,"data-item"),a=(0,p.findAncestorByAttrName)(t,"data-choice");o?this._handleButtonAction(i,o):s?this._handleItemAction(i,s,r):a&&this._handleChoiceAction(i,a),e.preventDefault()}}},{key:"_onMouseOver",value:function(e){var t=e.target;(t===this.dropdown||this.dropdown.element.contains(t))&&t.hasAttribute("data-choice")&&this._highlightChoice(t)}},{key:"_onClick",value:function(e){var t=e.target;this.containerOuter.element.contains(t)?this.dropdown.isActive||this.containerOuter.isDisabled?this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),this.containerOuter.focus()):(this._store.highlightedActiveItems&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))}},{key:"_onFocus",value:function(e){var t=this,n=e.target;this.containerOuter.element.contains(n)&&{text:function(){n===t.input.element&&t.containerOuter.addFocusState()},"select-one":function(){t.containerOuter.addFocusState(),n===t.input.element&&t.showDropdown(!0)},"select-multiple":function(){n===t.input.element&&(t.showDropdown(!0),t.containerOuter.addFocusState())}}[this.passedElement.element.type]()}},{key:"_onBlur",value:function(e){var t=this,n=e.target;if(this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var i=this._store.activeItems.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),i&&t.unhighlightAll(),t.hideDropdown(!0))},"select-one":function(){t.containerOuter.removeFocusState(),(n===t.input.element||n===t.containerOuter.element&&!t._canSearch)&&t.hideDropdown(!0)},"select-multiple":function(){n===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(!0),i&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()}},{key:"_onFormReset",value:function(){this._store.dispatch((0,d.resetTo)(this._initialState))}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var i=t;Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))).forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),i?this._highlightPosition=n.indexOf(i):(i=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(i=n[0]),i.classList.add(this.config.classNames.highlightedState),i.setAttribute("aria-selected","true"),this.passedElement.triggerEvent(a.EVENTS.highlightChoice,{el:i}),this.dropdown.isActive&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}}},{key:"_addItem",value:function(e){var t=e.value,n=e.label,i=void 0===n?null:n,r=e.choiceId,o=void 0===r?-1:r,s=e.groupId,c=void 0===s?-1:s,l=e.customProperties,h=void 0===l?null:l,d=e.placeholder,f=void 0!==d&&d,v=e.keyCode,m=void 0===v?null:v,g=(0,p.isType)("String",t)?t.trim():t,y=m,_=h,b=this._store.items,E=i||g,S=parseInt(o,10)||-1,I=c>=0?this._store.getGroupById(c):null,O=b?b.length+1:1;return this.config.prependValue&&(g=this.config.prependValue+g.toString()),this.config.appendValue&&(g+=this.config.appendValue.toString()),this._store.dispatch((0,u.addItem)({value:g,label:E,id:O,choiceId:S,groupId:c,customProperties:h,placeholder:f,keyCode:y})),this._isSelectOneElement&&this.removeActiveItems(O),this.passedElement.triggerEvent(a.EVENTS.addItem,{id:O,value:g,label:E,customProperties:_,groupValue:I&&I.value?I.value:void 0,keyCode:y}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,p.isType)("Object",e))return this;var t=e.id,n=e.value,i=e.label,r=e.choiceId,o=e.groupId,s=o>=0?this._store.getGroupById(o):null;return this._store.dispatch((0,u.removeItem)(t,r)),s&&s.value?this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:n,label:i,groupValue:s.value}):this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:n,label:i}),this}},{key:"_addChoice",value:function(e){var t=e.value,n=e.label,i=void 0===n?null:n,r=e.isSelected,o=void 0!==r&&r,s=e.isDisabled,a=void 0!==s&&s,c=e.groupId,u=void 0===c?-1:c,h=e.customProperties,d=void 0===h?null:h,f=e.placeholder,p=void 0!==f&&f,v=e.keyCode,m=void 0===v?null:v;if(null!=t){var g=this._store.choices,y=i||t,_=g?g.length+1:1,b="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(_);this._store.dispatch((0,l.addChoice)({value:t,label:y,id:_,groupId:u,disabled:a,elementId:b,customProperties:d,placeholder:p,keyCode:m})),o&&this._addItem({value:t,label:y,choiceId:_,customProperties:d,placeholder:p,keyCode:m})}}},{key:"_clearChoices",value:function(){this._store.dispatch((0,l.clearChoices)())}},{key:"_addGroup",value:function(e){var t=this,n=e.group,i=e.id,r=e.valueKey,o=void 0===r?"value":r,s=e.labelKey,a=void 0===s?"label":s,c=(0,p.isType)("Object",n)?n.choices:Array.from(n.getElementsByTagName("OPTION")),l=i||Math.floor((new Date).valueOf()*Math.random()),u=!!n.disabled&&n.disabled;if(c){this._store.dispatch((0,h.addGroup)(n.label,l,!0,u));c.forEach(function(e){var n=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[o],label:(0,p.isType)("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:n,groupId:l,customProperties:e.customProperties,placeholder:e.placeholder})})}else this._store.dispatch((0,h.addGroup)(n.label,n.id,!1,n.disabled))}},{key:"_getTemplate",value:function(e){var t;if(!e)return null;for(var n=this.config,i=n.templates,r=n.classNames,o=arguments.length,s=new Array(o>1?o-1:0),a=1;a{let n=[],i=-1,r=-1,o=0;for(let s=e.length;o=t&&n.push([i,r]),i=-1)}return e[o-1]&&o-i>=t&&n.push([i,o-1]),n})},"./src/bitap/bitap_pattern_alphabet.js":
+/*! no static exports found */function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],i=-1,r=-1,o=0,s=e.length;o=t&&n.push([i,r]),i=-1)}return e[o-1]&&o-i>=t&&n.push([i,o-1]),n}},"./src/bitap/bitap_pattern_alphabet.js":
/*!*********************************************!*\
!*** ./src/bitap/bitap_pattern_alphabet.js ***!
\*********************************************/
-/*! no static exports found */function(e,t){e.exports=(e=>{let t={},n=e.length;for(let i=0;i{let r=new RegExp(t.replace(n,"\\$&").replace(i,"|")),o=e.match(r),s=!!o,a=[];if(s)for(let t=0,n=o.length;t2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(n,"\\$&").replace(i,"|")),o=e.match(r),s=!!o,a=[];if(s)for(var c=0,l=o.length;c{const o=t/e.length,s=Math.abs(i-n);return r?o+s/r:s?1:o})},"./src/bitap/bitap_search.js":
+/*! no static exports found */function(e,t){e.exports=function(e,t){var n=t.errors,i=void 0===n?0:n,r=t.currentLocation,o=void 0===r?0:r,s=t.expectedLocation,a=void 0===s?0:s,c=t.distance,l=void 0===c?100:c,u=i/e.length,h=Math.abs(a-o);return l?u+h/l:h?1:u}},"./src/bitap/bitap_search.js":
/*!***********************************!*\
!*** ./src/bitap/bitap_search.js ***!
\***********************************/
-/*! no static exports found */function(e,t,n){const i=n(/*! ./bitap_score */"./src/bitap/bitap_score.js"),r=n(/*! ./bitap_matched_indices */"./src/bitap/bitap_matched_indices.js");e.exports=((e,t,n,{location:o=0,distance:s=100,threshold:a=.6,findAllMatches:l=!1,minMatchCharLength:c=1})=>{const u=o,h=e.length;let d=a,f=e.indexOf(t,u);const p=t.length,v=[];for(let e=0;e=c;o-=1){let a=o-1,l=n[e.charAt(a)];if(l&&(v[a]=1),E[o]=(E[o+1]<<1|1)&l,0!==r&&(E[o]|=(m[o+1]|m[o])<<1|1|m[o+1]),E[o]&y&&(g=i(t,{errors:r,currentLocation:a,expectedLocation:u,distance:s}))<=d){if(d=g,(f=a)<=u)break;c=Math.max(1,2*u-f)}}if(i(t,{errors:r+1,currentLocation:u,expectedLocation:u,distance:s})>d)break;m=E}return{isMatch:f>=0,score:0===g?.001:g,matchedIndices:r(v,c)}})},"./src/bitap/index.js":
+/*! no static exports found */function(e,t,n){var i=n(/*! ./bitap_score */"./src/bitap/bitap_score.js"),r=n(/*! ./bitap_matched_indices */"./src/bitap/bitap_matched_indices.js");e.exports=function(e,t,n,o){for(var s=o.location,a=void 0===s?0:s,c=o.distance,l=void 0===c?100:c,u=o.threshold,h=void 0===u?.6:u,d=o.findAllMatches,f=void 0!==d&&d,p=o.minMatchCharLength,v=void 0===p?1:p,m=a,g=e.length,y=h,_=e.indexOf(t,m),b=t.length,E=[],S=0;S=D;M-=1){var N=M-1,F=n[e.charAt(N)];if(F&&(E[N]=1),j[M]=(j[M+1]<<1|1)&F,0!==A&&(j[M]|=(C[M+1]|C[M])<<1|1|C[M+1]),j[M]&k&&(w=i(t,{errors:A,currentLocation:N,expectedLocation:m,distance:l}))<=y){if(y=w,(_=N)<=m)break;D=Math.max(1,2*m-_)}}if(i(t,{errors:A+1,currentLocation:m,expectedLocation:m,distance:l})>y)break;C=j}return{isMatch:_>=0,score:0===w?.001:w,matchedIndices:r(E,v)}}},"./src/bitap/index.js":
/*!****************************!*\
!*** ./src/bitap/index.js ***!
\****************************/
-/*! no static exports found */function(e,t,n){const i=n(/*! ./bitap_regex_search */"./src/bitap/bitap_regex_search.js"),r=n(/*! ./bitap_search */"./src/bitap/bitap_search.js"),o=n(/*! ./bitap_pattern_alphabet */"./src/bitap/bitap_pattern_alphabet.js");e.exports=class{constructor(e,{location:t=0,distance:n=100,threshold:i=.6,maxPatternLength:r=32,isCaseSensitive:s=!1,tokenSeparator:a=/ +/g,findAllMatches:l=!1,minMatchCharLength:c=1}){this.options={location:t,distance:n,threshold:i,maxPatternLength:r,isCaseSensitive:s,tokenSeparator:a,findAllMatches:l,minMatchCharLength:c},this.pattern=this.options.isCaseSensitive?e:e.toLowerCase(),this.pattern.length<=r&&(this.patternAlphabet=o(this.pattern))}search(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};const{maxPatternLength:t,tokenSeparator:n}=this.options;if(this.pattern.length>t)return i(e,this.pattern,n);const{location:o,distance:s,threshold:a,findAllMatches:l,minMatchCharLength:c}=this.options;return r(e,this.pattern,this.patternAlphabet,{location:o,distance:s,threshold:a,findAllMatches:l,minMatchCharLength:c})}}},"./src/helpers/deep_value.js":
+/*! no static exports found */function(e,t,n){function i(e,t){for(var n=0;nn)return r(e,this.pattern,i);var s=this.options,a=s.location,c=s.distance,l=s.threshold,u=s.findAllMatches,h=s.minMatchCharLength;return o(e,this.pattern,this.patternAlphabet,{location:a,distance:c,threshold:l,findAllMatches:u,minMatchCharLength:h})}}])&&i(t.prototype,n),a&&i(t,a),e}();e.exports=a},"./src/helpers/deep_value.js":
/*!***********************************!*\
!*** ./src/helpers/deep_value.js ***!
\***********************************/
-/*! no static exports found */function(e,t,n){const i=n(/*! ./is_array */"./src/helpers/is_array.js"),r=(e,t,n)=>{if(t){const o=t.indexOf(".");let s=t,a=null;-1!==o&&(s=t.slice(0,o),a=t.slice(o+1));const l=e[s];if(null!=l)if(a||"string"!=typeof l&&"number"!=typeof l)if(i(l))for(let e=0,t=l.length;er(e,t,[]))},"./src/helpers/is_array.js":
+/*! no static exports found */function(e,t,n){var i=n(/*! ./is_array */"./src/helpers/is_array.js");e.exports=function(e,t){return function e(t,n,r){if(n){var o=n.indexOf("."),s=n,a=null;-1!==o&&(s=n.slice(0,o),a=n.slice(o+1));var c=t[s];if(null!=c)if(a||"string"!=typeof c&&"number"!=typeof c)if(i(c))for(var l=0,u=c.length;lArray.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e))},"./src/index.js":
+/*! no static exports found */function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},"./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
-/*! no static exports found */function(e,t,n){const i=n(/*! ./bitap */"./src/bitap/index.js"),r=n(/*! ./helpers/deep_value */"./src/helpers/deep_value.js"),o=n(/*! ./helpers/is_array */"./src/helpers/is_array.js");e.exports=class{constructor(e,{location:t=0,distance:n=100,threshold:i=.6,maxPatternLength:o=32,caseSensitive:s=!1,tokenSeparator:a=/ +/g,findAllMatches:l=!1,minMatchCharLength:c=1,id:u=null,keys:h=[],shouldSort:d=!0,getFn:f=r,sortFn:p=((e,t)=>e.score-t.score),tokenize:v=!1,matchAllTokens:m=!1,includeMatches:g=!1,includeScore:_=!1,verbose:y=!1}){this.options={location:t,distance:n,threshold:i,maxPatternLength:o,isCaseSensitive:s,tokenSeparator:a,findAllMatches:l,minMatchCharLength:c,id:u,keys:h,includeMatches:g,includeScore:_,shouldSort:d,getFn:f,sortFn:p,verbose:y,tokenize:v,matchAllTokens:m},this.setCollection(e)}setCollection(e){return this.list=e,e}search(e,t={limit:!1}){this._log(`---------\nSearch pattern: "${e}"`);const{tokenSearchers:n,fullSearcher:i}=this._prepareSearchers(e);let{weights:r,results:o}=this._search(n,i);return this._computeScore(r,o),this.options.shouldSort&&this._sort(o),t.limit&&"number"==typeof t.limit&&(o=o.slice(0,t.limit)),this._format(o)}_prepareSearchers(e=""){const t=[];if(this.options.tokenize){const n=e.split(this.options.tokenSeparator);for(let e=0,r=n.length;e1)throw new Error("Key weight has to be > 0 and <= 1");l=l.name}else o[l]={weight:1};this._analyze({key:l,value:this.options.getFn(a,l),record:a,index:s},{resultMap:i,results:r,tokenSearchers:e,fullSearcher:t})}}return{weights:o,results:r}}_analyze({key:e,arrayIndex:t=-1,value:n,record:i,index:r},{tokenSearchers:s=[],fullSearcher:a=[],resultMap:l={},results:c=[]}){if(null==n)return;let u=!1,h=-1,d=0;if("string"==typeof n){this._log(`\nKey: ${""===e?"-":e}`);let o=a.search(n);if(this._log(`Full text: "${n}", score: ${o.score}`),this.options.tokenize){let e=n.split(this.options.tokenSeparator),t=[];for(let n=0;n-1&&(f=(f+h)/2),this._log("Score average:",f);let p=!this.options.tokenize||!this.options.matchAllTokens||d>=s.length;if(this._log(`\nCheck Matches: ${p}`),(u||o.isMatch)&&p){let s=l[r];s?s.output.push({key:e,arrayIndex:t,value:n,score:f,matchedIndices:o.matchedIndices}):(l[r]={item:i,output:[{key:e,arrayIndex:t,value:n,score:f,matchedIndices:o.matchedIndices}]},c.push(l[r]))}}else if(o(n))for(let t=0,o=n.length;t{const n=e.output;t.matches=[];for(let e=0,i=n.length;e-1&&(r.arrayIndex=i.arrayIndex),t.matches.push(r)}}),this.options.includeScore&&n.push((e,t)=>{t.score=e.score});for(let i=0,r=e.length;i0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_ITEM":var n=[].concat(e,[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);return n.map(function(e){var t=e;return t.highlighted=!1,t});case"REMOVE_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.active=!1),n});case"HIGHLIGHT_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.highlighted=t.highlighted),n});default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_GROUP":return[].concat(e,[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_CHOICE":return[].concat(e,[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":return t.activateOptions?e.map(function(e){var n=e;return n.active=t.active,n}):t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!0),n}):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!1),n}):e;case"FILTER_CHOICES":return e.map(function(e){var n=e;return n.active=t.results.some(function(e){var t=e.item,i=e.score;return t.id===n.id&&(n.score=i,!0)}),n});case"ACTIVATE_CHOICES":return e.map(function(e){var n=e;return n.active=t.active,n});case"CLEAR_CHOICES":return i;default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.defaultState=void 0;var i={loading:!1};t.defaultState=i;var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_LOADING":return{loading:t.isLoading};default:return e}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Dropdown",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"List",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"WrappedInput",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"WrappedSelect",{enumerable:!0,get:function(){return l.default}});var i=c(n(23)),r=c(n(24)),o=c(n(25)),s=c(n(26)),a=c(n(27)),l=c(n(28));function c(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";function i(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:(0,i.getWindowHeight)();if(void 0===e)return!1;var n=!1;return"auto"===this.position?n=e>=t:"top"===this.position&&(n=!0),n}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"open",value:function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)}},{key:"close",value:function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)}},{key:"focus",value:function(){this.isFocussed||this.element.focus()}},{key:"addFocusState",value:function(){this.element.classList.add(this.classNames.focusState)}},{key:"removeFocusState",value:function(){this.element.classList.remove(this.classNames.focusState)}},{key:"enable",value:function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),"select-one"===this.type&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),"select-one"===this.type&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0}},{key:"wrap",value:function(e){(0,i.wrap)(e,this.element)}},{key:"unwrap",value:function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)}},{key:"addLoadingState",value:function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0}},{key:"removeLoadingState",value:function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function r(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0];return this.element.value&&(this.element.value=""),e&&this.setWidth(),this}},{key:"setWidth",value:function(e){var t=this,n=function(e){t.element.style.width=e};if(this._placeholderValue){var i=this.element.value.length>=this._placeholderValue.length/1.25;(this.element.value&&i||e)&&this.calcWidth(n)}else this.calcWidth(n)}},{key:"calcWidth",value:function(e){return(0,i.calcWidthOfInput)(this.element,e)}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"_onInput",value:function(){"select-one"!==this.type&&this.setWidth()}},{key:"_onPaste",value:function(e){e.target===this.element&&this.preventPaste&&e.preventDefault()}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}},{key:"placeholder",set:function(e){this.element.placeholder=e}},{key:"value",set:function(e){this.element.value="".concat(e)},get:function(){return(0,i.stripHTML)(this.element.value)}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(1);function r(e,t){for(var n=0;n0?this.element.scrollTop+o-s:e.offsetTop;requestAnimationFrame(function(e){n._animateScroll(e,a,t)})}}},{key:"_scrollDown",value:function(e,t,n){var i=(n-e)/t,r=i>1?i:1;this.element.scrollTop=e+r}},{key:"_scrollUp",value:function(e,t,n){var i=(e-n)/t,r=i>1?i:1;this.element.scrollTop=e-r}},{key:"_animateScroll",value:function(e,t,n){var r=this,o=i.SCROLLING_SPEED,s=this.element.scrollTop,a=!1;n>0?(this._scrollDown(s,o,t),st&&(a=!0)),a&&requestAnimationFrame(function(){r._animateScroll(e,t,n)})}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,r=(i=n(4))&&i.__esModule?i:{default:i},o=n(0);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var n=this._prepareSearchers(e),i=n.tokenSearchers,r=n.fullSearcher,o=this._search(i,r),s=o.weights,a=o.results;return this._computeScore(s,a),this.options.shouldSort&&this._sort(a),t.limit&&"number"==typeof t.limit&&(a=a.slice(0,t.limit)),this._format(a)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),i=0,r=n.length;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=this.list,i={},r=[];if("string"==typeof n[0]){for(var o=0,s=n.length;o1)throw new Error("Key weight has to be > 0 and <= 1");f=f.name}else a[f]={weight:1};this._analyze({key:f,value:this.options.getFn(u,f),record:u,index:c},{resultMap:i,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:"_analyze",value:function(e,t){var n=e.key,i=e.arrayIndex,r=void 0===i?-1:i,o=e.value,s=e.record,c=e.index,l=t.tokenSearchers,u=void 0===l?[]:l,h=t.fullSearcher,d=void 0===h?[]:h,f=t.resultMap,p=void 0===f?{}:f,v=t.results,m=void 0===v?[]:v;if(null!=o){var g=!1,y=-1,_=0;if("string"==typeof o){this._log("\nKey: ".concat(""===n?"-":n));var b=d.search(o);if(this._log('Full text: "'.concat(o,'", score: ').concat(b.score)),this.options.tokenize){for(var E=o.split(this.options.tokenSeparator),S=[],I=0;I-1&&(D=(D+y)/2),this._log("Score average:",D);var P=!this.options.tokenize||!this.options.matchAllTokens||_>=u.length;if(this._log("\nCheck Matches: ".concat(P)),(g||b.isMatch)&&P){var j=p[c];j?j.output.push({key:n,arrayIndex:r,value:o,score:D,matchedIndices:b.matchedIndices}):(p[c]={item:s,output:[{key:n,arrayIndex:r,value:o,score:D,matchedIndices:b.matchedIndices}]},m.push(p[c]))}}else if(a(o))for(var M=0,N=o.length;M-1&&(s.arrayIndex=o.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&r.push(function(e,t){t.score=e.score});for(var o=0,s=e.length;o0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_ITEM":var n=[].concat(e,[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);return n.map(function(e){var t=e;return t.highlighted=!1,t});case"REMOVE_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.active=!1),n});case"HIGHLIGHT_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.highlighted=t.highlighted),n});default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_GROUP":return[].concat(e,[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_CHOICE":return[].concat(e,[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":return t.activateOptions?e.map(function(e){var n=e;return n.active=t.active,n}):t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!0),n}):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!1),n}):e;case"FILTER_CHOICES":return e.map(function(e){var n=e;return n.active=t.results.some(function(e){var t=e.item,i=e.score;return t.id===n.id&&(n.score=i,!0)}),n});case"ACTIVATE_CHOICES":return e.map(function(e){var n=e;return n.active=t.active,n});case"CLEAR_CHOICES":return i;default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.defaultState=void 0;var i={loading:!1};t.defaultState=i;var r=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_LOADING":return{loading:t.isLoading};default:return e}};t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Dropdown",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"List",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"WrappedInput",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"WrappedSelect",{enumerable:!0,get:function(){return c.default}});var i=l(n(23)),r=l(n(24)),o=l(n(25)),s=l(n(26)),a=l(n(27)),c=l(n(28));function l(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";function i(e,t){for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:(0,i.getWindowHeight)();if(void 0===e)return!1;var n=!1;return"auto"===this.position?n=e>=t:"top"===this.position&&(n=!0),n}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"open",value:function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)}},{key:"close",value:function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)}},{key:"focus",value:function(){this.isFocussed||this.element.focus()}},{key:"addFocusState",value:function(){this.element.classList.add(this.classNames.focusState)}},{key:"removeFocusState",value:function(){this.element.classList.remove(this.classNames.focusState)}},{key:"enable",value:function(){this.element.classList.remove(this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),"select-one"===this.type&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),"select-one"===this.type&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0}},{key:"wrap",value:function(e){(0,i.wrap)(e,this.element)}},{key:"unwrap",value:function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)}},{key:"addLoadingState",value:function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0}},{key:"removeLoadingState",value:function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function r(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0];return this.element.value&&(this.element.value=""),e&&this.setWidth(),this}},{key:"setWidth",value:function(e){var t=this,n=function(e){t.element.style.width=e};if(this._placeholderValue){var i=this.element.value.length>=this._placeholderValue.length/1.25;(this.element.value&&i||e)&&this.calcWidth(n)}else this.calcWidth(n)}},{key:"calcWidth",value:function(e){return(0,i.calcWidthOfInput)(this.element,e)}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"_onInput",value:function(){"select-one"!==this.type&&this.setWidth()}},{key:"_onPaste",value:function(e){e.target===this.element&&this.preventPaste&&e.preventDefault()}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}},{key:"placeholder",set:function(e){this.element.placeholder=e}},{key:"value",set:function(e){this.element.value="".concat(e)},get:function(){return(0,i.stripHTML)(this.element.value)}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(1);function r(e,t){for(var n=0;n0?this.element.scrollTop+o-s:e.offsetTop;requestAnimationFrame(function(e){n._animateScroll(e,a,t)})}}},{key:"_scrollDown",value:function(e,t,n){var i=(n-e)/t,r=i>1?i:1;this.element.scrollTop=e+r}},{key:"_scrollUp",value:function(e,t,n){var i=(e-n)/t,r=i>1?i:1;this.element.scrollTop=e-r}},{key:"_animateScroll",value:function(e,t,n){var r=this,o=i.SCROLLING_SPEED,s=this.element.scrollTop,a=!1;n>0?(this._scrollDown(s,o,t),st&&(a=!0)),a&&requestAnimationFrame(function(){r._animateScroll(e,t,n)})}}])&&r(t.prototype,n),o&&r(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,r=(i=n(4))&&i.__esModule?i:{default:i},o=n(0);function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0];return{type:i.ACTION_TYPES.ACTIVATE_CHOICES,active:e}};t.clearChoices=function(){return{type:i.ACTION_TYPES.CLEAR_CHOICES}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highlightItem=t.removeItem=t.addItem=void 0;var i=n(1);t.addItem=function(e){var t=e.value,n=e.label,r=e.id,o=e.choiceId,s=e.groupId,a=e.customProperties,l=e.placeholder,c=e.keyCode;return{type:i.ACTION_TYPES.ADD_ITEM,value:t,label:n,id:r,choiceId:o,groupId:s,customProperties:a,placeholder:l,keyCode:c}};t.removeItem=function(e,t){return{type:i.ACTION_TYPES.REMOVE_ITEM,id:e,choiceId:t}};t.highlightItem=function(e,t){return{type:i.ACTION_TYPES.HIGHLIGHT_ITEM,id:e,highlighted:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addGroup=void 0;var i=n(1);t.addGroup=function(e,t,n,r){return{type:i.ACTION_TYPES.ADD_GROUP,value:e,id:t,active:n,disabled:r}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetTo=t.clearAll=void 0;t.clearAll=function(){return{type:"CLEAR_ALL"}};t.resetTo=function(e){return{type:"RESET_TO",state:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setIsLoading=void 0;t.setIsLoading=function(e){return{type:"SET_IS_LOADING",isLoading:e}}}])});
\ No newline at end of file
+!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t0&&void 0!==arguments[0])||arguments[0];return{type:i.ACTION_TYPES.ACTIVATE_CHOICES,active:e}};t.clearChoices=function(){return{type:i.ACTION_TYPES.CLEAR_CHOICES}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highlightItem=t.removeItem=t.addItem=void 0;var i=n(1);t.addItem=function(e){var t=e.value,n=e.label,r=e.id,o=e.choiceId,s=e.groupId,a=e.customProperties,c=e.placeholder,l=e.keyCode;return{type:i.ACTION_TYPES.ADD_ITEM,value:t,label:n,id:r,choiceId:o,groupId:s,customProperties:a,placeholder:c,keyCode:l}};t.removeItem=function(e,t){return{type:i.ACTION_TYPES.REMOVE_ITEM,id:e,choiceId:t}};t.highlightItem=function(e,t){return{type:i.ACTION_TYPES.HIGHLIGHT_ITEM,id:e,highlighted:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addGroup=void 0;var i=n(1);t.addGroup=function(e,t,n,r){return{type:i.ACTION_TYPES.ADD_GROUP,value:e,id:t,active:n,disabled:r}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetTo=t.clearAll=void 0;t.clearAll=function(){return{type:"CLEAR_ALL"}};t.resetTo=function(e){return{type:"RESET_TO",state:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setIsLoading=void 0;t.setIsLoading=function(e){return{type:"SET_IS_LOADING",isLoading:e}}}])});
\ No newline at end of file
diff --git a/public/index.html b/public/index.html
index a02cc0e..2af5f74 100644
--- a/public/index.html
+++ b/public/index.html
@@ -16,7 +16,7 @@
-
+
@@ -24,8 +24,8 @@
-
-
+
+