/* Chosen v1.8.7 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
(function() {
var t, e, s, i, n = function(t, e) {
return function() {
return t.apply(e, arguments)
}
},
r = function(t, e) {
function s() {
this.constructor = t
}
for (var i in e) o.call(e, i) && (t[i] = e[i]);
return s.prototype = e.prototype,
t.prototype = new s,
t.__super__ = e.prototype,
t
},
o = {}.hasOwnProperty;
(i = function() {
function t() {
this.options_index = 0,
this.parsed = []
}
return t.prototype.add_node = function(t) {
return "OPTGROUP" === t.nodeName.toUpperCase() ? this.add_group(t) : this.add_option(t)
},
t.prototype.add_group = function(t) {
var e, s, i, n, r, o;
for (e = this.parsed.length, this.parsed.push({
array_index: e,
group: !0,
label: t.label,
title: t.title ? t.title : void 0,
children: 0,
disabled: t.disabled,
classes: t.className
}), o = [], s = 0, i = (r = t.childNodes).length; s < i; s++) n = r[s],
o.push(this.add_option(n, e, t.disabled));
return o
},
t.prototype.add_option = function(t, e, s) {
if ("OPTION" === t.nodeName.toUpperCase()) return "" !== t.text ? (null != e && (this.parsed[e].children += 1), this.parsed.push({
array_index: this.parsed.length,
options_index: this.options_index,
value: t.value,
text: t.text,
html: t.innerHTML,
title: t.title ? t.title : void 0,
selected: t.selected,
disabled: !0 === s ? s : t.disabled,
group_array_index: e,
group_label: null != e ? this.parsed[e].label : null,
classes: t.className,
style: t.style.cssText
})) : this.parsed.push({
array_index: this.parsed.length,
options_index: this.options_index,
empty: !0
}),
this.options_index += 1
},
t
} ()).select_to_array = function(t) {
var e, s, n, r, o;
for (r = new i, s = 0, n = (o = t.childNodes).length; s < n; s++) e = o[s],
r.add_node(e);
return r.parsed
},
e = function() {
function t(e, s) {
this.form_field = e,
this.options = null != s ? s : {},
this.label_click_handler = n(this.label_click_handler, this),
t.browser_is_supported() && (this.is_multiple = this.form_field.multiple, this.set_default_text(), this.set_default_values(), this.setup(), this.set_up_html(), this.register_observers(), this.on_ready())
}
return t.prototype.set_default_values = function() {
return this.click_test_action = function(t) {
return function(e) {
return t.test_active_click(e)
}
} (this),
this.activate_action = function(t) {
return function(e) {
return t.activate_field(e)
}
} (this),
this.active_field = !1,
this.mouse_on_container = !1,
this.results_showing = !1,
this.result_highlighted = null,
this.is_rtl = this.options.rtl || /\bchosen-rtl\b/.test(this.form_field.className),
this.allow_single_deselect = null != this.options.allow_single_deselect && null != this.form_field.options[0] && "" === this.form_field.options[0].text && this.options.allow_single_deselect,
this.disable_search_threshold = this.options.disable_search_threshold || 0,
this.disable_search = this.options.disable_search || !1,
this.enable_split_word_search = null == this.options.enable_split_word_search || this.options.enable_split_word_search,
this.group_search = null == this.options.group_search || this.options.group_search,
this.search_contains = this.options.search_contains || !1,
this.single_backstroke_delete = null == this.options.single_backstroke_delete || this.options.single_backstroke_delete,
this.max_selected_options = this.options.max_selected_options || Infinity,
this.inherit_select_classes = this.options.inherit_select_classes || !1,
this.display_selected_options = null == this.options.display_selected_options || this.options.display_selected_options,
this.display_disabled_options = null == this.options.display_disabled_options || this.options.display_disabled_options,
this.include_group_label_in_selected = this.options.include_group_label_in_selected || !1,
this.max_shown_results = this.options.max_shown_results || Number.POSITIVE_INFINITY,
this.case_sensitive_search = this.options.case_sensitive_search || !1,
this.hide_results_on_select = null == this.options.hide_results_on_select || this.options.hide_results_on_select
},
t.prototype.set_default_text = function() {
return this.form_field.getAttribute("data-placeholder") ? this.default_text = this.form_field.getAttribute("data-placeholder") : this.is_multiple ? this.default_text = this.options.placeholder_text_multiple || this.options.placeholder_text || t.default_multiple_text : this.default_text = this.options.placeholder_text_single || this.options.placeholder_text || t.default_single_text,
this.default_text = this.escape_html(this.default_text),
this.results_none_found = this.form_field.getAttribute("data-no_results_text") || this.options.no_results_text || t.default_no_result_text
},
t.prototype.choice_label = function(t) {
return this.include_group_label_in_selected && null != t.group_label ? "" + this.escape_html(t.group_label) + "" + t.html : t.html
},
t.prototype.mouse_enter = function() {
return this.mouse_on_container = !0
},
t.prototype.mouse_leave = function() {
return this.mouse_on_container = !1
},
t.prototype.input_focus = function(t) {
if (this.is_multiple) {
if (!this.active_field) return setTimeout(function(t) {
return function() {
return t.container_mousedown()
}
} (this), 50)
} else
if (!this.active_field) return this.activate_field()
},
t.prototype.input_blur = function(t) {
if (!this.mouse_on_container) return this.active_field = !1,
setTimeout(function(t) {
return function() {
return t.blur_test()
}
} (this), 100)
},
t.prototype.label_click_handler = function(t) {
return this.is_multiple ? this.container_mousedown(t) : this.activate_field()
},
t.prototype.results_option_build = function(t) {
var e, s, i, n, r, o, h;
for (e = "", h = 0, n = 0, r = (o = this.results_data).length; n < r && (s = o[n], i = "", "" !== (i = s.group ? this.result_add_group(s) : this.result_add_option(s)) && (h++, e += i), (null != t ? t.first : void 0) && (s.selected && this.is_multiple ? this.choice_build(s) : s.selected && !this.is_multiple && this.single_set_selected_text(this.choice_label(s))), !(h >= this.max_shown_results)); n++);
return e
},
t.prototype.result_add_option = function(t) {
var e, s;
return t.search_match && this.include_option_in_results(t) ? (e = [], t.disabled || t.selected && this.is_multiple || e.push("active-result"), !t.disabled || t.selected && this.is_multiple || e.push("disabled-result"), t.selected && e.push("result-selected"), null != t.group_array_index && e.push("group-option"), "" !== t.classes && e.push(t.classes), s = document.createElement("li"), s.className = e.join(" "), t.style && (s.style.cssText = t.style), s.setAttribute("data-option-array-index", t.array_index), s.innerHTML = t.highlighted_html || t.html, t.title && (s.title = t.title), this.outerHTML(s)) : ""
},
t.prototype.result_add_group = function(t) {
var e, s;
return (t.search_match || t.group_match) && t.active_options > 0 ? (
(e = []).push("group-result"), t.classes && e.push(t.classes), s = document.createElement("li"), s.className = e.join(" "), s.innerHTML = t.highlighted_html || this.escape_html(t.label), t.title && (s.title = t.title), this.outerHTML(s)) : ""
},
t.prototype.results_update_field = function() {
if (this.set_default_text(), this.is_multiple || this.results_reset_cleanup(), this.result_clear_highlight(), this.results_build(), this.results_showing) return this.winnow_results()
},
t.prototype.reset_single_select_options = function() {
var t, e, s, i, n;
for (n = [], t = 0, e = (s = this.results_data).length; t < e; t++)
(i = s[t]).selected ? n.push(i.selected = !1) : n.push(void 0);
return n
},
t.prototype.results_toggle = function() {
return this.results_showing ? this.results_hide() : this.results_show()
},
t.prototype.results_search = function(t) {
return this.results_showing ? this.winnow_results() : this.results_show()
},
t.prototype.winnow_results = function(t) {
var e, s, i, n, r, o, h, l, c, _, a, u, d, p, f;
for (this.no_results_clear(), _ = 0, e = (h = this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), c = this.get_search_regex(e), i = 0, n = (l = this.results_data).length; i < n; i++)
(r = l[i]).search_match = !1,
a = null,
u = null,
r.highlighted_html = "",
this.include_option_in_results(r) && (r.group && (r.group_match = !1, r.active_options = 0), null != r.group_array_index && this.results_data[r.group_array_index] && (0 === (a = this.results_data[r.group_array_index]).active_options && a.search_match && (_ += 1), a.active_options += 1), f = r.group ? r.label : r.text, r.group && !this.group_search || (u = this.search_string_match(f, c), r.search_match = null != u, r.search_match && !r.group && (_ += 1), r.search_match ? (h.length && (d = u.index, o = f.slice(0, d), s = f.slice(d, d + h.length), p = f.slice(d + h.length), r.highlighted_html = this.escape_html(o) + "" + this.escape_html(s) + "" + this.escape_html(p)), null != a && (a.group_match = !0)) : null != r.group_array_index && this.results_data[r.group_array_index].search_match && (r.search_match = !0)));
return this.result_clear_highlight(),
_ < 1 && h.length ? (this.update_results_content(""), this.no_results(h)) : (this.update_results_content(this.results_option_build()), (null != t ? t.skip_highlight : void 0) ? void 0 : this.winnow_results_set_highlight())
},
t.prototype.get_search_regex = function(t) {
var e, s;
return s = this.search_contains ? t : "(^|\\s|\\b)" + t + "[^\\s]*",
this.enable_split_word_search || this.search_contains || (s = "^" + s),
e = this.case_sensitive_search ? "" : "i",
new RegExp(s, e)
},
t.prototype.search_string_match = function(t, e) {
var s;
return s = e.exec(t),
!this.search_contains && (null != s ? s[1] : void 0) && (s.index += 1),
s
},
t.prototype.choices_count = function() {
var t, e, s;
if (null != this.selected_option_count) return this.selected_option_count;
for (this.selected_option_count = 0, t = 0, e = (s = this.form_field.options).length; t < e; t++) s[t].selected && (this.selected_option_count += 1);
return this.selected_option_count
},
t.prototype.choices_click = function(t) {
if (t.preventDefault(), this.activate_field(), !this.results_showing && !this.is_disabled) return this.results_show()
},
t.prototype.keydown_checker = function(t) {
var e, s;
switch (s = null != (e = t.which) ? e : t.keyCode, this.search_field_scale(), 8 !== s && this.pending_backstroke && this.clear_backstroke(), s) {
case 8:
this.backstroke_length = this.get_search_field_value().length;
break;
case 9:
this.results_showing && !this.is_multiple && this.result_select(t),
this.mouse_on_container = !1;
break;
case 13:
case 27:
this.results_showing && t.preventDefault();
break;
case 32:
this.disable_search && t.preventDefault();
break;
case 38:
t.preventDefault(),
this.keyup_arrow();
break;
case 40:
t.preventDefault(),
this.keydown_arrow()
}
},
t.prototype.keyup_checker = function(t) {
var e, s;
switch (s = null != (e = t.which) ? e : t.keyCode, this.search_field_scale(), s) {
case 8:
this.is_multiple && this.backstroke_length < 1 && this.choices_count() > 0 ? this.keydown_backstroke() : this.pending_backstroke || (this.result_clear_highlight(), this.results_search());
break;
case 13:
t.preventDefault(),
this.results_showing && this.result_select(t);
break;
case 27:
this.results_showing && this.results_hide();
break;
case 9:
case 16:
case 17:
case 18:
case 38:
case 40:
case 91:
break;
default:
this.results_search()
}
},
t.prototype.clipboard_event_checker = function(t) {
if (!this.is_disabled) return setTimeout(function(t) {
return function() {
return t.results_search()
}
} (this), 50)
},
t.prototype.container_width = function() {
return null != this.options.width ? this.options.width : this.form_field.offsetWidth + "px"
},
t.prototype.include_option_in_results = function(t) {
return ! (this.is_multiple && !this.display_selected_options && t.selected) && (!(!this.display_disabled_options && t.disabled) && !t.empty)
},
t.prototype.search_results_touchstart = function(t) {
return this.touch_started = !0,
this.search_results_mouseover(t)
},
t.prototype.search_results_touchmove = function(t) {
return this.touch_started = !1,
this.search_results_mouseout(t)
},
t.prototype.search_results_touchend = function(t) {
if (this.touch_started) return this.search_results_mouseup(t)
},
t.prototype.outerHTML = function(t) {
var e;
return t.outerHTML ? t.outerHTML : (
(e = document.createElement("div")).appendChild(t), e.innerHTML)
},
t.prototype.get_single_html = function() {
return '\n ' + this.default_text + '\n