Choices/assets/scripts/dist/bundle.js

2 lines
35 KiB
JavaScript

!function(e){function t(n){if(i[n])return i[n].exports;var s=i[n]={exports:{},id:n,loaded:!1};return e[n].call(s.exports,s,s.exports,t),s.loaded=!0,s.exports}var i={};return t.m=e,t.c=i,t.p="/assets/scripts/dist/",t(0)}([function(e,t,i){e.exports=i(1)},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.Choices=void 0;var o=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),r=i(2),a=i(13),l=n(a),c=i(17),u=i(18),d=i(19),h=n(d),p=t.Choices=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?"[data-choice]":arguments[0],i=arguments[1];s(this,e);var n=document.createElement("fakeel"),o="querySelector"in document&&"addEventListener"in document&&"classList"in n;o||console.error("init: Your browser doesn'nt support Choices");var a=i||{};if((0,u.isType)("String",t)){var c=document.querySelectorAll(t);if(c.length>1)for(var d=1;d<c.length;d++){var h=c[d];new e(h,i)}}var p={items:[],addItems:!0,removeItems:!0,editItems:!1,maxItems:!1,delimiter:",",allowDuplicates:!0,allowPaste:!0,allowSearch:!0,regexFilter:!1,debug:!1,placeholder:!0,placeholderValue:"",prependValue:!1,appendValue:!1,selectAll:!0,classNames:{containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--items",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemOption:"choices__item--option",group:"choices__group",groupHeading:"choices__heading",activeState:"is-active",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",selectedState:"is-selected"},callbackOnInit:function(){},callbackOnRender:function(){},callbackOnRemoveItem:function(){},callbackOnAddItem:function(){}};this.initialised=!1,this.options=(0,u.extend)(p,a||{}),this.store=(0,r.createStore)(l.default),this.passedElement=(0,u.isType)("String",t)?document.querySelector(t):t,this.presetItems=[],this.options.items.length?this.presetItems=this.options.items:""!==this.passedElement.value&&(this.presetItems=this.passedElement.value.split(this.options.delimiter)),this.init=this.init.bind(this),this.render=this.render.bind(this),this.destroy=this.destroy.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.onPaste=this.onPaste.bind(this),this.init()}return o(e,[{key:"isDisabled",value:function(){return!!this.input.disabled}},{key:"isEmpty",value:function(){return 0===this.store.getState().items.length}},{key:"hasSelectedItems",value:function(){var e=this.getItems();return e.some(function(e){return e.selected===!0})}},{key:"handleSelectAll",value:function(){this.options.removeItems&&!this.input.value&&this.options.selectAll&&this.input===document.activeElement&&this.selectAll(this.list.children)}},{key:"handleEnter",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1],i=!0;if("text"===this.passedElement.type&&(this.options.addItems?this.options.maxItems&&this.options.maxItems<=this.list.children.length?i=!1:this.options.allowDuplicates===!1&&this.passedElement.value&&(i=!e.some(function(e){return e.value===t})):i=!1),i){if("text"===this.passedElement.type){var n=!0;this.options.regexFilter&&(n=this.regexFilter(t)),n&&(this.addItem(t),this.clearInput(this.passedElement))}"select-multiple"===this.passedElement.type&&console.log("hit")}}},{key:"handleBackspaceKey",value:function(e){if(this.options.removeItems&&e){var t=e[e.length-1],i=e.some(function(e){return e.selected===!0});this.options.editItems&&!i&&t?(this.input.value=t.value,this.removeItem(t)):(this.selectItem(t),this.removeAllSelectedItems())}}},{key:"handleClick",value:function(e,t,i){var n=this;this.options.removeItems&&t&&!function(){var s=t.getAttribute("data-choice-id");e.forEach(function(e){e.id!==parseInt(s)||e.selected?i||n.deselectItem(e):n.selectItem(e)})}()}},{key:"onKeyDown",value:function(e){var t=this.getItemsFilteredByActive(),i=this.getOptionsFilteredByActive(),n=this.input===document.activeElement,s=e.ctrlKey||e.metaKey,o=8,r=13,a=65,l=27,c=38,u=40,d=this.dropdown&&this.dropdown.classList.contains(this.options.classNames.activeState),h=this.list&&this.list.children;if(e.target===this.input){if(s&&e.keyCode===a&&h&&this.handleSelectAll(),e.keyCode===r){if(e.target.value&&"text"===this.passedElement.type){var p=this.input.value;this.handleEnter(t,p)}if("select-multiple"===this.passedElement.type&&d){var f=this.dropdown.querySelector("."+this.options.classNames.highlightedState);if(f){var v=f.getAttribute("data-choice-value"),m=f.innerHTML,y=f.getAttribute("data-choice-id");this.addItem(v,m,y),this.input.value=""}}}if(e.keyCode===l&&d&&"select-multiple"===this.passedElement.type&&d&&this.toggleDropdown(),(e.keyCode===u||e.keyCode===c)&&"select-multiple"===this.passedElement.type&&d){var g=i.filter(function(e){return!e.selected}),b=!0;if(e.keyCode===u?this.highlightPosition<g.length-1?this.highlightPosition++:b=!1:e.keyCode===c&&(this.highlightPosition>0?this.highlightPosition--:b=!1),b){var I=g[this.highlightPosition];if(I){var E=this.dropdown.querySelector("."+this.options.classNames.highlightedState),w=this.dropdown.querySelector('[data-choice-id="'+I.id+'"]');E&&E.classList.remove(this.options.classNames.highlightedState),w&&w.classList.add(this.options.classNames.highlightedState)}}}}n&&(e.keyCode!==o||e.target.value||(this.handleBackspaceKey(t),e.preventDefault()))}},{key:"onKeyUp",value:function(e){var t=this;if(e.target===this.input&&"select-multiple"===this.passedElement.type&&this.options.allowSearch){var i=String.fromCharCode(e.keyCode);if(this.input===document.activeElement&&/[a-z0-9]/i.test(i))if(this.input.value){var n=(0,u.debounce)(function(){var e=t.getOptionsFiltedBySelectable(),i=new h.default(e),n=i.search(t.input.value,{fields:["label","value"],sort:[{field:"value",direction:"asc"}],limit:10});t.store.dispatch((0,c.filterOptions)(n))},100);n()}else this.store.dispatch((0,c.activateOptions)())}}},{key:"onClick",value:function(e){var t=this,i=e.shiftKey;if(this.dropdown&&this.toggleDropdown(),this.containerOuter.contains(e.target))if(this.input!==document.activeElement&&this.input.focus(),e.target.hasAttribute("data-choice-item")){var n=this.getItemsFilteredByActive(),s=e.target;this.handleClick(n,s,i)}else e.target.hasAttribute("data-choice-option")&&!function(){var i=t.getOptionsFilteredByActive(),n=e.target.getAttribute("data-choice-id"),s=i.find(function(e){return e.id===parseInt(n)});s.selected||t.addItem(s.value,s.label,s.id)}();else this.hasSelectedItems()&&this.deselectAll(),"select-multiple"===this.passedElement.type&&this.dropdown.classList.contains(this.options.classNames.activeState)&&this.toggleDropdown()}},{key:"onPaste",value:function(e){this.options.allowPaste||e.preventDefault()}},{key:"onFocus",value:function(e){this.containerOuter.classList.add(this.options.classNames.activeState)}},{key:"onBlur",value:function(e){this.containerOuter.classList.remove(this.options.classNames.activeState)}},{key:"clearInput",value:function(){this.input.value&&(this.input.value="")}},{key:"regexFilter",value:function(e){var t=new RegExp(this.options.regexFilter,"i"),i=t.test(e);return i}},{key:"getItemById",value:function(e){if(!e||!(0,u.isType)("Number",e))return void console.error("getItemById: An id was not given or was not a number");var t=this.getItems(),i=t.find(function(t){return t.id===parseInt(e)}),n=this.list.querySelector("[data-choice-id='"+i.id+"']");return n}},{key:"selectItem",value:function(e){if(e){var t=e.id;this.store.dispatch((0,c.selectItem)(t,!0))}}},{key:"deselectItem",value:function(e){if(e){var t=e.id;this.store.dispatch((0,c.selectItem)(t,!1))}}},{key:"selectAll",value:function(){var e=this,t=this.getItems();t.forEach(function(t){e.selectItem(t)})}},{key:"deselectAll",value:function(){var e=this,t=this.getItems();t.forEach(function(t){e.deselectItem(t)})}},{key:"addItem",value:function(e,t){var i=arguments.length<=2||void 0===arguments[2]?-1:arguments[2],n=arguments.length<=3||void 0===arguments[3]?this.options.callbackOnAddItem:arguments[3];this.options.debug&&console.debug("Add item");var s=e.trim(),o=t||s,r=i||-1;this.options.prependValue&&(s=this.options.prependValue+s.toString()),this.options.appendValue&&(s+=this.options.appendValue.toString());var a=this.store.getState().items.length+1;this.store.dispatch((0,c.addItem)(s,o,a,r)),n&&((0,u.isType)("Function",n)?n(a,e):console.error("callbackOnAddItem: Callback is not a function"))}},{key:"removeItem",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?this.options.callbackOnRemoveItem:arguments[1];if(!e||!(0,u.isType)("Object",e))return void console.error("removeItem: No item object was passed to be removed");var i=e.id,n=e.value,s=e.optionId;t&&((0,u.isType)("Function",t)?t(n):console.error("callbackOnRemoveItem: Callback is not a function")),this.store.dispatch((0,c.removeItem)(i,s))}},{key:"removeItemsByValue",value:function(e){var t=this;e&&(0,u.isType)("String",e)||console.error("removeItemsByValue: No value was passed to be removed");var i=this.getItemsFilteredByActive();i.forEach(function(i){i.value===e&&t.removeItem(i)})}},{key:"removeAllItems",value:function(){var e=this,t=this.getItemsFilteredByActive();t.forEach(function(t){t.active&&e.removeItem(t)})}},{key:"removeAllSelectedItems",value:function(){var e=this,t=this.getItemsFilteredByActive();t.forEach(function(t){t.selected&&t.active&&e.removeItem(t)})}},{key:"showDropdown",value:function(){this.dropdown.classList.add(this.options.classNames.activeState);var e=this.dropdown.getBoundingClientRect();e.top+e.height>=document.body.offsetHeight?this.dropdown.classList.add(this.options.classNames.flippedState):this.dropdown.classList.remove(this.options.classNames.flippedState)}},{key:"hideDropdown",value:function(){var e=this.dropdown.classList.contains(this.options.classNames.flippedState);this.dropdown.classList.remove(this.options.classNames.activeState),e&&this.dropdown.classList.remove(this.options.classNames.flippedState)}},{key:"toggleDropdown",value:function(){if(this.dropdown){var e=this.dropdown.classList.contains(this.options.classNames.activeState);e?this.hideDropdown():this.showDropdown()}}},{key:"addOption",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?-1:arguments[1],i=arguments.length<=2||void 0===arguments[2]?!1:arguments[2],n=this.store.getState(),s=n.options.length+1,o=e.value,r=e.innerHTML,a=e.selected;this.store.dispatch((0,c.addOption)(o,r,s,t,i)),a&&this.addItem(o,r,s)}},{key:"addGroup",value:function(e,t,i,n){this.store.dispatch((0,c.addGroup)(e,t,i,n))}},{key:"getItems",value:function(){var e=this.store.getState();return e.items}},{key:"getItemsFilteredByActive",value:function(){var e=this.getItems(),t=e.filter(function(e){return e.active===!0},[]);return t}},{key:"getItemsReducedToValues",value:function(){var e=this.getItems(),t=e.reduce(function(e,t){return e.push(t.value),e},[]);return t}},{key:"getOptions",value:function(){var e=this.store.getState();return e.options}},{key:"getOptionsFilteredByActive",value:function(){var e=this.getOptions(),t=e.filter(function(e){return e.active===!0&&e.disabled===!1&&e.selected!==!0},[]);return t}},{key:"getOptionsFiltedBySelectable",value:function(){var e=this.getOptions(),t=e.filter(function(e){return e.disabled===!1},[]);return t}},{key:"getGroups",value:function(){var e=this.store.getState();return e.groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getOptions(),i=e.filter(function(e){var i=e.active===!0&&e.disabled===!1,n=t.some(function(e){return e.active===!0&&e.disabled===!1});return!(!i||!n)},[]);return i}},{key:"generateTextInput",value:function(){var e=this,t=(0,u.strToEl)('<div class="'+this.options.classNames.containerOuter+'"></div>'),i=(0,u.strToEl)('<div class="'+this.options.classNames.containerInner+'"></div>');this.passedElement.classList.add(this.options.classNames.input,this.options.classNames.hiddenState),this.passedElement.tabIndex="-1",this.passedElement.setAttribute("style","display:none;"),this.passedElement.setAttribute("aria-hidden","true"),(0,u.wrap)(this.passedElement,i),(0,u.wrap)(i,t);var n=(0,u.strToEl)('<ul class="'+this.options.classNames.list+" "+this.options.classNames.listItems+'"></ul>'),s=(0,u.strToEl)('<input type="text" class="'+this.options.classNames.input+" "+this.options.classNames.inputCloned+'">');if(this.options.placeholder){var o=this.options.placeholderValue||this.passedElement.placeholder;o&&(s.placeholder=o,s.style.width=(0,u.getWidthOfInput)(s))}this.options.addItems||(s.disabled=!0,t.classList.add(this.options.classNames.disabledState)),t.appendChild(i),i.appendChild(n),i.appendChild(s),this.containerOuter=t,this.containerInner=i,this.input=s,this.list=n,this.presetItems.forEach(function(t){e.addItem(t)})}},{key:"generateMultipleSelectInput",value:function(){var e=this,t=(0,u.strToEl)('<div class="'+this.options.classNames.containerOuter+'"></div>'),i=(0,u.strToEl)('<div class="'+this.options.classNames.containerInner+'"></div>');this.passedElement.classList.add(this.options.classNames.input,this.options.classNames.hiddenState),this.passedElement.tabIndex="-1",this.passedElement.setAttribute("style","display:none;"),this.passedElement.setAttribute("aria-hidden","true"),(0,u.wrap)(this.passedElement,i),(0,u.wrap)(i,t);var n=(0,u.strToEl)('<ul class="'+this.options.classNames.list+" "+this.options.classNames.listItems+'"></ul>'),s=(0,u.strToEl)('<input type="text" class="'+this.options.classNames.input+" "+this.options.classNames.inputCloned+'">'),o=(0,u.strToEl)('<div class="'+this.options.classNames.list+" "+this.options.classNames.listDropdown+'"></div>');this.options.placeholder&&this.options.placeholderValue&&(s.placeholder=this.options.placeholderValue,s.style.width=(0,u.getWidthOfInput)(s)),this.options.addItems||(s.disabled=!0),t.appendChild(i),t.appendChild(o),i.appendChild(n),i.appendChild(s),this.containerOuter=t,this.containerInner=i,this.input=s,this.list=n,this.dropdown=o,this.highlightPosition=0;var r=Array.from(this.passedElement.getElementsByTagName("OPTGROUP"));if(r.length)r.forEach(function(t,i){var n=Array.from(t.getElementsByTagName("OPTION")),s=i;n?(e.addGroup(t.label,s,!0,t.disabled),n.forEach(function(i,n){t.disabled?e.addOption(i,s,!0):e.addOption(i,s)})):e.addGroup(t.label,s,!1,t.disabled)});else{var a=Array.from(this.passedElement.options);a.forEach(function(t){e.addOption(t)})}}},{key:"addEventListeners",value:function(){document.addEventListener("keyup",this.onKeyUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("click",this.onClick),document.addEventListener("paste",this.onPaste),this.input.addEventListener("focus",this.onFocus),this.input.addEventListener("blur",this.onBlur)}},{key:"removeEventListeners",value:function(){document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("click",this.onClick),document.removeEventListener("paste",this.onPaste),this.input.removeEventListener("focus",this.onFocus),this.input.removeEventListener("blur",this.onBlur)}},{key:"render",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?this.options.callbackOnRender:arguments[0],i=this.options.classNames,n=this.getItemsFilteredByActive();"select-multiple"===this.passedElement.type&&!function(){var t=e.getOptionsFilteredByActive(),n=e.getGroupsFilteredByActive();e.dropdown.innerHTML="";var s=document.createDocumentFragment();if(n.length>=1?n.forEach(function(e,n){var o=t.filter(function(t){return t.groupId===e.id});o.length>=1&&!function(){var t=(0,u.strToEl)('\n <div class="'+i.group+" "+(e.disabled?i.itemDisabled:"")+'" data-choice-value="'+e.value+'" data-choice-group-id="'+e.id+'">\n <div class="'+i.groupHeading+'">'+e.value+"</div>\n </div>\n ");o.forEach(function(e,s){var o=(0,u.strToEl)('\n <div class="'+i.item+" "+i.itemOption+" "+(e.selected?i.selectedState+" "+i.itemDisabled:i.itemSelectable)+" "+(0===n&&0===s?i.highlightedState:"")+'" data-choice-option data-choice-id="'+e.id+'" data-choice-value="'+e.value+'">\n '+e.label+"\n </div>\n ");t.appendChild(o)}),s.appendChild(t)}()}):t.length>=1&&t.forEach(function(e,t){var n=(0,u.strToEl)('\n <div class="'+i.item+" "+i.itemOption+" "+(e.selected?i.selectedState+" "+i.itemDisabled:i.itemSelectable)+" "+(0===t?i.highlightedState:"")+'" data-choice-option data-choice-id="'+e.id+'" data-choice-value="'+e.value+'">\n '+e.label+"\n </div>\n ");s.appendChild(n)}),e.dropdown.appendChild(s),""===e.dropdown.innerHTML){var o=(0,u.strToEl)('<div class="'+i.item+'">No options to select</div>');s.appendChild(o),e.dropdown.appendChild(s)}}(),n&&!function(){var t=e.getItemsReducedToValues();e.passedElement.value=t.join(e.options.delimiter),e.list.innerHTML="";var s=document.createDocumentFragment();n.forEach(function(t){var n=(0,u.strToEl)('\n <li class="'+i.item+" "+(e.options.removeItems?i.itemSelectable:"")+" "+(t.selected?i.selectedState:"")+'" data-choice-item data-choice-id="'+t.id+'" data-choice-selected="'+t.selected+'">\n '+t.label+"\n </li>\n ");s.appendChild(n)}),e.list.appendChild(s)}(),t&&((0,u.isType)("Function",t)?t(n):console.error("callbackOnRender: Callback is not a function"))}},{key:"renderInput",value:function(e){switch(this.options.debug&&console.debug("Render"),e.type){case"text":this.generateTextInput();break;case"select-one":break;case"select-multiple":this.generateMultipleSelectInput();break;default:console.error("renderInput: Input type is not supported")}}},{key:"init",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.options.callbackOnInit:arguments[0];this.initialised=!0,this.renderInput(this.passedElement),this.store.subscribe(this.render),this.render(),this.addEventListeners(),e&&((0,u.isType)("Function",e)?e():console.error("callbackOnInit: Callback is not a function"))}},{key:"destroy",value:function(){this.passedElement=null,this.userOptions=null,this.options=null,this.initialised=null,this.store=null}}]),e}();window.Choices=e.exports=p},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0,t.compose=t.applyMiddleware=t.bindActionCreators=t.combineReducers=t.createStore=void 0;var s=i(3),o=n(s),r=i(8),a=n(r),l=i(10),c=n(l),u=i(11),d=n(u),h=i(12),p=n(h),f=i(9);n(f);t.createStore=o.default,t.combineReducers=a.default,t.bindActionCreators=c.default,t.applyMiddleware=d.default,t.compose=p.default},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function s(e,t,i){function n(){f===p&&(f=p.slice())}function o(){return h}function l(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return n(),f.push(e),function(){if(t){t=!1,n();var i=f.indexOf(e);f.splice(i,1)}}}function c(e){if(!(0,r.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"==typeof 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,h=d(h,e)}finally{v=!1}for(var t=p=f,i=0;i<t.length;i++)t[i]();return e}function u(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");d=e,c({type:a.INIT})}if("function"==typeof t&&"undefined"==typeof i&&(i=t,t=void 0),"undefined"!=typeof i){if("function"!=typeof i)throw new Error("Expected the enhancer to be a function.");return i(s)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var d=e,h=t,p=[],f=p,v=!1;return c({type:a.INIT}),{dispatch:c,subscribe:l,getState:o,replaceReducer:u}}t.__esModule=!0,t.ActionTypes=void 0,t.default=s;var o=i(4),r=n(o),a=t.ActionTypes={INIT:"@@redux/INIT"}},function(e,t,i){function n(e){if(!r(e)||h.call(e)!=a||o(e))return!1;var t=s(e);if(null===t)return!0;var i=u.call(t,"constructor")&&t.constructor;return"function"==typeof i&&i instanceof i&&c.call(i)==d}var s=i(5),o=i(6),r=i(7),a="[object Object]",l=Object.prototype,c=Function.prototype.toString,u=l.hasOwnProperty,d=c.call(Object),h=l.toString;e.exports=n},function(e,t){function i(e){return n(Object(e))}var n=Object.getPrototypeOf;e.exports=i},function(e,t){function i(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}e.exports=i},function(e,t){function i(e){return!!e&&"object"==typeof e}e.exports=i},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){var i=t&&t.type,n=i&&'"'+i.toString()+'"'||"an action";return'Reducer "'+e+'" returned undefined handling '+n+". To ignore an action, you must explicitly return the previous state."}function o(e){Object.keys(e).forEach(function(t){var i=e[t],n=i(void 0,{type:a.ActionTypes.INIT});if("undefined"==typeof n)throw new Error('Reducer "'+t+'" 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.');var s="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if("undefined"==typeof i(void 0,{type:s}))throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+a.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.")})}function r(e){for(var t=Object.keys(e),i={},n=0;n<t.length;n++){var r=t[n];"function"==typeof e[r]&&(i[r]=e[r])}var a,l=Object.keys(i);try{o(i)}catch(c){a=c}return function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];if(a)throw a;for(var n=!1,o={},r=0;r<l.length;r++){var c=l[r],u=i[c],d=e[c],h=u(d,t);if("undefined"==typeof h){var p=s(c,t);throw new Error(p)}o[c]=h,n=n||h!==d}return n?o:e}}t.__esModule=!0,t.default=r;var a=i(3),l=i(4),c=(n(l),i(9));n(c)},function(e,t){"use strict";function i(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(t){}}t.__esModule=!0,t.default=i},function(e,t){"use strict";function i(e,t){return function(){return t(e.apply(void 0,arguments))}}function n(e,t){if("function"==typeof e)return i(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),s={},o=0;o<n.length;o++){var r=n[o],a=e[r];"function"==typeof a&&(s[r]=i(a,t))}return s}t.__esModule=!0,t.default=n},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function s(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return function(e){return function(i,n,s){var r=e(i,n,s),l=r.dispatch,c=[],u={getState:r.getState,dispatch:function(e){return l(e)}};return c=t.map(function(e){return e(u)}),l=a.default.apply(void 0,c)(r.dispatch),o({},r,{dispatch:l})}}}var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e};t.__esModule=!0,t.default=s;var r=i(12),a=n(r)},function(e,t){"use strict";function i(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return function(){if(0===t.length)return arguments.length<=0?void 0:arguments[0];var e=t[t.length-1],i=t.slice(0,-1);return i.reduceRight(function(e,t){return t(e)},e.apply(void 0,arguments))}}t.__esModule=!0,t.default=i},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var s=i(2),o=i(14),r=n(o),a=i(15),l=n(a),c=i(16),u=n(c),d=(0,s.combineReducers)({items:r.default,groups:l.default,options:u.default});t.default=d},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_ITEM":var n=[].concat(i(e),[{id:t.id,optionId:t.optionId,value:t.value,label:t.label,active:!0,selected:!1}]);return n.map(function(e){return e.selected&&(e.selected=!1),e});case"REMOVE_ITEM":return e.map(function(e){return e.id===t.id&&(e.active=!1),e});case"SELECT_ITEM":return e.map(function(e){return e.id===t.id&&(e.selected=t.selected),e});default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(i(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);default:return e}};t.default=n},function(e,t){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){var e=arguments.length<=0||void 0===arguments[0]?[]:arguments[0],t=arguments[1];switch(t.type){case"ADD_OPTION":return[].concat(i(e),[{id:t.id,groupId:t.groupId,value:t.value,label:t.label,disabled:t.disabled,selected:!1,active:!0}]);case"ADD_ITEM":return t.optionId>-1?e.map(function(e){return e.id===parseInt(t.optionId)&&(e.selected=!0),e}):e;case"REMOVE_ITEM":return t.optionId>-1?e.map(function(e){return e.id===parseInt(t.optionId)&&(e.selected=!1),e}):e;case"FILTER_OPTIONS":var n=t.results.items,s=e.map(function(e,t){return e.active=n.some(function(e){return e.id===t}),e});return s;case"ACTIVATE_OPTIONS":return e.map(function(e){return e.active=t.active,e});default:return e}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.addItem=function(e,t,i,n){return{type:"ADD_ITEM",value:e,label:t,id:i,optionId:n}},t.removeItem=function(e,t){return{type:"REMOVE_ITEM",id:e,optionId:t}},t.selectItem=function(e,t){return{type:"SELECT_ITEM",id:e,selected:t}},t.addOption=function(e,t,i,n,s){return{type:"ADD_OPTION",value:e,label:t,id:i,groupId:n,disabled:s}},t.filterOptions=function(e){return{type:"FILTER_OPTIONS",results:e}},t.activateOptions=function(){var e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];return{type:"ACTIVATE_OPTIONS",active:e}},t.addGroup=function(e,t,i,n){return{type:"ADD_GROUP",value:e,id:t,active:i,disabled:n}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=(t.hasClass=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},t.capitalise=function(e){return e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})},t.isType=function(e,t){var i=Object.prototype.toString.call(t).slice(8,-1);return void 0!==t&&null!==t&&i===e}),n=(t.extend=function o(){for(var e={},t=!1,n=arguments.length,s=function(n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t&&i("Object",n[s])?e[s]=o(!0,e[s],n[s]):e[s]=n[s])},r=0;n>r;r++){var a=arguments[r];i("Object",a)?s(a):console.error("Custom options must be an object")}return e},t.whichTransitionEvent=function(){var e,t=document.createElement("fakeelement"),i={transition:"transitionend",OTransition:"oTransitionEnd",MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd"};for(e in i)if(void 0!==t.style[e])return i[e]},t.whichAnimationEvent=function(){var e,t=document.createElement("fakeelement"),i={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"animationend",WebkitAnimation:"webkitAnimationEnd"};for(e in i)if(void 0!==t.style[e])return i[e]}),s=(t.getParentsUntil=function(e,t,i){for(var n=[];e&&e!==document;e=e.parentNode){if(t){var s=t.charAt(0);if("."===s&&e.classList.contains(t.substr(1)))break;if("#"===s&&e.id===t.substr(1))break;if("["===s&&e.hasAttribute(t.substr(1,t.length-1)))break;if(e.tagName.toLowerCase()===t)break}if(i){var o=i.charAt(0);"."===o&&e.classList.contains(i.substr(1))&&n.push(e),"#"===o&&e.id===i.substr(1)&&n.push(e),"["===o&&e.hasAttribute(i.substr(1,i.length-1))&&n.push(e),e.tagName.toLowerCase()===i&&n.push(e)}else n.push(e)}return 0===n.length?null:n},t.wrap=function(e,t){return t=t||document.createElement("div"),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)},t.getSiblings=function(e){for(var t=[],i=e.parentNode.firstChild;i;i=i.nextSibling)1===i.nodeType&&i!==e&&t.push(i);return t},t.findAncestor=function(e,t){for(;(e=e.parentElement)&&!e.classList.contains(t););return e},t.debounce=function(e,t,i){var n;return function(){var s=this,o=arguments,r=function(){n=null,i||e.apply(s,o)},a=i&&!n;clearTimeout(n),n=setTimeout(r,t),a&&e.apply(s,o)}},t.getElemDistance=function(e){var t=0;if(e.offsetParent)do t+=e.offsetTop,e=e.offsetParent;while(e);return t>=0?t:0},t.getElementOffset=function(e,t){var i=t;return i>1&&(i=1),i>0&&(i=0),Math.max(e.offsetHeight*i)},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,i){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,i)},t.stripHTML=function(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""},t.addAnimation=function(e,t){var i=n(),s=function o(){e.classList.remove(t),e.removeEventListener(i,o,!1)};e.classList.add(t),e.addEventListener(i,s,!1)},t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)},t.strToEl=function(){var e=document.createElement("div");return function(t){var i;for(e.innerHTML=t,i=e.children[0];e.firstChild;)e.removeChild(e.firstChild);return i}}());t.getWidthOfInput=function(e){var t=arguments.length<=1||void 0===arguments[1]?20:arguments[1],i=e.value||e.placeholder,n=e.offsetWidth;if(i){var o=s('<span class="offscreen">'+i+"</span>");o.style.position="absolute",o.style.top="-9999px",o.style.left="-9999px",o.style.padding="0",o.style.width="auto",document.body.appendChild(o),o.offsetWidth>t&&o.offsetWidth!=e.offsetWidth&&(n=o.offsetWidth+t/4),document.body.removeChild(o)}return n+"px"}},function(e,t,i){var n,s;!function(o,r){n=r,s="function"==typeof n?n.call(t,i,t,e):n,!(void 0!==s&&(e.exports=s))}(this,function(){var e=function(e,t){this.items=e,this.settings=t||{diacritics:!0}};e.prototype.tokenize=function(e){if(e=n(String(e||"").toLowerCase()),!e||!e.length)return[];var t,i,o,a,l=[],c=e.split(/ +/);for(t=0,i=c.length;i>t;t++){if(o=s(c[t]),this.settings.diacritics)for(a in r)r.hasOwnProperty(a)&&(o=o.replace(new RegExp(a,"g"),r[a]));
l.push({string:c[t],regex:new RegExp(o,"i")})}return l},e.prototype.iterator=function(e,t){var i;i=o(e)?Array.prototype.forEach||function(e){for(var t=0,i=this.length;i>t;t++)e(this[t],t,this)}:function(e){for(var t in this)this.hasOwnProperty(t)&&e(this[t],t,this)},i.apply(e,[t])},e.prototype.getScoreFunction=function(e,t){var i,n,s,o;i=this,e=i.prepareSearch(e,t),s=e.tokens,n=e.options.fields,o=s.length;var r=function(e,t){var i,n;return e?(e=String(e||""),n=e.search(t.regex),-1===n?0:(i=t.string.length/e.length,0===n&&(i+=.5),i)):0},a=function(){var e=n.length;return e?1===e?function(e,t){return r(t[n[0]],e)}:function(t,i){for(var s=0,o=0;e>s;s++)o+=r(i[n[s]],t);return o/e}:function(){return 0}}();return o?1===o?function(e){return a(s[0],e)}:"and"===e.options.conjunction?function(e){for(var t,i=0,n=0;o>i;i++){if(t=a(s[i],e),0>=t)return 0;n+=t}return n/o}:function(e){for(var t=0,i=0;o>t;t++)i+=a(s[t],e);return i/o}:function(){return 0}},e.prototype.getSortFunction=function(e,i){var n,s,o,r,a,l,c,u,d,h,p;if(o=this,e=o.prepareSearch(e,i),p=!e.query&&i.sort_empty||i.sort,d=function(e,t){return"$score"===e?t.score:o.items[t.id][e]},a=[],p)for(n=0,s=p.length;s>n;n++)(e.query||"$score"!==p[n].field)&&a.push(p[n]);if(e.query){for(h=!0,n=0,s=a.length;s>n;n++)if("$score"===a[n].field){h=!1;break}h&&a.unshift({field:"$score",direction:"desc"})}else for(n=0,s=a.length;s>n;n++)if("$score"===a[n].field){a.splice(n,1);break}for(u=[],n=0,s=a.length;s>n;n++)u.push("desc"===a[n].direction?-1:1);return l=a.length,l?1===l?(r=a[0].field,c=u[0],function(e,i){return c*t(d(r,e),d(r,i))}):function(e,i){var n,s,o;for(n=0;l>n;n++)if(o=a[n].field,s=u[n]*t(d(o,e),d(o,i)))return s;return 0}:null},e.prototype.prepareSearch=function(e,t){if("object"==typeof e)return e;t=i({},t);var n=t.fields,s=t.sort,r=t.sort_empty;return n&&!o(n)&&(t.fields=[n]),s&&!o(s)&&(t.sort=[s]),r&&!o(r)&&(t.sort_empty=[r]),{options:t,query:String(e||"").toLowerCase(),tokens:this.tokenize(e),total:0,items:[]}},e.prototype.search=function(e,t){var i,n,s,o,r=this;return n=this.prepareSearch(e,t),t=n.options,e=n.query,o=t.score||r.getScoreFunction(n),e.length?r.iterator(r.items,function(e,s){i=o(e),(t.filter===!1||i>0)&&n.items.push({score:i,id:s})}):r.iterator(r.items,function(e,t){n.items.push({score:1,id:t})}),s=r.getSortFunction(n,t),s&&n.items.sort(s),n.total=n.items.length,"number"==typeof t.limit&&(n.items=n.items.slice(0,t.limit)),n};var t=function(e,t){return"number"==typeof e&&"number"==typeof t?e>t?1:t>e?-1:0:(e=a(String(e||"")),t=a(String(t||"")),e>t?1:t>e?-1:0)},i=function(e,t){var i,n,s,o;for(i=1,n=arguments.length;n>i;i++)if(o=arguments[i])for(s in o)o.hasOwnProperty(s)&&(e[s]=o[s]);return e},n=function(e){return(e+"").replace(/^\s+|\s+$|/g,"")},s=function(e){return(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1")},o=Array.isArray||"undefined"!=typeof $&&$.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},r={a:"[aÀÁÂÃÄÅàáâãäåĀāąĄ]",c:"[cÇçćĆčČ]",d:"[dđĐďĎð]",e:"[eÈÉÊËèéêëěĚĒēęĘ]",i:"[iÌÍÎÏìíîïĪī]",l:"[lłŁ]",n:"[nÑñňŇńŃ]",o:"[oÒÓÔÕÕÖØòóôõöøŌō]",r:"[rřŘ]",s:"[sŠšśŚ]",t:"[tťŤ]",u:"[uÙÚÛÜùúûüůŮŪū]",y:"[yŸÿýÝ]",z:"[zŽžżŻźŹ]"},a=function(){var e,t,i,n,s="",o={};for(i in r)if(r.hasOwnProperty(i))for(n=r[i].substring(2,r[i].length-1),s+=n,e=0,t=n.length;t>e;e++)o[n.charAt(e)]=i;var a=new RegExp("["+s+"]","g");return function(e){return e.replace(a,function(e){return o[e]}).toLowerCase()}}();return e})}]);