diff --git a/.babelrc b/.babelrc
index f2e3127..d4b1424 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,3 +1,11 @@
{
- "presets": ["env", "stage-2"]
+ "presets": [
+ "@babel/preset-env"
+ ],
+ "plugins": [
+ "@babel/plugin-transform-modules-commonjs",
+ ["@babel/plugin-transform-spread", {
+ "loose": true
+ }]
+ ]
}
diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 0000000..7c8f0e2
--- /dev/null
+++ b/.browserslistrc
@@ -0,0 +1,2 @@
+> 5%
+IE 11
\ No newline at end of file
diff --git a/README.md b/README.md
index 381b9cd..b5d5b9a 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
# Choices.js ![Build Status](https://travis-ci.org/jshjohnson/Choices.svg?branch=master) [![](https://data.jsdelivr.com/v1/package/npm/choices.js/badge?style=rounded)](https://www.jsdelivr.com/package/npm/choices.js) [![npm](https://img.shields.io/npm/v/choices.js.svg)](https://www.npmjs.com/package/choices.js) [![codebeat badge](https://codebeat.co/badges/55120150-5866-42d8-8010-6aaaff5d3fa1)](https://codebeat.co/projects/github-com-jshjohnson-choices-master)
-A vanilla, lightweight (~25kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
+A vanilla, lightweight (~22kb gzipped 🎉), configurable select box/text input plugin. Similar to Select2 and Selectize but without the jQuery dependency.
[Demo](https://joshuajohnson.co.uk/Choices/)
@@ -919,6 +919,8 @@ Choices is compiled using [Babel](https://babeljs.io/) to enable support for [ES
* Array.prototype.map
* Array.prototype.find
* Array.prototype.some
+* Array.prototype.includes
+* Array.from
* Array.prototype.reduce
* Array.prototype.indexOf
* Object.assign
diff --git a/package.json b/package.json
index b02579c..c598ed0 100644
--- a/package.json
+++ b/package.json
@@ -13,13 +13,11 @@
"cypress:run": "$(npm bin)/cypress run",
"cypress:open": "$(npm bin)/cypress open",
"test": "run-p test:unit test:e2e",
- "test:unit": "mocha --require ./config/jsdom.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\" --exit",
+ "test:unit": "mocha --require ./config/jsdom.js --require @babel/register $(find src -name '*.test.js') --exit",
"test:unit:watch": "npm run test:unit -- --watch --inspect=5556",
"test:e2e": "run-p --race start cypress:run",
"js:watch": "NODE_ENV=development node server.js",
- "js:build:minimised": "webpack --env.minimize --config webpack.config.prod.js",
- "js:build:unminimised": "webpack --config webpack.config.prod.js",
- "js:build": "run-p js:build:minimised js:build:unminimised",
+ "js:build": "webpack --config webpack.config.prod.js",
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
"css:build": "run-p css:sass css:prefix css:min",
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
@@ -28,7 +26,7 @@
"bump-cache": "node bump-cache.js --current $npm_package_version",
"deploy": "git subtree push --prefix public origin gh-pages",
"postversion": "npm run js:build && npm run bump-cache",
- "prepush": "run-p lint test:unit"
+ "prepush": "run-p lint test:unit && npm run bundlesize"
},
"repository": {
"type": "git",
@@ -55,49 +53,53 @@
"js"
],
"devDependencies": {
+ "@babel/core": "^7.2.2",
+ "@babel/plugin-proposal-class-properties": "^7.3.0",
+ "@babel/plugin-transform-modules-commonjs": "^7.2.0",
+ "@babel/plugin-transform-spread": "^7.2.2",
+ "@babel/preset-env": "^7.3.1",
+ "@babel/register": "^7.0.0",
"autoprefixer": "^6.3.3",
- "babel-core": "^6.26.0",
- "babel-eslint": "^7.2.3",
- "babel-loader": "^7.1.2",
- "babel-preset-env": "^1.6.1",
- "babel-preset-stage-2": "^6.24.1",
+ "babel-eslint": "^9.0.0",
+ "babel-loader": "^8.0.5",
"bundlesize": "^0.17.1",
- "chai": "^4.1.0",
+ "chai": "^4.2.0",
"csso": "^1.8.2",
- "cypress": "^3.1.4",
+ "cypress": "^3.1.5",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.1.0",
- "eslint-config-prettier": "^2.9.0",
- "eslint-loader": "^1.5.0",
- "eslint-plugin-cypress": "^2.0.1",
- "eslint-plugin-import": "^2.7.0",
+ "eslint-config-prettier": "^2.10.0",
+ "eslint-loader": "^2.1.2",
+ "eslint-plugin-cypress": "^2.2.0",
+ "eslint-plugin-import": "^2.16.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
- "eslint-plugin-prettier": "^2.6.0",
- "eslint-plugin-react": "^7.2.1",
- "express": "^4.16.3",
+ "eslint-plugin-prettier": "^2.7.0",
+ "eslint-plugin-react": "^7.12.4",
+ "express": "^4.16.4",
"husky": "^0.14.3",
- "jsdom": "^11.5.1",
- "mocha": "^3.4.2",
- "node-sass": "^4.9.3",
- "nodemon": "^1.18.9",
- "npm-run-all": "^4.1.3",
- "nyc": "^11.0.3",
- "opn": "^5.1.0",
+ "jsdom": "^11.12.0",
+ "mocha": "^5.2.0",
+ "node-sass": "^4.11.0",
+ "nodemon": "^1.18.10",
+ "npm-run-all": "^4.1.5",
+ "nyc": "^11.9.0",
+ "opn": "^5.4.0",
"postcss-cli": "^2.5.1",
- "prettier": "^1.13.0",
+ "prettier": "^1.16.4",
"sinon": "^2.4.0",
- "webpack": "^3.8.1",
- "webpack-dev-middleware": "^2.0.0",
- "webpack-hot-middleware": "^2.22.2",
+ "unminified-webpack-plugin": "^2.0.0",
+ "webpack": "^4.29.3",
+ "webpack-cli": "^3.2.3",
+ "webpack-dev-middleware": "^3.5.2",
+ "webpack-hot-middleware": "^2.24.3",
"whatwg-fetch": "^1.0.0",
- "wrapper-webpack-plugin": "^0.1.7"
+ "wrapper-webpack-plugin": "^2.1.0"
},
"dependencies": {
- "classnames": "^2.2.5",
- "core-js": "^2.5.6",
+ "classnames": "^2.2.6",
"custom-event-polyfill": "^0.3.0",
"deepmerge": "^2.2.1",
- "fuse.js": "^3.1.0",
+ "fuse.js": "^3.4.1",
"redux": "^3.3.1"
},
"npmName": "choices.js",
diff --git a/public/assets/scripts/choices.js b/public/assets/scripts/choices.js
index 858de55..aac6c15 100644
--- a/public/assets/scripts/choices.js
+++ b/public/assets/scripts/choices.js
@@ -1,18 +1,17 @@
-/*! choices.js v4.1.4 | (c) 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) {
- //CommonJS2
+ //CommonJS2
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
- //AMD
+ //AMD
else if(typeof define === 'function' && define.amd)
define([], factory);
- //CommonJS
+ //CommonJS
else if(typeof exports === 'object')
exports["Choices"] = factory();
- //Window
+ //Window
else
root["Choices"] = factory();
-})(typeof self !== 'undefined' ? self : this, function() {
+})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
@@ -51,14 +50,34 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, {
-/******/ configurable: false,
-/******/ enumerable: true,
-/******/ get: getter
-/******/ });
+/******/ 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 ?
@@ -74,44 +93,33 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/public/assets/scripts/";
/******/
+/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 37);
+/******/ return __webpack_require__(__webpack_require__.s = 9);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
-var store = __webpack_require__(26)('wks');
-var uid = __webpack_require__(13);
-var Symbol = __webpack_require__(3).Symbol;
-var USE_SYMBOL = typeof Symbol == 'function';
-
-var $exports = module.exports = function (name) {
- return store[name] || (store[name] =
- USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
-};
-
-$exports.store = store;
-
-
-/***/ }),
-/* 1 */
-/***/ (function(module, exports, __webpack_require__) {
-
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
-/* eslint-disable */
+exports.doKeysMatch = exports.cloneObject = exports.existsInArray = exports.isIE11 = exports.fetchFromObject = exports.reduceToValues = exports.getWindowHeight = exports.regexFilter = exports.dispatchEvent = exports.sortByScore = exports.sortByAlpha = exports.calcWidthOfInput = exports.strToEl = exports.stripHTML = exports.isScrolledIntoView = exports.getAdjacentEl = exports.findAncestorByAttrName = exports.findAncestor = exports.wrap = exports.extend = exports.isElement = exports.isType = exports.getType = exports.generateId = exports.generateChars = exports.getRandomNumber = void 0;
-var getRandomNumber = exports.getRandomNumber = function getRandomNumber(min, max) {
+var _this = void 0;
+
+/* eslint-disable */
+var getRandomNumber = function getRandomNumber(min, max) {
return Math.floor(Math.random() * (max - min) + min);
};
-var generateChars = exports.generateChars = function generateChars(length) {
+exports.getRandomNumber = getRandomNumber;
+
+var generateChars = function generateChars(length) {
var chars = '';
for (var i = 0; i < length; i++) {
@@ -122,35 +130,44 @@ var generateChars = exports.generateChars = function generateChars(length) {
return chars;
};
-var generateId = exports.generateId = function generateId(element, prefix) {
- var id = element.id || element.name && element.name + '-' + generateChars(2) || generateChars(4);
- id = id.replace(/(:|\.|\[|\]|,)/g, '');
- id = prefix + '-' + id;
+exports.generateChars = generateChars;
+var generateId = function generateId(element, prefix) {
+ var id = element.id || element.name && "".concat(element.name, "-").concat(generateChars(2)) || generateChars(4);
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
+ id = "".concat(prefix, "-").concat(id);
return id;
};
-var getType = exports.getType = function getType(obj) {
+exports.generateId = generateId;
+
+var getType = function getType(obj) {
return Object.prototype.toString.call(obj).slice(8, -1);
};
-var isType = exports.isType = function isType(type, obj) {
+exports.getType = getType;
+
+var isType = function isType(type, obj) {
var clas = getType(obj);
return obj !== undefined && obj !== null && clas === type;
};
-var isElement = exports.isElement = function isElement(element) {
+exports.isType = isType;
+
+var isElement = function isElement(element) {
return element instanceof Element;
};
-var extend = exports.extend = function extend() {
+exports.isElement = isElement;
+
+var extend = function extend() {
var extended = {};
var length = arguments.length;
-
/**
* Merge one object into another
* @param {Object} obj Object to merge into extended object
*/
+
var merge = function merge(obj) {
for (var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
@@ -162,14 +179,13 @@ var extend = exports.extend = function extend() {
}
}
}
- };
+ }; // Loop through each passed argument
+
- // Loop through each passed argument
for (var i = 0; i < length; i++) {
// store argument at position i
- var obj = arguments[i];
+ var obj = arguments[i]; // If we are in fact dealing with an object, merge it.
- // If we are in fact dealing with an object, merge it.
if (isType('Object', obj)) {
merge(obj);
}
@@ -178,22 +194,33 @@ var extend = exports.extend = function extend() {
return extended;
};
-var wrap = exports.wrap = function wrap(element, wrapper) {
+exports.extend = extend;
+
+var wrap = function wrap(element, wrapper) {
wrapper = wrapper || document.createElement('div');
+
if (element.nextSibling) {
element.parentNode.insertBefore(wrapper, element.nextSibling);
} else {
element.parentNode.appendChild(wrapper);
}
+
return wrapper.appendChild(element);
};
-var findAncestor = exports.findAncestor = function findAncestor(el, cls) {
- while ((el = el.parentElement) && !el.classList.contains(cls)) {}
+exports.wrap = wrap;
+
+var findAncestor = function findAncestor(el, cls) {
+ while ((el = el.parentElement) && !el.classList.contains(cls)) {
+ ;
+ }
+
return el;
};
-var findAncestorByAttrName = exports.findAncestorByAttrName = function findAncestorByAttrName(el, attr) {
+exports.findAncestor = findAncestor;
+
+var findAncestorByAttrName = function findAncestorByAttrName(el, attr) {
var target = el;
while (target) {
@@ -207,26 +234,24 @@ var findAncestorByAttrName = exports.findAncestorByAttrName = function findAnces
return null;
};
-var getAdjacentEl = exports.getAdjacentEl = function getAdjacentEl(startEl, className) {
+exports.findAncestorByAttrName = findAncestorByAttrName;
+
+var getAdjacentEl = function getAdjacentEl(startEl, className) {
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
-
if (!startEl || !className) return;
-
var parent = startEl.parentNode.parentNode;
var children = Array.from(parent.querySelectorAll(className));
-
var startPos = children.indexOf(startEl);
var operatorDirection = direction > 0 ? 1 : -1;
-
return children[startPos + operatorDirection];
};
-var isScrolledIntoView = exports.isScrolledIntoView = function isScrolledIntoView(el, parent) {
+exports.getAdjacentEl = getAdjacentEl;
+
+var isScrolledIntoView = function isScrolledIntoView(el, parent) {
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
-
if (!el) return;
-
- var isVisible = void 0;
+ var isVisible;
if (direction > 0) {
// In view from bottom
@@ -239,15 +264,19 @@ var isScrolledIntoView = exports.isScrolledIntoView = function isScrolledIntoVie
return isVisible;
};
-var stripHTML = exports.stripHTML = function stripHTML(html) {
+exports.isScrolledIntoView = isScrolledIntoView;
+
+var stripHTML = function stripHTML(html) {
return html.replace(/&/g, '&').replace(/>/g, '&rt;').replace(/' + stripHTML(value) + '');
+ var testEl = strToEl("".concat(stripHTML(value), ""));
testEl.style.position = 'absolute';
testEl.style.padding = '0';
testEl.style.top = '-9999px';
@@ -291,22 +323,22 @@ var calcWidthOfInput = exports.calcWidthOfInput = function calcWidthOfInput(inpu
}
document.body.appendChild(testEl);
-
requestAnimationFrame(function () {
if (value && testEl.offsetWidth !== input.offsetWidth) {
width = testEl.offsetWidth + 4;
}
document.body.removeChild(testEl);
-
- callback.call(undefined, width + 'px');
+ callback.call(_this, "".concat(width, "px"));
});
} else {
- callback.call(undefined, width + 'px');
+ callback.call(_this, "".concat(width, "px"));
}
};
-var sortByAlpha = exports.sortByAlpha = function sortByAlpha(a, b) {
+exports.calcWidthOfInput = calcWidthOfInput;
+
+var sortByAlpha = function sortByAlpha(a, b) {
var labelA = (a.label || a.value).toLowerCase();
var labelB = (b.label || b.value).toLowerCase();
@@ -321,23 +353,27 @@ var sortByAlpha = exports.sortByAlpha = function sortByAlpha(a, b) {
return 0;
};
-var sortByScore = exports.sortByScore = function sortByScore(a, b) {
+exports.sortByAlpha = sortByAlpha;
+
+var sortByScore = function sortByScore(a, b) {
return a.score - b.score;
};
-var dispatchEvent = exports.dispatchEvent = function dispatchEvent(element, type) {
- var customArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
+exports.sortByScore = sortByScore;
+var dispatchEvent = function dispatchEvent(element, type) {
+ var customArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var event = new CustomEvent(type, {
detail: customArgs,
bubbles: true,
cancelable: true
});
-
return element.dispatchEvent(event);
};
-var regexFilter = exports.regexFilter = function regexFilter(value, regex) {
+exports.dispatchEvent = dispatchEvent;
+
+var regexFilter = function regexFilter(value, regex) {
if (!value || !regex) {
return false;
}
@@ -346,24 +382,28 @@ var regexFilter = exports.regexFilter = function regexFilter(value, regex) {
return expression.test(value);
};
-var getWindowHeight = exports.getWindowHeight = function getWindowHeight() {
+exports.regexFilter = regexFilter;
+
+var getWindowHeight = function getWindowHeight() {
var body = document.body;
var html = document.documentElement;
return Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
};
-var reduceToValues = exports.reduceToValues = function reduceToValues(items) {
- var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
+exports.getWindowHeight = getWindowHeight;
+var reduceToValues = function reduceToValues(items) {
+ var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
var values = items.reduce(function (prev, current) {
prev.push(current[key]);
return prev;
}, []);
-
return values;
};
-var fetchFromObject = exports.fetchFromObject = function fetchFromObject(object, path) {
+exports.reduceToValues = reduceToValues;
+
+var fetchFromObject = function fetchFromObject(object, path) {
var index = path.indexOf('.');
if (index > -1) {
@@ -373,11 +413,15 @@ var fetchFromObject = exports.fetchFromObject = function fetchFromObject(object,
return object[path];
};
-var isIE11 = exports.isIE11 = function isIE11() {
+exports.fetchFromObject = fetchFromObject;
+
+var isIE11 = function isIE11() {
return !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/));
};
-var existsInArray = exports.existsInArray = function existsInArray(array, value) {
+exports.isIE11 = isIE11;
+
+var existsInArray = function existsInArray(array, value) {
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
return array.some(function (item) {
if (isType('String', value)) {
@@ -388,52 +432,24 @@ var existsInArray = exports.existsInArray = function existsInArray(array, value)
});
};
-var cloneObject = exports.cloneObject = function cloneObject(obj) {
+exports.existsInArray = existsInArray;
+
+var cloneObject = function cloneObject(obj) {
return JSON.parse(JSON.stringify(obj));
};
-var doKeysMatch = exports.doKeysMatch = function doKeysMatch(a, b) {
+exports.cloneObject = cloneObject;
+
+var doKeysMatch = function doKeysMatch(a, b) {
var aKeys = Object.keys(a).sort();
var bKeys = Object.keys(b).sort();
return JSON.stringify(aKeys) === JSON.stringify(bKeys);
};
-/***/ }),
-/* 2 */
-/***/ (function(module, exports) {
-
-var core = module.exports = { version: '2.5.7' };
-if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
-
+exports.doKeysMatch = doKeysMatch;
/***/ }),
-/* 3 */
-/***/ (function(module, exports) {
-
-// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
-var global = module.exports = typeof window != 'undefined' && window.Math == Math
- ? window : typeof self != 'undefined' && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
-if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
-
-
-/***/ }),
-/* 4 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var dP = __webpack_require__(7);
-var createDesc = __webpack_require__(12);
-module.exports = __webpack_require__(10) ? function (object, key, value) {
- return dP.f(object, key, createDesc(1, value));
-} : function (object, key, value) {
- object[key] = value;
- return object;
-};
-
-
-/***/ }),
-/* 5 */
+/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -442,11 +458,11 @@ module.exports = __webpack_require__(10) ? function (object, key, value) {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.SCROLLING_SPEED = exports.KEY_CODES = exports.ACTION_TYPES = exports.EVENTS = exports.DEFAULT_CONFIG = exports.DEFAULT_CLASSNAMES = undefined;
+exports.SCROLLING_SPEED = exports.KEY_CODES = exports.ACTION_TYPES = exports.EVENTS = exports.DEFAULT_CONFIG = exports.DEFAULT_CLASSNAMES = void 0;
-var _utils = __webpack_require__(1);
+var _utils = __webpack_require__(0);
-var DEFAULT_CLASSNAMES = exports.DEFAULT_CLASSNAMES = {
+var DEFAULT_CLASSNAMES = {
containerOuter: 'choices',
containerInner: 'choices__inner',
input: 'choices__input',
@@ -474,8 +490,8 @@ var DEFAULT_CLASSNAMES = exports.DEFAULT_CLASSNAMES = {
noResults: 'has-no-results',
noChoices: 'has-no-choices'
};
-
-var DEFAULT_CONFIG = exports.DEFAULT_CONFIG = {
+exports.DEFAULT_CLASSNAMES = DEFAULT_CLASSNAMES;
+var DEFAULT_CONFIG = {
items: [],
choices: [],
silent: false,
@@ -511,10 +527,10 @@ var DEFAULT_CONFIG = exports.DEFAULT_CONFIG = {
itemSelectText: 'Press to select',
uniqueItemText: 'Only unique values can be added',
addItemText: function addItemText(value) {
- return 'Press Enter to add "' + (0, _utils.stripHTML)(value) + '"';
+ return "Press Enter to add \"".concat((0, _utils.stripHTML)(value), "\"");
},
maxItemText: function maxItemText(maxItemCount) {
- return 'Only ' + maxItemCount + ' values can be added';
+ return "Only ".concat(maxItemCount, " values can be added");
},
itemComparer: function itemComparer(choice, item) {
return choice === item;
@@ -526,8 +542,8 @@ var DEFAULT_CONFIG = exports.DEFAULT_CONFIG = {
callbackOnCreateTemplates: null,
classNames: DEFAULT_CLASSNAMES
};
-
-var EVENTS = exports.EVENTS = {
+exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
+var EVENTS = {
showDropdown: 'showDropdown',
hideDropdown: 'hideDropdown',
change: 'change',
@@ -538,8 +554,8 @@ var EVENTS = exports.EVENTS = {
highlightItem: 'highlightItem',
highlightChoice: 'highlightChoice'
};
-
-var ACTION_TYPES = exports.ACTION_TYPES = {
+exports.EVENTS = EVENTS;
+var ACTION_TYPES = {
ADD_CHOICE: 'ADD_CHOICE',
FILTER_CHOICES: 'FILTER_CHOICES',
ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',
@@ -550,8 +566,8 @@ var ACTION_TYPES = exports.ACTION_TYPES = {
HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',
CLEAR_ALL: 'CLEAR_ALL'
};
-
-var KEY_CODES = exports.KEY_CODES = {
+exports.ACTION_TYPES = ACTION_TYPES;
+var KEY_CODES = {
BACK_KEY: 46,
DELETE_KEY: 8,
ENTER_KEY: 13,
@@ -562,432 +578,283 @@ var KEY_CODES = exports.KEY_CODES = {
PAGE_UP_KEY: 33,
PAGE_DOWN_KEY: 34
};
-
-var SCROLLING_SPEED = exports.SCROLLING_SPEED = 4;
+exports.KEY_CODES = KEY_CODES;
+var SCROLLING_SPEED = 4;
+exports.SCROLLING_SPEED = SCROLLING_SPEED;
/***/ }),
-/* 6 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var global = __webpack_require__(3);
-var core = __webpack_require__(2);
-var hide = __webpack_require__(4);
-var redefine = __webpack_require__(24);
-var ctx = __webpack_require__(14);
-var PROTOTYPE = 'prototype';
-
-var $export = function (type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
- var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
- var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
- var key, own, out, exp;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- // export native or passed
- out = (own ? target : source)[key];
- // bind timers to global for call from export context
- exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- // extend global
- if (target) redefine(target, key, out, type & $export.U);
- // export
- if (exports[key] != out) hide(exports, key, exp);
- if (IS_PROTO && expProto[key] != out) expProto[key] = out;
- }
-};
-global.core = core;
-// type bitmap
-$export.F = 1; // forced
-$export.G = 2; // global
-$export.S = 4; // static
-$export.P = 8; // proto
-$export.B = 16; // bind
-$export.W = 32; // wrap
-$export.U = 64; // safe
-$export.R = 128; // real proto method for `library`
-module.exports = $export;
-
-
-/***/ }),
-/* 7 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var anObject = __webpack_require__(8);
-var IE8_DOM_DEFINE = __webpack_require__(44);
-var toPrimitive = __webpack_require__(45);
-var dP = Object.defineProperty;
-
-exports.f = __webpack_require__(10) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return dP(O, P, Attributes);
- } catch (e) { /* empty */ }
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
-};
-
-
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var isObject = __webpack_require__(9);
-module.exports = function (it) {
- if (!isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
-};
-
-
-/***/ }),
-/* 9 */
-/***/ (function(module, exports) {
-
-module.exports = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
-};
-
-
-/***/ }),
-/* 10 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// Thank's IE8 for his funny defineProperty
-module.exports = !__webpack_require__(22)(function () {
- return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
-});
-
-
-/***/ }),
-/* 11 */
-/***/ (function(module, exports) {
-
-var hasOwnProperty = {}.hasOwnProperty;
-module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
-};
-
-
-/***/ }),
-/* 12 */
-/***/ (function(module, exports) {
-
-module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
-};
-
-
-/***/ }),
-/* 13 */
-/***/ (function(module, exports) {
-
-var id = 0;
-var px = Math.random();
-module.exports = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
-};
-
-
-/***/ }),
-/* 14 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// optional / simple context binding
-var aFunction = __webpack_require__(46);
-module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
-};
-
-
-/***/ }),
-/* 15 */
-/***/ (function(module, exports) {
-
-var toString = {}.toString;
-
-module.exports = function (it) {
- return toString.call(it).slice(8, -1);
-};
-
-
-/***/ }),
-/* 16 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 7.1.13 ToObject(argument)
-var defined = __webpack_require__(17);
-module.exports = function (it) {
- return Object(defined(it));
-};
-
-
-/***/ }),
-/* 17 */
-/***/ (function(module, exports) {
-
-// 7.2.1 RequireObjectCoercible(argument)
-module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
-};
-
-
-/***/ }),
-/* 18 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 7.1.15 ToLength
-var toInteger = __webpack_require__(19);
-var min = Math.min;
-module.exports = function (it) {
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
-};
-
-
-/***/ }),
-/* 19 */
-/***/ (function(module, exports) {
-
-// 7.1.4 ToInteger
-var ceil = Math.ceil;
-var floor = Math.floor;
-module.exports = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
-};
-
-
-/***/ }),
-/* 20 */
-/***/ (function(module, exports) {
-
-module.exports = {};
-
-
-/***/ }),
-/* 21 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var shared = __webpack_require__(26)('keys');
-var uid = __webpack_require__(13);
-module.exports = function (key) {
- return shared[key] || (shared[key] = uid(key));
-};
-
-
-/***/ }),
-/* 22 */
-/***/ (function(module, exports) {
-
-module.exports = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
-};
-
-
-/***/ }),
-/* 23 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var isObject = __webpack_require__(9);
-var document = __webpack_require__(3).document;
-// typeof document.createElement is 'object' in old IE
-var is = isObject(document) && isObject(document.createElement);
-module.exports = function (it) {
- return is ? document.createElement(it) : {};
-};
-
-
-/***/ }),
-/* 24 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var global = __webpack_require__(3);
-var hide = __webpack_require__(4);
-var has = __webpack_require__(11);
-var SRC = __webpack_require__(13)('src');
-var TO_STRING = 'toString';
-var $toString = Function[TO_STRING];
-var TPL = ('' + $toString).split(TO_STRING);
-
-__webpack_require__(2).inspectSource = function (it) {
- return $toString.call(it);
-};
-
-(module.exports = function (O, key, val, safe) {
- var isFunction = typeof val == 'function';
- if (isFunction) has(val, 'name') || hide(val, 'name', key);
- if (O[key] === val) return;
- if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
- if (O === global) {
- O[key] = val;
- } else if (!safe) {
- delete O[key];
- hide(O, key, val);
- } else if (O[key]) {
- O[key] = val;
- } else {
- hide(O, key, val);
- }
-// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
-})(Function.prototype, TO_STRING, function toString() {
- return typeof this == 'function' && this[SRC] || $toString.call(this);
-});
-
-
-/***/ }),
-/* 25 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// fallback for non-array-like ES3 and non-enumerable old V8 strings
-var cof = __webpack_require__(15);
-// eslint-disable-next-line no-prototype-builtins
-module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return cof(it) == 'String' ? it.split('') : Object(it);
-};
-
-
-/***/ }),
-/* 26 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var core = __webpack_require__(2);
-var global = __webpack_require__(3);
-var SHARED = '__core-js_shared__';
-var store = global[SHARED] || (global[SHARED] = {});
-
-(module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
-})('versions', []).push({
- version: core.version,
- mode: __webpack_require__(27) ? 'pure' : 'global',
- copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
-});
-
-
-/***/ }),
-/* 27 */
-/***/ (function(module, exports) {
-
-module.exports = false;
-
-
-/***/ }),
-/* 28 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 22.1.3.31 Array.prototype[@@unscopables]
-var UNSCOPABLES = __webpack_require__(0)('unscopables');
-var ArrayProto = Array.prototype;
-if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(4)(ArrayProto, UNSCOPABLES, {});
-module.exports = function (key) {
- ArrayProto[UNSCOPABLES][key] = true;
-};
-
-
-/***/ }),
-/* 29 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// to indexed object, toObject with fallback for non-array-like ES3 strings
-var IObject = __webpack_require__(25);
-var defined = __webpack_require__(17);
-module.exports = function (it) {
- return IObject(defined(it));
-};
-
-
-/***/ }),
-/* 30 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// false -> Array#indexOf
-// true -> Array#includes
-var toIObject = __webpack_require__(29);
-var toLength = __webpack_require__(18);
-var toAbsoluteIndex = __webpack_require__(60);
-module.exports = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- } return !IS_INCLUDES && -1;
- };
-};
-
-
-/***/ }),
-/* 31 */
-/***/ (function(module, exports) {
-
-// IE 8- don't enum bug keys
-module.exports = (
- 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
-).split(',');
-
-
-/***/ }),
-/* 32 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var def = __webpack_require__(7).f;
-var has = __webpack_require__(11);
-var TAG = __webpack_require__(0)('toStringTag');
-
-module.exports = function (it, tag, stat) {
- if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
-};
-
-
-/***/ }),
-/* 33 */
+/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
+/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
+/* global window */
+
+
+var root;
+
+if (typeof self !== 'undefined') {
+ root = self;
+} else if (typeof window !== 'undefined') {
+ root = window;
+} else if (typeof global !== 'undefined') {
+ root = global;
+} else if (true) {
+ root = module;
+} else {}
+
+var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(root);
+/* harmony default export */ __webpack_exports__["a"] = (result);
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3), __webpack_require__(16)(module)))
+
+/***/ }),
+/* 3 */
+/***/ (function(module, exports) {
+
+var g;
+
+// This works in non-strict mode
+g = (function() {
+ return this;
+})();
+
+try {
+ // This works if eval is allowed (see CSP)
+ g = g || new Function("return this")();
+} catch (e) {
+ // This works if the window reference is available
+ if (typeof window === "object") g = window;
+}
+
+// g can still be undefined, but nothing to do about it...
+// We return undefined, instead of nothing here, so it's
+// easier to handle this case. if(!global) { ...}
+
+module.exports = g;
+
+
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = void 0;
+
+var _utils = __webpack_require__(0);
+
+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 WrappedElement =
+/*#__PURE__*/
+function () {
+ function WrappedElement(_ref) {
+ var element = _ref.element,
+ classNames = _ref.classNames;
+
+ _classCallCheck(this, WrappedElement);
+
+ Object.assign(this, {
+ element: element,
+ classNames: classNames
+ });
+
+ if (!(0, _utils.isElement)(element)) {
+ throw new TypeError('Invalid element passed');
+ }
+
+ this.isDisabled = false;
+ }
+
+ _createClass(WrappedElement, [{
+ key: "conceal",
+ value: function conceal() {
+ // Hide passed input
+ this.element.classList.add(this.classNames.input);
+ this.element.classList.add(this.classNames.hiddenState); // Remove element from tab index
+
+ this.element.tabIndex = '-1'; // Backup original styles if any
+
+ var origStyle = this.element.getAttribute('style');
+
+ if (origStyle) {
+ this.element.setAttribute('data-choice-orig-style', origStyle);
+ }
+
+ this.element.setAttribute('aria-hidden', 'true');
+ this.element.setAttribute('data-choice', 'active');
+ }
+ }, {
+ key: "reveal",
+ value: function reveal() {
+ // Reinstate passed element
+ this.element.classList.remove(this.classNames.input);
+ this.element.classList.remove(this.classNames.hiddenState);
+ this.element.removeAttribute('tabindex'); // Recover original styles if any
+
+ var origStyle = this.element.getAttribute('data-choice-orig-style');
+
+ if (origStyle) {
+ this.element.removeAttribute('data-choice-orig-style');
+ this.element.setAttribute('style', origStyle);
+ } else {
+ this.element.removeAttribute('style');
+ }
+
+ this.element.removeAttribute('aria-hidden');
+ this.element.removeAttribute('data-choice'); // Re-assign values - this is weird, I know
+
+ this.element.value = this.element.value;
+ }
+ }, {
+ key: "enable",
+ value: function enable() {
+ this.element.removeAttribute('disabled');
+ this.element.disabled = false;
+ this.isDisabled = false;
+ }
+ }, {
+ key: "disable",
+ value: function disable() {
+ this.element.setAttribute('disabled', '');
+ this.element.disabled = true;
+ this.isDisabled = true;
+ }
+ }, {
+ key: "triggerEvent",
+ value: function triggerEvent(eventType, data) {
+ (0, _utils.dispatchEvent)(this.element, eventType, data);
+ }
+ }, {
+ key: "value",
+ get: function get() {
+ return this.element.value;
+ }
+ }]);
+
+ return WrappedElement;
+}();
+
+exports.default = WrappedElement;
+
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = exports.TEMPLATES = void 0;
+
+var _classnames = _interopRequireDefault(__webpack_require__(29));
+
+var _utils = __webpack_require__(0);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+var TEMPLATES = {
+ containerOuter: function containerOuter(globalClasses, direction, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {
+ var tabIndex = isSelectOneElement ? 'tabindex="0"' : '';
+ var role = isSelectElement ? 'role="listbox"' : '';
+ var ariaAutoComplete = '';
+
+ if (isSelectElement && searchEnabled) {
+ role = 'role="combobox"';
+ ariaAutoComplete = 'aria-autocomplete="list"';
+ }
+
+ return (0, _utils.strToEl)("\n
\n
\n "));
+ },
+ containerInner: function containerInner(globalClasses) {
+ return (0, _utils.strToEl)("\n \n "));
+ },
+ itemList: function itemList(globalClasses, isSelectOneElement) {
+ var _classNames;
+
+ var localClasses = (0, _classnames.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !isSelectOneElement), _classNames));
+ return (0, _utils.strToEl)("\n \n "));
+ },
+ placeholder: function placeholder(globalClasses, value) {
+ return (0, _utils.strToEl)("\n \n ").concat(value, "\n
\n "));
+ },
+ item: function item(globalClasses, data, removeItemButton) {
+ var _classNames2;
+
+ var ariaSelected = data.active ? 'aria-selected="true"' : '';
+ var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
+ var localClasses = (0, _classnames.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _defineProperty(_classNames2, globalClasses.placeholder, data.placeholder), _classNames2));
+
+ if (removeItemButton) {
+ 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 "));
+ },
+ choiceList: function choiceList(globalClasses, isSelectOneElement) {
+ var ariaMultiSelectable = !isSelectOneElement ? 'aria-multiselectable="true"' : '';
+ return (0, _utils.strToEl)("\n \n
\n "));
+ },
+ choiceGroup: function choiceGroup(globalClasses, data) {
+ var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
+ var localClasses = (0, _classnames.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
+ return (0, _utils.strToEl)("\n \n
").concat(data.value, "
\n
\n "));
+ },
+ choice: function choice(globalClasses, data, itemSelectText) {
+ var _classNames5;
+
+ var role = data.groupId > 0 ? 'role="treeitem"' : 'role="option"';
+ var localClasses = (0, _classnames.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames5, globalClasses.placeholder, data.placeholder), _classNames5));
+ return (0, _utils.strToEl)("\n \n ").concat(data.label, "\n
\n "));
+ },
+ input: function input(globalClasses) {
+ var localClasses = (0, _classnames.default)(globalClasses.input, globalClasses.inputCloned);
+ return (0, _utils.strToEl)("\n \n "));
+ },
+ dropdown: function dropdown(globalClasses) {
+ var localClasses = (0, _classnames.default)(globalClasses.list, globalClasses.listDropdown);
+ return (0, _utils.strToEl)("\n \n
\n "));
+ },
+ notice: function notice(globalClasses, label) {
+ var _classNames6;
+
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+ var localClasses = (0, _classnames.default)(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _defineProperty(_classNames6, globalClasses.noResults, type === 'no-results'), _defineProperty(_classNames6, globalClasses.noChoices, type === 'no-choices'), _classNames6));
+ return (0, _utils.strToEl)("\n \n ").concat(label, "\n
\n "));
+ },
+ option: function option(data) {
+ return (0, _utils.strToEl)("\n \n "));
+ }
+};
+exports.TEMPLATES = TEMPLATES;
+var _default = TEMPLATES;
+exports.default = _default;
+
+/***/ }),
+/* 6 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: ./node_modules/lodash-es/_freeGlobal.js
-var _freeGlobal = __webpack_require__(74);
+var _freeGlobal = __webpack_require__(8);
// CONCATENATED MODULE: ./node_modules/lodash-es/_root.js
@@ -1231,7 +1098,7 @@ function isPlainObject(value) {
/* harmony default export */ var lodash_es_isPlainObject = (isPlainObject);
// EXTERNAL MODULE: ./node_modules/symbol-observable/es/index.js
-var es = __webpack_require__(75);
+var es = __webpack_require__(2);
// CONCATENATED MODULE: ./node_modules/redux/es/createStore.js
@@ -1489,7 +1356,7 @@ var ActionTypes = {
* @param {String} message The warning message.
* @returns {void}
*/
-function warning_warning(message) {
+function warning(message) {
/* eslint-disable no-console */
if (typeof console !== 'undefined' && typeof console.error === 'function') {
console.error(message);
@@ -1579,11 +1446,7 @@ function combineReducers(reducers) {
for (var i = 0; i < reducerKeys.length; i++) {
var key = reducerKeys[i];
- if (false) {
- if (typeof reducers[key] === 'undefined') {
- warning('No reducer provided for key "' + key + '"');
- }
- }
+ if (false) {}
if (typeof reducers[key] === 'function') {
finalReducers[key] = reducers[key];
@@ -1592,9 +1455,7 @@ function combineReducers(reducers) {
var finalReducerKeys = Object.keys(finalReducers);
var unexpectedKeyCache = void 0;
- if (false) {
- unexpectedKeyCache = {};
- }
+ if (false) {}
var shapeAssertionError = void 0;
try {
@@ -1611,12 +1472,7 @@ function combineReducers(reducers) {
throw shapeAssertionError;
}
- if (false) {
- var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
- if (warningMessage) {
- warning(warningMessage);
- }
- }
+ if (false) { var warningMessage; }
var hasChanged = false;
var nextState = {};
@@ -1766,11 +1622,11 @@ function applyMiddleware() {
};
}
// CONCATENATED MODULE: ./node_modules/redux/es/index.js
-/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "createStore", function() { return createStore_createStore; });
-/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "combineReducers", function() { return combineReducers; });
-/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return bindActionCreators; });
-/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return applyMiddleware; });
-/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
+/* concated harmony reexport createStore */__webpack_require__.d(__webpack_exports__, "createStore", function() { return createStore_createStore; });
+/* concated harmony reexport combineReducers */__webpack_require__.d(__webpack_exports__, "combineReducers", function() { return combineReducers; });
+/* concated harmony reexport bindActionCreators */__webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return bindActionCreators; });
+/* concated harmony reexport applyMiddleware */__webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return applyMiddleware; });
+/* concated harmony reexport compose */__webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
@@ -1784,318 +1640,104 @@ function applyMiddleware() {
*/
function isCrushed() {}
-if (false) {
- warning('You are currently using minified code outside of NODE_ENV === \'production\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');
-}
+if (false) {}
/***/ }),
-/* 34 */
-/***/ (function(module, exports) {
-
-var g;
-
-// This works in non-strict mode
-g = (function() {
- return this;
-})();
-
-try {
- // This works if eval is allowed (see CSP)
- g = g || Function("return this")() || (1,eval)("this");
-} catch(e) {
- // This works if the window reference is available
- if(typeof window === "object")
- g = window;
-}
-
-// g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
-
-module.exports = g;
-
-
-/***/ }),
-/* 35 */
-/***/ (function(module, exports, __webpack_require__) {
+/* 7 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
+/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return symbolObservablePonyfill; });
+function symbolObservablePonyfill(root) {
+ var result;
+ var Symbol = root.Symbol;
+ if (typeof Symbol === 'function') {
+ if (Symbol.observable) {
+ result = Symbol.observable;
+ } else {
+ result = Symbol('observable');
+ Symbol.observable = result;
+ }
+ } else {
+ result = '@@observable';
+ }
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _utils = __webpack_require__(1);
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var WrappedElement = function () {
- function WrappedElement(_ref) {
- var element = _ref.element,
- classNames = _ref.classNames;
-
- _classCallCheck(this, WrappedElement);
-
- Object.assign(this, { element: element, classNames: classNames });
-
- if (!(0, _utils.isElement)(element)) {
- throw new TypeError('Invalid element passed');
- }
-
- this.isDisabled = false;
- }
-
- _createClass(WrappedElement, [{
- key: 'conceal',
- value: function conceal() {
- // Hide passed input
- this.element.classList.add(this.classNames.input);
- this.element.classList.add(this.classNames.hiddenState);
-
- // Remove element from tab index
- this.element.tabIndex = '-1';
-
- // Backup original styles if any
- var origStyle = this.element.getAttribute('style');
-
- if (origStyle) {
- this.element.setAttribute('data-choice-orig-style', origStyle);
- }
-
- this.element.setAttribute('aria-hidden', 'true');
- this.element.setAttribute('data-choice', 'active');
- }
- }, {
- key: 'reveal',
- value: function reveal() {
- // Reinstate passed element
- this.element.classList.remove(this.classNames.input);
- this.element.classList.remove(this.classNames.hiddenState);
- this.element.removeAttribute('tabindex');
-
- // Recover original styles if any
- var origStyle = this.element.getAttribute('data-choice-orig-style');
-
- if (origStyle) {
- this.element.removeAttribute('data-choice-orig-style');
- this.element.setAttribute('style', origStyle);
- } else {
- this.element.removeAttribute('style');
- }
- this.element.removeAttribute('aria-hidden');
- this.element.removeAttribute('data-choice');
-
- // Re-assign values - this is weird, I know
- this.element.value = this.element.value;
- }
- }, {
- key: 'enable',
- value: function enable() {
- this.element.removeAttribute('disabled');
- this.element.disabled = false;
- this.isDisabled = false;
- }
- }, {
- key: 'disable',
- value: function disable() {
- this.element.setAttribute('disabled', '');
- this.element.disabled = true;
- this.isDisabled = true;
- }
- }, {
- key: 'triggerEvent',
- value: function triggerEvent(eventType, data) {
- (0, _utils.dispatchEvent)(this.element, eventType, data);
- }
- }, {
- key: 'value',
- get: function get() {
- return this.element.value;
- }
- }]);
-
- return WrappedElement;
-}();
-
-exports.default = WrappedElement;
-
-/***/ }),
-/* 36 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.TEMPLATES = undefined;
-
-var _classnames = __webpack_require__(90);
-
-var _classnames2 = _interopRequireDefault(_classnames);
-
-var _utils = __webpack_require__(1);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-var TEMPLATES = exports.TEMPLATES = {
- containerOuter: function containerOuter(globalClasses, direction, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {
- var tabIndex = isSelectOneElement ? 'tabindex="0"' : '';
- var role = isSelectElement ? 'role="listbox"' : '';
- var ariaAutoComplete = '';
-
- if (isSelectElement && searchEnabled) {
- role = 'role="combobox"';
- ariaAutoComplete = 'aria-autocomplete="list"';
- }
-
- return (0, _utils.strToEl)('\n \n
\n ');
- },
- containerInner: function containerInner(globalClasses) {
- return (0, _utils.strToEl)('\n \n ');
- },
- itemList: function itemList(globalClasses, isSelectOneElement) {
- var _classNames;
-
- var localClasses = (0, _classnames2.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !isSelectOneElement), _classNames));
-
- return (0, _utils.strToEl)('\n \n ');
- },
- placeholder: function placeholder(globalClasses, value) {
- return (0, _utils.strToEl)('\n \n ' + value + '\n
\n ');
- },
- item: function item(globalClasses, data, removeItemButton) {
- var _classNames2;
-
- var ariaSelected = data.active ? 'aria-selected="true"' : '';
- var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
-
- var localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _defineProperty(_classNames2, globalClasses.placeholder, data.placeholder), _classNames2));
-
- if (removeItemButton) {
- var _classNames3;
-
- localClasses = (0, _classnames2.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 ' + data.label + '\n
\n ');
- }
-
- return (0, _utils.strToEl)('\n \n ' + data.label + '\n
\n ');
- },
- choiceList: function choiceList(globalClasses, isSelectOneElement) {
- var ariaMultiSelectable = !isSelectOneElement ? 'aria-multiselectable="true"' : '';
-
- return (0, _utils.strToEl)('\n \n
\n ');
- },
- choiceGroup: function choiceGroup(globalClasses, data) {
- var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
- var localClasses = (0, _classnames2.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
-
- return (0, _utils.strToEl)('\n \n ');
- },
- choice: function choice(globalClasses, data, itemSelectText) {
- var _classNames5;
-
- var role = data.groupId > 0 ? 'role="treeitem"' : 'role="option"';
- var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames5, globalClasses.placeholder, data.placeholder), _classNames5));
-
- return (0, _utils.strToEl)('\n \n ' + data.label + '\n
\n ');
- },
- input: function input(globalClasses) {
- var localClasses = (0, _classnames2.default)(globalClasses.input, globalClasses.inputCloned);
-
- return (0, _utils.strToEl)('\n \n ');
- },
- dropdown: function dropdown(globalClasses) {
- var localClasses = (0, _classnames2.default)(globalClasses.list, globalClasses.listDropdown);
-
- return (0, _utils.strToEl)('\n \n
\n ');
- },
- notice: function notice(globalClasses, label) {
- var _classNames6;
-
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
-
- var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _defineProperty(_classNames6, globalClasses.noResults, type === 'no-results'), _defineProperty(_classNames6, globalClasses.noChoices, type === 'no-choices'), _classNames6));
-
- return (0, _utils.strToEl)('\n \n ' + label + '\n
\n ');
- },
- option: function option(data) {
- return (0, _utils.strToEl)('\n \n ');
- }
+ return result;
};
-exports.default = TEMPLATES;
/***/ }),
-/* 37 */
+/* 8 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
+var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
+
+/* harmony default export */ __webpack_exports__["a"] = (freeGlobal);
+
+/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(3)))
+
+/***/ }),
+/* 9 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(38);
+module.exports = __webpack_require__(10);
/***/ }),
-/* 38 */
+/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+var _fuse = _interopRequireDefault(__webpack_require__(11));
-var _fuse = __webpack_require__(39);
+var _deepmerge = _interopRequireDefault(__webpack_require__(12));
-var _fuse2 = _interopRequireDefault(_fuse);
+__webpack_require__(13);
-var _deepmerge = __webpack_require__(40);
+var _store = _interopRequireDefault(__webpack_require__(15));
-var _deepmerge2 = _interopRequireDefault(_deepmerge);
+var _components = __webpack_require__(22);
-__webpack_require__(41);
+var _constants = __webpack_require__(1);
-var _store2 = __webpack_require__(73);
+var _templates = __webpack_require__(5);
-var _store3 = _interopRequireDefault(_store2);
+var _choices = __webpack_require__(30);
-var _components = __webpack_require__(83);
+var _items = __webpack_require__(31);
-var _constants = __webpack_require__(5);
+var _groups = __webpack_require__(32);
-var _templates = __webpack_require__(36);
+var _misc = __webpack_require__(33);
-var _choices = __webpack_require__(91);
+var _general = __webpack_require__(34);
-var _items = __webpack_require__(92);
-
-var _groups = __webpack_require__(93);
-
-var _misc = __webpack_require__(94);
-
-var _general = __webpack_require__(95);
-
-var _utils = __webpack_require__(1);
+var _utils = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
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; }
+
/**
* Choices
* @author Josh Johnson
*/
-var Choices = function () {
+var Choices =
+/*#__PURE__*/
+function () {
function Choices() {
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-choice]';
var userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -2103,21 +1745,21 @@ var Choices = function () {
_classCallCheck(this, Choices);
if ((0, _utils.isType)('String', element)) {
- var elements = Array.from(document.querySelectorAll(element));
-
- // If there are multiple elements, create a new instance
+ var elements = Array.from(document.querySelectorAll(element)); // If there are multiple elements, create a new instance
// for each element besides the first one (as that already has an instance)
+
if (elements.length > 1) {
return this._generateInstances(elements, userConfig);
}
}
- this.config = _deepmerge2.default.all([_constants.DEFAULT_CONFIG, Choices.userDefaults, userConfig],
- // When merging array configs, replace with a copy of the userConfig array,
+ this.config = _deepmerge.default.all([_constants.DEFAULT_CONFIG, Choices.userDefaults, userConfig], // When merging array configs, replace with a copy of the userConfig array,
// instead of concatenating with the default array
- { arrayMerge: function arrayMerge(destinationArray, sourceArray) {
- return [].concat(_toConsumableArray(sourceArray));
- } });
+ {
+ arrayMerge: function arrayMerge(destinationArray, sourceArray) {
+ return [].concat(sourceArray);
+ }
+ });
if (!(0, _utils.doKeysMatch)(this.config, _constants.DEFAULT_CONFIG)) {
console.warn('Unknown config option(s) passed');
@@ -2125,9 +1767,9 @@ var Choices = function () {
if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {
this.config.renderSelectedChoices = 'auto';
- }
+ } // Retrieve triggering element (i.e. element with 'data-choice' trigger)
+
- // Retrieve triggering element (i.e. element with 'data-choice' trigger)
var passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element;
if (!passedElement) {
@@ -2161,8 +1803,7 @@ var Choices = function () {
}
this.initialised = false;
-
- this._store = new _store3.default(this.render);
+ this._store = new _store.default(this.render);
this._initialState = {};
this._currentState = {};
this._prevState = {};
@@ -2176,12 +1817,12 @@ var Choices = function () {
this._direction = this.passedElement.element.getAttribute('dir') || 'ltr';
this._idNames = {
itemChoice: 'item-choice'
- };
- // Assign preset choices from passed object
- this._presetChoices = this.config.choices;
- // Assign preset items from passed object first
- this._presetItems = this.config.items;
- // Then add any values passed from attribute
+ }; // Assign preset choices from passed object
+
+ this._presetChoices = this.config.choices; // Assign preset items from passed object first
+
+ this._presetItems = this.config.items; // Then add any values passed from attribute
+
if (this.passedElement.value) {
this._presetItems = this._presetItems.concat(this.passedElement.value.split(this.config.delimiter));
}
@@ -2201,37 +1842,41 @@ var Choices = function () {
this._onEnterKey = this._onEnterKey.bind(this);
this._onEscapeKey = this._onEscapeKey.bind(this);
this._onDirectionKey = this._onDirectionKey.bind(this);
- this._onDeleteKey = this._onDeleteKey.bind(this);
+ this._onDeleteKey = this._onDeleteKey.bind(this); // If element has already been initialised with Choices, fail silently
- // If element has already been initialised with Choices, fail silently
if (this.passedElement.element.getAttribute('data-choice') === 'active') {
console.warn('Trying to initialise Choices on element already initialised');
- }
+ } // Let's go
+
- // Let's go
this.init();
}
-
/* ========================================
= Public functions =
======================================== */
+
_createClass(Choices, [{
- key: 'init',
+ key: "init",
value: function init() {
if (this.initialised) {
return;
}
this._createTemplates();
- this._createElements();
- this._createStructure();
- // Set initial state (We need to clone the state because some reducers
+ this._createElements();
+
+ this._createStructure(); // Set initial state (We need to clone the state because some reducers
// modify the inner objects properties in the state) 🤢
+
+
this._initialState = (0, _utils.cloneObject)(this._store.state);
+
this._store.subscribe(this._render);
+
this._render();
+
this._addEventListeners();
var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled');
@@ -2241,22 +1886,21 @@ var Choices = function () {
}
this.initialised = true;
-
- var callbackOnInit = this.config.callbackOnInit;
- // Run callback if it is a function
+ var callbackOnInit = this.config.callbackOnInit; // Run callback if it is a function
if (callbackOnInit && (0, _utils.isType)('Function', callbackOnInit)) {
callbackOnInit.call(this);
}
}
}, {
- key: 'destroy',
+ key: "destroy",
value: function destroy() {
if (!this.initialised) {
return;
}
this._removeEventListeners();
+
this.passedElement.reveal();
this.containerOuter.unwrap(this.passedElement.element);
@@ -2265,12 +1909,11 @@ var Choices = function () {
}
this.clearStore();
-
this.config.templates = null;
this.initialised = false;
}
}, {
- key: 'enable',
+ key: "enable",
value: function enable() {
if (this.passedElement.isDisabled) {
this.passedElement.enable();
@@ -2278,6 +1921,7 @@ var Choices = function () {
if (this.containerOuter.isDisabled) {
this._addEventListeners();
+
this.input.enable();
this.containerOuter.enable();
}
@@ -2285,7 +1929,7 @@ var Choices = function () {
return this;
}
}, {
- key: 'disable',
+ key: "disable",
value: function disable() {
if (!this.passedElement.isDisabled) {
this.passedElement.disable();
@@ -2293,6 +1937,7 @@ var Choices = function () {
if (!this.containerOuter.isDisabled) {
this._removeEventListeners();
+
this.input.disable();
this.containerOuter.disable();
}
@@ -2300,7 +1945,7 @@ var Choices = function () {
return this;
}
}, {
- key: 'highlightItem',
+ key: "highlightItem",
value: function highlightItem(item) {
var runEvent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
@@ -2310,12 +1955,11 @@ var Choices = function () {
var id = item.id,
_item$groupId = item.groupId,
- groupId = _item$groupId === undefined ? -1 : _item$groupId,
+ groupId = _item$groupId === void 0 ? -1 : _item$groupId,
_item$value = item.value,
- value = _item$value === undefined ? '' : _item$value,
+ value = _item$value === void 0 ? '' : _item$value,
_item$label = item.label,
- label = _item$label === undefined ? '' : _item$label;
-
+ label = _item$label === void 0 ? '' : _item$label;
var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
this._store.dispatch((0, _items.highlightItem)(id, true));
@@ -2332,7 +1976,7 @@ var Choices = function () {
return this;
}
}, {
- key: 'unhighlightItem',
+ key: "unhighlightItem",
value: function unhighlightItem(item) {
if (!item) {
return this;
@@ -2340,46 +1984,47 @@ var Choices = function () {
var id = item.id,
_item$groupId2 = item.groupId,
- groupId = _item$groupId2 === undefined ? -1 : _item$groupId2,
+ groupId = _item$groupId2 === void 0 ? -1 : _item$groupId2,
_item$value2 = item.value,
- value = _item$value2 === undefined ? '' : _item$value2,
+ value = _item$value2 === void 0 ? '' : _item$value2,
_item$label2 = item.label,
- label = _item$label2 === undefined ? '' : _item$label2;
-
+ label = _item$label2 === void 0 ? '' : _item$label2;
var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
this._store.dispatch((0, _items.highlightItem)(id, false));
+
this.passedElement.triggerEvent(_constants.EVENTS.highlightItem, {
id: id,
value: value,
label: label,
groupValue: group && group.value ? group.value : null
});
-
return this;
}
}, {
- key: 'highlightAll',
+ key: "highlightAll",
value: function highlightAll() {
var _this = this;
this._store.items.forEach(function (item) {
return _this.highlightItem(item);
});
+
return this;
}
}, {
- key: 'unhighlightAll',
+ key: "unhighlightAll",
value: function unhighlightAll() {
var _this2 = this;
this._store.items.forEach(function (item) {
return _this2.unhighlightItem(item);
});
+
return this;
}
}, {
- key: 'removeActiveItemsByValue',
+ key: "removeActiveItemsByValue",
value: function removeActiveItemsByValue(value) {
var _this3 = this;
@@ -2392,7 +2037,7 @@ var Choices = function () {
return this;
}
}, {
- key: 'removeActiveItems',
+ key: "removeActiveItems",
value: function removeActiveItems(excludedId) {
var _this4 = this;
@@ -2406,16 +2051,17 @@ var Choices = function () {
return this;
}
}, {
- key: 'removeHighlightedItems',
+ key: "removeHighlightedItems",
value: function removeHighlightedItems() {
var _this5 = this;
var runEvent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
this._store.highlightedActiveItems.forEach(function (item) {
- _this5._removeItem(item);
- // If this action was performed by the user
+ _this5._removeItem(item); // If this action was performed by the user
// trigger the event
+
+
if (runEvent) {
_this5._triggerChange(item.value);
}
@@ -2424,7 +2070,7 @@ var Choices = function () {
return this;
}
}, {
- key: 'showDropdown',
+ key: "showDropdown",
value: function showDropdown(preventInputFocus) {
var _this6 = this;
@@ -2434,6 +2080,7 @@ var Choices = function () {
requestAnimationFrame(function () {
_this6.dropdown.show();
+
_this6.containerOuter.open(_this6.dropdown.distanceFromTopWindow());
if (!preventInputFocus && _this6._canSearch) {
@@ -2442,11 +2089,10 @@ var Choices = function () {
_this6.passedElement.triggerEvent(_constants.EVENTS.showDropdown, {});
});
-
return this;
}
}, {
- key: 'hideDropdown',
+ key: "hideDropdown",
value: function hideDropdown(preventInputBlur) {
var _this7 = this;
@@ -2456,26 +2102,27 @@ var Choices = function () {
requestAnimationFrame(function () {
_this7.dropdown.hide();
+
_this7.containerOuter.close();
if (!preventInputBlur && _this7._canSearch) {
_this7.input.removeActiveDescendant();
+
_this7.input.blur();
}
_this7.passedElement.triggerEvent(_constants.EVENTS.hideDropdown, {});
});
-
return this;
}
}, {
- key: 'toggleDropdown',
+ key: "toggleDropdown",
value: function toggleDropdown() {
this.dropdown.isActive ? this.hideDropdown() : this.showDropdown();
return this;
}
}, {
- key: 'getValue',
+ key: "getValue",
value: function getValue() {
var valueOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
@@ -2488,7 +2135,7 @@ var Choices = function () {
return this._isSelectOneElement ? values[0] : values;
}
}, {
- key: 'setValue',
+ key: "setValue",
value: function setValue(args) {
var _this8 = this;
@@ -2496,51 +2143,49 @@ var Choices = function () {
return this;
}
- [].concat(_toConsumableArray(args)).forEach(function (value) {
+ [].concat(args).forEach(function (value) {
return _this8._setChoiceOrItem(value);
});
return this;
}
}, {
- key: 'setChoiceByValue',
+ key: "setChoiceByValue",
value: function setChoiceByValue(value) {
var _this9 = this;
if (!this.initialised || this._isTextElement) {
return this;
- }
+ } // If only one value has been passed, convert to array
- // If only one value has been passed, convert to array
- var choiceValue = (0, _utils.isType)('Array', value) ? value : [value];
- // Loop through each value and
+ var choiceValue = (0, _utils.isType)('Array', value) ? value : [value]; // Loop through each value and
+
choiceValue.forEach(function (val) {
return _this9._findAndSelectChoiceByValue(val);
});
-
return this;
}
}, {
- key: 'setChoices',
+ key: "setChoices",
value: function setChoices() {
- var choices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
-
var _this10 = this;
+ var choices = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
+ var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var replaceChoices = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (!this._isSelectElement || !choices.length || !value) {
return this;
- }
+ } // Clear choices if needed
+
- // Clear choices if needed
if (replaceChoices) {
this._clearChoices();
}
this.containerOuter.removeLoadingState();
+
var addGroupsAndChoices = function addGroupsAndChoices(groupOrChoice) {
if (groupOrChoice.choices) {
_this10._addGroup({
@@ -2562,32 +2207,36 @@ var Choices = function () {
};
this._setLoading(true);
+
choices.forEach(addGroupsAndChoices);
+
this._setLoading(false);
return this;
}
}, {
- key: 'clearStore',
+ key: "clearStore",
value: function clearStore() {
this._store.dispatch((0, _misc.clearAll)());
+
return this;
}
}, {
- key: 'clearInput',
+ key: "clearInput",
value: function clearInput() {
var shouldSetInputWidth = !this._isSelectOneElement;
this.input.clear(shouldSetInputWidth);
if (!this._isTextElement && this._canSearch) {
this._isSearching = false;
+
this._store.dispatch((0, _choices.activateChoices)(true));
}
return this;
}
}, {
- key: 'ajax',
+ key: "ajax",
value: function ajax(fn) {
var _this11 = this;
@@ -2599,10 +2248,8 @@ var Choices = function () {
return _this11._handleLoadingState(true);
});
fn(this._ajaxCallback());
-
return this;
}
-
/* ===== End of Public functions ====== */
/* =============================================
@@ -2610,14 +2257,13 @@ var Choices = function () {
============================================= */
}, {
- key: '_render',
+ key: "_render",
value: function _render() {
if (this._store.isLoading()) {
return;
}
this._currentState = this._store.state;
-
var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items;
var shouldRenderChoices = this._isSelectElement;
var shouldRenderItems = this._currentState.items !== this._prevState.items;
@@ -2637,47 +2283,49 @@ var Choices = function () {
this._prevState = this._currentState;
}
}, {
- key: '_renderChoices',
+ key: "_renderChoices",
value: function _renderChoices() {
var _this12 = this;
- var _store = this._store,
- activeGroups = _store.activeGroups,
- activeChoices = _store.activeChoices;
-
+ var _this$_store = this._store,
+ activeGroups = _this$_store.activeGroups,
+ activeChoices = _this$_store.activeChoices;
var choiceListFragment = document.createDocumentFragment();
-
this.choiceList.clear();
if (this.config.resetScrollPosition) {
requestAnimationFrame(function () {
return _this12.choiceList.scrollToTop();
});
- }
+ } // If we have grouped options
+
- // If we have grouped options
if (activeGroups.length >= 1 && !this._isSearching) {
// If we have a placeholder choice along with groups
var activePlaceholders = activeChoices.filter(function (activeChoice) {
return activeChoice.placeholder === true && activeChoice.groupId === -1;
});
+
if (activePlaceholders.length >= 1) {
choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment);
}
+
choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment);
} else if (activeChoices.length >= 1) {
choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment);
- }
+ } // If we have choices to show
+
- // If we have choices to show
if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {
var activeItems = this._store.activeItems;
- var canAddItem = this._canAddItem(activeItems, this.input.value);
- // ...and we can select them
+ var canAddItem = this._canAddItem(activeItems, this.input.value); // ...and we can select them
+
+
if (canAddItem.response) {
// ...append them and highlight the first choice
this.choiceList.append(choiceListFragment);
+
this._highlightChoice();
} else {
// ...otherwise show a notice
@@ -2685,16 +2333,14 @@ var Choices = function () {
}
} else {
// Otherwise show a notice
- var dropdownItem = void 0;
- var notice = void 0;
+ var dropdownItem;
+ var notice;
if (this._isSearching) {
notice = (0, _utils.isType)('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText;
-
dropdownItem = this._getTemplate('notice', notice, 'no-results');
} else {
notice = (0, _utils.isType)('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText;
-
dropdownItem = this._getTemplate('notice', notice, 'no-choices');
}
@@ -2702,70 +2348,74 @@ var Choices = function () {
}
}
}, {
- key: '_renderItems',
+ key: "_renderItems",
value: function _renderItems() {
var activeItems = this._store.activeItems || [];
- this.itemList.clear();
-
- // Create a fragment to store our list items
+ this.itemList.clear(); // Create a fragment to store our list items
// (so we don't have to update the DOM for each item)
- var itemListFragment = this._createItemsFragment(activeItems);
- // If we have items to add, append them
+ var itemListFragment = this._createItemsFragment(activeItems); // If we have items to add, append them
+
+
if (itemListFragment.childNodes) {
this.itemList.append(itemListFragment);
}
}
}, {
- key: '_createGroupsFragment',
+ key: "_createGroupsFragment",
value: function _createGroupsFragment(groups, choices, fragment) {
var _this13 = this;
var groupFragment = fragment || document.createDocumentFragment();
+
var getGroupChoices = function getGroupChoices(group) {
return choices.filter(function (choice) {
if (_this13._isSelectOneElement) {
return choice.groupId === group.id;
}
+
return choice.groupId === group.id && (_this13.config.renderSelectedChoices === 'always' || !choice.selected);
});
- };
+ }; // If sorting is enabled, filter groups
+
- // If sorting is enabled, filter groups
if (this.config.shouldSort) {
groups.sort(this.config.sortFn);
}
groups.forEach(function (group) {
var groupChoices = getGroupChoices(group);
+
if (groupChoices.length >= 1) {
var dropdownGroup = _this13._getTemplate('choiceGroup', group);
+
groupFragment.appendChild(dropdownGroup);
+
_this13._createChoicesFragment(groupChoices, groupFragment, true);
}
});
-
return groupFragment;
}
}, {
- key: '_createChoicesFragment',
+ key: "_createChoicesFragment",
value: function _createChoicesFragment(choices, fragment) {
var _this14 = this;
var withinGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
-
// Create a fragment to store our list items (so we don't have to update the DOM for each item)
var choicesFragment = fragment || document.createDocumentFragment();
- var _config = this.config,
- renderSelectedChoices = _config.renderSelectedChoices,
- searchResultLimit = _config.searchResultLimit,
- renderChoiceLimit = _config.renderChoiceLimit;
-
+ var _this$config = this.config,
+ renderSelectedChoices = _this$config.renderSelectedChoices,
+ searchResultLimit = _this$config.searchResultLimit,
+ renderChoiceLimit = _this$config.renderChoiceLimit;
var filter = this._isSearching ? _utils.sortByScore : this.config.sortFn;
+
var appendChoice = function appendChoice(choice) {
var shouldRender = renderSelectedChoices === 'auto' ? _this14._isSelectOneElement || !choice.selected : true;
+
if (shouldRender) {
var dropdownItem = _this14._getTemplate('choice', choice, _this14.config.itemSelectText);
+
choicesFragment.appendChild(dropdownItem);
}
};
@@ -2776,9 +2426,8 @@ var Choices = function () {
rendererableChoices = choices.filter(function (choice) {
return !choice.selected;
});
- }
+ } // Split array into placeholders and "normal" choices
- // Split array into placeholders and "normal" choices
var _rendererableChoices$ = rendererableChoices.reduce(function (acc, choice) {
if (choice.placeholder) {
@@ -2786,30 +2435,31 @@ var Choices = function () {
} else {
acc.normalChoices.push(choice);
}
- return acc;
- }, { placeholderChoices: [], normalChoices: [] }),
- placeholderChoices = _rendererableChoices$.placeholderChoices,
- normalChoices = _rendererableChoices$.normalChoices;
- // If sorting is enabled or the user is searching, filter choices
+ return acc;
+ }, {
+ placeholderChoices: [],
+ normalChoices: []
+ }),
+ placeholderChoices = _rendererableChoices$.placeholderChoices,
+ normalChoices = _rendererableChoices$.normalChoices; // If sorting is enabled or the user is searching, filter choices
if (this.config.shouldSort || this._isSearching) {
normalChoices.sort(filter);
}
- var choiceLimit = rendererableChoices.length;
+ var choiceLimit = rendererableChoices.length; // Prepend placeholeder
- // Prepend placeholeder
- var sortedChoices = [].concat(_toConsumableArray(placeholderChoices), _toConsumableArray(normalChoices));
+ var sortedChoices = [].concat(placeholderChoices, normalChoices);
if (this._isSearching) {
choiceLimit = searchResultLimit;
} else if (renderChoiceLimit > 0 && !withinGroup) {
choiceLimit = renderChoiceLimit;
- }
+ } // Add each choice to dropdown within range
+
- // Add each choice to dropdown within range
for (var i = 0; i < choiceLimit; i += 1) {
if (sortedChoices[i]) {
appendChoice(sortedChoices[i]);
@@ -2819,21 +2469,18 @@ var Choices = function () {
return choicesFragment;
}
}, {
- key: '_createItemsFragment',
+ key: "_createItemsFragment",
value: function _createItemsFragment(items) {
var _this15 = this;
var fragment = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
-
// Create fragment to add elements to
- var _config2 = this.config,
- shouldSortItems = _config2.shouldSortItems,
- sortFn = _config2.sortFn,
- removeItemButton = _config2.removeItemButton;
+ var _this$config2 = this.config,
+ shouldSortItems = _this$config2.shouldSortItems,
+ sortFn = _this$config2.sortFn,
+ removeItemButton = _this$config2.removeItemButton;
+ var itemListFragment = fragment || document.createDocumentFragment(); // If sorting is enabled, filter items
- var itemListFragment = fragment || document.createDocumentFragment();
-
- // If sorting is enabled, filter items
if (shouldSortItems && !this._isSelectOneElement) {
items.sort(sortFn);
}
@@ -2848,20 +2495,20 @@ var Choices = function () {
var addItemToFragment = function addItemToFragment(item) {
// Create new list element
- var listItem = _this15._getTemplate('item', item, removeItemButton);
- // Append it to list
- itemListFragment.appendChild(listItem);
- };
+ var listItem = _this15._getTemplate('item', item, removeItemButton); // Append it to list
+
+
+ itemListFragment.appendChild(listItem);
+ }; // Add each list item to list
+
- // Add each list item to list
items.forEach(function (item) {
return addItemToFragment(item);
});
-
return itemListFragment;
}
}, {
- key: '_triggerChange',
+ key: "_triggerChange",
value: function _triggerChange(value) {
if (value === undefined || value === null) {
return;
@@ -2872,7 +2519,7 @@ var Choices = function () {
});
}
}, {
- key: '_selectPlaceholderChoice',
+ key: "_selectPlaceholderChoice",
value: function _selectPlaceholderChoice() {
var placeholderChoice = this._store.placeholderChoice;
@@ -2889,7 +2536,7 @@ var Choices = function () {
}
}
}, {
- key: '_handleButtonAction',
+ key: "_handleButtonAction",
value: function _handleButtonAction(activeItems, element) {
if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) {
return;
@@ -2898,10 +2545,10 @@ var Choices = function () {
var itemId = element.parentNode.getAttribute('data-id');
var itemToRemove = activeItems.find(function (item) {
return item.id === parseInt(itemId, 10);
- });
+ }); // Remove item associated with button
- // Remove item associated with button
this._removeItem(itemToRemove);
+
this._triggerChange(itemToRemove.value);
if (this._isSelectOneElement) {
@@ -2909,7 +2556,7 @@ var Choices = function () {
}
}
}, {
- key: '_handleItemAction',
+ key: "_handleItemAction",
value: function _handleItemAction(activeItems, element) {
var _this16 = this;
@@ -2919,39 +2566,37 @@ var Choices = function () {
return;
}
- var passedId = element.getAttribute('data-id');
-
- // We only want to select one item with a click
+ var passedId = element.getAttribute('data-id'); // We only want to select one item with a click
// so we deselect any items that aren't the target
// unless shift is being pressed
+
activeItems.forEach(function (item) {
if (item.id === parseInt(passedId, 10) && !item.highlighted) {
_this16.highlightItem(item);
} else if (!hasShiftKey && item.highlighted) {
_this16.unhighlightItem(item);
}
- });
-
- // Focus input as without focus, a user cannot do anything with a
+ }); // Focus input as without focus, a user cannot do anything with a
// highlighted item
+
this.input.focus();
}
}, {
- key: '_handleChoiceAction',
+ key: "_handleChoiceAction",
value: function _handleChoiceAction(activeItems, element) {
if (!activeItems || !element) {
return;
- }
+ } // If we are clicking on an option
+
- // If we are clicking on an option
var id = element.getAttribute('data-id');
+
var choice = this._store.getChoiceById(id);
+
var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;
- var hasActiveDropdown = this.dropdown.isActive;
+ var hasActiveDropdown = this.dropdown.isActive; // Update choice keyCode
- // Update choice keyCode
choice.keyCode = passedKeyCode;
-
this.passedElement.triggerEvent(_constants.EVENTS.choice, {
choice: choice
});
@@ -2974,16 +2619,15 @@ var Choices = function () {
}
}
- this.clearInput();
+ this.clearInput(); // We wont to close the dropdown if we are dealing with a single select box
- // We wont to close the dropdown if we are dealing with a single select box
if (hasActiveDropdown && this._isSelectOneElement) {
this.hideDropdown(true);
this.containerOuter.focus();
}
}
}, {
- key: '_handleBackspace',
+ key: "_handleBackspace",
value: function _handleBackspace(activeItems) {
if (!this.config.removeItems || !activeItems) {
return;
@@ -2992,34 +2636,35 @@ var Choices = function () {
var lastItem = activeItems[activeItems.length - 1];
var hasHighlightedItems = activeItems.some(function (item) {
return item.highlighted;
- });
-
- // If editing the last item is allowed and there are not other selected items,
+ }); // If editing the last item is allowed and there are not other selected items,
// we can edit the item value. Otherwise if we can remove items, remove all selected items
+
if (this.config.editItems && !hasHighlightedItems && lastItem) {
this.input.value = lastItem.value;
this.input.setWidth();
+
this._removeItem(lastItem);
+
this._triggerChange(lastItem.value);
} else {
if (!hasHighlightedItems) {
// Highlight last item if none already highlighted
this.highlightItem(lastItem, false);
}
+
this.removeHighlightedItems(true);
}
}
}, {
- key: '_setLoading',
+ key: "_setLoading",
value: function _setLoading(isLoading) {
this._store.dispatch((0, _general.setIsLoading)(isLoading));
}
}, {
- key: '_handleLoadingState',
+ key: "_handleLoadingState",
value: function _handleLoadingState() {
var setLoading = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
-
- var placeholderItem = this.itemList.getChild('.' + this.config.classNames.placeholder);
+ var placeholderItem = this.itemList.getChild(".".concat(this.config.classNames.placeholder));
if (setLoading) {
this.disable();
@@ -3047,25 +2692,23 @@ var Choices = function () {
}
}
}, {
- key: '_handleSearch',
+ key: "_handleSearch",
value: function _handleSearch(value) {
if (!value || !this.input.isFocussed) {
return;
}
var choices = this._store.choices;
- var _config3 = this.config,
- searchFloor = _config3.searchFloor,
- searchChoices = _config3.searchChoices;
-
+ var _this$config3 = this.config,
+ searchFloor = _this$config3.searchFloor,
+ searchChoices = _this$config3.searchChoices;
var hasUnactiveChoices = choices.some(function (option) {
return !option.active;
- });
+ }); // Check that we have a value to search and the input was an alphanumeric character
- // Check that we have a value to search and the input was an alphanumeric character
if (value && value.length >= searchFloor) {
- var resultCount = searchChoices ? this._searchChoices(value) : 0;
- // Trigger search event
+ var resultCount = searchChoices ? this._searchChoices(value) : 0; // Trigger search event
+
this.passedElement.triggerEvent(_constants.EVENTS.search, {
value: value,
resultCount: resultCount
@@ -3073,11 +2716,12 @@ var Choices = function () {
} else if (hasUnactiveChoices) {
// Otherwise reset choices to active
this._isSearching = false;
+
this._store.dispatch((0, _choices.activateChoices)(true));
}
}
}, {
- key: '_canAddItem',
+ key: "_canAddItem",
value: function _canAddItem(activeItems, value) {
var canAddItem = true;
var notice = (0, _utils.isType)('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText;
@@ -3111,7 +2755,7 @@ var Choices = function () {
};
}
}, {
- key: '_ajaxCallback',
+ key: "_ajaxCallback",
value: function _ajaxCallback() {
var _this17 = this;
@@ -3125,8 +2769,10 @@ var Choices = function () {
if (parsedResults && (0, _utils.isType)('Array', parsedResults) && parsedResults.length) {
// Remove loading states/text
_this17._handleLoadingState(false);
- _this17._setLoading(true);
- // Add each result as a choice
+
+ _this17._setLoading(true); // Add each result as a choice
+
+
parsedResults.forEach(function (result) {
if (result.choices) {
_this17._addGroup({
@@ -3159,32 +2805,34 @@ var Choices = function () {
};
}
}, {
- key: '_searchChoices',
+ key: "_searchChoices",
value: function _searchChoices(value) {
var newValue = (0, _utils.isType)('String', value) ? value.trim() : value;
var currentValue = (0, _utils.isType)('String', this._currentValue) ? this._currentValue.trim() : this._currentValue;
- if (newValue.length < 1 && newValue === currentValue + ' ') {
+ if (newValue.length < 1 && newValue === "".concat(currentValue, " ")) {
return 0;
- }
+ } // If new value matches the desired length and is not the same as the current value with a space
+
- // If new value matches the desired length and is not the same as the current value with a space
var haystack = this._store.searchableChoices;
var needle = newValue;
- var keys = [].concat(_toConsumableArray(this.config.searchFields));
- var options = Object.assign(this.config.fuseOptions, { keys: keys });
- var fuse = new _fuse2.default(haystack, options);
+ var keys = [].concat(this.config.searchFields);
+ var options = Object.assign(this.config.fuseOptions, {
+ keys: keys
+ });
+ var fuse = new _fuse.default(haystack, options);
var results = fuse.search(needle);
-
this._currentValue = newValue;
this._highlightPosition = 0;
this._isSearching = true;
+
this._store.dispatch((0, _choices.filterChoices)(results));
return results.length;
}
}, {
- key: '_addEventListeners',
+ key: "_addEventListeners",
value: function _addEventListeners() {
document.addEventListener('keyup', this._onKeyUp);
document.addEventListener('keydown', this._onKeyDown);
@@ -3209,7 +2857,7 @@ var Choices = function () {
this.input.addEventListeners();
}
}, {
- key: '_removeEventListeners',
+ key: "_removeEventListeners",
value: function _removeEventListeners() {
document.removeEventListener('keyup', this._onKeyUp);
document.removeEventListener('keydown', this._onKeyDown);
@@ -3234,7 +2882,7 @@ var Choices = function () {
this.input.removeEventListeners();
}
}, {
- key: '_onKeyDown',
+ key: "_onKeyDown",
value: function _onKeyDown(event) {
var _keyDownActions;
@@ -3243,7 +2891,6 @@ var Choices = function () {
ctrlKey = event.ctrlKey,
metaKey = event.metaKey;
-
if (target !== this.input.element && !this.containerOuter.element.contains(target)) {
return;
}
@@ -3253,7 +2900,6 @@ var Choices = function () {
var hasActiveDropdown = this.dropdown.isActive;
var hasItems = this.itemList.hasChildren;
var keyString = String.fromCharCode(keyCode);
-
var BACK_KEY = _constants.KEY_CODES.BACK_KEY,
DELETE_KEY = _constants.KEY_CODES.DELETE_KEY,
ENTER_KEY = _constants.KEY_CODES.ENTER_KEY,
@@ -3263,18 +2909,15 @@ var Choices = function () {
DOWN_KEY = _constants.KEY_CODES.DOWN_KEY,
PAGE_UP_KEY = _constants.KEY_CODES.PAGE_UP_KEY,
PAGE_DOWN_KEY = _constants.KEY_CODES.PAGE_DOWN_KEY;
+ var hasCtrlDownKeyPressed = ctrlKey || metaKey; // If a user is typing and the dropdown is not active
- var hasCtrlDownKeyPressed = ctrlKey || metaKey;
-
- // If a user is typing and the dropdown is not active
if (!this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {
this.showDropdown();
- }
+ } // Map keys to key actions
- // Map keys to key actions
- var keyDownActions = (_keyDownActions = {}, _defineProperty(_keyDownActions, A_KEY, this._onAKey), _defineProperty(_keyDownActions, ENTER_KEY, this._onEnterKey), _defineProperty(_keyDownActions, ESC_KEY, this._onEscapeKey), _defineProperty(_keyDownActions, UP_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, PAGE_UP_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, DOWN_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, PAGE_DOWN_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, DELETE_KEY, this._onDeleteKey), _defineProperty(_keyDownActions, BACK_KEY, this._onDeleteKey), _keyDownActions);
- // If keycode has a function, run it
+ var keyDownActions = (_keyDownActions = {}, _defineProperty(_keyDownActions, A_KEY, this._onAKey), _defineProperty(_keyDownActions, ENTER_KEY, this._onEnterKey), _defineProperty(_keyDownActions, ESC_KEY, this._onEscapeKey), _defineProperty(_keyDownActions, UP_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, PAGE_UP_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, DOWN_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, PAGE_DOWN_KEY, this._onDirectionKey), _defineProperty(_keyDownActions, DELETE_KEY, this._onDeleteKey), _defineProperty(_keyDownActions, BACK_KEY, this._onDeleteKey), _keyDownActions); // If keycode has a function, run it
+
if (keyDownActions[keyCode]) {
keyDownActions[keyCode]({
event: event,
@@ -3290,7 +2933,7 @@ var Choices = function () {
}
}
}, {
- key: '_onKeyUp',
+ key: "_onKeyUp",
value: function _onKeyUp(_ref2) {
var target = _ref2.target,
keyCode = _ref2.keyCode;
@@ -3301,14 +2944,16 @@ var Choices = function () {
var value = this.input.value;
var activeItems = this._store.activeItems;
- var canAddItem = this._canAddItem(activeItems, value);
- // We are typing into a text input and have a value, we want to show a dropdown
+ var canAddItem = this._canAddItem(activeItems, value); // We are typing into a text input and have a value, we want to show a dropdown
// notice. Otherwise hide the dropdown
+
+
if (this._isTextElement) {
if (value) {
if (canAddItem.notice) {
var dropdownItem = this._getTemplate('notice', canAddItem.notice);
+
this.dropdown.element.innerHTML = dropdownItem.outerHTML;
}
@@ -3322,12 +2967,12 @@ var Choices = function () {
}
} else {
var backKey = _constants.KEY_CODES.BACK_KEY;
- var deleteKey = _constants.KEY_CODES.DELETE_KEY;
+ var deleteKey = _constants.KEY_CODES.DELETE_KEY; // If user has removed value...
- // If user has removed value...
if ((keyCode === backKey || keyCode === deleteKey) && !target.value) {
if (!this._isTextElement && this._isSearching) {
this._isSearching = false;
+
this._store.dispatch((0, _choices.activateChoices)(true));
}
} else if (this._canSearch && canAddItem.response) {
@@ -3338,7 +2983,7 @@ var Choices = function () {
this._canSearch = this.config.searchEnabled;
}
}, {
- key: '_onAKey',
+ key: "_onAKey",
value: function _onAKey(_ref3) {
var hasItems = _ref3.hasItems,
hasCtrlDownKeyPressed = _ref3.hasCtrlDownKeyPressed;
@@ -3346,6 +2991,7 @@ var Choices = function () {
// If CTRL + A or CMD + A have been pressed and there are items to select
if (hasCtrlDownKeyPressed && hasItems) {
this._canSearch = false;
+
if (this.config.removeItems && !this.input.value && this.input.element === document.activeElement) {
// Highlight items
this.highlightAll();
@@ -3353,42 +2999,48 @@ var Choices = function () {
}
}
}, {
- key: '_onEnterKey',
+ key: "_onEnterKey",
value: function _onEnterKey(_ref4) {
var event = _ref4.event,
target = _ref4.target,
activeItems = _ref4.activeItems,
hasActiveDropdown = _ref4.hasActiveDropdown;
- var enterKey = _constants.KEY_CODES.ENTER_KEY;
- // If enter key is pressed and the input has a value
+ var enterKey = _constants.KEY_CODES.ENTER_KEY; // If enter key is pressed and the input has a value
if (this._isTextElement && target.value) {
var value = this.input.value;
- var canAddItem = this._canAddItem(activeItems, value);
- // All is good, add
+ var canAddItem = this._canAddItem(activeItems, value); // All is good, add
+
+
if (canAddItem.response) {
this.hideDropdown(true);
- this._addItem({ value: value });
+
+ this._addItem({
+ value: value
+ });
+
this._triggerChange(value);
+
this.clearInput();
}
}
if (target.hasAttribute('data-button')) {
this._handleButtonAction(activeItems, target);
+
event.preventDefault();
}
if (hasActiveDropdown) {
- var highlighted = this.dropdown.getChild('.' + this.config.classNames.highlightedState);
+ var highlighted = this.dropdown.getChild(".".concat(this.config.classNames.highlightedState)); // If we have a highlighted choice
- // If we have a highlighted choice
if (highlighted) {
// add enter keyCode value
if (activeItems[0]) {
activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign
}
+
this._handleChoiceAction(activeItems, highlighted);
}
@@ -3400,7 +3052,7 @@ var Choices = function () {
}
}
}, {
- key: '_onEscapeKey',
+ key: "_onEscapeKey",
value: function _onEscapeKey(_ref5) {
var hasActiveDropdown = _ref5.hasActiveDropdown;
@@ -3410,7 +3062,7 @@ var Choices = function () {
}
}
}, {
- key: '_onDirectionKey',
+ key: "_onDirectionKey",
value: function _onDirectionKey(_ref6) {
var event = _ref6.event,
hasActiveDropdown = _ref6.hasActiveDropdown,
@@ -3418,19 +3070,16 @@ var Choices = function () {
metaKey = _ref6.metaKey;
var downKey = _constants.KEY_CODES.DOWN_KEY,
pageUpKey = _constants.KEY_CODES.PAGE_UP_KEY,
- pageDownKey = _constants.KEY_CODES.PAGE_DOWN_KEY;
-
- // If up or down key is pressed, traverse through options
+ pageDownKey = _constants.KEY_CODES.PAGE_DOWN_KEY; // If up or down key is pressed, traverse through options
if (hasActiveDropdown || this._isSelectOneElement) {
this.showDropdown();
this._canSearch = false;
-
var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1;
var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey;
var selectableChoiceIdentifier = '[data-choice-selectable]';
+ var nextEl;
- var nextEl = void 0;
if (skipKey) {
if (directionInt > 0) {
nextEl = Array.from(this.dropdown.element.querySelectorAll(selectableChoiceIdentifier)).pop();
@@ -3438,7 +3087,8 @@ var Choices = function () {
nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);
}
} else {
- var currentEl = this.dropdown.element.querySelector('.' + this.config.classNames.highlightedState);
+ var currentEl = this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));
+
if (currentEl) {
nextEl = (0, _utils.getAdjacentEl)(currentEl, selectableChoiceIdentifier, directionInt);
} else {
@@ -3452,16 +3102,17 @@ var Choices = function () {
if (!(0, _utils.isScrolledIntoView)(nextEl, this.choiceList.element, directionInt)) {
this.choiceList.scrollToChoice(nextEl, directionInt);
}
- this._highlightChoice(nextEl);
- }
- // Prevent default to maintain cursor position whilst
+ this._highlightChoice(nextEl);
+ } // Prevent default to maintain cursor position whilst
// traversing dropdown options
+
+
event.preventDefault();
}
}
}, {
- key: '_onDeleteKey',
+ key: "_onDeleteKey",
value: function _onDeleteKey(_ref7) {
var event = _ref7.event,
target = _ref7.target,
@@ -3471,25 +3122,24 @@ var Choices = function () {
// If backspace or delete key is pressed and the input has no value
if (hasFocusedInput && !target.value && !this._isSelectOneElement) {
this._handleBackspace(activeItems);
+
event.preventDefault();
}
}
}, {
- key: '_onTouchMove',
+ key: "_onTouchMove",
value: function _onTouchMove() {
if (this._wasTap === true) {
this._wasTap = false;
}
}
}, {
- key: '_onTouchEnd',
+ key: "_onTouchEnd",
value: function _onTouchEnd(event) {
- var target = event.target || event.touches[0].target;
+ var target = event.target || event.touches[0].target; // If a user tapped within our container...
- // If a user tapped within our container...
if (this._wasTap === true && this.containerOuter.element.contains(target)) {
// ...and we aren't dealing with a single select box, show dropdown/focus input
-
var containerWasTarget = target === this.containerOuter.element || target === this.containerInner.element;
if (containerWasTarget && !this._isSelectOneElement) {
@@ -3500,19 +3150,19 @@ var Choices = function () {
// If a select box, we want to show the dropdown
this.showDropdown();
}
- }
- // Prevents focus event firing
+ } // Prevents focus event firing
+
+
event.stopPropagation();
}
this._wasTap = true;
}
}, {
- key: '_onMouseDown',
+ key: "_onMouseDown",
value: function _onMouseDown(event) {
var target = event.target,
- shiftKey = event.shiftKey;
- // If we have our mouse down on the scrollbar and are on IE11...
+ shiftKey = event.shiftKey; // If we have our mouse down on the scrollbar and are on IE11...
if (target === this.choiceList && (0, _utils.isIE11)()) {
this._isScrollingOnIe = true;
@@ -3524,7 +3174,6 @@ var Choices = function () {
var activeItems = this._store.activeItems;
var hasShiftKey = shiftKey;
-
var buttonTarget = (0, _utils.findAncestorByAttrName)(target, 'data-button');
var itemTarget = (0, _utils.findAncestorByAttrName)(target, 'data-item');
var choiceTarget = (0, _utils.findAncestorByAttrName)(target, 'data-choice');
@@ -3540,10 +3189,9 @@ var Choices = function () {
event.preventDefault();
}
}, {
- key: '_onMouseOver',
+ key: "_onMouseOver",
value: function _onMouseOver(_ref8) {
var target = _ref8.target;
-
var targetWithinDropdown = target === this.dropdown || this.dropdown.element.contains(target);
var shouldHighlightChoice = targetWithinDropdown && target.hasAttribute('data-choice');
@@ -3552,7 +3200,7 @@ var Choices = function () {
}
}
}, {
- key: '_onClick',
+ key: "_onClick",
value: function _onClick(_ref9) {
var target = _ref9.target;
@@ -3581,7 +3229,7 @@ var Choices = function () {
}
}
}, {
- key: '_onFocus',
+ key: "_onFocus",
value: function _onFocus(_ref10) {
var _this18 = this;
@@ -3599,24 +3247,25 @@ var Choices = function () {
},
'select-one': function selectOne() {
_this18.containerOuter.addFocusState();
+
if (target === _this18.input.element) {
_this18.showDropdown(true);
}
},
'select-multiple': function selectMultiple() {
if (target === _this18.input.element) {
- _this18.showDropdown(true);
- // If element is a select box, the focused element is the container and the dropdown
+ _this18.showDropdown(true); // If element is a select box, the focused element is the container and the dropdown
// isn't already open, focus and show dropdown
+
+
_this18.containerOuter.addFocusState();
}
}
};
-
focusActions[this.passedElement.element.type]();
}
}, {
- key: '_onBlur',
+ key: "_onBlur",
value: function _onBlur(_ref11) {
var _this19 = this;
@@ -3632,14 +3281,17 @@ var Choices = function () {
text: function text() {
if (target === _this19.input.element) {
_this19.containerOuter.removeFocusState();
+
if (hasHighlightedItems) {
_this19.unhighlightAll();
}
+
_this19.hideDropdown(true);
}
},
'select-one': function selectOne() {
_this19.containerOuter.removeFocusState();
+
if (target === _this19.input.element || target === _this19.containerOuter.element && !_this19._canSearch) {
_this19.hideDropdown(true);
}
@@ -3647,14 +3299,15 @@ var Choices = function () {
'select-multiple': function selectMultiple() {
if (target === _this19.input.element) {
_this19.containerOuter.removeFocusState();
+
_this19.hideDropdown(true);
+
if (hasHighlightedItems) {
_this19.unhighlightAll();
}
}
}
};
-
blurActions[this.passedElement.element.type]();
} else {
// On IE11, clicking the scollbar blurs our input and thus
@@ -3665,17 +3318,16 @@ var Choices = function () {
}
}
}, {
- key: '_onFormReset',
+ key: "_onFormReset",
value: function _onFormReset() {
this._store.dispatch((0, _misc.resetTo)(this._initialState));
}
}, {
- key: '_highlightChoice',
+ key: "_highlightChoice",
value: function _highlightChoice() {
var _this20 = this;
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
-
var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));
if (!choices.length) {
@@ -3683,9 +3335,8 @@ var Choices = function () {
}
var passedEl = el;
- var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll('.' + this.config.classNames.highlightedState));
+ var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))); // Remove any highlighted choices
- // Remove any highlighted choices
highlightedChoices.forEach(function (choice) {
choice.classList.remove(_this20.config.classNames.highlightedState);
choice.setAttribute('aria-selected', 'false');
@@ -3710,7 +3361,9 @@ var Choices = function () {
passedEl.classList.add(this.config.classNames.highlightedState);
passedEl.setAttribute('aria-selected', 'true');
- this.passedElement.triggerEvent(_constants.EVENTS.highlightChoice, { el: passedEl });
+ this.passedElement.triggerEvent(_constants.EVENTS.highlightChoice, {
+ el: passedEl
+ });
if (this.dropdown.isActive) {
// IE11 ignores aria-label and blocks virtual keyboard
@@ -3720,38 +3373,35 @@ var Choices = function () {
}
}
}, {
- key: '_addItem',
+ key: "_addItem",
value: function _addItem(_ref12) {
var value = _ref12.value,
_ref12$label = _ref12.label,
- label = _ref12$label === undefined ? null : _ref12$label,
+ label = _ref12$label === void 0 ? null : _ref12$label,
_ref12$choiceId = _ref12.choiceId,
- choiceId = _ref12$choiceId === undefined ? -1 : _ref12$choiceId,
+ choiceId = _ref12$choiceId === void 0 ? -1 : _ref12$choiceId,
_ref12$groupId = _ref12.groupId,
- groupId = _ref12$groupId === undefined ? -1 : _ref12$groupId,
+ groupId = _ref12$groupId === void 0 ? -1 : _ref12$groupId,
_ref12$customProperti = _ref12.customProperties,
- customProperties = _ref12$customProperti === undefined ? null : _ref12$customProperti,
+ customProperties = _ref12$customProperti === void 0 ? null : _ref12$customProperti,
_ref12$placeholder = _ref12.placeholder,
- placeholder = _ref12$placeholder === undefined ? false : _ref12$placeholder,
+ placeholder = _ref12$placeholder === void 0 ? false : _ref12$placeholder,
_ref12$keyCode = _ref12.keyCode,
- keyCode = _ref12$keyCode === undefined ? null : _ref12$keyCode;
-
+ keyCode = _ref12$keyCode === void 0 ? null : _ref12$keyCode;
var passedValue = (0, _utils.isType)('String', value) ? value.trim() : value;
-
var passedKeyCode = keyCode;
var passedCustomProperties = customProperties;
var items = this._store.items;
var passedLabel = label || passedValue;
var passedOptionId = parseInt(choiceId, 10) || -1;
var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
- var id = items ? items.length + 1 : 1;
+ var id = items ? items.length + 1 : 1; // If a prepended value has been passed, prepend it
- // If a prepended value has been passed, prepend it
if (this.config.prependValue) {
passedValue = this.config.prependValue + passedValue.toString();
- }
+ } // If an appended value has been passed, append it
+
- // If an appended value has been passed, append it
if (this.config.appendValue) {
passedValue += this.config.appendValue.toString();
}
@@ -3769,9 +3419,9 @@ var Choices = function () {
if (this._isSelectOneElement) {
this.removeActiveItems(id);
- }
+ } // Trigger change event
+
- // Trigger change event
this.passedElement.triggerEvent(_constants.EVENTS.addItem, {
id: id,
value: passedValue,
@@ -3780,11 +3430,10 @@ var Choices = function () {
groupValue: group && group.value ? group.value : undefined,
keyCode: passedKeyCode
});
-
return this;
}
}, {
- key: '_removeItem',
+ key: "_removeItem",
value: function _removeItem(item) {
if (!item || !(0, _utils.isType)('Object', item)) {
return this;
@@ -3795,7 +3444,6 @@ var Choices = function () {
label = item.label,
choiceId = item.choiceId,
groupId = item.groupId;
-
var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
this._store.dispatch((0, _items.removeItem)(id, choiceId));
@@ -3818,33 +3466,33 @@ var Choices = function () {
return this;
}
}, {
- key: '_addChoice',
+ key: "_addChoice",
value: function _addChoice(_ref13) {
var value = _ref13.value,
_ref13$label = _ref13.label,
- label = _ref13$label === undefined ? null : _ref13$label,
+ label = _ref13$label === void 0 ? null : _ref13$label,
_ref13$isSelected = _ref13.isSelected,
- isSelected = _ref13$isSelected === undefined ? false : _ref13$isSelected,
+ isSelected = _ref13$isSelected === void 0 ? false : _ref13$isSelected,
_ref13$isDisabled = _ref13.isDisabled,
- isDisabled = _ref13$isDisabled === undefined ? false : _ref13$isDisabled,
+ isDisabled = _ref13$isDisabled === void 0 ? false : _ref13$isDisabled,
_ref13$groupId = _ref13.groupId,
- groupId = _ref13$groupId === undefined ? -1 : _ref13$groupId,
+ groupId = _ref13$groupId === void 0 ? -1 : _ref13$groupId,
_ref13$customProperti = _ref13.customProperties,
- customProperties = _ref13$customProperti === undefined ? null : _ref13$customProperti,
+ customProperties = _ref13$customProperti === void 0 ? null : _ref13$customProperti,
_ref13$placeholder = _ref13.placeholder,
- placeholder = _ref13$placeholder === undefined ? false : _ref13$placeholder,
+ placeholder = _ref13$placeholder === void 0 ? false : _ref13$placeholder,
_ref13$keyCode = _ref13.keyCode,
- keyCode = _ref13$keyCode === undefined ? null : _ref13$keyCode;
+ keyCode = _ref13$keyCode === void 0 ? null : _ref13$keyCode;
if (typeof value === 'undefined' || value === null) {
return;
- }
+ } // Generate unique id
+
- // Generate unique id
var choices = this._store.choices;
var choiceLabel = label || value;
var choiceId = choices ? choices.length + 1 : 1;
- var choiceElementId = this._baseId + '-' + this._idNames.itemChoice + '-' + choiceId;
+ var choiceElementId = "".concat(this._baseId, "-").concat(this._idNames.itemChoice, "-").concat(choiceId);
this._store.dispatch((0, _choices.addChoice)({
value: value,
@@ -3870,22 +3518,21 @@ var Choices = function () {
}
}
}, {
- key: '_clearChoices',
+ key: "_clearChoices",
value: function _clearChoices() {
this._store.dispatch((0, _choices.clearChoices)());
}
}, {
- key: '_addGroup',
+ key: "_addGroup",
value: function _addGroup(_ref14) {
var _this21 = this;
var group = _ref14.group,
id = _ref14.id,
_ref14$valueKey = _ref14.valueKey,
- valueKey = _ref14$valueKey === undefined ? 'value' : _ref14$valueKey,
+ valueKey = _ref14$valueKey === void 0 ? 'value' : _ref14$valueKey,
_ref14$labelKey = _ref14.labelKey,
- labelKey = _ref14$labelKey === undefined ? 'label' : _ref14$labelKey;
-
+ labelKey = _ref14$labelKey === void 0 ? 'label' : _ref14$labelKey;
var groupChoices = (0, _utils.isType)('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));
var groupId = id || Math.floor(new Date().valueOf() * Math.random());
var isDisabled = group.disabled ? group.disabled : false;
@@ -3913,7 +3560,7 @@ var Choices = function () {
}
}
}, {
- key: '_getTemplate',
+ key: "_getTemplate",
value: function _getTemplate(template) {
var _templates$template;
@@ -3921,21 +3568,20 @@ var Choices = function () {
return null;
}
- var _config4 = this.config,
- templates = _config4.templates,
- classNames = _config4.classNames;
+ var _this$config4 = this.config,
+ templates = _this$config4.templates,
+ classNames = _this$config4.classNames;
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return (_templates$template = templates[template]).call.apply(_templates$template, [this, classNames].concat(args));
}
}, {
- key: '_createTemplates',
+ key: "_createTemplates",
value: function _createTemplates() {
var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates;
-
var userTemplates = {};
if (callbackOnCreateTemplates && (0, _utils.isType)('Function', callbackOnCreateTemplates)) {
@@ -3945,7 +3591,7 @@ var Choices = function () {
this.config.templates = (0, _utils.extend)(_templates.TEMPLATES, userTemplates);
}
}, {
- key: '_createElements',
+ key: "_createElements",
value: function _createElements() {
this.containerOuter = new _components.Container({
element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type),
@@ -3953,28 +3599,23 @@ var Choices = function () {
type: this.passedElement.element.type,
position: this.config.position
});
-
this.containerInner = new _components.Container({
element: this._getTemplate('containerInner'),
classNames: this.config.classNames,
type: this.passedElement.element.type,
position: this.config.position
});
-
this.input = new _components.Input({
element: this._getTemplate('input'),
classNames: this.config.classNames,
type: this.passedElement.element.type
});
-
this.choiceList = new _components.List({
element: this._getTemplate('choiceList', this._isSelectOneElement)
});
-
this.itemList = new _components.List({
element: this._getTemplate('itemList', this._isSelectOneElement)
});
-
this.dropdown = new _components.Dropdown({
element: this._getTemplate('dropdown'),
classNames: this.config.classNames,
@@ -3982,13 +3623,13 @@ var Choices = function () {
});
}
}, {
- key: '_createStructure',
+ key: "_createStructure",
value: function _createStructure() {
// Hide original element
- this.passedElement.conceal();
- // Wrap input in container preserving DOM ordering
- this.containerInner.wrap(this.passedElement.element);
- // Wrapper inner container with outer container
+ this.passedElement.conceal(); // Wrap input in container preserving DOM ordering
+
+ this.containerInner.wrap(this.passedElement.element); // Wrapper inner container with outer container
+
this.containerOuter.wrap(this.containerInner.element);
if (this._isSelectOneElement) {
@@ -4019,19 +3660,20 @@ var Choices = function () {
}
}
}, {
- key: '_addPredefinedChoices',
+ key: "_addPredefinedChoices",
value: function _addPredefinedChoices() {
var _this22 = this;
var passedGroups = this.passedElement.optionGroups;
-
this._highlightPosition = 0;
this._isSearching = false;
+
this._setLoading(true);
if (passedGroups && passedGroups.length) {
// If we have a placeholder option
var placeholderChoice = this.passedElement.placeholderOption;
+
if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') {
this._addChoice({
value: placeholderChoice.value,
@@ -4051,9 +3693,8 @@ var Choices = function () {
} else {
var passedOptions = this.passedElement.options;
var filter = this.config.sortFn;
- var allChoices = this._presetChoices;
+ var allChoices = this._presetChoices; // Create array of options from option elements
- // Create array of options from option elements
passedOptions.forEach(function (o) {
allChoices.push({
value: o.value,
@@ -4062,24 +3703,23 @@ var Choices = function () {
disabled: o.disabled || o.parentNode.disabled,
placeholder: o.hasAttribute('placeholder')
});
- });
+ }); // If sorting is enabled or the user is searching, filter choices
- // 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
+
- // Determine whether there is a selected choice
var hasSelectedChoice = allChoices.some(function (choice) {
return choice.selected;
});
+
var handleChoice = function handleChoice(choice, index) {
var value = choice.value,
label = choice.label,
customProperties = choice.customProperties,
placeholder = choice.placeholder;
-
if (_this22._isSelectElement) {
// If the choice is actually a group
if (choice.choices) {
@@ -4114,9 +3754,9 @@ var Choices = function () {
placeholder: placeholder
});
}
- };
+ }; // Add each choice
+
- // Add each choice
allChoices.forEach(function (choice, index) {
return handleChoice(choice, index);
});
@@ -4125,12 +3765,13 @@ var Choices = function () {
this._setLoading(false);
}
}, {
- key: '_addPredefinedItems',
+ key: "_addPredefinedItems",
value: function _addPredefinedItems() {
var _this23 = this;
var handlePresetItem = function handlePresetItem(item) {
var itemType = (0, _utils.getType)(item);
+
if (itemType === 'Object' && item.value) {
_this23._addItem({
value: item.value,
@@ -4151,7 +3792,7 @@ var Choices = function () {
});
}
}, {
- key: '_setChoiceOrItem',
+ key: "_setChoiceOrItem",
value: function _setChoiceOrItem(item) {
var _this24 = this;
@@ -4160,10 +3801,10 @@ var Choices = function () {
object: function object() {
if (!item.value) {
return;
- }
-
- // If we are dealing with a select input, we need to create an option first
+ } // If we are dealing with a select input, we need to create an option first
// that is then selected. For text inputs we can just add items normally.
+
+
if (!_this24._isTextElement) {
_this24._addChoice({
value: item.value,
@@ -4198,16 +3839,15 @@ var Choices = function () {
}
}
};
-
handleType[itemType]();
}
}, {
- key: '_findAndSelectChoiceByValue',
+ key: "_findAndSelectChoiceByValue",
value: function _findAndSelectChoiceByValue(val) {
var _this25 = this;
- var choices = this._store.choices;
- // Check 'value' property exists and the choice isn't already selected
+ var choices = this._store.choices; // Check 'value' property exists and the choice isn't already selected
+
var foundChoice = choices.find(function (choice) {
return _this25.config.itemComparer(choice.value, val);
});
@@ -4225,7 +3865,7 @@ var Choices = function () {
}
}
}, {
- key: '_generateInstances',
+ key: "_generateInstances",
value: function _generateInstances(elements, config) {
return elements.reduce(function (instances, element) {
instances.push(new Choices(element, config));
@@ -4233,7 +3873,7 @@ var Choices = function () {
}, [this]);
}
}, {
- key: '_generatePlaceholderValue',
+ key: "_generatePlaceholderValue",
value: function _generatePlaceholderValue() {
if (this._isSelectOneElement) {
return false;
@@ -4241,7 +3881,6 @@ var Choices = function () {
return this.config.placeholder ? this.config.placeholderValue || this.passedElement.element.getAttribute('placeholder') : false;
}
-
/* ===== End of Private functions ====== */
}]);
@@ -4249,31 +3888,26 @@ var Choices = function () {
return Choices;
}();
-Choices.userDefaults = {};
-// We cannot export default here due to Webpack: https://github.com/webpack/webpack/issues/3929
+Choices.userDefaults = {}; // We cannot export default here due to Webpack: https://github.com/webpack/webpack/issues/3929
+
module.exports = Choices;
/***/ }),
-/* 39 */
+/* 11 */
/***/ (function(module, exports, __webpack_require__) {
/*!
- * Fuse.js v3.2.0 - Lightweight fuzzy-search (http://fusejs.io)
- *
+ * Fuse.js v3.4.1 - 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 if(typeof define === 'function' && define.amd)
- define("Fuse", [], factory);
- else if(typeof exports === 'object')
- exports["Fuse"] = factory();
- else
- root["Fuse"] = factory();
+ else {}
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
@@ -4310,20 +3944,37 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
-/******/ // identity function for calling harmony imports with the correct context
-/******/ __webpack_require__.i = function(value) { return value; };
-/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
-/******/ Object.defineProperty(exports, name, {
-/******/ configurable: false,
-/******/ enumerable: true,
-/******/ get: getter
-/******/ });
+/******/ 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 ?
@@ -4339,68 +3990,341 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
+/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 8);
+/******/ return __webpack_require__(__webpack_require__.s = "./src/index.js");
/******/ })
/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ (function(module, exports, __webpack_require__) {
+/******/ ({
-"use strict";
+/***/ "./src/bitap/bitap_matched_indices.js":
+/*!********************************************!*\
+ !*** ./src/bitap/bitap_matched_indices.js ***!
+ \********************************************/
+/*! no static exports found */
+/***/ (function(module, exports) {
+
+module.exports = (matchmask = [], minMatchCharLength = 1) => {
+ let matchedIndices = [];
+ let start = -1;
+ let end = -1;
+ let i = 0;
+
+ for (let len = matchmask.length; i < len; i += 1) {
+ let 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
-module.exports = function (obj) {
- return Object.prototype.toString.call(obj) === '[object Array]';
+ if (matchmask[i - 1] && i - start >= minMatchCharLength) {
+ matchedIndices.push([start, i - 1]);
+ }
+
+ return matchedIndices;
};
/***/ }),
-/* 1 */
+
+/***/ "./src/bitap/bitap_pattern_alphabet.js":
+/*!*********************************************!*\
+ !*** ./src/bitap/bitap_pattern_alphabet.js ***!
+ \*********************************************/
+/*! no static exports found */
+/***/ (function(module, exports) {
+
+module.exports = pattern => {
+ let mask = {};
+ let len = pattern.length;
+
+ for (let 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;
+ }
+
+ return mask;
+};
+
+/***/ }),
+
+/***/ "./src/bitap/bitap_regex_search.js":
+/*!*****************************************!*\
+ !*** ./src/bitap/bitap_regex_search.js ***!
+ \*****************************************/
+/*! no static exports found */
+/***/ (function(module, exports) {
+
+const 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 = [];
+
+ if (isMatch) {
+ for (let i = 0, matchesLen = matches.length; i < matchesLen; i += 1) {
+ let match = matches[i];
+ matchedIndices.push([text.indexOf(match), match.length - 1]);
+ }
+ }
+
+ return {
+ // TODO: revisit this score
+ score: isMatch ? 0.5 : 1,
+ isMatch,
+ matchedIndices
+ };
+};
+
+/***/ }),
+
+/***/ "./src/bitap/bitap_score.js":
+/*!**********************************!*\
+ !*** ./src/bitap/bitap_score.js ***!
+ \**********************************/
+/*! 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);
+
+ 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__) {
-"use strict";
+const bitapScore = __webpack_require__(/*! ./bitap_score */ "./src/bitap/bitap_score.js");
+
+const 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.
+
+ const textLen = text.length; // Highest score beyond which we give up.
+
+ let currentThreshold = threshold; // Is there a nearby exact match? (speedup)
+
+ let bestLocation = text.indexOf(pattern, expectedLocation);
+ const patternLen = pattern.length; // a mask of the matches
+
+ const matchMask = [];
+
+ for (let i = 0; i < textLen; i += 1) {
+ matchMask[i] = 0;
+ }
+
+ if (bestLocation !== -1) {
+ let score = bitapScore(pattern, {
+ errors: 0,
+ currentLocation: bestLocation,
+ expectedLocation,
+ 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, {
+ errors: 0,
+ currentLocation: bestLocation,
+ expectedLocation,
+ distance
+ });
+ currentThreshold = Math.min(score, currentThreshold);
+ }
+ } // Reset the best location
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+ bestLocation = -1;
+ let lastBitArr = [];
+ let finalScore = 1;
+ let binMax = patternLen + textLen;
+ const mask = 1 << patternLen - 1;
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+ for (let 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 bitapRegexSearch = __webpack_require__(5);
-var bitapSearch = __webpack_require__(7);
-var patternAlphabet = __webpack_require__(4);
+ while (binMin < binMid) {
+ const score = bitapScore(pattern, {
+ errors: i,
+ currentLocation: expectedLocation + binMid,
+ expectedLocation,
+ distance
+ });
-var Bitap = function () {
- function Bitap(pattern, _ref) {
- var _ref$location = _ref.location,
- location = _ref$location === undefined ? 0 : _ref$location,
- _ref$distance = _ref.distance,
- distance = _ref$distance === undefined ? 100 : _ref$distance,
- _ref$threshold = _ref.threshold,
- threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,
- _ref$maxPatternLength = _ref.maxPatternLength,
- maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,
- _ref$isCaseSensitive = _ref.isCaseSensitive,
- isCaseSensitive = _ref$isCaseSensitive === undefined ? false : _ref$isCaseSensitive,
- _ref$tokenSeparator = _ref.tokenSeparator,
- tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,
- _ref$findAllMatches = _ref.findAllMatches,
- findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,
- _ref$minMatchCharLeng = _ref.minMatchCharLength,
- minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;
+ if (score <= currentThreshold) {
+ binMin = binMid;
+ } else {
+ binMax = binMid;
+ }
- _classCallCheck(this, Bitap);
+ binMid = Math.floor((binMax - binMin) / 2 + binMin);
+ } // Use the result from this iteration as the maximum for the next.
+
+ binMax = binMid;
+ let start = Math.max(1, expectedLocation - binMid + 1);
+ let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; // Initialize the bit array
+
+ let 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)];
+
+ 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,
+ expectedLocation,
+ 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.
+
+
+ const score = bitapScore(pattern, {
+ errors: i + 1,
+ currentLocation: expectedLocation,
+ expectedLocation,
+ distance
+ }); // console.log('score', score, finalScore)
+
+ if (score > 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__) {
+
+const bitapRegexSearch = __webpack_require__(/*! ./bitap_regex_search */ "./src/bitap/bitap_regex_search.js");
+
+const bitapSearch = __webpack_require__(/*! ./bitap_search */ "./src/bitap/bitap_search.js");
+
+const patternAlphabet = __webpack_require__(/*! ./bitap_pattern_alphabet */ "./src/bitap/bitap_pattern_alphabet.js");
+
+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: location,
- distance: distance,
- threshold: threshold,
- maxPatternLength: maxPatternLength,
- isCaseSensitive: isCaseSensitive,
- tokenSeparator: tokenSeparator,
- findAllMatches: findAllMatches,
- minMatchCharLength: minMatchCharLength
+ location,
+ distance,
+ threshold,
+ maxPatternLength,
+ isCaseSensitive,
+ tokenSeparator,
+ findAllMatches,
+ minMatchCharLength
};
-
this.pattern = this.options.isCaseSensitive ? pattern : pattern.toLowerCase();
if (this.pattern.length <= maxPatternLength) {
@@ -4408,89 +4332,87 @@ var Bitap = function () {
}
}
- _createClass(Bitap, [{
- key: 'search',
- value: function search(text) {
- if (!this.options.isCaseSensitive) {
- text = text.toLowerCase();
- }
+ search(text) {
+ if (!this.options.isCaseSensitive) {
+ text = text.toLowerCase();
+ } // Exact match
- // 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 _options = this.options,
- maxPatternLength = _options.maxPatternLength,
- tokenSeparator = _options.tokenSeparator;
+ 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.length > maxPatternLength) {
- return bitapRegexSearch(text, this.pattern, tokenSeparator);
- }
- // Otherwise, use Bitap algorithm
- var _options2 = this.options,
- location = _options2.location,
- distance = _options2.distance,
- threshold = _options2.threshold,
- findAllMatches = _options2.findAllMatches,
- minMatchCharLength = _options2.minMatchCharLength;
+ const {
+ maxPatternLength,
+ tokenSeparator
+ } = this.options;
- return bitapSearch(text, this.pattern, this.patternAlphabet, {
- location: location,
- distance: distance,
- threshold: threshold,
- findAllMatches: findAllMatches,
- minMatchCharLength: minMatchCharLength
- });
- }
- }]);
+ if (this.pattern.length > maxPatternLength) {
+ return bitapRegexSearch(text, this.pattern, tokenSeparator);
+ } // Otherwise, use Bitap algorithm
- return Bitap;
-}();
-// let x = new Bitap("od mn war", {})
+ const {
+ location,
+ distance,
+ threshold,
+ findAllMatches,
+ minMatchCharLength
+ } = this.options;
+ return bitapSearch(text, this.pattern, this.patternAlphabet, {
+ location,
+ distance,
+ threshold,
+ findAllMatches,
+ minMatchCharLength
+ });
+ }
+
+} // let x = new Bitap("od mn war", {})
// let result = x.search("Old Man's War")
// console.log(result)
+
module.exports = Bitap;
/***/ }),
-/* 2 */
+
+/***/ "./src/helpers/deep_value.js":
+/*!***********************************!*\
+ !*** ./src/helpers/deep_value.js ***!
+ \***********************************/
+/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+const isArray = __webpack_require__(/*! ./is_array */ "./src/helpers/is_array.js");
-
-var isArray = __webpack_require__(0);
-
-var deepValue = function deepValue(obj, path, list) {
+const 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;
+ const dotIndex = path.indexOf('.');
+ let firstSegment = path;
+ let remaining = null;
if (dotIndex !== -1) {
firstSegment = path.slice(0, dotIndex);
remaining = path.slice(dotIndex + 1);
}
- var value = obj[firstSegment];
+ const 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) {
+ for (let i = 0, len = value.length; i < len; i += 1) {
deepValue(value[i], remaining, list);
}
} else if (remaining) {
@@ -4503,763 +4425,514 @@ var deepValue = function deepValue(obj, path, list) {
return list;
};
-module.exports = function (obj, path) {
+module.exports = (obj, path) => {
return deepValue(obj, path, []);
};
/***/ }),
-/* 3 */
-/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+/***/ "./src/helpers/is_array.js":
+/*!*********************************!*\
+ !*** ./src/helpers/is_array.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;
-};
+module.exports = obj => !Array.isArray ? Object.prototype.toString.call(obj) === '[object Array]' : Array.isArray(obj);
/***/ }),
-/* 4 */
+
+/***/ "./src/index.js":
+/*!**********************!*\
+ !*** ./src/index.js ***!
+ \**********************/
+/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
-"use strict";
+const Bitap = __webpack_require__(/*! ./bitap */ "./src/bitap/index.js");
+const deepValue = __webpack_require__(/*! ./helpers/deep_value */ "./src/helpers/deep_value.js");
-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;
-};
-
-/***/ }),
-/* 5 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-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
- };
-};
-
-/***/ }),
-/* 6 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-module.exports = function (pattern, _ref) {
- var _ref$errors = _ref.errors,
- errors = _ref$errors === undefined ? 0 : _ref$errors,
- _ref$currentLocation = _ref.currentLocation,
- currentLocation = _ref$currentLocation === undefined ? 0 : _ref$currentLocation,
- _ref$expectedLocation = _ref.expectedLocation,
- expectedLocation = _ref$expectedLocation === undefined ? 0 : _ref$expectedLocation,
- _ref$distance = _ref.distance,
- distance = _ref$distance === undefined ? 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;
-};
-
-/***/ }),
-/* 7 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var bitapScore = __webpack_require__(6);
-var matchedIndices = __webpack_require__(3);
-
-module.exports = function (text, pattern, patternAlphabet, _ref) {
- var _ref$location = _ref.location,
- location = _ref$location === undefined ? 0 : _ref$location,
- _ref$distance = _ref.distance,
- distance = _ref$distance === undefined ? 100 : _ref$distance,
- _ref$threshold = _ref.threshold,
- threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,
- _ref$findAllMatches = _ref.findAllMatches,
- findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,
- _ref$minMatchCharLeng = _ref.minMatchCharLength,
- minMatchCharLength = _ref$minMatchCharLeng === undefined ? 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
- });
-
- if (_score2 > currentThreshold) {
- break;
- }
-
- lastBitArr = bitArr;
- }
-
- // 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)
- };
-};
-
-/***/ }),
-/* 8 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var Bitap = __webpack_require__(1);
-var deepValue = __webpack_require__(2);
-var isArray = __webpack_require__(0);
-
-var Fuse = function () {
- function Fuse(list, _ref) {
- var _ref$location = _ref.location,
- location = _ref$location === undefined ? 0 : _ref$location,
- _ref$distance = _ref.distance,
- distance = _ref$distance === undefined ? 100 : _ref$distance,
- _ref$threshold = _ref.threshold,
- threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,
- _ref$maxPatternLength = _ref.maxPatternLength,
- maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,
- _ref$caseSensitive = _ref.caseSensitive,
- caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,
- _ref$tokenSeparator = _ref.tokenSeparator,
- tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,
- _ref$findAllMatches = _ref.findAllMatches,
- findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,
- _ref$minMatchCharLeng = _ref.minMatchCharLength,
- minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng,
- _ref$id = _ref.id,
- id = _ref$id === undefined ? null : _ref$id,
- _ref$keys = _ref.keys,
- keys = _ref$keys === undefined ? [] : _ref$keys,
- _ref$shouldSort = _ref.shouldSort,
- shouldSort = _ref$shouldSort === undefined ? true : _ref$shouldSort,
- _ref$getFn = _ref.getFn,
- getFn = _ref$getFn === undefined ? deepValue : _ref$getFn,
- _ref$sortFn = _ref.sortFn,
- sortFn = _ref$sortFn === undefined ? function (a, b) {
- return a.score - b.score;
- } : _ref$sortFn,
- _ref$tokenize = _ref.tokenize,
- tokenize = _ref$tokenize === undefined ? false : _ref$tokenize,
- _ref$matchAllTokens = _ref.matchAllTokens,
- matchAllTokens = _ref$matchAllTokens === undefined ? false : _ref$matchAllTokens,
- _ref$includeMatches = _ref.includeMatches,
- includeMatches = _ref$includeMatches === undefined ? false : _ref$includeMatches,
- _ref$includeScore = _ref.includeScore,
- includeScore = _ref$includeScore === undefined ? false : _ref$includeScore,
- _ref$verbose = _ref.verbose,
- verbose = _ref$verbose === undefined ? false : _ref$verbose;
-
- _classCallCheck(this, Fuse);
+const isArray = __webpack_require__(/*! ./helpers/is_array */ "./src/helpers/is_array.js");
+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: location,
- distance: distance,
- threshold: threshold,
- maxPatternLength: maxPatternLength,
+ location,
+ distance,
+ threshold,
+ 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
+ tokenSeparator,
+ findAllMatches,
+ minMatchCharLength,
+ id,
+ keys,
+ includeMatches,
+ includeScore,
+ shouldSort,
+ getFn,
+ sortFn,
+ verbose,
+ tokenize,
+ matchAllTokens
};
-
this.setCollection(list);
}
- _createClass(Fuse, [{
- key: 'setCollection',
- value: function setCollection(list) {
- this.list = list;
- return 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);
}
- }, {
- key: 'search',
- value: function search(pattern) {
- this._log('---------\nSearch pattern: "' + pattern + '"');
- var _prepareSearchers2 = this._prepareSearchers(pattern),
- tokenSearchers = _prepareSearchers2.tokenSearchers,
- fullSearcher = _prepareSearchers2.fullSearcher;
+ if (opts.limit && typeof opts.limit === 'number') {
+ results = results.slice(0, opts.limit);
+ }
- var _search2 = this._search(tokenSearchers, fullSearcher),
- weights = _search2.weights,
- results = _search2.results;
+ return this._format(results);
+ }
- this._computeScore(weights, results);
+ _prepareSearchers(pattern = '') {
+ const tokenSearchers = [];
- if (this.options.shouldSort) {
- this._sort(results);
+ if (this.options.tokenize) {
+ // Tokenize on the separator
+ const tokens = pattern.split(this.options.tokenSeparator);
+
+ for (let i = 0, len = tokens.length; i < len; i += 1) {
+ tokenSearchers.push(new Bitap(tokens[i], this.options));
+ }
+ }
+
+ let fullSearcher = new Bitap(pattern, this.options);
+ return {
+ tokenSearchers,
+ fullSearcher
+ };
+ }
+
+ _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.
+
+ 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
+ });
}
- return this._format(results);
- }
- }, {
- key: '_prepareSearchers',
- value: function _prepareSearchers() {
- var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
+ return {
+ weights: null,
+ 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 tokenSearchers = [];
+
+ 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;
+ }
+
+ let exists = false;
+ let averageScore = -1;
+ let numTextMatches = 0;
+
+ if (typeof value === 'string') {
+ this._log(`\nKey: ${key === '' ? '-' : key}`);
+
+ let mainSearchResult = fullSearcher.search(value);
+
+ this._log(`Full text: "${value}", score: ${mainSearchResult.score}`);
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));
- }
- }
+ let words = value.split(this.options.tokenSeparator);
+ let scores = [];
- var fullSearcher = new Bitap(pattern, this.options);
+ for (let i = 0; i < tokenSearchers.length; i += 1) {
+ let tokenSearcher = tokenSearchers[i];
- return { tokenSearchers: tokenSearchers, fullSearcher: fullSearcher };
- }
- }, {
- key: '_search',
- value: function _search() {
- var tokenSearchers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- var fullSearcher = arguments[1];
+ this._log(`\nPattern: "${tokenSearcher.pattern}"`); // let tokenScores = []
- 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
- });
- }
+ let hasMatchInText = false;
- return { weights: null, results: results };
- }
+ for (let j = 0; j < words.length; j += 1) {
+ let word = words[j];
+ let tokenSearchResult = tokenSearcher.search(word);
+ let obj = {};
- // 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
- };
- }
+ if (tokenSearchResult.isMatch) {
+ obj[word] = tokenSearchResult.score;
+ exists = true;
+ hasMatchInText = true;
+ scores.push(tokenSearchResult.score);
+ } else {
+ obj[word] = 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 === undefined ? -1 : _ref2$arrayIndex,
- value = _ref2.value,
- record = _ref2.record,
- index = _ref2.index;
- var _ref3$tokenSearchers = _ref3.tokenSearchers,
- tokenSearchers = _ref3$tokenSearchers === undefined ? [] : _ref3$tokenSearchers,
- _ref3$fullSearcher = _ref3.fullSearcher,
- fullSearcher = _ref3$fullSearcher === undefined ? [] : _ref3$fullSearcher,
- _ref3$resultMap = _ref3.resultMap,
- resultMap = _ref3$resultMap === undefined ? {} : _ref3$resultMap,
- _ref3$results = _ref3.results,
- results = _ref3$results === undefined ? [] : _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: ' + (key === '' ? '-' : key));
-
- var mainSearchResult = fullSearcher.search(value);
- this._log('Full text: "' + value + '", score: ' + 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: "' + 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);
- }
+ if (!this.options.matchAllTokens) {
+ scores.push(1);
}
- this._log('Token: "' + word + '", score: ' + obj[word]);
- // tokenScores.push(obj)
}
- if (hasMatchInText) {
- numTextMatches += 1;
- }
+ this._log(`Token: "${word}", score: ${obj[word]}`); // tokenScores.push(obj)
+
}
- averageScore = scores[0];
- var scoresLen = scores.length;
- for (var _i2 = 1; _i2 < scoresLen; _i2 += 1) {
- averageScore += scores[_i2];
+ if (hasMatchInText) {
+ numTextMatches += 1;
}
- averageScore = averageScore / scoresLen;
-
- this._log('Token score average:', averageScore);
}
- var finalScore = mainSearchResult.score;
- if (averageScore > -1) {
- finalScore = (finalScore + averageScore) / 2;
+ averageScore = scores[0];
+ let scoresLen = scores.length;
+
+ for (let i = 1; i < scoresLen; i += 1) {
+ averageScore += scores[i];
}
- this._log('Score average:', finalScore);
+ averageScore = averageScore / scoresLen;
- var checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true;
+ this._log('Token score average:', averageScore);
+ }
- this._log('\nCheck Matches: ' + checkTextMatches);
+ let finalScore = mainSearchResult.score;
- // 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,
+ 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
+
+
+ if ((exists || mainSearchResult.isMatch) && checkTextMatches) {
+ // Check if the item already exists in our results
+ let 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,
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
- });
+ }]
+ };
+ results.push(resultMap[index]);
}
}
- }
- }, {
- 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 totalScore = 0;
- 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;
- totalScore += nScore;
- }
- }
-
- results[i].score = bestScore === 1 ? totalScore / scoreLen : 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 = [];
-
- this._log('\n\nOutput:\n\n', JSON.stringify(results));
-
- 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);
- }
+ } 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
});
}
-
- 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);
+ _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;
+ }
}
- }
- }]);
- return Fuse;
-}();
+ results[i].score = bestScore === 1 ? currScore : bestScore;
+
+ 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);
+ }
+
+ 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 (this.options.includeScore) {
+ transformers.push((result, data) => {
+ data.score = result.score;
+ });
+ }
+
+ for (let i = 0, len = results.length; i < len; i += 1) {
+ const 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;
+ }
+
+ 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;
+ }
+
+ _log() {
+ if (this.options.verbose) {
+ console.log(...arguments);
+ }
+ }
+
+}
module.exports = Fuse;
/***/ })
-/******/ ]);
+
+/******/ });
});
-//# sourceMappingURL=fuse.js.map
/***/ }),
-/* 40 */
+/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
-Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
+__webpack_require__.r(__webpack_exports__);
var isMergeableObject = function isMergeableObject(value) {
return isNonNullObject(value)
&& !isSpecial(value)
@@ -5352,666 +5025,16 @@ var deepmerge_1 = deepmerge;
/***/ }),
-/* 41 */
+/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
-__webpack_require__(42);
-
-__webpack_require__(51);
-
-__webpack_require__(70);
-
-__webpack_require__(72);
+__webpack_require__(14);
/***/ }),
-/* 42 */
-/***/ (function(module, exports, __webpack_require__) {
-
-__webpack_require__(43);
-module.exports = __webpack_require__(2).Array.find;
-
-
-/***/ }),
-/* 43 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
-var $export = __webpack_require__(6);
-var $find = __webpack_require__(47)(5);
-var KEY = 'find';
-var forced = true;
-// Shouldn't skip holes
-if (KEY in []) Array(1)[KEY](function () { forced = false; });
-$export($export.P + $export.F * forced, 'Array', {
- find: function find(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
-});
-__webpack_require__(28)(KEY);
-
-
-/***/ }),
-/* 44 */
-/***/ (function(module, exports, __webpack_require__) {
-
-module.exports = !__webpack_require__(10) && !__webpack_require__(22)(function () {
- return Object.defineProperty(__webpack_require__(23)('div'), 'a', { get: function () { return 7; } }).a != 7;
-});
-
-
-/***/ }),
-/* 45 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 7.1.1 ToPrimitive(input [, PreferredType])
-var isObject = __webpack_require__(9);
-// instead of the ES6 spec version, we didn't implement @@toPrimitive case
-// and the second argument - flag - preferred type is a string
-module.exports = function (it, S) {
- if (!isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
-};
-
-
-/***/ }),
-/* 46 */
-/***/ (function(module, exports) {
-
-module.exports = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
-};
-
-
-/***/ }),
-/* 47 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 0 -> Array#forEach
-// 1 -> Array#map
-// 2 -> Array#filter
-// 3 -> Array#some
-// 4 -> Array#every
-// 5 -> Array#find
-// 6 -> Array#findIndex
-var ctx = __webpack_require__(14);
-var IObject = __webpack_require__(25);
-var toObject = __webpack_require__(16);
-var toLength = __webpack_require__(18);
-var asc = __webpack_require__(48);
-module.exports = function (TYPE, $create) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- var create = $create || asc;
- return function ($this, callbackfn, that) {
- var O = toObject($this);
- var self = IObject(O);
- var f = ctx(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
- var val, res;
- for (;length > index; index++) if (NO_HOLES || index in self) {
- val = self[index];
- res = f(val, index, O);
- if (TYPE) {
- if (IS_MAP) result[index] = res; // map
- else if (res) switch (TYPE) {
- case 3: return true; // some
- case 5: return val; // find
- case 6: return index; // findIndex
- case 2: result.push(val); // filter
- } else if (IS_EVERY) return false; // every
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
-};
-
-
-/***/ }),
-/* 48 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 9.4.2.3 ArraySpeciesCreate(originalArray, length)
-var speciesConstructor = __webpack_require__(49);
-
-module.exports = function (original, length) {
- return new (speciesConstructor(original))(length);
-};
-
-
-/***/ }),
-/* 49 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var isObject = __webpack_require__(9);
-var isArray = __webpack_require__(50);
-var SPECIES = __webpack_require__(0)('species');
-
-module.exports = function (original) {
- var C;
- if (isArray(original)) {
- C = original.constructor;
- // cross-realm fallback
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
- if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- } return C === undefined ? Array : C;
-};
-
-
-/***/ }),
-/* 50 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 7.2.2 IsArray(argument)
-var cof = __webpack_require__(15);
-module.exports = Array.isArray || function isArray(arg) {
- return cof(arg) == 'Array';
-};
-
-
-/***/ }),
-/* 51 */
-/***/ (function(module, exports, __webpack_require__) {
-
-__webpack_require__(52);
-__webpack_require__(63);
-module.exports = __webpack_require__(2).Array.from;
-
-
-/***/ }),
-/* 52 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-var $at = __webpack_require__(53)(true);
-
-// 21.1.3.27 String.prototype[@@iterator]()
-__webpack_require__(54)(String, 'String', function (iterated) {
- this._t = String(iterated); // target
- this._i = 0; // next index
-// 21.1.5.2.1 %StringIteratorPrototype%.next()
-}, function () {
- var O = this._t;
- var index = this._i;
- var point;
- if (index >= O.length) return { value: undefined, done: true };
- point = $at(O, index);
- this._i += point.length;
- return { value: point, done: false };
-});
-
-
-/***/ }),
-/* 53 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var toInteger = __webpack_require__(19);
-var defined = __webpack_require__(17);
-// true -> String#at
-// false -> String#codePointAt
-module.exports = function (TO_STRING) {
- return function (that, pos) {
- var s = String(defined(that));
- var i = toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
- ? TO_STRING ? s.charAt(i) : a
- : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
-};
-
-
-/***/ }),
-/* 54 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-var LIBRARY = __webpack_require__(27);
-var $export = __webpack_require__(6);
-var redefine = __webpack_require__(24);
-var hide = __webpack_require__(4);
-var Iterators = __webpack_require__(20);
-var $iterCreate = __webpack_require__(55);
-var setToStringTag = __webpack_require__(32);
-var getPrototypeOf = __webpack_require__(62);
-var ITERATOR = __webpack_require__(0)('iterator');
-var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
-var FF_ITERATOR = '@@iterator';
-var KEYS = 'keys';
-var VALUES = 'values';
-
-var returnThis = function () { return this; };
-
-module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- $iterCreate(Constructor, NAME, next);
- var getMethod = function (kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS: return function keys() { return new Constructor(this, kind); };
- case VALUES: return function values() { return new Constructor(this, kind); };
- } return function entries() { return new Constructor(this, kind); };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- // Fix native
- if ($anyNative) {
- IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- // Set @@toStringTag to native iterators
- setToStringTag(IteratorPrototype, TAG, true);
- // fix for some old engines
- if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() { return $native.call(this); };
- }
- // Define iterator
- if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- hide(proto, ITERATOR, $default);
- }
- // Plug for library
- Iterators[NAME] = $default;
- Iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) redefine(proto, key, methods[key]);
- } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
-};
-
-
-/***/ }),
-/* 55 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-var create = __webpack_require__(56);
-var descriptor = __webpack_require__(12);
-var setToStringTag = __webpack_require__(32);
-var IteratorPrototype = {};
-
-// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
-__webpack_require__(4)(IteratorPrototype, __webpack_require__(0)('iterator'), function () { return this; });
-
-module.exports = function (Constructor, NAME, next) {
- Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
- setToStringTag(Constructor, NAME + ' Iterator');
-};
-
-
-/***/ }),
-/* 56 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
-var anObject = __webpack_require__(8);
-var dPs = __webpack_require__(57);
-var enumBugKeys = __webpack_require__(31);
-var IE_PROTO = __webpack_require__(21)('IE_PROTO');
-var Empty = function () { /* empty */ };
-var PROTOTYPE = 'prototype';
-
-// Create object with fake `null` prototype: use iframe Object with cleared prototype
-var createDict = function () {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = __webpack_require__(23)('iframe');
- var i = enumBugKeys.length;
- var lt = '<';
- var gt = '>';
- var iframeDocument;
- iframe.style.display = 'none';
- __webpack_require__(61).appendChild(iframe);
- iframe.src = 'javascript:'; // eslint-disable-line no-script-url
- // createDict = iframe.contentWindow.Object;
- // html.removeChild(iframe);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
- iframeDocument.close();
- createDict = iframeDocument.F;
- while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
- return createDict();
-};
-
-module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- Empty[PROTOTYPE] = anObject(O);
- result = new Empty();
- Empty[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = createDict();
- return Properties === undefined ? result : dPs(result, Properties);
-};
-
-
-/***/ }),
-/* 57 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var dP = __webpack_require__(7);
-var anObject = __webpack_require__(8);
-var getKeys = __webpack_require__(58);
-
-module.exports = __webpack_require__(10) ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var keys = getKeys(Properties);
- var length = keys.length;
- var i = 0;
- var P;
- while (length > i) dP.f(O, P = keys[i++], Properties[P]);
- return O;
-};
-
-
-/***/ }),
-/* 58 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 19.1.2.14 / 15.2.3.14 Object.keys(O)
-var $keys = __webpack_require__(59);
-var enumBugKeys = __webpack_require__(31);
-
-module.exports = Object.keys || function keys(O) {
- return $keys(O, enumBugKeys);
-};
-
-
-/***/ }),
-/* 59 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var has = __webpack_require__(11);
-var toIObject = __webpack_require__(29);
-var arrayIndexOf = __webpack_require__(30)(false);
-var IE_PROTO = __webpack_require__(21)('IE_PROTO');
-
-module.exports = function (object, names) {
- var O = toIObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- return result;
-};
-
-
-/***/ }),
-/* 60 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var toInteger = __webpack_require__(19);
-var max = Math.max;
-var min = Math.min;
-module.exports = function (index, length) {
- index = toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
-};
-
-
-/***/ }),
-/* 61 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var document = __webpack_require__(3).document;
-module.exports = document && document.documentElement;
-
-
-/***/ }),
-/* 62 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
-var has = __webpack_require__(11);
-var toObject = __webpack_require__(16);
-var IE_PROTO = __webpack_require__(21)('IE_PROTO');
-var ObjectProto = Object.prototype;
-
-module.exports = Object.getPrototypeOf || function (O) {
- O = toObject(O);
- if (has(O, IE_PROTO)) return O[IE_PROTO];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- } return O instanceof Object ? ObjectProto : null;
-};
-
-
-/***/ }),
-/* 63 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-var ctx = __webpack_require__(14);
-var $export = __webpack_require__(6);
-var toObject = __webpack_require__(16);
-var call = __webpack_require__(64);
-var isArrayIter = __webpack_require__(65);
-var toLength = __webpack_require__(18);
-var createProperty = __webpack_require__(66);
-var getIterFn = __webpack_require__(67);
-
-$export($export.S + $export.F * !__webpack_require__(69)(function (iter) { Array.from(iter); }), 'Array', {
- // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
- from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = toObject(arrayLike);
- var C = typeof this == 'function' ? this : Array;
- var aLen = arguments.length;
- var mapfn = aLen > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var index = 0;
- var iterFn = getIterFn(O);
- var length, result, step, iterator;
- if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
- // if object isn't iterable or it's array with default iterator - use simple case
- if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
- for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
- createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
- }
- } else {
- length = toLength(O.length);
- for (result = new C(length); length > index; index++) {
- createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
- }
- }
- result.length = index;
- return result;
- }
-});
-
-
-/***/ }),
-/* 64 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// call something on iterator step with safe closing on error
-var anObject = __webpack_require__(8);
-module.exports = function (iterator, fn, value, entries) {
- try {
- return entries ? fn(anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch (e) {
- var ret = iterator['return'];
- if (ret !== undefined) anObject(ret.call(iterator));
- throw e;
- }
-};
-
-
-/***/ }),
-/* 65 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// check on default Array iterator
-var Iterators = __webpack_require__(20);
-var ITERATOR = __webpack_require__(0)('iterator');
-var ArrayProto = Array.prototype;
-
-module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
-};
-
-
-/***/ }),
-/* 66 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-var $defineProperty = __webpack_require__(7);
-var createDesc = __webpack_require__(12);
-
-module.exports = function (object, index, value) {
- if (index in object) $defineProperty.f(object, index, createDesc(0, value));
- else object[index] = value;
-};
-
-
-/***/ }),
-/* 67 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var classof = __webpack_require__(68);
-var ITERATOR = __webpack_require__(0)('iterator');
-var Iterators = __webpack_require__(20);
-module.exports = __webpack_require__(2).getIteratorMethod = function (it) {
- if (it != undefined) return it[ITERATOR]
- || it['@@iterator']
- || Iterators[classof(it)];
-};
-
-
-/***/ }),
-/* 68 */
-/***/ (function(module, exports, __webpack_require__) {
-
-// getting tag from 19.1.3.6 Object.prototype.toString()
-var cof = __webpack_require__(15);
-var TAG = __webpack_require__(0)('toStringTag');
-// ES3 wrong here
-var ARG = cof(function () { return arguments; }()) == 'Arguments';
-
-// fallback for IE11 Script Access Denied error
-var tryGet = function (it, key) {
- try {
- return it[key];
- } catch (e) { /* empty */ }
-};
-
-module.exports = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
- // builtinTag case
- : ARG ? cof(O)
- // ES3 arguments fallback
- : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
-};
-
-
-/***/ }),
-/* 69 */
-/***/ (function(module, exports, __webpack_require__) {
-
-var ITERATOR = __webpack_require__(0)('iterator');
-var SAFE_CLOSING = false;
-
-try {
- var riter = [7][ITERATOR]();
- riter['return'] = function () { SAFE_CLOSING = true; };
- // eslint-disable-next-line no-throw-literal
- Array.from(riter, function () { throw 2; });
-} catch (e) { /* empty */ }
-
-module.exports = function (exec, skipClosing) {
- if (!skipClosing && !SAFE_CLOSING) return false;
- var safe = false;
- try {
- var arr = [7];
- var iter = arr[ITERATOR]();
- iter.next = function () { return { done: safe = true }; };
- arr[ITERATOR] = function () { return iter; };
- exec(arr);
- } catch (e) { /* empty */ }
- return safe;
-};
-
-
-/***/ }),
-/* 70 */
-/***/ (function(module, exports, __webpack_require__) {
-
-__webpack_require__(71);
-module.exports = __webpack_require__(2).Array.includes;
-
-
-/***/ }),
-/* 71 */
-/***/ (function(module, exports, __webpack_require__) {
-
-"use strict";
-
-// https://github.com/tc39/Array.prototype.includes
-var $export = __webpack_require__(6);
-var $includes = __webpack_require__(30)(true);
-
-$export($export.P, 'Array', {
- includes: function includes(el /* , fromIndex = 0 */) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
-});
-
-__webpack_require__(28)('includes');
-
-
-/***/ }),
-/* 72 */
+/* 14 */
/***/ (function(module, exports) {
// Polyfill for creating CustomEvents on IE9/10/11
@@ -6061,7 +5084,7 @@ try {
/***/ }),
-/* 73 */
+/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6070,28 +5093,28 @@ try {
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+var _redux = __webpack_require__(6);
-var _redux = __webpack_require__(33);
-
-var _index = __webpack_require__(78);
-
-var _index2 = _interopRequireDefault(_index);
+var _index = _interopRequireDefault(__webpack_require__(17));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var Store = 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 Store =
+/*#__PURE__*/
+function () {
function Store() {
_classCallCheck(this, Store);
- this._store = (0, _redux.createStore)(_index2.default, window.devToolsExtension ? window.devToolsExtension() : undefined);
+ this._store = (0, _redux.createStore)(_index.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
}
-
/**
* Subscribe store to function call (wrapped Redux method)
* @param {Function} onChange Function to trigger when state changes
@@ -6100,11 +5123,10 @@ var Store = function () {
_createClass(Store, [{
- key: 'subscribe',
+ key: "subscribe",
value: function subscribe(onChange) {
this._store.subscribe(onChange);
}
-
/**
* Dispatch event to store (wrapped Redux method)
* @param {Function} action Action function to trigger
@@ -6112,19 +5134,17 @@ var Store = function () {
*/
}, {
- key: 'dispatch',
+ key: "dispatch",
value: function dispatch(action) {
this._store.dispatch(action);
}
-
/**
* Get store object (wrapping Redux method)
* @return {Object} State
*/
}, {
- key: 'isLoading',
-
+ key: "isLoading",
/**
* Get loading state from store
@@ -6133,14 +5153,13 @@ var Store = function () {
value: function isLoading() {
return this.state.general.loading;
}
-
/**
* Get single choice by it's ID
* @return {Object} Found choice
*/
}, {
- key: 'getChoiceById',
+ key: "getChoiceById",
value: function getChoiceById(id) {
if (id) {
var choices = this.activeChoices;
@@ -6149,9 +5168,9 @@ var Store = function () {
});
return foundChoice;
}
+
return false;
}
-
/**
* Get group by group id
* @param {Number} id Group ID
@@ -6159,143 +5178,131 @@ var Store = function () {
*/
}, {
- key: 'getGroupById',
+ key: "getGroupById",
value: function getGroupById(id) {
return this.groups.find(function (group) {
return group.id === parseInt(id, 10);
});
}
}, {
- key: 'state',
+ key: "state",
get: function get() {
return this._store.getState();
}
-
/**
* Get items from store
* @return {Array} Item objects
*/
}, {
- key: 'items',
+ key: "items",
get: function get() {
return this.state.items;
}
-
/**
* Get active items from store
* @return {Array} Item objects
*/
}, {
- key: 'activeItems',
+ key: "activeItems",
get: function get() {
return this.items.filter(function (item) {
return item.active === true;
});
}
-
/**
* Get highlighted items from store
* @return {Array} Item objects
*/
}, {
- key: 'highlightedActiveItems',
+ key: "highlightedActiveItems",
get: function get() {
return this.items.filter(function (item) {
return item.active && item.highlighted;
});
}
-
/**
* Get choices from store
* @return {Array} Option objects
*/
}, {
- key: 'choices',
+ key: "choices",
get: function get() {
return this.state.choices;
}
-
/**
* Get active choices from store
* @return {Array} Option objects
*/
}, {
- key: 'activeChoices',
+ key: "activeChoices",
get: function get() {
var choices = this.choices;
var values = choices.filter(function (choice) {
return choice.active === true;
});
-
return values;
}
-
/**
* Get selectable choices from store
* @return {Array} Option objects
*/
}, {
- key: 'selectableChoices',
+ key: "selectableChoices",
get: function get() {
return this.choices.filter(function (choice) {
return choice.disabled !== true;
});
}
-
/**
* Get choices that can be searched (excluding placeholders)
* @return {Array} Option objects
*/
}, {
- key: 'searchableChoices',
+ key: "searchableChoices",
get: function get() {
return this.selectableChoices.filter(function (choice) {
return choice.placeholder !== true;
});
}
-
/**
* Get placeholder choice from store
* @return {Object} Found placeholder
*/
}, {
- key: 'placeholderChoice',
+ key: "placeholderChoice",
get: function get() {
- return [].concat(_toConsumableArray(this.choices)).reverse().find(function (choice) {
+ return [].concat(this.choices).reverse().find(function (choice) {
return choice.placeholder === true;
});
}
-
/**
* Get groups from store
* @return {Array} Group objects
*/
}, {
- key: 'groups',
+ key: "groups",
get: function get() {
return this.state.groups;
}
-
/**
* Get active groups from store
* @return {Array} Group objects
*/
}, {
- key: 'activeGroups',
+ key: "activeGroups",
get: function get() {
var groups = this.groups;
var choices = this.choices;
-
return groups.filter(function (group) {
var isActive = group.active === true && group.disabled === false;
var hasActiveOptions = choices.some(function (choice) {
@@ -6312,54 +5319,14 @@ var Store = function () {
exports.default = Store;
/***/ }),
-/* 74 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
-var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
-
-/* harmony default export */ __webpack_exports__["a"] = (freeGlobal);
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(34)))
-
-/***/ }),
-/* 75 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ponyfill_js__ = __webpack_require__(77);
-/* global window */
-
-
-var root;
-
-if (typeof self !== 'undefined') {
- root = self;
-} else if (typeof window !== 'undefined') {
- root = window;
-} else if (typeof global !== 'undefined') {
- root = global;
-} else if (true) {
- root = module;
-} else {
- root = Function('return this')();
-}
-
-var result = Object(__WEBPACK_IMPORTED_MODULE_0__ponyfill_js__["a" /* default */])(root);
-/* harmony default export */ __webpack_exports__["a"] = (result);
-
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(34), __webpack_require__(76)(module)))
-
-/***/ }),
-/* 76 */
+/* 16 */
/***/ (function(module, exports) {
module.exports = function(originalModule) {
- if(!originalModule.webpackPolyfill) {
+ if (!originalModule.webpackPolyfill) {
var module = Object.create(originalModule);
// module.parent = undefined by default
- if(!module.children) module.children = [];
+ if (!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
@@ -6373,7 +5340,7 @@ module.exports = function(originalModule) {
}
});
Object.defineProperty(module, "exports", {
- enumerable: true,
+ enumerable: true
});
module.webpackPolyfill = 1;
}
@@ -6382,32 +5349,7 @@ module.exports = function(originalModule) {
/***/ }),
-/* 77 */
-/***/ (function(module, __webpack_exports__, __webpack_require__) {
-
-"use strict";
-/* harmony export (immutable) */ __webpack_exports__["a"] = symbolObservablePonyfill;
-function symbolObservablePonyfill(root) {
- var result;
- var Symbol = root.Symbol;
-
- if (typeof Symbol === 'function') {
- if (Symbol.observable) {
- result = Symbol.observable;
- } else {
- result = Symbol('observable');
- Symbol.observable = result;
- }
- } else {
- result = '@@observable';
- }
-
- return result;
-};
-
-
-/***/ }),
-/* 78 */
+/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6416,42 +5358,35 @@ function symbolObservablePonyfill(root) {
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _redux = __webpack_require__(33);
+var _redux = __webpack_require__(6);
-var _items = __webpack_require__(79);
+var _items = _interopRequireDefault(__webpack_require__(18));
-var _items2 = _interopRequireDefault(_items);
+var _groups = _interopRequireDefault(__webpack_require__(19));
-var _groups = __webpack_require__(80);
+var _choices = _interopRequireDefault(__webpack_require__(20));
-var _groups2 = _interopRequireDefault(_groups);
+var _general = _interopRequireDefault(__webpack_require__(21));
-var _choices = __webpack_require__(81);
-
-var _choices2 = _interopRequireDefault(_choices);
-
-var _general = __webpack_require__(82);
-
-var _general2 = _interopRequireDefault(_general);
-
-var _utils = __webpack_require__(1);
+var _utils = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var appReducer = (0, _redux.combineReducers)({
- items: _items2.default,
- groups: _groups2.default,
- choices: _choices2.default,
- general: _general2.default
+ items: _items.default,
+ groups: _groups.default,
+ choices: _choices.default,
+ general: _general.default
});
var rootReducer = function rootReducer(passedState, action) {
- var state = passedState;
- // If we are clearing all items, groups and options we reassign
+ var state = passedState; // If we are clearing all items, groups and options we reassign
// state and then pass that state to our proper reducer. This isn't
// mutating our actual state
// See: http://stackoverflow.com/a/35641992
+
if (action.type === 'CLEAR_ALL') {
state = undefined;
} else if (action.type === 'RESET_TO') {
@@ -6461,10 +5396,11 @@ var rootReducer = function rootReducer(passedState, action) {
return appReducer(state, action);
};
-exports.default = rootReducer;
+var _default = rootReducer;
+exports.default = _default;
/***/ }),
-/* 79 */
+/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6474,20 +5410,19 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = items;
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-var defaultState = exports.defaultState = [];
+exports.defaultState = void 0;
+var defaultState = [];
+exports.defaultState = defaultState;
function items() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
- var action = arguments[1];
+ var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'ADD_ITEM':
{
// Add object to items array
- var newState = [].concat(_toConsumableArray(state), [{
+ var newState = [].concat(state, [{
id: action.id,
choiceId: action.choiceId,
groupId: action.groupId,
@@ -6499,7 +5434,6 @@ function items() {
placeholder: action.placeholder || false,
keyCode: null
}]);
-
return newState.map(function (obj) {
var item = obj;
item.highlighted = false;
@@ -6512,9 +5446,11 @@ function items() {
// Set item to inactive
return state.map(function (obj) {
var item = obj;
+
if (item.id === action.id) {
item.active = false;
}
+
return item;
});
}
@@ -6523,9 +5459,11 @@ function items() {
{
return state.map(function (obj) {
var item = obj;
+
if (item.id === action.id) {
item.highlighted = action.highlighted;
}
+
return item;
});
}
@@ -6538,7 +5476,7 @@ function items() {
}
/***/ }),
-/* 80 */
+/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6548,19 +5486,18 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = groups;
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-var defaultState = exports.defaultState = [];
+exports.defaultState = void 0;
+var defaultState = [];
+exports.defaultState = defaultState;
function groups() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
- var action = arguments[1];
+ var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'ADD_GROUP':
{
- return [].concat(_toConsumableArray(state), [{
+ return [].concat(state, [{
id: action.id,
value: action.value,
active: action.active,
@@ -6581,7 +5518,7 @@ function groups() {
}
/***/ }),
-/* 81 */
+/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6591,14 +5528,13 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = choices;
-
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-var defaultState = exports.defaultState = [];
+exports.defaultState = void 0;
+var defaultState = [];
+exports.defaultState = defaultState;
function choices() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
- var action = arguments[1];
+ var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
case 'ADD_CHOICE':
@@ -6608,7 +5544,7 @@ function choices() {
A selected choice has been added to the passed input's value (added as an item)
An active choice appears within the choice dropdown
*/
- return [].concat(_toConsumableArray(state), [{
+ return [].concat(state, [{
id: action.id,
elementId: action.elementId,
groupId: action.groupId,
@@ -6633,16 +5569,18 @@ function choices() {
choice.active = action.active;
return choice;
});
- }
-
- // When an item is added and it has an associated choice,
+ } // When an item is added and it has an associated choice,
// we want to disable it so it can't be chosen again
+
+
if (action.choiceId > -1) {
return state.map(function (obj) {
var choice = obj;
+
if (choice.id === parseInt(action.choiceId, 10)) {
choice.selected = true;
}
+
return choice;
});
}
@@ -6657,9 +5595,11 @@ function choices() {
if (action.choiceId > -1) {
return state.map(function (obj) {
var choice = obj;
+
if (choice.id === parseInt(action.choiceId, 10)) {
choice.selected = false;
}
+
return choice;
});
}
@@ -6670,9 +5610,9 @@ function choices() {
case 'FILTER_CHOICES':
{
return state.map(function (obj) {
- var choice = obj;
- // Set active state based on whether choice is
+ var choice = obj; // Set active state based on whether choice is
// within filtered results
+
choice.active = action.results.some(function (_ref) {
var item = _ref.item,
score = _ref.score;
@@ -6681,9 +5621,9 @@ function choices() {
choice.score = score;
return true;
}
+
return false;
});
-
return choice;
});
}
@@ -6710,7 +5650,7 @@ function choices() {
}
/***/ }),
-/* 82 */
+/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6719,16 +5659,18 @@ function choices() {
Object.defineProperty(exports, "__esModule", {
value: true
});
-var defaultState = exports.defaultState = {
+exports.default = exports.defaultState = void 0;
+var defaultState = {
loading: false
};
+exports.defaultState = defaultState;
var general = function general() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
- var action = arguments[1];
+ var action = arguments.length > 1 ? arguments[1] : undefined;
switch (action.type) {
- case 'LOADING':
+ case 'SET_IS_LOADING':
{
return {
loading: action.isLoading
@@ -6742,10 +5684,11 @@ var general = function general() {
}
};
-exports.default = general;
+var _default = general;
+exports.default = _default;
/***/ }),
-/* 83 */
+/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6754,43 +5697,59 @@ exports.default = general;
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.WrappedSelect = exports.WrappedInput = exports.List = exports.Input = exports.Container = exports.Dropdown = undefined;
+Object.defineProperty(exports, "Dropdown", {
+ enumerable: true,
+ get: function get() {
+ return _dropdown.default;
+ }
+});
+Object.defineProperty(exports, "Container", {
+ enumerable: true,
+ get: function get() {
+ return _container.default;
+ }
+});
+Object.defineProperty(exports, "Input", {
+ enumerable: true,
+ get: function get() {
+ return _input.default;
+ }
+});
+Object.defineProperty(exports, "List", {
+ enumerable: true,
+ get: function get() {
+ return _list.default;
+ }
+});
+Object.defineProperty(exports, "WrappedInput", {
+ enumerable: true,
+ get: function get() {
+ return _wrappedInput.default;
+ }
+});
+Object.defineProperty(exports, "WrappedSelect", {
+ enumerable: true,
+ get: function get() {
+ return _wrappedSelect.default;
+ }
+});
-var _dropdown = __webpack_require__(84);
+var _dropdown = _interopRequireDefault(__webpack_require__(23));
-var _dropdown2 = _interopRequireDefault(_dropdown);
+var _container = _interopRequireDefault(__webpack_require__(24));
-var _container = __webpack_require__(85);
+var _input = _interopRequireDefault(__webpack_require__(25));
-var _container2 = _interopRequireDefault(_container);
+var _list = _interopRequireDefault(__webpack_require__(26));
-var _input = __webpack_require__(86);
+var _wrappedInput = _interopRequireDefault(__webpack_require__(27));
-var _input2 = _interopRequireDefault(_input);
-
-var _list = __webpack_require__(87);
-
-var _list2 = _interopRequireDefault(_list);
-
-var _wrappedInput = __webpack_require__(88);
-
-var _wrappedInput2 = _interopRequireDefault(_wrappedInput);
-
-var _wrappedSelect = __webpack_require__(89);
-
-var _wrappedSelect2 = _interopRequireDefault(_wrappedSelect);
+var _wrappedSelect = _interopRequireDefault(__webpack_require__(28));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-exports.Dropdown = _dropdown2.default;
-exports.Container = _container2.default;
-exports.Input = _input2.default;
-exports.List = _list2.default;
-exports.WrappedInput = _wrappedInput2.default;
-exports.WrappedSelect = _wrappedSelect2.default;
-
/***/ }),
-/* 84 */
+/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6799,12 +5758,17 @@ exports.WrappedSelect = _wrappedSelect2.default;
Object.defineProperty(exports, "__esModule", {
value: true
});
-
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+exports.default = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var Dropdown = 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 Dropdown =
+/*#__PURE__*/
+function () {
function Dropdown(_ref) {
var element = _ref.element,
type = _ref.type,
@@ -6812,11 +5776,13 @@ var Dropdown = function () {
_classCallCheck(this, Dropdown);
- Object.assign(this, { element: element, type: type, classNames: classNames });
-
+ Object.assign(this, {
+ element: element,
+ type: type,
+ classNames: classNames
+ });
this.isActive = false;
}
-
/**
* Determine how far the top of our element is from
* the top of the window
@@ -6825,24 +5791,22 @@ var Dropdown = function () {
_createClass(Dropdown, [{
- key: 'distanceFromTopWindow',
+ key: "distanceFromTopWindow",
value: function distanceFromTopWindow() {
this.dimensions = this.element.getBoundingClientRect();
this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);
return this.position;
}
-
/**
* Find element that matches passed selector
* @return {HTMLElement}
*/
}, {
- key: 'getChild',
+ key: "getChild",
value: function getChild(selector) {
return this.element.querySelector(selector);
}
-
/**
* Show dropdown to user by adding active state class
* @return {Object} Class instance
@@ -6850,14 +5814,13 @@ var Dropdown = function () {
*/
}, {
- key: 'show',
+ key: "show",
value: function show() {
this.element.classList.add(this.classNames.activeState);
this.element.setAttribute('aria-expanded', 'true');
this.isActive = true;
return this;
}
-
/**
* Hide dropdown from user
* @return {Object} Class instance
@@ -6865,7 +5828,7 @@ var Dropdown = function () {
*/
}, {
- key: 'hide',
+ key: "hide",
value: function hide() {
this.element.classList.remove(this.classNames.activeState);
this.element.setAttribute('aria-expanded', 'false');
@@ -6880,7 +5843,7 @@ var Dropdown = function () {
exports.default = Dropdown;
/***/ }),
-/* 85 */
+/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6889,14 +5852,19 @@ exports.default = Dropdown;
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _utils = __webpack_require__(1);
+var _utils = __webpack_require__(0);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var Container = 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 Container =
+/*#__PURE__*/
+function () {
function Container(_ref) {
var element = _ref.element,
type = _ref.type,
@@ -6905,30 +5873,31 @@ var Container = function () {
_classCallCheck(this, Container);
- Object.assign(this, { element: element, classNames: classNames, type: type, position: position });
-
+ Object.assign(this, {
+ element: element,
+ classNames: classNames,
+ type: type,
+ position: position
+ });
this.isOpen = false;
this.isFlipped = false;
this.isFocussed = false;
this.isDisabled = false;
this.isLoading = false;
-
this._onFocus = this._onFocus.bind(this);
this._onBlur = this._onBlur.bind(this);
}
-
/**
* Add event listeners
*/
_createClass(Container, [{
- key: 'addEventListeners',
+ key: "addEventListeners",
value: function addEventListeners() {
this.element.addEventListener('focus', this._onFocus);
this.element.addEventListener('blur', this._onBlur);
}
-
/**
* Remove event listeners
*/
@@ -6936,12 +5905,11 @@ var Container = function () {
/** */
}, {
- key: 'removeEventListeners',
+ key: "removeEventListeners",
value: function removeEventListeners() {
this.element.removeEventListener('focus', this._onFocus);
this.element.removeEventListener('blur', this._onBlur);
}
-
/**
* Determine whether container should be flipped
* based on passed dropdown position
@@ -6950,17 +5918,18 @@ var Container = function () {
*/
}, {
- key: 'shouldFlip',
+ key: "shouldFlip",
value: function shouldFlip(dropdownPos) {
var windowHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _utils.getWindowHeight)();
if (dropdownPos === undefined) {
return false;
- }
-
- // If flip is enabled and the dropdown bottom position is
+ } // If flip is enabled and the dropdown bottom position is
// greater than the window height flip the dropdown.
+
+
var shouldFlip = false;
+
if (this.position === 'auto') {
shouldFlip = dropdownPos >= windowHeight;
} else if (this.position === 'top') {
@@ -6969,29 +5938,27 @@ var Container = function () {
return shouldFlip;
}
-
/**
* Set active descendant attribute
* @param {Number} activeDescendant ID of active descendant
*/
}, {
- key: 'setActiveDescendant',
+ key: "setActiveDescendant",
value: function setActiveDescendant(activeDescendantID) {
this.element.setAttribute('aria-activedescendant', activeDescendantID);
}
-
/**
* Remove active descendant attribute
*/
}, {
- key: 'removeActiveDescendant',
+ key: "removeActiveDescendant",
value: function removeActiveDescendant() {
this.element.removeAttribute('aria-activedescendant');
}
}, {
- key: 'open',
+ key: "open",
value: function open(dropdownPos) {
this.element.classList.add(this.classNames.openState);
this.element.setAttribute('aria-expanded', 'true');
@@ -7003,120 +5970,117 @@ var Container = function () {
}
}
}, {
- key: 'close',
+ key: "close",
value: function close() {
this.element.classList.remove(this.classNames.openState);
this.element.setAttribute('aria-expanded', 'false');
this.removeActiveDescendant();
- this.isOpen = false;
+ this.isOpen = false; // A dropdown flips if it does not have space within the page
- // A dropdown flips if it does not have space within the page
if (this.isFlipped) {
this.element.classList.remove(this.classNames.flippedState);
this.isFlipped = false;
}
}
}, {
- key: 'focus',
+ key: "focus",
value: function focus() {
if (!this.isFocussed) {
this.element.focus();
}
}
}, {
- key: 'addFocusState',
+ key: "addFocusState",
value: function addFocusState() {
this.element.classList.add(this.classNames.focusState);
}
}, {
- key: 'removeFocusState',
+ key: "removeFocusState",
value: function removeFocusState() {
this.element.classList.remove(this.classNames.focusState);
}
-
/**
* Remove disabled state
*/
}, {
- key: 'enable',
+ key: "enable",
value: function enable() {
this.element.classList.remove(this.classNames.disabledState);
this.element.removeAttribute('aria-disabled');
+
if (this.type === 'select-one') {
this.element.setAttribute('tabindex', '0');
}
+
this.isDisabled = false;
}
-
/**
* Set disabled state
*/
}, {
- key: 'disable',
+ key: "disable",
value: function disable() {
this.element.classList.add(this.classNames.disabledState);
this.element.setAttribute('aria-disabled', 'true');
+
if (this.type === 'select-one') {
this.element.setAttribute('tabindex', '-1');
}
+
this.isDisabled = true;
}
}, {
- key: 'wrap',
+ key: "wrap",
value: function wrap(element) {
(0, _utils.wrap)(element, this.element);
}
}, {
- key: 'unwrap',
+ key: "unwrap",
value: function unwrap(element) {
// Move passed element outside this element
- this.element.parentNode.insertBefore(element, this.element);
- // Remove this element
+ this.element.parentNode.insertBefore(element, this.element); // Remove this element
+
this.element.parentNode.removeChild(this.element);
}
-
/**
* Add loading state to element
*/
}, {
- key: 'addLoadingState',
+ key: "addLoadingState",
value: function addLoadingState() {
this.element.classList.add(this.classNames.loadingState);
this.element.setAttribute('aria-busy', 'true');
this.isLoading = true;
}
-
/**
* Remove loading state from element
*/
}, {
- key: 'removeLoadingState',
+ key: "removeLoadingState",
value: function removeLoadingState() {
this.element.classList.remove(this.classNames.loadingState);
this.element.removeAttribute('aria-busy');
this.isLoading = false;
}
-
/**
* Set focussed state
*/
}, {
- key: '_onFocus',
+ key: "_onFocus",
value: function _onFocus() {
this.isFocussed = true;
}
-
/**
* Remove blurred state
*/
}, {
- key: '_onBlur',
+ key: "_onBlur",
value: function _onBlur() {
this.isFocussed = false;
}
@@ -7128,7 +6092,7 @@ var Container = function () {
exports.default = Container;
/***/ }),
-/* 86 */
+/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7137,14 +6101,19 @@ exports.default = Container;
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _utils = __webpack_require__(1);
+var _utils = __webpack_require__(0);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var Input = 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 Input =
+/*#__PURE__*/
+function () {
function Input(_ref) {
var element = _ref.element,
type = _ref.type,
@@ -7153,14 +6122,17 @@ var Input = function () {
_classCallCheck(this, Input);
- Object.assign(this, { element: element, type: type, classNames: classNames, placeholderValue: placeholderValue });
-
+ Object.assign(this, {
+ element: element,
+ type: type,
+ classNames: classNames,
+ placeholderValue: placeholderValue
+ });
this.element = element;
this.classNames = classNames;
this.isFocussed = this.element === document.activeElement;
- this.isDisabled = false;
+ this.isDisabled = false; // Bind event listeners
- // Bind event listeners
this._onPaste = this._onPaste.bind(this);
this._onInput = this._onInput.bind(this);
this._onFocus = this._onFocus.bind(this);
@@ -7168,7 +6140,7 @@ var Input = function () {
}
_createClass(Input, [{
- key: 'addEventListeners',
+ key: "addEventListeners",
value: function addEventListeners() {
this.element.addEventListener('input', this._onInput);
this.element.addEventListener('paste', this._onPaste);
@@ -7180,7 +6152,7 @@ var Input = function () {
}
}
}, {
- key: 'removeEventListeners',
+ key: "removeEventListeners",
value: function removeEventListeners() {
this.element.removeEventListener('input', this._onInput);
this.element.removeEventListener('paste', this._onPaste);
@@ -7192,32 +6164,31 @@ var Input = function () {
}
}
}, {
- key: 'enable',
+ key: "enable",
value: function enable() {
this.element.removeAttribute('disabled');
this.isDisabled = false;
}
}, {
- key: 'disable',
+ key: "disable",
value: function disable() {
this.element.setAttribute('disabled', '');
this.isDisabled = true;
}
}, {
- key: 'focus',
+ key: "focus",
value: function focus() {
if (!this.isFocussed) {
this.element.focus();
}
}
}, {
- key: 'blur',
+ key: "blur",
value: function blur() {
if (this.isFocussed) {
this.element.blur();
}
}
-
/**
* Set value of input to blank
* @return {Object} Class instance
@@ -7225,7 +6196,7 @@ var Input = function () {
*/
}, {
- key: 'clear',
+ key: "clear",
value: function clear() {
var setWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
@@ -7239,7 +6210,6 @@ var Input = function () {
return this;
}
-
/**
* Set the correct input width based on placeholder
* value or input value
@@ -7247,7 +6217,7 @@ var Input = function () {
*/
}, {
- key: 'setWidth',
+ key: "setWidth",
value: function setWidth(enforceWidth) {
var _this = this;
@@ -7269,56 +6239,55 @@ var Input = function () {
}
}
}, {
- key: 'calcWidth',
+ key: "calcWidth",
value: function calcWidth(callback) {
return (0, _utils.calcWidthOfInput)(this.element, callback);
}
}, {
- key: 'setActiveDescendant',
+ key: "setActiveDescendant",
value: function setActiveDescendant(activeDescendantID) {
this.element.setAttribute('aria-activedescendant', activeDescendantID);
}
}, {
- key: 'removeActiveDescendant',
+ key: "removeActiveDescendant",
value: function removeActiveDescendant() {
this.element.removeAttribute('aria-activedescendant');
}
}, {
- key: '_onInput',
+ key: "_onInput",
value: function _onInput() {
if (this.type !== 'select-one') {
this.setWidth();
}
}
}, {
- key: '_onPaste',
+ key: "_onPaste",
value: function _onPaste(event) {
- var target = event.target;
- // Disable pasting into the input if option has been set
+ var target = event.target; // Disable pasting into the input if option has been set
if (target === this.element && this.preventPaste) {
event.preventDefault();
}
}
}, {
- key: '_onFocus',
+ key: "_onFocus",
value: function _onFocus() {
this.isFocussed = true;
}
}, {
- key: '_onBlur',
+ key: "_onBlur",
value: function _onBlur() {
this.isFocussed = false;
}
}, {
- key: 'placeholder',
+ key: "placeholder",
set: function set(placeholder) {
this.element.placeholder = placeholder;
}
}, {
- key: 'value',
+ key: "value",
set: function set(value) {
- this.element.value = '' + value;
+ this.element.value = "".concat(value);
},
get: function get() {
return (0, _utils.stripHTML)(this.element.value);
@@ -7331,7 +6300,7 @@ var Input = function () {
exports.default = Input;
/***/ }),
-/* 87 */
+/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7340,48 +6309,54 @@ exports.default = Input;
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var _constants = __webpack_require__(5);
+var _constants = __webpack_require__(1);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-var List = 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 List =
+/*#__PURE__*/
+function () {
function List(_ref) {
var element = _ref.element;
_classCallCheck(this, List);
- Object.assign(this, { element: element });
-
+ Object.assign(this, {
+ element: element
+ });
this.scrollPos = this.element.scrollTop;
this.height = this.element.offsetHeight;
this.hasChildren = !!this.element.children;
}
_createClass(List, [{
- key: 'clear',
+ key: "clear",
value: function clear() {
this.element.innerHTML = '';
}
}, {
- key: 'append',
+ key: "append",
value: function append(node) {
this.element.appendChild(node);
}
}, {
- key: 'getChild',
+ key: "getChild",
value: function getChild(selector) {
return this.element.querySelector(selector);
}
}, {
- key: 'scrollToTop',
+ key: "scrollToTop",
value: function scrollToTop() {
this.element.scrollTop = 0;
}
}, {
- key: 'scrollToChoice',
+ key: "scrollToChoice",
value: function scrollToChoice(choice, direction) {
var _this = this;
@@ -7390,36 +6365,33 @@ var List = function () {
}
var dropdownHeight = this.element.offsetHeight;
- var choiceHeight = choice.offsetHeight;
- // Distance from bottom of element to top of parent
- var choicePos = choice.offsetTop + choiceHeight;
- // Scroll position of dropdown
- var containerScrollPos = this.element.scrollTop + dropdownHeight;
- // Difference between the choice and scroll position
- var endpoint = direction > 0 ? this.element.scrollTop + choicePos - containerScrollPos : choice.offsetTop;
+ var choiceHeight = choice.offsetHeight; // Distance from bottom of element to top of parent
+ var choicePos = choice.offsetTop + choiceHeight; // Scroll position of dropdown
+
+ var containerScrollPos = this.element.scrollTop + dropdownHeight; // Difference between the choice and scroll position
+
+ var endpoint = direction > 0 ? this.element.scrollTop + choicePos - containerScrollPos : choice.offsetTop;
requestAnimationFrame(function (time) {
_this._animateScroll(time, endpoint, direction);
});
}
}, {
- key: '_scrollDown',
+ key: "_scrollDown",
value: function _scrollDown(scrollPos, strength, endpoint) {
var easing = (endpoint - scrollPos) / strength;
var distance = easing > 1 ? easing : 1;
-
this.element.scrollTop = scrollPos + distance;
}
}, {
- key: '_scrollUp',
+ key: "_scrollUp",
value: function _scrollUp(scrollPos, strength, endpoint) {
var easing = (scrollPos - endpoint) / strength;
var distance = easing > 1 ? easing : 1;
-
this.element.scrollTop = scrollPos - distance;
}
}, {
- key: '_animateScroll',
+ key: "_animateScroll",
value: function _animateScroll(time, endpoint, direction) {
var _this2 = this;
@@ -7455,7 +6427,7 @@ var List = function () {
exports.default = List;
/***/ }),
-/* 88 */
+/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7464,65 +6436,79 @@ exports.default = List;
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+var _wrappedElement = _interopRequireDefault(__webpack_require__(4));
-var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
-
-var _wrappedElement = __webpack_require__(35);
-
-var _wrappedElement2 = _interopRequireDefault(_wrappedElement);
-
-var _utils = __webpack_require__(1);
+var _utils = __webpack_require__(0);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-var WrappedInput = function (_WrappedElement) {
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
+
+function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+var WrappedInput =
+/*#__PURE__*/
+function (_WrappedElement) {
_inherits(WrappedInput, _WrappedElement);
function WrappedInput(_ref) {
+ var _this;
+
var element = _ref.element,
classNames = _ref.classNames,
delimiter = _ref.delimiter;
_classCallCheck(this, WrappedInput);
- var _this = _possibleConstructorReturn(this, (WrappedInput.__proto__ || Object.getPrototypeOf(WrappedInput)).call(this, { element: element, classNames: classNames }));
-
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(WrappedInput).call(this, {
+ element: element,
+ classNames: classNames
+ }));
_this.delimiter = delimiter;
return _this;
}
_createClass(WrappedInput, [{
- key: 'value',
+ key: "value",
set: function set(items) {
var itemsFiltered = (0, _utils.reduceToValues)(items);
var itemsFilteredString = itemsFiltered.join(this.delimiter);
-
this.element.setAttribute('value', itemsFilteredString);
this.element.value = itemsFilteredString;
- }
-
- // @todo figure out why we need this? Perhaps a babel issue
+ } // @todo figure out why we need this? Perhaps a babel issue
,
get: function get() {
- return _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'value', this);
+ return _get(_getPrototypeOf(WrappedInput.prototype), "value", this);
}
}]);
return WrappedInput;
-}(_wrappedElement2.default);
+}(_wrappedElement.default);
exports.default = WrappedInput;
/***/ }),
-/* 89 */
+/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7531,26 +6517,35 @@ exports.default = WrappedInput;
Object.defineProperty(exports, "__esModule", {
value: true
});
+exports.default = void 0;
-var _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+var _wrappedElement = _interopRequireDefault(__webpack_require__(4));
-var _wrappedElement = __webpack_require__(35);
-
-var _wrappedElement2 = _interopRequireDefault(_wrappedElement);
-
-var _templates = __webpack_require__(36);
-
-var _templates2 = _interopRequireDefault(_templates);
+var _templates = _interopRequireDefault(__webpack_require__(5));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+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 _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+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 _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
-var WrappedSelect = function (_WrappedElement) {
+function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
+
+function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
+
+function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
+
+function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
+
+var WrappedSelect =
+/*#__PURE__*/
+function (_WrappedElement) {
_inherits(WrappedSelect, _WrappedElement);
function WrappedSelect(_ref) {
@@ -7559,59 +6554,63 @@ var WrappedSelect = function (_WrappedElement) {
_classCallCheck(this, WrappedSelect);
- return _possibleConstructorReturn(this, (WrappedSelect.__proto__ || Object.getPrototypeOf(WrappedSelect)).call(this, { element: element, classNames: classNames }));
+ return _possibleConstructorReturn(this, _getPrototypeOf(WrappedSelect).call(this, {
+ element: element,
+ classNames: classNames
+ }));
}
_createClass(WrappedSelect, [{
- key: 'appendDocFragment',
+ key: "appendDocFragment",
value: function appendDocFragment(fragment) {
this.element.innerHTML = '';
this.element.appendChild(fragment);
}
}, {
- key: 'placeholderOption',
+ key: "placeholderOption",
get: function get() {
return this.element.querySelector('option[placeholder]');
}
}, {
- key: 'optionGroups',
+ key: "optionGroups",
get: function get() {
return Array.from(this.element.getElementsByTagName('OPTGROUP'));
}
}, {
- key: 'options',
+ key: "options",
get: function get() {
return Array.from(this.element.options);
},
set: function set(options) {
var fragment = document.createDocumentFragment();
+
var addOptionToFragment = function addOptionToFragment(data) {
// Create a standard select option
- var template = _templates2.default.option(data);
- // Append it to fragment
- fragment.appendChild(template);
- };
+ var template = _templates.default.option(data); // Append it to fragment
+
+
+ fragment.appendChild(template);
+ }; // Add each list item to list
+
- // Add each list item to list
options.forEach(function (optionData) {
return addOptionToFragment(optionData);
});
-
this.appendDocFragment(fragment);
}
}]);
return WrappedSelect;
-}(_wrappedElement2.default);
+}(_wrappedElement.default);
exports.default = WrappedSelect;
/***/ }),
-/* 90 */
+/* 29 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2016 Jed Watson.
+ Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
@@ -7633,8 +6632,11 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
if (argType === 'string' || argType === 'number') {
classes.push(arg);
- } else if (Array.isArray(arg)) {
- classes.push(classNames.apply(null, arg));
+ } else if (Array.isArray(arg) && arg.length) {
+ var inner = classNames.apply(null, arg);
+ if (inner) {
+ classes.push(inner);
+ }
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
@@ -7647,7 +6649,8 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
return classes.join(' ');
}
- if (typeof module !== 'undefined' && module.exports) {
+ if ( true && module.exports) {
+ classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
@@ -7655,14 +6658,12 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {
- window.classNames = classNames;
- }
+ } else {}
}());
/***/ }),
-/* 91 */
+/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7671,11 +6672,11 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = undefined;
+exports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = void 0;
-var _constants = __webpack_require__(5);
+var _constants = __webpack_require__(1);
-var addChoice = exports.addChoice = function addChoice(_ref) {
+var addChoice = function addChoice(_ref) {
var value = _ref.value,
label = _ref.label,
id = _ref.id,
@@ -7699,14 +6700,18 @@ var addChoice = exports.addChoice = function addChoice(_ref) {
};
};
-var filterChoices = exports.filterChoices = function filterChoices(results) {
+exports.addChoice = addChoice;
+
+var filterChoices = function filterChoices(results) {
return {
type: _constants.ACTION_TYPES.FILTER_CHOICES,
results: results
};
};
-var activateChoices = exports.activateChoices = function activateChoices() {
+exports.filterChoices = filterChoices;
+
+var activateChoices = function activateChoices() {
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
return {
type: _constants.ACTION_TYPES.ACTIVATE_CHOICES,
@@ -7714,14 +6719,18 @@ var activateChoices = exports.activateChoices = function activateChoices() {
};
};
-var clearChoices = exports.clearChoices = function clearChoices() {
+exports.activateChoices = activateChoices;
+
+var clearChoices = function clearChoices() {
return {
type: _constants.ACTION_TYPES.CLEAR_CHOICES
};
};
+exports.clearChoices = clearChoices;
+
/***/ }),
-/* 92 */
+/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7730,11 +6739,11 @@ var clearChoices = exports.clearChoices = function clearChoices() {
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.highlightItem = exports.removeItem = exports.addItem = undefined;
+exports.highlightItem = exports.removeItem = exports.addItem = void 0;
-var _constants = __webpack_require__(5);
+var _constants = __webpack_require__(1);
-var addItem = exports.addItem = function addItem(_ref) {
+var addItem = function addItem(_ref) {
var value = _ref.value,
label = _ref.label,
id = _ref.id,
@@ -7756,7 +6765,9 @@ var addItem = exports.addItem = function addItem(_ref) {
};
};
-var removeItem = exports.removeItem = function removeItem(id, choiceId) {
+exports.addItem = addItem;
+
+var removeItem = function removeItem(id, choiceId) {
return {
type: _constants.ACTION_TYPES.REMOVE_ITEM,
id: id,
@@ -7764,7 +6775,9 @@ var removeItem = exports.removeItem = function removeItem(id, choiceId) {
};
};
-var highlightItem = exports.highlightItem = function highlightItem(id, highlighted) {
+exports.removeItem = removeItem;
+
+var highlightItem = function highlightItem(id, highlighted) {
return {
type: _constants.ACTION_TYPES.HIGHLIGHT_ITEM,
id: id,
@@ -7772,8 +6785,10 @@ var highlightItem = exports.highlightItem = function highlightItem(id, highlight
};
};
+exports.highlightItem = highlightItem;
+
/***/ }),
-/* 93 */
+/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7782,12 +6797,12 @@ var highlightItem = exports.highlightItem = function highlightItem(id, highlight
Object.defineProperty(exports, "__esModule", {
value: true
});
-exports.addGroup = undefined;
+exports.addGroup = void 0;
-var _constants = __webpack_require__(5);
+var _constants = __webpack_require__(1);
/* eslint-disable import/prefer-default-export */
-var addGroup = exports.addGroup = function addGroup(value, id, active, disabled) {
+var addGroup = function addGroup(value, id, active, disabled) {
return {
type: _constants.ACTION_TYPES.ADD_GROUP,
value: value,
@@ -7797,8 +6812,10 @@ var addGroup = exports.addGroup = function addGroup(value, id, active, disabled)
};
};
+exports.addGroup = addGroup;
+
/***/ }),
-/* 94 */
+/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7807,21 +6824,27 @@ var addGroup = exports.addGroup = function addGroup(value, id, active, disabled)
Object.defineProperty(exports, "__esModule", {
value: true
});
-var clearAll = exports.clearAll = function clearAll() {
+exports.resetTo = exports.clearAll = void 0;
+
+var clearAll = function clearAll() {
return {
type: 'CLEAR_ALL'
};
};
-var resetTo = exports.resetTo = function resetTo(state) {
+exports.clearAll = clearAll;
+
+var resetTo = function resetTo(state) {
return {
type: 'RESET_TO',
state: state
};
};
+exports.resetTo = resetTo;
+
/***/ }),
-/* 95 */
+/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -7830,16 +6853,18 @@ var resetTo = exports.resetTo = function resetTo(state) {
Object.defineProperty(exports, "__esModule", {
value: true
});
-/* eslint-disable import/prefer-default-export */
+exports.setIsLoading = void 0;
-var setIsLoading = exports.setIsLoading = function setIsLoading(isLoading) {
+/* eslint-disable import/prefer-default-export */
+var setIsLoading = function setIsLoading(isLoading) {
return {
- type: 'LOADING',
+ type: 'SET_IS_LOADING',
isLoading: isLoading
};
};
+exports.setIsLoading = setIsLoading;
+
/***/ })
/******/ ]);
-});
-//# sourceMappingURL=choices.js.map
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/public/assets/scripts/choices.js.map b/public/assets/scripts/choices.js.map
deleted file mode 100644
index d4f8fc4..0000000
--- a/public/assets/scripts/choices.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"file":"choices.js","sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 3d3e2c50c165f0a86fe1","webpack:///./node_modules/core-js/modules/_wks.js","webpack:///src/scripts/lib/utils.js","webpack:///./node_modules/core-js/modules/_core.js","webpack:///./node_modules/core-js/modules/_global.js","webpack:///./node_modules/core-js/modules/_hide.js","webpack:///src/scripts/constants.js","webpack:///./node_modules/core-js/modules/_export.js","webpack:///./node_modules/core-js/modules/_object-dp.js","webpack:///./node_modules/core-js/modules/_an-object.js","webpack:///./node_modules/core-js/modules/_is-object.js","webpack:///./node_modules/core-js/modules/_descriptors.js","webpack:///./node_modules/core-js/modules/_has.js","webpack:///./node_modules/core-js/modules/_property-desc.js","webpack:///./node_modules/core-js/modules/_uid.js","webpack:///./node_modules/core-js/modules/_ctx.js","webpack:///./node_modules/core-js/modules/_cof.js","webpack:///./node_modules/core-js/modules/_to-object.js","webpack:///./node_modules/core-js/modules/_defined.js","webpack:///./node_modules/core-js/modules/_to-length.js","webpack:///./node_modules/core-js/modules/_to-integer.js","webpack:///./node_modules/core-js/modules/_iterators.js","webpack:///./node_modules/core-js/modules/_shared-key.js","webpack:///./node_modules/core-js/modules/_fails.js","webpack:///./node_modules/core-js/modules/_dom-create.js","webpack:///./node_modules/core-js/modules/_redefine.js","webpack:///./node_modules/core-js/modules/_iobject.js","webpack:///./node_modules/core-js/modules/_shared.js","webpack:///./node_modules/core-js/modules/_library.js","webpack:///./node_modules/core-js/modules/_add-to-unscopables.js","webpack:///./node_modules/core-js/modules/_to-iobject.js","webpack:///./node_modules/core-js/modules/_array-includes.js","webpack:///./node_modules/core-js/modules/_enum-bug-keys.js","webpack:///./node_modules/core-js/modules/_set-to-string-tag.js","webpack:///./node_modules/lodash-es/_root.js","webpack:///./node_modules/lodash-es/_Symbol.js","webpack:///./node_modules/lodash-es/_getRawTag.js","webpack:///./node_modules/lodash-es/_objectToString.js","webpack:///./node_modules/lodash-es/_baseGetTag.js","webpack:///./node_modules/lodash-es/_overArg.js","webpack:///./node_modules/lodash-es/_getPrototype.js","webpack:///./node_modules/lodash-es/isObjectLike.js","webpack:///./node_modules/lodash-es/isPlainObject.js","webpack:///./node_modules/redux/es/createStore.js","webpack:///./node_modules/redux/es/utils/warning.js","webpack:///./node_modules/redux/es/combineReducers.js","webpack:///./node_modules/redux/es/bindActionCreators.js","webpack:///./node_modules/redux/es/compose.js","webpack:///./node_modules/redux/es/applyMiddleware.js","webpack:///./node_modules/redux/es/index.js","webpack:///(webpack)/buildin/global.js","webpack:///src/scripts/components/wrapped-element.js","webpack:///src/scripts/templates.js","webpack:///src/scripts/choices.js","webpack:///./node_modules/fuse.js/dist/fuse.js","webpack:///./node_modules/deepmerge/dist/es.js","webpack:///src/scripts/lib/polyfills.js","webpack:///./node_modules/core-js/fn/array/find.js","webpack:///./node_modules/core-js/modules/es6.array.find.js","webpack:///./node_modules/core-js/modules/_ie8-dom-define.js","webpack:///./node_modules/core-js/modules/_to-primitive.js","webpack:///./node_modules/core-js/modules/_a-function.js","webpack:///./node_modules/core-js/modules/_array-methods.js","webpack:///./node_modules/core-js/modules/_array-species-create.js","webpack:///./node_modules/core-js/modules/_array-species-constructor.js","webpack:///./node_modules/core-js/modules/_is-array.js","webpack:///./node_modules/core-js/fn/array/from.js","webpack:///./node_modules/core-js/modules/es6.string.iterator.js","webpack:///./node_modules/core-js/modules/_string-at.js","webpack:///./node_modules/core-js/modules/_iter-define.js","webpack:///./node_modules/core-js/modules/_iter-create.js","webpack:///./node_modules/core-js/modules/_object-create.js","webpack:///./node_modules/core-js/modules/_object-dps.js","webpack:///./node_modules/core-js/modules/_object-keys.js","webpack:///./node_modules/core-js/modules/_object-keys-internal.js","webpack:///./node_modules/core-js/modules/_to-absolute-index.js","webpack:///./node_modules/core-js/modules/_html.js","webpack:///./node_modules/core-js/modules/_object-gpo.js","webpack:///./node_modules/core-js/modules/es6.array.from.js","webpack:///./node_modules/core-js/modules/_iter-call.js","webpack:///./node_modules/core-js/modules/_is-array-iter.js","webpack:///./node_modules/core-js/modules/_create-property.js","webpack:///./node_modules/core-js/modules/core.get-iterator-method.js","webpack:///./node_modules/core-js/modules/_classof.js","webpack:///./node_modules/core-js/modules/_iter-detect.js","webpack:///./node_modules/core-js/fn/array/includes.js","webpack:///./node_modules/core-js/modules/es7.array.includes.js","webpack:///./node_modules/custom-event-polyfill/custom-event-polyfill.js","webpack:///src/scripts/store/store.js","webpack:///./node_modules/lodash-es/_freeGlobal.js","webpack:///./node_modules/symbol-observable/es/index.js","webpack:///(webpack)/buildin/harmony-module.js","webpack:///./node_modules/symbol-observable/es/ponyfill.js","webpack:///src/scripts/reducers/index.js","webpack:///src/scripts/reducers/items.js","webpack:///src/scripts/reducers/groups.js","webpack:///src/scripts/reducers/choices.js","webpack:///src/scripts/components/index.js","webpack:///src/scripts/components/dropdown.js","webpack:///src/scripts/components/container.js","webpack:///src/scripts/components/input.js","webpack:///src/scripts/components/list.js","webpack:///src/scripts/components/wrapped-input.js","webpack:///src/scripts/components/wrapped-select.js","webpack:///./node_modules/classnames/index.js","webpack:///src/scripts/actions/choices.js","webpack:///src/scripts/actions/items.js","webpack:///src/scripts/actions/groups.js","webpack:///src/scripts/actions/misc.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n //CommonJS2\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n //AMD\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n //CommonJS\n\telse if(typeof exports === 'object')\n\t\texports[\"Choices\"] = factory();\n //Window\n\telse\n\t\troot[\"Choices\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/public/assets/scripts/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 37);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 3d3e2c50c165f0a86fe1","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_wks.js\n// module id = 0\n// module chunks = 0","/* eslint-disable */\n\nexport const getRandomNumber = function(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n};\n\nexport const generateChars = function(length) {\n let chars = '';\n\n for (let i = 0; i < length; i++) {\n const randomChar = getRandomNumber(0, 36);\n chars += randomChar.toString(36);\n }\n\n return chars;\n};\n\nexport const generateId = function(element, prefix) {\n let id =\n element.id ||\n (element.name && `${element.name}-${generateChars(2)}`) ||\n generateChars(4);\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = `${prefix}-${id}`;\n\n return id;\n};\n\nexport const getType = function(obj) {\n return Object.prototype.toString.call(obj).slice(8, -1);\n};\n\nexport const isType = function(type, obj) {\n const clas = getType(obj);\n return obj !== undefined && obj !== null && clas === type;\n};\n\nexport const isElement = (element) => {\n return element instanceof Element;\n};\n\nexport const extend = function() {\n const extended = {};\n const length = arguments.length;\n\n /**\n * Merge one object into another\n * @param {Object} obj Object to merge into extended object\n */\n const merge = function(obj) {\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n // If deep merge and property is an object, merge properties\n if (isType('Object', obj[prop])) {\n extended[prop] = extend(true, extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each passed argument\n for (let i = 0; i < length; i++) {\n // store argument at position i\n const obj = arguments[i];\n\n // If we are in fact dealing with an object, merge it.\n if (isType('Object', obj)) {\n merge(obj);\n }\n }\n\n return extended;\n};\n\nexport const wrap = function(element, wrapper) {\n wrapper = wrapper || document.createElement('div');\n if (element.nextSibling) {\n element.parentNode.insertBefore(wrapper, element.nextSibling);\n } else {\n element.parentNode.appendChild(wrapper);\n }\n return wrapper.appendChild(element);\n};\n\nexport const findAncestor = function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n};\n\nexport const findAncestorByAttrName = function(el, attr) {\n let target = el;\n\n while (target) {\n if (target.hasAttribute(attr)) {\n return target;\n }\n\n target = target.parentElement;\n }\n\n return null;\n};\n\nexport const getAdjacentEl = (startEl, className, direction = 1) => {\n if (!startEl || !className) return;\n\n const parent = startEl.parentNode.parentNode;\n const children = Array.from(parent.querySelectorAll(className));\n\n const startPos = children.indexOf(startEl);\n const operatorDirection = direction > 0 ? 1 : -1;\n\n return children[startPos + operatorDirection];\n};\n\nexport const isScrolledIntoView = (el, parent, direction = 1) => {\n if (!el) return;\n\n let isVisible;\n\n if (direction > 0) {\n // In view from bottom\n isVisible =\n parent.scrollTop + parent.offsetHeight >= el.offsetTop + el.offsetHeight;\n } else {\n // In view from top\n isVisible = el.offsetTop >= parent.scrollTop;\n }\n\n return isVisible;\n};\n\nexport const stripHTML = html =>\n html\n .replace(/&/g, '&')\n .replace(/>/g, '&rt;')\n .replace(/ {\n const value = input.value || input.placeholder;\n let width = input.offsetWidth;\n\n if (value) {\n const testEl = strToEl(`${stripHTML(value)}`);\n testEl.style.position = 'absolute';\n testEl.style.padding = '0';\n testEl.style.top = '-9999px';\n testEl.style.left = '-9999px';\n testEl.style.width = 'auto';\n testEl.style.whiteSpace = 'pre';\n\n if (document.body.contains(input) && window.getComputedStyle) {\n const inputStyle = window.getComputedStyle(input);\n\n if (inputStyle) {\n testEl.style.fontSize = inputStyle.fontSize;\n testEl.style.fontFamily = inputStyle.fontFamily;\n testEl.style.fontWeight = inputStyle.fontWeight;\n testEl.style.fontStyle = inputStyle.fontStyle;\n testEl.style.letterSpacing = inputStyle.letterSpacing;\n testEl.style.textTransform = inputStyle.textTransform;\n testEl.style.padding = inputStyle.padding;\n }\n }\n\n document.body.appendChild(testEl);\n\n requestAnimationFrame(() => {\n if (value && testEl.offsetWidth !== input.offsetWidth) {\n width = testEl.offsetWidth + 4;\n }\n\n document.body.removeChild(testEl);\n\n callback.call(this, `${width}px`);\n });\n } else {\n callback.call(this, `${width}px`);\n }\n};\n\nexport const sortByAlpha = (a, b) => {\n const labelA = (a.label || a.value).toLowerCase();\n const labelB = (b.label || b.value).toLowerCase();\n\n if (labelA < labelB) {\n return -1;\n }\n\n if (labelA > labelB) {\n return 1;\n }\n\n return 0;\n};\n\nexport const sortByScore = (a, b) => a.score - b.score;\n\nexport const dispatchEvent = (element, type, customArgs = null) => {\n const event = new CustomEvent(type, {\n detail: customArgs,\n bubbles: true,\n cancelable: true,\n });\n\n return element.dispatchEvent(event);\n};\n\nexport const regexFilter = (value, regex) => {\n if (!value || !regex) {\n return false;\n }\n\n const expression = new RegExp(regex.source, 'i');\n return expression.test(value);\n};\n\nexport const getWindowHeight = () => {\n const body = document.body;\n const html = document.documentElement;\n return Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight,\n );\n};\n\nexport const reduceToValues = (items, key = 'value') => {\n const values = items.reduce((prev, current) => {\n prev.push(current[key]);\n return prev;\n }, []);\n\n return values;\n};\n\nexport const fetchFromObject = (object, path) => {\n const index = path.indexOf('.');\n\n if (index > -1) {\n return fetchFromObject(\n object[path.substring(0, index)],\n path.substr(index + 1),\n );\n }\n\n return object[path];\n};\n\nexport const isIE11 = () =>\n !!(\n navigator.userAgent.match(/Trident/) &&\n navigator.userAgent.match(/rv[ :]11/)\n );\n\nexport const existsInArray = (array, value, key = 'value') =>\n array.some(item => {\n if (isType('String', value)) {\n return item[key] === value.trim();\n }\n\n return item[key] === value;\n });\n\nexport const cloneObject = obj => JSON.parse(JSON.stringify(obj));\n\nexport const doKeysMatch = (a, b) => {\n const aKeys = Object.keys(a).sort();\n const bKeys = Object.keys(b).sort();\n return JSON.stringify(aKeys) === JSON.stringify(bKeys);\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/lib/utils.js","var core = module.exports = { version: '2.5.7' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_core.js\n// module id = 2\n// module chunks = 0","// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_global.js\n// module id = 3\n// module chunks = 0","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_hide.js\n// module id = 4\n// module chunks = 0","import { stripHTML, sortByAlpha } from './lib/utils';\n\nexport const DEFAULT_CLASSNAMES = {\n containerOuter: 'choices',\n containerInner: 'choices__inner',\n input: 'choices__input',\n inputCloned: 'choices__input--cloned',\n list: 'choices__list',\n listItems: 'choices__list--multiple',\n listSingle: 'choices__list--single',\n listDropdown: 'choices__list--dropdown',\n item: 'choices__item',\n itemSelectable: 'choices__item--selectable',\n itemDisabled: 'choices__item--disabled',\n itemChoice: 'choices__item--choice',\n placeholder: 'choices__placeholder',\n group: 'choices__group',\n groupHeading: 'choices__heading',\n button: 'choices__button',\n activeState: 'is-active',\n focusState: 'is-focused',\n openState: 'is-open',\n disabledState: 'is-disabled',\n highlightedState: 'is-highlighted',\n hiddenState: 'is-hidden',\n flippedState: 'is-flipped',\n loadingState: 'is-loading',\n noResults: 'has-no-results',\n noChoices: 'has-no-choices',\n};\n\nexport const DEFAULT_CONFIG = {\n items: [],\n choices: [],\n silent: false,\n renderChoiceLimit: -1,\n maxItemCount: -1,\n addItems: true,\n removeItems: true,\n removeItemButton: false,\n editItems: false,\n duplicateItemsAllowed: true,\n delimiter: ',',\n paste: true,\n searchEnabled: true,\n searchChoices: true,\n searchFloor: 1,\n searchResultLimit: 4,\n searchFields: ['label', 'value'],\n position: 'auto',\n resetScrollPosition: true,\n regexFilter: null,\n shouldSort: true,\n shouldSortItems: false,\n sortFn: sortByAlpha,\n placeholder: true,\n placeholderValue: null,\n searchPlaceholderValue: null,\n prependValue: null,\n appendValue: null,\n renderSelectedChoices: 'auto',\n loadingText: 'Loading...',\n noResultsText: 'No results found',\n noChoicesText: 'No choices to choose from',\n itemSelectText: 'Press to select',\n uniqueItemText: 'Only unique values can be added',\n addItemText: value => `Press Enter to add \"${stripHTML(value)}\"`,\n maxItemText: maxItemCount => `Only ${maxItemCount} values can be added`,\n itemComparer: (choice, item) => choice === item,\n fuseOptions: {\n includeScore: true,\n },\n callbackOnInit: null,\n callbackOnCreateTemplates: null,\n classNames: DEFAULT_CLASSNAMES,\n};\n\nexport const EVENTS = {\n showDropdown: 'showDropdown',\n hideDropdown: 'hideDropdown',\n change: 'change',\n choice: 'choice',\n search: 'search',\n addItem: 'addItem',\n removeItem: 'removeItem',\n highlightItem: 'highlightItem',\n highlightChoice: 'highlightChoice',\n};\n\nexport const ACTION_TYPES = {\n ADD_CHOICE: 'ADD_CHOICE',\n FILTER_CHOICES: 'FILTER_CHOICES',\n ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n CLEAR_CHOICES: 'CLEAR_CHOICES',\n ADD_GROUP: 'ADD_GROUP',\n ADD_ITEM: 'ADD_ITEM',\n REMOVE_ITEM: 'REMOVE_ITEM',\n HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n CLEAR_ALL: 'CLEAR_ALL',\n};\n\nexport const KEY_CODES = {\n BACK_KEY: 46,\n DELETE_KEY: 8,\n ENTER_KEY: 13,\n A_KEY: 65,\n ESC_KEY: 27,\n UP_KEY: 38,\n DOWN_KEY: 40,\n PAGE_UP_KEY: 33,\n PAGE_DOWN_KEY: 34,\n};\n\nexport const SCROLLING_SPEED = 4;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/constants.js","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_export.js\n// module id = 6\n// module chunks = 0","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_object-dp.js\n// module id = 7\n// module chunks = 0","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_an-object.js\n// module id = 8\n// module chunks = 0","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_is-object.js\n// module id = 9\n// module chunks = 0","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_descriptors.js\n// module id = 10\n// module chunks = 0","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_has.js\n// module id = 11\n// module chunks = 0","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_property-desc.js\n// module id = 12\n// module chunks = 0","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_uid.js\n// module id = 13\n// module chunks = 0","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_ctx.js\n// module id = 14\n// module chunks = 0","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_cof.js\n// module id = 15\n// module chunks = 0","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_to-object.js\n// module id = 16\n// module chunks = 0","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_defined.js\n// module id = 17\n// module chunks = 0","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_to-length.js\n// module id = 18\n// module chunks = 0","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_to-integer.js\n// module id = 19\n// module chunks = 0","module.exports = {};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_iterators.js\n// module id = 20\n// module chunks = 0","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_shared-key.js\n// module id = 21\n// module chunks = 0","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_fails.js\n// module id = 22\n// module chunks = 0","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_dom-create.js\n// module id = 23\n// module chunks = 0","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar TO_STRING = 'toString';\nvar $toString = Function[TO_STRING];\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_redefine.js\n// module id = 24\n// module chunks = 0","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_iobject.js\n// module id = 25\n// module chunks = 0","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2018 Denis Pushkarev (zloirock.ru)'\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_shared.js\n// module id = 26\n// module chunks = 0","module.exports = false;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_library.js\n// module id = 27\n// module chunks = 0","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_add-to-unscopables.js\n// module id = 28\n// module chunks = 0","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_to-iobject.js\n// module id = 29\n// module chunks = 0","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_array-includes.js\n// module id = 30\n// module chunks = 0","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_enum-bug-keys.js\n// module id = 31\n// module chunks = 0","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_set-to-string-tag.js\n// module id = 32\n// module chunks = 0","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_root.js\n// module id = null\n// module chunks = ","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_Symbol.js\n// module id = null\n// module chunks = ","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_getRawTag.js\n// module id = null\n// module chunks = ","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_objectToString.js\n// module id = null\n// module chunks = ","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_baseGetTag.js\n// module id = null\n// module chunks = ","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_overArg.js\n// module id = null\n// module chunks = ","import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_getPrototype.js\n// module id = null\n// module chunks = ","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/isObjectLike.js\n// module id = null\n// module chunks = ","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/isPlainObject.js\n// module id = null\n// module chunks = ","import isPlainObject from 'lodash-es/isPlainObject';\nimport $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nexport var ActionTypes = {\n INIT: '@@redux/INIT'\n\n /**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n};export default function createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n function getState() {\n return currentState;\n }\n\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected listener to be a function.');\n }\n\n var isSubscribed = true;\n\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n isSubscribed = false;\n\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n };\n }\n\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer;\n dispatch({ type: ActionTypes.INIT });\n }\n\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object') {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return { unsubscribe: unsubscribe };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n }\n\n // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n dispatch({ type: ActionTypes.INIT });\n\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/createStore.js\n// module id = null\n// module chunks = ","/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nexport default function warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n /* eslint-disable no-empty */\n } catch (e) {}\n /* eslint-enable no-empty */\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/utils/warning.js\n// module id = null\n// module chunks = ","import { ActionTypes } from './createStore';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport warning from './utils/warning';\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionName = actionType && '\"' + actionType.toString() + '\"' || 'an action';\n\n return 'Given action ' + actionName + ', reducer \"' + key + '\" returned undefined. ' + 'To ignore an action, you must explicitly return the previous state. ' + 'If you want this reducer to hold no value, you can return null instead of undefined.';\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return 'The ' + argumentName + ' has unexpected type of \"' + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + '\". Expected argument to be an object with the following ' + ('keys: \"' + reducerKeys.join('\", \"') + '\"');\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n\n if (unexpectedKeys.length > 0) {\n return 'Unexpected ' + (unexpectedKeys.length > 1 ? 'keys' : 'key') + ' ' + ('\"' + unexpectedKeys.join('\", \"') + '\" found in ' + argumentName + '. ') + 'Expected to find one of the known reducer keys instead: ' + ('\"' + reducerKeys.join('\", \"') + '\". Unexpected keys will be ignored.');\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, { type: ActionTypes.INIT });\n\n if (typeof initialState === 'undefined') {\n throw new Error('Reducer \"' + key + '\" returned undefined during initialization. ' + 'If the state passed to the reducer is undefined, you must ' + 'explicitly return the initial state. The initial state may ' + 'not be undefined. If you don\\'t want to set a value for this reducer, ' + 'you can use null instead of undefined.');\n }\n\n var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');\n if (typeof reducer(undefined, { type: type }) === 'undefined') {\n throw new Error('Reducer \"' + key + '\" returned undefined when probed with a random type. ' + ('Don\\'t try to handle ' + ActionTypes.INIT + ' or other actions in \"redux/*\" ') + 'namespace. They are considered private. Instead, you must return the ' + 'current state for any unknown actions, unless it is undefined, ' + 'in which case you must return the initial state, regardless of the ' + 'action type. The initial state may not be undefined, but can be null.');\n }\n });\n}\n\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\nexport default function combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning('No reducer provided for key \"' + key + '\"');\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n var finalReducerKeys = Object.keys(finalReducers);\n\n var unexpectedKeyCache = void 0;\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError = void 0;\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments[1];\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n return hasChanged ? nextState : state;\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/combineReducers.js\n// module id = null\n// module chunks = ","function bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(undefined, arguments));\n };\n}\n\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass a single function as the first argument,\n * and get a function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\nexport default function bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error('bindActionCreators expected an object or a function, instead received ' + (actionCreators === null ? 'null' : typeof actionCreators) + '. ' + 'Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?');\n }\n\n var keys = Object.keys(actionCreators);\n var boundActionCreators = {};\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var actionCreator = actionCreators[key];\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n return boundActionCreators;\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/bindActionCreators.js\n// module id = null\n// module chunks = ","/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\n\nexport default function compose() {\n for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(undefined, arguments));\n };\n });\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/compose.js\n// module id = null\n// module chunks = ","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nimport compose from './compose';\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\nexport default function applyMiddleware() {\n for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function (reducer, preloadedState, enhancer) {\n var store = createStore(reducer, preloadedState, enhancer);\n var _dispatch = store.dispatch;\n var chain = [];\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch(action) {\n return _dispatch(action);\n }\n };\n chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(undefined, chain)(store.dispatch);\n\n return _extends({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/applyMiddleware.js\n// module id = null\n// module chunks = ","import createStore from './createStore';\nimport combineReducers from './combineReducers';\nimport bindActionCreators from './bindActionCreators';\nimport applyMiddleware from './applyMiddleware';\nimport compose from './compose';\nimport warning from './utils/warning';\n\n/*\n* This is a dummy function to check if the function name has been altered by minification.\n* If the function has been minified and NODE_ENV !== 'production', warn the user.\n*/\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \\'production\\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { createStore, combineReducers, bindActionCreators, applyMiddleware, compose };\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/index.js\n// module id = null\n// module chunks = ","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\r\n} catch(e) {\r\n\t// This works if the window reference is available\r\n\tif(typeof window === \"object\")\r\n\t\tg = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 34\n// module chunks = 0","import { dispatchEvent, isElement } from '../lib/utils';\n\nexport default class WrappedElement {\n constructor({ element, classNames }) {\n Object.assign(this, { element, classNames });\n\n if (!isElement(element)) {\n throw new TypeError('Invalid element passed');\n }\n\n this.isDisabled = false;\n }\n\n get value() {\n return this.element.value;\n }\n\n conceal() {\n // Hide passed input\n this.element.classList.add(this.classNames.input);\n this.element.classList.add(this.classNames.hiddenState);\n\n // Remove element from tab index\n this.element.tabIndex = '-1';\n\n // Backup original styles if any\n const origStyle = this.element.getAttribute('style');\n\n if (origStyle) {\n this.element.setAttribute('data-choice-orig-style', origStyle);\n }\n\n this.element.setAttribute('aria-hidden', 'true');\n this.element.setAttribute('data-choice', 'active');\n }\n\n reveal() {\n // Reinstate passed element\n this.element.classList.remove(this.classNames.input);\n this.element.classList.remove(this.classNames.hiddenState);\n this.element.removeAttribute('tabindex');\n\n // Recover original styles if any\n const origStyle = this.element.getAttribute('data-choice-orig-style');\n\n if (origStyle) {\n this.element.removeAttribute('data-choice-orig-style');\n this.element.setAttribute('style', origStyle);\n } else {\n this.element.removeAttribute('style');\n }\n this.element.removeAttribute('aria-hidden');\n this.element.removeAttribute('data-choice');\n\n // Re-assign values - this is weird, I know\n this.element.value = this.element.value;\n }\n\n enable() {\n this.element.removeAttribute('disabled');\n this.element.disabled = false;\n this.isDisabled = false;\n }\n\n disable() {\n this.element.setAttribute('disabled', '');\n this.element.disabled = true;\n this.isDisabled = true;\n }\n\n triggerEvent(eventType, data) {\n dispatchEvent(this.element, eventType, data);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/wrapped-element.js","import classNames from 'classnames';\nimport { strToEl } from './lib/utils';\n\nexport const TEMPLATES = {\n containerOuter(\n globalClasses,\n direction,\n isSelectElement,\n isSelectOneElement,\n searchEnabled,\n passedElementType,\n ) {\n const tabIndex = isSelectOneElement ? 'tabindex=\"0\"' : '';\n let role = isSelectElement ? 'role=\"listbox\"' : '';\n let ariaAutoComplete = '';\n\n if (isSelectElement && searchEnabled) {\n role = 'role=\"combobox\"';\n ariaAutoComplete = 'aria-autocomplete=\"list\"';\n }\n\n return strToEl(`\n \n
\n `);\n },\n containerInner(globalClasses) {\n return strToEl(`\n \n `);\n },\n itemList(globalClasses, isSelectOneElement) {\n const localClasses = classNames(globalClasses.list, {\n [globalClasses.listSingle]: isSelectOneElement,\n [globalClasses.listItems]: !isSelectOneElement,\n });\n\n return strToEl(`\n \n `);\n },\n placeholder(globalClasses, value) {\n return strToEl(`\n \n ${value}\n
\n `);\n },\n item(globalClasses, data, removeItemButton) {\n const ariaSelected = data.active ? 'aria-selected=\"true\"' : '';\n const ariaDisabled = data.disabled ? 'aria-disabled=\"true\"' : '';\n\n let localClasses = classNames(globalClasses.item, {\n [globalClasses.highlightedState]: data.highlighted,\n [globalClasses.itemSelectable]: !data.highlighted,\n [globalClasses.placeholder]: data.placeholder,\n });\n\n if (removeItemButton) {\n localClasses = classNames(globalClasses.item, {\n [globalClasses.highlightedState]: data.highlighted,\n [globalClasses.itemSelectable]: !data.disabled,\n [globalClasses.placeholder]: data.placeholder,\n });\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n }\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n },\n choiceList(globalClasses, isSelectOneElement) {\n const ariaMultiSelectable = !isSelectOneElement\n ? 'aria-multiselectable=\"true\"'\n : '';\n\n return strToEl(`\n \n
\n `);\n },\n choiceGroup(globalClasses, data) {\n const ariaDisabled = data.disabled ? 'aria-disabled=\"true\"' : '';\n const localClasses = classNames(globalClasses.group, {\n [globalClasses.itemDisabled]: data.disabled,\n });\n\n return strToEl(`\n \n `);\n },\n choice(globalClasses, data, itemSelectText) {\n const role = data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"';\n const localClasses = classNames(\n globalClasses.item,\n globalClasses.itemChoice,\n {\n [globalClasses.itemDisabled]: data.disabled,\n [globalClasses.itemSelectable]: !data.disabled,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n },\n input(globalClasses) {\n const localClasses = classNames(\n globalClasses.input,\n globalClasses.inputCloned,\n );\n\n return strToEl(`\n \n `);\n },\n dropdown(globalClasses) {\n const localClasses = classNames(\n globalClasses.list,\n globalClasses.listDropdown,\n );\n\n return strToEl(`\n \n
\n `);\n },\n notice(globalClasses, label, type = '') {\n const localClasses = classNames(\n globalClasses.item,\n globalClasses.itemChoice,\n {\n [globalClasses.noResults]: type === 'no-results',\n [globalClasses.noChoices]: type === 'no-choices',\n },\n );\n\n return strToEl(`\n \n ${label}\n
\n `);\n },\n option(data) {\n return strToEl(`\n \n `);\n },\n};\n\nexport default TEMPLATES;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/templates.js","import Fuse from 'fuse.js';\nimport merge from 'deepmerge';\n\nimport './lib/polyfills';\nimport Store from './store/store';\nimport {\n Dropdown,\n Container,\n Input,\n List,\n WrappedInput,\n WrappedSelect,\n} from './components';\nimport { DEFAULT_CONFIG, EVENTS, KEY_CODES } from './constants';\nimport { TEMPLATES } from './templates';\nimport {\n addChoice,\n filterChoices,\n activateChoices,\n clearChoices,\n} from './actions/choices';\nimport { addItem, removeItem, highlightItem } from './actions/items';\nimport { addGroup } from './actions/groups';\nimport { clearAll, resetTo } from './actions/misc';\nimport {\n isScrolledIntoView,\n getAdjacentEl,\n getType,\n isType,\n strToEl,\n extend,\n sortByScore,\n generateId,\n findAncestorByAttrName,\n regexFilter,\n fetchFromObject,\n isIE11,\n existsInArray,\n cloneObject,\n doKeysMatch,\n} from './lib/utils';\n\n/**\n * Choices\n * @author Josh Johnson\n */\nclass Choices {\n constructor(element = '[data-choice]', userConfig = {}) {\n if (isType('String', element)) {\n const elements = Array.from(document.querySelectorAll(element));\n\n // If there are multiple elements, create a new instance\n // for each element besides the first one (as that already has an instance)\n if (elements.length > 1) {\n return this._generateInstances(elements, userConfig);\n }\n }\n\n this.config = merge.all(\n [DEFAULT_CONFIG, Choices.userDefaults, userConfig],\n // When merging array configs, replace with a copy of the userConfig array,\n // instead of concatenating with the default array\n { arrayMerge: (destinationArray, sourceArray) => [...sourceArray] },\n );\n\n if (!doKeysMatch(this.config, DEFAULT_CONFIG)) {\n console.warn('Unknown config option(s) passed');\n }\n\n if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {\n this.config.renderSelectedChoices = 'auto';\n }\n\n // Retrieve triggering element (i.e. element with 'data-choice' trigger)\n const passedElement = isType('String', element)\n ? document.querySelector(element)\n : element;\n\n if (!passedElement) {\n return console.error(\n 'Could not find passed element or passed element was of an invalid type',\n );\n }\n\n this._isTextElement = passedElement.type === 'text';\n this._isSelectOneElement = passedElement.type === 'select-one';\n this._isSelectMultipleElement = passedElement.type === 'select-multiple';\n this._isSelectElement =\n this._isSelectOneElement || this._isSelectMultipleElement;\n\n if (this._isTextElement) {\n this.passedElement = new WrappedInput({\n element: passedElement,\n classNames: this.config.classNames,\n delimiter: this.config.delimiter,\n });\n } else if (this._isSelectElement) {\n this.passedElement = new WrappedSelect({\n element: passedElement,\n classNames: this.config.classNames,\n });\n }\n\n if (!this.passedElement) {\n return console.error('Passed element was of an invalid type');\n }\n\n if (\n this.config.shouldSortItems === true &&\n this._isSelectOneElement &&\n !this.config.silent\n ) {\n console.warn(\n \"shouldSortElements: Type of passed element is 'select-one', falling back to false.\",\n );\n }\n\n this.initialised = false;\n\n this._store = new Store(this.render);\n this._initialState = {};\n this._currentState = {};\n this._prevState = {};\n this._currentValue = '';\n this._canSearch = this.config.searchEnabled;\n this._isScrollingOnIe = false;\n this._highlightPosition = 0;\n this._wasTap = true;\n this._placeholderValue = this._generatePlaceholderValue();\n this._baseId = generateId(this.passedElement.element, 'choices-');\n this._direction = this.passedElement.element.getAttribute('dir') || 'ltr';\n this._idNames = {\n itemChoice: 'item-choice',\n };\n // Assign preset choices from passed object\n this._presetChoices = this.config.choices;\n // Assign preset items from passed object first\n this._presetItems = this.config.items;\n // Then add any values passed from attribute\n if (this.passedElement.value) {\n this._presetItems = this._presetItems.concat(\n this.passedElement.value.split(this.config.delimiter),\n );\n }\n\n this._render = this._render.bind(this);\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n this._onKeyUp = this._onKeyUp.bind(this);\n this._onKeyDown = this._onKeyDown.bind(this);\n this._onClick = this._onClick.bind(this);\n this._onTouchMove = this._onTouchMove.bind(this);\n this._onTouchEnd = this._onTouchEnd.bind(this);\n this._onMouseDown = this._onMouseDown.bind(this);\n this._onMouseOver = this._onMouseOver.bind(this);\n this._onFormReset = this._onFormReset.bind(this);\n this._onAKey = this._onAKey.bind(this);\n this._onEnterKey = this._onEnterKey.bind(this);\n this._onEscapeKey = this._onEscapeKey.bind(this);\n this._onDirectionKey = this._onDirectionKey.bind(this);\n this._onDeleteKey = this._onDeleteKey.bind(this);\n\n // If element has already been initialised with Choices, fail silently\n if (this.passedElement.element.getAttribute('data-choice') === 'active') {\n console.warn(\n 'Trying to initialise Choices on element already initialised',\n );\n }\n\n // Let's go\n this.init();\n }\n\n /* ========================================\n = Public functions =\n ======================================== */\n\n init() {\n if (this.initialised) {\n return;\n }\n\n this._createTemplates();\n this._createElements();\n this._createStructure();\n\n // Set initial state (We need to clone the state because some reducers\n // modify the inner objects properties in the state) 🤢\n this._initialState = cloneObject(this._store.state);\n this._store.subscribe(this._render);\n this._render();\n this._addEventListeners();\n\n const shouldDisable =\n !this.config.addItems ||\n this.passedElement.element.hasAttribute('disabled');\n\n if (shouldDisable) {\n this.disable();\n }\n\n this.initialised = true;\n\n const { callbackOnInit } = this.config;\n // Run callback if it is a function\n if (callbackOnInit && isType('Function', callbackOnInit)) {\n callbackOnInit.call(this);\n }\n }\n\n destroy() {\n if (!this.initialised) {\n return;\n }\n\n this._removeEventListeners();\n this.passedElement.reveal();\n this.containerOuter.unwrap(this.passedElement.element);\n\n if (this._isSelectElement) {\n this.passedElement.options = this._presetChoices;\n }\n\n this.clearStore();\n\n this.config.templates = null;\n this.initialised = false;\n }\n\n enable() {\n if (this.passedElement.isDisabled) {\n this.passedElement.enable();\n }\n\n if (this.containerOuter.isDisabled) {\n this._addEventListeners();\n this.input.enable();\n this.containerOuter.enable();\n }\n\n return this;\n }\n\n disable() {\n if (!this.passedElement.isDisabled) {\n this.passedElement.disable();\n }\n\n if (!this.containerOuter.isDisabled) {\n this._removeEventListeners();\n this.input.disable();\n this.containerOuter.disable();\n }\n\n return this;\n }\n\n highlightItem(item, runEvent = true) {\n if (!item) {\n return this;\n }\n\n const { id, groupId = -1, value = '', label = '' } = item;\n const group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n\n this._store.dispatch(highlightItem(id, true));\n\n if (runEvent) {\n this.passedElement.triggerEvent(EVENTS.highlightItem, {\n id,\n value,\n label,\n groupValue: group && group.value ? group.value : null,\n });\n }\n\n return this;\n }\n\n unhighlightItem(item) {\n if (!item) {\n return this;\n }\n\n const { id, groupId = -1, value = '', label = '' } = item;\n const group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n\n this._store.dispatch(highlightItem(id, false));\n this.passedElement.triggerEvent(EVENTS.highlightItem, {\n id,\n value,\n label,\n groupValue: group && group.value ? group.value : null,\n });\n\n return this;\n }\n\n highlightAll() {\n this._store.items.forEach(item => this.highlightItem(item));\n return this;\n }\n\n unhighlightAll() {\n this._store.items.forEach(item => this.unhighlightItem(item));\n return this;\n }\n\n removeActiveItemsByValue(value) {\n this._store.activeItems\n .filter(item => item.value === value)\n .forEach(item => this._removeItem(item));\n\n return this;\n }\n\n removeActiveItems(excludedId) {\n this._store.activeItems\n .filter(({ id }) => id !== excludedId)\n .forEach(item => this._removeItem(item));\n\n return this;\n }\n\n removeHighlightedItems(runEvent = false) {\n this._store.highlightedActiveItems.forEach(item => {\n this._removeItem(item);\n // If this action was performed by the user\n // trigger the event\n if (runEvent) {\n this._triggerChange(item.value);\n }\n });\n\n return this;\n }\n\n showDropdown(preventInputFocus) {\n if (this.dropdown.isActive) {\n return this;\n }\n\n requestAnimationFrame(() => {\n this.dropdown.show();\n this.containerOuter.open(this.dropdown.distanceFromTopWindow());\n\n if (!preventInputFocus && this._canSearch) {\n this.input.focus();\n }\n\n this.passedElement.triggerEvent(EVENTS.showDropdown, {});\n });\n\n return this;\n }\n\n hideDropdown(preventInputBlur) {\n if (!this.dropdown.isActive) {\n return this;\n }\n\n requestAnimationFrame(() => {\n this.dropdown.hide();\n this.containerOuter.close();\n\n if (!preventInputBlur && this._canSearch) {\n this.input.removeActiveDescendant();\n this.input.blur();\n }\n\n this.passedElement.triggerEvent(EVENTS.hideDropdown, {});\n });\n\n return this;\n }\n\n toggleDropdown() {\n this.dropdown.isActive ? this.hideDropdown() : this.showDropdown();\n return this;\n }\n\n getValue(valueOnly = false) {\n const values = this._store.activeItems.reduce((selectedItems, item) => {\n const itemValue = valueOnly ? item.value : item;\n selectedItems.push(itemValue);\n return selectedItems;\n }, []);\n\n return this._isSelectOneElement ? values[0] : values;\n }\n\n setValue(args) {\n if (!this.initialised) {\n return this;\n }\n\n [...args].forEach(value => this._setChoiceOrItem(value));\n return this;\n }\n\n setChoiceByValue(value) {\n if (!this.initialised || this._isTextElement) {\n return this;\n }\n\n // If only one value has been passed, convert to array\n const choiceValue = isType('Array', value) ? value : [value];\n\n // Loop through each value and\n choiceValue.forEach(val => this._findAndSelectChoiceByValue(val));\n\n return this;\n }\n\n setChoices(choices = [], value = '', label = '', replaceChoices = false) {\n if (!this._isSelectElement || !choices.length || !value) {\n return this;\n }\n\n // Clear choices if needed\n if (replaceChoices) {\n this._clearChoices();\n }\n\n this.containerOuter.removeLoadingState();\n const addGroupsAndChoices = groupOrChoice => {\n if (groupOrChoice.choices) {\n this._addGroup({\n group: groupOrChoice,\n id: groupOrChoice.id || null,\n valueKey: value,\n labelKey: label,\n });\n } else {\n this._addChoice({\n value: groupOrChoice[value],\n label: groupOrChoice[label],\n isSelected: groupOrChoice.selected,\n isDisabled: groupOrChoice.disabled,\n customProperties: groupOrChoice.customProperties,\n placeholder: groupOrChoice.placeholder,\n });\n }\n };\n\n choices.forEach(addGroupsAndChoices);\n\n return this;\n }\n\n clearStore() {\n this._store.dispatch(clearAll());\n return this;\n }\n\n clearInput() {\n const shouldSetInputWidth = !this._isSelectOneElement;\n this.input.clear(shouldSetInputWidth);\n\n if (!this._isTextElement && this._canSearch) {\n this._isSearching = false;\n this._store.dispatch(activateChoices(true));\n }\n\n return this;\n }\n\n ajax(fn) {\n if (!this.initialised || !this._isSelectElement || !fn) {\n return this;\n }\n\n requestAnimationFrame(() => this._handleLoadingState(true));\n fn(this._ajaxCallback());\n\n return this;\n }\n\n /* ===== End of Public functions ====== */\n\n /* =============================================\n = Private functions =\n ============================================= */\n\n _render() {\n this._currentState = this._store.state;\n\n const stateChanged =\n this._currentState.choices !== this._prevState.choices ||\n this._currentState.groups !== this._prevState.groups ||\n this._currentState.items !== this._prevState.items;\n const shouldRenderChoices = this._isSelectElement;\n const shouldRenderItems =\n this._currentState.items !== this._prevState.items;\n\n if (!stateChanged) {\n return;\n }\n\n if (shouldRenderChoices) {\n this._renderChoices();\n }\n\n if (shouldRenderItems) {\n this._renderItems();\n }\n\n this._prevState = this._currentState;\n }\n\n _renderChoices() {\n const { activeGroups, activeChoices } = this._store;\n let choiceListFragment = document.createDocumentFragment();\n\n this.choiceList.clear();\n\n if (this.config.resetScrollPosition) {\n requestAnimationFrame(() => this.choiceList.scrollToTop());\n }\n\n // If we have grouped options\n if (activeGroups.length >= 1 && !this._isSearching) {\n // If we have a placeholder choice along with groups\n const activePlaceholders = activeChoices.filter(\n activeChoice =>\n activeChoice.placeholder === true && activeChoice.groupId === -1,\n );\n if (activePlaceholders.length >= 1) {\n choiceListFragment = this._createChoicesFragment(\n activePlaceholders,\n choiceListFragment,\n );\n }\n choiceListFragment = this._createGroupsFragment(\n activeGroups,\n activeChoices,\n choiceListFragment,\n );\n } else if (activeChoices.length >= 1) {\n choiceListFragment = this._createChoicesFragment(\n activeChoices,\n choiceListFragment,\n );\n }\n\n // If we have choices to show\n if (\n choiceListFragment.childNodes &&\n choiceListFragment.childNodes.length > 0\n ) {\n const activeItems = this._store.activeItems;\n const canAddItem = this._canAddItem(activeItems, this.input.value);\n\n // ...and we can select them\n if (canAddItem.response) {\n // ...append them and highlight the first choice\n this.choiceList.append(choiceListFragment);\n this._highlightChoice();\n } else {\n // ...otherwise show a notice\n this.choiceList.append(this._getTemplate('notice', canAddItem.notice));\n }\n } else {\n // Otherwise show a notice\n let dropdownItem;\n let notice;\n\n if (this._isSearching) {\n notice = isType('Function', this.config.noResultsText)\n ? this.config.noResultsText()\n : this.config.noResultsText;\n\n dropdownItem = this._getTemplate('notice', notice, 'no-results');\n } else {\n notice = isType('Function', this.config.noChoicesText)\n ? this.config.noChoicesText()\n : this.config.noChoicesText;\n\n dropdownItem = this._getTemplate('notice', notice, 'no-choices');\n }\n\n this.choiceList.append(dropdownItem);\n }\n }\n\n _renderItems() {\n const activeItems = this._store.activeItems || [];\n this.itemList.clear();\n\n // Create a fragment to store our list items\n // (so we don't have to update the DOM for each item)\n const itemListFragment = this._createItemsFragment(activeItems);\n\n // If we have items to add, append them\n if (itemListFragment.childNodes) {\n this.itemList.append(itemListFragment);\n }\n }\n\n _createGroupsFragment(groups, choices, fragment) {\n const groupFragment = fragment || document.createDocumentFragment();\n const getGroupChoices = group =>\n choices.filter(choice => {\n if (this._isSelectOneElement) {\n return choice.groupId === group.id;\n }\n return (\n choice.groupId === group.id &&\n (this.config.renderSelectedChoices === 'always' || !choice.selected)\n );\n });\n\n // If sorting is enabled, filter groups\n if (this.config.shouldSort) {\n groups.sort(this.config.sortFn);\n }\n\n groups.forEach(group => {\n const groupChoices = getGroupChoices(group);\n if (groupChoices.length >= 1) {\n const dropdownGroup = this._getTemplate('choiceGroup', group);\n groupFragment.appendChild(dropdownGroup);\n this._createChoicesFragment(groupChoices, groupFragment, true);\n }\n });\n\n return groupFragment;\n }\n\n _createChoicesFragment(choices, fragment, withinGroup = false) {\n // Create a fragment to store our list items (so we don't have to update the DOM for each item)\n const choicesFragment = fragment || document.createDocumentFragment();\n const {\n renderSelectedChoices,\n searchResultLimit,\n renderChoiceLimit,\n } = this.config;\n const filter = this._isSearching ? sortByScore : this.config.sortFn;\n const appendChoice = choice => {\n const shouldRender =\n renderSelectedChoices === 'auto'\n ? this._isSelectOneElement || !choice.selected\n : true;\n if (shouldRender) {\n const dropdownItem = this._getTemplate(\n 'choice',\n choice,\n this.config.itemSelectText,\n );\n choicesFragment.appendChild(dropdownItem);\n }\n };\n\n let rendererableChoices = choices;\n\n if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) {\n rendererableChoices = choices.filter(choice => !choice.selected);\n }\n\n // Split array into placeholders and \"normal\" choices\n const { placeholderChoices, normalChoices } = rendererableChoices.reduce(\n (acc, choice) => {\n if (choice.placeholder) {\n acc.placeholderChoices.push(choice);\n } else {\n acc.normalChoices.push(choice);\n }\n return acc;\n },\n { placeholderChoices: [], normalChoices: [] },\n );\n\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort || this._isSearching) {\n normalChoices.sort(filter);\n }\n\n let choiceLimit = rendererableChoices.length;\n\n // Prepend placeholeder\n const sortedChoices = [...placeholderChoices, ...normalChoices];\n\n if (this._isSearching) {\n choiceLimit = searchResultLimit;\n } else if (renderChoiceLimit > 0 && !withinGroup) {\n choiceLimit = renderChoiceLimit;\n }\n\n // Add each choice to dropdown within range\n for (let i = 0; i < choiceLimit; i += 1) {\n if (sortedChoices[i]) {\n appendChoice(sortedChoices[i]);\n }\n }\n\n return choicesFragment;\n }\n\n _createItemsFragment(items, fragment = null) {\n // Create fragment to add elements to\n const { shouldSortItems, sortFn, removeItemButton } = this.config;\n const itemListFragment = fragment || document.createDocumentFragment();\n\n // If sorting is enabled, filter items\n if (shouldSortItems && !this._isSelectOneElement) {\n items.sort(sortFn);\n }\n\n if (this._isTextElement) {\n // Update the value of the hidden input\n this.passedElement.value = items;\n } else {\n // Update the options of the hidden input\n this.passedElement.options = items;\n }\n\n const addItemToFragment = item => {\n // Create new list element\n const listItem = this._getTemplate('item', item, removeItemButton);\n // Append it to list\n itemListFragment.appendChild(listItem);\n };\n\n // Add each list item to list\n items.forEach(item => addItemToFragment(item));\n\n return itemListFragment;\n }\n\n _triggerChange(value) {\n if (value === undefined || value === null) {\n return;\n }\n\n this.passedElement.triggerEvent(EVENTS.change, {\n value,\n });\n }\n\n _selectPlaceholderChoice() {\n const placeholderChoice = this._store.placeholderChoice;\n\n if (placeholderChoice) {\n this._addItem({\n value: placeholderChoice.value,\n label: placeholderChoice.label,\n choiceId: placeholderChoice.id,\n groupId: placeholderChoice.groupId,\n placeholder: placeholderChoice.placeholder,\n });\n\n this._triggerChange(placeholderChoice.value);\n }\n }\n\n _handleButtonAction(activeItems, element) {\n if (\n !activeItems ||\n !element ||\n !this.config.removeItems ||\n !this.config.removeItemButton\n ) {\n return;\n }\n\n const itemId = element.parentNode.getAttribute('data-id');\n const itemToRemove = activeItems.find(\n item => item.id === parseInt(itemId, 10),\n );\n\n // Remove item associated with button\n this._removeItem(itemToRemove);\n this._triggerChange(itemToRemove.value);\n\n if (this._isSelectOneElement) {\n this._selectPlaceholderChoice();\n }\n }\n\n _handleItemAction(activeItems, element, hasShiftKey = false) {\n if (\n !activeItems ||\n !element ||\n !this.config.removeItems ||\n this._isSelectOneElement\n ) {\n return;\n }\n\n const passedId = element.getAttribute('data-id');\n\n // We only want to select one item with a click\n // so we deselect any items that aren't the target\n // unless shift is being pressed\n activeItems.forEach(item => {\n if (item.id === parseInt(passedId, 10) && !item.highlighted) {\n this.highlightItem(item);\n } else if (!hasShiftKey && item.highlighted) {\n this.unhighlightItem(item);\n }\n });\n\n // Focus input as without focus, a user cannot do anything with a\n // highlighted item\n this.input.focus();\n }\n\n _handleChoiceAction(activeItems, element) {\n if (!activeItems || !element) {\n return;\n }\n\n // If we are clicking on an option\n const id = element.getAttribute('data-id');\n const choice = this._store.getChoiceById(id);\n const passedKeyCode =\n activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;\n const hasActiveDropdown = this.dropdown.isActive;\n\n // Update choice keyCode\n choice.keyCode = passedKeyCode;\n\n this.passedElement.triggerEvent(EVENTS.choice, {\n choice,\n });\n\n if (choice && !choice.selected && !choice.disabled) {\n const canAddItem = this._canAddItem(activeItems, choice.value);\n\n if (canAddItem.response) {\n this._addItem({\n value: choice.value,\n label: choice.label,\n choiceId: choice.id,\n groupId: choice.groupId,\n customProperties: choice.customProperties,\n placeholder: choice.placeholder,\n keyCode: choice.keyCode,\n });\n\n this._triggerChange(choice.value);\n }\n }\n\n this.clearInput();\n\n // We wont to close the dropdown if we are dealing with a single select box\n if (hasActiveDropdown && this._isSelectOneElement) {\n this.hideDropdown(true);\n this.containerOuter.focus();\n }\n }\n\n _handleBackspace(activeItems) {\n if (!this.config.removeItems || !activeItems) {\n return;\n }\n\n const lastItem = activeItems[activeItems.length - 1];\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n\n // If editing the last item is allowed and there are not other selected items,\n // we can edit the item value. Otherwise if we can remove items, remove all selected items\n if (this.config.editItems && !hasHighlightedItems && lastItem) {\n this.input.value = lastItem.value;\n this.input.setWidth();\n this._removeItem(lastItem);\n this._triggerChange(lastItem.value);\n } else {\n if (!hasHighlightedItems) {\n // Highlight last item if none already highlighted\n this.highlightItem(lastItem, false);\n }\n this.removeHighlightedItems(true);\n }\n }\n\n _handleLoadingState(isLoading = true) {\n let placeholderItem = this.itemList.getChild(\n `.${this.config.classNames.placeholder}`,\n );\n\n if (isLoading) {\n this.disable();\n this.containerOuter.addLoadingState();\n\n if (this._isSelectOneElement) {\n if (!placeholderItem) {\n placeholderItem = this._getTemplate(\n 'placeholder',\n this.config.loadingText,\n );\n this.itemList.append(placeholderItem);\n } else {\n placeholderItem.innerHTML = this.config.loadingText;\n }\n } else {\n this.input.placeholder = this.config.loadingText;\n }\n } else {\n this.enable();\n this.containerOuter.removeLoadingState();\n\n if (this._isSelectOneElement) {\n placeholderItem.innerHTML = this._placeholderValue || '';\n } else {\n this.input.placeholder = this._placeholderValue || '';\n }\n }\n }\n\n _handleSearch(value) {\n if (!value || !this.input.isFocussed) {\n return;\n }\n\n const choices = this._store.choices;\n const { searchFloor, searchChoices } = this.config;\n const hasUnactiveChoices = choices.some(option => !option.active);\n\n // Check that we have a value to search and the input was an alphanumeric character\n if (value && value.length >= searchFloor) {\n const resultCount = searchChoices ? this._searchChoices(value) : 0;\n // Trigger search event\n this.passedElement.triggerEvent(EVENTS.search, {\n value,\n resultCount,\n });\n } else if (hasUnactiveChoices) {\n // Otherwise reset choices to active\n this._isSearching = false;\n this._store.dispatch(activateChoices(true));\n }\n }\n\n _canAddItem(activeItems, value) {\n let canAddItem = true;\n let notice = isType('Function', this.config.addItemText)\n ? this.config.addItemText(value)\n : this.config.addItemText;\n\n if (!this._isSelectOneElement) {\n const isDuplicateValue = existsInArray(activeItems, value);\n\n if (\n this.config.maxItemCount > 0 &&\n this.config.maxItemCount <= activeItems.length\n ) {\n // If there is a max entry limit and we have reached that limit\n // don't update\n canAddItem = false;\n notice = isType('Function', this.config.maxItemText)\n ? this.config.maxItemText(this.config.maxItemCount)\n : this.config.maxItemText;\n }\n\n if (\n this.config.regexFilter &&\n this._isTextElement &&\n this.config.addItems &&\n canAddItem\n ) {\n // If a user has supplied a regular expression filter\n // determine whether we can update based on whether\n // our regular expression passes\n canAddItem = regexFilter(value, this.config.regexFilter);\n }\n\n if (\n !this.config.duplicateItemsAllowed &&\n isDuplicateValue &&\n canAddItem\n ) {\n canAddItem = false;\n notice = isType('Function', this.config.uniqueItemText)\n ? this.config.uniqueItemText(value)\n : this.config.uniqueItemText;\n }\n }\n\n return {\n response: canAddItem,\n notice,\n };\n }\n\n _ajaxCallback() {\n return (results, value, label) => {\n if (!results || !value) {\n return;\n }\n\n const parsedResults = isType('Object', results) ? [results] : results;\n\n if (\n parsedResults &&\n isType('Array', parsedResults) &&\n parsedResults.length\n ) {\n // Remove loading states/text\n this._handleLoadingState(false);\n // Add each result as a choice\n parsedResults.forEach(result => {\n if (result.choices) {\n this._addGroup({\n group: result,\n id: result.id || null,\n valueKey: value,\n labelKey: label,\n });\n } else {\n this._addChoice({\n value: fetchFromObject(result, value),\n label: fetchFromObject(result, label),\n isSelected: result.selected,\n isDisabled: result.disabled,\n customProperties: result.customProperties,\n placeholder: result.placeholder,\n });\n }\n });\n\n if (this._isSelectOneElement) {\n this._selectPlaceholderChoice();\n }\n } else {\n // No results, remove loading state\n this._handleLoadingState(false);\n }\n };\n }\n\n _searchChoices(value) {\n const newValue = isType('String', value) ? value.trim() : value;\n const currentValue = isType('String', this._currentValue)\n ? this._currentValue.trim()\n : this._currentValue;\n\n if (newValue.length < 1 && newValue === `${currentValue} `) {\n return 0;\n }\n\n // If new value matches the desired length and is not the same as the current value with a space\n const haystack = this._store.searchableChoices;\n const needle = newValue;\n const keys = [...this.config.searchFields];\n const options = Object.assign(this.config.fuseOptions, { keys });\n const fuse = new Fuse(haystack, options);\n const results = fuse.search(needle);\n\n this._currentValue = newValue;\n this._highlightPosition = 0;\n this._isSearching = true;\n this._store.dispatch(filterChoices(results));\n\n return results.length;\n }\n\n _addEventListeners() {\n document.addEventListener('keyup', this._onKeyUp);\n document.addEventListener('keydown', this._onKeyDown);\n document.addEventListener('click', this._onClick);\n document.addEventListener('touchmove', this._onTouchMove);\n document.addEventListener('touchend', this._onTouchEnd);\n document.addEventListener('mousedown', this._onMouseDown);\n document.addEventListener('mouseover', this._onMouseOver);\n\n if (this._isSelectOneElement) {\n this.containerOuter.element.addEventListener('focus', this._onFocus);\n this.containerOuter.element.addEventListener('blur', this._onBlur);\n }\n\n this.input.element.addEventListener('focus', this._onFocus);\n this.input.element.addEventListener('blur', this._onBlur);\n\n if (this.input.element.form) {\n this.input.element.form.addEventListener('reset', this._onFormReset);\n }\n\n this.input.addEventListeners();\n }\n\n _removeEventListeners() {\n document.removeEventListener('keyup', this._onKeyUp);\n document.removeEventListener('keydown', this._onKeyDown);\n document.removeEventListener('click', this._onClick);\n document.removeEventListener('touchmove', this._onTouchMove);\n document.removeEventListener('touchend', this._onTouchEnd);\n document.removeEventListener('mousedown', this._onMouseDown);\n document.removeEventListener('mouseover', this._onMouseOver);\n\n if (this._isSelectOneElement) {\n this.containerOuter.element.removeEventListener('focus', this._onFocus);\n this.containerOuter.element.removeEventListener('blur', this._onBlur);\n }\n\n this.input.element.removeEventListener('focus', this._onFocus);\n this.input.element.removeEventListener('blur', this._onBlur);\n\n if (this.input.element.form) {\n this.input.element.form.removeEventListener('reset', this._onFormReset);\n }\n\n this.input.removeEventListeners();\n }\n\n _onKeyDown(event) {\n const { target, keyCode, ctrlKey, metaKey } = event;\n\n if (\n target !== this.input.element &&\n !this.containerOuter.element.contains(target)\n ) {\n return;\n }\n\n const activeItems = this._store.activeItems;\n const hasFocusedInput = this.input.isFocussed;\n const hasActiveDropdown = this.dropdown.isActive;\n const hasItems = this.itemList.hasChildren;\n const keyString = String.fromCharCode(keyCode);\n\n const {\n BACK_KEY,\n DELETE_KEY,\n ENTER_KEY,\n A_KEY,\n ESC_KEY,\n UP_KEY,\n DOWN_KEY,\n PAGE_UP_KEY,\n PAGE_DOWN_KEY,\n } = KEY_CODES;\n const hasCtrlDownKeyPressed = ctrlKey || metaKey;\n\n // If a user is typing and the dropdown is not active\n if (!this._isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {\n this.showDropdown();\n }\n\n // Map keys to key actions\n const keyDownActions = {\n [A_KEY]: this._onAKey,\n [ENTER_KEY]: this._onEnterKey,\n [ESC_KEY]: this._onEscapeKey,\n [UP_KEY]: this._onDirectionKey,\n [PAGE_UP_KEY]: this._onDirectionKey,\n [DOWN_KEY]: this._onDirectionKey,\n [PAGE_DOWN_KEY]: this._onDirectionKey,\n [DELETE_KEY]: this._onDeleteKey,\n [BACK_KEY]: this._onDeleteKey,\n };\n\n // If keycode has a function, run it\n if (keyDownActions[keyCode]) {\n keyDownActions[keyCode]({\n event,\n target,\n keyCode,\n metaKey,\n activeItems,\n hasFocusedInput,\n hasActiveDropdown,\n hasItems,\n hasCtrlDownKeyPressed,\n });\n }\n }\n\n _onKeyUp({ target, keyCode }) {\n if (target !== this.input.element) {\n return;\n }\n\n const value = this.input.value;\n const activeItems = this._store.activeItems;\n const canAddItem = this._canAddItem(activeItems, value);\n\n // We are typing into a text input and have a value, we want to show a dropdown\n // notice. Otherwise hide the dropdown\n if (this._isTextElement) {\n if (value) {\n if (canAddItem.notice) {\n const dropdownItem = this._getTemplate('notice', canAddItem.notice);\n this.dropdown.element.innerHTML = dropdownItem.outerHTML;\n }\n\n if (canAddItem.response === true) {\n this.showDropdown(true);\n } else if (!canAddItem.notice) {\n this.hideDropdown(true);\n }\n } else {\n this.hideDropdown(true);\n }\n } else {\n const backKey = KEY_CODES.BACK_KEY;\n const deleteKey = KEY_CODES.DELETE_KEY;\n\n // If user has removed value...\n if ((keyCode === backKey || keyCode === deleteKey) && !target.value) {\n if (!this._isTextElement && this._isSearching) {\n this._isSearching = false;\n this._store.dispatch(activateChoices(true));\n }\n } else if (this._canSearch && canAddItem.response) {\n this._handleSearch(this.input.value);\n }\n }\n\n this._canSearch = this.config.searchEnabled;\n }\n\n _onAKey({ hasItems, hasCtrlDownKeyPressed }) {\n // If CTRL + A or CMD + A have been pressed and there are items to select\n if (hasCtrlDownKeyPressed && hasItems) {\n this._canSearch = false;\n if (\n this.config.removeItems &&\n !this.input.value &&\n this.input.element === document.activeElement\n ) {\n // Highlight items\n this.highlightAll();\n }\n }\n }\n\n _onEnterKey({ event, target, activeItems, hasActiveDropdown }) {\n const { ENTER_KEY: enterKey } = KEY_CODES;\n // If enter key is pressed and the input has a value\n if (this._isTextElement && target.value) {\n const value = this.input.value;\n const canAddItem = this._canAddItem(activeItems, value);\n\n // All is good, add\n if (canAddItem.response) {\n this.hideDropdown(true);\n this._addItem({ value });\n this._triggerChange(value);\n this.clearInput();\n }\n }\n\n if (target.hasAttribute('data-button')) {\n this._handleButtonAction(activeItems, target);\n event.preventDefault();\n }\n\n if (hasActiveDropdown) {\n const highlighted = this.dropdown.getChild(\n `.${this.config.classNames.highlightedState}`,\n );\n\n // If we have a highlighted choice\n if (highlighted) {\n // add enter keyCode value\n if (activeItems[0]) {\n activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign\n }\n this._handleChoiceAction(activeItems, highlighted);\n }\n\n event.preventDefault();\n } else if (this._isSelectOneElement) {\n // Open single select dropdown if it's not active\n this.showDropdown();\n event.preventDefault();\n }\n }\n\n _onEscapeKey({ hasActiveDropdown }) {\n if (hasActiveDropdown) {\n this.hideDropdown(true);\n this.containerOuter.focus();\n }\n }\n\n _onDirectionKey({ event, hasActiveDropdown, keyCode, metaKey }) {\n const {\n DOWN_KEY: downKey,\n PAGE_UP_KEY: pageUpKey,\n PAGE_DOWN_KEY: pageDownKey,\n } = KEY_CODES;\n\n // If up or down key is pressed, traverse through options\n if (hasActiveDropdown || this._isSelectOneElement) {\n this.showDropdown();\n this._canSearch = false;\n\n const directionInt =\n keyCode === downKey || keyCode === pageDownKey ? 1 : -1;\n const skipKey =\n metaKey || keyCode === pageDownKey || keyCode === pageUpKey;\n const selectableChoiceIdentifier = '[data-choice-selectable]';\n\n let nextEl;\n if (skipKey) {\n if (directionInt > 0) {\n nextEl = Array.from(\n this.dropdown.element.querySelectorAll(selectableChoiceIdentifier),\n ).pop();\n } else {\n nextEl = this.dropdown.element.querySelector(\n selectableChoiceIdentifier,\n );\n }\n } else {\n const currentEl = this.dropdown.element.querySelector(\n `.${this.config.classNames.highlightedState}`,\n );\n if (currentEl) {\n nextEl = getAdjacentEl(\n currentEl,\n selectableChoiceIdentifier,\n directionInt,\n );\n } else {\n nextEl = this.dropdown.element.querySelector(\n selectableChoiceIdentifier,\n );\n }\n }\n\n if (nextEl) {\n // We prevent default to stop the cursor moving\n // when pressing the arrow\n if (\n !isScrolledIntoView(nextEl, this.choiceList.element, directionInt)\n ) {\n this.choiceList.scrollToChoice(nextEl, directionInt);\n }\n this._highlightChoice(nextEl);\n }\n\n // Prevent default to maintain cursor position whilst\n // traversing dropdown options\n event.preventDefault();\n }\n }\n\n _onDeleteKey({ event, target, hasFocusedInput, activeItems }) {\n // If backspace or delete key is pressed and the input has no value\n if (hasFocusedInput && !target.value && !this._isSelectOneElement) {\n this._handleBackspace(activeItems);\n event.preventDefault();\n }\n }\n\n _onTouchMove() {\n if (this._wasTap === true) {\n this._wasTap = false;\n }\n }\n\n _onTouchEnd(event) {\n const target = event.target || event.touches[0].target;\n\n // If a user tapped within our container...\n if (this._wasTap === true && this.containerOuter.element.contains(target)) {\n // ...and we aren't dealing with a single select box, show dropdown/focus input\n\n const containerWasTarget =\n target === this.containerOuter.element ||\n target === this.containerInner.element;\n\n if (containerWasTarget && !this._isSelectOneElement) {\n if (this._isTextElement) {\n // If text element, we only want to focus the input\n this.input.focus();\n } else {\n // If a select box, we want to show the dropdown\n this.showDropdown();\n }\n }\n // Prevents focus event firing\n event.stopPropagation();\n }\n\n this._wasTap = true;\n }\n\n _onMouseDown(event) {\n const { target, shiftKey } = event;\n // If we have our mouse down on the scrollbar and are on IE11...\n if (target === this.choiceList && isIE11()) {\n this._isScrollingOnIe = true;\n }\n\n if (\n !this.containerOuter.element.contains(target) ||\n target === this.input.element\n ) {\n return;\n }\n\n const activeItems = this._store.activeItems;\n const hasShiftKey = shiftKey;\n\n const buttonTarget = findAncestorByAttrName(target, 'data-button');\n const itemTarget = findAncestorByAttrName(target, 'data-item');\n const choiceTarget = findAncestorByAttrName(target, 'data-choice');\n\n if (buttonTarget) {\n this._handleButtonAction(activeItems, buttonTarget);\n } else if (itemTarget) {\n this._handleItemAction(activeItems, itemTarget, hasShiftKey);\n } else if (choiceTarget) {\n this._handleChoiceAction(activeItems, choiceTarget);\n }\n\n event.preventDefault();\n }\n\n _onMouseOver({ target }) {\n const targetWithinDropdown =\n target === this.dropdown || this.dropdown.element.contains(target);\n const shouldHighlightChoice =\n targetWithinDropdown && target.hasAttribute('data-choice');\n\n if (shouldHighlightChoice) {\n this._highlightChoice(target);\n }\n }\n\n _onClick({ target }) {\n if (this.containerOuter.element.contains(target)) {\n if (!this.dropdown.isActive && !this.containerOuter.isDisabled) {\n if (this._isTextElement) {\n if (document.activeElement !== this.input.element) {\n this.input.focus();\n }\n } else {\n this.showDropdown();\n this.containerOuter.focus();\n }\n } else if (\n this._isSelectOneElement &&\n target !== this.input.element &&\n !this.dropdown.element.contains(target)\n ) {\n this.hideDropdown();\n }\n } else {\n const hasHighlightedItems = this._store.highlightedActiveItems;\n\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n\n this.containerOuter.removeFocusState();\n this.hideDropdown(true);\n }\n }\n\n _onFocus({ target }) {\n if (!this.containerOuter.element.contains(target)) {\n return;\n }\n\n const focusActions = {\n text: () => {\n if (target === this.input.element) {\n this.containerOuter.addFocusState();\n }\n },\n 'select-one': () => {\n this.containerOuter.addFocusState();\n if (target === this.input.element) {\n this.showDropdown(true);\n }\n },\n 'select-multiple': () => {\n if (target === this.input.element) {\n this.showDropdown(true);\n // If element is a select box, the focused element is the container and the dropdown\n // isn't already open, focus and show dropdown\n this.containerOuter.addFocusState();\n }\n },\n };\n\n focusActions[this.passedElement.element.type]();\n }\n\n _onBlur({ target }) {\n // If target is something that concerns us\n if (\n this.containerOuter.element.contains(target) &&\n !this._isScrollingOnIe\n ) {\n const activeItems = this._store.activeItems;\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n const blurActions = {\n text: () => {\n if (target === this.input.element) {\n this.containerOuter.removeFocusState();\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n this.hideDropdown(true);\n }\n },\n 'select-one': () => {\n this.containerOuter.removeFocusState();\n if (\n target === this.input.element ||\n (target === this.containerOuter.element && !this._canSearch)\n ) {\n this.hideDropdown(true);\n }\n },\n 'select-multiple': () => {\n if (target === this.input.element) {\n this.containerOuter.removeFocusState();\n this.hideDropdown(true);\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n }\n },\n };\n\n blurActions[this.passedElement.element.type]();\n } else {\n // On IE11, clicking the scollbar blurs our input and thus\n // closes the dropdown. To stop this, we refocus our input\n // if we know we are on IE *and* are scrolling.\n this._isScrollingOnIe = false;\n this.input.element.focus();\n }\n }\n\n _onFormReset() {\n this._store.dispatch(resetTo(this._initialState));\n }\n\n _highlightChoice(el = null) {\n const choices = Array.from(\n this.dropdown.element.querySelectorAll('[data-choice-selectable]'),\n );\n\n if (!choices.length) {\n return;\n }\n\n let passedEl = el;\n const highlightedChoices = Array.from(\n this.dropdown.element.querySelectorAll(\n `.${this.config.classNames.highlightedState}`,\n ),\n );\n\n // Remove any highlighted choices\n highlightedChoices.forEach(choice => {\n choice.classList.remove(this.config.classNames.highlightedState);\n choice.setAttribute('aria-selected', 'false');\n });\n\n if (passedEl) {\n this._highlightPosition = choices.indexOf(passedEl);\n } else {\n // Highlight choice based on last known highlight location\n if (choices.length > this._highlightPosition) {\n // If we have an option to highlight\n passedEl = choices[this._highlightPosition];\n } else {\n // Otherwise highlight the option before\n passedEl = choices[choices.length - 1];\n }\n\n if (!passedEl) {\n passedEl = choices[0];\n }\n }\n\n passedEl.classList.add(this.config.classNames.highlightedState);\n passedEl.setAttribute('aria-selected', 'true');\n this.passedElement.triggerEvent(EVENTS.highlightChoice, { el: passedEl });\n\n if (this.dropdown.isActive) {\n // IE11 ignores aria-label and blocks virtual keyboard\n // if aria-activedescendant is set without a dropdown\n this.input.setActiveDescendant(passedEl.id);\n this.containerOuter.setActiveDescendant(passedEl.id);\n }\n }\n\n _addItem({\n value,\n label = null,\n choiceId = -1,\n groupId = -1,\n customProperties = null,\n placeholder = false,\n keyCode = null,\n }) {\n let passedValue = isType('String', value) ? value.trim() : value;\n\n const passedKeyCode = keyCode;\n const passedCustomProperties = customProperties;\n const items = this._store.items;\n const passedLabel = label || passedValue;\n const passedOptionId = parseInt(choiceId, 10) || -1;\n const group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n const id = items ? items.length + 1 : 1;\n\n // If a prepended value has been passed, prepend it\n if (this.config.prependValue) {\n passedValue = this.config.prependValue + passedValue.toString();\n }\n\n // If an appended value has been passed, append it\n if (this.config.appendValue) {\n passedValue += this.config.appendValue.toString();\n }\n\n this._store.dispatch(\n addItem({\n value: passedValue,\n label: passedLabel,\n id,\n choiceId: passedOptionId,\n groupId,\n customProperties,\n placeholder,\n keyCode: passedKeyCode,\n }),\n );\n\n if (this._isSelectOneElement) {\n this.removeActiveItems(id);\n }\n\n // Trigger change event\n this.passedElement.triggerEvent(EVENTS.addItem, {\n id,\n value: passedValue,\n label: passedLabel,\n customProperties: passedCustomProperties,\n groupValue: group && group.value ? group.value : undefined,\n keyCode: passedKeyCode,\n });\n\n return this;\n }\n\n _removeItem(item) {\n if (!item || !isType('Object', item)) {\n return this;\n }\n\n const { id, value, label, choiceId, groupId } = item;\n const group = groupId >= 0 ? this._store.getGroupById(groupId) : null;\n\n this._store.dispatch(removeItem(id, choiceId));\n\n if (group && group.value) {\n this.passedElement.triggerEvent(EVENTS.removeItem, {\n id,\n value,\n label,\n groupValue: group.value,\n });\n } else {\n this.passedElement.triggerEvent(EVENTS.removeItem, {\n id,\n value,\n label,\n });\n }\n\n return this;\n }\n\n _addChoice({\n value,\n label = null,\n isSelected = false,\n isDisabled = false,\n groupId = -1,\n customProperties = null,\n placeholder = false,\n keyCode = null,\n }) {\n if (typeof value === 'undefined' || value === null) {\n return;\n }\n\n // Generate unique id\n const choices = this._store.choices;\n const choiceLabel = label || value;\n const choiceId = choices ? choices.length + 1 : 1;\n const choiceElementId = `${this._baseId}-${\n this._idNames.itemChoice\n }-${choiceId}`;\n\n this._store.dispatch(\n addChoice({\n value,\n label: choiceLabel,\n id: choiceId,\n groupId,\n disabled: isDisabled,\n elementId: choiceElementId,\n customProperties,\n placeholder,\n keyCode,\n }),\n );\n\n if (isSelected) {\n this._addItem({\n value,\n label: choiceLabel,\n choiceId,\n customProperties,\n placeholder,\n keyCode,\n });\n }\n }\n\n _clearChoices() {\n this._store.dispatch(clearChoices());\n }\n\n _addGroup({ group, id, valueKey = 'value', labelKey = 'label' }) {\n const groupChoices = isType('Object', group)\n ? group.choices\n : Array.from(group.getElementsByTagName('OPTION'));\n const groupId = id || Math.floor(new Date().valueOf() * Math.random());\n const isDisabled = group.disabled ? group.disabled : false;\n\n if (groupChoices) {\n this._store.dispatch(addGroup(group.label, groupId, true, isDisabled));\n\n const addGroupChoices = choice => {\n const isOptDisabled =\n choice.disabled || (choice.parentNode && choice.parentNode.disabled);\n\n this._addChoice({\n value: choice[valueKey],\n label: isType('Object', choice) ? choice[labelKey] : choice.innerHTML,\n isSelected: choice.selected,\n isDisabled: isOptDisabled,\n groupId,\n customProperties: choice.customProperties,\n placeholder: choice.placeholder,\n });\n };\n\n groupChoices.forEach(addGroupChoices);\n } else {\n this._store.dispatch(\n addGroup(group.label, group.id, false, group.disabled),\n );\n }\n }\n\n _getTemplate(template, ...args) {\n if (!template) {\n return null;\n }\n\n const { templates, classNames } = this.config;\n return templates[template].call(this, classNames, ...args);\n }\n\n _createTemplates() {\n const { callbackOnCreateTemplates } = this.config;\n let userTemplates = {};\n\n if (\n callbackOnCreateTemplates &&\n isType('Function', callbackOnCreateTemplates)\n ) {\n userTemplates = callbackOnCreateTemplates.call(this, strToEl);\n }\n\n this.config.templates = extend(TEMPLATES, userTemplates);\n }\n\n _createElements() {\n this.containerOuter = new Container({\n element: this._getTemplate(\n 'containerOuter',\n this._direction,\n this._isSelectElement,\n this._isSelectOneElement,\n this.config.searchEnabled,\n this.passedElement.element.type,\n ),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n position: this.config.position,\n });\n\n this.containerInner = new Container({\n element: this._getTemplate('containerInner'),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n position: this.config.position,\n });\n\n this.input = new Input({\n element: this._getTemplate('input'),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n });\n\n this.choiceList = new List({\n element: this._getTemplate('choiceList', this._isSelectOneElement),\n });\n\n this.itemList = new List({\n element: this._getTemplate('itemList', this._isSelectOneElement),\n });\n\n this.dropdown = new Dropdown({\n element: this._getTemplate('dropdown'),\n classNames: this.config.classNames,\n type: this.passedElement.element.type,\n });\n }\n\n _createStructure() {\n // Hide original element\n this.passedElement.conceal();\n // Wrap input in container preserving DOM ordering\n this.containerInner.wrap(this.passedElement.element);\n // Wrapper inner container with outer container\n this.containerOuter.wrap(this.containerInner.element);\n\n if (this._isSelectOneElement) {\n this.input.placeholder = this.config.searchPlaceholderValue || '';\n } else if (this._placeholderValue) {\n this.input.placeholder = this._placeholderValue;\n this.input.setWidth(true);\n }\n\n this.containerOuter.element.appendChild(this.containerInner.element);\n this.containerOuter.element.appendChild(this.dropdown.element);\n this.containerInner.element.appendChild(this.itemList.element);\n\n if (!this._isTextElement) {\n this.dropdown.element.appendChild(this.choiceList.element);\n }\n\n if (!this._isSelectOneElement) {\n this.containerInner.element.appendChild(this.input.element);\n } else if (this.config.searchEnabled) {\n this.dropdown.element.insertBefore(\n this.input.element,\n this.dropdown.element.firstChild,\n );\n }\n\n if (this._isSelectElement) {\n this._addPredefinedChoices();\n } else if (this._isTextElement) {\n this._addPredefinedItems();\n }\n }\n\n _addPredefinedChoices() {\n const passedGroups = this.passedElement.optionGroups;\n\n this._highlightPosition = 0;\n this._isSearching = false;\n\n if (passedGroups && passedGroups.length) {\n // If we have a placeholder option\n const placeholderChoice = this.passedElement.placeholderOption;\n if (\n placeholderChoice &&\n placeholderChoice.parentNode.tagName === 'SELECT'\n ) {\n this._addChoice({\n value: placeholderChoice.value,\n label: placeholderChoice.innerHTML,\n isSelected: placeholderChoice.selected,\n isDisabled: placeholderChoice.disabled,\n placeholder: true,\n });\n }\n\n passedGroups.forEach(group =>\n this._addGroup({\n group,\n id: group.id || null,\n }),\n );\n } else {\n const passedOptions = this.passedElement.options;\n const filter = this.config.sortFn;\n const allChoices = this._presetChoices;\n\n // Create array of options from option elements\n passedOptions.forEach(o => {\n allChoices.push({\n value: o.value,\n label: o.innerHTML,\n selected: o.selected,\n disabled: o.disabled || o.parentNode.disabled,\n placeholder: o.hasAttribute('placeholder'),\n });\n });\n\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort) {\n allChoices.sort(filter);\n }\n\n // Determine whether there is a selected choice\n const hasSelectedChoice = allChoices.some(choice => choice.selected);\n const handleChoice = (choice, index) => {\n const { value, label, customProperties, placeholder } = choice;\n\n if (this._isSelectElement) {\n // If the choice is actually a group\n if (choice.choices) {\n this._addGroup({\n group: choice,\n id: choice.id || null,\n });\n } else {\n // If there is a selected choice already or the choice is not\n // the first in the array, add each choice normally\n // Otherwise pre-select the first choice in the array if it's a single select\n const shouldPreselect =\n this._isSelectOneElement && !hasSelectedChoice && index === 0;\n const isSelected = shouldPreselect ? true : choice.selected;\n const isDisabled = shouldPreselect ? false : choice.disabled;\n\n this._addChoice({\n value,\n label,\n isSelected,\n isDisabled,\n customProperties,\n placeholder,\n });\n }\n } else {\n this._addChoice({\n value,\n label,\n isSelected: choice.selected,\n isDisabled: choice.disabled,\n customProperties,\n placeholder,\n });\n }\n };\n\n // Add each choice\n allChoices.forEach((choice, index) => handleChoice(choice, index));\n }\n }\n\n _addPredefinedItems() {\n const handlePresetItem = item => {\n const itemType = getType(item);\n if (itemType === 'Object' && item.value) {\n this._addItem({\n value: item.value,\n label: item.label,\n choiceId: item.id,\n customProperties: item.customProperties,\n placeholder: item.placeholder,\n });\n } else if (itemType === 'String') {\n this._addItem({\n value: item,\n });\n }\n };\n\n this._presetItems.forEach(item => handlePresetItem(item));\n }\n\n _setChoiceOrItem(item) {\n const itemType = getType(item).toLowerCase();\n const handleType = {\n object: () => {\n if (!item.value) {\n return;\n }\n\n // If we are dealing with a select input, we need to create an option first\n // that is then selected. For text inputs we can just add items normally.\n if (!this._isTextElement) {\n this._addChoice({\n value: item.value,\n label: item.label,\n isSelected: true,\n isDisabled: false,\n customProperties: item.customProperties,\n placeholder: item.placeholder,\n });\n } else {\n this._addItem({\n value: item.value,\n label: item.label,\n choiceId: item.id,\n customProperties: item.customProperties,\n placeholder: item.placeholder,\n });\n }\n },\n string: () => {\n if (!this._isTextElement) {\n this._addChoice({\n value: item,\n label: item,\n isSelected: true,\n isDisabled: false,\n });\n } else {\n this._addItem({\n value: item,\n });\n }\n },\n };\n\n handleType[itemType]();\n }\n\n _findAndSelectChoiceByValue(val) {\n const choices = this._store.choices;\n // Check 'value' property exists and the choice isn't already selected\n const foundChoice = choices.find(choice =>\n this.config.itemComparer(choice.value, val),\n );\n\n if (foundChoice && !foundChoice.selected) {\n this._addItem({\n value: foundChoice.value,\n label: foundChoice.label,\n choiceId: foundChoice.id,\n groupId: foundChoice.groupId,\n customProperties: foundChoice.customProperties,\n placeholder: foundChoice.placeholder,\n keyCode: foundChoice.keyCode,\n });\n }\n }\n\n _generateInstances(elements, config) {\n return elements.reduce(\n (instances, element) => {\n instances.push(new Choices(element, config));\n return instances;\n },\n [this],\n );\n }\n\n _generatePlaceholderValue() {\n if (this._isSelectOneElement) {\n return false;\n }\n\n return this.config.placeholder\n ? this.config.placeholderValue ||\n this.passedElement.element.getAttribute('placeholder')\n : false;\n }\n\n /* ===== End of Private functions ====== */\n}\n\nChoices.userDefaults = {};\n// We cannot export default here due to Webpack: https://github.com/webpack/webpack/issues/3929\nmodule.exports = Choices;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/choices.js","/*!\n * Fuse.js v3.2.0 - Lightweight fuzzy-search (http://fusejs.io)\n * \n * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Fuse\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Fuse\"] = factory();\n\telse\n\t\troot[\"Fuse\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n};\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar bitapRegexSearch = __webpack_require__(5);\nvar bitapSearch = __webpack_require__(7);\nvar patternAlphabet = __webpack_require__(4);\n\nvar Bitap = function () {\n function Bitap(pattern, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$maxPatternLength = _ref.maxPatternLength,\n maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,\n _ref$isCaseSensitive = _ref.isCaseSensitive,\n isCaseSensitive = _ref$isCaseSensitive === undefined ? false : _ref$isCaseSensitive,\n _ref$tokenSeparator = _ref.tokenSeparator,\n tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;\n\n _classCallCheck(this, Bitap);\n\n this.options = {\n location: location,\n distance: distance,\n threshold: threshold,\n maxPatternLength: maxPatternLength,\n isCaseSensitive: isCaseSensitive,\n tokenSeparator: tokenSeparator,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength\n };\n\n this.pattern = this.options.isCaseSensitive ? pattern : pattern.toLowerCase();\n\n if (this.pattern.length <= maxPatternLength) {\n this.patternAlphabet = patternAlphabet(this.pattern);\n }\n }\n\n _createClass(Bitap, [{\n key: 'search',\n value: function search(text) {\n if (!this.options.isCaseSensitive) {\n text = text.toLowerCase();\n }\n\n // Exact match\n if (this.pattern === text) {\n return {\n isMatch: true,\n score: 0,\n matchedIndices: [[0, text.length - 1]]\n };\n }\n\n // When pattern length is greater than the machine word length, just do a a regex comparison\n var _options = this.options,\n maxPatternLength = _options.maxPatternLength,\n tokenSeparator = _options.tokenSeparator;\n\n if (this.pattern.length > maxPatternLength) {\n return bitapRegexSearch(text, this.pattern, tokenSeparator);\n }\n\n // Otherwise, use Bitap algorithm\n var _options2 = this.options,\n location = _options2.location,\n distance = _options2.distance,\n threshold = _options2.threshold,\n findAllMatches = _options2.findAllMatches,\n minMatchCharLength = _options2.minMatchCharLength;\n\n return bitapSearch(text, this.pattern, this.patternAlphabet, {\n location: location,\n distance: distance,\n threshold: threshold,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength\n });\n }\n }]);\n\n return Bitap;\n}();\n\n// let x = new Bitap(\"od mn war\", {})\n// let result = x.search(\"Old Man's War\")\n// console.log(result)\n\nmodule.exports = Bitap;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isArray = __webpack_require__(0);\n\nvar deepValue = function deepValue(obj, path, list) {\n if (!path) {\n // If there's no path left, we've gotten to the object we care about.\n list.push(obj);\n } else {\n var dotIndex = path.indexOf('.');\n var firstSegment = path;\n var remaining = null;\n\n if (dotIndex !== -1) {\n firstSegment = path.slice(0, dotIndex);\n remaining = path.slice(dotIndex + 1);\n }\n\n var value = obj[firstSegment];\n\n if (value !== null && value !== undefined) {\n if (!remaining && (typeof value === 'string' || typeof value === 'number')) {\n list.push(value.toString());\n } else if (isArray(value)) {\n // Search each item in the array.\n for (var i = 0, len = value.length; i < len; i += 1) {\n deepValue(value[i], remaining, list);\n }\n } else if (remaining) {\n // An object. Recurse further.\n deepValue(value, remaining, list);\n }\n }\n }\n\n return list;\n};\n\nmodule.exports = function (obj, path) {\n return deepValue(obj, path, []);\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n var matchedIndices = [];\n var start = -1;\n var end = -1;\n var i = 0;\n\n for (var len = matchmask.length; i < len; i += 1) {\n var match = matchmask[i];\n if (match && start === -1) {\n start = i;\n } else if (!match && start !== -1) {\n end = i - 1;\n if (end - start + 1 >= minMatchCharLength) {\n matchedIndices.push([start, end]);\n }\n start = -1;\n }\n }\n\n // (i-1 - start) + 1 => i - start\n if (matchmask[i - 1] && i - start >= minMatchCharLength) {\n matchedIndices.push([start, i - 1]);\n }\n\n return matchedIndices;\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (pattern) {\n var mask = {};\n var len = pattern.length;\n\n for (var i = 0; i < len; i += 1) {\n mask[pattern.charAt(i)] = 0;\n }\n\n for (var _i = 0; _i < len; _i += 1) {\n mask[pattern.charAt(_i)] |= 1 << len - _i - 1;\n }\n\n return mask;\n};\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar SPECIAL_CHARS_REGEX = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g;\n\nmodule.exports = function (text, pattern) {\n var tokenSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : / +/g;\n\n var regex = new RegExp(pattern.replace(SPECIAL_CHARS_REGEX, '\\\\$&').replace(tokenSeparator, '|'));\n var matches = text.match(regex);\n var isMatch = !!matches;\n var matchedIndices = [];\n\n if (isMatch) {\n for (var i = 0, matchesLen = matches.length; i < matchesLen; i += 1) {\n var match = matches[i];\n matchedIndices.push([text.indexOf(match), match.length - 1]);\n }\n }\n\n return {\n // TODO: revisit this score\n score: isMatch ? 0.5 : 1,\n isMatch: isMatch,\n matchedIndices: matchedIndices\n };\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (pattern, _ref) {\n var _ref$errors = _ref.errors,\n errors = _ref$errors === undefined ? 0 : _ref$errors,\n _ref$currentLocation = _ref.currentLocation,\n currentLocation = _ref$currentLocation === undefined ? 0 : _ref$currentLocation,\n _ref$expectedLocation = _ref.expectedLocation,\n expectedLocation = _ref$expectedLocation === undefined ? 0 : _ref$expectedLocation,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance;\n\n var accuracy = errors / pattern.length;\n var proximity = Math.abs(expectedLocation - currentLocation);\n\n if (!distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n }\n\n return accuracy + proximity / distance;\n};\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar bitapScore = __webpack_require__(6);\nvar matchedIndices = __webpack_require__(3);\n\nmodule.exports = function (text, pattern, patternAlphabet, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;\n\n var expectedLocation = location;\n // Set starting location at beginning text and initialize the alphabet.\n var textLen = text.length;\n // Highest score beyond which we give up.\n var currentThreshold = threshold;\n // Is there a nearby exact match? (speedup)\n var bestLocation = text.indexOf(pattern, expectedLocation);\n\n var patternLen = pattern.length;\n\n // a mask of the matches\n var matchMask = [];\n for (var i = 0; i < textLen; i += 1) {\n matchMask[i] = 0;\n }\n\n if (bestLocation !== -1) {\n var score = bitapScore(pattern, {\n errors: 0,\n currentLocation: bestLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n currentThreshold = Math.min(score, currentThreshold);\n\n // What about in the other direction? (speed up)\n bestLocation = text.lastIndexOf(pattern, expectedLocation + patternLen);\n\n if (bestLocation !== -1) {\n var _score = bitapScore(pattern, {\n errors: 0,\n currentLocation: bestLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n currentThreshold = Math.min(_score, currentThreshold);\n }\n }\n\n // Reset the best location\n bestLocation = -1;\n\n var lastBitArr = [];\n var finalScore = 1;\n var binMax = patternLen + textLen;\n\n var mask = 1 << patternLen - 1;\n\n for (var _i = 0; _i < patternLen; _i += 1) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from the match location we can stray\n // at this error level.\n var binMin = 0;\n var binMid = binMax;\n\n while (binMin < binMid) {\n var _score3 = bitapScore(pattern, {\n errors: _i,\n currentLocation: expectedLocation + binMid,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n if (_score3 <= currentThreshold) {\n binMin = binMid;\n } else {\n binMax = binMid;\n }\n\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\n }\n\n // Use the result from this iteration as the maximum for the next.\n binMax = binMid;\n\n var start = Math.max(1, expectedLocation - binMid + 1);\n var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;\n\n // Initialize the bit array\n var bitArr = Array(finish + 2);\n\n bitArr[finish + 1] = (1 << _i) - 1;\n\n for (var j = finish; j >= start; j -= 1) {\n var currentLocation = j - 1;\n var charMatch = patternAlphabet[text.charAt(currentLocation)];\n\n if (charMatch) {\n matchMask[currentLocation] = 1;\n }\n\n // First pass: exact match\n bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;\n\n // Subsequent passes: fuzzy match\n if (_i !== 0) {\n bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];\n }\n\n if (bitArr[j] & mask) {\n finalScore = bitapScore(pattern, {\n errors: _i,\n currentLocation: currentLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (finalScore <= currentThreshold) {\n // Indeed it is\n currentThreshold = finalScore;\n bestLocation = currentLocation;\n\n // Already passed `loc`, downhill from here on in.\n if (bestLocation <= expectedLocation) {\n break;\n }\n\n // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\n start = Math.max(1, 2 * expectedLocation - bestLocation);\n }\n }\n }\n\n // No hope for a (better) match at greater error levels.\n var _score2 = bitapScore(pattern, {\n errors: _i + 1,\n currentLocation: expectedLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n if (_score2 > currentThreshold) {\n break;\n }\n\n lastBitArr = bitArr;\n }\n\n // Count exact matches (those with a score of 0) to be \"almost\" exact\n return {\n isMatch: bestLocation >= 0,\n score: finalScore === 0 ? 0.001 : finalScore,\n matchedIndices: matchedIndices(matchMask, minMatchCharLength)\n };\n};\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Bitap = __webpack_require__(1);\nvar deepValue = __webpack_require__(2);\nvar isArray = __webpack_require__(0);\n\nvar Fuse = function () {\n function Fuse(list, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$maxPatternLength = _ref.maxPatternLength,\n maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,\n _ref$caseSensitive = _ref.caseSensitive,\n caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,\n _ref$tokenSeparator = _ref.tokenSeparator,\n tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng,\n _ref$id = _ref.id,\n id = _ref$id === undefined ? null : _ref$id,\n _ref$keys = _ref.keys,\n keys = _ref$keys === undefined ? [] : _ref$keys,\n _ref$shouldSort = _ref.shouldSort,\n shouldSort = _ref$shouldSort === undefined ? true : _ref$shouldSort,\n _ref$getFn = _ref.getFn,\n getFn = _ref$getFn === undefined ? deepValue : _ref$getFn,\n _ref$sortFn = _ref.sortFn,\n sortFn = _ref$sortFn === undefined ? function (a, b) {\n return a.score - b.score;\n } : _ref$sortFn,\n _ref$tokenize = _ref.tokenize,\n tokenize = _ref$tokenize === undefined ? false : _ref$tokenize,\n _ref$matchAllTokens = _ref.matchAllTokens,\n matchAllTokens = _ref$matchAllTokens === undefined ? false : _ref$matchAllTokens,\n _ref$includeMatches = _ref.includeMatches,\n includeMatches = _ref$includeMatches === undefined ? false : _ref$includeMatches,\n _ref$includeScore = _ref.includeScore,\n includeScore = _ref$includeScore === undefined ? false : _ref$includeScore,\n _ref$verbose = _ref.verbose,\n verbose = _ref$verbose === undefined ? false : _ref$verbose;\n\n _classCallCheck(this, Fuse);\n\n this.options = {\n location: location,\n distance: distance,\n threshold: threshold,\n maxPatternLength: maxPatternLength,\n isCaseSensitive: caseSensitive,\n tokenSeparator: tokenSeparator,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength,\n id: id,\n keys: keys,\n includeMatches: includeMatches,\n includeScore: includeScore,\n shouldSort: shouldSort,\n getFn: getFn,\n sortFn: sortFn,\n verbose: verbose,\n tokenize: tokenize,\n matchAllTokens: matchAllTokens\n };\n\n this.setCollection(list);\n }\n\n _createClass(Fuse, [{\n key: 'setCollection',\n value: function setCollection(list) {\n this.list = list;\n return list;\n }\n }, {\n key: 'search',\n value: function search(pattern) {\n this._log('---------\\nSearch pattern: \"' + pattern + '\"');\n\n var _prepareSearchers2 = this._prepareSearchers(pattern),\n tokenSearchers = _prepareSearchers2.tokenSearchers,\n fullSearcher = _prepareSearchers2.fullSearcher;\n\n var _search2 = this._search(tokenSearchers, fullSearcher),\n weights = _search2.weights,\n results = _search2.results;\n\n this._computeScore(weights, results);\n\n if (this.options.shouldSort) {\n this._sort(results);\n }\n\n return this._format(results);\n }\n }, {\n key: '_prepareSearchers',\n value: function _prepareSearchers() {\n var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n var tokenSearchers = [];\n\n if (this.options.tokenize) {\n // Tokenize on the separator\n var tokens = pattern.split(this.options.tokenSeparator);\n for (var i = 0, len = tokens.length; i < len; i += 1) {\n tokenSearchers.push(new Bitap(tokens[i], this.options));\n }\n }\n\n var fullSearcher = new Bitap(pattern, this.options);\n\n return { tokenSearchers: tokenSearchers, fullSearcher: fullSearcher };\n }\n }, {\n key: '_search',\n value: function _search() {\n var tokenSearchers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var fullSearcher = arguments[1];\n\n var list = this.list;\n var resultMap = {};\n var results = [];\n\n // Check the first item in the list, if it's a string, then we assume\n // that every item in the list is also a string, and thus it's a flattened array.\n if (typeof list[0] === 'string') {\n // Iterate over every item\n for (var i = 0, len = list.length; i < len; i += 1) {\n this._analyze({\n key: '',\n value: list[i],\n record: i,\n index: i\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n\n return { weights: null, results: results };\n }\n\n // Otherwise, the first item is an Object (hopefully), and thus the searching\n // is done on the values of the keys of each item.\n var weights = {};\n for (var _i = 0, _len = list.length; _i < _len; _i += 1) {\n var item = list[_i];\n // Iterate over every key\n for (var j = 0, keysLen = this.options.keys.length; j < keysLen; j += 1) {\n var key = this.options.keys[j];\n if (typeof key !== 'string') {\n weights[key.name] = {\n weight: 1 - key.weight || 1\n };\n if (key.weight <= 0 || key.weight > 1) {\n throw new Error('Key weight has to be > 0 and <= 1');\n }\n key = key.name;\n } else {\n weights[key] = {\n weight: 1\n };\n }\n\n this._analyze({\n key: key,\n value: this.options.getFn(item, key),\n record: item,\n index: _i\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n }\n\n return { weights: weights, results: results };\n }\n }, {\n key: '_analyze',\n value: function _analyze(_ref2, _ref3) {\n var key = _ref2.key,\n _ref2$arrayIndex = _ref2.arrayIndex,\n arrayIndex = _ref2$arrayIndex === undefined ? -1 : _ref2$arrayIndex,\n value = _ref2.value,\n record = _ref2.record,\n index = _ref2.index;\n var _ref3$tokenSearchers = _ref3.tokenSearchers,\n tokenSearchers = _ref3$tokenSearchers === undefined ? [] : _ref3$tokenSearchers,\n _ref3$fullSearcher = _ref3.fullSearcher,\n fullSearcher = _ref3$fullSearcher === undefined ? [] : _ref3$fullSearcher,\n _ref3$resultMap = _ref3.resultMap,\n resultMap = _ref3$resultMap === undefined ? {} : _ref3$resultMap,\n _ref3$results = _ref3.results,\n results = _ref3$results === undefined ? [] : _ref3$results;\n\n // Check if the texvaluet can be searched\n if (value === undefined || value === null) {\n return;\n }\n\n var exists = false;\n var averageScore = -1;\n var numTextMatches = 0;\n\n if (typeof value === 'string') {\n this._log('\\nKey: ' + (key === '' ? '-' : key));\n\n var mainSearchResult = fullSearcher.search(value);\n this._log('Full text: \"' + value + '\", score: ' + mainSearchResult.score);\n\n if (this.options.tokenize) {\n var words = value.split(this.options.tokenSeparator);\n var scores = [];\n\n for (var i = 0; i < tokenSearchers.length; i += 1) {\n var tokenSearcher = tokenSearchers[i];\n\n this._log('\\nPattern: \"' + tokenSearcher.pattern + '\"');\n\n // let tokenScores = []\n var hasMatchInText = false;\n\n for (var j = 0; j < words.length; j += 1) {\n var word = words[j];\n var tokenSearchResult = tokenSearcher.search(word);\n var obj = {};\n if (tokenSearchResult.isMatch) {\n obj[word] = tokenSearchResult.score;\n exists = true;\n hasMatchInText = true;\n scores.push(tokenSearchResult.score);\n } else {\n obj[word] = 1;\n if (!this.options.matchAllTokens) {\n scores.push(1);\n }\n }\n this._log('Token: \"' + word + '\", score: ' + obj[word]);\n // tokenScores.push(obj)\n }\n\n if (hasMatchInText) {\n numTextMatches += 1;\n }\n }\n\n averageScore = scores[0];\n var scoresLen = scores.length;\n for (var _i2 = 1; _i2 < scoresLen; _i2 += 1) {\n averageScore += scores[_i2];\n }\n averageScore = averageScore / scoresLen;\n\n this._log('Token score average:', averageScore);\n }\n\n var finalScore = mainSearchResult.score;\n if (averageScore > -1) {\n finalScore = (finalScore + averageScore) / 2;\n }\n\n this._log('Score average:', finalScore);\n\n var checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true;\n\n this._log('\\nCheck Matches: ' + checkTextMatches);\n\n // If a match is found, add the item to , including its score\n if ((exists || mainSearchResult.isMatch) && checkTextMatches) {\n // Check if the item already exists in our results\n var existingResult = resultMap[index];\n if (existingResult) {\n // Use the lowest score\n // existingResult.score, bitapResult.score\n existingResult.output.push({\n key: key,\n arrayIndex: arrayIndex,\n value: value,\n score: finalScore,\n matchedIndices: mainSearchResult.matchedIndices\n });\n } else {\n // Add it to the raw result list\n resultMap[index] = {\n item: record,\n output: [{\n key: key,\n arrayIndex: arrayIndex,\n value: value,\n score: finalScore,\n matchedIndices: mainSearchResult.matchedIndices\n }]\n };\n\n results.push(resultMap[index]);\n }\n }\n } else if (isArray(value)) {\n for (var _i3 = 0, len = value.length; _i3 < len; _i3 += 1) {\n this._analyze({\n key: key,\n arrayIndex: _i3,\n value: value[_i3],\n record: record,\n index: index\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n }\n }\n }, {\n key: '_computeScore',\n value: function _computeScore(weights, results) {\n this._log('\\n\\nComputing score:\\n');\n\n for (var i = 0, len = results.length; i < len; i += 1) {\n var output = results[i].output;\n var scoreLen = output.length;\n\n var totalScore = 0;\n var bestScore = 1;\n\n for (var j = 0; j < scoreLen; j += 1) {\n var weight = weights ? weights[output[j].key].weight : 1;\n var score = weight === 1 ? output[j].score : output[j].score || 0.001;\n var nScore = score * weight;\n\n if (weight !== 1) {\n bestScore = Math.min(bestScore, nScore);\n } else {\n output[j].nScore = nScore;\n totalScore += nScore;\n }\n }\n\n results[i].score = bestScore === 1 ? totalScore / scoreLen : bestScore;\n\n this._log(results[i]);\n }\n }\n }, {\n key: '_sort',\n value: function _sort(results) {\n this._log('\\n\\nSorting....');\n results.sort(this.options.sortFn);\n }\n }, {\n key: '_format',\n value: function _format(results) {\n var finalOutput = [];\n\n this._log('\\n\\nOutput:\\n\\n', JSON.stringify(results));\n\n var transformers = [];\n\n if (this.options.includeMatches) {\n transformers.push(function (result, data) {\n var output = result.output;\n data.matches = [];\n\n for (var i = 0, len = output.length; i < len; i += 1) {\n var item = output[i];\n\n if (item.matchedIndices.length === 0) {\n continue;\n }\n\n var obj = {\n indices: item.matchedIndices,\n value: item.value\n };\n if (item.key) {\n obj.key = item.key;\n }\n if (item.hasOwnProperty('arrayIndex') && item.arrayIndex > -1) {\n obj.arrayIndex = item.arrayIndex;\n }\n data.matches.push(obj);\n }\n });\n }\n\n if (this.options.includeScore) {\n transformers.push(function (result, data) {\n data.score = result.score;\n });\n }\n\n for (var i = 0, len = results.length; i < len; i += 1) {\n var result = results[i];\n\n if (this.options.id) {\n result.item = this.options.getFn(result.item, this.options.id)[0];\n }\n\n if (!transformers.length) {\n finalOutput.push(result.item);\n continue;\n }\n\n var data = {\n item: result.item\n };\n\n for (var j = 0, _len2 = transformers.length; j < _len2; j += 1) {\n transformers[j](result, data);\n }\n\n finalOutput.push(data);\n }\n\n return finalOutput;\n }\n }, {\n key: '_log',\n value: function _log() {\n if (this.options.verbose) {\n var _console;\n\n (_console = console).log.apply(_console, arguments);\n }\n }\n }]);\n\n return Fuse;\n}();\n\nmodule.exports = Fuse;\n\n/***/ })\n/******/ ]);\n});\n//# sourceMappingURL=fuse.js.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fuse.js/dist/fuse.js\n// module id = 39\n// module chunks = 0","var isMergeableObject = function isMergeableObject(value) {\n\treturn isNonNullObject(value)\n\t\t&& !isSpecial(value)\n};\n\nfunction isNonNullObject(value) {\n\treturn !!value && typeof value === 'object'\n}\n\nfunction isSpecial(value) {\n\tvar stringValue = Object.prototype.toString.call(value);\n\n\treturn stringValue === '[object RegExp]'\n\t\t|| stringValue === '[object Date]'\n\t\t|| isReactElement(value)\n}\n\n// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25\nvar canUseSymbol = typeof Symbol === 'function' && Symbol.for;\nvar REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;\n\nfunction isReactElement(value) {\n\treturn value.$$typeof === REACT_ELEMENT_TYPE\n}\n\nfunction emptyTarget(val) {\n\treturn Array.isArray(val) ? [] : {}\n}\n\nfunction cloneUnlessOtherwiseSpecified(value, options) {\n\treturn (options.clone !== false && options.isMergeableObject(value))\n\t\t? deepmerge(emptyTarget(value), value, options)\n\t\t: value\n}\n\nfunction defaultArrayMerge(target, source, options) {\n\treturn target.concat(source).map(function(element) {\n\t\treturn cloneUnlessOtherwiseSpecified(element, options)\n\t})\n}\n\nfunction mergeObject(target, source, options) {\n\tvar destination = {};\n\tif (options.isMergeableObject(target)) {\n\t\tObject.keys(target).forEach(function(key) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(target[key], options);\n\t\t});\n\t}\n\tObject.keys(source).forEach(function(key) {\n\t\tif (!options.isMergeableObject(source[key]) || !target[key]) {\n\t\t\tdestination[key] = cloneUnlessOtherwiseSpecified(source[key], options);\n\t\t} else {\n\t\t\tdestination[key] = deepmerge(target[key], source[key], options);\n\t\t}\n\t});\n\treturn destination\n}\n\nfunction deepmerge(target, source, options) {\n\toptions = options || {};\n\toptions.arrayMerge = options.arrayMerge || defaultArrayMerge;\n\toptions.isMergeableObject = options.isMergeableObject || isMergeableObject;\n\n\tvar sourceIsArray = Array.isArray(source);\n\tvar targetIsArray = Array.isArray(target);\n\tvar sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n\tif (!sourceAndTargetTypesMatch) {\n\t\treturn cloneUnlessOtherwiseSpecified(source, options)\n\t} else if (sourceIsArray) {\n\t\treturn options.arrayMerge(target, source, options)\n\t} else {\n\t\treturn mergeObject(target, source, options)\n\t}\n}\n\ndeepmerge.all = function deepmergeAll(array, options) {\n\tif (!Array.isArray(array)) {\n\t\tthrow new Error('first argument should be an array')\n\t}\n\n\treturn array.reduce(function(prev, next) {\n\t\treturn deepmerge(prev, next, options)\n\t}, {})\n};\n\nvar deepmerge_1 = deepmerge;\n\nexport default deepmerge_1;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/deepmerge/dist/es.js\n// module id = 40\n// module chunks = 0","import 'core-js/fn/array/find';\nimport 'core-js/fn/array/from';\nimport 'core-js/fn/array/includes';\nimport 'custom-event-polyfill';\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/lib/polyfills.js","require('../../modules/es6.array.find');\nmodule.exports = require('../../modules/_core').Array.find;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/fn/array/find.js\n// module id = 42\n// module chunks = 0","'use strict';\n// 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)\nvar $export = require('./_export');\nvar $find = require('./_array-methods')(5);\nvar KEY = 'find';\nvar forced = true;\n// Shouldn't skip holes\nif (KEY in []) Array(1)[KEY](function () { forced = false; });\n$export($export.P + $export.F * forced, 'Array', {\n find: function find(callbackfn /* , that = undefined */) {\n return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\nrequire('./_add-to-unscopables')(KEY);\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/es6.array.find.js\n// module id = 43\n// module chunks = 0","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_ie8-dom-define.js\n// module id = 44\n// module chunks = 0","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_to-primitive.js\n// module id = 45\n// module chunks = 0","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_a-function.js\n// module id = 46\n// module chunks = 0","// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = require('./_ctx');\nvar IObject = require('./_iobject');\nvar toObject = require('./_to-object');\nvar toLength = require('./_to-length');\nvar asc = require('./_array-species-create');\nmodule.exports = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || asc;\n return function ($this, callbackfn, that) {\n var O = toObject($this);\n var self = IObject(O);\n var f = ctx(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_array-methods.js\n// module id = 47\n// module chunks = 0","// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\nvar speciesConstructor = require('./_array-species-constructor');\n\nmodule.exports = function (original, length) {\n return new (speciesConstructor(original))(length);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_array-species-create.js\n// module id = 48\n// module chunks = 0","var isObject = require('./_is-object');\nvar isArray = require('./_is-array');\nvar SPECIES = require('./_wks')('species');\n\nmodule.exports = function (original) {\n var C;\n if (isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;\n if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_array-species-constructor.js\n// module id = 49\n// module chunks = 0","// 7.2.2 IsArray(argument)\nvar cof = require('./_cof');\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_is-array.js\n// module id = 50\n// module chunks = 0","require('../../modules/es6.string.iterator');\nrequire('../../modules/es6.array.from');\nmodule.exports = require('../../modules/_core').Array.from;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/fn/array/from.js\n// module id = 51\n// module chunks = 0","'use strict';\nvar $at = require('./_string-at')(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\nrequire('./_iter-define')(String, 'String', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/es6.string.iterator.js\n// module id = 52\n// module chunks = 0","var toInteger = require('./_to-integer');\nvar defined = require('./_defined');\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_string-at.js\n// module id = 53\n// module chunks = 0","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_iter-define.js\n// module id = 54\n// module chunks = 0","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_iter-create.js\n// module id = 55\n// module chunks = 0","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_object-create.js\n// module id = 56\n// module chunks = 0","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_object-dps.js\n// module id = 57\n// module chunks = 0","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_object-keys.js\n// module id = 58\n// module chunks = 0","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_object-keys-internal.js\n// module id = 59\n// module chunks = 0","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_to-absolute-index.js\n// module id = 60\n// module chunks = 0","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_html.js\n// module id = 61\n// module chunks = 0","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_object-gpo.js\n// module id = 62\n// module chunks = 0","'use strict';\nvar ctx = require('./_ctx');\nvar $export = require('./_export');\nvar toObject = require('./_to-object');\nvar call = require('./_iter-call');\nvar isArrayIter = require('./_is-array-iter');\nvar toLength = require('./_to-length');\nvar createProperty = require('./_create-property');\nvar getIterFn = require('./core.get-iterator-method');\n\n$export($export.S + $export.F * !require('./_iter-detect')(function (iter) { Array.from(iter); }), 'Array', {\n // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)\n from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == 'function' ? this : Array;\n var aLen = arguments.length;\n var mapfn = aLen > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var index = 0;\n var iterFn = getIterFn(O);\n var length, result, step, iterator;\n if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);\n // if object isn't iterable or it's array with default iterator - use simple case\n if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {\n for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {\n createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);\n }\n } else {\n length = toLength(O.length);\n for (result = new C(length); length > index; index++) {\n createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);\n }\n }\n result.length = index;\n return result;\n }\n});\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/es6.array.from.js\n// module id = 63\n// module chunks = 0","// call something on iterator step with safe closing on error\nvar anObject = require('./_an-object');\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_iter-call.js\n// module id = 64\n// module chunks = 0","// check on default Array iterator\nvar Iterators = require('./_iterators');\nvar ITERATOR = require('./_wks')('iterator');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_is-array-iter.js\n// module id = 65\n// module chunks = 0","'use strict';\nvar $defineProperty = require('./_object-dp');\nvar createDesc = require('./_property-desc');\n\nmodule.exports = function (object, index, value) {\n if (index in object) $defineProperty.f(object, index, createDesc(0, value));\n else object[index] = value;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_create-property.js\n// module id = 66\n// module chunks = 0","var classof = require('./_classof');\nvar ITERATOR = require('./_wks')('iterator');\nvar Iterators = require('./_iterators');\nmodule.exports = require('./_core').getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it['@@iterator']\n || Iterators[classof(it)];\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/core.get-iterator-method.js\n// module id = 67\n// module chunks = 0","// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = require('./_cof');\nvar TAG = require('./_wks')('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_classof.js\n// module id = 68\n// module chunks = 0","var ITERATOR = require('./_wks')('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/_iter-detect.js\n// module id = 69\n// module chunks = 0","require('../../modules/es7.array.includes');\nmodule.exports = require('../../modules/_core').Array.includes;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/fn/array/includes.js\n// module id = 70\n// module chunks = 0","'use strict';\n// https://github.com/tc39/Array.prototype.includes\nvar $export = require('./_export');\nvar $includes = require('./_array-includes')(true);\n\n$export($export.P, 'Array', {\n includes: function includes(el /* , fromIndex = 0 */) {\n return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);\n }\n});\n\nrequire('./_add-to-unscopables')('includes');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/core-js/modules/es7.array.includes.js\n// module id = 71\n// module chunks = 0","// Polyfill for creating CustomEvents on IE9/10/11\n\n// code pulled from:\n// https://github.com/d4tocchini/customevent-polyfill\n// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent#Polyfill\n\ntry {\n var ce = new window.CustomEvent('test');\n ce.preventDefault();\n if (ce.defaultPrevented !== true) {\n // IE has problems with .preventDefault() on custom events\n // http://stackoverflow.com/questions/23349191\n throw new Error('Could not prevent default');\n }\n} catch(e) {\n var CustomEvent = function(event, params) {\n var evt, origPrevent;\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined\n };\n\n evt = document.createEvent(\"CustomEvent\");\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n origPrevent = evt.preventDefault;\n evt.preventDefault = function () {\n origPrevent.call(this);\n try {\n Object.defineProperty(this, 'defaultPrevented', {\n get: function () {\n return true;\n }\n });\n } catch(e) {\n this.defaultPrevented = true;\n }\n };\n return evt;\n };\n\n CustomEvent.prototype = window.Event.prototype;\n window.CustomEvent = CustomEvent; // expose definition to window\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/custom-event-polyfill/custom-event-polyfill.js\n// module id = 72\n// module chunks = 0","import { createStore } from 'redux';\nimport rootReducer from './../reducers/index';\n\nexport default class Store {\n constructor() {\n this._store = createStore(\n rootReducer,\n window.devToolsExtension ? window.devToolsExtension() : undefined,\n );\n }\n\n /**\n * Subscribe store to function call (wrapped Redux method)\n * @param {Function} onChange Function to trigger when state changes\n * @return\n */\n subscribe(onChange) {\n this._store.subscribe(onChange);\n }\n\n /**\n * Dispatch event to store (wrapped Redux method)\n * @param {Function} action Action function to trigger\n * @return\n */\n dispatch(action) {\n this._store.dispatch(action);\n }\n\n /**\n * Get store object (wrapping Redux method)\n * @return {Object} State\n */\n get state() {\n return this._store.getState();\n }\n\n /**\n * Get items from store\n * @return {Array} Item objects\n */\n get items() {\n return this.state.items;\n }\n\n /**\n * Get active items from store\n * @return {Array} Item objects\n */\n get activeItems() {\n return this.items.filter(item => item.active === true);\n }\n\n /**\n * Get highlighted items from store\n * @return {Array} Item objects\n */\n get highlightedActiveItems() {\n return this.items.filter(item => item.active && item.highlighted);\n }\n\n /**\n * Get choices from store\n * @return {Array} Option objects\n */\n get choices() {\n return this.state.choices;\n }\n\n /**\n * Get active choices from store\n * @return {Array} Option objects\n */\n get activeChoices() {\n const choices = this.choices;\n const values = choices.filter(choice => choice.active === true);\n\n return values;\n }\n\n /**\n * Get selectable choices from store\n * @return {Array} Option objects\n */\n get selectableChoices() {\n return this.choices.filter(choice => choice.disabled !== true);\n }\n\n /**\n * Get choices that can be searched (excluding placeholders)\n * @return {Array} Option objects\n */\n get searchableChoices() {\n return this.selectableChoices.filter(choice => choice.placeholder !== true);\n }\n\n /**\n * Get placeholder choice from store\n * @return {Object} Found placeholder\n */\n get placeholderChoice() {\n return [...this.choices]\n .reverse()\n .find(choice => choice.placeholder === true);\n }\n\n /**\n * Get groups from store\n * @return {Array} Group objects\n */\n get groups() {\n return this.state.groups;\n }\n\n /**\n * Get active groups from store\n * @return {Array} Group objects\n */\n get activeGroups() {\n const groups = this.groups;\n const choices = this.choices;\n\n return groups.filter(group => {\n const isActive = group.active === true && group.disabled === false;\n const hasActiveOptions = choices.some(\n choice => choice.active === true && choice.disabled === false,\n );\n return isActive && hasActiveOptions;\n }, []);\n }\n\n /**\n * Get single choice by it's ID\n * @return {Object} Found choice\n */\n getChoiceById(id) {\n if (id) {\n const choices = this.activeChoices;\n const foundChoice = choices.find(\n choice => choice.id === parseInt(id, 10),\n );\n return foundChoice;\n }\n return false;\n }\n\n /**\n * Get group by group id\n * @param {Number} id Group ID\n * @return {Object} Group data\n */\n getGroupById(id) {\n return this.groups.find(group => group.id === parseInt(id, 10));\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/store/store.js","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/lodash-es/_freeGlobal.js\n// module id = 74\n// module chunks = 0","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/symbol-observable/es/index.js\n// module id = 75\n// module chunks = 0","module.exports = function(originalModule) {\r\n\tif(!originalModule.webpackPolyfill) {\r\n\t\tvar module = Object.create(originalModule);\r\n\t\t// module.parent = undefined by default\r\n\t\tif(!module.children) module.children = [];\r\n\t\tObject.defineProperty(module, \"loaded\", {\r\n\t\t\tenumerable: true,\r\n\t\t\tget: function() {\r\n\t\t\t\treturn module.l;\r\n\t\t\t}\r\n\t\t});\r\n\t\tObject.defineProperty(module, \"id\", {\r\n\t\t\tenumerable: true,\r\n\t\t\tget: function() {\r\n\t\t\t\treturn module.i;\r\n\t\t\t}\r\n\t\t});\r\n\t\tObject.defineProperty(module, \"exports\", {\r\n\t\t\tenumerable: true,\r\n\t\t});\r\n\t\tmodule.webpackPolyfill = 1;\r\n\t}\r\n\treturn module;\r\n};\r\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/harmony-module.js\n// module id = 76\n// module chunks = 0","export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/symbol-observable/es/ponyfill.js\n// module id = 77\n// module chunks = 0","import { combineReducers } from 'redux';\nimport items from './items';\nimport groups from './groups';\nimport choices from './choices';\nimport { cloneObject } from '../lib/utils';\n\nconst appReducer = combineReducers({\n items,\n groups,\n choices,\n});\n\nconst rootReducer = (passedState, action) => {\n let state = passedState;\n // If we are clearing all items, groups and options we reassign\n // state and then pass that state to our proper reducer. This isn't\n // mutating our actual state\n // See: http://stackoverflow.com/a/35641992\n if (action.type === 'CLEAR_ALL') {\n state = undefined;\n } else if (action.type === 'RESET_TO') {\n return cloneObject(action.state);\n }\n\n return appReducer(state, action);\n};\n\nexport default rootReducer;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/reducers/index.js","export const defaultState = [];\n\nexport default function items(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_ITEM': {\n // Add object to items array\n const newState = [\n ...state,\n {\n id: action.id,\n choiceId: action.choiceId,\n groupId: action.groupId,\n value: action.value,\n label: action.label,\n active: true,\n highlighted: false,\n customProperties: action.customProperties,\n placeholder: action.placeholder || false,\n keyCode: null,\n },\n ];\n\n return newState.map(obj => {\n const item = obj;\n item.highlighted = false;\n return item;\n });\n }\n\n case 'REMOVE_ITEM': {\n // Set item to inactive\n return state.map(obj => {\n const item = obj;\n if (item.id === action.id) {\n item.active = false;\n }\n return item;\n });\n }\n\n case 'HIGHLIGHT_ITEM': {\n return state.map(obj => {\n const item = obj;\n if (item.id === action.id) {\n item.highlighted = action.highlighted;\n }\n return item;\n });\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/reducers/items.js","export const defaultState = [];\n\nexport default function groups(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_GROUP': {\n return [\n ...state,\n {\n id: action.id,\n value: action.value,\n active: action.active,\n disabled: action.disabled,\n },\n ];\n }\n\n case 'CLEAR_CHOICES': {\n return [];\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/reducers/groups.js","export const defaultState = [];\n\nexport default function choices(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_CHOICE': {\n /*\n A disabled choice appears in the choice dropdown but cannot be selected\n A selected choice has been added to the passed input's value (added as an item)\n An active choice appears within the choice dropdown\n */\n return [\n ...state,\n {\n id: action.id,\n elementId: action.elementId,\n groupId: action.groupId,\n value: action.value,\n label: action.label || action.value,\n disabled: action.disabled || false,\n selected: false,\n active: true,\n score: 9999,\n customProperties: action.customProperties,\n placeholder: action.placeholder || false,\n keyCode: null,\n },\n ];\n }\n\n case 'ADD_ITEM': {\n // If all choices need to be activated\n if (action.activateOptions) {\n return state.map(obj => {\n const choice = obj;\n choice.active = action.active;\n return choice;\n });\n }\n\n // When an item is added and it has an associated choice,\n // we want to disable it so it can't be chosen again\n if (action.choiceId > -1) {\n return state.map(obj => {\n const choice = obj;\n if (choice.id === parseInt(action.choiceId, 10)) {\n choice.selected = true;\n }\n return choice;\n });\n }\n\n return state;\n }\n\n case 'REMOVE_ITEM': {\n // When an item is removed and it has an associated choice,\n // we want to re-enable it so it can be chosen again\n if (action.choiceId > -1) {\n return state.map(obj => {\n const choice = obj;\n if (choice.id === parseInt(action.choiceId, 10)) {\n choice.selected = false;\n }\n return choice;\n });\n }\n\n return state;\n }\n\n case 'FILTER_CHOICES': {\n return state.map(obj => {\n const choice = obj;\n // Set active state based on whether choice is\n // within filtered results\n choice.active = action.results.some(({ item, score }) => {\n if (item.id === choice.id) {\n choice.score = score;\n return true;\n }\n return false;\n });\n\n return choice;\n });\n }\n\n case 'ACTIVATE_CHOICES': {\n return state.map(obj => {\n const choice = obj;\n choice.active = action.active;\n return choice;\n });\n }\n\n case 'CLEAR_CHOICES': {\n return defaultState;\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/reducers/choices.js","import Dropdown from './dropdown';\nimport Container from './container';\nimport Input from './input';\nimport List from './list';\nimport WrappedInput from './wrapped-input';\nimport WrappedSelect from './wrapped-select';\n\nexport { Dropdown, Container, Input, List, WrappedInput, WrappedSelect };\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/index.js","export default class Dropdown {\n constructor({ element, type, classNames }) {\n Object.assign(this, { element, type, classNames });\n\n this.isActive = false;\n }\n\n /**\n * Determine how far the top of our element is from\n * the top of the window\n * @return {Number} Vertical position\n */\n distanceFromTopWindow() {\n this.dimensions = this.element.getBoundingClientRect();\n this.position = Math.ceil(\n this.dimensions.top + window.pageYOffset + this.element.offsetHeight,\n );\n return this.position;\n }\n\n /**\n * Find element that matches passed selector\n * @return {HTMLElement}\n */\n getChild(selector) {\n return this.element.querySelector(selector);\n }\n\n /**\n * Show dropdown to user by adding active state class\n * @return {Object} Class instance\n * @public\n */\n show() {\n this.element.classList.add(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isActive = true;\n return this;\n }\n\n /**\n * Hide dropdown from user\n * @return {Object} Class instance\n * @public\n */\n hide() {\n this.element.classList.remove(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'false');\n this.isActive = false;\n return this;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/dropdown.js","import { getWindowHeight, wrap } from '../lib/utils';\n\nexport default class Container {\n constructor({ element, type, classNames, position }) {\n Object.assign(this, { element, classNames, type, position });\n\n this.isOpen = false;\n this.isFlipped = false;\n this.isFocussed = false;\n this.isDisabled = false;\n this.isLoading = false;\n\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n }\n\n /**\n * Add event listeners\n */\n addEventListeners() {\n this.element.addEventListener('focus', this._onFocus);\n this.element.addEventListener('blur', this._onBlur);\n }\n\n /**\n * Remove event listeners\n */\n\n /** */\n removeEventListeners() {\n this.element.removeEventListener('focus', this._onFocus);\n this.element.removeEventListener('blur', this._onBlur);\n }\n\n /**\n * Determine whether container should be flipped\n * based on passed dropdown position\n * @param {Number} dropdownPos\n * @returns\n */\n shouldFlip(dropdownPos, windowHeight = getWindowHeight()) {\n if (dropdownPos === undefined) {\n return false;\n }\n\n // If flip is enabled and the dropdown bottom position is\n // greater than the window height flip the dropdown.\n let shouldFlip = false;\n if (this.position === 'auto') {\n shouldFlip = dropdownPos >= windowHeight;\n } else if (this.position === 'top') {\n shouldFlip = true;\n }\n\n return shouldFlip;\n }\n\n /**\n * Set active descendant attribute\n * @param {Number} activeDescendant ID of active descendant\n */\n setActiveDescendant(activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n }\n\n /**\n * Remove active descendant attribute\n */\n removeActiveDescendant() {\n this.element.removeAttribute('aria-activedescendant');\n }\n\n open(dropdownPos) {\n this.element.classList.add(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isOpen = true;\n\n if (this.shouldFlip(dropdownPos)) {\n this.element.classList.add(this.classNames.flippedState);\n this.isFlipped = true;\n }\n }\n\n close() {\n this.element.classList.remove(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'false');\n this.removeActiveDescendant();\n this.isOpen = false;\n\n // A dropdown flips if it does not have space within the page\n if (this.isFlipped) {\n this.element.classList.remove(this.classNames.flippedState);\n this.isFlipped = false;\n }\n }\n\n focus() {\n if (!this.isFocussed) {\n this.element.focus();\n }\n }\n\n addFocusState() {\n this.element.classList.add(this.classNames.focusState);\n }\n\n removeFocusState() {\n this.element.classList.remove(this.classNames.focusState);\n }\n\n /**\n * Remove disabled state\n */\n enable() {\n this.element.classList.remove(this.classNames.disabledState);\n this.element.removeAttribute('aria-disabled');\n if (this.type === 'select-one') {\n this.element.setAttribute('tabindex', '0');\n }\n this.isDisabled = false;\n }\n\n /**\n * Set disabled state\n */\n disable() {\n this.element.classList.add(this.classNames.disabledState);\n this.element.setAttribute('aria-disabled', 'true');\n if (this.type === 'select-one') {\n this.element.setAttribute('tabindex', '-1');\n }\n this.isDisabled = true;\n }\n\n wrap(element) {\n wrap(element, this.element);\n }\n\n unwrap(element) {\n // Move passed element outside this element\n this.element.parentNode.insertBefore(element, this.element);\n // Remove this element\n this.element.parentNode.removeChild(this.element);\n }\n\n /**\n * Add loading state to element\n */\n addLoadingState() {\n this.element.classList.add(this.classNames.loadingState);\n this.element.setAttribute('aria-busy', 'true');\n this.isLoading = true;\n }\n\n /**\n * Remove loading state from element\n */\n removeLoadingState() {\n this.element.classList.remove(this.classNames.loadingState);\n this.element.removeAttribute('aria-busy');\n this.isLoading = false;\n }\n\n /**\n * Set focussed state\n */\n _onFocus() {\n this.isFocussed = true;\n }\n\n /**\n * Remove blurred state\n */\n _onBlur() {\n this.isFocussed = false;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/container.js","import { calcWidthOfInput, stripHTML } from '../lib/utils';\n\nexport default class Input {\n constructor({ element, type, classNames, placeholderValue }) {\n Object.assign(this, { element, type, classNames, placeholderValue });\n\n this.element = element;\n this.classNames = classNames;\n this.isFocussed = this.element === document.activeElement;\n this.isDisabled = false;\n\n // Bind event listeners\n this._onPaste = this._onPaste.bind(this);\n this._onInput = this._onInput.bind(this);\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n }\n\n set placeholder(placeholder) {\n this.element.placeholder = placeholder;\n }\n\n set value(value) {\n this.element.value = `${value}`;\n }\n\n get value() {\n return stripHTML(this.element.value);\n }\n\n addEventListeners() {\n this.element.addEventListener('input', this._onInput);\n this.element.addEventListener('paste', this._onPaste);\n this.element.addEventListener('focus', this._onFocus);\n this.element.addEventListener('blur', this._onBlur);\n\n if (this.element.form) {\n this.element.form.addEventListener('reset', this._onFormReset);\n }\n }\n\n removeEventListeners() {\n this.element.removeEventListener('input', this._onInput);\n this.element.removeEventListener('paste', this._onPaste);\n this.element.removeEventListener('focus', this._onFocus);\n this.element.removeEventListener('blur', this._onBlur);\n\n if (this.element.form) {\n this.element.form.removeEventListener('reset', this._onFormReset);\n }\n }\n\n enable() {\n this.element.removeAttribute('disabled');\n this.isDisabled = false;\n }\n\n disable() {\n this.element.setAttribute('disabled', '');\n this.isDisabled = true;\n }\n\n focus() {\n if (!this.isFocussed) {\n this.element.focus();\n }\n }\n\n blur() {\n if (this.isFocussed) {\n this.element.blur();\n }\n }\n\n /**\n * Set value of input to blank\n * @return {Object} Class instance\n * @public\n */\n clear(setWidth = true) {\n if (this.element.value) {\n this.element.value = '';\n }\n\n if (setWidth) {\n this.setWidth();\n }\n\n return this;\n }\n\n /**\n * Set the correct input width based on placeholder\n * value or input value\n * @return\n */\n setWidth(enforceWidth) {\n const callback = width => {\n this.element.style.width = width;\n };\n\n if (this._placeholderValue) {\n // If there is a placeholder, we only want to set the width of the input when it is a greater\n // length than 75% of the placeholder. This stops the input jumping around.\n const valueHasDesiredLength =\n this.element.value.length >= this._placeholderValue.length / 1.25;\n\n if ((this.element.value && valueHasDesiredLength) || enforceWidth) {\n this.calcWidth(callback);\n }\n } else {\n // If there is no placeholder, resize input to contents\n this.calcWidth(callback);\n }\n }\n\n calcWidth(callback) {\n return calcWidthOfInput(this.element, callback);\n }\n\n setActiveDescendant(activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n }\n\n removeActiveDescendant() {\n this.element.removeAttribute('aria-activedescendant');\n }\n\n _onInput() {\n if (this.type !== 'select-one') {\n this.setWidth();\n }\n }\n\n _onPaste(event) {\n const { target } = event;\n // Disable pasting into the input if option has been set\n if (target === this.element && this.preventPaste) {\n event.preventDefault();\n }\n }\n\n _onFocus() {\n this.isFocussed = true;\n }\n\n _onBlur() {\n this.isFocussed = false;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/input.js","import { SCROLLING_SPEED } from '../constants';\n\nexport default class List {\n constructor({ element }) {\n Object.assign(this, { element });\n\n this.scrollPos = this.element.scrollTop;\n this.height = this.element.offsetHeight;\n this.hasChildren = !!this.element.children;\n }\n\n clear() {\n this.element.innerHTML = '';\n }\n\n append(node) {\n this.element.appendChild(node);\n }\n\n getChild(selector) {\n return this.element.querySelector(selector);\n }\n\n scrollToTop() {\n this.element.scrollTop = 0;\n }\n\n scrollToChoice(choice, direction) {\n if (!choice) {\n return;\n }\n\n const dropdownHeight = this.element.offsetHeight;\n const choiceHeight = choice.offsetHeight;\n // Distance from bottom of element to top of parent\n const choicePos = choice.offsetTop + choiceHeight;\n // Scroll position of dropdown\n const containerScrollPos = this.element.scrollTop + dropdownHeight;\n // Difference between the choice and scroll position\n const endpoint =\n direction > 0\n ? this.element.scrollTop + choicePos - containerScrollPos\n : choice.offsetTop;\n\n requestAnimationFrame(time => {\n this._animateScroll(time, endpoint, direction);\n });\n }\n\n _scrollDown(scrollPos, strength, endpoint) {\n const easing = (endpoint - scrollPos) / strength;\n const distance = easing > 1 ? easing : 1;\n\n this.element.scrollTop = scrollPos + distance;\n }\n\n _scrollUp(scrollPos, strength, endpoint) {\n const easing = (scrollPos - endpoint) / strength;\n const distance = easing > 1 ? easing : 1;\n\n this.element.scrollTop = scrollPos - distance;\n }\n\n _animateScroll(time, endpoint, direction) {\n const strength = SCROLLING_SPEED;\n const choiceListScrollTop = this.element.scrollTop;\n let continueAnimation = false;\n\n if (direction > 0) {\n this._scrollDown(choiceListScrollTop, strength, endpoint);\n\n if (choiceListScrollTop < endpoint) {\n continueAnimation = true;\n }\n } else {\n this._scrollUp(choiceListScrollTop, strength, endpoint);\n\n if (choiceListScrollTop > endpoint) {\n continueAnimation = true;\n }\n }\n\n if (continueAnimation) {\n requestAnimationFrame(() => {\n this._animateScroll(time, endpoint, direction);\n });\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/list.js","import WrappedElement from './wrapped-element';\nimport { reduceToValues } from './../lib/utils';\n\nexport default class WrappedInput extends WrappedElement {\n constructor({ element, classNames, delimiter }) {\n super({ element, classNames });\n this.delimiter = delimiter;\n }\n\n set value(items) {\n const itemsFiltered = reduceToValues(items);\n const itemsFilteredString = itemsFiltered.join(this.delimiter);\n\n this.element.setAttribute('value', itemsFilteredString);\n this.element.value = itemsFilteredString;\n }\n\n // @todo figure out why we need this? Perhaps a babel issue\n get value() {\n return super.value;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/wrapped-input.js","import WrappedElement from './wrapped-element';\nimport templates from './../templates';\n\nexport default class WrappedSelect extends WrappedElement {\n constructor({ element, classNames }) {\n super({ element, classNames });\n }\n\n get placeholderOption() {\n return this.element.querySelector('option[placeholder]');\n }\n\n get optionGroups() {\n return Array.from(this.element.getElementsByTagName('OPTGROUP'));\n }\n\n get options() {\n return Array.from(this.element.options);\n }\n\n set options(options) {\n const fragment = document.createDocumentFragment();\n const addOptionToFragment = data => {\n // Create a standard select option\n const template = templates.option(data);\n // Append it to fragment\n fragment.appendChild(template);\n };\n\n // Add each list item to list\n options.forEach(optionData => addOptionToFragment(optionData));\n\n this.appendDocFragment(fragment);\n }\n\n appendDocFragment(fragment) {\n this.element.innerHTML = '';\n this.element.appendChild(fragment);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/components/wrapped-select.js","/*!\n Copyright (c) 2016 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tclasses.push(classNames.apply(null, arg));\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 89\n// module chunks = 0","import { ACTION_TYPES } from './../constants';\n\nexport const addChoice = ({\n value,\n label,\n id,\n groupId,\n disabled,\n elementId,\n customProperties,\n placeholder,\n keyCode,\n}) => ({\n type: ACTION_TYPES.ADD_CHOICE,\n value,\n label,\n id,\n groupId,\n disabled,\n elementId,\n customProperties,\n placeholder,\n keyCode,\n});\n\nexport const filterChoices = results => ({\n type: ACTION_TYPES.FILTER_CHOICES,\n results,\n});\n\nexport const activateChoices = (active = true) => ({\n type: ACTION_TYPES.ACTIVATE_CHOICES,\n active,\n});\n\nexport const clearChoices = () => ({\n type: ACTION_TYPES.CLEAR_CHOICES,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/actions/choices.js","import { ACTION_TYPES } from './../constants';\n\nexport const addItem = ({\n value,\n label,\n id,\n choiceId,\n groupId,\n customProperties,\n placeholder,\n keyCode,\n}) => ({\n type: ACTION_TYPES.ADD_ITEM,\n value,\n label,\n id,\n choiceId,\n groupId,\n customProperties,\n placeholder,\n keyCode,\n});\n\nexport const removeItem = (id, choiceId) => ({\n type: ACTION_TYPES.REMOVE_ITEM,\n id,\n choiceId,\n});\n\nexport const highlightItem = (id, highlighted) => ({\n type: ACTION_TYPES.HIGHLIGHT_ITEM,\n id,\n highlighted,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/actions/items.js","import { ACTION_TYPES } from './../constants';\n\n/* eslint-disable import/prefer-default-export */\nexport const addGroup = (value, id, active, disabled) => ({\n type: ACTION_TYPES.ADD_GROUP,\n value,\n id,\n active,\n disabled,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/actions/groups.js","export const clearAll = () => ({\n type: 'CLEAR_ALL',\n});\n\nexport const resetTo = state => ({\n type: 'RESET_TO',\n state,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/actions/misc.js"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAKA;AAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAPA;AACA;AAQA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACvSA;AACA;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AACA;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AADA;AAGA;AACA;AACA;AA3CA;AACA;AA6CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;;;;;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACfA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;;;;;;;ACFA;AACA;AACA;AACA;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACPA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnBA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;;;;;;;ACAA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC9BA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACXA;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtBA;AACA;AACA;AACA;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACRA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACdA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACpBA;AACA;;;AACA;AACA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AA3DA;AACA;AACA;;;;;;AAbA;;;;;;;;;;;;;;ACFA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AAGA;AACA;AAAA;AACA;AAAA;AACA;AAIA;AAGA;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAKA;AAAA;AACA;AAAA;AACA;AAKA;AAqBA;AACA;AACA;AAYA;AACA;AACA;AACA;AAGA;AASA;AACA;AACA;AACA;AACA;AAGA;AAYA;AACA;AAAA;AACA;AAAA;AACA;AACA;AASA;AAkBA;AACA;AACA;AACA;AAIA;AAWA;AACA;AACA;AACA;AAIA;AAOA;AACA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAQA;AAKA;AACA;AACA;AAKA;AAlOA;AACA;AAoOA;;;;;;;;;;;;;;;;;;ACxOA;AACA;;;AAAA;AACA;;;AACA;AACA;AAAA;AACA;;;AAAA;AACA;AAOA;AACA;AAAA;AACA;AAAA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;;;;;;;;;AAiBA;;;;AAIA;AACA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAzBA;AA2BA;AACA;AAAA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;;;AAEA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AAAA;AAAA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;AAEA;AAAA;AAAA;AACA;AADA;AACA;AADA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAIA;AACA;AACA;AACA;AAIA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAGA;AACA;AAIA;AACA;AAKA;AACA;AAIA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AAAA;AAEA;AACA;AACA;AACA;AAIA;AATA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAFA;AAAA;AAAA;AAAA;AACA;AAOA;AACA;AACA;AAIA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AA/BA;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AAvCA;AAAA;AACA;AA0CA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AADA;AAAA;AAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AAGA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AACA;AAOA;AACA;AACA;;;AAEA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AALA;AAAA;AAAA;AACA;AAMA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AAGA;AACA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AA0BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AAWA;AACA;;;AAEA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAMA;AACA;AAAA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AAGA;AACA;AACA;AAGA;AACA;AAKA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AAAA;AAEA;AACA;AAAA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AAEA;AACA;AAEA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnBA;AACA;AAqBA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAIA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA3BA;AACA;AA6BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAUA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AACA;AAQA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;;;AAWA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;;;AAEA;AACA;AACA;;;AAEA;AAAA;AACA;AADA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA;AASA;AACA;AACA;AACA;AACA;AAGA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AACA;AADA;AAAA;AAAA;AACA;AAKA;AACA;;;AAEA;AAAA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AAQA;AACA;AACA;AAXA;AACA;AAaA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AADA;AACA;AAGA;AACA;AADA;AACA;AAGA;AACA;AACA;AACA;AAHA;AAKA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AAAA;AAEA;AACA;AAFA;AADA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AADA;AAGA;AACA;AACA;AACA;AAAA;AAAA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AANA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AADA;AAGA;AACA;AAxCA;AACA;AA0CA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA;AASA;AACA;;;AAEA;AACA;AAEA;AACA;AACA;AAGA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;;;;;;AAEA;AACA;AACA;;;;;;AC5hEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACn+BA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACxFA;AACA;AAAA;AACA;AAAA;AACA;AAAA;;;;;;ACHA;AACA;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;AACA;AACA;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACXA;AACA;AACA;AACA;;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC3CA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACfA;AACA;AACA;AACA;AACA;;;;;;;ACJA;AACA;AACA;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACNA;AACA;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACrBA;AACA;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC3CA;AACA;AAAA;AACA;;;;;;;;;AACA;AACA;AAAA;AACA;AAAA;AAIA;AACA;AACA;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;;;;;;;;;AAsGA;;;;AAIA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AAAA;AAAA;AACA;;;AAxHA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AAEA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;;;;;;AA9HA;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;;ACHA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACvBA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AChBA;AACA;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AACA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACzBA;AACA;;;AAHA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AACA;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAjDA;AAmDA;;;;;;;;;;;;ACpDA;AACA;;;AAHA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAGA;AACA;AACA;AACA;AAJA;AAOA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAnBA;AAqBA;;;;;;;;;;;;ACtBA;AACA;;;AAHA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;;;;;AAKA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA;AAeA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAlGA;AAoGA;;;;;;;;;;;;;;ACvGA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;ACPA;AACA;AAAA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAKA;AACA;AACA;AAGA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;AAlDA;;;;;;;;;;;;;;;ACAA;AACA;;;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;;;;;;AA7KA;;;;;;;;;;;;;;;ACFA;AACA;;;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAaA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AAEA;AACA;AAAA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAlIA;AACA;AACA;;;AAEA;AACA;AACA;AAEA;AACA;AACA;;;;;;AA1BA;;;;;;;;;;;;;;;ACFA;AACA;;;AACA;AACA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AArFA;;;;;;;;;;;;;;;;;ACFA;AACA;;;AAAA;AACA;;;;;;;;;AACA;;;AACA;AAAA;AAAA;AAAA;AACA;AADA;AACA;AADA;AACA;AACA;AAFA;AAGA;AACA;;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;;;;AAjBA;;;;;;;;;;;;;;;ACHA;AACA;;;AAAA;AACA;;;;;;;;;;;AACA;;;AACA;AAAA;AAAA;AACA;AADA;AACA;AADA;AAEA;AACA;;;AA4BA;AACA;AACA;AACA;;;AA9BA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;AA9BA;;;;;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC/CA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAVA;AACA;AAsBA;AAAA;AACA;AACA;AAFA;AAAA;AACA;AAIA;AAAA;AAAA;AACA;AACA;AAFA;AAAA;AACA;AAIA;AAAA;AACA;AADA;AAAA;;;;;;;;;;;;;;ACnCA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AATA;AACA;AAoBA;AAAA;AACA;AACA;AACA;AAHA;AAAA;AACA;AAKA;AAAA;AACA;AACA;AACA;AAHA;AAAA;;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AALA;AAAA;;;;;;;;;;;;ACHA;AAAA;AACA;AADA;AAAA;AACA;AAGA;AAAA;AACA;AACA;AAFA;AAAA;;;;A","sourceRoot":""}
diff --git a/public/assets/scripts/choices.min.js b/public/assets/scripts/choices.min.js
index beb5b24..3a2dd01 100644
--- a/public/assets/scripts/choices.min.js
+++ b/public/assets/scripts/choices.min.js
@@ -1,2 +1,58 @@
/*! choices.js v4.1.4 | (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()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/public/assets/scripts/",t(t.s=37)}([function(e,t,n){var i=n(26)("wks"),r=n(13),o=n(3).Symbol,s="function"==typeof o;(e.exports=function(e){return i[e]||(i[e]=s&&o[e]||(s?o:r)("Symbol."+e))}).store=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)},r=t.generateChars=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));return r[r.indexOf(e)+(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}},t.stripHTML=function(e){return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"+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,i+"px")})}else t.call(void 0,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){var n=e.exports={version:"2.5.7"};"number"==typeof __e&&(__e=n)},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){var i=n(7),r=n(12);e.exports=n(10)?function(e,t,n){return i.f(e,t,r(1,n))}:function(e,t,n){return e[t]=n,e}},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(1),r=t.DEFAULT_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"};t.DEFAULT_CONFIG={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 "'+(0,i.stripHTML)(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:r},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){var i=n(3),r=n(2),o=n(4),s=n(24),a=n(14),c=function(e,t,n){var l,u,h,d,f=e&c.F,p=e&c.G,v=e&c.S,m=e&c.P,g=e&c.B,y=p?i:v?i[t]||(i[t]={}):(i[t]||{}).prototype,_=p?r:r[t]||(r[t]={}),b=_.prototype||(_.prototype={});p&&(n=t);for(l in n)u=!f&&y&&void 0!==y[l],h=(u?y:n)[l],d=g&&u?a(h,i):m&&"function"==typeof h?a(Function.call,h):h,y&&s(y,l,h,e&c.U),_[l]!=h&&o(_,l,d),m&&b[l]!=h&&(b[l]=h)};i.core=r,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,e.exports=c},function(e,t,n){var i=n(8),r=n(44),o=n(45),s=Object.defineProperty;t.f=n(10)?Object.defineProperty:function(e,t,n){if(i(e),t=o(t,!0),i(n),r)try{return s(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){var i=n(9);e.exports=function(e){if(!i(e))throw TypeError(e+" is not an object!");return e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){e.exports=!n(22)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t){var n=0,i=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},function(e,t,n){var i=n(46);e.exports=function(e,t,n){if(i(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,i){return e.call(t,n,i)};case 3:return function(n,i,r){return e.call(t,n,i,r)}}return function(){return e.apply(t,arguments)}}},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var i=n(17);e.exports=function(e){return Object(i(e))}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var i=n(19),r=Math.min;e.exports=function(e){return e>0?r(i(e),9007199254740991):0}},function(e,t){var n=Math.ceil,i=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},function(e,t){e.exports={}},function(e,t,n){var i=n(26)("keys"),r=n(13);e.exports=function(e){return i[e]||(i[e]=r(e))}},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t,n){var i=n(9),r=n(3).document,o=i(r)&&i(r.createElement);e.exports=function(e){return o?r.createElement(e):{}}},function(e,t,n){var i=n(3),r=n(4),o=n(11),s=n(13)("src"),a=Function.toString,c=(""+a).split("toString");n(2).inspectSource=function(e){return a.call(e)},(e.exports=function(e,t,n,a){var l="function"==typeof n;l&&(o(n,"name")||r(n,"name",t)),e[t]!==n&&(l&&(o(n,s)||r(n,s,e[t]?""+e[t]:c.join(String(t)))),e===i?e[t]=n:a?e[t]?e[t]=n:r(e,t,n):(delete e[t],r(e,t,n)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[s]||a.call(this)})},function(e,t,n){var i=n(15);e.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==i(e)?e.split(""):Object(e)}},function(e,t,n){var i=n(2),r=n(3),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(e.exports=function(e,t){return o[e]||(o[e]=void 0!==t?t:{})})("versions",[]).push({version:i.version,mode:n(27)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(e,t){e.exports=!1},function(e,t,n){var i=n(0)("unscopables"),r=Array.prototype;void 0==r[i]&&n(4)(r,i,{}),e.exports=function(e){r[i][e]=!0}},function(e,t,n){var i=n(25),r=n(17);e.exports=function(e){return i(r(e))}},function(e,t,n){var i=n(29),r=n(18),o=n(60);e.exports=function(e){return function(t,n,s){var a,c=i(t),l=r(c.length),u=o(s,l);if(e&&n!=n){for(;l>u;)if((a=c[u++])!=a)return!0}else for(;l>u;u++)if((e||u in c)&&c[u]===n)return e||u||0;return!e&&-1}}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var i=n(7).f,r=n(11),o=n(0)("toStringTag");e.exports=function(e,t,n){e&&!r(e=n?e:e.prototype,o)&&i(e,o,{configurable:!0,value:t})}},function(e,t,n){"use strict";function i(e){var t=I.call(e,w),n=e[w];try{e[w]=void 0;var i=!0}catch(e){}var r=C.call(e);return i&&(t?e[w]=n:delete e[w]),r}function r(e){return k.call(e)}function o(e){return null==e?void 0===e?P:L:D&&D in Object(e)?A(e):x(e)}function s(e,t){return function(n){return e(t(n))}}function a(e){return null!=e&&"object"==typeof e}function c(e){if(!K(e)||j(e)!=R)return!1;var t=N(e);if(null===t)return!0;var n=Y.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&B.call(n)==G}function l(e,t,n){function i(){p===f&&(p=f.slice())}function r(){return d}function o(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return i(),p.push(e),function(){if(t){t=!1,i();var n=p.indexOf(e);p.splice(n,1)}}}function s(e){if(!W(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(v)throw new Error("Reducers may not dispatch actions.");try{v=!0,d=h(d,e)}finally{v=!1}for(var t=f=p,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var i=!1,r={},a=0;a\n \n ')},containerInner:function(e){return(0,s.strToEl)('\n \n ')},itemList:function(e,t){var n,r=(0,o.default)(e.list,(n={},i(n,e.listSingle,t),i(n,e.listItems,!t),n));return(0,s.strToEl)('\n \n ')},placeholder:function(e,t){return(0,s.strToEl)('\n \n '+t+"\n
\n ")},item:function(e,t,n){var r,a=t.active?'aria-selected="true"':"",c=t.disabled?'aria-disabled="true"':"",l=(0,o.default)(e.item,(r={},i(r,e.highlightedState,t.highlighted),i(r,e.itemSelectable,!t.highlighted),i(r,e.placeholder,t.placeholder),r));if(n){var u;return l=(0,o.default)(e.item,(u={},i(u,e.highlightedState,t.highlighted),i(u,e.itemSelectable,!t.disabled),i(u,e.placeholder,t.placeholder),u)),(0,s.strToEl)('\n \n "+t.label+'\x3c!--\n --\x3e\n
\n ")}return(0,s.strToEl)('\n \n "+t.label+"\n
\n ")},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return(0,s.strToEl)('\n \n
\n ")},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",r=(0,o.default)(e.group,i({},e.itemDisabled,t.disabled));return(0,s.strToEl)('\n \n ")},choice:function(e,t,n){var r,a=t.groupId>0?'role="treeitem"':'role="option"',c=(0,o.default)(e.item,e.itemChoice,(r={},i(r,e.itemDisabled,t.disabled),i(r,e.itemSelectable,!t.disabled),i(r,e.placeholder,t.placeholder),r));return(0,s.strToEl)('\n \n "+t.label+"\n
\n ")},input:function(e){var t=(0,o.default)(e.input,e.inputCloned);return(0,s.strToEl)('\n \n ')},dropdown:function(e){var t=(0,o.default)(e.list,e.listDropdown);return(0,s.strToEl)('\n \n
\n ')},notice:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=(0,o.default)(e.item,e.itemChoice,(n={},i(n,e.noResults,"no-results"===r),i(n,e.noChoices,"no-choices"===r),n));return(0,s.strToEl)('\n \n '+t+"\n
\n ")},option:function(e){return(0,s.strToEl)('\n \n ")}};t.default=a},function(e,t,n){e.exports=n(38)},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,e),(0,E.isType)("String",t)){var i=Array.from(document.querySelectorAll(t));if(i.length>1)return this._generateInstances(i,n)}this.config=h.default.all([v.DEFAULT_CONFIG,e.userDefaults,n],{arrayMerge:function(e,t){return[].concat(o(t))}}),(0,E.doKeysMatch)(this.config,v.DEFAULT_CONFIG)||console.warn("Unknown config option(s) passed"),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto");var r=(0,E.isType)("String",t)?document.querySelector(t):t;return r?(this._isTextElement="text"===r.type,this._isSelectOneElement="select-one"===r.type,this._isSelectMultipleElement="select-multiple"===r.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new p.WrappedInput({element:r,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new p.WrappedSelect({element:r,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 f.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,E.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")}return a(e,[{key:"init",value:function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=(0,E.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,E.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,a=e.label,c=void 0===a?"":a,l=r>=0?this._store.getGroupById(r):null;return this._store.dispatch((0,y.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(v.EVENTS.highlightItem,{id:n,value:s,label:c,groupValue:l&&l.value?l.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,a=void 0===s?"":s,c=i>=0?this._store.getGroupById(i):null;return this._store.dispatch((0,y.highlightItem)(t,!1)),this.passedElement.triggerEvent(v.EVENTS.highlightItem,{id:t,value:o,label:a,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(v.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(v.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(o(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,E.isType)("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._isSelectElement||!e.length||!t)return this;r&&this._clearChoices(),this.containerOuter.removeLoadingState();var o=function(e){e.choices?n._addGroup({group:e,id:e.id||null,valueKey:t,labelKey:i}):n._addChoice({value:e[t],label:e[i],isSelected:e.selected,isDisabled:e.disabled,customProperties:e.customProperties,placeholder:e.placeholder})};return e.forEach(o),this}},{key:"clearStore",value:function(){return this._store.dispatch((0,b.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,g.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(){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=void 0,l=void 0;this._isSearching?(l=(0,E.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,c=this._getTemplate("notice",l,"no-results")):(l=(0,E.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(),o=function(e){return t.filter(function(t){return i._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===i.config.renderSelectedChoices||!t.selected)})};return this.config.shouldSort&&e.sort(this.config.sortFn),e.forEach(function(e){var t=o(e);if(t.length>=1){var n=i._getTemplate("choiceGroup",e);r.appendChild(n),i._createChoicesFragment(t,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(),s=this.config,a=s.renderSelectedChoices,c=s.searchResultLimit,l=s.renderChoiceLimit,u=this._isSearching?E.sortByScore:this.config.sortFn,h=e;"auto"!==a||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,p=d.normalChoices;(this.config.shouldSort||this._isSearching)&&p.sort(u);var v=h.length,m=[].concat(o(f),o(p));this._isSearching?v=c:l>0&&!i&&(v=l);for(var g=0;g1&&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;var c=function(e){var n=t._getTemplate("item",e,s);a.appendChild(n)};return e.forEach(function(e){return c(e)}),a}},{key:"_triggerChange",value:function(e){void 0!==e&&null!==e&&this.passedElement.triggerEvent(v.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(v.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:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild("."+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(v.EVENTS.search,{value:e,resultCount:s})}else o&&(this._isSearching=!1,this._store.dispatch((0,g.activateChoices)(!0)))}}},{key:"_canAddItem",value:function(e,t){var n=!0,i=(0,E.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=(0,E.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=(0,E.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,E.regexFilter)(t,this.config.regexFilter)),!this.config.duplicateItemsAllowed&&r&&n&&(n=!1,i=(0,E.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,E.isType)("Object",t)?[t]:t;r&&(0,E.isType)("Array",r)&&r.length?(e._handleLoadingState(!1),r.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:(0,E.fetchFromObject)(t,n),label:(0,E.fetchFromObject)(t,i),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=(0,E.isType)("String",e)?e.trim():e,n=(0,E.isType)("String",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t===n+" ")return 0;var i=this._store.searchableChoices,r=t,s=[].concat(o(this.config.searchFields)),a=Object.assign(this.config.fuseOptions,{keys:s}),c=new l.default(i,a),u=c.search(r);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,g.filterChoices)(u)),u.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,o=e.ctrlKey,s=e.metaKey;if(n===this.input.element||this.containerOuter.element.contains(n)){var a=this._store.activeItems,c=this.input.isFocussed,l=this.dropdown.isActive,u=this.itemList.hasChildren,h=String.fromCharCode(i),d=v.KEY_CODES.BACK_KEY,f=v.KEY_CODES.DELETE_KEY,p=v.KEY_CODES.ENTER_KEY,m=v.KEY_CODES.A_KEY,g=v.KEY_CODES.ESC_KEY,y=v.KEY_CODES.UP_KEY,_=v.KEY_CODES.DOWN_KEY,b=v.KEY_CODES.PAGE_UP_KEY,E=v.KEY_CODES.PAGE_DOWN_KEY,S=o||s;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var O=(t={},r(t,m,this._onAKey),r(t,p,this._onEnterKey),r(t,g,this._onEscapeKey),r(t,y,this._onDirectionKey),r(t,b,this._onDirectionKey),r(t,_,this._onDirectionKey),r(t,E,this._onDirectionKey),r(t,f,this._onDeleteKey),r(t,d,this._onDeleteKey),t);O[i]&&O[i]({event:e,target:n,keyCode:i,metaKey:s,activeItems:a,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 a=v.KEY_CODES.BACK_KEY,c=v.KEY_CODES.DELETE_KEY;n!==a&&n!==c||t.value?this._canSearch&&o.response&&this._handleSearch(this.input.value):!this._isTextElement&&this._isSearching&&(this._isSearching=!1,this._store.dispatch((0,g.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=v.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 a=this.dropdown.getChild("."+this.config.classNames.highlightedState);a&&(i[0]&&(i[0].keyCode=o),this._handleChoiceAction(i,a)),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=v.KEY_CODES.DOWN_KEY,s=v.KEY_CODES.PAGE_UP_KEY,a=v.KEY_CODES.PAGE_DOWN_KEY;if(n||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=i===o||i===a?1:-1,l=r||i===a||i===s,u=void 0;if(l)u=c>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("."+this.config.classNames.highlightedState);u=h?(0,E.getAdjacentEl)(h,"[data-choice-selectable]",c):this.dropdown.element.querySelector("[data-choice-selectable]")}u&&((0,E.isScrolledIntoView)(u,this.choiceList.element,c)||this.choiceList.scrollToChoice(u,c),this._highlightChoice(u)),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;if(!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,E.isIE11)()&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var i=this._store.activeItems,r=n,o=(0,E.findAncestorByAttrName)(t,"data-button"),s=(0,E.findAncestorByAttrName)(t,"data-item"),a=(0,E.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;if(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());else{this._store.highlightedActiveItems&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0)}}},{key:"_onFocus",value:function(e){var t=this,n=e.target;if(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,r=i.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),r&&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),r&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()}},{key:"_onFormReset",value:function(){this._store.dispatch((0,b.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("."+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(v.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,a=void 0===s?-1:s,c=e.customProperties,l=void 0===c?null:c,u=e.placeholder,h=void 0!==u&&u,d=e.keyCode,f=void 0===d?null:d,p=(0,E.isType)("String",t)?t.trim():t,m=f,g=l,_=this._store.items,b=i||p,S=parseInt(o,10)||-1,O=a>=0?this._store.getGroupById(a):null,I=_?_.length+1:1;return this.config.prependValue&&(p=this.config.prependValue+p.toString()),this.config.appendValue&&(p+=this.config.appendValue.toString()),this._store.dispatch((0,y.addItem)({value:p,label:b,id:I,choiceId:S,groupId:a,customProperties:l,placeholder:h,keyCode:m})),this._isSelectOneElement&&this.removeActiveItems(I),this.passedElement.triggerEvent(v.EVENTS.addItem,{id:I,value:p,label:b,customProperties:g,groupValue:O&&O.value?O.value:void 0,keyCode:m}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,E.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,y.removeItem)(t,r)),s&&s.value?this.passedElement.triggerEvent(v.EVENTS.removeItem,{id:t,value:n,label:i,groupValue:s.value}):this.passedElement.triggerEvent(v.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,l=void 0===c?-1:c,u=e.customProperties,h=void 0===u?null:u,d=e.placeholder,f=void 0!==d&&d,p=e.keyCode,v=void 0===p?null:p;if(void 0!==t&&null!==t){var m=this._store.choices,y=i||t,_=m?m.length+1:1,b=this._baseId+"-"+this._idNames.itemChoice+"-"+_;this._store.dispatch((0,g.addChoice)({value:t,label:y,id:_,groupId:l,disabled:a,elementId:b,customProperties:h,placeholder:f,keyCode:v})),o&&this._addItem({value:t,label:y,choiceId:_,customProperties:h,placeholder:f,keyCode:v})}}},{key:"_clearChoices",value:function(){this._store.dispatch((0,g.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,E.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,_.addGroup)(n.label,l,!0,u));var h=function(e){var n=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[o],label:(0,E.isType)("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:n,groupId:l,customProperties:e.customProperties,placeholder:e.placeholder})};c.forEach(h)}else this._store.dispatch((0,_.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=Array(o>1?o-1:0),a=1;an)return o(e,this.pattern,i);var r=this.options,a=r.location,c=r.distance,l=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return s(e,this.pattern,this.patternAlphabet,{location:a,distance:c,threshold:l,findAllMatches:u,minMatchCharLength:h})}}]),e}();e.exports=c},function(e,t,n){"use strict";var i=n(0),r=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&&void 0!==c)if(a||"string"!=typeof c&&"number"!=typeof c)if(i(c))for(var l=0,u=c.length;l0&&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}},function(e,t,n){"use strict";e.exports=function(e){for(var t={},n=e.length,i=0;i2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(i,"\\$&").replace(n,"|")),o=e.match(r),s=!!o,a=[];if(s)for(var c=0,l=o.length;c=P;M-=1){var F=M-1,N=n[e.charAt(F)];if(N&&(E[F]=1),j[M]=(j[M+1]<<1|1)&N,0!==k&&(j[M]|=(C[M+1]|C[M])<<1|1|C[M+1]),j[M]&T&&(w=i(t,{errors:k,currentLocation:F,expectedLocation:m,distance:l}))<=y){if(y=w,(_=F)<=m)break;P=Math.max(1,2*m-_)}}if(i(t,{errors:k+1,currentLocation:m,expectedLocation:m,distance:l})>y)break;C=j}return{isMatch:_>=0,score:0===w?.001:w,matchedIndices:r(E,v)}}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n0&&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[1],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(void 0!==o&&null!==o){var g=!1,y=-1,_=0;if("string"==typeof o){this._log("\nKey: "+(""===n?"-":n));var b=d.search(o);if(this._log('Full text: "'+o+'", score: '+b.score),this.options.tokenize){for(var E=o.split(this.options.tokenSeparator),S=[],O=0;O-1&&(P=(P+y)/2),this._log("Score average:",P);var D=!this.options.tokenize||!this.options.matchAllTokens||_>=u.length;if(this._log("\nCheck Matches: "+D),(g||b.isMatch)&&D){var j=p[c];j?j.output.push({key:n,arrayIndex:r,value:o,score:P,matchedIndices:b.matchedIndices}):(p[c]={item:s,output:[{key:n,arrayIndex:r,value:o,score:P,matchedIndices:b.matchedIndices}]},m.push(p[c]))}}else if(a(o))for(var M=0,F=o.length;M-1&&(s.arrayIndex=o.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&n.push(function(e,t){t.score=e.score});for(var i=0,r=e.length;i1?arguments[1]:void 0)}}),n(28)("find")},function(e,t,n){e.exports=!n(10)&&!n(22)(function(){return 7!=Object.defineProperty(n(23)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var i=n(9);e.exports=function(e,t){if(!i(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!i(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var i=n(14),r=n(25),o=n(16),s=n(18),a=n(48);e.exports=function(e,t){var n=1==e,c=2==e,l=3==e,u=4==e,h=6==e,d=5==e||h,f=t||a;return function(t,a,p){for(var v,m,g=o(t),y=r(g),_=i(a,p,3),b=s(y.length),E=0,S=n?f(t,b):c?f(t,0):void 0;b>E;E++)if((d||E in y)&&(v=y[E],m=_(v,E,g),e))if(n)S[E]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return E;case 2:S.push(v)}else if(u)return!1;return h?-1:l||u?u:S}}},function(e,t,n){var i=n(49);e.exports=function(e,t){return new(i(e))(t)}},function(e,t,n){var i=n(9),r=n(50),o=n(0)("species");e.exports=function(e){var t;return r(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!r(t.prototype)||(t=void 0),i(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){var i=n(15);e.exports=Array.isArray||function(e){return"Array"==i(e)}},function(e,t,n){n(52),n(63),e.exports=n(2).Array.from},function(e,t,n){"use strict";var i=n(53)(!0);n(54)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var i=n(19),r=n(17);e.exports=function(e){return function(t,n){var o,s,a=String(r(t)),c=i(n),l=a.length;return c<0||c>=l?e?"":void 0:(o=a.charCodeAt(c),o<55296||o>56319||c+1===l||(s=a.charCodeAt(c+1))<56320||s>57343?e?a.charAt(c):o:e?a.slice(c,c+2):s-56320+(o-55296<<10)+65536)}}},function(e,t,n){"use strict";var i=n(27),r=n(6),o=n(24),s=n(4),a=n(20),c=n(55),l=n(32),u=n(62),h=n(0)("iterator"),d=!([].keys&&"next"in[].keys()),f=function(){return this};e.exports=function(e,t,n,p,v,m,g){c(n,t,p);var y,_,b,E=function(e){if(!d&&e in C)return C[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+" Iterator",O="values"==v,I=!1,C=e.prototype,w=C[h]||C["@@iterator"]||v&&C[v],A=w||E(v),T=v?O?E("entries"):A:void 0,k="Array"==t?C.entries||w:w;if(k&&(b=u(k.call(new e)))!==Object.prototype&&b.next&&(l(b,S,!0),i||"function"==typeof b[h]||s(b,h,f)),O&&w&&"values"!==w.name&&(I=!0,A=function(){return w.call(this)}),i&&!g||!d&&!I&&C[h]||s(C,h,A),a[t]=A,a[S]=f,v)if(y={values:O?A:E("values"),keys:m?A:E("keys"),entries:T},g)for(_ in y)_ in C||o(C,_,y[_]);else r(r.P+r.F*(d||I),t,y);return y}},function(e,t,n){"use strict";var i=n(56),r=n(12),o=n(32),s={};n(4)(s,n(0)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(s,{next:r(1,n)}),o(e,t+" Iterator")}},function(e,t,n){var i=n(8),r=n(57),o=n(31),s=n(21)("IE_PROTO"),a=function(){},c=function(){var e,t=n(23)("iframe"),i=o.length;for(t.style.display="none",n(61).appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("