From bef6743c3b7e3c93d3b13bb0f17364ee689d96bb Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Thu, 24 Oct 2019 13:21:40 -0400 Subject: [PATCH] set window target for minified build (#685) * set `globalObject` option * commit builded assets * set window target for minified build --- package.json | 2 +- public/assets/scripts/choices.js | 1073 +------------------------- public/assets/scripts/choices.min.js | 46 +- webpack.config.base.js | 3 +- webpack.config.prod.js | 2 +- 5 files changed, 12 insertions(+), 1114 deletions(-) diff --git a/package.json b/package.json index e2d5678..a22805c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "choices.js", "version": "7.1.5", "description": "A vanilla JS customisable text input/select box plugin", - "main": "./public/assets/scripts/choices.min.js", + "main": "./public/assets/scripts/choices.js", "types": "./types/index.d.ts", "scripts": { "start": "run-p js:watch css:watch", diff --git a/public/assets/scripts/choices.js b/public/assets/scripts/choices.js index f106c91..4207034 100644 --- a/public/assets/scripts/choices.js +++ b/public/assets/scripts/choices.js @@ -1,4 +1,4 @@ -/*! choices.js v7.1.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ +/*! choices.js v7.1.5 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -321,1081 +321,14 @@ var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"] /***/ (function(module, exports, __webpack_require__) { /*! - * Fuse.js v3.4.2 - Lightweight fuzzy-search (http://fusejs.io) + * Fuse.js v3.4.5 - Lightweight fuzzy-search (http://fusejs.io) * * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me) * All Rights Reserved. Apache Software License 2.0 * * http://www.apache.org/licenses/LICENSE-2.0 */ -(function webpackUniversalModuleDefinition(root, factory) { - if(true) - module.exports = factory(); - else {} -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js"); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ "./src/bitap/bitap_matched_indices.js": -/*!********************************************!*\ - !*** ./src/bitap/bitap_matched_indices.js ***! - \********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -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 (var len = matchmask.length; i < len; i += 1) { - var match = matchmask[i]; - - if (match && start === -1) { - start = i; - } else if (!match && start !== -1) { - end = i - 1; - - if (end - start + 1 >= minMatchCharLength) { - matchedIndices.push([start, end]); - } - - start = -1; - } - } // (i-1 - start) + 1 => i - start - - - if (matchmask[i - 1] && i - start >= minMatchCharLength) { - matchedIndices.push([start, i - 1]); - } - - return matchedIndices; -}; - -/***/ }), - -/***/ "./src/bitap/bitap_pattern_alphabet.js": -/*!*********************************************!*\ - !*** ./src/bitap/bitap_pattern_alphabet.js ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = function (pattern) { - var mask = {}; - var len = pattern.length; - - for (var i = 0; i < len; i += 1) { - mask[pattern.charAt(i)] = 0; - } - - for (var _i = 0; _i < len; _i += 1) { - mask[pattern.charAt(_i)] |= 1 << len - _i - 1; - } - - return mask; -}; - -/***/ }), - -/***/ "./src/bitap/bitap_regex_search.js": -/*!*****************************************!*\ - !*** ./src/bitap/bitap_regex_search.js ***! - \*****************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -var SPECIAL_CHARS_REGEX = /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g; - -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 (var i = 0, matchesLen = matches.length; i < matchesLen; i += 1) { - var match = matches[i]; - matchedIndices.push([text.indexOf(match), match.length - 1]); - } - } - - return { - // TODO: revisit this score - score: isMatch ? 0.5 : 1, - isMatch: isMatch, - matchedIndices: matchedIndices - }; -}; - -/***/ }), - -/***/ "./src/bitap/bitap_score.js": -/*!**********************************!*\ - !*** ./src/bitap/bitap_score.js ***! - \**********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -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. - return proximity ? 1.0 : accuracy; - } - - return accuracy + proximity / distance; -}; - -/***/ }), - -/***/ "./src/bitap/bitap_search.js": -/*!***********************************!*\ - !*** ./src/bitap/bitap_search.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var bitapScore = __webpack_require__(/*! ./bitap_score */ "./src/bitap/bitap_score.js"); - -var matchedIndices = __webpack_require__(/*! ./bitap_matched_indices */ "./src/bitap/bitap_matched_indices.js"); - -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. - - var textLen = text.length; // Highest score beyond which we give up. - - var currentThreshold = threshold; // Is there a nearby exact match? (speedup) - - var bestLocation = text.indexOf(pattern, expectedLocation); - var patternLen = pattern.length; // a mask of the matches - - var matchMask = []; - - for (var i = 0; i < textLen; i += 1) { - matchMask[i] = 0; - } - - if (bestLocation !== -1) { - var score = bitapScore(pattern, { - errors: 0, - currentLocation: bestLocation, - 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) { - var _score = bitapScore(pattern, { - errors: 0, - currentLocation: bestLocation, - expectedLocation: expectedLocation, - distance: distance - }); - - currentThreshold = Math.min(_score, currentThreshold); - } - } // Reset the best location - - - bestLocation = -1; - var lastBitArr = []; - var finalScore = 1; - var binMax = patternLen + textLen; - var mask = 1 << patternLen - 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. - var binMin = 0; - var binMid = binMax; - - while (binMin < binMid) { - var _score3 = bitapScore(pattern, { - errors: _i, - currentLocation: expectedLocation + binMid, - expectedLocation: expectedLocation, - distance: distance - }); - - if (_score3 <= currentThreshold) { - binMin = binMid; - } else { - binMax = binMid; - } - - binMid = Math.floor((binMax - binMin) / 2 + binMin); - } // Use the result from this iteration as the maximum for the next. - - - binMax = binMid; - var start = Math.max(1, expectedLocation - binMid + 1); - var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array - - var bitArr = Array(finish + 2); - bitArr[finish + 1] = (1 << _i) - 1; - - for (var j = finish; j >= start; j -= 1) { - var currentLocation = j - 1; - var charMatch = patternAlphabet[text.charAt(currentLocation)]; - - if (charMatch) { - matchMask[currentLocation] = 1; - } // First pass: exact match - - - bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch; // Subsequent passes: fuzzy match - - 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: currentLocation, - expectedLocation: expectedLocation, - distance: distance - }); // This match will almost certainly be better than any existing match. - // But check anyway. - - if (finalScore <= currentThreshold) { - // Indeed it is - currentThreshold = finalScore; - bestLocation = currentLocation; // Already passed `loc`, downhill from here on in. - - if (bestLocation <= expectedLocation) { - break; - } // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`. - - - start = Math.max(1, 2 * expectedLocation - bestLocation); - } - } - } // No hope for a (better) match at greater error levels. - - - var _score2 = bitapScore(pattern, { - errors: _i + 1, - currentLocation: expectedLocation, - expectedLocation: expectedLocation, - distance: distance - }); // console.log('score', score, finalScore) - - - if (_score2 > currentThreshold) { - break; - } - - lastBitArr = bitArr; - } // console.log('FINAL SCORE', finalScore) - // Count exact matches (those with a score of 0) to be "almost" exact - - - return { - isMatch: bestLocation >= 0, - score: finalScore === 0 ? 0.001 : finalScore, - matchedIndices: matchedIndices(matchMask, minMatchCharLength) - }; -}; - -/***/ }), - -/***/ "./src/bitap/index.js": -/*!****************************!*\ - !*** ./src/bitap/index.js ***! - \****************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -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 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); - - this.options = { - location: location, - distance: distance, - threshold: threshold, - maxPatternLength: maxPatternLength, - isCaseSensitive: isCaseSensitive, - tokenSeparator: tokenSeparator, - findAllMatches: findAllMatches, - minMatchCharLength: minMatchCharLength - }; - this.pattern = this.options.isCaseSensitive ? pattern : pattern.toLowerCase(); - - if (this.pattern.length <= maxPatternLength) { - this.patternAlphabet = patternAlphabet(this.pattern); - } - } - - _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 - - - 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 - - - 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 - }); - } - }]); - - return Bitap; -}(); // let x = new Bitap("od mn war", {}) -// let result = x.search("Old Man's War") -// console.log(result) - - -module.exports = Bitap; - -/***/ }), - -/***/ "./src/helpers/deep_value.js": -/*!***********************************!*\ - !*** ./src/helpers/deep_value.js ***! - \***********************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -var isArray = __webpack_require__(/*! ./is_array */ "./src/helpers/is_array.js"); - -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 { - var dotIndex = path.indexOf('.'); - var firstSegment = path; - var remaining = null; - - if (dotIndex !== -1) { - firstSegment = path.slice(0, dotIndex); - remaining = path.slice(dotIndex + 1); - } - - 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 (var i = 0, len = value.length; i < len; i += 1) { - deepValue(value[i], remaining, list); - } - } else if (remaining) { - // An object. Recurse further. - deepValue(value, remaining, list); - } - } - } - - return list; -}; - -module.exports = function (obj, path) { - return deepValue(obj, path, []); -}; - -/***/ }), - -/***/ "./src/helpers/is_array.js": -/*!*********************************!*\ - !*** ./src/helpers/is_array.js ***! - \*********************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = function (obj) { - return !Array.isArray ? Object.prototype.toString.call(obj) === '[object Array]' : Array.isArray(obj); -}; - -/***/ }), - -/***/ "./src/index.js": -/*!**********************!*\ - !*** ./src/index.js ***! - \**********************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { - -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); } - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -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); - - this.options = { - location: location, - distance: distance, - threshold: threshold, - maxPatternLength: maxPatternLength, - isCaseSensitive: caseSensitive, - 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); - } - - _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 - }; - - this._log("---------\nSearch pattern: \"".concat(pattern, "\"")); - - var _this$_prepareSearche = this._prepareSearchers(pattern), - tokenSearchers = _this$_prepareSearche.tokenSearchers, - fullSearcher = _this$_prepareSearche.fullSearcher; - - var _this$_search = this._search(tokenSearchers, fullSearcher), - weights = _this$_search.weights, - results = _this$_search.results; - - this._computeScore(weights, results); - - 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 = []; - - if (this.options.tokenize) { - // Tokenize on the separator - var tokens = pattern.split(this.options.tokenSeparator); - - for (var i = 0, len = tokens.length; i < len; i += 1) { - tokenSearchers.push(new Bitap(tokens[i], this.options)); - } - } - - 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: weights, - results: results - }; - } - }, { - 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; - - // Check if the texvaluet can be searched - if (value === undefined || value === null) { - return; - } - - var exists = false; - var averageScore = -1; - var numTextMatches = 0; - - if (typeof value === 'string') { - this._log("\nKey: ".concat(key === '' ? '-' : key)); - - var mainSearchResult = fullSearcher.search(value); - - this._log("Full text: \"".concat(value, "\", score: ").concat(mainSearchResult.score)); - - if (this.options.tokenize) { - var words = value.split(this.options.tokenSeparator); - var scores = []; - - for (var i = 0; i < tokenSearchers.length; i += 1) { - var tokenSearcher = tokenSearchers[i]; - - this._log("\nPattern: \"".concat(tokenSearcher.pattern, "\"")); // let tokenScores = [] - - - var hasMatchInText = false; - - 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 (!this.options.matchAllTokens) { - scores.push(1); - } - } - - this._log("Token: \"".concat(word, "\", score: ").concat(obj[word])); // tokenScores.push(obj) - - } - - 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); - } - - var finalScore = mainSearchResult.score; - - if (averageScore > -1) { - finalScore = (finalScore + averageScore) / 2; - } - - this._log('Score average:', finalScore); - - var checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true; - - 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 - var existingResult = resultMap[index]; - - if (existingResult) { - // Use the lowest score - // existingResult.score, bitapResult.score - existingResult.output.push({ - key: key, - arrayIndex: arrayIndex, - value: value, - score: finalScore, - matchedIndices: mainSearchResult.matchedIndices - }); - } 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 - }); - } - } - } - }, { - 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); - } - }); - } - - if (this.options.includeScore) { - transformers.push(function (result, data) { - data.score = result.score; - }); - } - - for (var i = 0, len = results.length; i < len; i += 1) { - var result = results[i]; - - if (this.options.id) { - result.item = this.options.getFn(result.item, this.options.id)[0]; - } - - if (!transformers.length) { - finalOutput.push(result.item); - continue; - } - - var data = { - item: result.item - }; - - for (var j = 0, _len2 = transformers.length; j < _len2; j += 1) { - transformers[j](result, data); - } - - finalOutput.push(data); - } - - return finalOutput; - } - }, { - key: "_log", - value: function _log() { - if (this.options.verbose) { - var _console; - - (_console = console).log.apply(_console, arguments); - } - } - }]); - - return Fuse; -}(); - -module.exports = Fuse; - -/***/ }) - -/******/ }); -}); +!function(e,t){ true?module.exports=t():undefined}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},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="",n(n.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){function r(e){return(r="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 o(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),r=n.tokenSearchers,o=n.fullSearcher,i=this._search(r,o),a=i.weights,s=i.results;return this._computeScore(a,s),this.options.shouldSort&&this._sort(s),t.limit&&"number"==typeof t.limit&&(s=s.slice(0,t.limit)),this._format(s)}},{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),r=0,o=n.length;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=this.list,r={},o=[];if("string"==typeof n[0]){for(var i=0,a=n.length;i1)throw new Error("Key weight has to be > 0 and <= 1");d=d.name}else s[d]={weight:1};this._analyze({key:d,value:this.options.getFn(l,d),record:l,index:c},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:s,results:o}}},{key:"_analyze",value:function(e,t){var n=e.key,r=e.arrayIndex,o=void 0===r?-1:r,i=e.value,a=e.record,c=e.index,h=t.tokenSearchers,l=void 0===h?[]:h,u=t.fullSearcher,f=void 0===u?[]:u,d=t.resultMap,v=void 0===d?{}:d,p=t.results,g=void 0===p?[]:p;if(null!=i){var y=!1,m=-1,k=0;if("string"==typeof i){this._log("\nKey: ".concat(""===n?"-":n));var S=f.search(i);if(this._log('Full text: "'.concat(i,'", score: ').concat(S.score)),this.options.tokenize){for(var x=i.split(this.options.tokenSeparator),b=[],M=0;M-1&&(P=(P+m)/2),this._log("Score average:",P);var F=!this.options.tokenize||!this.options.matchAllTokens||k>=l.length;if(this._log("\nCheck Matches: ".concat(F)),(y||S.isMatch)&&F){var T=v[c];T?T.output.push({key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}):(v[c]={item:a,output:[{key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}]},g.push(v[c]))}}else if(s(i))for(var z=0,E=i.length;z-1&&(a.arrayIndex=i.arrayIndex),t.matches.push(a)}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score});for(var i=0,a=e.length;in)return o(e,this.pattern,r);var a=this.options,s=a.location,c=a.distance,h=a.threshold,l=a.findAllMatches,u=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:s,distance:c,threshold:h,findAllMatches:l,minMatchCharLength:u})}}])&&r(t.prototype,n),s&&r(t,s),e}();e.exports=s},function(e,t){var n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(n,"\\$&").replace(r,"|")),i=e.match(o),a=!!i,s=[];if(a)for(var c=0,h=i.length;c=P;z-=1){var E=z-1,K=n[e.charAt(E)];if(K&&(x[E]=1),T[z]=(T[z+1]<<1|1)&K,0!==I&&(T[z]|=(L[z+1]|L[z])<<1|1|L[z+1]),T[z]&C&&(w=r(t,{errors:I,currentLocation:E,expectedLocation:g,distance:h}))<=m){if(m=w,(k=E)<=g)break;P=Math.max(1,2*g-k)}}if(r(t,{errors:I+1,currentLocation:g,expectedLocation:g,distance:h})>m)break;L=T}return{isMatch:k>=0,score:0===w?.001:w,matchedIndices:o(x,p)}}},function(e,t){e.exports=function(e,t){var n=t.errors,r=void 0===n?0:n,o=t.currentLocation,i=void 0===o?0:o,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?100:c,l=r/e.length,u=Math.abs(s-i);return h?l+u/h:u?1:l}},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=[],r=-1,o=-1,i=0,a=e.length;i=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}},function(e,t){e.exports=function(e){for(var t={},n=e.length,r=0;r0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,s=-1,r=0,o=e.length;r=t&&i.push([n,s]),n=-1)}return e[r-1]&&r-n>=t&&i.push([n,r-1]),i}},"./src/bitap/bitap_pattern_alphabet.js": -/*!*********************************************!*\ - !*** ./src/bitap/bitap_pattern_alphabet.js ***! - \*********************************************/ -/*! no static exports found */function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n2&&void 0!==arguments[2]?arguments[2]:/ +/g,s=new RegExp(t.replace(i,"\\$&").replace(n,"|")),r=e.match(s),o=!!r,a=[];if(o)for(var l=0,c=r.length;l=D;j-=1){var M=j-1,N=i[e.charAt(M)];if(N&&(E[M]=1),F[j]=(F[j+1]<<1|1)&N,0!==T&&(F[j]|=(C[j+1]|C[j])<<1|1|C[j+1]),F[j]&x&&(O=n(t,{errors:T,currentLocation:M,expectedLocation:v,distance:c}))<=_){if(_=O,(b=M)<=v)break;D=Math.max(1,2*v-b)}}if(n(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:c})>_)break;C=F}return{isMatch:b>=0,score:0===O?.001:O,matchedIndices:s(E,m)}}},"./src/bitap/index.js": -/*!****************************!*\ - !*** ./src/bitap/index.js ***! - \****************************/ -/*! no static exports found */function(e,t,i){function n(e,t){for(var i=0;ii)return s(e,this.pattern,n);var o=this.options,a=o.location,l=o.distance,c=o.threshold,h=o.findAllMatches,u=o.minMatchCharLength;return r(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:h,minMatchCharLength:u})}}])&&n(t.prototype,i),a&&n(t,a),e}();e.exports=a},"./src/helpers/deep_value.js": -/*!***********************************!*\ - !*** ./src/helpers/deep_value.js ***! - \***********************************/ -/*! no static exports found */function(e,t,i){var n=i(/*! ./is_array */"./src/helpers/is_array.js");e.exports=function(e,t){return function e(t,i,s){if(i){var r=i.indexOf("."),o=i,a=null;-1!==r&&(o=i.slice(0,r),a=i.slice(r+1));var l=t[o];if(null!=l)if(a||"string"!=typeof l&&"number"!=typeof l)if(n(l))for(var c=0,h=l.length;c1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var i=this._prepareSearchers(e),n=i.tokenSearchers,s=i.fullSearcher,r=this._search(n,s),o=r.weights,a=r.results;return this._computeScore(o,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 i=e.split(this.options.tokenSeparator),n=0,s=i.length;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},s=[];if("string"==typeof i[0]){for(var r=0,o=i.length;r1)throw new Error("Key weight has to be > 0 and <= 1");p=p.name}else a[p]={weight:1};this._analyze({key:p,value:this.options.getFn(h,p),record:h,index:l},{resultMap:n,results:s,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:s}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayIndex,s=void 0===n?-1:n,r=e.value,o=e.record,l=e.index,c=t.tokenSearchers,h=void 0===c?[]:c,u=t.fullSearcher,d=void 0===u?[]:u,p=t.resultMap,f=void 0===p?{}:p,m=t.results,v=void 0===m?[]:m;if(null!=r){var g=!1,_=-1,b=0;if("string"==typeof r){this._log("\nKey: ".concat(""===i?"-":i));var y=d.search(r);if(this._log('Full text: "'.concat(r,'", score: ').concat(y.score)),this.options.tokenize){for(var E=r.split(this.options.tokenSeparator),S=[],I=0;I-1&&(D=(D+_)/2),this._log("Score average:",D);var P=!this.options.tokenize||!this.options.matchAllTokens||b>=h.length;if(this._log("\nCheck Matches: ".concat(P)),(g||y.isMatch)&&P){var F=f[l];F?F.output.push({key:i,arrayIndex:s,value:r,score:D,matchedIndices:y.matchedIndices}):(f[l]={item:o,output:[{key:i,arrayIndex:s,value:r,score:D,matchedIndices:y.matchedIndices}]},v.push(f[l]))}}else if(a(r))for(var j=0,M=r.length;j-1&&(o.arrayIndex=r.arrayIndex),t.matches.push(o)}}})),this.options.includeScore&&s.push((function(e,t){t.score=e.score}));for(var r=0,o=e.length;r/g,"&rt;").replace(/-1?e(t[i.substring(0,n)],i.substr(n+1)):t[i]},T=function(e){return JSON.parse(JSON.stringify(e))},L=function(e,t){var i=Object.keys(e).sort(),n=Object.keys(t).sort();return i.filter((function(e){return n.indexOf(e)<0}))},k=function(e){for(var t=Object.keys(e),i={},n=0;n-1?e.map((function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!0),i})):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map((function(e){var i=e;return i.id===parseInt(t.choiceId,10)&&(i.selected=!1),i})):e;case"FILTER_CHOICES":return e.map((function(e){var i=e;return i.active=t.results.some((function(e){var t=e.item,n=e.score;return t.id===i.id&&(i.score=n,!0)})),i}));case"ACTIVATE_CHOICES":return e.map((function(e){var i=e;return i.active=t.active,i}));case"CLEAR_CHOICES":return m;default:return e}},general:_}),D=function(e,t){var i=e;if("CLEAR_ALL"===t.type)i=void 0;else if("RESET_TO"===t.type)return T(t.state);return k(i,t)};function P(e,t){for(var i=0;i=t:"top"===this.position&&(s=!0),s},t.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},t.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},t.open=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)},t.close=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)},t.focus=function(){this.isFocussed||this.element.focus()},t.addFocusState=function(){this.element.classList.add(this.classNames.focusState)},t.removeFocusState=function(){this.element.classList.remove(this.classNames.focusState)},t.enable=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},t.disable=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},t.wrap=function(e){!function(e,t){void 0===t&&(t=document.createElement("div")),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)}(e,this.element)},t.unwrap=function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)},t.addLoadingState=function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},t.removeLoadingState=function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},t._onFocus=function(){this.isFocussed=!0},t._onBlur=function(){this.isFocussed=!1},e}();function N(e,t){for(var i=0;i=this._placeholderValue.length/1.25;(this.element.value&&n||e)&&this.calcWidth(i)}else this.calcWidth(i)},s.calcWidth=function(e){return function(e,t){var i=e.value||e.placeholder,n=e.offsetWidth;if(i){var s=O(""+C(i)+"");if(s.style.position="absolute",s.style.padding="0",s.style.top="-9999px",s.style.left="-9999px",s.style.width="auto",s.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var r=window.getComputedStyle(e);r&&(s.style.fontSize=r.fontSize,s.style.fontFamily=r.fontFamily,s.style.fontWeight=r.fontWeight,s.style.fontStyle=r.fontStyle,s.style.letterSpacing=r.letterSpacing,s.style.textTransform=r.textTransform,s.style.paddingLeft=r.paddingLeft,s.style.paddingRight=r.paddingRight)}document.body.appendChild(s),requestAnimationFrame((function(){i&&s.offsetWidth!==e.offsetWidth&&(n=s.offsetWidth+4),document.body.removeChild(s),t.call(void 0,n+"px")}))}else t.call(void 0,n+"px")}(this.element,e)},s.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},s.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},s._onInput=function(){"select-one"!==this.type&&this.setWidth()},s._onPaste=function(e){e.target===this.element&&this.preventPaste&&e.preventDefault()},s._onFocus=function(){this.isFocussed=!0},s._onBlur=function(){this.isFocussed=!1},t=e,(i=[{key:"placeholder",set:function(e){this.element.placeholder=e}},{key:"value",set:function(e){this.element.value=e},get:function(){return C(this.element.value)}}])&&N(t.prototype,i),n&&N(t,n),e}(),R={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilterFn:null,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,shouldSort:!0,shouldSortItems:!1,sortFn:function(e,t){var i=(""+(e.label||e.value)).toLowerCase(),n=(""+(t.label||t.value)).toLowerCase();return in?1:0},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",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add "'+C(e)+'"'},maxItemText:function(e){return"Only "+e+" values can be added"},itemComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{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"}},B="showDropdown",V="hideDropdown",H="change",G="choice",q="search",W="addItem",U="removeItem",z="highlightItem",X="highlightChoice",Y="ADD_CHOICE",$="FILTER_CHOICES",J="ACTIVATE_CHOICES",Z="CLEAR_CHOICES",Q="ADD_GROUP",ee="ADD_ITEM",te="REMOVE_ITEM",ie="HIGHLIGHT_ITEM",ne=46,se=8,re=13,oe=65,ae=27,le=38,ce=40,he=33,ue=34,de=function(){function e(e){var t=e.element;Object.assign(this,{element:t}),this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight,this.hasChildren=!!this.element.children}var t=e.prototype;return t.clear=function(){this.element.innerHTML=""},t.append=function(e){this.element.appendChild(e)},t.getChild=function(e){return this.element.querySelector(e)},t.scrollToTop=function(){this.element.scrollTop=0},t.scrollToChoice=function(e,t){var i=this;if(e){var n=this.element.offsetHeight,s=e.offsetHeight,r=e.offsetTop+s,o=this.element.scrollTop+n,a=t>0?this.element.scrollTop+r-o:e.offsetTop;requestAnimationFrame((function(e){i._animateScroll(e,a,t)}))}},t._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},t._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},t._animateScroll=function(e,t,i){var n=this,s=this.element.scrollTop,r=!1;i>0?(this._scrollDown(s,4,t),st&&(r=!0)),r&&requestAnimationFrame((function(){n._animateScroll(e,t,i)}))},e}();function pe(e,t){for(var i=0;i