{"version":3,"sources":["selectize.js"],"names":["root","factory","define","amd","exports","module","Sifter","this","items","settings","diacritics","prototype","tokenize","query","trim","String","toLowerCase","length","i","n","regex","letter","tokens","words","split","escape_regex","DIACRITICS","hasOwnProperty","replace","RegExp","push","string","iterator","object","callback","is_array","Array","forEach","key","apply","getScoreFunction","search","options","fields","token_count","nesting","prepareSearch","field_count","scoreValue","value","token","score","pos","scoreObject","data","getattr","sum","conjunction","getSortFunction","self","field","fields_count","multiplier","multipliers","get_field","implicit_score","sort","sort_empty","name","result","id","unshift","direction","splice","a","b","cmp","option_fields","extend","option_sort","option_sort_empty","total","fn_sort","fn_score","item","filter","limit","slice","asciifold","k","arguments","obj","names","shift","str","isArray","$","Object","toString","call","c","d","e","f","g","h","j","l","o","p","q","r","s","t","u","v","w","x","y","z","chunk","foreignletters","lookup","substring","charAt","regexp","foreignletter","MicroPlugin","mixin","Interface","plugins","initializePlugins","queue","requested","loaded","utils","require","loadPlugin","plugin","Error","fn","vArg","Selectize","jQuery","highlight","$element","pattern","node","skip","nodeType","match","spannode","document","createElement","className","middlebit","splitText","middleclone","cloneNode","appendChild","parentNode","replaceChild","childNodes","test","tagName","each","removeHighlight","find","firstChild","nodeName","parent","normalize","end","MicroEvent","on","event","fct","_events","off","indexOf","trigger","destObject","props","IS_MAC","navigator","userAgent","KEY_CMD","KEY_CTRL","SUPPORTS_VALIDITY_API","window","validity","isset","hash_key","escape_html","hook","before","method","original","after","once","called","debounce_events","types","type","event_args","getSelection","input","start","selectionStart","selectionEnd","selection","focus","sel","createRange","selLen","text","moveStart","autoGrow","$input","currentWidth","update","keyCode","printable","placeholder","width","character","$parent","metaKey","altKey","force","val","shiftKey","fromCharCode","toUpperCase","attr","$testInput","css","position","top","left","padding","whiteSpace","appendTo","$from","$to","properties","styles","transferStyles","triggerHandler","dir","selectize","delay","timeout","computedStyle","getComputedStyle","getPropertyValue","currentStyle","parents","order","tabIndex","tagType","rtl","eventNS","count","highlightedValue","isBlurring","isOpen","isDisabled","isRequired","is","isInvalid","isLocked","isFocused","isInputHidden","isSetup","isShiftDown","isCmdDown","isCtrlDown","ignoreFocus","ignoreBlur","ignoreHover","hasOptions","currentResults","lastValue","caretPos","loading","loadedSearches","$activeOption","$activeItems","optgroups","userOptions","renderCache","onSearchChange","loadThrottle","args","clearTimeout","setTimeout","sifter","registerOption","registerOptionGroup","mode","maxItems","hideSelected","setupCallbacks","setupTemplates","setup","message","console","error","component","explanation","group","groupEnd","logError","$wrapper","$control","$control_input","$dropdown","$dropdown_content","$dropdown_parent","inputMode","classes","classes_plugins","inputId","selector","$window","$document","addClass","wrapperClass","inputClass","dropdownParent","dropdownClass","hide","dropdownContentClass","copyClassesToDropdown","style","join","splitOn","delimiter","delimiterEscaped","stopImmediatePropagation","onOptionHover","onOptionSelect","onItemSelect","child","target","currentTarget","mousedown","onMouseDown","click","onClick","stopPropagation","keydown","onKeyDown","keyup","onKeyUp","keypress","onKeyPress","resize","positionDropdown","blur","onBlur","onFocus","paste","onPaste","has","revertSettings","$children","children","detach","tabindex","setValue","preventDefault","refreshState","updateOriginalInput","refreshItems","updatePlaceholder","disable","onChange","preload","field_label","labelField","field_optgroup","optgroupLabelField","templates","optgroup","html","optgroup_header","escape","option","option_create","render","callbacks","initialize","change","item_add","item_remove","clear","option_add","option_remove","option_clear","optgroup_add","optgroup_remove","optgroup_clear","dropdown_open","dropdown_close","load","defaultPrevented","isDefaultPrevented","close","open","setActiveItem","isFull","pastedText","splitInput","createItem","which","create","selectAll","ctrlKey","$next","getAdjacentOption","setActiveOption","$prev","advanceSelection","selectOnTab","deleteSelection","refreshOptions","wasFocused","showInput","openOnFocus","dest","activeElement","deactivate","setTextboxValue","setCaret","createOnBlur","$target","hasClass","closeAfterSelect","lastQuery","addItem","getOption","loadingClass","results","Math","max","addOption","removeClass","getValue","silent","addItems","$item","eventName","idx","begin","swap","$last","hideInput","$option","scroll","animate","height_menu","height_item","scroll_top","scroll_bottom","height","outerHeight","scrollTop","offset","stop","scrollDuration","opacity","getSearchOptions","sortField","searchField","searchConjunction","calculateScore","triggerDropdown","groups","groups_order","option_html","html_children","has_create_option","$active","$active_before","$create","tmp","active_before","maxOptions","min","optgroupField","createDocumentFragment","lockOptgroupOrder","$order","innerHTML","dom","canCreate","prepend","addPrecedence","valueField","optgroupValueField","addOptionGroup","removeOptionGroup","clearOptionGroups","updateOption","$item_new","value_new","index_item","cache_items","cache_options","order_old","getItem","replaceWith","removeOption","removeItem","clearOptions","getElementWithValue","$options","index","eq","$els","getAttribute","values","buffer","isPending","control","insertBefore","value_next","wasFull","insertAtCaret","remove","persist","caret","lock","unlock","output","refreshValidityState","refreshClasses","invalid","prop","toggleClass","isEmptyObject","opts","label","removeAttr","visibility","display","getBoundingClientRect","$el","el","option_select","$option_select","$tail","onDelete","pop","tail","valueLength","advanceCaret","$adj","$child","append","enable","destroy","show","removeData","undefined","body","templateName","cache","disabledField","clearCache","createFilter","defaults","allowEmptyOption","dataAttr","settings_user","attr_data","field_value","field_disabled","field_optgroup_label","field_optgroup_value","tag_name","settings_element","optionsMap","readData","JSON","parse","arr","addGroup","$optgroup","init_select","data_raw","init_textbox","support","sortable","forcePlaceholderSize","disabled","ui","helper","overflow","active","title","headerClass","titleRowClass","labelClass","closeClass","$dropdown_header","equalizeWidth","equalizeHeight","closest","prev","next","getScrollbarWidth","div","doc","offsetWidth","clientWidth","removeChild","equalizeSizes","height_max","width_last","width_parent","$optgroups","innerWidth","round","thisRef","html_container","html_element","render_item","multiClose","context","singleClose"],"mappings":"CAgBC,SAASA,EAAMC,GACO,mBAAXC,QAAyBA,OAAOC,IAC1CD,OAAO,SAAUD,GACY,iBAAZG,QACjBC,OAAOD,QAAUH,IAEjBD,EAAKM,OAASL,IANhB,CAQEM,MAAM,WAWP,IAAID,EAAS,SAASE,EAAOC,GAC5BF,KAAKC,MAAQA,EACbD,KAAKE,SAAWA,GAAY,CAACC,YAAY,IAU1CJ,EAAOK,UAAUC,SAAW,SAASC,GAEpC,KADAA,EAAQC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AAMmC,MAQrBoG,EAAU5I,OAAO,wBAAwB,SAASwC,GACjD,IAOK2J,EAPD1I,EAAOpD,KAEXmC,EAAQ6K,KAAO7K,EAAQ6K,MAAQ,SAAS8K,GACvC,OAAOA,EAAO9X,KAAKE,SAASoX,aAG7BtX,KAAK0V,WACA5J,EAAW1I,EAAKsS,UACb,SAAS3P,GACf,IAAIia,EAAOlI,EACX,OA/hGiB,IA+hGb/R,EAAEuH,SAA2D,KAA9BtN,KAAKqT,eAAetF,QAAiB/N,KAAKyR,aAAa/Q,SACzFsf,EAAQhgB,KAAKqR,SAAW,IACX,GAAK2O,EAAQhgB,KAAKC,MAAMS,QACpCoX,EAAS9X,KAAKmC,QAAQnC,KAAKC,MAAM+f,IAC7BhgB,KAAKma,gBAAgBpU,KACxB/F,KAAK2a,gBAAgBxY,EAAQ6K,KAAKhL,MAAMhC,KAAM,CAAC8X,KAC/C9X,KAAKoa,gBAAe,SAErBrU,EAAE8Q,kBAIG/K,EAAS9J,MAAMhC,KAAMmF,gBAMxBoD","file":"selectize.js","sourcesContent":["/**\n * sifter.js\n * Copyright (c) 2013 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis <brian@thirdroute.com>\n */\n\n(function(root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine('sifter', factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.Sifter = factory();\n\t}\n}(this, function() {\n\n\t/**\n\t * Textually searches arrays and hashes of objects\n\t * by property (or multiple properties). Designed\n\t * specifically for autocomplete.\n\t *\n\t * @constructor\n\t * @param {array|object} items\n\t * @param {object} items\n\t */\n\tvar Sifter = function(items, settings) {\n\t\tthis.items = items;\n\t\tthis.settings = settings || {diacritics: true};\n\t};\n\n\t/**\n\t * Splits a search string into an array of individual\n\t * regexps to be used to match results.\n\t *\n\t * @param {string} query\n\t * @returns {array}\n\t */\n\tSifter.prototype.tokenize = function(query) {\n\t\tquery = trim(String(query || '').toLowerCase());\n\t\tif (!query || !query.length) return [];\n\n\t\tvar i, n, regex, letter;\n\t\tvar tokens = [];\n\t\tvar words = query.split(/ +/);\n\n\t\tfor (i = 0, n = words.length; i < n; i++) {\n\t\t\tregex = escape_regex(words[i]);\n\t\t\tif (this.settings.diacritics) {\n\t\t\t\tfor (letter in DIACRITICS) {\n\t\t\t\t\tif (DIACRITICS.hasOwnProperty(letter)) {\n\t\t\t\t\t\tregex = regex.replace(new RegExp(letter, 'g'), DIACRITICS[letter]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttokens.push({\n\t\t\t\tstring : words[i],\n\t\t\t\tregex  : new RegExp(regex, 'i')\n\t\t\t});\n\t\t}\n\n\t\treturn tokens;\n\t};\n\n\t/**\n\t * Iterates over arrays and hashes.\n\t *\n\t * ```\n\t * this.iterator(this.items, function(item, id) {\n\t *    // invoked for each item\n\t * });\n\t * ```\n\t *\n\t * @param {array|object} object\n\t */\n\tSifter.prototype.iterator = function(object, callback) {\n\t\tvar iterator;\n\t\tif (is_array(object)) {\n\t\t\titerator = Array.prototype.forEach || function(callback) {\n\t\t\t\tfor (var i = 0, n = this.length; i < n; i++) {\n\t\t\t\t\tcallback(this[i], i, this);\n\t\t\t\t}\n\t\t\t};\n\t\t} else {\n\t\t\titerator = function(callback) {\n\t\t\t\tfor (var key in this) {\n\t\t\t\t\tif (this.hasOwnProperty(key)) {\n\t\t\t\t\t\tcallback(this[key], key, this);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\titerator.apply(object, [callback]);\n\t};\n\n\t/**\n\t * Returns a function to be used to score individual results.\n\t *\n\t * Good matches will have a higher score than poor matches.\n\t * If an item is not a match, 0 will be returned by the function.\n\t *\n\t * @param {object|string} search\n\t * @param {object} options (optional)\n\t * @returns {function}\n\t */\n\tSifter.prototype.getScoreFunction = function(search, options) {\n\t\tvar self, fields, tokens, token_count, nesting;\n\n\t\tself        = this;\n\t\tsearch      = self.prepareSearch(search, options);\n\t\ttokens      = search.tokens;\n\t\tfields      = search.options.fields;\n\t\ttoken_count = tokens.length;\n\t\tnesting     = search.options.nesting;\n\n\t\t/**\n\t\t * Calculates how close of a match the\n\t\t * given value is against a search token.\n\t\t *\n\t\t * @param {mixed} value\n\t\t * @param {object} token\n\t\t * @return {number}\n\t\t */\n\t\tvar scoreValue = function(value, token) {\n\t\t\tvar score, pos;\n\n\t\t\tif (!value) return 0;\n\t\t\tvalue = String(value || '');\n\t\t\tpos = value.search(token.regex);\n\t\t\tif (pos === -1) return 0;\n\t\t\tscore = token.string.length / value.length;\n\t\t\tif (pos === 0) score += 0.5;\n\t\t\treturn score;\n\t\t};\n\n\t\t/**\n\t\t * Calculates the score of an object\n\t\t * against the search query.\n\t\t *\n\t\t * @param {object} token\n\t\t * @param {object} data\n\t\t * @return {number}\n\t\t */\n\t\tvar scoreObject = (function() {\n\t\t\tvar field_count = fields.length;\n\t\t\tif (!field_count) {\n\t\t\t\treturn function() { return 0; };\n\t\t\t}\n\t\t\tif (field_count === 1) {\n\t\t\t\treturn function(token, data) {\n\t\t\t\t\treturn scoreValue(getattr(data, fields[0], nesting), token);\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn function(token, data) {\n\t\t\t\tfor (var i = 0, sum = 0; i < field_count; i++) {\n\t\t\t\t\tsum += scoreValue(getattr(data, fields[i], nesting), token);\n\t\t\t\t}\n\t\t\t\treturn sum / field_count;\n\t\t\t};\n\t\t})();\n\n\t\tif (!token_count) {\n\t\t\treturn function() { return 0; };\n\t\t}\n\t\tif (token_count === 1) {\n\t\t\treturn function(data) {\n\t\t\t\treturn scoreObject(tokens[0], data);\n\t\t\t};\n\t\t}\n\n\t\tif (search.options.conjunction === 'and') {\n\t\t\treturn function(data) {\n\t\t\t\tvar score;\n\t\t\t\tfor (var i = 0, sum = 0; i < token_count; i++) {\n\t\t\t\t\tscore = scoreObject(tokens[i], data);\n\t\t\t\t\tif (score <= 0) return 0;\n\t\t\t\t\tsum += score;\n\t\t\t\t}\n\t\t\t\treturn sum / token_count;\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(data) {\n\t\t\t\tfor (var i = 0, sum = 0; i < token_count; i++) {\n\t\t\t\t\tsum += scoreObject(tokens[i], data);\n\t\t\t\t}\n\t\t\t\treturn sum / token_count;\n\t\t\t};\n\t\t}\n\t};\n\n\t/**\n\t * Returns a function that can be used to compare two\n\t * results, for sorting purposes. If no sorting should\n\t * be performed, `null` will be returned.\n\t *\n\t * @param {string|object} search\n\t * @param {object} options\n\t * @return function(a,b)\n\t */\n\tSifter.prototype.getSortFunction = function(search, options) {\n\t\tvar i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;\n\n\t\tself   = this;\n\t\tsearch = self.prepareSearch(search, options);\n\t\tsort   = (!search.query && options.sort_empty) || options.sort;\n\n\t\t/**\n\t\t * Fetches the specified sort field value\n\t\t * from a search result item.\n\t\t *\n\t\t * @param  {string} name\n\t\t * @param  {object} result\n\t\t * @return {mixed}\n\t\t */\n\t\tget_field = function(name, result) {\n\t\t\tif (name === '$score') return result.score;\n\t\t\treturn getattr(self.items[result.id], name, options.nesting);\n\t\t};\n\n\t\t// parse options\n\t\tfields = [];\n\t\tif (sort) {\n\t\t\tfor (i = 0, n = sort.length; i < n; i++) {\n\t\t\t\tif (search.query || sort[i].field !== '$score') {\n\t\t\t\t\tfields.push(sort[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// the \"$score\" field is implied to be the primary\n\t\t// sort field, unless it's manually specified\n\t\tif (search.query) {\n\t\t\timplicit_score = true;\n\t\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\t\tif (fields[i].field === '$score') {\n\t\t\t\t\timplicit_score = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (implicit_score) {\n\t\t\t\tfields.unshift({field: '$score', direction: 'desc'});\n\t\t\t}\n\t\t} else {\n\t\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\t\tif (fields[i].field === '$score') {\n\t\t\t\t\tfields.splice(i, 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tmultipliers = [];\n\t\tfor (i = 0, n = fields.length; i < n; i++) {\n\t\t\tmultipliers.push(fields[i].direction === 'desc' ? -1 : 1);\n\t\t}\n\n\t\t// build function\n\t\tfields_count = fields.length;\n\t\tif (!fields_count) {\n\t\t\treturn null;\n\t\t} else if (fields_count === 1) {\n\t\t\tfield = fields[0].field;\n\t\t\tmultiplier = multipliers[0];\n\t\t\treturn function(a, b) {\n\t\t\t\treturn multiplier * cmp(\n\t\t\t\t\tget_field(field, a),\n\t\t\t\t\tget_field(field, b)\n\t\t\t\t);\n\t\t\t};\n\t\t} else {\n\t\t\treturn function(a, b) {\n\t\t\t\tvar i, result, a_value, b_value, field;\n\t\t\t\tfor (i = 0; i < fields_count; i++) {\n\t\t\t\t\tfield = fields[i].field;\n\t\t\t\t\tresult = multipliers[i] * cmp(\n\t\t\t\t\t\tget_field(field, a),\n\t\t\t\t\t\tget_field(field, b)\n\t\t\t\t\t);\n\t\t\t\t\tif (result) return result;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t};\n\t\t}\n\t};\n\n\t/**\n\t * Parses a search query and returns an object\n\t * with tokens and fields ready to be populated\n\t * with results.\n\t *\n\t * @param {string} query\n\t * @param {object} options\n\t * @returns {object}\n\t */\n\tSifter.prototype.prepareSearch = function(query, options) {\n\t\tif (typeof query === 'object') return query;\n\n\t\toptions = extend({}, options);\n\n\t\tvar option_fields     = options.fields;\n\t\tvar option_sort       = options.sort;\n\t\tvar option_sort_empty = options.sort_empty;\n\n\t\tif (option_fields && !is_array(option_fields)) options.fields = [option_fields];\n\t\tif (option_sort && !is_array(option_sort)) options.sort = [option_sort];\n\t\tif (option_sort_empty && !is_array(option_sort_empty)) options.sort_empty = [option_sort_empty];\n\n\t\treturn {\n\t\t\toptions : options,\n\t\t\tquery   : String(query || '').toLowerCase(),\n\t\t\ttokens  : this.tokenize(query),\n\t\t\ttotal   : 0,\n\t\t\titems   : []\n\t\t};\n\t};\n\n\t/**\n\t * Searches through all items and returns a sorted array of matches.\n\t *\n\t * The `options` parameter can contain:\n\t *\n\t *   - fields {string|array}\n\t *   - sort {array}\n\t *   - score {function}\n\t *   - filter {bool}\n\t *   - limit {integer}\n\t *\n\t * Returns an object containing:\n\t *\n\t *   - options {object}\n\t *   - query {string}\n\t *   - tokens {array}\n\t *   - total {int}\n\t *   - items {array}\n\t *\n\t * @param {string} query\n\t * @param {object} options\n\t * @returns {object}\n\t */\n\tSifter.prototype.search = function(query, options) {\n\t\tvar self = this, value, score, search, calculateScore;\n\t\tvar fn_sort;\n\t\tvar fn_score;\n\n\t\tsearch  = this.prepareSearch(query, options);\n\t\toptions = search.options;\n\t\tquery   = search.query;\n\n\t\t// generate result scoring function\n\t\tfn_score = options.score || self.getScoreFunction(search);\n\n\t\t// perform search and sort\n\t\tif (query.length) {\n\t\t\tself.iterator(self.items, function(item, id) {\n\t\t\t\tscore = fn_score(item);\n\t\t\t\tif (options.filter === false || score > 0) {\n\t\t\t\t\tsearch.items.push({'score': score, 'id': id});\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tself.iterator(self.items, function(item, id) {\n\t\t\t\tsearch.items.push({'score': 1, 'id': id});\n\t\t\t});\n\t\t}\n\n\t\tfn_sort = self.getSortFunction(search, options);\n\t\tif (fn_sort) search.items.sort(fn_sort);\n\n\t\t// apply limits\n\t\tsearch.total = search.items.length;\n\t\tif (typeof options.limit === 'number') {\n\t\t\tsearch.items = search.items.slice(0, options.limit);\n\t\t}\n\n\t\treturn search;\n\t};\n\n\t// utilities\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n\tvar cmp = function(a, b) {\n\t\tif (typeof a === 'number' && typeof b === 'number') {\n\t\t\treturn a > b ? 1 : (a < b ? -1 : 0);\n\t\t}\n\t\ta = asciifold(String(a || ''));\n\t\tb = asciifold(String(b || ''));\n\t\tif (a > b) return 1;\n\t\tif (b > a) return -1;\n\t\treturn 0;\n\t};\n\n\tvar extend = function(a, b) {\n\t\tvar i, n, k, object;\n\t\tfor (i = 1, n = arguments.length; i < n; i++) {\n\t\t\tobject = arguments[i];\n\t\t\tif (!object) continue;\n\t\t\tfor (k in object) {\n\t\t\t\tif (object.hasOwnProperty(k)) {\n\t\t\t\t\ta[k] = object[k];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn a;\n\t};\n\n\t/**\n\t * A property getter resolving dot-notation\n\t * @param  {Object}  obj     The root object to fetch property on\n\t * @param  {String}  name    The optionally dotted property name to fetch\n\t * @param  {Boolean} nesting Handle nesting or not\n\t * @return {Object}          The resolved property value\n\t */\n\tvar getattr = function(obj, name, nesting) {\n\t    if (!obj || !name) return;\n\t    if (!nesting) return obj[name];\n\t    var names = name.split(\".\");\n\t    while(names.length && (obj = obj[names.shift()]));\n\t    return obj;\n\t};\n\n\tvar trim = function(str) {\n\t\treturn (str + '').replace(/^\\s+|\\s+$|/g, '');\n\t};\n\n\tvar escape_regex = function(str) {\n\t\treturn (str + '').replace(/([.?*+^$[\\]\\\\(){}|-])/g, '\\\\$1');\n\t};\n\n\tvar is_array = Array.isArray || (typeof $ !== 'undefined' && $.isArray) || function(object) {\n\t\treturn Object.prototype.toString.call(object) === '[object Array]';\n\t};\n\n\tvar DIACRITICS = {\n\t\t'a': '[aḀḁĂăÂâǍǎȺⱥȦȧẠạÄäÀàÁáĀāÃãÅåąĄÃąĄ]',\n\t\t'b': '[b␢βΒB฿𐌁ᛒ]',\n\t\t'c': '[cĆćĈĉČčĊċC̄c̄ÇçḈḉȻȼƇƈɕᴄＣｃ]',\n\t\t'd': '[dĎďḊḋḐḑḌḍḒḓḎḏĐđD̦d̦ƉɖƊɗƋƌᵭᶁᶑȡᴅＤｄð]',\n\t\t'e': '[eÉéÈèÊêḘḙĚěĔĕẼẽḚḛẺẻĖėËëĒēȨȩĘęᶒɆɇȄȅẾếỀềỄễỂểḜḝḖḗḔḕȆȇẸẹỆệⱸᴇＥｅɘǝƏƐε]',\n\t\t'f': '[fƑƒḞḟ]',\n\t\t'g': '[gɢ₲ǤǥĜĝĞğĢģƓɠĠġ]',\n\t\t'h': '[hĤĥĦħḨḩẖẖḤḥḢḣɦʰǶƕ]',\n\t\t'i': '[iÍíÌìĬĭÎîǏǐÏïḮḯĨĩĮįĪīỈỉȈȉȊȋỊịḬḭƗɨɨ̆ᵻᶖİiIıɪＩｉ]',\n\t\t'j': '[jȷĴĵɈɉʝɟʲ]',\n\t\t'k': '[kƘƙꝀꝁḰḱǨǩḲḳḴḵκϰ₭]',\n\t\t'l': '[lŁłĽľĻļĹĺḶḷḸḹḼḽḺḻĿŀȽƚⱠⱡⱢɫɬᶅɭȴʟＬｌ]',\n\t\t'n': '[nŃńǸǹŇňÑñṄṅŅņṆṇṊṋṈṉN̈n̈ƝɲȠƞᵰᶇɳȵɴＮｎŊŋ]',\n\t\t'o': '[oØøÖöÓóÒòÔôǑǒŐőŎŏȮȯỌọƟɵƠơỎỏŌōÕõǪǫȌȍՕօ]',\n\t\t'p': '[pṔṕṖṗⱣᵽƤƥᵱ]',\n\t\t'q': '[qꝖꝗʠɊɋꝘꝙq̃]',\n\t\t'r': '[rŔŕɌɍŘřŖŗṘṙȐȑȒȓṚṛⱤɽ]',\n\t\t's': '[sŚśṠṡṢṣꞨꞩŜŝŠšŞşȘșS̈s̈]',\n\t\t't': '[tŤťṪṫŢţṬṭƮʈȚțṰṱṮṯƬƭ]',\n\t\t'u': '[uŬŭɄʉỤụÜüÚúÙùÛûǓǔŰűŬŭƯưỦủŪūŨũŲųȔȕ∪]',\n\t\t'v': '[vṼṽṾṿƲʋꝞꝟⱱʋ]',\n\t\t'w': '[wẂẃẀẁŴŵẄẅẆẇẈẉ]',\n\t\t'x': '[xẌẍẊẋχ]',\n\t\t'y': '[yÝýỲỳŶŷŸÿỸỹẎẏỴỵɎɏƳƴ]',\n\t\t'z': '[zŹźẐẑŽžŻżẒẓẔẕƵƶ]'\n\t};\n\n\tvar asciifold = (function() {\n\t\tvar i, n, k, chunk;\n\t\tvar foreignletters = '';\n\t\tvar lookup = {};\n\t\tfor (k in DIACRITICS) {\n\t\t\tif (DIACRITICS.hasOwnProperty(k)) {\n\t\t\t\tchunk = DIACRITICS[k].substring(2, DIACRITICS[k].length - 1);\n\t\t\t\tforeignletters += chunk;\n\t\t\t\tfor (i = 0, n = chunk.length; i < n; i++) {\n\t\t\t\t\tlookup[chunk.charAt(i)] = k;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar regexp = new RegExp('[' +  foreignletters + ']', 'g');\n\t\treturn function(str) {\n\t\t\treturn str.replace(regexp, function(foreignletter) {\n\t\t\t\treturn lookup[foreignletter];\n\t\t\t}).toLowerCase();\n\t\t};\n\t})();\n\n\n\t// export\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\n\treturn Sifter;\n}));\n\n\n\n/**\n * microplugin.js\n * Copyright (c) 2013 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis <brian@thirdroute.com>\n */\n\n(function(root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine('microplugin', factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.MicroPlugin = factory();\n\t}\n}(this, function() {\n\tvar MicroPlugin = {};\n\n\tMicroPlugin.mixin = function(Interface) {\n\t\tInterface.plugins = {};\n\n\t\t/**\n\t\t * Initializes the listed plugins (with options).\n\t\t * Acceptable formats:\n\t\t *\n\t\t * List (without options):\n\t\t *   ['a', 'b', 'c']\n\t\t *\n\t\t * List (with options):\n\t\t *   [{'name': 'a', options: {}}, {'name': 'b', options: {}}]\n\t\t *\n\t\t * Hash (with options):\n\t\t *   {'a': { ... }, 'b': { ... }, 'c': { ... }}\n\t\t *\n\t\t * @param {mixed} plugins\n\t\t */\n\t\tInterface.prototype.initializePlugins = function(plugins) {\n\t\t\tvar i, n, key;\n\t\t\tvar self  = this;\n\t\t\tvar queue = [];\n\n\t\t\tself.plugins = {\n\t\t\t\tnames     : [],\n\t\t\t\tsettings  : {},\n\t\t\t\trequested : {},\n\t\t\t\tloaded    : {}\n\t\t\t};\n\n\t\t\tif (utils.isArray(plugins)) {\n\t\t\t\tfor (i = 0, n = plugins.length; i < n; i++) {\n\t\t\t\t\tif (typeof plugins[i] === 'string') {\n\t\t\t\t\t\tqueue.push(plugins[i]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.plugins.settings[plugins[i].name] = plugins[i].options;\n\t\t\t\t\t\tqueue.push(plugins[i].name);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (plugins) {\n\t\t\t\tfor (key in plugins) {\n\t\t\t\t\tif (plugins.hasOwnProperty(key)) {\n\t\t\t\t\t\tself.plugins.settings[key] = plugins[key];\n\t\t\t\t\t\tqueue.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\twhile (queue.length) {\n\t\t\t\tself.require(queue.shift());\n\t\t\t}\n\t\t};\n\n\t\tInterface.prototype.loadPlugin = function(name) {\n\t\t\tvar self    = this;\n\t\t\tvar plugins = self.plugins;\n\t\t\tvar plugin  = Interface.plugins[name];\n\n\t\t\tif (!Interface.plugins.hasOwnProperty(name)) {\n\t\t\t\tthrow new Error('Unable to find \"' +  name + '\" plugin');\n\t\t\t}\n\n\t\t\tplugins.requested[name] = true;\n\t\t\tplugins.loaded[name] = plugin.fn.apply(self, [self.plugins.settings[name] || {}]);\n\t\t\tplugins.names.push(name);\n\t\t};\n\n\t\t/**\n\t\t * Initializes a plugin.\n\t\t *\n\t\t * @param {string} name\n\t\t */\n\t\tInterface.prototype.require = function(name) {\n\t\t\tvar self = this;\n\t\t\tvar plugins = self.plugins;\n\n\t\t\tif (!self.plugins.loaded.hasOwnProperty(name)) {\n\t\t\t\tif (plugins.requested[name]) {\n\t\t\t\t\tthrow new Error('Plugin has circular dependency (\"' + name + '\")');\n\t\t\t\t}\n\t\t\t\tself.loadPlugin(name);\n\t\t\t}\n\n\t\t\treturn plugins.loaded[name];\n\t\t};\n\n\t\t/**\n\t\t * Registers a plugin.\n\t\t *\n\t\t * @param {string} name\n\t\t * @param {function} fn\n\t\t */\n\t\tInterface.define = function(name, fn) {\n\t\t\tInterface.plugins[name] = {\n\t\t\t\t'name' : name,\n\t\t\t\t'fn'   : fn\n\t\t\t};\n\t\t};\n\t};\n\n\tvar utils = {\n\t\tisArray: Array.isArray || function(vArg) {\n\t\t\treturn Object.prototype.toString.call(vArg) === '[object Array]';\n\t\t}\n\t};\n\n\treturn MicroPlugin;\n}));\n\n/**\n * selectize.js (v0.12.6)\n * Copyright (c) 2013–2015 Brian Reavis & contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this\n * file except in compliance with the License. You may obtain a copy of the License at:\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF\n * ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n *\n * @author Brian Reavis <brian@thirdroute.com>\n */\n\n/*jshint curly:false */\n/*jshint browser:true */\n\n(function(root, factory) {\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine('selectize', ['jquery','sifter','microplugin'], factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory(require('jquery'), require('sifter'), require('microplugin'));\n\t} else {\n\t\troot.Selectize = factory(root.jQuery, root.Sifter, root.MicroPlugin);\n\t}\n}(this, function($, Sifter, MicroPlugin) {\n\t'use strict';\n\n\tvar highlight = function($element, pattern) {\n\t\tif (typeof pattern === 'string' && !pattern.length) return;\n\t\tvar regex = (typeof pattern === 'string') ? new RegExp(pattern, 'i') : pattern;\n\t\n\t\tvar highlight = function(node) {\n\t\t\tvar skip = 0;\n\t\t\t// Wrap matching part of text node with highlighting <span>, e.g.\n\t\t\t// Soccer  ->  <span class=\"highlight\">Soc</span>cer  for regex = /soc/i\n\t\t\tif (node.nodeType === 3) {\n\t\t\t\tvar pos = node.data.search(regex);\n\t\t\t\tif (pos >= 0 && node.data.length > 0) {\n\t\t\t\t\tvar match = node.data.match(regex);\n\t\t\t\t\tvar spannode = document.createElement('span');\n\t\t\t\t\tspannode.className = 'highlight';\n\t\t\t\t\tvar middlebit = node.splitText(pos);\n\t\t\t\t\tvar endbit = middlebit.splitText(match[0].length);\n\t\t\t\t\tvar middleclone = middlebit.cloneNode(true);\n\t\t\t\t\tspannode.appendChild(middleclone);\n\t\t\t\t\tmiddlebit.parentNode.replaceChild(spannode, middlebit);\n\t\t\t\t\tskip = 1;\n\t\t\t\t}\n\t\t\t} \n\t\t\t// Recurse element node, looking for child text nodes to highlight, unless element \n\t\t\t// is childless, <script>, <style>, or already highlighted: <span class=\"hightlight\">\n\t\t\telse if (node.nodeType === 1 && node.childNodes && !/(script|style)/i.test(node.tagName) && ( node.className !== 'highlight' || node.tagName !== 'SPAN' )) {\n\t\t\t\tfor (var i = 0; i < node.childNodes.length; ++i) {\n\t\t\t\t\ti += highlight(node.childNodes[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn skip;\n\t\t};\n\t\n\t\treturn $element.each(function() {\n\t\t\thighlight(this);\n\t\t});\n\t};\n\t\n\t/**\n\t * removeHighlight fn copied from highlight v5 and\n\t * edited to remove with() and pass js strict mode\n\t */\n\t$.fn.removeHighlight = function() {\n\t\treturn this.find(\"span.highlight\").each(function() {\n\t\t\tthis.parentNode.firstChild.nodeName;\n\t\t\tvar parent = this.parentNode;\n\t\t\tparent.replaceChild(this.firstChild, this);\n\t\t\tparent.normalize();\n\t\t}).end();\n\t};\n\t\n\t\n\tvar MicroEvent = function() {};\n\tMicroEvent.prototype = {\n\t\ton: function(event, fct){\n\t\t\tthis._events = this._events || {};\n\t\t\tthis._events[event] = this._events[event] || [];\n\t\t\tthis._events[event].push(fct);\n\t\t},\n\t\toff: function(event, fct){\n\t\t\tvar n = arguments.length;\n\t\t\tif (n === 0) return delete this._events;\n\t\t\tif (n === 1) return delete this._events[event];\n\t\n\t\t\tthis._events = this._events || {};\n\t\t\tif (event in this._events === false) return;\n\t\t\tthis._events[event].splice(this._events[event].indexOf(fct), 1);\n\t\t},\n\t\ttrigger: function(event /* , args... */){\n\t\t\tthis._events = this._events || {};\n\t\t\tif (event in this._events === false) return;\n\t\t\tfor (var i = 0; i < this._events[event].length; i++){\n\t\t\t\tthis._events[event][i].apply(this, Array.prototype.slice.call(arguments, 1));\n\t\t\t}\n\t\t}\n\t};\n\t\n\t/**\n\t * Mixin will delegate all MicroEvent.js function in the destination object.\n\t *\n\t * - MicroEvent.mixin(Foobar) will make Foobar able to use MicroEvent\n\t *\n\t * @param {object} the object which will support MicroEvent\n\t */\n\tMicroEvent.mixin = function(destObject){\n\t\tvar props = ['on', 'off', 'trigger'];\n\t\tfor (var i = 0; i < props.length; i++){\n\t\t\tdestObject.prototype[props[i]] = MicroEvent.prototype[props[i]];\n\t\t}\n\t};\n\t\n\tvar IS_MAC        = /Mac/.test(navigator.userAgent);\n\t\n\tvar KEY_A         = 65;\n\tvar KEY_COMMA     = 188;\n\tvar KEY_RETURN    = 13;\n\tvar KEY_ESC       = 27;\n\tvar KEY_LEFT      = 37;\n\tvar KEY_UP        = 38;\n\tvar KEY_P         = 80;\n\tvar KEY_RIGHT     = 39;\n\tvar KEY_DOWN      = 40;\n\tvar KEY_N         = 78;\n\tvar KEY_BACKSPACE = 8;\n\tvar KEY_DELETE    = 46;\n\tvar KEY_SHIFT     = 16;\n\tvar KEY_CMD       = IS_MAC ? 91 : 17;\n\tvar KEY_CTRL      = IS_MAC ? 18 : 17;\n\tvar KEY_TAB       = 9;\n\t\n\tvar TAG_SELECT    = 1;\n\tvar TAG_INPUT     = 2;\n\t\n\t// for now, android support in general is too spotty to support validity\n\tvar SUPPORTS_VALIDITY_API = !/android/i.test(window.navigator.userAgent) && !!document.createElement('input').validity;\n\t\n\t\n\tvar isset = function(object) {\n\t\treturn typeof object !== 'undefined';\n\t};\n\t\n\t/**\n\t * Converts a scalar to its best string representation\n\t * for hash keys and HTML attribute values.\n\t *\n\t * Transformations:\n\t *   'str'     -> 'str'\n\t *   null      -> ''\n\t *   undefined -> ''\n\t *   true      -> '1'\n\t *   false     -> '0'\n\t *   0         -> '0'\n\t *   1         -> '1'\n\t *\n\t * @param {string} value\n\t * @returns {string|null}\n\t */\n\tvar hash_key = function(value) {\n\t\tif (typeof value === 'undefined' || value === null) return null;\n\t\tif (typeof value === 'boolean') return value ? '1' : '0';\n\t\treturn value + '';\n\t};\n\t\n\t/**\n\t * Escapes a string for use within HTML.\n\t *\n\t * @param {string} str\n\t * @returns {string}\n\t */\n\tvar escape_html = function(str) {\n\t\treturn (str + '')\n\t\t\t.replace(/&/g, '&amp;')\n\t\t\t.replace(/</g, '&lt;')\n\t\t\t.replace(/>/g, '&gt;')\n\t\t\t.replace(/\"/g, '&quot;');\n\t};\n\t\n\t/**\n\t * Escapes \"$\" characters in replacement strings.\n\t *\n\t * @param {string} str\n\t * @returns {string}\n\t */\n\tvar escape_replace = function(str) {\n\t\treturn (str + '').replace(/\\$/g, '$$$$');\n\t};\n\t\n\tvar hook = {};\n\t\n\t/**\n\t * Wraps `method` on `self` so that `fn`\n\t * is invoked before the original method.\n\t *\n\t * @param {object} self\n\t * @param {string} method\n\t * @param {function} fn\n\t */\n\thook.before = function(self, method, fn) {\n\t\tvar original = self[method];\n\t\tself[method] = function() {\n\t\t\tfn.apply(self, arguments);\n\t\t\treturn original.apply(self, arguments);\n\t\t};\n\t};\n\t\n\t/**\n\t * Wraps `method` on `self` so that `fn`\n\t * is invoked after the original method.\n\t *\n\t * @param {object} self\n\t * @param {string} method\n\t * @param {function} fn\n\t */\n\thook.after = function(self, method, fn) {\n\t\tvar original = self[method];\n\t\tself[method] = function() {\n\t\t\tvar result = original.apply(self, arguments);\n\t\t\tfn.apply(self, arguments);\n\t\t\treturn result;\n\t\t};\n\t};\n\t\n\t/**\n\t * Wraps `fn` so that it can only be invoked once.\n\t *\n\t * @param {function} fn\n\t * @returns {function}\n\t */\n\tvar once = function(fn) {\n\t\tvar called = false;\n\t\treturn function() {\n\t\t\tif (called) return;\n\t\t\tcalled = true;\n\t\t\tfn.apply(this, arguments);\n\t\t};\n\t};\n\t\n\t/**\n\t * Wraps `fn` so that it can only be called once\n\t * every `delay` milliseconds (invoked on the falling edge).\n\t *\n\t * @param {function} fn\n\t * @param {int} delay\n\t * @returns {function}\n\t */\n\tvar debounce = function(fn, delay) {\n\t\tvar timeout;\n\t\treturn function() {\n\t\t\tvar self = this;\n\t\t\tvar args = arguments;\n\t\t\twindow.clearTimeout(timeout);\n\t\t\ttimeout = window.setTimeout(function() {\n\t\t\t\tfn.apply(self, args);\n\t\t\t}, delay);\n\t\t};\n\t};\n\t\n\t/**\n\t * Debounce all fired events types listed in `types`\n\t * while executing the provided `fn`.\n\t *\n\t * @param {object} self\n\t * @param {array} types\n\t * @param {function} fn\n\t */\n\tvar debounce_events = function(self, types, fn) {\n\t\tvar type;\n\t\tvar trigger = self.trigger;\n\t\tvar event_args = {};\n\t\n\t\t// override trigger method\n\t\tself.trigger = function() {\n\t\t\tvar type = arguments[0];\n\t\t\tif (types.indexOf(type) !== -1) {\n\t\t\t\tevent_args[type] = arguments;\n\t\t\t} else {\n\t\t\t\treturn trigger.apply(self, arguments);\n\t\t\t}\n\t\t};\n\t\n\t\t// invoke provided function\n\t\tfn.apply(self, []);\n\t\tself.trigger = trigger;\n\t\n\t\t// trigger queued events\n\t\tfor (type in event_args) {\n\t\t\tif (event_args.hasOwnProperty(type)) {\n\t\t\t\ttrigger.apply(self, event_args[type]);\n\t\t\t}\n\t\t}\n\t};\n\t\n\t/**\n\t * A workaround for http://bugs.jquery.com/ticket/6696\n\t *\n\t * @param {object} $parent - Parent element to listen on.\n\t * @param {string} event - Event name.\n\t * @param {string} selector - Descendant selector to filter by.\n\t * @param {function} fn - Event handler.\n\t */\n\tvar watchChildEvent = function($parent, event, selector, fn) {\n\t\t$parent.on(event, selector, function(e) {\n\t\t\tvar child = e.target;\n\t\t\twhile (child && child.parentNode !== $parent[0]) {\n\t\t\t\tchild = child.parentNode;\n\t\t\t}\n\t\t\te.currentTarget = child;\n\t\t\treturn fn.apply(this, [e]);\n\t\t});\n\t};\n\t\n\t/**\n\t * Determines the current selection within a text input control.\n\t * Returns an object containing:\n\t *   - start\n\t *   - length\n\t *\n\t * @param {object} input\n\t * @returns {object}\n\t */\n\tvar getSelection = function(input) {\n\t\tvar result = {};\n\t\tif ('selectionStart' in input) {\n\t\t\tresult.start = input.selectionStart;\n\t\t\tresult.length = input.selectionEnd - result.start;\n\t\t} else if (document.selection) {\n\t\t\tinput.focus();\n\t\t\tvar sel = document.selection.createRange();\n\t\t\tvar selLen = document.selection.createRange().text.length;\n\t\t\tsel.moveStart('character', -input.value.length);\n\t\t\tresult.start = sel.text.length - selLen;\n\t\t\tresult.length = selLen;\n\t\t}\n\t\treturn result;\n\t};\n\t\n\t/**\n\t * Copies CSS properties from one element to another.\n\t *\n\t * @param {object} $from\n\t * @param {object} $to\n\t * @param {array} properties\n\t */\n\tvar transferStyles = function($from, $to, properties) {\n\t\tvar i, n, styles = {};\n\t\tif (properties) {\n\t\t\tfor (i = 0, n = properties.length; i < n; i++) {\n\t\t\t\tstyles[properties[i]] = $from.css(properties[i]);\n\t\t\t}\n\t\t} else {\n\t\t\tstyles = $from.css();\n\t\t}\n\t\t$to.css(styles);\n\t};\n\t\n\t/**\n\t * Measures the width of a string within a\n\t * parent element (in pixels).\n\t *\n\t * @param {string} str\n\t * @param {object} $parent\n\t * @returns {int}\n\t */\n\tvar measureString = function(str, $parent) {\n\t\tif (!str) {\n\t\t\treturn 0;\n\t\t}\n\t\n\t\tif (!Selectize.$testInput) {\n\t\t\tSelectize.$testInput = $('<span />').css({\n\t\t\t\tposition: 'absolute',\n\t\t\t\ttop: -99999,\n\t\t\t\tleft: -99999,\n\t\t\t\twidth: 'auto',\n\t\t\t\tpadding: 0,\n\t\t\t\twhiteSpace: 'pre'\n\t\t\t}).appendTo('body');\n\t\t}\n\t\n\t\tSelectize.$testInput.text(str);\n\t\n\t\ttransferStyles($parent, Selectize.$testInput, [\n\t\t\t'letterSpacing',\n\t\t\t'fontSize',\n\t\t\t'fontFamily',\n\t\t\t'fontWeight',\n\t\t\t'textTransform'\n\t\t]);\n\t\n\t\treturn Selectize.$testInput.width();\n\t};\n\t\n\t/**\n\t * Sets up an input to grow horizontally as the user\n\t * types. If the value is changed manually, you can\n\t * trigger the \"update\" handler to resize:\n\t *\n\t * $input.trigger('update');\n\t *\n\t * @param {object} $input\n\t */\n\tvar autoGrow = function($input) {\n\t\tvar currentWidth = null;\n\t\n\t\tvar update = function(e, options) {\n\t\t\tvar value, keyCode, printable, placeholder, width;\n\t\t\tvar shift, character, selection;\n\t\t\te = e || window.event || {};\n\t\t\toptions = options || {};\n\t\n\t\t\tif (e.metaKey || e.altKey) return;\n\t\t\tif (!options.force && $input.data('grow') === false) return;\n\t\n\t\t\tvalue = $input.val();\n\t\t\tif (e.type && e.type.toLowerCase() === 'keydown') {\n\t\t\t\tkeyCode = e.keyCode;\n\t\t\t\tprintable = (\n\t\t\t\t\t(keyCode >= 48 && keyCode <= 57)  || // 0-9\n\t\t\t\t\t(keyCode >= 65 && keyCode <= 90)   || // a-z\n\t\t\t\t\t(keyCode >= 96 && keyCode <= 111)  || // numpad 0-9, numeric operators\n\t\t\t\t\t(keyCode >= 186 && keyCode <= 222) || // semicolon, equal, comma, dash, etc.\n\t\t\t\t\tkeyCode === 32 // space\n\t\t\t\t);\n\t\n\t\t\t\tif (keyCode === KEY_DELETE || keyCode === KEY_BACKSPACE) {\n\t\t\t\t\tselection = getSelection($input[0]);\n\t\t\t\t\tif (selection.length) {\n\t\t\t\t\t\tvalue = value.substring(0, selection.start) + value.substring(selection.start + selection.length);\n\t\t\t\t\t} else if (keyCode === KEY_BACKSPACE && selection.start) {\n\t\t\t\t\t\tvalue = value.substring(0, selection.start - 1) + value.substring(selection.start + 1);\n\t\t\t\t\t} else if (keyCode === KEY_DELETE && typeof selection.start !== 'undefined') {\n\t\t\t\t\t\tvalue = value.substring(0, selection.start) + value.substring(selection.start + 1);\n\t\t\t\t\t}\n\t\t\t\t} else if (printable) {\n\t\t\t\t\tshift = e.shiftKey;\n\t\t\t\t\tcharacter = String.fromCharCode(e.keyCode);\n\t\t\t\t\tif (shift) character = character.toUpperCase();\n\t\t\t\t\telse character = character.toLowerCase();\n\t\t\t\t\tvalue += character;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tplaceholder = $input.attr('placeholder');\n\t\t\tif (!value && placeholder) {\n\t\t\t\tvalue = placeholder;\n\t\t\t}\n\t\n\t\t\twidth = measureString(value, $input) + 4;\n\t\t\tif (width !== currentWidth) {\n\t\t\t\tcurrentWidth = width;\n\t\t\t\t$input.width(width);\n\t\t\t\t$input.triggerHandler('resize');\n\t\t\t}\n\t\t};\n\t\n\t\t$input.on('keydown keyup update blur', update);\n\t\tupdate();\n\t};\n\t\n\tvar domToString = function(d) {\n\t\tvar tmp = document.createElement('div');\n\t\n\t\ttmp.appendChild(d.cloneNode(true));\n\t\n\t\treturn tmp.innerHTML;\n\t};\n\t\n\tvar logError = function(message, options){\n\t\tif(!options) options = {};\n\t\tvar component = \"Selectize\";\n\t\n\t\tconsole.error(component + \": \" + message)\n\t\n\t\tif(options.explanation){\n\t\t\t// console.group is undefined in <IE11\n\t\t\tif(console.group) console.group();\n\t\t\tconsole.error(options.explanation);\n\t\t\tif(console.group) console.groupEnd();\n\t\t}\n\t}\n\t\n\t\n\tvar Selectize = function($input, settings) {\n\t\tvar key, i, n, dir, input, self = this;\n\t\tinput = $input[0];\n\t\tinput.selectize = self;\n\t\n\t\t// detect rtl environment\n\t\tvar computedStyle = window.getComputedStyle && window.getComputedStyle(input, null);\n\t\tdir = computedStyle ? computedStyle.getPropertyValue('direction') : input.currentStyle && input.currentStyle.direction;\n\t\tdir = dir || $input.parents('[dir]:first').attr('dir') || '';\n\t\n\t\t// setup default state\n\t\t$.extend(self, {\n\t\t\torder            : 0,\n\t\t\tsettings         : settings,\n\t\t\t$input           : $input,\n\t\t\ttabIndex         : $input.attr('tabindex') || '',\n\t\t\ttagType          : input.tagName.toLowerCase() === 'select' ? TAG_SELECT : TAG_INPUT,\n\t\t\trtl              : /rtl/i.test(dir),\n\t\n\t\t\teventNS          : '.selectize' + (++Selectize.count),\n\t\t\thighlightedValue : null,\n\t\t\tisBlurring       : false,\n\t\t\tisOpen           : false,\n\t\t\tisDisabled       : false,\n\t\t\tisRequired       : $input.is('[required]'),\n\t\t\tisInvalid        : false,\n\t\t\tisLocked         : false,\n\t\t\tisFocused        : false,\n\t\t\tisInputHidden    : false,\n\t\t\tisSetup          : false,\n\t\t\tisShiftDown      : false,\n\t\t\tisCmdDown        : false,\n\t\t\tisCtrlDown       : false,\n\t\t\tignoreFocus      : false,\n\t\t\tignoreBlur       : false,\n\t\t\tignoreHover      : false,\n\t\t\thasOptions       : false,\n\t\t\tcurrentResults   : null,\n\t\t\tlastValue        : '',\n\t\t\tcaretPos         : 0,\n\t\t\tloading          : 0,\n\t\t\tloadedSearches   : {},\n\t\n\t\t\t$activeOption    : null,\n\t\t\t$activeItems     : [],\n\t\n\t\t\toptgroups        : {},\n\t\t\toptions          : {},\n\t\t\tuserOptions      : {},\n\t\t\titems            : [],\n\t\t\trenderCache      : {},\n\t\t\tonSearchChange   : settings.loadThrottle === null ? self.onSearchChange : debounce(self.onSearchChange, settings.loadThrottle)\n\t\t});\n\t\n\t\t// search system\n\t\tself.sifter = new Sifter(this.options, {diacritics: settings.diacritics});\n\t\n\t\t// build options table\n\t\tif (self.settings.options) {\n\t\t\tfor (i = 0, n = self.settings.options.length; i < n; i++) {\n\t\t\t\tself.registerOption(self.settings.options[i]);\n\t\t\t}\n\t\t\tdelete self.settings.options;\n\t\t}\n\t\n\t\t// build optgroup table\n\t\tif (self.settings.optgroups) {\n\t\t\tfor (i = 0, n = self.settings.optgroups.length; i < n; i++) {\n\t\t\t\tself.registerOptionGroup(self.settings.optgroups[i]);\n\t\t\t}\n\t\t\tdelete self.settings.optgroups;\n\t\t}\n\t\n\t\t// option-dependent defaults\n\t\tself.settings.mode = self.settings.mode || (self.settings.maxItems === 1 ? 'single' : 'multi');\n\t\tif (typeof self.settings.hideSelected !== 'boolean') {\n\t\t\tself.settings.hideSelected = self.settings.mode === 'multi';\n\t\t}\n\t\n\t\tself.initializePlugins(self.settings.plugins);\n\t\tself.setupCallbacks();\n\t\tself.setupTemplates();\n\t\tself.setup();\n\t};\n\t\n\t// mixins\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\t\n\tMicroEvent.mixin(Selectize);\n\t\n\tif(typeof MicroPlugin !== \"undefined\"){\n\t\tMicroPlugin.mixin(Selectize);\n\t}else{\n\t\tlogError(\"Dependency MicroPlugin is missing\",\n\t\t\t{explanation:\n\t\t\t\t\"Make sure you either: (1) are using the \\\"standalone\\\" \"+\n\t\t\t\t\"version of Selectize, or (2) require MicroPlugin before you \"+\n\t\t\t\t\"load Selectize.\"}\n\t\t);\n\t}\n\t\n\t\n\t// methods\n\t// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n\t\n\t$.extend(Selectize.prototype, {\n\t\n\t\t/**\n\t\t * Creates all elements and sets up event bindings.\n\t\t */\n\t\tsetup: function() {\n\t\t\tvar self      = this;\n\t\t\tvar settings  = self.settings;\n\t\t\tvar eventNS   = self.eventNS;\n\t\t\tvar $window   = $(window);\n\t\t\tvar $document = $(document);\n\t\t\tvar $input    = self.$input;\n\t\n\t\t\tvar $wrapper;\n\t\t\tvar $control;\n\t\t\tvar $control_input;\n\t\t\tvar $dropdown;\n\t\t\tvar $dropdown_content;\n\t\t\tvar $dropdown_parent;\n\t\t\tvar inputMode;\n\t\t\tvar timeout_blur;\n\t\t\tvar timeout_focus;\n\t\t\tvar classes;\n\t\t\tvar classes_plugins;\n\t\t\tvar inputId;\n\t\n\t\t\tinputMode         = self.settings.mode;\n\t\t\tclasses           = $input.attr('class') || '';\n\t\n\t\t\t$wrapper          = $('<div>').addClass(settings.wrapperClass).addClass(classes).addClass(inputMode);\n\t\t\t$control          = $('<div>').addClass(settings.inputClass).addClass('items').appendTo($wrapper);\n\t\t\t$control_input    = $('<input type=\"text\" autocomplete=\"off\" />').appendTo($control).attr('tabindex', $input.is(':disabled') ? '-1' : self.tabIndex);\n\t\t\t$dropdown_parent  = $(settings.dropdownParent || $wrapper);\n\t\t\t$dropdown         = $('<div>').addClass(settings.dropdownClass).addClass(inputMode).hide().appendTo($dropdown_parent);\n\t\t\t$dropdown_content = $('<div>').addClass(settings.dropdownContentClass).appendTo($dropdown);\n\t\n\t\t\tif(inputId = $input.attr('id')) {\n\t\t\t\t$control_input.attr('id', inputId + '-selectized');\n\t\t\t\t$(\"label[for='\"+inputId+\"']\").attr('for', inputId + '-selectized');\n\t\t\t}\n\t\n\t\t\tif(self.settings.copyClassesToDropdown) {\n\t\t\t\t$dropdown.addClass(classes);\n\t\t\t}\n\t\n\t\t\t$wrapper.css({\n\t\t\t\twidth: $input[0].style.width\n\t\t\t});\n\t\n\t\t\tif (self.plugins.names.length) {\n\t\t\t\tclasses_plugins = 'plugin-' + self.plugins.names.join(' plugin-');\n\t\t\t\t$wrapper.addClass(classes_plugins);\n\t\t\t\t$dropdown.addClass(classes_plugins);\n\t\t\t}\n\t\n\t\t\tif ((settings.maxItems === null || settings.maxItems > 1) && self.tagType === TAG_SELECT) {\n\t\t\t\t$input.attr('multiple', 'multiple');\n\t\t\t}\n\t\n\t\t\tif (self.settings.placeholder) {\n\t\t\t\t$control_input.attr('placeholder', settings.placeholder);\n\t\t\t}\n\t\n\t\t\t// if splitOn was not passed in, construct it from the delimiter to allow pasting universally\n\t\t\tif (!self.settings.splitOn && self.settings.delimiter) {\n\t\t\t\tvar delimiterEscaped = self.settings.delimiter.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n\t\t\t\tself.settings.splitOn = new RegExp('\\\\s*' + delimiterEscaped + '+\\\\s*');\n\t\t\t}\n\t\n\t\t\tif ($input.attr('autocorrect')) {\n\t\t\t\t$control_input.attr('autocorrect', $input.attr('autocorrect'));\n\t\t\t}\n\t\n\t\t\tif ($input.attr('autocapitalize')) {\n\t\t\t\t$control_input.attr('autocapitalize', $input.attr('autocapitalize'));\n\t\t\t}\n\t\t\t$control_input[0].type = $input[0].type;\n\t\n\t\t\tself.$wrapper          = $wrapper;\n\t\t\tself.$control          = $control;\n\t\t\tself.$control_input    = $control_input;\n\t\t\tself.$dropdown         = $dropdown;\n\t\t\tself.$dropdown_content = $dropdown_content;\n\t\n\t\t\t$dropdown.on('mouseenter mousedown click', '[data-disabled]>[data-selectable]', function(e) { e.stopImmediatePropagation(); });\n\t\t\t$dropdown.on('mouseenter', '[data-selectable]', function() { return self.onOptionHover.apply(self, arguments); });\n\t\t\t$dropdown.on('mousedown click', '[data-selectable]', function() { return self.onOptionSelect.apply(self, arguments); });\n\t\t\twatchChildEvent($control, 'mousedown', '*:not(input)', function() { return self.onItemSelect.apply(self, arguments); });\n\t\t\tautoGrow($control_input);\n\t\n\t\t\t$control.on({\n\t\t\t\tmousedown : function() { return self.onMouseDown.apply(self, arguments); },\n\t\t\t\tclick     : function() { return self.onClick.apply(self, arguments); }\n\t\t\t});\n\t\n\t\t\t$control_input.on({\n\t\t\t\tmousedown : function(e) { e.stopPropagation(); },\n\t\t\t\tkeydown   : function() { return self.onKeyDown.apply(self, arguments); },\n\t\t\t\tkeyup     : function() { return self.onKeyUp.apply(self, arguments); },\n\t\t\t\tkeypress  : function() { return self.onKeyPress.apply(self, arguments); },\n\t\t\t\tresize    : function() { self.positionDropdown.apply(self, []); },\n\t\t\t\tblur      : function() { return self.onBlur.apply(self, arguments); },\n\t\t\t\tfocus     : function() { self.ignoreBlur = false; return self.onFocus.apply(self, arguments); },\n\t\t\t\tpaste     : function() { return self.onPaste.apply(self, arguments); }\n\t\t\t});\n\t\n\t\t\t$document.on('keydown' + eventNS, function(e) {\n\t\t\t\tself.isCmdDown = e[IS_MAC ? 'metaKey' : 'ctrlKey'];\n\t\t\t\tself.isCtrlDown = e[IS_MAC ? 'altKey' : 'ctrlKey'];\n\t\t\t\tself.isShiftDown = e.shiftKey;\n\t\t\t});\n\t\n\t\t\t$document.on('keyup' + eventNS, function(e) {\n\t\t\t\tif (e.keyCode === KEY_CTRL) self.isCtrlDown = false;\n\t\t\t\tif (e.keyCode === KEY_SHIFT) self.isShiftDown = false;\n\t\t\t\tif (e.keyCode === KEY_CMD) self.isCmdDown = false;\n\t\t\t});\n\t\n\t\t\t$document.on('mousedown' + eventNS, function(e) {\n\t\t\t\tif (self.isFocused) {\n\t\t\t\t\t// prevent events on the dropdown scrollbar from causing the control to blur\n\t\t\t\t\tif (e.target === self.$dropdown[0] || e.target.parentNode === self.$dropdown[0]) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t// blur on click outside\n\t\t\t\t\tif (!self.$control.has(e.target).length && e.target !== self.$control[0]) {\n\t\t\t\t\t\tself.blur(e.target);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\t$window.on(['scroll' + eventNS, 'resize' + eventNS].join(' '), function() {\n\t\t\t\tif (self.isOpen) {\n\t\t\t\t\tself.positionDropdown.apply(self, arguments);\n\t\t\t\t}\n\t\t\t});\n\t\t\t$window.on('mousemove' + eventNS, function() {\n\t\t\t\tself.ignoreHover = false;\n\t\t\t});\n\t\n\t\t\t// store original children and tab index so that they can be\n\t\t\t// restored when the destroy() method is called.\n\t\t\tthis.revertSettings = {\n\t\t\t\t$children : $input.children().detach(),\n\t\t\t\ttabindex  : $input.attr('tabindex')\n\t\t\t};\n\t\n\t\t\t$input.attr('tabindex', -1).hide().after(self.$wrapper);\n\t\n\t\t\tif ($.isArray(settings.items)) {\n\t\t\t\tself.setValue(settings.items);\n\t\t\t\tdelete settings.items;\n\t\t\t}\n\t\n\t\t\t// feature detect for the validation API\n\t\t\tif (SUPPORTS_VALIDITY_API) {\n\t\t\t\t$input.on('invalid' + eventNS, function(e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tself.isInvalid = true;\n\t\t\t\t\tself.refreshState();\n\t\t\t\t});\n\t\t\t}\n\t\n\t\t\tself.updateOriginalInput();\n\t\t\tself.refreshItems();\n\t\t\tself.refreshState();\n\t\t\tself.updatePlaceholder();\n\t\t\tself.isSetup = true;\n\t\n\t\t\tif ($input.is(':disabled')) {\n\t\t\t\tself.disable();\n\t\t\t}\n\t\n\t\t\tself.on('change', this.onChange);\n\t\n\t\t\t$input.data('selectize', self);\n\t\t\t$input.addClass('selectized');\n\t\t\tself.trigger('initialize');\n\t\n\t\t\t// preload options\n\t\t\tif (settings.preload === true) {\n\t\t\t\tself.onSearchChange('');\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t/**\n\t\t * Sets up default rendering functions.\n\t\t */\n\t\tsetupTemplates: function() {\n\t\t\tvar self = this;\n\t\t\tvar field_label = self.settings.labelField;\n\t\t\tvar field_optgroup = self.settings.optgroupLabelField;\n\t\n\t\t\tvar templates = {\n\t\t\t\t'optgroup': function(data) {\n\t\t\t\t\treturn '<div class=\"optgroup\">' + data.html + '</div>';\n\t\t\t\t},\n\t\t\t\t'optgroup_header': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"optgroup-header\">' + escape(data[field_optgroup]) + '</div>';\n\t\t\t\t},\n\t\t\t\t'option': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"option\">' + escape(data[field_label]) + '</div>';\n\t\t\t\t},\n\t\t\t\t'item': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"item\">' + escape(data[field_label]) + '</div>';\n\t\t\t\t},\n\t\t\t\t'option_create': function(data, escape) {\n\t\t\t\t\treturn '<div class=\"create\">Add <strong>' + escape(data.input) + '</strong>&hellip;</div>';\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tself.settings.render = $.extend({}, templates, self.settings.render);\n\t\t},\n\t\n\t\t/**\n\t\t * Maps fired events to callbacks provided\n\t\t * in the settings used when creating the control.\n\t\t */\n\t\tsetupCallbacks: function() {\n\t\t\tvar key, fn, callbacks = {\n\t\t\t\t'initialize'      : 'onInitialize',\n\t\t\t\t'change'          : 'onChange',\n\t\t\t\t'item_add'        : 'onItemAdd',\n\t\t\t\t'item_remove'     : 'onItemRemove',\n\t\t\t\t'clear'           : 'onClear',\n\t\t\t\t'option_add'      : 'onOptionAdd',\n\t\t\t\t'option_remove'   : 'onOptionRemove',\n\t\t\t\t'option_clear'    : 'onOptionClear',\n\t\t\t\t'optgroup_add'    : 'onOptionGroupAdd',\n\t\t\t\t'optgroup_remove' : 'onOptionGroupRemove',\n\t\t\t\t'optgroup_clear'  : 'onOptionGroupClear',\n\t\t\t\t'dropdown_open'   : 'onDropdownOpen',\n\t\t\t\t'dropdown_close'  : 'onDropdownClose',\n\t\t\t\t'type'            : 'onType',\n\t\t\t\t'load'            : 'onLoad',\n\t\t\t\t'focus'           : 'onFocus',\n\t\t\t\t'blur'            : 'onBlur'\n\t\t\t};\n\t\n\t\t\tfor (key in callbacks) {\n\t\t\t\tif (callbacks.hasOwnProperty(key)) {\n\t\t\t\t\tfn = this.settings[callbacks[key]];\n\t\t\t\t\tif (fn) this.on(key, fn);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the main control element\n\t\t * has a click event.\n\t\t *\n\t\t * @param {object} e\n\t\t * @return {boolean}\n\t\t */\n\t\tonClick: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\t// necessary for mobile webkit devices (manual focus triggering\n\t\t\t// is ignored unless invoked within a click event)\n\t    // also necessary to reopen a dropdown that has been closed by\n\t    // closeAfterSelect\n\t\t\tif (!self.isFocused || !self.isOpen) {\n\t\t\t\tself.focus();\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the main control element\n\t\t * has a mouse down event.\n\t\t *\n\t\t * @param {object} e\n\t\t * @return {boolean}\n\t\t */\n\t\tonMouseDown: function(e) {\n\t\t\tvar self = this;\n\t\t\tvar defaultPrevented = e.isDefaultPrevented();\n\t\t\tvar $target = $(e.target);\n\t\n\t\t\tif (self.isFocused) {\n\t\t\t\t// retain focus by preventing native handling. if the\n\t\t\t\t// event target is the input it should not be modified.\n\t\t\t\t// otherwise, text selection within the input won't work.\n\t\t\t\tif (e.target !== self.$control_input[0]) {\n\t\t\t\t\tif (self.settings.mode === 'single') {\n\t\t\t\t\t\t// toggle dropdown\n\t\t\t\t\t\tself.isOpen ? self.close() : self.open();\n\t\t\t\t\t} else if (!defaultPrevented) {\n\t\t\t\t\t\tself.setActiveItem(null);\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// give control focus\n\t\t\t\tif (!defaultPrevented) {\n\t\t\t\t\twindow.setTimeout(function() {\n\t\t\t\t\t\tself.focus();\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the value of the control has been changed.\n\t\t * This should propagate the event to the original DOM\n\t\t * input / select element.\n\t\t */\n\t\tonChange: function() {\n\t\t\tthis.$input.trigger('change');\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> paste.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonPaste: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isFull() || self.isInputHidden || self.isLocked) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If a regex or string is included, this will split the pasted\n\t\t\t// input and create Items for each separate value\n\t\t\tif (self.settings.splitOn) {\n\t\n\t\t\t\t// Wait for pasted text to be recognized in value\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tvar pastedText = self.$control_input.val();\n\t\t\t\t\tif(!pastedText.match(self.settings.splitOn)){ return }\n\t\n\t\t\t\t\tvar splitInput = $.trim(pastedText).split(self.settings.splitOn);\n\t\t\t\t\tfor (var i = 0, n = splitInput.length; i < n; i++) {\n\t\t\t\t\t\tself.createItem(splitInput[i]);\n\t\t\t\t\t}\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> keypress.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonKeyPress: function(e) {\n\t\t\tif (this.isLocked) return e && e.preventDefault();\n\t\t\tvar character = String.fromCharCode(e.keyCode || e.which);\n\t\t\tif (this.settings.create && this.settings.mode === 'multi' && character === this.settings.delimiter) {\n\t\t\t\tthis.createItem();\n\t\t\t\te.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> keydown.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonKeyDown: function(e) {\n\t\t\tvar isInput = e.target === this.$control_input[0];\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked) {\n\t\t\t\tif (e.keyCode !== KEY_TAB) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tswitch (e.keyCode) {\n\t\t\t\tcase KEY_A:\n\t\t\t\t\tif (self.isCmdDown) {\n\t\t\t\t\t\tself.selectAll();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase KEY_ESC:\n\t\t\t\t\tif (self.isOpen) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_N:\n\t\t\t\t\tif (!e.ctrlKey || e.altKey) break;\n\t\t\t\tcase KEY_DOWN:\n\t\t\t\t\tif (!self.isOpen && self.hasOptions) {\n\t\t\t\t\t\tself.open();\n\t\t\t\t\t} else if (self.$activeOption) {\n\t\t\t\t\t\tself.ignoreHover = true;\n\t\t\t\t\t\tvar $next = self.getAdjacentOption(self.$activeOption, 1);\n\t\t\t\t\t\tif ($next.length) self.setActiveOption($next, true, true);\n\t\t\t\t\t}\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_P:\n\t\t\t\t\tif (!e.ctrlKey || e.altKey) break;\n\t\t\t\tcase KEY_UP:\n\t\t\t\t\tif (self.$activeOption) {\n\t\t\t\t\t\tself.ignoreHover = true;\n\t\t\t\t\t\tvar $prev = self.getAdjacentOption(self.$activeOption, -1);\n\t\t\t\t\t\tif ($prev.length) self.setActiveOption($prev, true, true);\n\t\t\t\t\t}\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_RETURN:\n\t\t\t\t\tif (self.isOpen && self.$activeOption) {\n\t\t\t\t\t\tself.onOptionSelect({currentTarget: self.$activeOption});\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_LEFT:\n\t\t\t\t\tself.advanceSelection(-1, e);\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_RIGHT:\n\t\t\t\t\tself.advanceSelection(1, e);\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_TAB:\n\t\t\t\t\tif (self.settings.selectOnTab && self.isOpen && self.$activeOption) {\n\t\t\t\t\t\tself.onOptionSelect({currentTarget: self.$activeOption});\n\t\n\t\t\t\t\t\t// Default behaviour is to jump to the next field, we only want this\n\t\t\t\t\t\t// if the current field doesn't accept any more entries\n\t\t\t\t\t\tif (!self.isFull()) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (self.settings.create && self.createItem()) {\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\tcase KEY_BACKSPACE:\n\t\t\t\tcase KEY_DELETE:\n\t\t\t\t\tself.deleteSelection(e);\n\t\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif ((self.isFull() || self.isInputHidden) && !(IS_MAC ? e.metaKey : e.ctrlKey)) {\n\t\t\t\te.preventDefault();\n\t\t\t\treturn;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> keyup.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonKeyUp: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked) return e && e.preventDefault();\n\t\t\tvar value = self.$control_input.val() || '';\n\t\t\tif (self.lastValue !== value) {\n\t\t\t\tself.lastValue = value;\n\t\t\t\tself.onSearchChange(value);\n\t\t\t\tself.refreshOptions();\n\t\t\t\tself.trigger('type', value);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Invokes the user-provide option provider / loader.\n\t\t *\n\t\t * Note: this function is debounced in the Selectize\n\t\t * constructor (by `settings.loadThrottle` milliseconds)\n\t\t *\n\t\t * @param {string} value\n\t\t */\n\t\tonSearchChange: function(value) {\n\t\t\tvar self = this;\n\t\t\tvar fn = self.settings.load;\n\t\t\tif (!fn) return;\n\t\t\tif (self.loadedSearches.hasOwnProperty(value)) return;\n\t\t\tself.loadedSearches[value] = true;\n\t\t\tself.load(function(callback) {\n\t\t\t\tfn.apply(self, [value, callback]);\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> focus.\n\t\t *\n\t\t * @param {object} e (optional)\n\t\t * @returns {boolean}\n\t\t */\n\t\tonFocus: function(e) {\n\t\t\tvar self = this;\n\t\t\tvar wasFocused = self.isFocused;\n\t\n\t\t\tif (self.isDisabled) {\n\t\t\t\tself.blur();\n\t\t\t\te && e.preventDefault();\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\tif (self.ignoreFocus) return;\n\t\t\tself.isFocused = true;\n\t\t\tif (self.settings.preload === 'focus') self.onSearchChange('');\n\t\n\t\t\tif (!wasFocused) self.trigger('focus');\n\t\n\t\t\tif (!self.$activeItems.length) {\n\t\t\t\tself.showInput();\n\t\t\t\tself.setActiveItem(null);\n\t\t\t\tself.refreshOptions(!!self.settings.openOnFocus);\n\t\t\t}\n\t\n\t\t\tself.refreshState();\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered on <input> blur.\n\t\t *\n\t\t * @param {object} e\n\t\t * @param {Element} dest\n\t\t */\n\t\tonBlur: function(e, dest) {\n\t\t\tvar self = this;\n\t\t\tif (!self.isFocused) return;\n\t\t\tself.isFocused = false;\n\t\n\t\t\tif (self.ignoreFocus) {\n\t\t\t\treturn;\n\t\t\t} else if (!self.ignoreBlur && document.activeElement === self.$dropdown_content[0]) {\n\t\t\t\t// necessary to prevent IE closing the dropdown when the scrollbar is clicked\n\t\t\t\tself.ignoreBlur = true;\n\t\t\t\tself.onFocus(e);\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tvar deactivate = function() {\n\t\t\t\tself.close();\n\t\t\t\tself.setTextboxValue('');\n\t\t\t\tself.setActiveItem(null);\n\t\t\t\tself.setActiveOption(null);\n\t\t\t\tself.setCaret(self.items.length);\n\t\t\t\tself.refreshState();\n\t\n\t\t\t\t// IE11 bug: element still marked as active\n\t\t\t\tdest && dest.focus && dest.focus();\n\t\n\t\t\t\tself.isBlurring = false;\n\t\t\t\tself.ignoreFocus = false;\n\t\t\t\tself.trigger('blur');\n\t\t\t};\n\t\n\t\t\tself.isBlurring = true;\n\t\t\tself.ignoreFocus = true;\n\t\t\tif (self.settings.create && self.settings.createOnBlur) {\n\t\t\t\tself.createItem(null, false, deactivate);\n\t\t\t} else {\n\t\t\t\tdeactivate();\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the user rolls over\n\t\t * an option in the autocomplete dropdown menu.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonOptionHover: function(e) {\n\t\t\tif (this.ignoreHover) return;\n\t\t\tthis.setActiveOption(e.currentTarget, false);\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the user clicks on an option\n\t\t * in the autocomplete dropdown menu.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonOptionSelect: function(e) {\n\t\t\tvar value, $target, $option, self = this;\n\t\n\t\t\tif (e.preventDefault) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\n\t\t\t$target = $(e.currentTarget);\n\t\t\tif ($target.hasClass('create')) {\n\t\t\t\tself.createItem(null, function() {\n\t\t\t\t\tif (self.settings.closeAfterSelect) {\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tvalue = $target.attr('data-value');\n\t\t\t\tif (typeof value !== 'undefined') {\n\t\t\t\t\tself.lastQuery = null;\n\t\t\t\t\tself.setTextboxValue('');\n\t\t\t\t\tself.addItem(value);\n\t\t\t\t\tif (self.settings.closeAfterSelect) {\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t} else if (!self.settings.hideSelected && e.type && /mouse/.test(e.type)) {\n\t\t\t\t\t\tself.setActiveOption(self.getOption(value));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Triggered when the user clicks on an item\n\t\t * that has been selected.\n\t\t *\n\t\t * @param {object} e\n\t\t * @returns {boolean}\n\t\t */\n\t\tonItemSelect: function(e) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked) return;\n\t\t\tif (self.settings.mode === 'multi') {\n\t\t\t\te.preventDefault();\n\t\t\t\tself.setActiveItem(e.currentTarget, e);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Invokes the provided method that provides\n\t\t * results to a callback---which are then added\n\t\t * as options to the control.\n\t\t *\n\t\t * @param {function} fn\n\t\t */\n\t\tload: function(fn) {\n\t\t\tvar self = this;\n\t\t\tvar $wrapper = self.$wrapper.addClass(self.settings.loadingClass);\n\t\n\t\t\tself.loading++;\n\t\t\tfn.apply(self, [function(results) {\n\t\t\t\tself.loading = Math.max(self.loading - 1, 0);\n\t\t\t\tif (results && results.length) {\n\t\t\t\t\tself.addOption(results);\n\t\t\t\t\tself.refreshOptions(self.isFocused && !self.isInputHidden);\n\t\t\t\t}\n\t\t\t\tif (!self.loading) {\n\t\t\t\t\t$wrapper.removeClass(self.settings.loadingClass);\n\t\t\t\t}\n\t\t\t\tself.trigger('load', results);\n\t\t\t}]);\n\t\t},\n\t\n\t\t/**\n\t\t * Sets the input field of the control to the specified value.\n\t\t *\n\t\t * @param {string} value\n\t\t */\n\t\tsetTextboxValue: function(value) {\n\t\t\tvar $input = this.$control_input;\n\t\t\tvar changed = $input.val() !== value;\n\t\t\tif (changed) {\n\t\t\t\t$input.val(value).triggerHandler('update');\n\t\t\t\tthis.lastValue = value;\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the value of the control. If multiple items\n\t\t * can be selected (e.g. <select multiple>), this returns\n\t\t * an array. If only one item can be selected, this\n\t\t * returns a string.\n\t\t *\n\t\t * @returns {mixed}\n\t\t */\n\t\tgetValue: function() {\n\t\t\tif (this.tagType === TAG_SELECT && this.$input.attr('multiple')) {\n\t\t\t\treturn this.items;\n\t\t\t} else {\n\t\t\t\treturn this.items.join(this.settings.delimiter);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Resets the selected items to the given value.\n\t\t *\n\t\t * @param {mixed} value\n\t\t */\n\t\tsetValue: function(value, silent) {\n\t\t\tvar events = silent ? [] : ['change'];\n\t\n\t\t\tdebounce_events(this, events, function() {\n\t\t\t\tthis.clear(silent);\n\t\t\t\tthis.addItems(value, silent);\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Sets the selected item.\n\t\t *\n\t\t * @param {object} $item\n\t\t * @param {object} e (optional)\n\t\t */\n\t\tsetActiveItem: function($item, e) {\n\t\t\tvar self = this;\n\t\t\tvar eventName;\n\t\t\tvar i, idx, begin, end, item, swap;\n\t\t\tvar $last;\n\t\n\t\t\tif (self.settings.mode === 'single') return;\n\t\t\t$item = $($item);\n\t\n\t\t\t// clear the active selection\n\t\t\tif (!$item.length) {\n\t\t\t\t$(self.$activeItems).removeClass('active');\n\t\t\t\tself.$activeItems = [];\n\t\t\t\tif (self.isFocused) {\n\t\t\t\t\tself.showInput();\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// modify selection\n\t\t\teventName = e && e.type.toLowerCase();\n\t\n\t\t\tif (eventName === 'mousedown' && self.isShiftDown && self.$activeItems.length) {\n\t\t\t\t$last = self.$control.children('.active:last');\n\t\t\t\tbegin = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$last[0]]);\n\t\t\t\tend   = Array.prototype.indexOf.apply(self.$control[0].childNodes, [$item[0]]);\n\t\t\t\tif (begin > end) {\n\t\t\t\t\tswap  = begin;\n\t\t\t\t\tbegin = end;\n\t\t\t\t\tend   = swap;\n\t\t\t\t}\n\t\t\t\tfor (i = begin; i <= end; i++) {\n\t\t\t\t\titem = self.$control[0].childNodes[i];\n\t\t\t\t\tif (self.$activeItems.indexOf(item) === -1) {\n\t\t\t\t\t\t$(item).addClass('active');\n\t\t\t\t\t\tself.$activeItems.push(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\te.preventDefault();\n\t\t\t} else if ((eventName === 'mousedown' && self.isCtrlDown) || (eventName === 'keydown' && this.isShiftDown)) {\n\t\t\t\tif ($item.hasClass('active')) {\n\t\t\t\t\tidx = self.$activeItems.indexOf($item[0]);\n\t\t\t\t\tself.$activeItems.splice(idx, 1);\n\t\t\t\t\t$item.removeClass('active');\n\t\t\t\t} else {\n\t\t\t\t\tself.$activeItems.push($item.addClass('active')[0]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$(self.$activeItems).removeClass('active');\n\t\t\t\tself.$activeItems = [$item.addClass('active')[0]];\n\t\t\t}\n\t\n\t\t\t// ensure control has focus\n\t\t\tself.hideInput();\n\t\t\tif (!this.isFocused) {\n\t\t\t\tself.focus();\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Sets the selected item in the dropdown menu\n\t\t * of available options.\n\t\t *\n\t\t * @param {object} $object\n\t\t * @param {boolean} scroll\n\t\t * @param {boolean} animate\n\t\t */\n\t\tsetActiveOption: function($option, scroll, animate) {\n\t\t\tvar height_menu, height_item, y;\n\t\t\tvar scroll_top, scroll_bottom;\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.$activeOption) self.$activeOption.removeClass('active');\n\t\t\tself.$activeOption = null;\n\t\n\t\t\t$option = $($option);\n\t\t\tif (!$option.length) return;\n\t\n\t\t\tself.$activeOption = $option.addClass('active');\n\t\n\t\t\tif (scroll || !isset(scroll)) {\n\t\n\t\t\t\theight_menu   = self.$dropdown_content.height();\n\t\t\t\theight_item   = self.$activeOption.outerHeight(true);\n\t\t\t\tscroll        = self.$dropdown_content.scrollTop() || 0;\n\t\t\t\ty             = self.$activeOption.offset().top - self.$dropdown_content.offset().top + scroll;\n\t\t\t\tscroll_top    = y;\n\t\t\t\tscroll_bottom = y - height_menu + height_item;\n\t\n\t\t\t\tif (y + height_item > height_menu + scroll) {\n\t\t\t\t\tself.$dropdown_content.stop().animate({scrollTop: scroll_bottom}, animate ? self.settings.scrollDuration : 0);\n\t\t\t\t} else if (y < scroll) {\n\t\t\t\t\tself.$dropdown_content.stop().animate({scrollTop: scroll_top}, animate ? self.settings.scrollDuration : 0);\n\t\t\t\t}\n\t\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Selects all items (CTRL + A).\n\t\t */\n\t\tselectAll: function() {\n\t\t\tvar self = this;\n\t\t\tif (self.settings.mode === 'single') return;\n\t\n\t\t\tself.$activeItems = Array.prototype.slice.apply(self.$control.children(':not(input)').addClass('active'));\n\t\t\tif (self.$activeItems.length) {\n\t\t\t\tself.hideInput();\n\t\t\t\tself.close();\n\t\t\t}\n\t\t\tself.focus();\n\t\t},\n\t\n\t\t/**\n\t\t * Hides the input element out of view, while\n\t\t * retaining its focus.\n\t\t */\n\t\thideInput: function() {\n\t\t\tvar self = this;\n\t\n\t\t\tself.setTextboxValue('');\n\t\t\tself.$control_input.css({opacity: 0, position: 'absolute', left: self.rtl ? 10000 : -10000});\n\t\t\tself.isInputHidden = true;\n\t\t},\n\t\n\t\t/**\n\t\t * Restores input visibility.\n\t\t */\n\t\tshowInput: function() {\n\t\t\tthis.$control_input.css({opacity: 1, position: 'relative', left: 0});\n\t\t\tthis.isInputHidden = false;\n\t\t},\n\t\n\t\t/**\n\t\t * Gives the control focus.\n\t\t */\n\t\tfocus: function() {\n\t\t\tvar self = this;\n\t\t\tif (self.isDisabled) return;\n\t\n\t\t\tself.ignoreFocus = true;\n\t\t\tself.$control_input[0].focus();\n\t\t\twindow.setTimeout(function() {\n\t\t\t\tself.ignoreFocus = false;\n\t\t\t\tself.onFocus();\n\t\t\t}, 0);\n\t\t},\n\t\n\t\t/**\n\t\t * Forces the control out of focus.\n\t\t *\n\t\t * @param {Element} dest\n\t\t */\n\t\tblur: function(dest) {\n\t\t\tthis.$control_input[0].blur();\n\t\t\tthis.onBlur(null, dest);\n\t\t},\n\t\n\t\t/**\n\t\t * Returns a function that scores an object\n\t\t * to show how good of a match it is to the\n\t\t * provided query.\n\t\t *\n\t\t * @param {string} query\n\t\t * @param {object} options\n\t\t * @return {function}\n\t\t */\n\t\tgetScoreFunction: function(query) {\n\t\t\treturn this.sifter.getScoreFunction(query, this.getSearchOptions());\n\t\t},\n\t\n\t\t/**\n\t\t * Returns search options for sifter (the system\n\t\t * for scoring and sorting results).\n\t\t *\n\t\t * @see https://github.com/brianreavis/sifter.js\n\t\t * @return {object}\n\t\t */\n\t\tgetSearchOptions: function() {\n\t\t\tvar settings = this.settings;\n\t\t\tvar sort = settings.sortField;\n\t\t\tif (typeof sort === 'string') {\n\t\t\t\tsort = [{field: sort}];\n\t\t\t}\n\t\n\t\t\treturn {\n\t\t\t\tfields      : settings.searchField,\n\t\t\t\tconjunction : settings.searchConjunction,\n\t\t\t\tsort        : sort,\n\t\t\t\tnesting     : settings.nesting\n\t\t\t};\n\t\t},\n\t\n\t\t/**\n\t\t * Searches through available options and returns\n\t\t * a sorted array of matches.\n\t\t *\n\t\t * Returns an object containing:\n\t\t *\n\t\t *   - query {string}\n\t\t *   - tokens {array}\n\t\t *   - total {int}\n\t\t *   - items {array}\n\t\t *\n\t\t * @param {string} query\n\t\t * @returns {object}\n\t\t */\n\t\tsearch: function(query) {\n\t\t\tvar i, value, score, result, calculateScore;\n\t\t\tvar self     = this;\n\t\t\tvar settings = self.settings;\n\t\t\tvar options  = this.getSearchOptions();\n\t\n\t\t\t// validate user-provided result scoring function\n\t\t\tif (settings.score) {\n\t\t\t\tcalculateScore = self.settings.score.apply(this, [query]);\n\t\t\t\tif (typeof calculateScore !== 'function') {\n\t\t\t\t\tthrow new Error('Selectize \"score\" setting must be a function that returns a function');\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// perform search\n\t\t\tif (query !== self.lastQuery) {\n\t\t\t\tself.lastQuery = query;\n\t\t\t\tresult = self.sifter.search(query, $.extend(options, {score: calculateScore}));\n\t\t\t\tself.currentResults = result;\n\t\t\t} else {\n\t\t\t\tresult = $.extend(true, {}, self.currentResults);\n\t\t\t}\n\t\n\t\t\t// filter out selected items\n\t\t\tif (settings.hideSelected) {\n\t\t\t\tfor (i = result.items.length - 1; i >= 0; i--) {\n\t\t\t\t\tif (self.items.indexOf(hash_key(result.items[i].id)) !== -1) {\n\t\t\t\t\t\tresult.items.splice(i, 1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn result;\n\t\t},\n\t\n\t\t/**\n\t\t * Refreshes the list of available options shown\n\t\t * in the autocomplete dropdown menu.\n\t\t *\n\t\t * @param {boolean} triggerDropdown\n\t\t */\n\t\trefreshOptions: function(triggerDropdown) {\n\t\t\tvar i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;\n\t\t\tvar $active, $active_before, $create;\n\t\n\t\t\tif (typeof triggerDropdown === 'undefined') {\n\t\t\t\ttriggerDropdown = true;\n\t\t\t}\n\t\n\t\t\tvar self              = this;\n\t\t\tvar query             = $.trim(self.$control_input.val());\n\t\t\tvar results           = self.search(query);\n\t\t\tvar $dropdown_content = self.$dropdown_content;\n\t\t\tvar active_before     = self.$activeOption && hash_key(self.$activeOption.attr('data-value'));\n\t\n\t\t\t// build markup\n\t\t\tn = results.items.length;\n\t\t\tif (typeof self.settings.maxOptions === 'number') {\n\t\t\t\tn = Math.min(n, self.settings.maxOptions);\n\t\t\t}\n\t\n\t\t\t// render and group available options individually\n\t\t\tgroups = {};\n\t\t\tgroups_order = [];\n\t\n\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\toption      = self.options[results.items[i].id];\n\t\t\t\toption_html = self.render('option', option);\n\t\t\t\toptgroup    = option[self.settings.optgroupField] || '';\n\t\t\t\toptgroups   = $.isArray(optgroup) ? optgroup : [optgroup];\n\t\n\t\t\t\tfor (j = 0, k = optgroups && optgroups.length; j < k; j++) {\n\t\t\t\t\toptgroup = optgroups[j];\n\t\t\t\t\tif (!self.optgroups.hasOwnProperty(optgroup)) {\n\t\t\t\t\t\toptgroup = '';\n\t\t\t\t\t}\n\t\t\t\t\tif (!groups.hasOwnProperty(optgroup)) {\n\t\t\t\t\t\tgroups[optgroup] = document.createDocumentFragment();\n\t\t\t\t\t\tgroups_order.push(optgroup);\n\t\t\t\t\t}\n\t\t\t\t\tgroups[optgroup].appendChild(option_html);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// sort optgroups\n\t\t\tif (this.settings.lockOptgroupOrder) {\n\t\t\t\tgroups_order.sort(function(a, b) {\n\t\t\t\t\tvar a_order = self.optgroups[a].$order || 0;\n\t\t\t\t\tvar b_order = self.optgroups[b].$order || 0;\n\t\t\t\t\treturn a_order - b_order;\n\t\t\t\t});\n\t\t\t}\n\t\n\t\t\t// render optgroup headers & join groups\n\t\t\thtml = document.createDocumentFragment();\n\t\t\tfor (i = 0, n = groups_order.length; i < n; i++) {\n\t\t\t\toptgroup = groups_order[i];\n\t\t\t\tif (self.optgroups.hasOwnProperty(optgroup) && groups[optgroup].childNodes.length) {\n\t\t\t\t\t// render the optgroup header and options within it,\n\t\t\t\t\t// then pass it to the wrapper template\n\t\t\t\t\thtml_children = document.createDocumentFragment();\n\t\t\t\t\thtml_children.appendChild(self.render('optgroup_header', self.optgroups[optgroup]));\n\t\t\t\t\thtml_children.appendChild(groups[optgroup]);\n\t\n\t\t\t\t\thtml.appendChild(self.render('optgroup', $.extend({}, self.optgroups[optgroup], {\n\t\t\t\t\t\thtml: domToString(html_children),\n\t\t\t\t\t\tdom:  html_children\n\t\t\t\t\t})));\n\t\t\t\t} else {\n\t\t\t\t\thtml.appendChild(groups[optgroup]);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t$dropdown_content.html(html);\n\t\n\t\t\t// highlight matching terms inline\n\t\t\tif (self.settings.highlight) {\n\t\t\t\t$dropdown_content.removeHighlight();\n\t\t\t\tif (results.query.length && results.tokens.length) {\n\t\t\t\t\tfor (i = 0, n = results.tokens.length; i < n; i++) {\n\t\t\t\t\t\thighlight($dropdown_content, results.tokens[i].regex);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// add \"selected\" class to selected options\n\t\t\tif (!self.settings.hideSelected) {\n\t\t\t\tfor (i = 0, n = self.items.length; i < n; i++) {\n\t\t\t\t\tself.getOption(self.items[i]).addClass('selected');\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// add create option\n\t\t\thas_create_option = self.canCreate(query);\n\t\t\tif (has_create_option) {\n\t\t\t\t$dropdown_content.prepend(self.render('option_create', {input: query}));\n\t\t\t\t$create = $($dropdown_content[0].childNodes[0]);\n\t\t\t}\n\t\n\t\t\t// activate\n\t\t\tself.hasOptions = results.items.length > 0 || has_create_option;\n\t\t\tif (self.hasOptions) {\n\t\t\t\tif (results.items.length > 0) {\n\t\t\t\t\t$active_before = active_before && self.getOption(active_before);\n\t\t\t\t\tif ($active_before && $active_before.length) {\n\t\t\t\t\t\t$active = $active_before;\n\t\t\t\t\t} else if (self.settings.mode === 'single' && self.items.length) {\n\t\t\t\t\t\t$active = self.getOption(self.items[0]);\n\t\t\t\t\t}\n\t\t\t\t\tif (!$active || !$active.length) {\n\t\t\t\t\t\tif ($create && !self.settings.addPrecedence) {\n\t\t\t\t\t\t\t$active = self.getAdjacentOption($create, 1);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t$active = $dropdown_content.find('[data-selectable]:first');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$active = $create;\n\t\t\t\t}\n\t\t\t\tself.setActiveOption($active);\n\t\t\t\tif (triggerDropdown && !self.isOpen) { self.open(); }\n\t\t\t} else {\n\t\t\t\tself.setActiveOption(null);\n\t\t\t\tif (triggerDropdown && self.isOpen) { self.close(); }\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Adds an available option. If it already exists,\n\t\t * nothing will happen. Note: this does not refresh\n\t\t * the options list dropdown (use `refreshOptions`\n\t\t * for that).\n\t\t *\n\t\t * Usage:\n\t\t *\n\t\t *   this.addOption(data)\n\t\t *\n\t\t * @param {object|array} data\n\t\t */\n\t\taddOption: function(data) {\n\t\t\tvar i, n, value, self = this;\n\t\n\t\t\tif ($.isArray(data)) {\n\t\t\t\tfor (i = 0, n = data.length; i < n; i++) {\n\t\t\t\t\tself.addOption(data[i]);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif (value = self.registerOption(data)) {\n\t\t\t\tself.userOptions[value] = true;\n\t\t\t\tself.lastQuery = null;\n\t\t\t\tself.trigger('option_add', value, data);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Registers an option to the pool of options.\n\t\t *\n\t\t * @param {object} data\n\t\t * @return {boolean|string}\n\t\t */\n\t\tregisterOption: function(data) {\n\t\t\tvar key = hash_key(data[this.settings.valueField]);\n\t\t\tif (typeof key === 'undefined' || key === null || this.options.hasOwnProperty(key)) return false;\n\t\t\tdata.$order = data.$order || ++this.order;\n\t\t\tthis.options[key] = data;\n\t\t\treturn key;\n\t\t},\n\t\n\t\t/**\n\t\t * Registers an option group to the pool of option groups.\n\t\t *\n\t\t * @param {object} data\n\t\t * @return {boolean|string}\n\t\t */\n\t\tregisterOptionGroup: function(data) {\n\t\t\tvar key = hash_key(data[this.settings.optgroupValueField]);\n\t\t\tif (!key) return false;\n\t\n\t\t\tdata.$order = data.$order || ++this.order;\n\t\t\tthis.optgroups[key] = data;\n\t\t\treturn key;\n\t\t},\n\t\n\t\t/**\n\t\t * Registers a new optgroup for options\n\t\t * to be bucketed into.\n\t\t *\n\t\t * @param {string} id\n\t\t * @param {object} data\n\t\t */\n\t\taddOptionGroup: function(id, data) {\n\t\t\tdata[this.settings.optgroupValueField] = id;\n\t\t\tif (id = this.registerOptionGroup(data)) {\n\t\t\t\tthis.trigger('optgroup_add', id, data);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Removes an existing option group.\n\t\t *\n\t\t * @param {string} id\n\t\t */\n\t\tremoveOptionGroup: function(id) {\n\t\t\tif (this.optgroups.hasOwnProperty(id)) {\n\t\t\t\tdelete this.optgroups[id];\n\t\t\t\tthis.renderCache = {};\n\t\t\t\tthis.trigger('optgroup_remove', id);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Clears all existing option groups.\n\t\t */\n\t\tclearOptionGroups: function() {\n\t\t\tthis.optgroups = {};\n\t\t\tthis.renderCache = {};\n\t\t\tthis.trigger('optgroup_clear');\n\t\t},\n\t\n\t\t/**\n\t\t * Updates an option available for selection. If\n\t\t * it is visible in the selected items or options\n\t\t * dropdown, it will be re-rendered automatically.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {object} data\n\t\t */\n\t\tupdateOption: function(value, data) {\n\t\t\tvar self = this;\n\t\t\tvar $item, $item_new;\n\t\t\tvar value_new, index_item, cache_items, cache_options, order_old;\n\t\n\t\t\tvalue     = hash_key(value);\n\t\t\tvalue_new = hash_key(data[self.settings.valueField]);\n\t\n\t\t\t// sanity checks\n\t\t\tif (value === null) return;\n\t\t\tif (!self.options.hasOwnProperty(value)) return;\n\t\t\tif (typeof value_new !== 'string') throw new Error('Value must be set in option data');\n\t\n\t\t\torder_old = self.options[value].$order;\n\t\n\t\t\t// update references\n\t\t\tif (value_new !== value) {\n\t\t\t\tdelete self.options[value];\n\t\t\t\tindex_item = self.items.indexOf(value);\n\t\t\t\tif (index_item !== -1) {\n\t\t\t\t\tself.items.splice(index_item, 1, value_new);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdata.$order = data.$order || order_old;\n\t\t\tself.options[value_new] = data;\n\t\n\t\t\t// invalidate render cache\n\t\t\tcache_items = self.renderCache['item'];\n\t\t\tcache_options = self.renderCache['option'];\n\t\n\t\t\tif (cache_items) {\n\t\t\t\tdelete cache_items[value];\n\t\t\t\tdelete cache_items[value_new];\n\t\t\t}\n\t\t\tif (cache_options) {\n\t\t\t\tdelete cache_options[value];\n\t\t\t\tdelete cache_options[value_new];\n\t\t\t}\n\t\n\t\t\t// update the item if it's selected\n\t\t\tif (self.items.indexOf(value_new) !== -1) {\n\t\t\t\t$item = self.getItem(value);\n\t\t\t\t$item_new = $(self.render('item', data));\n\t\t\t\tif ($item.hasClass('active')) $item_new.addClass('active');\n\t\t\t\t$item.replaceWith($item_new);\n\t\t\t}\n\t\n\t\t\t// invalidate last query because we might have updated the sortField\n\t\t\tself.lastQuery = null;\n\t\n\t\t\t// update dropdown contents\n\t\t\tif (self.isOpen) {\n\t\t\t\tself.refreshOptions(false);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Removes a single option.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} silent\n\t\t */\n\t\tremoveOption: function(value, silent) {\n\t\t\tvar self = this;\n\t\t\tvalue = hash_key(value);\n\t\n\t\t\tvar cache_items = self.renderCache['item'];\n\t\t\tvar cache_options = self.renderCache['option'];\n\t\t\tif (cache_items) delete cache_items[value];\n\t\t\tif (cache_options) delete cache_options[value];\n\t\n\t\t\tdelete self.userOptions[value];\n\t\t\tdelete self.options[value];\n\t\t\tself.lastQuery = null;\n\t\t\tself.trigger('option_remove', value);\n\t\t\tself.removeItem(value, silent);\n\t\t},\n\t\n\t\t/**\n\t\t * Clears all options.\n\t\t */\n\t\tclearOptions: function() {\n\t\t\tvar self = this;\n\t\n\t\t\tself.loadedSearches = {};\n\t\t\tself.userOptions = {};\n\t\t\tself.renderCache = {};\n\t\t\tvar options = self.options;\n\t\t\t$.each(self.options, function(key, value) {\n\t\t\t\tif(self.items.indexOf(key) == -1) {\n\t\t\t\t\tdelete options[key];\n\t\t\t\t}\n\t\t\t});\n\t\t\tself.options = self.sifter.items = options;\n\t\t\tself.lastQuery = null;\n\t\t\tself.trigger('option_clear');\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the jQuery element of the option\n\t\t * matching the given value.\n\t\t *\n\t\t * @param {string} value\n\t\t * @returns {object}\n\t\t */\n\t\tgetOption: function(value) {\n\t\t\treturn this.getElementWithValue(value, this.$dropdown_content.find('[data-selectable]'));\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the jQuery element of the next or\n\t\t * previous selectable option.\n\t\t *\n\t\t * @param {object} $option\n\t\t * @param {int} direction  can be 1 for next or -1 for previous\n\t\t * @return {object}\n\t\t */\n\t\tgetAdjacentOption: function($option, direction) {\n\t\t\tvar $options = this.$dropdown.find('[data-selectable]');\n\t\t\tvar index    = $options.index($option) + direction;\n\t\n\t\t\treturn index >= 0 && index < $options.length ? $options.eq(index) : $();\n\t\t},\n\t\n\t\t/**\n\t\t * Finds the first element with a \"data-value\" attribute\n\t\t * that matches the given value.\n\t\t *\n\t\t * @param {mixed} value\n\t\t * @param {object} $els\n\t\t * @return {object}\n\t\t */\n\t\tgetElementWithValue: function(value, $els) {\n\t\t\tvalue = hash_key(value);\n\t\n\t\t\tif (typeof value !== 'undefined' && value !== null) {\n\t\t\t\tfor (var i = 0, n = $els.length; i < n; i++) {\n\t\t\t\t\tif ($els[i].getAttribute('data-value') === value) {\n\t\t\t\t\t\treturn $($els[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn $();\n\t\t},\n\t\n\t\t/**\n\t\t * Returns the jQuery element of the item\n\t\t * matching the given value.\n\t\t *\n\t\t * @param {string} value\n\t\t * @returns {object}\n\t\t */\n\t\tgetItem: function(value) {\n\t\t\treturn this.getElementWithValue(value, this.$control.children());\n\t\t},\n\t\n\t\t/**\n\t\t * \"Selects\" multiple items at once. Adds them to the list\n\t\t * at the current caret position.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} silent\n\t\t */\n\t\taddItems: function(values, silent) {\n\t\t\tthis.buffer = document.createDocumentFragment();\n\t\n\t\t\tvar childNodes = this.$control[0].childNodes;\n\t\t\tfor (var i = 0; i < childNodes.length; i++) {\n\t\t\t\tthis.buffer.appendChild(childNodes[i]);\n\t\t\t}\n\t\n\t\t\tvar items = $.isArray(values) ? values : [values];\n\t\t\tfor (var i = 0, n = items.length; i < n; i++) {\n\t\t\t\tthis.isPending = (i < n - 1);\n\t\t\t\tthis.addItem(items[i], silent);\n\t\t\t}\n\t\n\t\t\tvar control = this.$control[0];\n\t\t\tcontrol.insertBefore(this.buffer, control.firstChild);\n\t\n\t\t\tthis.buffer = null;\n\t\t},\n\t\n\t\t/**\n\t\t * \"Selects\" an item. Adds it to the list\n\t\t * at the current caret position.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} silent\n\t\t */\n\t\taddItem: function(value, silent) {\n\t\t\tvar events = silent ? [] : ['change'];\n\t\n\t\t\tdebounce_events(this, events, function() {\n\t\t\t\tvar $item, $option, $options;\n\t\t\t\tvar self = this;\n\t\t\t\tvar inputMode = self.settings.mode;\n\t\t\t\tvar i, active, value_next, wasFull;\n\t\t\t\tvalue = hash_key(value);\n\t\n\t\t\t\tif (self.items.indexOf(value) !== -1) {\n\t\t\t\t\tif (inputMode === 'single') self.close();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tif (!self.options.hasOwnProperty(value)) return;\n\t\t\t\tif (inputMode === 'single') self.clear(silent);\n\t\t\t\tif (inputMode === 'multi' && self.isFull()) return;\n\t\n\t\t\t\t$item = $(self.render('item', self.options[value]));\n\t\t\t\twasFull = self.isFull();\n\t\t\t\tself.items.splice(self.caretPos, 0, value);\n\t\t\t\tself.insertAtCaret($item);\n\t\t\t\tif (!self.isPending || (!wasFull && self.isFull())) {\n\t\t\t\t\tself.refreshState();\n\t\t\t\t}\n\t\n\t\t\t\tif (self.isSetup) {\n\t\t\t\t\t$options = self.$dropdown_content.find('[data-selectable]');\n\t\n\t\t\t\t\t// update menu / remove the option (if this is not one item being added as part of series)\n\t\t\t\t\tif (!self.isPending) {\n\t\t\t\t\t\t$option = self.getOption(value);\n\t\t\t\t\t\tvalue_next = self.getAdjacentOption($option, 1).attr('data-value');\n\t\t\t\t\t\tself.refreshOptions(self.isFocused && inputMode !== 'single');\n\t\t\t\t\t\tif (value_next) {\n\t\t\t\t\t\t\tself.setActiveOption(self.getOption(value_next));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// hide the menu if the maximum number of items have been selected or no options are left\n\t\t\t\t\tif (!$options.length || self.isFull()) {\n\t\t\t\t\t\tself.close();\n\t\t\t\t\t} else if (!self.isPending) {\n\t\t\t\t\t\tself.positionDropdown();\n\t\t\t\t\t}\n\t\n\t\t\t\t\tself.updatePlaceholder();\n\t\t\t\t\tself.trigger('item_add', value, $item);\n\t\n\t\t\t\t\tif (!self.isPending) {\n\t\t\t\t\t\tself.updateOriginalInput({silent: silent});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Removes the selected item matching\n\t\t * the provided value.\n\t\t *\n\t\t * @param {string} value\n\t\t */\n\t\tremoveItem: function(value, silent) {\n\t\t\tvar self = this;\n\t\t\tvar $item, i, idx;\n\t\n\t\t\t$item = (value instanceof $) ? value : self.getItem(value);\n\t\t\tvalue = hash_key($item.attr('data-value'));\n\t\t\ti = self.items.indexOf(value);\n\t\n\t\t\tif (i !== -1) {\n\t\t\t\t$item.remove();\n\t\t\t\tif ($item.hasClass('active')) {\n\t\t\t\t\tidx = self.$activeItems.indexOf($item[0]);\n\t\t\t\t\tself.$activeItems.splice(idx, 1);\n\t\t\t\t}\n\t\n\t\t\t\tself.items.splice(i, 1);\n\t\t\t\tself.lastQuery = null;\n\t\t\t\tif (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {\n\t\t\t\t\tself.removeOption(value, silent);\n\t\t\t\t}\n\t\n\t\t\t\tif (i < self.caretPos) {\n\t\t\t\t\tself.setCaret(self.caretPos - 1);\n\t\t\t\t}\n\t\n\t\t\t\tself.refreshState();\n\t\t\t\tself.updatePlaceholder();\n\t\t\t\tself.updateOriginalInput({silent: silent});\n\t\t\t\tself.positionDropdown();\n\t\t\t\tself.trigger('item_remove', value, $item);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Invokes the `create` method provided in the\n\t\t * selectize options that should provide the data\n\t\t * for the new item, given the user input.\n\t\t *\n\t\t * Once this completes, it will be added\n\t\t * to the item list.\n\t\t *\n\t\t * @param {string} value\n\t\t * @param {boolean} [triggerDropdown]\n\t\t * @param {function} [callback]\n\t\t * @return {boolean}\n\t\t */\n\t\tcreateItem: function(input, triggerDropdown) {\n\t\t\tvar self  = this;\n\t\t\tvar caret = self.caretPos;\n\t\t\tinput = input || $.trim(self.$control_input.val() || '');\n\t\n\t\t\tvar callback = arguments[arguments.length - 1];\n\t\t\tif (typeof callback !== 'function') callback = function() {};\n\t\n\t\t\tif (typeof triggerDropdown !== 'boolean') {\n\t\t\t\ttriggerDropdown = true;\n\t\t\t}\n\t\n\t\t\tif (!self.canCreate(input)) {\n\t\t\t\tcallback();\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\tself.lock();\n\t\n\t\t\tvar setup = (typeof self.settings.create === 'function') ? this.settings.create : function(input) {\n\t\t\t\tvar data = {};\n\t\t\t\tdata[self.settings.labelField] = input;\n\t\t\t\tdata[self.settings.valueField] = input;\n\t\t\t\treturn data;\n\t\t\t};\n\t\n\t\t\tvar create = once(function(data) {\n\t\t\t\tself.unlock();\n\t\n\t\t\t\tif (!data || typeof data !== 'object') return callback();\n\t\t\t\tvar value = hash_key(data[self.settings.valueField]);\n\t\t\t\tif (typeof value !== 'string') return callback();\n\t\n\t\t\t\tself.setTextboxValue('');\n\t\t\t\tself.addOption(data);\n\t\t\t\tself.setCaret(caret);\n\t\t\t\tself.addItem(value);\n\t\t\t\tself.refreshOptions(triggerDropdown && self.settings.mode !== 'single');\n\t\t\t\tcallback(data);\n\t\t\t});\n\t\n\t\t\tvar output = setup.apply(this, [input, create]);\n\t\t\tif (typeof output !== 'undefined') {\n\t\t\t\tcreate(output);\n\t\t\t}\n\t\n\t\t\treturn true;\n\t\t},\n\t\n\t\t/**\n\t\t * Re-renders the selected item lists.\n\t\t */\n\t\trefreshItems: function() {\n\t\t\tthis.lastQuery = null;\n\t\n\t\t\tif (this.isSetup) {\n\t\t\t\tthis.addItem(this.items);\n\t\t\t}\n\t\n\t\t\tthis.refreshState();\n\t\t\tthis.updateOriginalInput();\n\t\t},\n\t\n\t\t/**\n\t\t * Updates all state-dependent attributes\n\t\t * and CSS classes.\n\t\t */\n\t\trefreshState: function() {\n\t\t\tthis.refreshValidityState();\n\t\t\tthis.refreshClasses();\n\t\t},\n\t\n\t\t/**\n\t\t * Update the `required` attribute of both input and control input.\n\t\t *\n\t\t * The `required` property needs to be activated on the control input\n\t\t * for the error to be displayed at the right place. `required` also\n\t\t * needs to be temporarily deactivated on the input since the input is\n\t\t * hidden and can't show errors.\n\t\t */\n\t\trefreshValidityState: function() {\n\t\t\tif (!this.isRequired) return false;\n\t\n\t\t\tvar invalid = !this.items.length;\n\t\n\t\t\tthis.isInvalid = invalid;\n\t\t\tthis.$control_input.prop('required', invalid);\n\t\t\tthis.$input.prop('required', !invalid);\n\t\t},\n\t\n\t\t/**\n\t\t * Updates all state-dependent CSS classes.\n\t\t */\n\t\trefreshClasses: function() {\n\t\t\tvar self     = this;\n\t\t\tvar isFull   = self.isFull();\n\t\t\tvar isLocked = self.isLocked;\n\t\n\t\t\tself.$wrapper\n\t\t\t\t.toggleClass('rtl', self.rtl);\n\t\n\t\t\tself.$control\n\t\t\t\t.toggleClass('focus', self.isFocused)\n\t\t\t\t.toggleClass('disabled', self.isDisabled)\n\t\t\t\t.toggleClass('required', self.isRequired)\n\t\t\t\t.toggleClass('invalid', self.isInvalid)\n\t\t\t\t.toggleClass('locked', isLocked)\n\t\t\t\t.toggleClass('full', isFull).toggleClass('not-full', !isFull)\n\t\t\t\t.toggleClass('input-active', self.isFocused && !self.isInputHidden)\n\t\t\t\t.toggleClass('dropdown-active', self.isOpen)\n\t\t\t\t.toggleClass('has-options', !$.isEmptyObject(self.options))\n\t\t\t\t.toggleClass('has-items', self.items.length > 0);\n\t\n\t\t\tself.$control_input.data('grow', !isFull && !isLocked);\n\t\t},\n\t\n\t\t/**\n\t\t * Determines whether or not more items can be added\n\t\t * to the control without exceeding the user-defined maximum.\n\t\t *\n\t\t * @returns {boolean}\n\t\t */\n\t\tisFull: function() {\n\t\t\treturn this.settings.maxItems !== null && this.items.length >= this.settings.maxItems;\n\t\t},\n\t\n\t\t/**\n\t\t * Refreshes the original <select> or <input>\n\t\t * element to reflect the current state.\n\t\t */\n\t\tupdateOriginalInput: function(opts) {\n\t\t\tvar i, n, options, label, self = this;\n\t\t\topts = opts || {};\n\t\n\t\t\tif (self.tagType === TAG_SELECT) {\n\t\t\t\toptions = [];\n\t\t\t\tfor (i = 0, n = self.items.length; i < n; i++) {\n\t\t\t\t\tlabel = self.options[self.items[i]][self.settings.labelField] || '';\n\t\t\t\t\toptions.push('<option value=\"' + escape_html(self.items[i]) + '\" selected=\"selected\">' + escape_html(label) + '</option>');\n\t\t\t\t}\n\t\t\t\tif (!options.length && !this.$input.attr('multiple')) {\n\t\t\t\t\toptions.push('<option value=\"\" selected=\"selected\"></option>');\n\t\t\t\t}\n\t\t\t\tself.$input.html(options.join(''));\n\t\t\t} else {\n\t\t\t\tself.$input.val(self.getValue());\n\t\t\t\tself.$input.attr('value',self.$input.val());\n\t\t\t}\n\t\n\t\t\tif (self.isSetup) {\n\t\t\t\tif (!opts.silent) {\n\t\t\t\t\tself.trigger('change', self.$input.val());\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Shows/hide the input placeholder depending\n\t\t * on if there items in the list already.\n\t\t */\n\t\tupdatePlaceholder: function() {\n\t\t\tif (!this.settings.placeholder) return;\n\t\t\tvar $input = this.$control_input;\n\t\n\t\t\tif (this.items.length) {\n\t\t\t\t$input.removeAttr('placeholder');\n\t\t\t} else {\n\t\t\t\t$input.attr('placeholder', this.settings.placeholder);\n\t\t\t}\n\t\t\t$input.triggerHandler('update', {force: true});\n\t\t},\n\t\n\t\t/**\n\t\t * Shows the autocomplete dropdown containing\n\t\t * the available options.\n\t\t */\n\t\topen: function() {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.isLocked || self.isOpen || (self.settings.mode === 'multi' && self.isFull())) return;\n\t\t\tself.focus();\n\t\t\tself.isOpen = true;\n\t\t\tself.refreshState();\n\t\t\tself.$dropdown.css({visibility: 'hidden', display: 'block'});\n\t\t\tself.positionDropdown();\n\t\t\tself.$dropdown.css({visibility: 'visible'});\n\t\t\tself.trigger('dropdown_open', self.$dropdown);\n\t\t},\n\t\n\t\t/**\n\t\t * Closes the autocomplete dropdown menu.\n\t\t */\n\t\tclose: function() {\n\t\t\tvar self = this;\n\t\t\tvar trigger = self.isOpen;\n\t\n\t\t\tif (self.settings.mode === 'single' && self.items.length) {\n\t\t\t\tself.hideInput();\n\t\n\t\t\t\t// Do not trigger blur while inside a blur event,\n\t\t\t\t// this fixes some weird tabbing behavior in FF and IE.\n\t\t\t\t// See #1164\n\t\t\t\tif (!self.isBlurring) {\n\t\t\t\t\tself.$control_input.blur(); // close keyboard on iOS\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tself.isOpen = false;\n\t\t\tself.$dropdown.hide();\n\t\t\tself.setActiveOption(null);\n\t\t\tself.refreshState();\n\t\n\t\t\tif (trigger) self.trigger('dropdown_close', self.$dropdown);\n\t\t},\n\t\n\t\t/**\n\t\t * Calculates and applies the appropriate\n\t\t * position of the dropdown.\n\t\t */\n\t\tpositionDropdown: function() {\n\t\t\tvar $control = this.$control;\n\t\t\tvar offset = this.settings.dropdownParent === 'body' ? $control.offset() : $control.position();\n\t\t\toffset.top += $control.outerHeight(true);\n\t\n\t\t\tthis.$dropdown.css({\n\t\t\t\twidth : $control[0].getBoundingClientRect().width,\n\t\t\t\ttop   : offset.top,\n\t\t\t\tleft  : offset.left\n\t\t\t});\n\t\t},\n\t\n\t\t/**\n\t\t * Resets / clears all selected items\n\t\t * from the control.\n\t\t *\n\t\t * @param {boolean} silent\n\t\t */\n\t\tclear: function(silent) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (!self.items.length) return;\n\t\t\tself.$control.children(':not(input)').remove();\n\t\t\tself.items = [];\n\t\t\tself.lastQuery = null;\n\t\t\tself.setCaret(0);\n\t\t\tself.setActiveItem(null);\n\t\t\tself.updatePlaceholder();\n\t\t\tself.updateOriginalInput({silent: silent});\n\t\t\tself.refreshState();\n\t\t\tself.showInput();\n\t\t\tself.trigger('clear');\n\t\t},\n\t\n\t\t/**\n\t\t * A helper method for inserting an element\n\t\t * at the current caret position.\n\t\t *\n\t\t * @param {object} $el\n\t\t */\n\t\tinsertAtCaret: function($el) {\n\t\t\tvar caret = Math.min(this.caretPos, this.items.length);\n\t\t\tvar el = $el[0];\n\t\t\tvar target = this.buffer || this.$control[0];\n\t\n\t\t\tif (caret === 0) {\n\t\t\t\ttarget.insertBefore(el, target.firstChild);\n\t\t\t} else {\n\t\t\t\ttarget.insertBefore(el, target.childNodes[caret]);\n\t\t\t}\n\t\n\t\t\tthis.setCaret(caret + 1);\n\t\t},\n\t\n\t\t/**\n\t\t * Removes the current selected item(s).\n\t\t *\n\t\t * @param {object} e (optional)\n\t\t * @returns {boolean}\n\t\t */\n\t\tdeleteSelection: function(e) {\n\t\t\tvar i, n, direction, selection, values, caret, option_select, $option_select, $tail;\n\t\t\tvar self = this;\n\t\n\t\t\tdirection = (e && e.keyCode === KEY_BACKSPACE) ? -1 : 1;\n\t\t\tselection = getSelection(self.$control_input[0]);\n\t\n\t\t\tif (self.$activeOption && !self.settings.hideSelected) {\n\t\t\t\toption_select = self.getAdjacentOption(self.$activeOption, -1).attr('data-value');\n\t\t\t}\n\t\n\t\t\t// determine items that will be removed\n\t\t\tvalues = [];\n\t\n\t\t\tif (self.$activeItems.length) {\n\t\t\t\t$tail = self.$control.children('.active:' + (direction > 0 ? 'last' : 'first'));\n\t\t\t\tcaret = self.$control.children(':not(input)').index($tail);\n\t\t\t\tif (direction > 0) { caret++; }\n\t\n\t\t\t\tfor (i = 0, n = self.$activeItems.length; i < n; i++) {\n\t\t\t\t\tvalues.push($(self.$activeItems[i]).attr('data-value'));\n\t\t\t\t}\n\t\t\t\tif (e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t} else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {\n\t\t\t\tif (direction < 0 && selection.start === 0 && selection.length === 0) {\n\t\t\t\t\tvalues.push(self.items[self.caretPos - 1]);\n\t\t\t\t} else if (direction > 0 && selection.start === self.$control_input.val().length) {\n\t\t\t\t\tvalues.push(self.items[self.caretPos]);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// allow the callback to abort\n\t\t\tif (!values.length || (typeof self.settings.onDelete === 'function' && self.settings.onDelete.apply(self, [values]) === false)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\t// perform removal\n\t\t\tif (typeof caret !== 'undefined') {\n\t\t\t\tself.setCaret(caret);\n\t\t\t}\n\t\t\twhile (values.length) {\n\t\t\t\tself.removeItem(values.pop());\n\t\t\t}\n\t\n\t\t\tself.showInput();\n\t\t\tself.positionDropdown();\n\t\t\tself.refreshOptions(true);\n\t\n\t\t\t// select previous option\n\t\t\tif (option_select) {\n\t\t\t\t$option_select = self.getOption(option_select);\n\t\t\t\tif ($option_select.length) {\n\t\t\t\t\tself.setActiveOption($option_select);\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn true;\n\t\t},\n\t\n\t\t/**\n\t\t * Selects the previous / next item (depending\n\t\t * on the `direction` argument).\n\t\t *\n\t\t * > 0 - right\n\t\t * < 0 - left\n\t\t *\n\t\t * @param {int} direction\n\t\t * @param {object} e (optional)\n\t\t */\n\t\tadvanceSelection: function(direction, e) {\n\t\t\tvar tail, selection, idx, valueLength, cursorAtEdge, $tail;\n\t\t\tvar self = this;\n\t\n\t\t\tif (direction === 0) return;\n\t\t\tif (self.rtl) direction *= -1;\n\t\n\t\t\ttail = direction > 0 ? 'last' : 'first';\n\t\t\tselection = getSelection(self.$control_input[0]);\n\t\n\t\t\tif (self.isFocused && !self.isInputHidden) {\n\t\t\t\tvalueLength = self.$control_input.val().length;\n\t\t\t\tcursorAtEdge = direction < 0\n\t\t\t\t\t? selection.start === 0 && selection.length === 0\n\t\t\t\t\t: selection.start === valueLength;\n\t\n\t\t\t\tif (cursorAtEdge && !valueLength) {\n\t\t\t\t\tself.advanceCaret(direction, e);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$tail = self.$control.children('.active:' + tail);\n\t\t\t\tif ($tail.length) {\n\t\t\t\t\tidx = self.$control.children(':not(input)').index($tail);\n\t\t\t\t\tself.setActiveItem(null);\n\t\t\t\t\tself.setCaret(direction > 0 ? idx + 1 : idx);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Moves the caret left / right.\n\t\t *\n\t\t * @param {int} direction\n\t\t * @param {object} e (optional)\n\t\t */\n\t\tadvanceCaret: function(direction, e) {\n\t\t\tvar self = this, fn, $adj;\n\t\n\t\t\tif (direction === 0) return;\n\t\n\t\t\tfn = direction > 0 ? 'next' : 'prev';\n\t\t\tif (self.isShiftDown) {\n\t\t\t\t$adj = self.$control_input[fn]();\n\t\t\t\tif ($adj.length) {\n\t\t\t\t\tself.hideInput();\n\t\t\t\t\tself.setActiveItem($adj);\n\t\t\t\t\te && e.preventDefault();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tself.setCaret(self.caretPos + direction);\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Moves the caret to the specified index.\n\t\t *\n\t\t * @param {int} i\n\t\t */\n\t\tsetCaret: function(i) {\n\t\t\tvar self = this;\n\t\n\t\t\tif (self.settings.mode === 'single') {\n\t\t\t\ti = self.items.length;\n\t\t\t} else {\n\t\t\t\ti = Math.max(0, Math.min(self.items.length, i));\n\t\t\t}\n\t\n\t\t\tif(!self.isPending) {\n\t\t\t\t// the input must be moved by leaving it in place and moving the\n\t\t\t\t// siblings, due to the fact that focus cannot be restored once lost\n\t\t\t\t// on mobile webkit devices\n\t\t\t\tvar j, n, fn, $children, $child;\n\t\t\t\t$children = self.$control.children(':not(input)');\n\t\t\t\tfor (j = 0, n = $children.length; j < n; j++) {\n\t\t\t\t\t$child = $($children[j]).detach();\n\t\t\t\t\tif (j <  i) {\n\t\t\t\t\t\tself.$control_input.before($child);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.$control.append($child);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tself.caretPos = i;\n\t\t},\n\t\n\t\t/**\n\t\t * Disables user input on the control. Used while\n\t\t * items are being asynchronously created.\n\t\t */\n\t\tlock: function() {\n\t\t\tthis.close();\n\t\t\tthis.isLocked = true;\n\t\t\tthis.refreshState();\n\t\t},\n\t\n\t\t/**\n\t\t * Re-enables user input on the control.\n\t\t */\n\t\tunlock: function() {\n\t\t\tthis.isLocked = false;\n\t\t\tthis.refreshState();\n\t\t},\n\t\n\t\t/**\n\t\t * Disables user input on the control completely.\n\t\t * While disabled, it cannot receive focus.\n\t\t */\n\t\tdisable: function() {\n\t\t\tvar self = this;\n\t\t\tself.$input.prop('disabled', true);\n\t\t\tself.$control_input.prop('disabled', true).prop('tabindex', -1);\n\t\t\tself.isDisabled = true;\n\t\t\tself.lock();\n\t\t},\n\t\n\t\t/**\n\t\t * Enables the control so that it can respond\n\t\t * to focus and user input.\n\t\t */\n\t\tenable: function() {\n\t\t\tvar self = this;\n\t\t\tself.$input.prop('disabled', false);\n\t\t\tself.$control_input.prop('disabled', false).prop('tabindex', self.tabIndex);\n\t\t\tself.isDisabled = false;\n\t\t\tself.unlock();\n\t\t},\n\t\n\t\t/**\n\t\t * Completely destroys the control and\n\t\t * unbinds all event listeners so that it can\n\t\t * be garbage collected.\n\t\t */\n\t\tdestroy: function() {\n\t\t\tvar self = this;\n\t\t\tvar eventNS = self.eventNS;\n\t\t\tvar revertSettings = self.revertSettings;\n\t\n\t\t\tself.trigger('destroy');\n\t\t\tself.off();\n\t\t\tself.$wrapper.remove();\n\t\t\tself.$dropdown.remove();\n\t\n\t\t\tself.$input\n\t\t\t\t.html('')\n\t\t\t\t.append(revertSettings.$children)\n\t\t\t\t.removeAttr('tabindex')\n\t\t\t\t.removeClass('selectized')\n\t\t\t\t.attr({tabindex: revertSettings.tabindex})\n\t\t\t\t.show();\n\t\n\t\t\tself.$control_input.removeData('grow');\n\t\t\tself.$input.removeData('selectize');\n\t\n\t\t\tif (--Selectize.count == 0 && Selectize.$testInput) {\n\t\t\t\tSelectize.$testInput.remove();\n\t\t\t\tSelectize.$testInput = undefined;\n\t\t\t}\n\t\n\t\t\t$(window).off(eventNS);\n\t\t\t$(document).off(eventNS);\n\t\t\t$(document.body).off(eventNS);\n\t\n\t\t\tdelete self.$input[0].selectize;\n\t\t},\n\t\n\t\t/**\n\t\t * A helper method for rendering \"item\" and\n\t\t * \"option\" templates, given the data.\n\t\t *\n\t\t * @param {string} templateName\n\t\t * @param {object} data\n\t\t * @returns {string}\n\t\t */\n\t\trender: function(templateName, data) {\n\t\t\tvar value, id, label;\n\t\t\tvar html = '';\n\t\t\tvar cache = false;\n\t\t\tvar self = this;\n\t\t\tvar regex_tag = /^[\\t \\r\\n]*<([a-z][a-z0-9\\-_]*(?:\\:[a-z][a-z0-9\\-_]*)?)/i;\n\t\n\t\t\tif (templateName === 'option' || templateName === 'item') {\n\t\t\t\tvalue = hash_key(data[self.settings.valueField]);\n\t\t\t\tcache = !!value;\n\t\t\t}\n\t\n\t\t\t// pull markup from cache if it exists\n\t\t\tif (cache) {\n\t\t\t\tif (!isset(self.renderCache[templateName])) {\n\t\t\t\t\tself.renderCache[templateName] = {};\n\t\t\t\t}\n\t\t\t\tif (self.renderCache[templateName].hasOwnProperty(value)) {\n\t\t\t\t\treturn self.renderCache[templateName][value];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// render markup\n\t\t\thtml = $(self.settings.render[templateName].apply(this, [data, escape_html]));\n\t\n\t\t\t// add mandatory attributes\n\t\t\tif (templateName === 'option' || templateName === 'option_create') {\n\t\t\t\tif (!data[self.settings.disabledField]) {\n\t\t\t\t\thtml.attr('data-selectable', '');\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (templateName === 'optgroup') {\n\t\t\t\tid = data[self.settings.optgroupValueField] || '';\n\t\t\t\thtml.attr('data-group', id);\n\t\t\t\tif(data[self.settings.disabledField]) {\n\t\t\t\t\thtml.attr('data-disabled', '');\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (templateName === 'option' || templateName === 'item') {\n\t\t\t\thtml.attr('data-value', value || '');\n\t\t\t}\n\t\n\t\t\t// update cache\n\t\t\tif (cache) {\n\t\t\t\tself.renderCache[templateName][value] = html[0];\n\t\t\t}\n\t\n\t\t\treturn html[0];\n\t\t},\n\t\n\t\t/**\n\t\t * Clears the render cache for a template. If\n\t\t * no template is given, clears all render\n\t\t * caches.\n\t\t *\n\t\t * @param {string} templateName\n\t\t */\n\t\tclearCache: function(templateName) {\n\t\t\tvar self = this;\n\t\t\tif (typeof templateName === 'undefined') {\n\t\t\t\tself.renderCache = {};\n\t\t\t} else {\n\t\t\t\tdelete self.renderCache[templateName];\n\t\t\t}\n\t\t},\n\t\n\t\t/**\n\t\t * Determines whether or not to display the\n\t\t * create item prompt, given a user input.\n\t\t *\n\t\t * @param {string} input\n\t\t * @return {boolean}\n\t\t */\n\t\tcanCreate: function(input) {\n\t\t\tvar self = this;\n\t\t\tif (!self.settings.create) return false;\n\t\t\tvar filter = self.settings.createFilter;\n\t\t\treturn input.length\n\t\t\t\t&& (typeof filter !== 'function' || filter.apply(self, [input]))\n\t\t\t\t&& (typeof filter !== 'string' || new RegExp(filter).test(input))\n\t\t\t\t&& (!(filter instanceof RegExp) || filter.test(input));\n\t\t}\n\t\n\t});\n\t\n\t\n\tSelectize.count = 0;\n\tSelectize.defaults = {\n\t\toptions: [],\n\t\toptgroups: [],\n\t\n\t\tplugins: [],\n\t\tdelimiter: ',',\n\t\tsplitOn: null, // regexp or string for splitting up values from a paste command\n\t\tpersist: true,\n\t\tdiacritics: true,\n\t\tcreate: false,\n\t\tcreateOnBlur: false,\n\t\tcreateFilter: null,\n\t\thighlight: true,\n\t\topenOnFocus: true,\n\t\tmaxOptions: 1000,\n\t\tmaxItems: null,\n\t\thideSelected: null,\n\t\taddPrecedence: false,\n\t\tselectOnTab: false,\n\t\tpreload: false,\n\t\tallowEmptyOption: false,\n\t\tcloseAfterSelect: false,\n\t\n\t\tscrollDuration: 60,\n\t\tloadThrottle: 300,\n\t\tloadingClass: 'loading',\n\t\n\t\tdataAttr: 'data-data',\n\t\toptgroupField: 'optgroup',\n\t\tvalueField: 'value',\n\t\tlabelField: 'text',\n\t\tdisabledField: 'disabled',\n\t\toptgroupLabelField: 'label',\n\t\toptgroupValueField: 'value',\n\t\tlockOptgroupOrder: false,\n\t\n\t\tsortField: '$order',\n\t\tsearchField: ['text'],\n\t\tsearchConjunction: 'and',\n\t\n\t\tmode: null,\n\t\twrapperClass: 'selectize-control',\n\t\tinputClass: 'selectize-input',\n\t\tdropdownClass: 'selectize-dropdown',\n\t\tdropdownContentClass: 'selectize-dropdown-content',\n\t\n\t\tdropdownParent: null,\n\t\n\t\tcopyClassesToDropdown: true,\n\t\n\t\t/*\n\t\tload                 : null, // function(query, callback) { ... }\n\t\tscore                : null, // function(search) { ... }\n\t\tonInitialize         : null, // function() { ... }\n\t\tonChange             : null, // function(value) { ... }\n\t\tonItemAdd            : null, // function(value, $item) { ... }\n\t\tonItemRemove         : null, // function(value) { ... }\n\t\tonClear              : null, // function() { ... }\n\t\tonOptionAdd          : null, // function(value, data) { ... }\n\t\tonOptionRemove       : null, // function(value) { ... }\n\t\tonOptionClear        : null, // function() { ... }\n\t\tonOptionGroupAdd     : null, // function(id, data) { ... }\n\t\tonOptionGroupRemove  : null, // function(id) { ... }\n\t\tonOptionGroupClear   : null, // function() { ... }\n\t\tonDropdownOpen       : null, // function($dropdown) { ... }\n\t\tonDropdownClose      : null, // function($dropdown) { ... }\n\t\tonType               : null, // function(str) { ... }\n\t\tonDelete             : null, // function(values) { ... }\n\t\t*/\n\t\n\t\trender: {\n\t\t\t/*\n\t\t\titem: null,\n\t\t\toptgroup: null,\n\t\t\toptgroup_header: null,\n\t\t\toption: null,\n\t\t\toption_create: null\n\t\t\t*/\n\t\t}\n\t};\n\t\n\t\n\t$.fn.selectize = function(settings_user) {\n\t\tvar defaults             = $.fn.selectize.defaults;\n\t\tvar settings             = $.extend({}, defaults, settings_user);\n\t\tvar attr_data            = settings.dataAttr;\n\t\tvar field_label          = settings.labelField;\n\t\tvar field_value          = settings.valueField;\n\t\tvar field_disabled       = settings.disabledField;\n\t\tvar field_optgroup       = settings.optgroupField;\n\t\tvar field_optgroup_label = settings.optgroupLabelField;\n\t\tvar field_optgroup_value = settings.optgroupValueField;\n\t\n\t\t/**\n\t\t * Initializes selectize from a <input type=\"text\"> element.\n\t\t *\n\t\t * @param {object} $input\n\t\t * @param {object} settings_element\n\t\t */\n\t\tvar init_textbox = function($input, settings_element) {\n\t\t\tvar i, n, values, option;\n\t\n\t\t\tvar data_raw = $input.attr(attr_data);\n\t\n\t\t\tif (!data_raw) {\n\t\t\t\tvar value = $.trim($input.val() || '');\n\t\t\t\tif (!settings.allowEmptyOption && !value.length) return;\n\t\t\t\tvalues = value.split(settings.delimiter);\n\t\t\t\tfor (i = 0, n = values.length; i < n; i++) {\n\t\t\t\t\toption = {};\n\t\t\t\t\toption[field_label] = values[i];\n\t\t\t\t\toption[field_value] = values[i];\n\t\t\t\t\tsettings_element.options.push(option);\n\t\t\t\t}\n\t\t\t\tsettings_element.items = values;\n\t\t\t} else {\n\t\t\t\tsettings_element.options = JSON.parse(data_raw);\n\t\t\t\tfor (i = 0, n = settings_element.options.length; i < n; i++) {\n\t\t\t\t\tsettings_element.items.push(settings_element.options[i][field_value]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\t/**\n\t\t * Initializes selectize from a <select> element.\n\t\t *\n\t\t * @param {object} $input\n\t\t * @param {object} settings_element\n\t\t */\n\t\tvar init_select = function($input, settings_element) {\n\t\t\tvar i, n, tagName, $children, order = 0;\n\t\t\tvar options = settings_element.options;\n\t\t\tvar optionsMap = {};\n\t\n\t\t\tvar readData = function($el) {\n\t\t\t\tvar data = attr_data && $el.attr(attr_data);\n\t\t\t\tif (typeof data === 'string' && data.length) {\n\t\t\t\t\treturn JSON.parse(data);\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t};\n\t\n\t\t\tvar addOption = function($option, group) {\n\t\t\t\t$option = $($option);\n\t\n\t\t\t\tvar value = hash_key($option.val());\n\t\t\t\tif (!value && !settings.allowEmptyOption) return;\n\t\n\t\t\t\t// if the option already exists, it's probably been\n\t\t\t\t// duplicated in another optgroup. in this case, push\n\t\t\t\t// the current group to the \"optgroup\" property on the\n\t\t\t\t// existing option so that it's rendered in both places.\n\t\t\t\tif (optionsMap.hasOwnProperty(value)) {\n\t\t\t\t\tif (group) {\n\t\t\t\t\t\tvar arr = optionsMap[value][field_optgroup];\n\t\t\t\t\t\tif (!arr) {\n\t\t\t\t\t\t\toptionsMap[value][field_optgroup] = group;\n\t\t\t\t\t\t} else if (!$.isArray(arr)) {\n\t\t\t\t\t\t\toptionsMap[value][field_optgroup] = [arr, group];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tarr.push(group);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tvar option             = readData($option) || {};\n\t\t\t\toption[field_label]    = option[field_label] || $option.text();\n\t\t\t\toption[field_value]    = option[field_value] || value;\n\t\t\t\toption[field_disabled] = option[field_disabled] || $option.prop('disabled');\n\t\t\t\toption[field_optgroup] = option[field_optgroup] || group;\n\t\n\t\t\t\toptionsMap[value] = option;\n\t\t\t\toptions.push(option);\n\t\n\t\t\t\tif ($option.is(':selected')) {\n\t\t\t\t\tsettings_element.items.push(value);\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tvar addGroup = function($optgroup) {\n\t\t\t\tvar i, n, id, optgroup, $options;\n\t\n\t\t\t\t$optgroup = $($optgroup);\n\t\t\t\tid = $optgroup.attr('label');\n\t\n\t\t\t\tif (id) {\n\t\t\t\t\toptgroup = readData($optgroup) || {};\n\t\t\t\t\toptgroup[field_optgroup_label] = id;\n\t\t\t\t\toptgroup[field_optgroup_value] = id;\n\t\t\t\t\toptgroup[field_disabled] = $optgroup.prop('disabled');\n\t\t\t\t\tsettings_element.optgroups.push(optgroup);\n\t\t\t\t}\n\t\n\t\t\t\t$options = $('option', $optgroup);\n\t\t\t\tfor (i = 0, n = $options.length; i < n; i++) {\n\t\t\t\t\taddOption($options[i], id);\n\t\t\t\t}\n\t\t\t};\n\t\n\t\t\tsettings_element.maxItems = $input.attr('multiple') ? null : 1;\n\t\n\t\t\t$children = $input.children();\n\t\t\tfor (i = 0, n = $children.length; i < n; i++) {\n\t\t\t\ttagName = $children[i].tagName.toLowerCase();\n\t\t\t\tif (tagName === 'optgroup') {\n\t\t\t\t\taddGroup($children[i]);\n\t\t\t\t} else if (tagName === 'option') {\n\t\t\t\t\taddOption($children[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\treturn this.each(function() {\n\t\t\tif (this.selectize) return;\n\t\n\t\t\tvar instance;\n\t\t\tvar $input = $(this);\n\t\t\tvar tag_name = this.tagName.toLowerCase();\n\t\t\tvar placeholder = $input.attr('placeholder') || $input.attr('data-placeholder');\n\t\t\tif (!placeholder && !settings.allowEmptyOption) {\n\t\t\t\tplaceholder = $input.children('option[value=\"\"]').text();\n\t\t\t}\n\t\n\t\t\tvar settings_element = {\n\t\t\t\t'placeholder' : placeholder,\n\t\t\t\t'options'     : [],\n\t\t\t\t'optgroups'   : [],\n\t\t\t\t'items'       : []\n\t\t\t};\n\t\n\t\t\tif (tag_name === 'select') {\n\t\t\t\tinit_select($input, settings_element);\n\t\t\t} else {\n\t\t\t\tinit_textbox($input, settings_element);\n\t\t\t}\n\t\n\t\t\tinstance = new Selectize($input, $.extend(true, {}, defaults, settings_element, settings_user));\n\t\t});\n\t};\n\t\n\t$.fn.selectize.defaults = Selectize.defaults;\n\t$.fn.selectize.support = {\n\t\tvalidity: SUPPORTS_VALIDITY_API\n\t};\n\t\n\t\n\tSelectize.define('drag_drop', function(options) {\n\t\tif (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\t\tif (this.settings.mode !== 'multi') return;\n\t\tvar self = this;\n\t\n\t\tself.lock = (function() {\n\t\t\tvar original = self.lock;\n\t\t\treturn function() {\n\t\t\t\tvar sortable = self.$control.data('sortable');\n\t\t\t\tif (sortable) sortable.disable();\n\t\t\t\treturn original.apply(self, arguments);\n\t\t\t};\n\t\t})();\n\t\n\t\tself.unlock = (function() {\n\t\t\tvar original = self.unlock;\n\t\t\treturn function() {\n\t\t\t\tvar sortable = self.$control.data('sortable');\n\t\t\t\tif (sortable) sortable.enable();\n\t\t\t\treturn original.apply(self, arguments);\n\t\t\t};\n\t\t})();\n\t\n\t\tself.setup = (function() {\n\t\t\tvar original = self.setup;\n\t\t\treturn function() {\n\t\t\t\toriginal.apply(this, arguments);\n\t\n\t\t\t\tvar $control = self.$control.sortable({\n\t\t\t\t\titems: '[data-value]',\n\t\t\t\t\tforcePlaceholderSize: true,\n\t\t\t\t\tdisabled: self.isLocked,\n\t\t\t\t\tstart: function(e, ui) {\n\t\t\t\t\t\tui.placeholder.css('width', ui.helper.css('width'));\n\t\t\t\t\t\t$control.css({overflow: 'visible'});\n\t\t\t\t\t},\n\t\t\t\t\tstop: function() {\n\t\t\t\t\t\t$control.css({overflow: 'hidden'});\n\t\t\t\t\t\tvar active = self.$activeItems ? self.$activeItems.slice() : null;\n\t\t\t\t\t\tvar values = [];\n\t\t\t\t\t\t$control.children('[data-value]').each(function() {\n\t\t\t\t\t\t\tvalues.push($(this).attr('data-value'));\n\t\t\t\t\t\t});\n\t\t\t\t\t\tself.setValue(values);\n\t\t\t\t\t\tself.setActiveItem(active);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t})();\n\t\n\t});\n\t\n\tSelectize.define('dropdown_header', function(options) {\n\t\tvar self = this;\n\t\n\t\toptions = $.extend({\n\t\t\ttitle         : 'Untitled',\n\t\t\theaderClass   : 'selectize-dropdown-header',\n\t\t\ttitleRowClass : 'selectize-dropdown-header-title',\n\t\t\tlabelClass    : 'selectize-dropdown-header-label',\n\t\t\tcloseClass    : 'selectize-dropdown-header-close',\n\t\n\t\t\thtml: function(data) {\n\t\t\t\treturn (\n\t\t\t\t\t'<div class=\"' + data.headerClass + '\">' +\n\t\t\t\t\t\t'<div class=\"' + data.titleRowClass + '\">' +\n\t\t\t\t\t\t\t'<span class=\"' + data.labelClass + '\">' + data.title + '</span>' +\n\t\t\t\t\t\t\t'<a href=\"javascript:void(0)\" class=\"' + data.closeClass + '\">&times;</a>' +\n\t\t\t\t\t\t'</div>' +\n\t\t\t\t\t'</div>'\n\t\t\t\t);\n\t\t\t}\n\t\t}, options);\n\t\n\t\tself.setup = (function() {\n\t\t\tvar original = self.setup;\n\t\t\treturn function() {\n\t\t\t\toriginal.apply(self, arguments);\n\t\t\t\tself.$dropdown_header = $(options.html(options));\n\t\t\t\tself.$dropdown.prepend(self.$dropdown_header);\n\t\t\t};\n\t\t})();\n\t\n\t});\n\t\n\tSelectize.define('optgroup_columns', function(options) {\n\t\tvar self = this;\n\t\n\t\toptions = $.extend({\n\t\t\tequalizeWidth  : true,\n\t\t\tequalizeHeight : true\n\t\t}, options);\n\t\n\t\tthis.getAdjacentOption = function($option, direction) {\n\t\t\tvar $options = $option.closest('[data-group]').find('[data-selectable]');\n\t\t\tvar index    = $options.index($option) + direction;\n\t\n\t\t\treturn index >= 0 && index < $options.length ? $options.eq(index) : $();\n\t\t};\n\t\n\t\tthis.onKeyDown = (function() {\n\t\t\tvar original = self.onKeyDown;\n\t\t\treturn function(e) {\n\t\t\t\tvar index, $option, $options, $optgroup;\n\t\n\t\t\t\tif (this.isOpen && (e.keyCode === KEY_LEFT || e.keyCode === KEY_RIGHT)) {\n\t\t\t\t\tself.ignoreHover = true;\n\t\t\t\t\t$optgroup = this.$activeOption.closest('[data-group]');\n\t\t\t\t\tindex = $optgroup.find('[data-selectable]').index(this.$activeOption);\n\t\n\t\t\t\t\tif(e.keyCode === KEY_LEFT) {\n\t\t\t\t\t\t$optgroup = $optgroup.prev('[data-group]');\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$optgroup = $optgroup.next('[data-group]');\n\t\t\t\t\t}\n\t\n\t\t\t\t\t$options = $optgroup.find('[data-selectable]');\n\t\t\t\t\t$option  = $options.eq(Math.min($options.length - 1, index));\n\t\t\t\t\tif ($option.length) {\n\t\t\t\t\t\tthis.setActiveOption($option);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\treturn original.apply(this, arguments);\n\t\t\t};\n\t\t})();\n\t\n\t\tvar getScrollbarWidth = function() {\n\t\t\tvar div;\n\t\t\tvar width = getScrollbarWidth.width;\n\t\t\tvar doc = document;\n\t\n\t\t\tif (typeof width === 'undefined') {\n\t\t\t\tdiv = doc.createElement('div');\n\t\t\t\tdiv.innerHTML = '<div style=\"width:50px;height:50px;position:absolute;left:-50px;top:-50px;overflow:auto;\"><div style=\"width:1px;height:100px;\"></div></div>';\n\t\t\t\tdiv = div.firstChild;\n\t\t\t\tdoc.body.appendChild(div);\n\t\t\t\twidth = getScrollbarWidth.width = div.offsetWidth - div.clientWidth;\n\t\t\t\tdoc.body.removeChild(div);\n\t\t\t}\n\t\t\treturn width;\n\t\t};\n\t\n\t\tvar equalizeSizes = function() {\n\t\t\tvar i, n, height_max, width, width_last, width_parent, $optgroups;\n\t\n\t\t\t$optgroups = $('[data-group]', self.$dropdown_content);\n\t\t\tn = $optgroups.length;\n\t\t\tif (!n || !self.$dropdown_content.width()) return;\n\t\n\t\t\tif (options.equalizeHeight) {\n\t\t\t\theight_max = 0;\n\t\t\t\tfor (i = 0; i < n; i++) {\n\t\t\t\t\theight_max = Math.max(height_max, $optgroups.eq(i).height());\n\t\t\t\t}\n\t\t\t\t$optgroups.css({height: height_max});\n\t\t\t}\n\t\n\t\t\tif (options.equalizeWidth) {\n\t\t\t\twidth_parent = self.$dropdown_content.innerWidth() - getScrollbarWidth();\n\t\t\t\twidth = Math.round(width_parent / n);\n\t\t\t\t$optgroups.css({width: width});\n\t\t\t\tif (n > 1) {\n\t\t\t\t\twidth_last = width_parent - width * (n - 1);\n\t\t\t\t\t$optgroups.eq(n - 1).css({width: width_last});\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\n\t\tif (options.equalizeHeight || options.equalizeWidth) {\n\t\t\thook.after(this, 'positionDropdown', equalizeSizes);\n\t\t\thook.after(this, 'refreshOptions', equalizeSizes);\n\t\t}\n\t\n\t\n\t});\n\t\n\tSelectize.define('remove_button', function(options) {\n\t\toptions = $.extend({\n\t\t\t\tlabel     : '&times;',\n\t\t\t\ttitle     : 'Remove',\n\t\t\t\tclassName : 'remove',\n\t\t\t\tappend    : true\n\t\t\t}, options);\n\t\n\t\t\tvar singleClose = function(thisRef, options) {\n\t\n\t\t\t\toptions.className = 'remove-single';\n\t\n\t\t\t\tvar self = thisRef;\n\t\t\t\tvar html = '<a href=\"javascript:void(0)\" class=\"' + options.className + '\" tabindex=\"-1\" title=\"' + escape_html(options.title) + '\">' + options.label + '</a>';\n\t\n\t\t\t\t/**\n\t\t\t\t * Appends an element as a child (with raw HTML).\n\t\t\t\t *\n\t\t\t\t * @param {string} html_container\n\t\t\t\t * @param {string} html_element\n\t\t\t\t * @return {string}\n\t\t\t\t */\n\t\t\t\tvar append = function(html_container, html_element) {\n\t\t\t\t\treturn $('<span>').append(html_container)\n\t\t\t\t\t\t.append(html_element);\n\t\t\t\t};\n\t\n\t\t\t\tthisRef.setup = (function() {\n\t\t\t\t\tvar original = self.setup;\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\t// override the item rendering method to add the button to each\n\t\t\t\t\t\tif (options.append) {\n\t\t\t\t\t\t\tvar id = $(self.$input.context).attr('id');\n\t\t\t\t\t\t\tvar selectizer = $('#'+id);\n\t\n\t\t\t\t\t\t\tvar render_item = self.settings.render.item;\n\t\t\t\t\t\t\tself.settings.render.item = function(data) {\n\t\t\t\t\t\t\t\treturn append(render_item.apply(thisRef, arguments), html);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\toriginal.apply(thisRef, arguments);\n\t\n\t\t\t\t\t\t// add event listener\n\t\t\t\t\t\tthisRef.$control.on('click', '.' + options.className, function(e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tif (self.isLocked) return;\n\t\n\t\t\t\t\t\t\tself.clear();\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t};\n\t\t\t\t})();\n\t\t\t};\n\t\n\t\t\tvar multiClose = function(thisRef, options) {\n\t\n\t\t\t\tvar self = thisRef;\n\t\t\t\tvar html = '<a href=\"javascript:void(0)\" class=\"' + options.className + '\" tabindex=\"-1\" title=\"' + escape_html(options.title) + '\">' + options.label + '</a>';\n\t\n\t\t\t\t/**\n\t\t\t\t * Appends an element as a child (with raw HTML).\n\t\t\t\t *\n\t\t\t\t * @param {string} html_container\n\t\t\t\t * @param {string} html_element\n\t\t\t\t * @return {string}\n\t\t\t\t */\n\t\t\t\tvar append = function(html_container, html_element) {\n\t\t\t\t\tvar pos = html_container.search(/(<\\/[^>]+>\\s*)$/);\n\t\t\t\t\treturn html_container.substring(0, pos) + html_element + html_container.substring(pos);\n\t\t\t\t};\n\t\n\t\t\t\tthisRef.setup = (function() {\n\t\t\t\t\tvar original = self.setup;\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\t// override the item rendering method to add the button to each\n\t\t\t\t\t\tif (options.append) {\n\t\t\t\t\t\t\tvar render_item = self.settings.render.item;\n\t\t\t\t\t\t\tself.settings.render.item = function(data) {\n\t\t\t\t\t\t\t\treturn append(render_item.apply(thisRef, arguments), html);\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\toriginal.apply(thisRef, arguments);\n\t\n\t\t\t\t\t\t// add event listener\n\t\t\t\t\t\tthisRef.$control.on('click', '.' + options.className, function(e) {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tif (self.isLocked) return;\n\t\n\t\t\t\t\t\t\tvar $item = $(e.currentTarget).parent();\n\t\t\t\t\t\t\tself.setActiveItem($item);\n\t\t\t\t\t\t\tif (self.deleteSelection()) {\n\t\t\t\t\t\t\t\tself.setCaret(self.items.length);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\n\t\t\t\t\t};\n\t\t\t\t})();\n\t\t\t};\n\t\n\t\t\tif (this.settings.mode === 'single') {\n\t\t\t\tsingleClose(this, options);\n\t\t\t\treturn;\n\t\t\t} else {\n\t\t\t\tmultiClose(this, options);\n\t\t\t}\n\t});\n\t\n\t\n\tSelectize.define('restore_on_backspace', function(options) {\n\t\tvar self = this;\n\t\n\t\toptions.text = options.text || function(option) {\n\t\t\treturn option[this.settings.labelField];\n\t\t};\n\t\n\t\tthis.onKeyDown = (function() {\n\t\t\tvar original = self.onKeyDown;\n\t\t\treturn function(e) {\n\t\t\t\tvar index, option;\n\t\t\t\tif (e.keyCode === KEY_BACKSPACE && this.$control_input.val() === '' && !this.$activeItems.length) {\n\t\t\t\t\tindex = this.caretPos - 1;\n\t\t\t\t\tif (index >= 0 && index < this.items.length) {\n\t\t\t\t\t\toption = this.options[this.items[index]];\n\t\t\t\t\t\tif (this.deleteSelection(e)) {\n\t\t\t\t\t\t\tthis.setTextboxValue(options.text.apply(this, [option]));\n\t\t\t\t\t\t\tthis.refreshOptions(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn original.apply(this, arguments);\n\t\t\t};\n\t\t})();\n\t});\n\t\n\n\treturn Selectize;\n}));"]}