PageSourceSearch

https://hydroterra.com.au/wp-content/plugins/woocommerce-request-a-quote//assets/js/select2.js?ver=1.0

js hydroterra.com.au collected 2026-09-29 23:21:56 UTC 130,358 bytes, 5,406 lines download raw bytes

vendor: 4,494 bytes, lines 1-129
1/*!
2 * Select2 4.0.0
3 * https://select2.github.io
4 *
5 * Released under the MIT license
6 * https://github.com/select2/select2/blob/master/LICENSE.md
7 */
8(function (factory) {
9	if (typeof define === 'function' && define.amd) {
10	  // AMD. Register as an anonymous module.
11	  define(['jquery'], factory);
12	} else if (typeof exports === 'object') {
13	  // Node/CommonJS
14	  factory(require('jquery'));
15	} else {
16	  // Browser globals
17	  factory(jQuery);
18	}
19}(function (jQuery) {
20  // This is needed so we can catch the AMD loader configuration and use it
21  // The inner file should be wrapped (by `banner.start.js`) in a function that
22  // returns the AMD loader references.
23  var S2 =
24(function () {
25		  // Restore the Select2 AMD loader so it can be used
26		  // Needed mostly in the language files, where the loader is not inserted
27		if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
28	  var S2 = jQuery.fn.select2.amd;
29		}
30		var S2;(function () { if (!S2 || !S2.requirejs) {
31				if (!S2) {
32			S2 = {}; } else {
33						require = S2; }
34		/**
35		 * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
36		 * Available via the MIT or new BSD license.
37		 * see: http://github.com/jrburke/almond for details
38		 */
39		//Going sloppy to avoid 'use strict' string cost, but strict practices should
40		//be followed.
41		/*jslint sloppy: true */
42		/*global setTimeout: false */
43
44		var requirejs, require, define;
45		(function (undef) {
46								var main, req, makeMap, handlers,
47							defined        = {},
48							waiting        = {},
49							config         = {},
50							defining       = {},
51							hasOwn         = Object.prototype.hasOwnProperty,
52							aps            = [].slice,
53							jsSuffixRegExp = /\.js$/;
54
55						function hasProp(obj, prop) {
56				return hasOwn.call(obj, prop);
57						}
58
59						/**
60						 * Given a relative module name, like ./something, normalize it to
61						 * a real name that can be mapped to a path.
62				 *
63						 * @param {String} name the relative name
64						 * @param {String} baseName a real name that the name arg is relative
65						 * to.
66						 * @returns {String} normalized name
67						 */
68						function normalize(name, baseName) {
69			var nameParts, nameSegment, mapValue, foundMap, lastIndex,
70				foundI, foundStarMap, starI, i, j, part,
71				baseParts = baseName && baseName.split("/"),
72				map       = config.map,
73				starMap   = (map && map['*']) || {};
74
75			//Adjust any relative paths.
76							if (name && name.charAt(0) === ".") {
77								//If have a base name, try to normalize against it,
78								//otherwise, assume it is a top-level require that will
79								//be relative to baseUrl in the end.
80								if (baseName) {
81									//Convert baseName to array, and lop off the last part,
82									//so that . matches that "directory" and not name of the baseName's
83									//module. For instance, baseName of "one/two/three", maps to
84									//"one/two/three.js", but we want the directory, "one/two" for
85									//this normalization.
86									baseParts = baseParts.slice(0, baseParts.length - 1);
87									name      = name.split('/');
88									lastIndex = name.length - 1;
89
90									// Node .js allowance:
91									if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
92										name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
93									}
94
95									name = baseParts.concat(name);
96
97									//start trimDots
98									for (i = 0; i < name.length; i += 1) {
99										part = name[i];
100										if (part === ".") {
101											name.splice(i, 1);
102											i -= 1;
103										} else if (part === "..") {
104											if (i === 1 && (name[2] === '..' || name[0] === '..')) {
105												//End of the line. Keep at least one non-dot
106												//path segment at the front so it can be mapped
107												//correctly to disk. Otherwise, there is likely
108												//no path mapping for a path starting with '..'.
109												//This can still fail, but catches the most reasonable
110												//uses of ..
111												break;
112											} else if (i > 0) {
113												name.splice(i - 1, 2);
114												i -= 2;
115											}
116										}
117									}
118									//end trimDots
119
120									name = name.join("/");
121								} else if (name.indexOf('./') === 0) {
122									// No baseName, so this is ID is resolved relative
123									// to baseUrl, pull off the leading dot.
124									name = name.substring(2);
125								}
126							}
127
128			//Apply map config if available.
129							if ((baseParts || starMap) && map) {
vendor: 7,651 bytes, lines 130-375
130								nameParts = name.split('/');
131
132								for (i = nameParts.length; i > 0; i -= 1) {
133									nameSegment = nameParts.slice(0, i).join("/");
134
135									if (baseParts) {
136										//Find the longest baseName segment match in the config.
137										//So, do joins on the biggest to smallest lengths of baseParts.
138										for (j = baseParts.length; j > 0; j -= 1) {
139											mapValue = map[baseParts.slice(0, j).join('/')];
140
141											//baseName segment has  config, find if it has one for
142											//this name.
143											if (mapValue) {
144												mapValue = mapValue[nameSegment];
145												if (mapValue) {
146													//Match, update name to the new value.
147													foundMap = mapValue;
148													foundI   = i;
149													break;
150												}
151											}
152										}
153									}
154
155									if (foundMap) {
156										break;
157									}
158
159									//Check for a star map match, but just hold on to it,
160									//if there is a shorter segment match later in a matching
161									//config, then favor over this star map.
162									if (!foundStarMap && starMap && starMap[nameSegment]) {
163										foundStarMap = starMap[nameSegment];
164										starI        = i;
165									}
166								}
167
168								if (!foundMap && foundStarMap) {
169									foundMap = foundStarMap;
170									foundI   = starI;
171								}
172
173								if (foundMap) {
174									nameParts.splice(0, foundI, foundMap);
175									name = nameParts.join('/');
176								}
177							}
178
179			return name;
180						}
181
182						function makeRequire(relName, forceSync) {
183			return function () {
184									//A version of a require function that passes a moduleName
185									//value for items that may need to
186									//look up paths relative to the moduleName
187									return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
188							};
189									}
190
191						function makeNormalize(relName) {
192							return function (name) {
193								return normalize(name, relName);
194							};
195						}
196
197						function makeLoad(depName) {
198							return function (value) {
199								defined[depName] = value;
200							};
201						}
202
203						function callDep(name) {
204							if (hasProp(waiting, name)) {
205								var args = waiting[name];
206								delete waiting[name];
207								defining[name] = true;
208								main.apply(undef, args);
209							}
210
211							if (!hasProp(defined, name) && !hasProp(defining, name)) {
212								throw new Error('No ' + name);
213							}
214							return defined[name];
215						}
216
217						//Turns a plugin!resource to [plugin, resource]
218						//with the plugin being undefined if the name
219						//did not have a plugin prefix.
220						function splitPrefix(name) {
221							var prefix,
222								index = name ? name.indexOf('!') : -1;
223							if (index > -1) {
224								prefix = name.substring(0, index);
225								name   = name.substring(index + 1, name.length);
226							}
227							return [prefix, name];
228						}
229
230						/**
231						 * Makes a name map, normalizing the name, and using a plugin
232						 * for normalization if necessary. Grabs a ref to plugin
233						 * too, as an optimization.
234						 */
235						makeMap = function (name, relName) {
236							var plugin,
237								parts  = splitPrefix(name),
238								prefix = parts[0];
239
240							name = parts[1];
241
242							if (prefix) {
243								prefix = normalize(prefix, relName);
244								plugin = callDep(prefix);
245							}
246
247							//Normalize according
248							if (prefix) {
249								if (plugin && plugin.normalize) {
250									name = plugin.normalize(name, makeNormalize(relName));
251								} else {
252									name = normalize(name, relName);
253								}
254							} else {
255								name   = normalize(name, relName);
256								parts  = splitPrefix(name);
257								prefix = parts[0];
258								name   = parts[1];
259								if (prefix) {
260									plugin = callDep(prefix);
261								}
262							}
263
264							//Using ridiculous property names for space reasons
265							return {
266								f: prefix ? prefix + '!' + name : name, //fullName
267								n: name,
268								pr: prefix,
269								p: plugin
270							};
271						};
272
273			function makeConfig(name) {
274			return function () {
275					return (config && config.config && config.config[name]) || {};
276				};
277						}
278
279					handlers = {
280						require: function (name) {
281							return makeRequire(name);
282						},
283						exports: function (name) {
284							var e = defined[name];
285							if (typeof e !== 'undefined') {
286								return e;
287							} else {
288								return (defined[name] = {});
289							}
290						},
291						module: function (name) {
292							return {
293								id: name,
294								uri: '',
295								exports: defined[name],
296								config: makeConfig(name)
297							};
298						}
299						};
300
301								main = function (name, deps, callback, relName) {
302									var cjsModule, depName, ret, map, i,
303										args         = [],
304										callbackType = typeof callback,
305										usingExports;
306
307									//Use name if no relName
308									relName = relName || name;
309
310									//Call the callback to define the module, if necessary.
311									if (callbackType === 'undefined' || callbackType === 'function') {
312										//Pull out the defined dependencies and pass the ordered
313										//values to the callback.
314										//Default to [require, exports, module] if no deps
315										deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
316										for (i = 0; i < deps.length; i += 1) {
317											map     = makeMap(deps[i], relName);
318											depName = map.f;
319
320											//Fast path CommonJS standard dependencies.
321											if (depName === "require") {
322												args[i] = handlers.require(name);
323											} else if (depName === "exports") {
324												//CommonJS module spec 1.1
325												args[i]      = handlers.exports(name);
326												usingExports = true;
327											} else if (depName === "module") {
328												//CommonJS module spec 1.1
329												cjsModule = args[i] = handlers.module(name);
330											} else if (hasProp(defined, depName) ||
331											   hasProp(waiting, depName) ||
332											   hasProp(defining, depName)) {
333												args[i] = callDep(depName);
334											} else if (map.p) {
335												map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
336												args[i] = defined[depName];
337											} else {
338												throw new Error(name + ' missing ' + depName);
339											}
340										}
341
342										ret = callback ? callback.apply(defined[name], args) : undefined;
343
344										if (name) {
345											//If setting exports via "module" is in play,
346											//favor that over return value and exports. After that,
347											//favor a non-undefined return value over exports use.
348											if (cjsModule && cjsModule.exports !== undef &&
349											cjsModule.exports !== defined[name]) {
350												defined[name] = cjsModule.exports;
351											} else if (ret !== undef || !usingExports) {
352												//Use the return value from the function.
353												defined[name] = ret;
354											}
355										}
356									} else if (name) {
357										//May just be an object definition for the module. Only
358										//worry about defining if have a module name.
359										defined[name] = callback;
360									}
361											};
362
363					requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
364						if (typeof deps === "string") {
365							if (handlers[deps]) {
366								//callback in this case is really relName
367								return handlers[deps](callback);
368							}
369							//Just return the module wanted. In this scenario, the
370							//deps arg is the module name, and second arg (if passed)
371							//is just the relName.
372							//Normalize module name, if it contains . or ..
373							return callDep(makeMap(deps, callback).f);
374						} else if (!deps.splice) {
375							//deps is a config object, not an array.
vendor: 39,988 bytes, lines 376-2000
376							config = deps;
377							if (config.deps) {
378								req(config.deps, config.callback);
379							}
380							if (!callback) {
381								return;
382							}
383
384							if (callback.splice) {
385								//callback is an array, which means it is a dependency list.
386								//Adjust args if there are dependencies
387								deps     = callback;
388								callback = relName;
389								relName  = null;
390							} else {
391								deps = undef;
392							}
393						}
394
395						//Support require(['a'])
396						callback = callback || function () {};
397
398						//If relName is a function, it is an errback handler,
399						//so remove it.
400						if (typeof relName === 'function') {
401							relName   = forceSync;
402							forceSync = alt;
403						}
404
405						//Simulate async callback;
406						if (forceSync) {
407							main(undef, deps, callback, relName);
408						} else {
409							//Using a non-zero value because of concern for what old browsers
410							//do, and latest browsers "upgrade" to 4 if lower value is used:
411							//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
412							//If want a value immediately, use require('id') instead -- something
413							//that works in almond on the global level, but not guaranteed and
414							//unlikely to work in other AMD implementations.
415							setTimeout(function () {
416								main(undef, deps, callback, relName);
417							}, 4);
418						}
419
420						return req;
421								};
422
423					/**
424					 * Just drops the config on the floor, but returns req in case
425					 * the config return value is used.
426					 */
427					req.config = function (cfg) {
428						return req(cfg);
429								};
430
431					/**
432					 * Expose module registry for debugging and tooling
433					 */
434					requirejs._defined = defined;
435
436					define = function (name, deps, callback) {
437
438						//This module may not have dependencies
439						if (!deps.splice) {
440							//deps is not an array, so probably means
441							//an object literal or factory function for
442							//the value. Adjust args.
443							callback = deps;
444							deps     = [];
445						}
446
447						if (!hasProp(defined, name) && !hasProp(waiting, name)) {
448							waiting[name] = [name, deps, callback];
449						}
450								};
451
452					define.amd = {
453						jQuery: true
454						};
455					}());
456
457		S2.requirejs = requirejs;S2.require = require;S2.define = define;
458		}
459		}());
460		S2.define("almond", function(){});
461
462		/* global jQuery:false, $:false */
463		S2.define('jquery',[],function () {
464		  var _$ = jQuery || $;
465
466			if (_$ == null && console && console.error) {
467		  console.error(
468			'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
469			'found. Make sure that you are including jQuery before Select2 on your ' +
470			'web page.'
471		  );
472			}
473
474		  return _$;
475		});
476
477		S2.define('select2/utils',[
478		  'jquery'
479		], function ($) {
480		  var Utils = {};
481
482		  Utils.Extend = function (ChildClass, SuperClass) {
483				var __hasProp = {}.hasOwnProperty;
484
485				function BaseConstructor () {
486					  this.constructor = ChildClass;
487				  }
488
489				for (var key in SuperClass) {
490					if (__hasProp.call(SuperClass, key)) {
491						ChildClass[key] = SuperClass[key];
492					}
493				  }
494
495				BaseConstructor.prototype = SuperClass.prototype;
496				ChildClass.prototype      = new BaseConstructor();
497				ChildClass.__super__      = SuperClass.prototype;
498
499				return ChildClass;
500			};
501
502			function getMethods (theClass) {
503	  var proto = theClass.prototype;
504
505	  var methods = [];
506
507				for (var methodName in proto) {
508				  var m = proto[methodName];
509
510					if (typeof m !== 'function') {
511					continue;
512					}
513
514					if (methodName === 'constructor') {
515			  continue;
516					}
517
518			  methods.push(methodName);
519				}
520
521	  return methods;
522			}
523
524	  Utils.Decorate = function (SuperClass, DecoratorClass) {
525					var decoratedMethods = getMethods(DecoratorClass);
526					var superMethods     = getMethods(SuperClass);
527
528				function DecoratedClass () {
529			var unshift = Array.prototype.unshift;
530
531			var argCount = DecoratorClass.prototype.constructor.length;
532
533			var calledConstructor = SuperClass.prototype.constructor;
534
535					if (argCount > 0) {
536						  unshift.call(arguments, SuperClass.prototype.constructor);
537
538						  calledConstructor = DecoratorClass.prototype.constructor;
539					}
540
541			calledConstructor.apply(this, arguments);
542					  }
543
544					DecoratorClass.displayName = SuperClass.displayName;
545
546				function ctr () {
547				this.constructor = DecoratedClass;
548					  }
549
550					DecoratedClass.prototype = new ctr();
551
552				for (var m = 0; m < superMethods.length; m++) {
553					var superMethod = superMethods[m];
554
555					DecoratedClass.prototype[superMethod] =
556					  SuperClass.prototype[superMethod];
557					  }
558
559					var calledMethod = function (methodName) {
560					  // Stub out the original method if it's not decorating an actual method
561					  var originalMethod = function () {};
562
563						if (methodName in DecoratedClass.prototype) {
564					originalMethod = DecoratedClass.prototype[methodName];
565						}
566
567				var decoratedMethod = DecoratorClass.prototype[methodName];
568
569				return function () {
570							  var unshift = Array.prototype.unshift;
571
572							  unshift.call(arguments, originalMethod);
573
574							  return decoratedMethod.apply(this, arguments);
575						};
576						  };
577
578			for (var d = 0; d < decoratedMethods.length; d++) {
579		  var decoratedMethod = decoratedMethods[d];
580
581		  DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
582			}
583
584			  return DecoratedClass;
585			};
586
587		  var Observable = function () {
588				this.listeners = {};
589			};
590
591		  Observable.prototype.on = function (event, callback) {
592				this.listeners = this.listeners || {};
593
594				if (event in this.listeners) {
595				  this.listeners[event].push(callback);
596				} else {
597				  this.listeners[event] = [callback];
598				}
599			};
600
601		  Observable.prototype.trigger = function (event) {
602				var slice = Array.prototype.slice;
603
604				this.listeners = this.listeners || {};
605
606				if (event in this.listeners) {
607				  this.invoke(this.listeners[event], slice.call(arguments, 1));
608				}
609
610				if ('*' in this.listeners) {
611				  this.invoke(this.listeners['*'], arguments);
612				}
613			};
614
615		  Observable.prototype.invoke = function (listeners, params) {
616				for (var i = 0, len = listeners.length; i < len; i++) {
617				  listeners[i].apply(this, params);
618				}
619			};
620
621		  Utils.Observable = Observable;
622
623		  Utils.generateChars = function (length) {
624				var chars = '';
625
626				for (var i = 0; i < length; i++) {
627				  var randomChar = Math.floor(Math.random() * 36);
628				  chars         += randomChar.toString(36);
629				}
630
631				return chars;
632			};
633
634		  Utils.bind = function (func, context) {
635				return function () {
636				  func.apply(context, arguments);
637				};
638			};
639
640		  Utils._convertData = function (data) {
641				for (var originalKey in data) {
642				  var keys = originalKey.split('-');
643
644				  var dataLevel = data;
645
646					if (keys.length === 1) {
647					continue;
648					}
649
650					for (var k = 0; k < keys.length; k++) {
651			  var key = keys[k];
652
653			  // Lowercase the first letter
654			  // By default, dash-separated becomes camelCase
655			  key = key.substring(0, 1).toLowerCase() + key.substring(1);
656
657						if (!(key in dataLevel)) {
658							dataLevel[key] = {};
659						}
660
661						if (k == keys.length - 1) {
662						  dataLevel[key] = data[originalKey];
663						}
664
665			  dataLevel = dataLevel[key];
666					}
667
668			  delete data[originalKey];
669				}
670
671				return data;
672			};
673
674		  Utils.hasScroll = function (index, el) {
675				// Adapted from the function created by @ShadowScripter
676				// and adapted by @BillBarry on the Stack Exchange Code Review website.
677				// The original code can be found at
678				// http://codereview.stackexchange.com/q/13338
679				// and was designed to be used with the Sizzle selector engine.
680
681				var $el       = $(el);
682				var overflowX = el.style.overflowX;
683				var overflowY = el.style.overflowY;
684
685				//Check both x and y declarations
686				if (overflowX === overflowY &&
687				(overflowY === 'hidden' || overflowY === 'visible')) {
688				  return false;
689				}
690
691				if (overflowX === 'scroll' || overflowY === 'scroll') {
692				  return true;
693				}
694
695				return ($el.innerHeight() < el.scrollHeight ||
696				$el.innerWidth() < el.scrollWidth);
697			};
698
699		  Utils.escapeMarkup = function (markup) {
700				var replaceMap = {
701					'\\': '&#92;',
702					'&': '&amp;',
703					'<': '&lt;',
704					'>': '&gt;',
705					'"': '&quot;',
706					'\'': '&#39;',
707					'/': '&#47;'
708				};
709
710				// Do not try to escape the markup if it's not a string
711				if (typeof markup !== 'string') {
712				  return markup;
713				}
714
715				return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
716				  return replaceMap[match];
717				});
718			};
719
720		  // Append an array of jQuery nodes to a given element.
721		  Utils.appendMany = function ($element, $nodes) {
722				// jQuery 1.7.x does not support $.fn.append() with an array
723				// Fall back to a jQuery object collection using $.fn.add()
724				if ($.fn.jquery.substr(0, 3) === '1.7') {
725				  var $jqNodes = $();
726
727				  $.map($nodes, function (node) {
728						$jqNodes = $jqNodes.add(node);
729					});
730
731				  $nodes = $jqNodes;
732				}
733
734				$element.append($nodes);
735			};
736
737		  return Utils;
738		});
739
740		S2.define('select2/results',[
741		  'jquery',
742		  './utils'
743		], function ($, Utils) {
744			function Results ($element, options, dataAdapter) {
745		  this.$element = $element;
746		  this.data     = dataAdapter;
747		  this.options  = options;
748
749		  Results.__super__.constructor.call(this);
750			}
751
752		  Utils.Extend(Results, Utils.Observable);
753
754		  Results.prototype.render = function () {
755				var $results = $(
756				'<ul class="select2-results__options" role="tree"></ul>'
757				);
758
759				if (this.options.get('multiple')) {
760				  $results.attr('aria-multiselectable', 'true');
761				}
762
763				this.$results = $results;
764
765				return $results;
766			};
767
768		  Results.prototype.clear = function () {
769				this.$results.empty();
770			};
771
772		  Results.prototype.displayMessage = function (params) {
773				var escapeMarkup = this.options.get('escapeMarkup');
774
775				this.clear();
776				this.hideLoading();
777
778				var $message = $(
779				'<li role="treeitem" class="select2-results__option"></li>'
780				);
781
782				var message = this.options.get('translations').get(params.message);
783
784				$message.append(
785				escapeMarkup(
786				message(params.args)
787				)
788				);
789
790				this.$results.append($message);
791			};
792
793		  Results.prototype.append = function (data) {
794				this.hideLoading();
795
796				var $options = [];
797
798				if (data.results == null || data.results.length === 0) {
799					if (this.$results.children().length === 0) {
800					this.trigger('results:message', {
801							message: 'noResults'
802					});
803					}
804
805				  return;
806				}
807
808				data.results = this.sort(data.results);
809
810				for (var d = 0; d < data.results.length; d++) {
811				  var item = data.results[d];
812
813				  var $option = this.option(item);
814
815				  $options.push($option);
816				}
817
818				this.$results.append($options);
819			};
820
821		  Results.prototype.position = function ($results, $dropdown) {
822				var $resultsContainer = $dropdown.find('.select2-results');
823				$resultsContainer.append($results);
824			};
825
826		  Results.prototype.sort = function (data) {
827				var sorter = this.options.get('sorter');
828
829				return sorter(data);
830			};
831
832		  Results.prototype.setClasses = function () {
833				var self = this;
834
835				this.data.current(function (selected) {
836				  var selectedIds = $.map(selected, function (s) {
837						return s.id.toString();
838					});
839
840				  var $options = self.$results
841				  .find('.select2-results__option[aria-selected]');
842
843				  $options.each(function () {
844						var $option = $(this);
845
846						var item = $.data(this, 'data');
847
848						// id needs to be converted to a string when comparing
849						var id = '' + item.id;
850
851						if ((item.element != null && item.element.selected) ||
852						(item.element == null && $.inArray(id, selectedIds) > -1)) {
853								$option.attr('aria-selected', 'true');
854							} else {
855							$option.attr('aria-selected', 'false');
856							}
857					});
858
859				  var $selected = $options.filter('[aria-selected=true]');
860
861				  // Check if there are any selected options
862					if ($selected.length > 0) {
863				  // If there are selected options, highlight the first
864				  $selected.first().trigger('mouseenter');
865					} else {
866			  // If there are no selected options, highlight the first option
867			  // in the dropdown
868			  $options.first().trigger('mouseenter');
869					}
870				});
871			};
872
873		  Results.prototype.showLoading = function (params) {
874				this.hideLoading();
875
876				var loadingMore = this.options.get('translations').get('searching');
877
878				var loading         = {
879					disabled: true,
880					loading: true,
881					text: loadingMore(params)
882				};
883				var $loading        = this.option(loading);
884				$loading.className += ' loading-results';
885
886				this.$results.prepend($loading);
887			};
888
889		  Results.prototype.hideLoading = function () {
890				this.$results.find('.loading-results').remove();
891			};
892
893		  Results.prototype.option = function (data) {
894				var option       = document.createElement('li');
895				option.className = 'select2-results__option';
896
897				var attrs = {
898					'role': 'treeitem',
899					'aria-selected': 'false'
900				};
901
902				if (data.disabled) {
903				  delete attrs['aria-selected'];
904				  attrs['aria-disabled'] = 'true';
905				}
906
907				if (data.id == null) {
908				  delete attrs['aria-selected'];
909				}
910
911				if (data._resultId != null) {
912				  option.id = data._resultId;
913				}
914
915				if (data.title) {
916				  option.title = data.title;
917				}
918
919				if (data.children) {
920				  attrs.role          = 'group';
921				  attrs['aria-label'] = data.text;
922				  delete attrs['aria-selected'];
923				}
924
925				for (var attr in attrs) {
926				  var val = attrs[attr];
927
928				  option.setAttribute(attr, val);
929				}
930
931				if (data.children) {
932				  var $option = $(option);
933
934				  var label       = document.createElement('strong');
935				  label.className = 'select2-results__group';
936
937				  var $label = $(label);
938				  this.template(data, label);
939
940				  var $children = [];
941
942					for (var c = 0; c < data.children.length; c++) {
943				  var child = data.children[c];
944
945				  var $child = this.option(child);
946
947				  $children.push($child);
948					}
949
950				  var $childrenContainer = $('<ul></ul>', {
951						'class': 'select2-results__options select2-results__options--nested'
952				  });
953
954				  $childrenContainer.append($children);
955
956				  $option.append(label);
957				  $option.append($childrenContainer);
958				} else {
959				  this.template(data, option);
960				}
961
962				$.data(option, 'data', data);
963
964				return option;
965			};
966
967		  Results.prototype.bind = function (container, $container) {
968				var self = this;
969
970				var id = container.id + '-results';
971
972				this.$results.attr('id', id);
973
974				container.on('results:all', function (params) {
975				  self.clear();
976				  self.append(params.data);
977
978					if (container.isOpen()) {
979				  self.setClasses();
980					}
981				});
982
983				container.on('results:append', function (params) {
984				  self.append(params.data);
985
986					if (container.isOpen()) {
987				  self.setClasses();
988					}
989				});
990
991				container.on('query', function (params) {
992				  self.showLoading(params);
993				});
994
995				container.on('select', function () {
996					if (!container.isOpen()) {
997				  return;
998					}
999
1000				  self.setClasses();
1001				});
1002
1003				container.on('unselect', function () {
1004					if (!container.isOpen()) {
1005				  return;
1006					}
1007
1008				  self.setClasses();
1009				});
1010
1011				container.on('open', function () {
1012				  // When the dropdown is open, aria-expended="true"
1013				  self.$results.attr('aria-expanded', 'true');
1014				  self.$results.attr('aria-hidden', 'false');
1015
1016				  self.setClasses();
1017				  self.ensureHighlightVisible();
1018				});
1019
1020				container.on('close', function () {
1021				  // When the dropdown is closed, aria-expended="false"
1022				  self.$results.attr('aria-expanded', 'false');
1023				  self.$results.attr('aria-hidden', 'true');
1024				  self.$results.removeAttr('aria-activedescendant');
1025				});
1026
1027				container.on('results:toggle', function () {
1028				  var $highlighted = self.getHighlightedResults();
1029
1030					if ($highlighted.length === 0) {
1031				  return;
1032					}
1033
1034				  $highlighted.trigger('mouseup');
1035				});
1036
1037				container.on('results:select', function () {
1038				  var $highlighted = self.getHighlightedResults();
1039
1040					if ($highlighted.length === 0) {
1041				  return;
1042					}
1043
1044				  var data = $highlighted.data('data');
1045
1046					if ($highlighted.attr('aria-selected') == 'true') {
1047			  self.trigger('close');
1048					} else {
1049			  self.trigger('select', {
1050							data: data
1051			  });
1052					}
1053				});
1054
1055				container.on('results:previous', function () {
1056				  var $highlighted = self.getHighlightedResults();
1057
1058				  var $options = self.$results.find('[aria-selected]');
1059
1060				  var currentIndex = $options.index($highlighted);
1061
1062				  // If we are already at te top, don't move further
1063					if (currentIndex === 0) {
1064				  return;
1065					}
1066
1067				  var nextIndex = currentIndex - 1;
1068
1069				  // If none are highlighted, highlight the first
1070					if ($highlighted.length === 0) {
1071			  nextIndex = 0;
1072					}
1073
1074			  var $next = $options.eq(nextIndex);
1075
1076			  $next.trigger('mouseenter');
1077
1078			  var currentOffset = self.$results.offset().top;
1079			  var nextTop       = $next.offset().top;
1080			  var nextOffset    = self.$results.scrollTop() + (nextTop - currentOffset);
1081
1082					if (nextIndex === 0) {
1083						self.$results.scrollTop(0);
1084					} else if (nextTop - currentOffset < 0) {
1085		  self.$results.scrollTop(nextOffset);
1086					}
1087				});
1088
1089				container.on('results:next', function () {
1090				  var $highlighted = self.getHighlightedResults();
1091
1092				  var $options = self.$results.find('[aria-selected]');
1093
1094				  var currentIndex = $options.index($highlighted);
1095
1096				  var nextIndex = currentIndex + 1;
1097
1098				  // If we are at the last option, stay there
1099					if (nextIndex >= $options.length) {
1100				  return;
1101					}
1102
1103				  var $next = $options.eq(nextIndex);
1104
1105				  $next.trigger('mouseenter');
1106
1107				  var currentOffset = self.$results.offset().top +
1108				self.$results.outerHeight(false);
1109				  var nextBottom    = $next.offset().top + $next.outerHeight(false);
1110				  var nextOffset    = self.$results.scrollTop() + nextBottom - currentOffset;
1111
1112					if (nextIndex === 0) {
1113			  self.$results.scrollTop(0);
1114					} else if (nextBottom > currentOffset) {
1115			  self.$results.scrollTop(nextOffset);
1116					}
1117				});
1118
1119				container.on('results:focus', function (params) {
1120				  params.element.addClass('select2-results__option--highlighted');
1121				});
1122
1123				container.on('results:message', function (params) {
1124				  self.displayMessage(params);
1125				});
1126
1127				if ($.fn.mousewheel) {
1128				  this.$results.on('mousewheel', function (e) {
1129						var top = self.$results.scrollTop();
1130
1131						var bottom = (
1132						self.$results.get(0).scrollHeight -
1133						self.$results.scrollTop() +
1134						e.deltaY
1135						);
1136
1137						var isAtTop    = e.deltaY > 0 && top - e.deltaY <= 0;
1138						var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1139
1140						if (isAtTop) {
1141							self.$results.scrollTop(0);
1142
1143							e.preventDefault();
1144							e.stopPropagation();
1145						} else if (isAtBottom) {
1146						  self.$results.scrollTop(
1147							self.$results.get(0).scrollHeight - self.$results.height()
1148						  );
1149
1150						  e.preventDefault();
1151						  e.stopPropagation();
1152						}
1153					});
1154				}
1155
1156				this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1157				function (evt) {
1158			var $this = $(this);
1159
1160			var data = $this.data('data');
1161
1162					if ($this.attr('aria-selected') === 'true') {
1163						if (self.options.get('multiple')) {
1164				self.trigger('unselect', {
1165								originalEvent: evt,
1166								data: data
1167				});
1168						} else {
1169			  self.trigger('close');
1170						}
1171
1172				return;
1173					}
1174
1175			self.trigger('select', {
1176						originalEvent: evt,
1177						data: data
1178			});
1179				});
1180
1181				this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1182				function (evt) {
1183			var data = $(this).data('data');
1184
1185			self.getHighlightedResults()
1186				.removeClass('select2-results__option--highlighted');
1187
1188			self.trigger('results:focus', {
1189						data: data,
1190						element: $(this)
1191			});
1192				});
1193			};
1194
1195		  Results.prototype.getHighlightedResults = function () {
1196				var $highlighted = this.$results
1197				.find('.select2-results__option--highlighted');
1198
1199				return $highlighted;
1200			};
1201
1202		  Results.prototype.destroy = function () {
1203				this.$results.remove();
1204			};
1205
1206		  Results.prototype.ensureHighlightVisible = function () {
1207				var $highlighted = this.getHighlightedResults();
1208
1209				if ($highlighted.length === 0) {
1210				  return;
1211				}
1212
1213				var $options = this.$results.find('[aria-selected]');
1214
1215				var currentIndex = $options.index($highlighted);
1216
1217				var currentOffset = this.$results.offset().top;
1218				var nextTop       = $highlighted.offset().top;
1219				var nextOffset    = this.$results.scrollTop() + (nextTop - currentOffset);
1220
1221				var offsetDelta = nextTop - currentOffset;
1222				nextOffset     -= $highlighted.outerHeight(false) * 2;
1223
1224				if (currentIndex <= 2) {
1225				  this.$results.scrollTop(0);
1226				} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1227				  this.$results.scrollTop(nextOffset);
1228				}
1229			};
1230
1231		  Results.prototype.template = function (result, container) {
1232				var template     = this.options.get('templateResult');
1233				var escapeMarkup = this.options.get('escapeMarkup');
1234
1235				var content = template(result);
1236
1237				if (content == null) {
1238				  container.style.display = 'none';
1239				} else if (typeof content === 'string') {
1240				  container.innerHTML = escapeMarkup(content);
1241				} else {
1242				  $(container).append(content);
1243					}
1244			};
1245
1246		  return Results;
1247		});
1248
1249		S2.define('select2/keys',[
1250
1251		], function () {
1252		  var KEYS = {
1253				BACKSPACE: 8,
1254				TAB: 9,
1255				ENTER: 13,
1256				SHIFT: 16,
1257				CTRL: 17,
1258				ALT: 18,
1259				ESC: 27,
1260				SPACE: 32,
1261				PAGE_UP: 33,
1262				PAGE_DOWN: 34,
1263				END: 35,
1264				HOME: 36,
1265				LEFT: 37,
1266				UP: 38,
1267				RIGHT: 39,
1268				DOWN: 40,
1269				DELETE: 46
1270			};
1271
1272		  return KEYS;
1273		});
1274
1275		S2.define('select2/selection/base',[
1276		  'jquery',
1277		  '../utils',
1278		  '../keys'
1279		], function ($, Utils, KEYS) {
1280			function BaseSelection ($element, options) {
1281		  this.$element = $element;
1282		  this.options  = options;
1283
1284		  BaseSelection.__super__.constructor.call(this);
1285			}
1286
1287		  Utils.Extend(BaseSelection, Utils.Observable);
1288
1289		  BaseSelection.prototype.render = function () {
1290				var $selection = $(
1291				'<span class="select2-selection" role="combobox" ' +
1292				'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
1293				'</span>'
1294				);
1295
1296				this._tabindex = 0;
1297
1298				if (this.$element.data('old-tabindex') != null) {
1299				  this._tabindex = this.$element.data('old-tabindex');
1300				} else if (this.$element.attr('tabindex') != null) {
1301				  this._tabindex = this.$element.attr('tabindex');
1302				}
1303
1304				$selection.attr('title', this.$element.attr('title'));
1305				$selection.attr('tabindex', this._tabindex);
1306
1307				this.$selection = $selection;
1308
1309				return $selection;
1310			};
1311
1312		  BaseSelection.prototype.bind = function (container, $container) {
1313				var self = this;
1314
1315				var id        = container.id + '-container';
1316				var resultsId = container.id + '-results';
1317
1318				this.container = container;
1319
1320				this.$selection.on('focus', function (evt) {
1321				  self.trigger('focus', evt);
1322				});
1323
1324				this.$selection.on('blur', function (evt) {
1325				  self.trigger('blur', evt);
1326				});
1327
1328				this.$selection.on('keydown', function (evt) {
1329				  self.trigger('keypress', evt);
1330
1331					if (evt.which === KEYS.SPACE) {
1332				  evt.preventDefault();
1333					}
1334				});
1335
1336				container.on('results:focus', function (params) {
1337				  self.$selection.attr('aria-activedescendant', params.data._resultId);
1338				});
1339
1340				container.on('selection:update', function (params) {
1341				  self.update(params.data);
1342				});
1343
1344				container.on('open', function () {
1345				  // When the dropdown is open, aria-expanded="true"
1346				  self.$selection.attr('aria-expanded', 'true');
1347				  self.$selection.attr('aria-owns', resultsId);
1348
1349				  self._attachCloseHandler(container);
1350				});
1351
1352				container.on('close', function () {
1353				  // When the dropdown is closed, aria-expanded="false"
1354				  self.$selection.attr('aria-expanded', 'false');
1355				  self.$selection.removeAttr('aria-activedescendant');
1356				  self.$selection.removeAttr('aria-owns');
1357
1358				  self.$selection.focus();
1359
1360				  self._detachCloseHandler(container);
1361				});
1362
1363				container.on('enable', function () {
1364				  self.$selection.attr('tabindex', self._tabindex);
1365				});
1366
1367				container.on('disable', function () {
1368				  self.$selection.attr('tabindex', '-1');
1369				});
1370			};
1371
1372		  BaseSelection.prototype._attachCloseHandler = function (container) {
1373				var self = this;
1374
1375				$(document.body).on('mousedown.select2.' + container.id, function (e) {
1376				  var $target = $(e.target);
1377
1378				  var $select = $target.closest('.select2');
1379
1380				  var $all = $('.select2.select2-container--open');
1381
1382				  $all.each(function () {
1383						var $this = $(this);
1384
1385						if (this == $select[0]) {
1386								return;
1387							}
1388
1389						var $element = $this.data('element');
1390
1391						$element.select2('close');
1392					});
1393				});
1394			};
1395
1396		  BaseSelection.prototype._detachCloseHandler = function (container) {
1397				$(document.body).off('mousedown.select2.' + container.id);
1398			};
1399
1400		  BaseSelection.prototype.position = function ($selection, $container) {
1401				var $selectionContainer = $container.find('.selection');
1402				$selectionContainer.append($selection);
1403			};
1404
1405		  BaseSelection.prototype.destroy = function () {
1406				this._detachCloseHandler(this.container);
1407			};
1408
1409		  BaseSelection.prototype.update = function (data) {
1410				throw new Error('The `update` method must be defined in child classes.');
1411			};
1412
1413		  return BaseSelection;
1414		});
1415
1416		S2.define('select2/selection/single',[
1417		  'jquery',
1418		  './base',
1419		  '../utils',
1420		  '../keys'
1421		], function ($, BaseSelection, Utils, KEYS) {
1422			function SingleSelection () {
1423		  SingleSelection.__super__.constructor.apply(this, arguments);
1424			}
1425
1426		  Utils.Extend(SingleSelection, BaseSelection);
1427
1428		  SingleSelection.prototype.render = function () {
1429				var $selection = SingleSelection.__super__.render.call(this);
1430
1431				$selection.addClass('select2-selection--single');
1432
1433				$selection.html(
1434				'<span class="select2-selection__rendered"></span>' +
1435				'<span class="select2-selection__arrow" role="presentation">' +
1436				'<b role="presentation"></b>' +
1437				'</span>'
1438				);
1439
1440				return $selection;
1441			};
1442
1443		  SingleSelection.prototype.bind = function (container, $container) {
1444				var self = this;
1445
1446				SingleSelection.__super__.bind.apply(this, arguments);
1447
1448				var id = container.id + '-container';
1449
1450				this.$selection.find('.select2-selection__rendered').attr('id', id);
1451				this.$selection.attr('aria-labelledby', id);
1452
1453				this.$selection.on('mousedown', function (evt) {
1454				  // Only respond to left clicks
1455					if (evt.which !== 1) {
1456				  return;
1457					}
1458
1459				  self.trigger('toggle', {
1460						originalEvent: evt
1461				  });
1462				});
1463
1464				this.$selection.on('focus', function (evt) {
1465				  // User focuses on the container
1466				});
1467
1468				this.$selection.on('blur', function (evt) {
1469				  // User exits the container
1470				});
1471
1472				container.on('selection:update', function (params) {
1473				  self.update(params.data);
1474				});
1475			};
1476
1477		  SingleSelection.prototype.clear = function () {
1478				this.$selection.find('.select2-selection__rendered').empty();
1479			};
1480
1481		  SingleSelection.prototype.display = function (data) {
1482				var template     = this.options.get('templateSelection');
1483				var escapeMarkup = this.options.get('escapeMarkup');
1484
1485				return escapeMarkup(template(data));
1486			};
1487
1488		  SingleSelection.prototype.selectionContainer = function () {
1489				return $('<span></span>');
1490			};
1491
1492		  SingleSelection.prototype.update = function (data) {
1493				if (data.length === 0) {
1494				  this.clear();
1495				  return;
1496				}
1497
1498				var selection = data[0];
1499
1500				var formatted = this.display(selection);
1501
1502				var $rendered = this.$selection.find('.select2-selection__rendered');
1503				$rendered.empty().append(formatted);
1504				$rendered.prop('title', selection.title || selection.text);
1505			};
1506
1507		  return SingleSelection;
1508		});
1509
1510		S2.define('select2/selection/multiple',[
1511		  'jquery',
1512		  './base',
1513		  '../utils'
1514		], function ($, BaseSelection, Utils) {
1515			function MultipleSelection ($element, options) {
1516		  MultipleSelection.__super__.constructor.apply(this, arguments);
1517			}
1518
1519		  Utils.Extend(MultipleSelection, BaseSelection);
1520
1521		  MultipleSelection.prototype.render = function () {
1522				var $selection = MultipleSelection.__super__.render.call(this);
1523
1524				$selection.addClass('select2-selection--multiple');
1525
1526				$selection.html(
1527				'<ul class="select2-selection__rendered"></ul>'
1528				);
1529
1530				return $selection;
1531			};
1532
1533		  MultipleSelection.prototype.bind = function (container, $container) {
1534				var self = this;
1535
1536				MultipleSelection.__super__.bind.apply(this, arguments);
1537
1538				this.$selection.on('click', function (evt) {
1539				  self.trigger('toggle', {
1540						originalEvent: evt
1541				  });
1542				});
1543
1544				this.$selection.on('click', '.select2-selection__choice__remove',
1545				function (evt) {
1546			var $remove    = $(this);
1547			var $selection = $remove.parent();
1548
1549			var data = $selection.data('data');
1550
1551			self.trigger('unselect', {
1552						originalEvent: evt,
1553						data: data
1554			});
1555				});
1556			};
1557
1558		  MultipleSelection.prototype.clear = function () {
1559				this.$selection.find('.select2-selection__rendered').empty();
1560			};
1561
1562		  MultipleSelection.prototype.display = function (data) {
1563				var template     = this.options.get('templateSelection');
1564				var escapeMarkup = this.options.get('escapeMarkup');
1565
1566				return escapeMarkup(template(data));
1567			};
1568
1569		  MultipleSelection.prototype.selectionContainer = function () {
1570				var $container = $(
1571				'<li class="select2-selection__choice">' +
1572				'<span class="select2-selection__choice__remove" role="presentation">' +
1573				'&times;' +
1574				'</span>' +
1575				'</li>'
1576				);
1577
1578				return $container;
1579			};
1580
1581		  MultipleSelection.prototype.update = function (data) {
1582				this.clear();
1583
1584				if (data.length === 0) {
1585				  return;
1586				}
1587
1588				var $selections = [];
1589
1590				for (var d = 0; d < data.length; d++) {
1591				  var selection = data[d];
1592
1593				  var formatted  = this.display(selection);
1594				  var $selection = this.selectionContainer();
1595
1596				  $selection.append(formatted);
1597				  $selection.prop('title', selection.title || selection.text);
1598
1599				  $selection.data('data', selection);
1600
1601				  $selections.push($selection);
1602				}
1603
1604				var $rendered = this.$selection.find('.select2-selection__rendered');
1605
1606				Utils.appendMany($rendered, $selections);
1607			};
1608
1609		  return MultipleSelection;
1610		});
1611
1612		S2.define('select2/selection/placeholder',[
1613		  '../utils'
1614		], function (Utils) {
1615			function Placeholder (decorated, $element, options) {
1616		  this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1617
1618		  decorated.call(this, $element, options);
1619			}
1620
1621		  Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1622				if (typeof placeholder === 'string') {
1623				  placeholder = {
1624						id: '',
1625						text: placeholder
1626					};
1627				}
1628
1629				return placeholder;
1630			};
1631
1632		  Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1633				var $placeholder = this.selectionContainer();
1634
1635				$placeholder.html(this.display(placeholder));
1636				$placeholder.addClass('select2-selection__placeholder')
1637				.removeClass('select2-selection__choice');
1638
1639				return $placeholder;
1640			};
1641
1642		  Placeholder.prototype.update = function (decorated, data) {
1643				var singlePlaceholder  = (
1644				data.length == 1 && data[0].id != this.placeholder.id
1645				);
1646				var multipleSelections = data.length > 1;
1647
1648				if (multipleSelections || singlePlaceholder) {
1649				  return decorated.call(this, data);
1650				}
1651
1652				this.clear();
1653
1654				var $placeholder = this.createPlaceholder(this.placeholder);
1655
1656				this.$selection.find('.select2-selection__rendered').append($placeholder);
1657			};
1658
1659		  return Placeholder;
1660		});
1661
1662		S2.define('select2/selection/allowClear',[
1663		  'jquery',
1664		  '../keys'
1665		], function ($, KEYS) {
1666			function AllowClear () { }
1667
1668		  AllowClear.prototype.bind = function (decorated, container, $container) {
1669				var self = this;
1670
1671				decorated.call(this, container, $container);
1672
1673				if (this.placeholder == null) {
1674					if (this.options.get('debug') && window.console && console.error) {
1675				  console.error(
1676					'Select2: The `allowClear` option should be used in combination ' +
1677					'with the `placeholder` option.'
1678				  );
1679					}
1680				  }
1681
1682				this.$selection.on('mousedown', '.select2-selection__clear',
1683				function (evt) {
1684				  self._handleClear(evt);
1685				  });
1686
1687				container.on('keypress', function (evt) {
1688					self._handleKeyboardClear(evt, container);
1689				  });
1690			};
1691
1692		  AllowClear.prototype._handleClear = function (_, evt) {
1693				// Ignore the event if it is disabled
1694				if (this.options.get('disabled')) {
1695				  return;
1696				}
1697
1698				var $clear = this.$selection.find('.select2-selection__clear');
1699
1700				// Ignore the event if nothing has been selected
1701				if ($clear.length === 0) {
1702				  return;
1703				}
1704
1705				evt.stopPropagation();
1706
1707				var data = $clear.data('data');
1708
1709				for (var d = 0; d < data.length; d++) {
1710				  var unselectData = {
1711						data: data[d]
1712					};
1713
1714				  // Trigger the `unselect` event, so people can prevent it from being
1715				  // cleared.
1716				  this.trigger('unselect', unselectData);
1717
1718				  // If the event was prevented, don't clear it out.
1719					if (unselectData.prevented) {
1720					return;
1721					}
1722				}
1723
1724				this.$element.val(this.placeholder.id).trigger('change');
1725
1726				this.trigger('toggle');
1727			};
1728
1729		  AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1730				if (container.isOpen()) {
1731				  return;
1732				}
1733
1734				if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1735				  this._handleClear(evt);
1736				}
1737			};
1738
1739		  AllowClear.prototype.update = function (decorated, data) {
1740				decorated.call(this, data);
1741
1742				if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1743				data.length === 0) {
1744				  return;
1745				}
1746
1747				var $remove = $(
1748				'<span class="select2-selection__clear">' +
1749				'&times;' +
1750				'</span>'
1751				);
1752				$remove.data('data', data);
1753
1754				this.$selection.find('.select2-selection__rendered').prepend($remove);
1755			};
1756
1757		  return AllowClear;
1758		});
1759
1760		S2.define('select2/selection/search',[
1761		  'jquery',
1762		  '../utils',
1763		  '../keys'
1764		], function ($, Utils, KEYS) {
1765			function Search (decorated, $element, options) {
1766		  decorated.call(this, $element, options);
1767			}
1768
1769		  Search.prototype.render = function (decorated) {
1770				var $search = $(
1771				'<li class="select2-search select2-search--inline">' +
1772				'<input class="select2-search__field" type="search" tabindex="-1"' +
1773				' autocomplete="off" autocorrect="off" autocapitalize="off"' +
1774				' spellcheck="false" role="textbox" />' +
1775				'</li>'
1776				);
1777
1778				this.$searchContainer = $search;
1779				this.$search          = $search.find('input');
1780
1781				var $rendered = decorated.call(this);
1782
1783				return $rendered;
1784			};
1785
1786		  Search.prototype.bind = function (decorated, container, $container) {
1787				var self = this;
1788
1789				decorated.call(this, container, $container);
1790
1791				container.on('open', function () {
1792				  self.$search.attr('tabindex', 0);
1793
1794				  self.$search.focus();
1795				});
1796
1797				container.on('close', function () {
1798				  self.$search.attr('tabindex', -1);
1799
1800				  self.$search.val('');
1801				  self.$search.focus();
1802				});
1803
1804				container.on('enable', function () {
1805				  self.$search.prop('disabled', false);
1806				});
1807
1808				container.on('disable', function () {
1809				  self.$search.prop('disabled', true);
1810				});
1811
1812				this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1813				  self.trigger('focus', evt);
1814				});
1815
1816				this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1817				  self.trigger('blur', evt);
1818				});
1819
1820				this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1821				  evt.stopPropagation();
1822
1823				  self.trigger('keypress', evt);
1824
1825				  self._keyUpPrevented = evt.isDefaultPrevented();
1826
1827				  var key = evt.which;
1828
1829					if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1830				  var $previousChoice = self.$searchContainer
1831					.prev('.select2-selection__choice');
1832
1833						if ($previousChoice.length > 0) {
1834								var item = $previousChoice.data('data');
1835
1836								self.searchRemoveChoice(item);
1837
1838								evt.preventDefault();
1839						}
1840					}
1841				});
1842
1843				// Workaround for browsers which do not support the `input` event
1844				// This will prevent double-triggering of events for browsers which support
1845				// both the `keyup` and `input` events.
1846				this.$selection.on('input', '.select2-search--inline', function (evt) {
1847				  // Unbind the duplicated `keyup` event
1848				  self.$selection.off('keyup.search');
1849				});
1850
1851				this.$selection.on('keyup.search input', '.select2-search--inline',
1852				function (evt) {
1853			  self.handleSearch(evt);
1854				});
1855			};
1856
1857		  Search.prototype.createPlaceholder = function (decorated, placeholder) {
1858				this.$search.attr('placeholder', placeholder.text);
1859			};
1860
1861		  Search.prototype.update = function (decorated, data) {
1862				this.$search.attr('placeholder', '');
1863
1864				decorated.call(this, data);
1865
1866				this.$selection.find('.select2-selection__rendered')
1867				   .append(this.$searchContainer);
1868
1869				this.resizeSearch();
1870			};
1871
1872		  Search.prototype.handleSearch = function () {
1873				this.resizeSearch();
1874
1875				if (!this._keyUpPrevented) {
1876				  var input = this.$search.val();
1877
1878				  this.trigger('query', {
1879						term: input
1880				  });
1881				}
1882
1883				this._keyUpPrevented = false;
1884			};
1885
1886		  Search.prototype.searchRemoveChoice = function (decorated, item) {
1887				this.trigger('unselect', {
1888					data: item
1889					});
1890
1891				this.trigger('open');
1892
1893				this.$search.val(item.text + ' ');
1894			};
1895
1896		  Search.prototype.resizeSearch = function () {
1897				this.$search.css('width', '25px');
1898
1899				var width = '';
1900
1901				if (this.$search.attr('placeholder') !== '') {
1902				  width = this.$selection.find('.select2-selection__rendered').innerWidth();
1903				} else {
1904				  var minimumWidth = this.$search.val().length + 1;
1905
1906				  width = (minimumWidth * 0.75) + 'em';
1907				}
1908
1909				this.$search.css('width', width);
1910			};
1911
1912		  return Search;
1913		});
1914
1915		S2.define('select2/selection/eventRelay',[
1916		  'jquery'
1917		], function ($) {
1918			function EventRelay () { }
1919
1920		  EventRelay.prototype.bind = function (decorated, container, $container) {
1921				var self        = this;
1922				var relayEvents = [
1923				'open', 'opening',
1924				'close', 'closing',
1925				'select', 'selecting',
1926				'unselect', 'unselecting'
1927				];
1928
1929				var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
1930
1931				decorated.call(this, container, $container);
1932
1933				container.on('*', function (name, params) {
1934					// Ignore events that should not be relayed
1935					if ($.inArray(name, relayEvents) === -1) {
1936				  return;
1937					}
1938
1939				  // The parameters should always be an object
1940				  params = params || {};
1941
1942				  // Generate the jQuery event for the Select2 event
1943				  var evt = $.Event('select2:' + name, {
1944						params: params
1945						});
1946
1947					self.$element.trigger(evt);
1948
1949					// Only handle preventable events if it was one
1950					if ($.inArray(name, preventableEvents) === -1) {
1951				  return;
1952					}
1953
1954				  params.prevented = evt.isDefaultPrevented();
1955				  });
1956			};
1957
1958		  return EventRelay;
1959		});
1960
1961		S2.define('select2/translation',[
1962		  'jquery',
1963		  'require'
1964		], function ($, require) {
1965			function Translation (dict) {
1966		  this.dict = dict || {};
1967			}
1968
1969		  Translation.prototype.all = function () {
1970				return this.dict;
1971			};
1972
1973		  Translation.prototype.get = function (key) {
1974				return this.dict[key];
1975			};
1976
1977		  Translation.prototype.extend = function (translation) {
1978				this.dict = $.extend({}, translation.all(), this.dict);
1979			};
1980
1981		  // Static functions
1982
1983		  Translation._cache = {};
1984
1985		  Translation.loadPath = function (path) {
1986				if (!(path in Translation._cache)) {
1987				  var translations = require(path);
1988
1989				  Translation._cache[path] = translations;
1990				}
1991
1992				return new Translation(Translation._cache[path]);
1993			};
1994
1995		  return Translation;
1996		});
1997
1998		S2.define('select2/diacritics',[
1999
2000		], function () {
2001		  var diacritics = {
2002				'\u24B6': 'A',
2003				'\uFF21': 'A',
2004				'\u00C0': 'A',
2005				'\u00C1': 'A',
2006				'\u00C2': 'A',
2007				'\u1EA6': 'A',
2008				'\u1EA4': 'A',
2009				'\u1EAA': 'A',
2010				'\u1EA8': 'A',
2011				'\u00C3': 'A',
2012				'\u0100': 'A',
2013				'\u0102': 'A',
2014				'\u1EB0': 'A',
2015				'\u1EAE': 'A',
2016				'\u1EB4': 'A',
2017				'\u1EB2': 'A',
2018				'\u0226': 'A',
2019				'\u01E0': 'A',
2020				'\u00C4': 'A',
2021				'\u01DE': 'A',
2022				'\u1EA2': 'A',
2023				'\u00C5': 'A',
2024				'\u01FA': 'A',
2025				'\u01CD': 'A',
2026				'\u0200': 'A',
2027				'\u0202': 'A',
2028				'\u1EA0': 'A',
2029				'\u1EAC': 'A',
2030				'\u1EB6': 'A',
2031				'\u1E00': 'A',
2032				'\u0104': 'A',
2033				'\u023A': 'A',
2034				'\u2C6F': 'A',
2035				'\uA732': 'AA',
2036				'\u00C6': 'AE',
2037				'\u01FC': 'AE',
2038				'\u01E2': 'AE',
2039				'\uA734': 'AO',
2040				'\uA736': 'AU',
2041				'\uA738': 'AV',
2042				'\uA73A': 'AV',
2043				'\uA73C': 'AY',
2044				'\u24B7': 'B',
2045				'\uFF22': 'B',
2046				'\u1E02': 'B',
2047				'\u1E04': 'B',
2048				'\u1E06': 'B',
2049				'\u0243': 'B',
2050				'\u0182': 'B',
2051				'\u0181': 'B',
2052				'\u24B8': 'C',
2053				'\uFF23': 'C',
2054				'\u0106': 'C',
2055				'\u0108': 'C',
2056				'\u010A': 'C',
2057				'\u010C': 'C',
2058				'\u00C7': 'C',
2059				'\u1E08': 'C',
2060				'\u0187': 'C',
2061				'\u023B': 'C',
2062				'\uA73E': 'C',
2063				'\u24B9': 'D',
2064				'\uFF24': 'D',
2065				'\u1E0A': 'D',
2066				'\u010E': 'D',
2067				'\u1E0C': 'D',
2068				'\u1E10': 'D',
2069				'\u1E12': 'D',
2070				'\u1E0E': 'D',
2071				'\u0110': 'D',
2072				'\u018B': 'D',
2073				'\u018A': 'D',
2074				'\u0189': 'D',
2075				'\uA779': 'D',
2076				'\u01F1': 'DZ',
2077				'\u01C4': 'DZ',
2078				'\u01F2': 'Dz',
2079				'\u01C5': 'Dz',
2080				'\u24BA': 'E',
2081				'\uFF25': 'E',
2082				'\u00C8': 'E',
2083				'\u00C9': 'E',
2084				'\u00CA': 'E',
2085				'\u1EC0': 'E',
2086				'\u1EBE': 'E',
2087				'\u1EC4': 'E',
2088				'\u1EC2': 'E',
2089				'\u1EBC': 'E',
2090				'\u0112': 'E',
2091				'\u1E14': 'E',
2092				'\u1E16': 'E',
2093				'\u0114': 'E',
2094				'\u0116': 'E',
2095				'\u00CB': 'E',
2096				'\u1EBA': 'E',
2097				'\u011A': 'E',
2098				'\u0204': 'E',
2099				'\u0206': 'E',
2100				'\u1EB8': 'E',
2101				'\u1EC6': 'E',
2102				'\u0228': 'E',
2103				'\u1E1C': 'E',
2104				'\u0118': 'E',
2105				'\u1E18': 'E',
2106				'\u1E1A': 'E',
2107				'\u0190': 'E',
2108				'\u018E': 'E',
2109				'\u24BB': 'F',
2110				'\uFF26': 'F',
2111				'\u1E1E': 'F',
2112				'\u0191': 'F',
2113				'\uA77B': 'F',
2114				'\u24BC': 'G',
2115				'\uFF27': 'G',
2116				'\u01F4': 'G',
2117				'\u011C': 'G',
2118				'\u1E20': 'G',
2119				'\u011E': 'G',
2120				'\u0120': 'G',
2121				'\u01E6': 'G',
2122				'\u0122': 'G',
2123				'\u01E4': 'G',
2124				'\u0193': 'G',
2125				'\uA7A0': 'G',
2126				'\uA77D': 'G',
2127				'\uA77E': 'G',
2128				'\u24BD': 'H',
2129				'\uFF28': 'H',
2130				'\u0124': 'H',
2131				'\u1E22': 'H',
2132				'\u1E26': 'H',
2133				'\u021E': 'H',
2134				'\u1E24': 'H',
2135				'\u1E28': 'H',
2136				'\u1E2A': 'H',
2137				'\u0126': 'H',
2138				'\u2C67': 'H',
2139				'\u2C75': 'H',
2140				'\uA78D': 'H',
2141				'\u24BE': 'I',
2142				'\uFF29': 'I',
2143				'\u00CC': 'I',
2144				'\u00CD': 'I',
2145				'\u00CE': 'I',
2146				'\u0128': 'I',
2147				'\u012A': 'I',
2148				'\u012C': 'I',
2149				'\u0130': 'I',
2150				'\u00CF': 'I',
2151				'\u1E2E': 'I',
2152				'\u1EC8': 'I',
2153				'\u01CF': 'I',
2154				'\u0208': 'I',
2155				'\u020A': 'I',
2156				'\u1ECA': 'I',
2157				'\u012E': 'I',
2158				'\u1E2C': 'I',
2159				'\u0197': 'I',
2160				'\u24BF': 'J',
2161				'\uFF2A': 'J',
2162				'\u0134': 'J',
2163				'\u0248': 'J',
2164				'\u24C0': 'K',
2165				'\uFF2B': 'K',
2166				'\u1E30': 'K',
2167				'\u01E8': 'K',
2168				'\u1E32': 'K',
2169				'\u0136': 'K',
2170				'\u1E34': 'K',
2171				'\u0198': 'K',
2172				'\u2C69': 'K',
2173				'\uA740': 'K',
2174				'\uA742': 'K',
2175				'\uA744': 'K',
2176				'\uA7A2': 'K',
2177				'\u24C1': 'L',
2178				'\uFF2C': 'L',
2179				'\u013F': 'L',
2180				'\u0139': 'L',
2181				'\u013D': 'L',
2182				'\u1E36': 'L',
2183				'\u1E38': 'L',
2184				'\u013B': 'L',
2185				'\u1E3C': 'L',
2186				'\u1E3A': 'L',
2187				'\u0141': 'L',
2188				'\u023D': 'L',
2189				'\u2C62': 'L',
2190				'\u2C60': 'L',
2191				'\uA748': 'L',
2192				'\uA746': 'L',
2193				'\uA780': 'L',
2194				'\u01C7': 'LJ',
2195				'\u01C8': 'Lj',
2196				'\u24C2': 'M',
2197				'\uFF2D': 'M',
2198				'\u1E3E': 'M',
2199				'\u1E40': 'M',
2200				'\u1E42': 'M',
2201				'\u2C6E': 'M',
2202				'\u019C': 'M',
2203				'\u24C3': 'N',
2204				'\uFF2E': 'N',
2205				'\u01F8': 'N',
2206				'\u0143': 'N',
2207				'\u00D1': 'N',
2208				'\u1E44': 'N',
2209				'\u0147': 'N',
2210				'\u1E46': 'N',
2211				'\u0145': 'N',
2212				'\u1E4A': 'N',
2213				'\u1E48': 'N',
2214				'\u0220': 'N',
2215				'\u019D': 'N',
2216				'\uA790': 'N',
2217				'\uA7A4': 'N',
2218				'\u01CA': 'NJ',
2219				'\u01CB': 'Nj',
2220				'\u24C4': 'O',
2221				'\uFF2F': 'O',
2222				'\u00D2': 'O',
2223				'\u00D3': 'O',
2224				'\u00D4': 'O',
2225				'\u1ED2': 'O',
2226				'\u1ED0': 'O',
2227				'\u1ED6': 'O',
2228				'\u1ED4': 'O',
2229				'\u00D5': 'O',
2230				'\u1E4C': 'O',
2231				'\u022C': 'O',
2232				'\u1E4E': 'O',
2233				'\u014C': 'O',
2234				'\u1E50': 'O',
2235				'\u1E52': 'O',
2236				'\u014E': 'O',
2237				'\u022E': 'O',
2238				'\u0230': 'O',
2239				'\u00D6': 'O',
2240				'\u022A': 'O',
2241				'\u1ECE': 'O',
2242				'\u0150': 'O',
2243				'\u01D1': 'O',
2244				'\u020C': 'O',
2245				'\u020E': 'O',
2246				'\u01A0': 'O',
2247				'\u1EDC': 'O',
2248				'\u1EDA': 'O',
2249				'\u1EE0': 'O',
2250				'\u1EDE': 'O',
2251				'\u1EE2': 'O',
2252				'\u1ECC': 'O',
2253				'\u1ED8': 'O',
2254				'\u01EA': 'O',
2255				'\u01EC': 'O',
2256				'\u00D8': 'O',
2257				'\u01FE': 'O',
2258				'\u0186': 'O',
2259				'\u019F': 'O',
2260				'\uA74A': 'O',
2261				'\uA74C': 'O',
2262				'\u01A2': 'OI',
2263				'\uA74E': 'OO',
2264				'\u0222': 'OU',
2265				'\u24C5': 'P',
2266				'\uFF30': 'P',
2267				'\u1E54': 'P',
2268				'\u1E56': 'P',
2269				'\u01A4': 'P',
2270				'\u2C63': 'P',
2271				'\uA750': 'P',
2272				'\uA752': 'P',
2273				'\uA754': 'P',
2274				'\u24C6': 'Q',
2275				'\uFF31': 'Q',
2276				'\uA756': 'Q',
2277				'\uA758': 'Q',
2278				'\u024A': 'Q',
2279				'\u24C7': 'R',
2280				'\uFF32': 'R',
2281				'\u0154': 'R',
2282				'\u1E58': 'R',
2283				'\u0158': 'R',
2284				'\u0210': 'R',
2285				'\u0212': 'R',
2286				'\u1E5A': 'R',
2287				'\u1E5C': 'R',
2288				'\u0156': 'R',
2289				'\u1E5E': 'R',
2290				'\u024C': 'R',
2291				'\u2C64': 'R',
2292				'\uA75A': 'R',
2293				'\uA7A6': 'R',
2294				'\uA782': 'R',
2295				'\u24C8': 'S',
2296				'\uFF33': 'S',
2297				'\u1E9E': 'S',
2298				'\u015A': 'S',
2299				'\u1E64': 'S',
2300				'\u015C': 'S',
2301				'\u1E60': 'S',
2302				'\u0160': 'S',
2303				'\u1E66': 'S',
2304				'\u1E62': 'S',
2305				'\u1E68': 'S',
2306				'\u0218': 'S',
2307				'\u015E': 'S',
2308				'\u2C7E': 'S',
2309				'\uA7A8': 'S',
2310				'\uA784': 'S',
2311				'\u24C9': 'T',
2312				'\uFF34': 'T',
2313				'\u1E6A': 'T',
2314				'\u0164': 'T',
2315				'\u1E6C': 'T',
2316				'\u021A': 'T',
2317				'\u0162': 'T',
2318				'\u1E70': 'T',
2319				'\u1E6E': 'T',
2320				'\u0166': 'T',
2321				'\u01AC': 'T',
2322				'\u01AE': 'T',
2323				'\u023E': 'T',
2324				'\uA786': 'T',
2325				'\uA728': 'TZ',
2326				'\u24CA': 'U',
2327				'\uFF35': 'U',
2328				'\u00D9': 'U',
2329				'\u00DA': 'U',
2330				'\u00DB': 'U',
2331				'\u0168': 'U',
2332				'\u1E78': 'U',
2333				'\u016A': 'U',
2334				'\u1E7A': 'U',
2335				'\u016C': 'U',
2336				'\u00DC': 'U',
2337				'\u01DB': 'U',
2338				'\u01D7': 'U',
2339				'\u01D5': 'U',
2340				'\u01D9': 'U',
2341				'\u1EE6': 'U',
2342				'\u016E': 'U',
2343				'\u0170': 'U',
2344				'\u01D3': 'U',
2345				'\u0214': 'U',
2346				'\u0216': 'U',
2347				'\u01AF': 'U',
2348				'\u1EEA': 'U',
2349				'\u1EE8': 'U',
2350				'\u1EEE': 'U',
2351				'\u1EEC': 'U',
2352				'\u1EF0': 'U',
2353				'\u1EE4': 'U',
2354				'\u1E72': 'U',
2355				'\u0172': 'U',
2356				'\u1E76': 'U',
2357				'\u1E74': 'U',
2358				'\u0244': 'U',
2359				'\u24CB': 'V',
2360				'\uFF36': 'V',
2361				'\u1E7C': 'V',
2362				'\u1E7E': 'V',
2363				'\u01B2': 'V',
2364				'\uA75E': 'V',
2365				'\u0245': 'V',
2366				'\uA760': 'VY',
2367				'\u24CC': 'W',
2368				'\uFF37': 'W',
2369				'\u1E80': 'W',
2370				'\u1E82': 'W',
2371				'\u0174': 'W',
2372				'\u1E86': 'W',
2373				'\u1E84': 'W',
2374				'\u1E88': 'W',
2375				'\u2C72': 'W',
2376				'\u24CD': 'X',
2377				'\uFF38': 'X',
2378				'\u1E8A': 'X',
2379				'\u1E8C': 'X',
2380				'\u24CE': 'Y',
2381				'\uFF39': 'Y',
2382				'\u1EF2': 'Y',
2383				'\u00DD': 'Y',
2384				'\u0176': 'Y',
2385				'\u1EF8': 'Y',
2386				'\u0232': 'Y',
2387				'\u1E8E': 'Y',
2388				'\u0178': 'Y',
2389				'\u1EF6': 'Y',
2390				'\u1EF4': 'Y',
2391				'\u01B3': 'Y',
2392				'\u024E': 'Y',
2393				'\u1EFE': 'Y',
2394				'\u24CF': 'Z',
2395				'\uFF3A': 'Z',
2396				'\u0179': 'Z',
2397				'\u1E90': 'Z',
2398				'\u017B': 'Z',
2399				'\u017D': 'Z',
2400				'\u1E92': 'Z',
2401				'\u1E94': 'Z',
2402				'\u01B5': 'Z',
2403				'\u0224': 'Z',
2404				'\u2C7F': 'Z',
2405				'\u2C6B': 'Z',
2406				'\uA762': 'Z',
2407				'\u24D0': 'a',
2408				'\uFF41': 'a',
2409				'\u1E9A': 'a',
2410				'\u00E0': 'a',
2411				'\u00E1': 'a',
2412				'\u00E2': 'a',
2413				'\u1EA7': 'a',
2414				'\u1EA5': 'a',
2415				'\u1EAB': 'a',
2416				'\u1EA9': 'a',
2417				'\u00E3': 'a',
2418				'\u0101': 'a',
2419				'\u0103': 'a',
2420				'\u1EB1': 'a',
2421				'\u1EAF': 'a',
2422				'\u1EB5': 'a',
2423				'\u1EB3': 'a',
2424				'\u0227': 'a',
2425				'\u01E1': 'a',
2426				'\u00E4': 'a',
2427				'\u01DF': 'a',
2428				'\u1EA3': 'a',
2429				'\u00E5': 'a',
2430				'\u01FB': 'a',
2431				'\u01CE': 'a',
2432				'\u0201': 'a',
2433				'\u0203': 'a',
2434				'\u1EA1': 'a',
2435				'\u1EAD': 'a',
2436				'\u1EB7': 'a',
2437				'\u1E01': 'a',
2438				'\u0105': 'a',
2439				'\u2C65': 'a',
2440				'\u0250': 'a',
2441				'\uA733': 'aa',
2442				'\u00E6': 'ae',
2443				'\u01FD': 'ae',
2444				'\u01E3': 'ae',
2445				'\uA735': 'ao',
2446				'\uA737': 'au',
2447				'\uA739': 'av',
2448				'\uA73B': 'av',
2449				'\uA73D': 'ay',
2450				'\u24D1': 'b',
2451				'\uFF42': 'b',
2452				'\u1E03': 'b',
2453				'\u1E05': 'b',
2454				'\u1E07': 'b',
2455				'\u0180': 'b',
2456				'\u0183': 'b',
2457				'\u0253': 'b',
2458				'\u24D2': 'c',
2459				'\uFF43': 'c',
2460				'\u0107': 'c',
2461				'\u0109': 'c',
2462				'\u010B': 'c',
2463				'\u010D': 'c',
2464				'\u00E7': 'c',
2465				'\u1E09': 'c',
2466				'\u0188': 'c',
2467				'\u023C': 'c',
2468				'\uA73F': 'c',
2469				'\u2184': 'c',
2470				'\u24D3': 'd',
2471				'\uFF44': 'd',
2472				'\u1E0B': 'd',
2473				'\u010F': 'd',
2474				'\u1E0D': 'd',
2475				'\u1E11': 'd',
2476				'\u1E13': 'd',
2477				'\u1E0F': 'd',
2478				'\u0111': 'd',
2479				'\u018C': 'd',
2480				'\u0256': 'd',
2481				'\u0257': 'd',
2482				'\uA77A': 'd',
2483				'\u01F3': 'dz',
2484				'\u01C6': 'dz',
2485				'\u24D4': 'e',
2486				'\uFF45': 'e',
2487				'\u00E8': 'e',
2488				'\u00E9': 'e',
2489				'\u00EA': 'e',
2490				'\u1EC1': 'e',
2491				'\u1EBF': 'e',
2492				'\u1EC5': 'e',
2493				'\u1EC3': 'e',
2494				'\u1EBD': 'e',
2495				'\u0113': 'e',
2496				'\u1E15': 'e',
2497				'\u1E17': 'e',
2498				'\u0115': 'e',
2499				'\u0117': 'e',
2500				'\u00EB': 'e',
2501				'\u1EBB': 'e',
2502				'\u011B': 'e',
2503				'\u0205': 'e',
2504				'\u0207': 'e',
2505				'\u1EB9': 'e',
2506				'\u1EC7': 'e',
2507				'\u0229': 'e',
2508				'\u1E1D': 'e',
2509				'\u0119': 'e',
2510				'\u1E19': 'e',
2511				'\u1E1B': 'e',
2512				'\u0247': 'e',
2513				'\u025B': 'e',
2514				'\u01DD': 'e',
2515				'\u24D5': 'f',
2516				'\uFF46': 'f',
2517				'\u1E1F': 'f',
2518				'\u0192': 'f',
2519				'\uA77C': 'f',
2520				'\u24D6': 'g',
2521				'\uFF47': 'g',
2522				'\u01F5': 'g',
2523				'\u011D': 'g',
2524				'\u1E21': 'g',
2525				'\u011F': 'g',
2526				'\u0121': 'g',
2527				'\u01E7': 'g',
2528				'\u0123': 'g',
2529				'\u01E5': 'g',
2530				'\u0260': 'g',
2531				'\uA7A1': 'g',
2532				'\u1D79': 'g',
2533				'\uA77F': 'g',
2534				'\u24D7': 'h',
2535				'\uFF48': 'h',
2536				'\u0125': 'h',
2537				'\u1E23': 'h',
2538				'\u1E27': 'h',
2539				'\u021F': 'h',
2540				'\u1E25': 'h',
2541				'\u1E29': 'h',
2542				'\u1E2B': 'h',
2543				'\u1E96': 'h',
2544				'\u0127': 'h',
2545				'\u2C68': 'h',
2546				'\u2C76': 'h',
2547				'\u0265': 'h',
2548				'\u0195': 'hv',
2549				'\u24D8': 'i',
2550				'\uFF49': 'i',
2551				'\u00EC': 'i',
2552				'\u00ED': 'i',
2553				'\u00EE': 'i',
2554				'\u0129': 'i',
2555				'\u012B': 'i',
2556				'\u012D': 'i',
2557				'\u00EF': 'i',
2558				'\u1E2F': 'i',
2559				'\u1EC9': 'i',
2560				'\u01D0': 'i',
2561				'\u0209': 'i',
2562				'\u020B': 'i',
2563				'\u1ECB': 'i',
2564				'\u012F': 'i',
2565				'\u1E2D': 'i',
2566				'\u0268': 'i',
2567				'\u0131': 'i',
2568				'\u24D9': 'j',
2569				'\uFF4A': 'j',
2570				'\u0135': 'j',
2571				'\u01F0': 'j',
2572				'\u0249': 'j',
2573				'\u24DA': 'k',
2574				'\uFF4B': 'k',
2575				'\u1E31': 'k',
2576				'\u01E9': 'k',
2577				'\u1E33': 'k',
2578				'\u0137': 'k',
2579				'\u1E35': 'k',
2580				'\u0199': 'k',
2581				'\u2C6A': 'k',
2582				'\uA741': 'k',
2583				'\uA743': 'k',
2584				'\uA745': 'k',
2585				'\uA7A3': 'k',
2586				'\u24DB': 'l',
2587				'\uFF4C': 'l',
2588				'\u0140': 'l',
2589				'\u013A': 'l',
2590				'\u013E': 'l',
2591				'\u1E37': 'l',
2592				'\u1E39': 'l',
2593				'\u013C': 'l',
2594				'\u1E3D': 'l',
2595				'\u1E3B': 'l',
2596				'\u017F': 'l',
2597				'\u0142': 'l',
2598				'\u019A': 'l',
2599				'\u026B': 'l',
2600				'\u2C61': 'l',
2601				'\uA749': 'l',
2602				'\uA781': 'l',
2603				'\uA747': 'l',
2604				'\u01C9': 'lj',
2605				'\u24DC': 'm',
2606				'\uFF4D': 'm',
2607				'\u1E3F': 'm',
2608				'\u1E41': 'm',
2609				'\u1E43': 'm',
2610				'\u0271': 'm',
2611				'\u026F': 'm',
2612				'\u24DD': 'n',
2613				'\uFF4E': 'n',
vendor: 6,110 bytes, lines 2614-2912
2614				'\u01F9': 'n',
2615				'\u0144': 'n',
2616				'\u00F1': 'n',
2617				'\u1E45': 'n',
2618				'\u0148': 'n',
2619				'\u1E47': 'n',
2620				'\u0146': 'n',
2621				'\u1E4B': 'n',
2622				'\u1E49': 'n',
2623				'\u019E': 'n',
2624				'\u0272': 'n',
2625				'\u0149': 'n',
2626				'\uA791': 'n',
2627				'\uA7A5': 'n',
2628				'\u01CC': 'nj',
2629				'\u24DE': 'o',
2630				'\uFF4F': 'o',
2631				'\u00F2': 'o',
2632				'\u00F3': 'o',
2633				'\u00F4': 'o',
2634				'\u1ED3': 'o',
2635				'\u1ED1': 'o',
2636				'\u1ED7': 'o',
2637				'\u1ED5': 'o',
2638				'\u00F5': 'o',
2639				'\u1E4D': 'o',
2640				'\u022D': 'o',
2641				'\u1E4F': 'o',
2642				'\u014D': 'o',
2643				'\u1E51': 'o',
2644				'\u1E53': 'o',
2645				'\u014F': 'o',
2646				'\u022F': 'o',
2647				'\u0231': 'o',
2648				'\u00F6': 'o',
2649				'\u022B': 'o',
2650				'\u1ECF': 'o',
2651				'\u0151': 'o',
2652				'\u01D2': 'o',
2653				'\u020D': 'o',
2654				'\u020F': 'o',
2655				'\u01A1': 'o',
2656				'\u1EDD': 'o',
2657				'\u1EDB': 'o',
2658				'\u1EE1': 'o',
2659				'\u1EDF': 'o',
2660				'\u1EE3': 'o',
2661				'\u1ECD': 'o',
2662				'\u1ED9': 'o',
2663				'\u01EB': 'o',
2664				'\u01ED': 'o',
2665				'\u00F8': 'o',
2666				'\u01FF': 'o',
2667				'\u0254': 'o',
2668				'\uA74B': 'o',
2669				'\uA74D': 'o',
2670				'\u0275': 'o',
2671				'\u01A3': 'oi',
2672				'\u0223': 'ou',
2673				'\uA74F': 'oo',
2674				'\u24DF': 'p',
2675				'\uFF50': 'p',
2676				'\u1E55': 'p',
2677				'\u1E57': 'p',
2678				'\u01A5': 'p',
2679				'\u1D7D': 'p',
2680				'\uA751': 'p',
2681				'\uA753': 'p',
2682				'\uA755': 'p',
2683				'\u24E0': 'q',
2684				'\uFF51': 'q',
2685				'\u024B': 'q',
2686				'\uA757': 'q',
2687				'\uA759': 'q',
2688				'\u24E1': 'r',
2689				'\uFF52': 'r',
2690				'\u0155': 'r',
2691				'\u1E59': 'r',
2692				'\u0159': 'r',
2693				'\u0211': 'r',
2694				'\u0213': 'r',
2695				'\u1E5B': 'r',
2696				'\u1E5D': 'r',
2697				'\u0157': 'r',
2698				'\u1E5F': 'r',
2699				'\u024D': 'r',
2700				'\u027D': 'r',
2701				'\uA75B': 'r',
2702				'\uA7A7': 'r',
2703				'\uA783': 'r',
2704				'\u24E2': 's',
2705				'\uFF53': 's',
2706				'\u00DF': 's',
2707				'\u015B': 's',
2708				'\u1E65': 's',
2709				'\u015D': 's',
2710				'\u1E61': 's',
2711				'\u0161': 's',
2712				'\u1E67': 's',
2713				'\u1E63': 's',
2714				'\u1E69': 's',
2715				'\u0219': 's',
2716				'\u015F': 's',
2717				'\u023F': 's',
2718				'\uA7A9': 's',
2719				'\uA785': 's',
2720				'\u1E9B': 's',
2721				'\u24E3': 't',
2722				'\uFF54': 't',
2723				'\u1E6B': 't',
2724				'\u1E97': 't',
2725				'\u0165': 't',
2726				'\u1E6D': 't',
2727				'\u021B': 't',
2728				'\u0163': 't',
2729				'\u1E71': 't',
2730				'\u1E6F': 't',
2731				'\u0167': 't',
2732				'\u01AD': 't',
2733				'\u0288': 't',
2734				'\u2C66': 't',
2735				'\uA787': 't',
2736				'\uA729': 'tz',
2737				'\u24E4': 'u',
2738				'\uFF55': 'u',
2739				'\u00F9': 'u',
2740				'\u00FA': 'u',
2741				'\u00FB': 'u',
2742				'\u0169': 'u',
2743				'\u1E79': 'u',
2744				'\u016B': 'u',
2745				'\u1E7B': 'u',
2746				'\u016D': 'u',
2747				'\u00FC': 'u',
2748				'\u01DC': 'u',
2749				'\u01D8': 'u',
2750				'\u01D6': 'u',
2751				'\u01DA': 'u',
2752				'\u1EE7': 'u',
2753				'\u016F': 'u',
2754				'\u0171': 'u',
2755				'\u01D4': 'u',
2756				'\u0215': 'u',
2757				'\u0217': 'u',
2758				'\u01B0': 'u',
2759				'\u1EEB': 'u',
2760				'\u1EE9': 'u',
2761				'\u1EEF': 'u',
2762				'\u1EED': 'u',
2763				'\u1EF1': 'u',
2764				'\u1EE5': 'u',
2765				'\u1E73': 'u',
2766				'\u0173': 'u',
2767				'\u1E77': 'u',
2768				'\u1E75': 'u',
2769				'\u0289': 'u',
2770				'\u24E5': 'v',
2771				'\uFF56': 'v',
2772				'\u1E7D': 'v',
2773				'\u1E7F': 'v',
2774				'\u028B': 'v',
2775				'\uA75F': 'v',
2776				'\u028C': 'v',
2777				'\uA761': 'vy',
2778				'\u24E6': 'w',
2779				'\uFF57': 'w',
2780				'\u1E81': 'w',
2781				'\u1E83': 'w',
2782				'\u0175': 'w',
2783				'\u1E87': 'w',
2784				'\u1E85': 'w',
2785				'\u1E98': 'w',
2786				'\u1E89': 'w',
2787				'\u2C73': 'w',
2788				'\u24E7': 'x',
2789				'\uFF58': 'x',
2790				'\u1E8B': 'x',
2791				'\u1E8D': 'x',
2792				'\u24E8': 'y',
2793				'\uFF59': 'y',
2794				'\u1EF3': 'y',
2795				'\u00FD': 'y',
2796				'\u0177': 'y',
2797				'\u1EF9': 'y',
2798				'\u0233': 'y',
2799				'\u1E8F': 'y',
2800				'\u00FF': 'y',
2801				'\u1EF7': 'y',
2802				'\u1E99': 'y',
2803				'\u1EF5': 'y',
2804				'\u01B4': 'y',
2805				'\u024F': 'y',
2806				'\u1EFF': 'y',
2807				'\u24E9': 'z',
2808				'\uFF5A': 'z',
2809				'\u017A': 'z',
2810				'\u1E91': 'z',
2811				'\u017C': 'z',
2812				'\u017E': 'z',
2813				'\u1E93': 'z',
2814				'\u1E95': 'z',
2815				'\u01B6': 'z',
2816				'\u0225': 'z',
2817				'\u0240': 'z',
2818				'\u2C6C': 'z',
2819				'\uA763': 'z',
2820				'\u0386': '\u0391',
2821				'\u0388': '\u0395',
2822				'\u0389': '\u0397',
2823				'\u038A': '\u0399',
2824				'\u03AA': '\u0399',
2825				'\u038C': '\u039F',
2826				'\u038E': '\u03A5',
2827				'\u03AB': '\u03A5',
2828				'\u038F': '\u03A9',
2829				'\u03AC': '\u03B1',
2830				'\u03AD': '\u03B5',
2831				'\u03AE': '\u03B7',
2832				'\u03AF': '\u03B9',
2833				'\u03CA': '\u03B9',
2834				'\u0390': '\u03B9',
2835				'\u03CC': '\u03BF',
2836				'\u03CD': '\u03C5',
2837				'\u03CB': '\u03C5',
2838				'\u03B0': '\u03C5',
2839				'\u03C9': '\u03C9',
2840				'\u03C2': '\u03C3'
2841			};
2842
2843		  return diacritics;
2844		});
2845
2846		S2.define('select2/data/base',[
2847		  '../utils'
2848		], function (Utils) {
2849			function BaseAdapter ($element, options) {
2850		  BaseAdapter.__super__.constructor.call(this);
2851			}
2852
2853		  Utils.Extend(BaseAdapter, Utils.Observable);
2854
2855		  BaseAdapter.prototype.current = function (callback) {
2856				throw new Error('The `current` method must be defined in child classes.');
2857			};
2858
2859		  BaseAdapter.prototype.query = function (params, callback) {
2860				throw new Error('The `query` method must be defined in child classes.');
2861			};
2862
2863		  BaseAdapter.prototype.bind = function (container, $container) {
2864				// Can be implemented in subclasses
2865			};
2866
2867		  BaseAdapter.prototype.destroy = function () {
2868				// Can be implemented in subclasses
2869			};
2870
2871		  BaseAdapter.prototype.generateResultId = function (container, data) {
2872				var id = container.id + '-result-';
2873
2874				id += Utils.generateChars(4);
2875
2876				if (data.id != null) {
2877				  id += '-' + data.id.toString();
2878				} else {
2879				  id += '-' + Utils.generateChars(4);
2880				}
2881				return id;
2882			};
2883
2884		  return BaseAdapter;
2885		});
2886
2887		S2.define('select2/data/select',[
2888		  './base',
2889		  '../utils',
2890		  'jquery'
2891		], function (BaseAdapter, Utils, $) {
2892			function SelectAdapter ($element, options) {
2893		  this.$element = $element;
2894		  this.options  = options;
2895
2896		  SelectAdapter.__super__.constructor.call(this);
2897			}
2898
2899		  Utils.Extend(SelectAdapter, BaseAdapter);
2900
2901		  SelectAdapter.prototype.current = function (callback) {
2902				var data = [];
2903				var self = this;
2904
2905				this.$element.find(':selected').each(function () {
2906				  var $option = $(this);
2907
2908				  var option = self.item($option);
2909
2910				  data.push(option);
2911				});
2912
vendor: 55,879 bytes, lines 2913-5229
2913				callback(data);
2914			};
2915
2916		  SelectAdapter.prototype.select = function (data) {
2917				var self = this;
2918
2919				data.selected = true;
2920
2921				// If data.element is a DOM node, use it instead
2922				if ($(data.element).is('option')) {
2923				  data.element.selected = true;
2924
2925				  this.$element.trigger('change');
2926
2927				  return;
2928				}
2929
2930				if (this.$element.prop('multiple')) {
2931				  this.current(function (currentData) {
2932						var val = [];
2933
2934						data = [data];
2935						data.push.apply(data, currentData);
2936
2937						for (var d = 0; d < data.length; d++) {
2938								var id = data[d].id;
2939
2940							if ($.inArray(id, val) === -1) {
2941					  val.push(id);
2942							}
2943							}
2944
2945						self.$element.val(val);
2946						self.$element.trigger('change');
2947					});
2948				} else {
2949				  var val = data.id;
2950
2951				  this.$element.val(val);
2952				  this.$element.trigger('change');
2953				}
2954			};
2955
2956		  SelectAdapter.prototype.unselect = function (data) {
2957				var self = this;
2958
2959				if (!this.$element.prop('multiple')) {
2960				  return;
2961				}
2962
2963				data.selected = false;
2964
2965				if ($(data.element).is('option')) {
2966				  data.element.selected = false;
2967
2968				  this.$element.trigger('change');
2969
2970				  return;
2971				}
2972
2973				this.current(function (currentData) {
2974				  var val = [];
2975
2976					for (var d = 0; d < currentData.length; d++) {
2977				  var id = currentData[d].id;
2978
2979						if (id !== data.id && $.inArray(id, val) === -1) {
2980								val.push(id);
2981						}
2982					}
2983
2984				  self.$element.val(val);
2985
2986				  self.$element.trigger('change');
2987				});
2988			};
2989
2990		  SelectAdapter.prototype.bind = function (container, $container) {
2991				var self = this;
2992
2993				this.container = container;
2994
2995				container.on('select', function (params) {
2996				  self.select(params.data);
2997				});
2998
2999				container.on('unselect', function (params) {
3000				  self.unselect(params.data);
3001				});
3002			};
3003
3004		  SelectAdapter.prototype.destroy = function () {
3005				// Remove anything added to child elements
3006				this.$element.find('*').each(function () {
3007				  // Remove any custom data set by Select2
3008				  $.removeData(this, 'data');
3009				});
3010			};
3011
3012		  SelectAdapter.prototype.query = function (params, callback) {
3013				var data = [];
3014				var self = this;
3015
3016				var $options = this.$element.children();
3017
3018				$options.each(function () {
3019				  var $option = $(this);
3020
3021					if (!$option.is('option') && !$option.is('optgroup')) {
3022				  return;
3023					}
3024
3025				  var option = self.item($option);
3026
3027				  var matches = self.matches(params, option);
3028
3029					if (matches !== null) {
3030			  data.push(matches);
3031					}
3032				});
3033
3034				callback({
3035					results: data
3036					});
3037			};
3038
3039		  SelectAdapter.prototype.addOptions = function ($options) {
3040				Utils.appendMany(this.$element, $options);
3041			};
3042
3043		  SelectAdapter.prototype.option = function (data) {
3044				var option;
3045
3046				if (data.children) {
3047				  option       = document.createElement('optgroup');
3048				  option.label = data.text;
3049				} else {
3050				  option = document.createElement('option');
3051
3052					if (option.textContent !== undefined) {
3053				  option.textContent = data.text;
3054					} else {
3055			  option.innerText = data.text;
3056					}
3057				}
3058
3059				if (data.id) {
3060					option.value = data.id;
3061				}
3062
3063				if (data.disabled) {
3064					option.disabled = true;
3065				}
3066
3067				if (data.selected) {
3068					option.selected = true;
3069				}
3070
3071				if (data.title) {
3072					option.title = data.title;
3073				}
3074
3075				var $option = $(option);
3076
3077				var normalizedData     = this._normalizeItem(data);
3078				normalizedData.element = option;
3079
3080				// Override the option's data with the combined data
3081				$.data(option, 'data', normalizedData);
3082
3083				return $option;
3084			};
3085
3086		  SelectAdapter.prototype.item = function ($option) {
3087				var data = {};
3088
3089				data = $.data($option[0], 'data');
3090
3091				if (data != null) {
3092				  return data;
3093				}
3094
3095				if ($option.is('option')) {
3096				  data = {
3097						id: $option.val(),
3098						text: $option.text(),
3099						disabled: $option.prop('disabled'),
3100						selected: $option.prop('selected'),
3101						title: $option.prop('title')
3102					};
3103				} else if ($option.is('optgroup')) {
3104				  data = {
3105						text: $option.prop('label'),
3106						children: [],
3107						title: $option.prop('title')
3108					};
3109
3110				  var $children = $option.children('option');
3111				  var children  = [];
3112
3113					for (var c = 0; c < $children.length; c++) {
3114					var $child = $($children[c]);
3115
3116					var child = this.item($child);
3117
3118					children.push(child);
3119					}
3120
3121				  data.children = children;
3122				}
3123
3124				data         = this._normalizeItem(data);
3125				data.element = $option[0];
3126
3127				$.data($option[0], 'data', data);
3128
3129				return data;
3130			};
3131
3132		  SelectAdapter.prototype._normalizeItem = function (item) {
3133				if (!$.isPlainObject(item)) {
3134				  item = {
3135						id: item,
3136						text: item
3137					};
3138				}
3139
3140				item = $.extend({}, {
3141					text: ''
3142					}, item);
3143
3144				var defaults = {
3145					selected: false,
3146					disabled: false
3147				};
3148
3149				if (item.id != null) {
3150				  item.id = item.id.toString();
3151				}
3152
3153				if (item.text != null) {
3154				  item.text = item.text.toString();
3155				}
3156
3157				if (item._resultId == null && item.id && this.container != null) {
3158				  item._resultId = this.generateResultId(this.container, item);
3159				}
3160
3161				return $.extend({}, defaults, item);
3162			};
3163
3164		  SelectAdapter.prototype.matches = function (params, data) {
3165				var matcher = this.options.get('matcher');
3166
3167				return matcher(params, data);
3168			};
3169
3170		  return SelectAdapter;
3171		});
3172
3173		S2.define('select2/data/array',[
3174		  './select',
3175		  '../utils',
3176		  'jquery'
3177		], function (SelectAdapter, Utils, $) {
3178			function ArrayAdapter ($element, options) {
3179		  var data = options.get('data') || [];
3180
3181		  ArrayAdapter.__super__.constructor.call(this, $element, options);
3182
3183		  this.addOptions(this.convertToOptions(data));
3184			}
3185
3186		  Utils.Extend(ArrayAdapter, SelectAdapter);
3187
3188		  ArrayAdapter.prototype.select = function (data) {
3189				var $option = this.$element.find('option').filter(function (i, elm) {
3190				  return elm.value == data.id.toString();
3191				});
3192
3193				if ($option.length === 0) {
3194				  $option = this.option(data);
3195
3196				  this.addOptions($option);
3197				}
3198
3199				ArrayAdapter.__super__.select.call(this, data);
3200			};
3201
3202		  ArrayAdapter.prototype.convertToOptions = function (data) {
3203				var self = this;
3204
3205				var $existing   = this.$element.find('option');
3206				var existingIds = $existing.map(function () {
3207				  return self.item($(this)).id;
3208				}).get();
3209
3210				var $options = [];
3211
3212				// Filter out all items except for the one passed in the argument
3213				function onlyItem (item) {
3214				  return function () {
3215						return $(this).val() == item.id;
3216					};
3217				}
3218
3219				for (var d = 0; d < data.length; d++) {
3220				  var item = this._normalizeItem(data[d]);
3221
3222				  // Skip items which were pre-loaded, only merge the data
3223					if ($.inArray(item.id, existingIds) >= 0) {
3224				  var $existingOption = $existing.filter(onlyItem(item));
3225
3226				  var existingData = this.item($existingOption);
3227				  var newData      = $.extend(true, {}, existingData, item);
3228
3229				  var $newOption = this.option(existingData);
3230
3231				  $existingOption.replaceWith($newOption);
3232
3233				  continue;
3234					}
3235
3236				  var $option = this.option(item);
3237
3238					if (item.children) {
3239			  var $children = this.convertToOptions(item.children);
3240
3241			  Utils.appendMany($option, $children);
3242					}
3243
3244			  $options.push($option);
3245				}
3246
3247				return $options;
3248			};
3249
3250		  return ArrayAdapter;
3251		});
3252
3253		S2.define('select2/data/ajax',[
3254		  './array',
3255		  '../utils',
3256		  'jquery'
3257		], function (ArrayAdapter, Utils, $) {
3258			function AjaxAdapter ($element, options) {
3259		  this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3260
3261				if (this.ajaxOptions.processResults != null) {
3262					this.processResults = this.ajaxOptions.processResults;
3263				}
3264
3265		  ArrayAdapter.__super__.constructor.call(this, $element, options);
3266			}
3267
3268		  Utils.Extend(AjaxAdapter, ArrayAdapter);
3269
3270		  AjaxAdapter.prototype._applyDefaults = function (options) {
3271				var defaults = {
3272					data: function (params) {
3273					return {
3274							q: params.term
3275						};
3276					},
3277					transport: function (params, success, failure) {
3278			  var $request = $.ajax(params);
3279
3280			  $request.then(success);
3281			  $request.fail(failure);
3282
3283			  return $request;
3284					}
3285				};
3286
3287				return $.extend({}, defaults, options, true);
3288			};
3289
3290		  AjaxAdapter.prototype.processResults = function (results) {
3291				return results;
3292			};
3293
3294		  AjaxAdapter.prototype.query = function (params, callback) {
3295				var matches = [];
3296				var self    = this;
3297
3298				if (this._request != null) {
3299				  // JSONP requests cannot always be aborted
3300					if ($.isFunction(this._request.abort)) {
3301					this._request.abort();
3302					}
3303
3304				  this._request = null;
3305				}
3306
3307				var options = $.extend({
3308					type: 'GET'
3309					}, this.ajaxOptions);
3310
3311				if (typeof options.url === 'function') {
3312				  options.url = options.url(params);
3313				}
3314
3315				if (typeof options.data === 'function') {
3316				  options.data = options.data(params);
3317				}
3318
3319				function request () {
3320				  var $request = options.transport(options, function (data) {
3321						var results = self.processResults(data, params);
3322
3323						if (self.options.get('debug') && window.console && console.error) {
3324								// Check to make sure that the response included a `results` key.
3325							if (!results || !results.results || !$.isArray(results.results)) {
3326					  console.error(
3327						'Select2: The AJAX results did not return an array in the ' +
3328						'`results` key of the response.'
3329					  );
3330							}
3331							}
3332
3333						callback(results);
3334					}, function () {
3335			// TODO: Handle AJAX errors
3336					});
3337
3338				self._request = $request;
3339					}
3340
3341				if (this.ajaxOptions.delay && params.term !== '') {
3342					if (this._queryTimeout) {
3343					window.clearTimeout(this._queryTimeout);
3344					}
3345
3346				  this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3347					} else {
3348				  request();
3349					}
3350			};
3351
3352		  return AjaxAdapter;
3353			});
3354
3355		S2.define('select2/data/tags',[
3356		  'jquery'
3357		], function ($) {
3358			function Tags (decorated, $element, options) {
3359		  var tags = options.get('tags');
3360
3361		  var createTag = options.get('createTag');
3362
3363				if (createTag !== undefined) {
3364					this.createTag = createTag;
3365				}
3366
3367		  decorated.call(this, $element, options);
3368
3369				if ($.isArray(tags)) {
3370					for (var t = 0; t < tags.length; t++) {
3371			  var tag  = tags[t];
3372			  var item = this._normalizeItem(tag);
3373
3374			  var $option = this.option(item);
3375
3376			  this.$element.append($option);
3377					}
3378				}
3379			}
3380
3381		  Tags.prototype.query = function (decorated, params, callback) {
3382				var self = this;
3383
3384				this._removeOldTags();
3385
3386				if (params.term == null || params.page != null) {
3387				  decorated.call(this, params, callback);
3388				  return;
3389					}
3390
3391				function wrapper (obj, child) {
3392				  var data = obj.results;
3393
3394					for (var i = 0; i < data.length; i++) {
3395				  var option = data[i];
3396
3397				  var checkChildren = (
3398					option.children != null &&
3399					!wrapper({
3400							results: option.children
3401					}, true)
3402				  );
3403
3404				  var checkText = option.text === params.term;
3405
3406						if (checkText || checkChildren) {
3407							if (child) {
3408				return false;
3409							}
3410
3411									obj.data = data;
3412									callback(obj);
3413
3414									return;
3415						}
3416					}
3417
3418					if (child) {
3419			  return true;
3420					}
3421
3422			  var tag = self.createTag(params);
3423
3424					if (tag != null) {
3425						var $option = self.option(tag);
3426						$option.attr('data-select2-tag', true);
3427
3428						self.addOptions([$option]);
3429
3430						self.insertTag(data, tag);
3431					}
3432
3433			  obj.results = data;
3434
3435			  callback(obj);
3436					}
3437
3438				decorated.call(this, params, wrapper);
3439			};
3440
3441		  Tags.prototype.createTag = function (decorated, params) {
3442				var term = $.trim(params.term);
3443
3444				if (term === '') {
3445				  return null;
3446					}
3447
3448				return {
3449					id: term,
3450					text: term
3451					};
3452			};
3453
3454		  Tags.prototype.insertTag = function (_, data, tag) {
3455				data.unshift(tag);
3456			};
3457
3458		  Tags.prototype._removeOldTags = function (_) {
3459				var tag = this._lastTag;
3460
3461				var $options = this.$element.find('option[data-select2-tag]');
3462
3463				$options.each(function () {
3464					if (this.selected) {
3465				  return;
3466					}
3467
3468				  $(this).remove();
3469					});
3470			};
3471
3472		  return Tags;
3473			});
3474
3475		S2.define('select2/data/tokenizer',[
3476		  'jquery'
3477		], function ($) {
3478			function Tokenizer (decorated, $element, options) {
3479		  var tokenizer = options.get('tokenizer');
3480
3481				if (tokenizer !== undefined) {
3482					this.tokenizer = tokenizer;
3483				}
3484
3485		  decorated.call(this, $element, options);
3486			}
3487
3488		  Tokenizer.prototype.bind = function (decorated, container, $container) {
3489				decorated.call(this, container, $container);
3490
3491				this.$search =  container.dropdown.$search || container.selection.$search ||
3492				$container.find('.select2-search__field');
3493			};
3494
3495		  Tokenizer.prototype.query = function (decorated, params, callback) {
3496				var self = this;
3497
3498				function select (data) {
3499				  self.select(data);
3500					}
3501
3502				params.term = params.term || '';
3503
3504				var tokenData = this.tokenizer(params, this.options, select);
3505
3506				if (tokenData.term !== params.term) {
3507				  // Replace the search term if we have the search box
3508					if (this.$search.length) {
3509				  this.$search.val(tokenData.term);
3510				  this.$search.focus();
3511					}
3512
3513				  params.term = tokenData.term;
3514					}
3515
3516				decorated.call(this, params, callback);
3517			};
3518
3519		  Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3520				var separators = options.get('tokenSeparators') || [];
3521				var term       = params.term;
3522				var i          = 0;
3523
3524				var createTag = this.createTag || function (params) {
3525				  return {
3526						id: params.term,
3527						text: params.term
3528					};
3529					};
3530
3531				while (i < term.length) {
3532				  var termChar = term[i];
3533
3534					if ($.inArray(termChar, separators) === -1) {
3535					i++;
3536
3537					continue;
3538					}
3539
3540				  var part       = term.substr(0, i);
3541				  var partParams = $.extend({}, params, {
3542						term: part
3543				  });
3544
3545				  var data = createTag(partParams);
3546
3547				  callback(data);
3548
3549				  // Reset the term to not include the tokenized portion
3550				  term = term.substr(i + 1) || '';
3551				  i    = 0;
3552					}
3553
3554				return {
3555					term: term
3556					};
3557			};
3558
3559		  return Tokenizer;
3560			});
3561
3562		S2.define('select2/data/minimumInputLength',[
3563
3564		], function () {
3565			function MinimumInputLength (decorated, $e, options) {
3566		  this.minimumInputLength = options.get('minimumInputLength');
3567
3568		  decorated.call(this, $e, options);
3569			}
3570
3571		  MinimumInputLength.prototype.query = function (decorated, params, callback) {
3572				params.term = params.term || '';
3573
3574				if (params.term.length < this.minimumInputLength) {
3575				  this.trigger('results:message', {
3576						message: 'inputTooShort',
3577						args: {
3578							minimum: this.minimumInputLength,
3579							input: params.term,
3580							params: params
3581							}
3582				  });
3583
3584				  return;
3585					}
3586
3587				decorated.call(this, params, callback);
3588			};
3589
3590		  return MinimumInputLength;
3591			});
3592
3593		S2.define('select2/data/maximumInputLength',[
3594
3595		], function () {
3596			function MaximumInputLength (decorated, $e, options) {
3597		  this.maximumInputLength = options.get('maximumInputLength');
3598
3599		  decorated.call(this, $e, options);
3600			}
3601
3602		  MaximumInputLength.prototype.query = function (decorated, params, callback) {
3603				params.term = params.term || '';
3604
3605				if (this.maximumInputLength > 0 &&
3606				params.term.length > this.maximumInputLength) {
3607				  this.trigger('results:message', {
3608						message: 'inputTooLong',
3609						args: {
3610							maximum: this.maximumInputLength,
3611							input: params.term,
3612							params: params
3613							}
3614				  });
3615
3616				  return;
3617					}
3618
3619				decorated.call(this, params, callback);
3620			};
3621
3622		  return MaximumInputLength;
3623			});
3624
3625		S2.define('select2/data/maximumSelectionLength',[
3626
3627		], function (){
3628			function MaximumSelectionLength (decorated, $e, options) {
3629		  this.maximumSelectionLength = options.get('maximumSelectionLength');
3630
3631		  decorated.call(this, $e, options);
3632			}
3633
3634		  MaximumSelectionLength.prototype.query =
3635			function (decorated, params, callback) {
3636			  var self = this;
3637
3638			  this.current(function (currentData) {
3639					var count = currentData != null ? currentData.length : 0;
3640					if (self.maximumSelectionLength > 0 &&
3641					count >= self.maximumSelectionLength) {
3642						self.trigger('results:message', {
3643							message: 'maximumSelected',
3644							args: {
3645								maximum: self.maximumSelectionLength
3646							}
3647						});
3648						return;
3649					}
3650					decorated.call(self, params, callback);
3651				});
3652			};
3653
3654		  return MaximumSelectionLength;
3655			});
3656
3657		S2.define('select2/dropdown',[
3658		  'jquery',
3659		  './utils'
3660		], function ($, Utils) {
3661			function Dropdown ($element, options) {
3662		  this.$element = $element;
3663		  this.options  = options;
3664
3665		  Dropdown.__super__.constructor.call(this);
3666			}
3667
3668		  Utils.Extend(Dropdown, Utils.Observable);
3669
3670		  Dropdown.prototype.render = function () {
3671				var $dropdown = $(
3672				'<span class="select2-dropdown">' +
3673				'<span class="select2-results"></span>' +
3674				'</span>'
3675				);
3676
3677				$dropdown.attr('dir', this.options.get('dir'));
3678
3679				this.$dropdown = $dropdown;
3680
3681				return $dropdown;
3682			};
3683
3684		  Dropdown.prototype.position = function ($dropdown, $container) {
3685				// Should be implmented in subclasses
3686			};
3687
3688		  Dropdown.prototype.destroy = function () {
3689				// Remove the dropdown from the DOM
3690				this.$dropdown.remove();
3691			};
3692
3693		  return Dropdown;
3694			});
3695
3696		S2.define('select2/dropdown/search',[
3697		  'jquery',
3698		  '../utils'
3699		], function ($, Utils) {
3700			function Search () { }
3701
3702		  Search.prototype.render = function (decorated) {
3703				var $rendered = decorated.call(this);
3704
3705				var $search = $(
3706				'<span class="select2-search select2-search--dropdown">' +
3707				'<input class="select2-search__field" type="search" tabindex="-1"' +
3708				' autocomplete="off" autocorrect="off" autocapitalize="off"' +
3709				' spellcheck="false" role="textbox" />' +
3710				'</span>'
3711				);
3712
3713				this.$searchContainer = $search;
3714				this.$search          = $search.find('input');
3715
3716				$rendered.prepend($search);
3717
3718				return $rendered;
3719			};
3720
3721		  Search.prototype.bind = function (decorated, container, $container) {
3722				var self = this;
3723
3724				decorated.call(this, container, $container);
3725
3726				this.$search.on('keydown', function (evt) {
3727				  self.trigger('keypress', evt);
3728
3729				  self._keyUpPrevented = evt.isDefaultPrevented();
3730					});
3731
3732				// Workaround for browsers which do not support the `input` event
3733				// This will prevent double-triggering of events for browsers which support
3734				// both the `keyup` and `input` events.
3735				this.$search.on('input', function (evt) {
3736				  // Unbind the duplicated `keyup` event
3737				  $(this).off('keyup');
3738					});
3739
3740				this.$search.on('keyup input', function (evt) {
3741				  self.handleSearch(evt);
3742					});
3743
3744				container.on('open', function () {
3745				  self.$search.attr('tabindex', 0);
3746
3747				  self.$search.focus();
3748
3749				  window.setTimeout(function () {
3750						self.$search.focus();
3751					}, 0);
3752					});
3753
3754				container.on('close', function () {
3755				  self.$search.attr('tabindex', -1);
3756
3757				  self.$search.val('');
3758					});
3759
3760				container.on('results:all', function (params) {
3761					if (params.query.term == null || params.query.term === '') {
3762				  var showSearch = self.showSearch(params);
3763
3764						if (showSearch) {
3765								self.$searchContainer.removeClass('select2-search--hide');
3766						} else {
3767							  self.$searchContainer.addClass('select2-search--hide');
3768						}
3769					}
3770					});
3771			};
3772
3773		  Search.prototype.handleSearch = function (evt) {
3774				if (!this._keyUpPrevented) {
3775				  var input = this.$search.val();
3776
3777				  this.trigger('query', {
3778						term: input
3779				  });
3780					}
3781
3782				this._keyUpPrevented = false;
3783			};
3784
3785		  Search.prototype.showSearch = function (_, params) {
3786				return true;
3787			};
3788
3789		  return Search;
3790			});
3791
3792		S2.define('select2/dropdown/hidePlaceholder',[
3793
3794		], function () {
3795			function HidePlaceholder (decorated, $element, options, dataAdapter) {
3796		  this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
3797
3798		  decorated.call(this, $element, options, dataAdapter);
3799			}
3800
3801		  HidePlaceholder.prototype.append = function (decorated, data) {
3802				data.results = this.removePlaceholder(data.results);
3803
3804				decorated.call(this, data);
3805			};
3806
3807		  HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
3808				if (typeof placeholder === 'string') {
3809				  placeholder = {
3810						id: '',
3811						text: placeholder
3812					};
3813					}
3814
3815				return placeholder;
3816			};
3817
3818		  HidePlaceholder.prototype.removePlaceholder = function (_, data) {
3819				var modifiedData = data.slice(0);
3820
3821				for (var d = data.length - 1; d >= 0; d--) {
3822				  var item = data[d];
3823
3824					if (this.placeholder.id === item.id) {
3825					modifiedData.splice(d, 1);
3826					}
3827					}
3828
3829				return modifiedData;
3830			};
3831
3832		  return HidePlaceholder;
3833			});
3834
3835		S2.define('select2/dropdown/infiniteScroll',[
3836		  'jquery'
3837		], function ($) {
3838			function InfiniteScroll (decorated, $element, options, dataAdapter) {
3839		  this.lastParams = {};
3840
3841		  decorated.call(this, $element, options, dataAdapter);
3842
3843		  this.$loadingMore = this.createLoadingMore();
3844		  this.loading      = false;
3845			}
3846
3847		  InfiniteScroll.prototype.append = function (decorated, data) {
3848				this.$loadingMore.remove();
3849				this.loading = false;
3850
3851				decorated.call(this, data);
3852
3853				if (this.showLoadingMore(data)) {
3854				  this.$results.append(this.$loadingMore);
3855					}
3856			};
3857
3858		  InfiniteScroll.prototype.bind = function (decorated, container, $container) {
3859				var self = this;
3860
3861				decorated.call(this, container, $container);
3862
3863				container.on('query', function (params) {
3864				  self.lastParams = params;
3865				  self.loading    = true;
3866					});
3867
3868				container.on('query:append', function (params) {
3869				  self.lastParams = params;
3870				  self.loading    = true;
3871					});
3872
3873				this.$results.on('scroll', function () {
3874				  var isLoadMoreVisible = $.contains(
3875				  document.documentElement,
3876				  self.$loadingMore[0]
3877				  );
3878
3879					if (self.loading || !isLoadMoreVisible) {
3880				  return;
3881					}
3882
3883				  var currentOffset     = self.$results.offset().top +
3884				self.$results.outerHeight(false);
3885				  var loadingMoreOffset = self.$loadingMore.offset().top +
3886				self.$loadingMore.outerHeight(false);
3887
3888					if (currentOffset + 50 >= loadingMoreOffset) {
3889			  self.loadMore();
3890					}
3891					});
3892			};
3893
3894		  InfiniteScroll.prototype.loadMore = function () {
3895				this.loading = true;
3896
3897				var params = $.extend({}, {page: 1}, this.lastParams);
3898
3899				params.page++;
3900
3901				this.trigger('query:append', params);
3902			};
3903
3904		  InfiniteScroll.prototype.showLoadingMore = function (_, data) {
3905				return data.pagination && data.pagination.more;
3906			};
3907
3908		  InfiniteScroll.prototype.createLoadingMore = function () {
3909				var $option = $(
3910				'<li class="option load-more" role="treeitem"></li>'
3911				);
3912
3913				var message = this.options.get('translations').get('loadingMore');
3914
3915				$option.html(message(this.lastParams));
3916
3917				return $option;
3918			};
3919
3920		  return InfiniteScroll;
3921			});
3922
3923		S2.define('select2/dropdown/attachBody',[
3924		  'jquery',
3925		  '../utils'
3926		], function ($, Utils) {
3927			function AttachBody (decorated, $element, options) {
3928		  this.$dropdownParent = options.get('dropdownParent') || document.body;
3929
3930		  decorated.call(this, $element, options);
3931			}
3932
3933		  AttachBody.prototype.bind = function (decorated, container, $container) {
3934				var self = this;
3935
3936				var setupResultsEvents = false;
3937
3938				decorated.call(this, container, $container);
3939
3940				container.on('open', function () {
3941				  self._showDropdown();
3942				  self._attachPositioningHandler(container);
3943
3944					if (!setupResultsEvents) {
3945				  setupResultsEvents = true;
3946
3947				  container.on('results:all', function () {
3948							  self._positionDropdown();
3949							  self._resizeDropdown();
3950						});
3951
3952				  container.on('results:append', function () {
3953							self._positionDropdown();
3954							self._resizeDropdown();
3955						});
3956					}
3957					});
3958
3959				container.on('close', function () {
3960				  self._hideDropdown();
3961				  self._detachPositioningHandler(container);
3962					});
3963
3964				this.$dropdownContainer.on('mousedown', function (evt) {
3965				  evt.stopPropagation();
3966					});
3967			};
3968
3969		  AttachBody.prototype.position = function (decorated, $dropdown, $container) {
3970				// Clone all of the container classes
3971				$dropdown.attr('class', $container.attr('class'));
3972
3973				$dropdown.removeClass('select2');
3974				$dropdown.addClass('select2-container--open');
3975
3976				$dropdown.css({
3977					position: 'absolute',
3978					top: -999999
3979					});
3980
3981				this.$container = $container;
3982			};
3983
3984		  AttachBody.prototype.render = function (decorated) {
3985				var $container = $('<span></span>');
3986
3987				var $dropdown = decorated.call(this);
3988				$container.append($dropdown);
3989
3990				this.$dropdownContainer = $container;
3991
3992				return $container;
3993			};
3994
3995		  AttachBody.prototype._hideDropdown = function (decorated) {
3996				this.$dropdownContainer.detach();
3997			};
3998
3999		  AttachBody.prototype._attachPositioningHandler = function (container) {
4000				var self = this;
4001
4002				var scrollEvent      = 'scroll.select2.' + container.id;
4003				var resizeEvent      = 'resize.select2.' + container.id;
4004				var orientationEvent = 'orientationchange.select2.' + container.id;
4005
4006				var $watchers = this.$container.parents().filter(Utils.hasScroll);
4007				$watchers.each(function () {
4008				  $(this).data('select2-scroll-position', {
4009						x: $(this).scrollLeft(),
4010						y: $(this).scrollTop()
4011				  });
4012					});
4013
4014				$watchers.on(scrollEvent, function (ev) {
4015				  var position = $(this).data('select2-scroll-position');
4016				  $(this).scrollTop(position.y);
4017					});
4018
4019				$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4020				function (e) {
4021			self._positionDropdown();
4022			self._resizeDropdown();
4023					});
4024			};
4025
4026		  AttachBody.prototype._detachPositioningHandler = function (container) {
4027				var scrollEvent      = 'scroll.select2.' + container.id;
4028				var resizeEvent      = 'resize.select2.' + container.id;
4029				var orientationEvent = 'orientationchange.select2.' + container.id;
4030
4031				var $watchers = this.$container.parents().filter(Utils.hasScroll);
4032				$watchers.off(scrollEvent);
4033
4034				$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4035			};
4036
4037		  AttachBody.prototype._positionDropdown = function () {
4038				var $window = $(window);
4039
4040				var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4041				var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4042
4043				var newDirection = null;
4044
4045				var position = this.$container.position();
4046				var offset   = this.$container.offset();
4047
4048				offset.bottom = offset.top + this.$container.outerHeight(false);
4049
4050				var container = {
4051					height: this.$container.outerHeight(false)
4052					};
4053
4054				container.top    = offset.top;
4055				container.bottom = offset.top + container.height;
4056
4057				var dropdown = {
4058					height: this.$dropdown.outerHeight(false)
4059					};
4060
4061				var viewport = {
4062					top: $window.scrollTop(),
4063					bottom: $window.scrollTop() + $window.height()
4064					};
4065
4066				var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4067				var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4068
4069				var css = {
4070					left: offset.left,
4071					top: container.bottom
4072					};
4073
4074				if (!isCurrentlyAbove && !isCurrentlyBelow) {
4075				  newDirection = 'below';
4076					}
4077
4078				if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4079				  newDirection = 'above';
4080					} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4081				  newDirection = 'below';
4082					}
4083
4084			  if (newDirection == 'above' ||
4085				(isCurrentlyAbove && newDirection !== 'below')) {
4086					css.top = container.top - dropdown.height;
4087					}
4088
4089			  if (newDirection != null) {
4090				  this.$dropdown
4091				  .removeClass('select2-dropdown--below select2-dropdown--above')
4092				  .addClass('select2-dropdown--' + newDirection);
4093				  this.$container
4094				  .removeClass('select2-container--below select2-container--above')
4095				  .addClass('select2-container--' + newDirection);
4096			  }
4097
4098				this.$dropdownContainer.css(css);
4099			};
4100
4101		  AttachBody.prototype._resizeDropdown = function () {
4102				this.$dropdownContainer.width();
4103
4104				var css = {
4105					width: this.$container.outerWidth(false) + 'px'
4106					};
4107
4108				if (this.options.get('dropdownAutoWidth')) {
4109				  css.minWidth = css.width;
4110				  css.width    = 'auto';
4111					}
4112
4113				this.$dropdown.css(css);
4114			};
4115
4116		  AttachBody.prototype._showDropdown = function (decorated) {
4117				this.$dropdownContainer.appendTo(this.$dropdownParent);
4118
4119				this._positionDropdown();
4120				this._resizeDropdown();
4121			};
4122
4123		  return AttachBody;
4124			});
4125
4126		S2.define('select2/dropdown/minimumResultsForSearch',[
4127
4128		], function () {
4129			function countResults (data) {
4130		  var count = 0;
4131
4132				for (var d = 0; d < data.length; d++) {
4133					var item = data[d];
4134
4135					if (item.children) {
4136					count += countResults(item.children);
4137					} else {
4138				count++;
4139					}
4140				}
4141
4142		  return count;
4143			}
4144
4145			function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4146	  this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4147
4148				if (this.minimumResultsForSearch < 0) {
4149				  this.minimumResultsForSearch = Infinity;
4150				}
4151
4152	  decorated.call(this, $element, options, dataAdapter);
4153			}
4154
4155	  MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4156				if (countResults(params.data.results) < this.minimumResultsForSearch) {
4157			return false;
4158				}
4159
4160					return decorated.call(this, params);
4161			};
4162
4163		  return MinimumResultsForSearch;
4164			});
4165
4166		S2.define('select2/dropdown/selectOnClose',[
4167
4168		], function () {
4169			function SelectOnClose () { }
4170
4171		  SelectOnClose.prototype.bind = function (decorated, container, $container) {
4172				var self = this;
4173
4174				decorated.call(this, container, $container);
4175
4176				container.on('close', function () {
4177					self._handleSelectOnClose();
4178				});
4179			};
4180
4181		  SelectOnClose.prototype._handleSelectOnClose = function () {
4182				var $highlightedResults = this.getHighlightedResults();
4183
4184				if ($highlightedResults.length < 1) {
4185				  return;
4186					}
4187
4188				this.trigger('select', {
4189					data: $highlightedResults.data('data')
4190					});
4191			};
4192
4193		  return SelectOnClose;
4194			});
4195
4196		S2.define('select2/dropdown/closeOnSelect',[
4197
4198		], function () {
4199			function CloseOnSelect () { }
4200
4201		  CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4202				var self = this;
4203
4204				decorated.call(this, container, $container);
4205
4206				container.on('select', function (evt) {
4207					self._selectTriggered(evt);
4208				});
4209
4210				container.on('unselect', function (evt) {
4211					self._selectTriggered(evt);
4212				});
4213			};
4214
4215		  CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4216				var originalEvent = evt.originalEvent;
4217
4218				// Don't close if the control key is being held
4219				if (originalEvent && originalEvent.ctrlKey) {
4220				  return;
4221					}
4222
4223				this.trigger('close');
4224			};
4225
4226		  return CloseOnSelect;
4227			});
4228
4229		S2.define('select2/i18n/en',[],function () {
4230		  // English
4231		  return {
4232				errorLoading: function () {
4233					return 'The results could not be loaded.';
4234				},
4235				inputTooLong: function (args) {
4236					var overChars = args.input.length - args.maximum;
4237
4238					var message = 'Please delete ' + overChars + ' character';
4239
4240					if (overChars != 1) {
4241				  message += 's';
4242					}
4243
4244				  return message;
4245				},
4246				inputTooShort: function (args) {
4247					var remainingChars = args.minimum - args.input.length;
4248
4249					var message = 'Please enter ' + remainingChars + ' or more characters';
4250
4251					return message;
4252				},
4253				loadingMore: function () {
4254					return 'Loading more results…';
4255				},
4256				maximumSelected: function (args) {
4257					var message = 'You can only select ' + args.maximum + ' item';
4258
4259					if (args.maximum != 1) {
4260				  message += 's';
4261					}
4262
4263				  return message;
4264				},
4265				noResults: function () {
4266					return 'No results found';
4267				},
4268				searching: function () {
4269					return 'Searching…';
4270				}
4271			};
4272			});
4273
4274		S2.define('select2/defaults',[
4275		  'jquery',
4276		  'require',
4277
4278		  './results',
4279
4280		  './selection/single',
4281		  './selection/multiple',
4282		  './selection/placeholder',
4283		  './selection/allowClear',
4284		  './selection/search',
4285		  './selection/eventRelay',
4286
4287		  './utils',
4288		  './translation',
4289		  './diacritics',
4290
4291		  './data/select',
4292		  './data/array',
4293		  './data/ajax',
4294		  './data/tags',
4295		  './data/tokenizer',
4296		  './data/minimumInputLength',
4297		  './data/maximumInputLength',
4298		  './data/maximumSelectionLength',
4299
4300		  './dropdown',
4301		  './dropdown/search',
4302		  './dropdown/hidePlaceholder',
4303		  './dropdown/infiniteScroll',
4304		  './dropdown/attachBody',
4305		  './dropdown/minimumResultsForSearch',
4306		  './dropdown/selectOnClose',
4307		  './dropdown/closeOnSelect',
4308
4309		  './i18n/en'
4310		], function ($, require,
4311
4312			 ResultsList,
4313
4314			 SingleSelection, MultipleSelection, Placeholder, AllowClear,
4315			 SelectionSearch, EventRelay,
4316
4317			 Utils, Translation, DIACRITICS,
4318
4319			 SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4320			 MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4321
4322			 Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4323			 AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4324
4325			 EnglishTranslation) {
4326			function Defaults () {
4327		  this.reset();
4328			}
4329
4330		  Defaults.prototype.apply = function (options) {
4331				options = $.extend({}, this.defaults, options);
4332
4333				if (options.dataAdapter == null) {
4334					if (options.ajax != null) {
4335					options.dataAdapter = AjaxData;
4336					} else if (options.data != null) {
4337			  options.dataAdapter = ArrayData;
4338					} else {
4339			  options.dataAdapter = SelectData;
4340					}
4341
4342					if (options.minimumInputLength > 0) {
4343						options.dataAdapter = Utils.Decorate(
4344							options.dataAdapter,
4345							MinimumInputLength
4346									);
4347					}
4348
4349					if (options.maximumInputLength > 0) {
4350								options.dataAdapter = Utils.Decorate(
4351						options.dataAdapter,
4352						MaximumInputLength
4353								);
4354					}
4355
4356					if (options.maximumSelectionLength > 0) {
4357							options.dataAdapter = Utils.Decorate(
4358								options.dataAdapter,
4359								MaximumSelectionLength
4360							);
4361					}
4362
4363					if (options.tags) {
4364						options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4365					}
4366
4367					if (options.tokenSeparators != null || options.tokenizer != null) {
4368					options.dataAdapter = Utils.Decorate(
4369						options.dataAdapter,
4370						Tokenizer
4371					);
4372					}
4373
4374					if (options.query != null) {
4375					var Query = require(options.amdBase + 'compat/query');
4376
4377					options.dataAdapter = Utils.Decorate(
4378						options.dataAdapter,
4379						Query
4380					);
4381					}
4382
4383					if (options.initSelection != null) {
4384					var InitSelection = require(options.amdBase + 'compat/initSelection');
4385
4386					options.dataAdapter = Utils.Decorate(
4387						options.dataAdapter,
4388						InitSelection
4389					);
4390					}
4391					}
4392
4393				if (options.resultsAdapter == null) {
4394				  options.resultsAdapter = ResultsList;
4395
4396					if (options.ajax != null) {
4397				  options.resultsAdapter = Utils.Decorate(
4398					options.resultsAdapter,
4399					InfiniteScroll
4400				  );
4401					}
4402
4403					if (options.placeholder != null) {
4404			  options.resultsAdapter = Utils.Decorate(
4405				options.resultsAdapter,
4406				HidePlaceholder
4407			  );
4408					}
4409
4410					if (options.selectOnClose) {
4411						options.resultsAdapter = Utils.Decorate(
4412						options.resultsAdapter,
4413						SelectOnClose
4414							  );
4415					}
4416					}
4417
4418				if (options.dropdownAdapter == null) {
4419					if (options.multiple) {
4420				  options.dropdownAdapter = Dropdown;
4421					} else {
4422			  var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4423
4424			  options.dropdownAdapter = SearchableDropdown;
4425					}
4426
4427					if (options.minimumResultsForSearch !== 0) {
4428						options.dropdownAdapter = Utils.Decorate(
4429						options.dropdownAdapter,
4430						MinimumResultsForSearch
4431							  );
4432					}
4433
4434					if (options.closeOnSelect) {
4435							options.dropdownAdapter = Utils.Decorate(
4436							options.dropdownAdapter,
4437							CloseOnSelect
4438						  );
4439					}
4440
4441					if (
4442			options.dropdownCssClass != null ||
4443			options.dropdownCss != null ||
4444			options.adaptDropdownCssClass != null
4445				  ) {
4446						var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4447
4448						options.dropdownAdapter = Utils.Decorate(
4449						  options.dropdownAdapter,
4450						  DropdownCSS
4451						);
4452					}
4453
4454			options.dropdownAdapter = Utils.Decorate(
4455			options.dropdownAdapter,
4456			AttachBody
4457				  );
4458					}
4459
4460				if (options.selectionAdapter == null) {
4461					if (options.multiple) {
4462				  options.selectionAdapter = MultipleSelection;
4463					} else {
4464			  options.selectionAdapter = SingleSelection;
4465					}
4466
4467			  // Add the placeholder mixin if a placeholder was specified
4468					if (options.placeholder != null) {
4469						options.selectionAdapter = Utils.Decorate(
4470						options.selectionAdapter,
4471						Placeholder
4472							  );
4473					}
4474
4475					if (options.allowClear) {
4476							options.selectionAdapter = Utils.Decorate(
4477							options.selectionAdapter,
4478							AllowClear
4479						  );
4480					}
4481
4482					if (options.multiple) {
4483						options.selectionAdapter = Utils.Decorate(
4484						options.selectionAdapter,
4485						SelectionSearch
4486					  );
4487					}
4488
4489					if (
4490			options.containerCssClass != null ||
4491			options.containerCss != null ||
4492			options.adaptContainerCssClass != null
4493				  ) {
4494						var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4495
4496						options.selectionAdapter = Utils.Decorate(
4497						  options.selectionAdapter,
4498						  ContainerCSS
4499						);
4500					}
4501
4502			options.selectionAdapter = Utils.Decorate(
4503			options.selectionAdapter,
4504			EventRelay
4505				  );
4506					}
4507
4508				if (typeof options.language === 'string') {
4509				  // Check if the language is specified with a region
4510					if (options.language.indexOf('-') > 0) {
4511				  // Extract the region information if it is included
4512				  var languageParts = options.language.split('-');
4513				  var baseLanguage  = languageParts[0];
4514
4515				  options.language = [options.language, baseLanguage];
4516					} else {
4517			  options.language = [options.language];
4518					}
4519					}
4520
4521				if ($.isArray(options.language)) {
4522				  var languages = new Translation();
4523				  options.language.push('en');
4524
4525				  var languageNames = options.language;
4526
4527					for (var l = 0; l < languageNames.length; l++) {
4528				  var name     = languageNames[l];
4529				  var language = {};
4530
4531						try {
4532								// Try to load it with the original name
4533								language = Translation.loadPath(name);
4534						} catch (e) {
4535							try {
4536				  // If we couldn't load it, check if it wasn't the full path
4537				  name     = this.defaults.amdLanguageBase + name;
4538				  language = Translation.loadPath(name);
4539							} catch (ex) {
4540				// The translation could not be loaded at all. Sometimes this is
4541				// because of a configuration problem, other times this can be
4542				// because of how Select2 helps load all possible translation files.
4543								if (options.debug && window.console && console.warn) {
4544										  console.warn(
4545											'Select2: The language file for "' + name + '" could not be ' +
4546											'automatically loaded. A fallback will be used instead.'
4547												);
4548								}
4549
4550				continue;
4551							}
4552						}
4553
4554				  languages.extend(language);
4555					}
4556
4557				  options.translations = languages;
4558					} else {
4559				  var baseTranslation   = Translation.loadPath(
4560					this.defaults.amdLanguageBase + 'en'
4561				  );
4562				  var customTranslation = new Translation(options.language);
4563
4564				  customTranslation.extend(baseTranslation);
4565
4566				  options.translations = customTranslation;
4567					}
4568
4569				return options;
4570			};
4571
4572		  Defaults.prototype.reset = function () {
4573				function stripDiacritics (text) {
4574				  // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4575					function match(a) {
4576					return DIACRITICS[a] || a;
4577					}
4578
4579				  return text.replace(/[^\u0000-\u007E]/g, match);
4580					}
4581
4582				function matcher (params, data) {
4583				  // Always return the object if there is nothing to compare
4584					if ($.trim(params.term) === '') {
4585				  return data;
4586					}
4587
4588				  // Do a recursive check for options with children
4589					if (data.children && data.children.length > 0) {
4590			  // Clone the data object if there are children
4591			  // This is required as we modify the object to remove any non-matches
4592			  var match = $.extend(true, {}, data);
4593
4594			  // Check each child of the option
4595						for (var c = data.children.length - 1; c >= 0; c--) {
4596						  var child = data.children[c];
4597
4598						  var matches = matcher(params, child);
4599
4600						  // If there wasn't a match, remove the object in the array
4601							if (matches == null) {
4602								match.children.splice(c, 1);
4603							}
4604						}
4605
4606			  // If any children matched, return the new object
4607						if (match.children.length > 0) {
4608						  return match;
4609						}
4610
4611			  // If there were no matching children, check just the plain object
4612			  return matcher(params, match);
4613					}
4614
4615			  var original = stripDiacritics(data.text).toUpperCase();
4616			  var term     = stripDiacritics(params.term).toUpperCase();
4617
4618			  // Check if the text contains the term
4619					if (original.indexOf(term) > -1) {
4620						return data;
4621					}
4622
4623			  // If it doesn't contain the term, don't return anything
4624			  return null;
4625					}
4626
4627				this.defaults = {
4628					amdBase: './',
4629					amdLanguageBase: './i18n/',
4630					closeOnSelect: true,
4631					debug: false,
4632					dropdownAutoWidth: false,
4633					escapeMarkup: Utils.escapeMarkup,
4634					language: EnglishTranslation,
4635					matcher: matcher,
4636					minimumInputLength: 0,
4637					maximumInputLength: 0,
4638					maximumSelectionLength: 0,
4639					minimumResultsForSearch: 0,
4640					selectOnClose: false,
4641					sorter: function (data) {
4642					return data;
4643					},
4644					templateResult: function (result) {
4645			  return result.text;
4646					},
4647					templateSelection: function (selection) {
4648			  return selection.text;
4649					},
4650					theme: 'default',
4651					width: 'resolve'
4652					};
4653			};
4654
4655		  Defaults.prototype.set = function (key, value) {
4656				var camelKey = $.camelCase(key);
4657
4658				var data       = {};
4659				data[camelKey] = value;
4660
4661				var convertedData = Utils._convertData(data);
4662
4663				$.extend(this.defaults, convertedData);
4664			};
4665
4666		  var defaults = new Defaults();
4667
4668		  return defaults;
4669			});
4670
4671		S2.define('select2/options',[
4672		  'require',
4673		  'jquery',
4674		  './defaults',
4675		  './utils'
4676		], function (require, $, Defaults, Utils) {
4677			function Options (options, $element) {
4678		  this.options = options;
4679
4680				if ($element != null) {
4681					this.fromElement($element);
4682				}
4683
4684		  this.options = Defaults.apply(this.options);
4685
4686				if ($element && $element.is('input')) {
4687					var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4688
4689					this.options.dataAdapter = Utils.Decorate(
4690						this.options.dataAdapter,
4691						InputCompat
4692						  );
4693				}
4694			}
4695
4696		  Options.prototype.fromElement = function ($e) {
4697				var excludedData = ['select2'];
4698
4699				if (this.options.multiple == null) {
4700				  this.options.multiple = $e.prop('multiple');
4701					}
4702
4703				if (this.options.disabled == null) {
4704				  this.options.disabled = $e.prop('disabled');
4705					}
4706
4707				if (this.options.language == null) {
4708					if ($e.prop('lang')) {
4709				  this.options.language = $e.prop('lang').toLowerCase();
4710					} else if ($e.closest('[lang]').prop('lang')) {
4711			  this.options.language = $e.closest('[lang]').prop('lang');
4712					}
4713					}
4714
4715				if (this.options.dir == null) {
4716					if ($e.prop('dir')) {
4717				  this.options.dir = $e.prop('dir');
4718					} else if ($e.closest('[dir]').prop('dir')) {
4719			  this.options.dir = $e.closest('[dir]').prop('dir');
4720					} else {
4721			  this.options.dir = 'ltr';
4722					}
4723					}
4724
4725				$e.prop('disabled', this.options.disabled);
4726				$e.prop('multiple', this.options.multiple);
4727
4728				if ($e.data('select2Tags')) {
4729					if (this.options.debug && window.console && console.warn) {
4730				  console.warn(
4731					'Select2: The `data-select2-tags` attribute has been changed to ' +
4732					'use the `data-data` and `data-tags="true"` attributes and will be ' +
4733					'removed in future versions of Select2.'
4734				  );
4735					}
4736
4737				  $e.data('data', $e.data('select2Tags'));
4738				  $e.data('tags', true);
4739					}
4740
4741				if ($e.data('ajaxUrl')) {
4742					if (this.options.debug && window.console && console.warn) {
4743				  console.warn(
4744					'Select2: The `data-ajax-url` attribute has been changed to ' +
4745					'`data-ajax--url` and support for the old attribute will be removed' +
4746					' in future versions of Select2.'
4747				  );
4748					}
4749
4750				  $e.attr('ajax--url', $e.data('ajaxUrl'));
4751				  $e.data('ajax--url', $e.data('ajaxUrl'));
4752					}
4753
4754				var dataset = {};
4755
4756				// Prefer the element's `dataset` attribute if it exists
4757				// jQuery 1.x does not correctly handle data attributes with multiple dashes
4758				if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
4759				  dataset = $.extend(true, {}, $e[0].dataset, $e.data());
4760					} else {
4761				  dataset = $e.data();
4762					}
4763
4764				var data = $.extend(true, {}, dataset);
4765
4766				data = Utils._convertData(data);
4767
4768			  for (var key in data) {
4769				  if ($.inArray(key, excludedData) > -1) {
4770					  continue;
4771				  }
4772
4773				  if ($.isPlainObject(this.options[key])) {
4774					  $.extend(this.options[key], data[key]);
4775				  } else {
4776					  this.options[key] = data[key];
4777				  }
4778			  }
4779
4780				return this;
4781			};
4782
4783		  Options.prototype.get = function (key) {
4784				return this.options[key];
4785			};
4786
4787		  Options.prototype.set = function (key, val) {
4788				this.options[key] = val;
4789			};
4790
4791		  return Options;
4792			});
4793
4794		S2.define('select2/core',[
4795		  'jquery',
4796		  './options',
4797		  './utils',
4798		  './keys'
4799		], function ($, Options, Utils, KEYS) {
4800		  var Select2 = function ($element, options) {
4801				if ($element.data('select2') != null) {
4802					  $element.data('select2').destroy();
4803				}
4804
4805				this.$element = $element;
4806
4807				this.id = this._generateId($element);
4808
4809				options = options || {};
4810
4811				this.options = new Options(options, $element);
4812
4813				Select2.__super__.constructor.call(this);
4814
4815				// Set up the tabindex
4816
4817				var tabindex = $element.attr('tabindex') || 0;
4818				$element.data('old-tabindex', tabindex);
4819				$element.attr('tabindex', '-1');
4820
4821				// Set up containers and adapters
4822
4823				var DataAdapter  = this.options.get('dataAdapter');
4824				this.dataAdapter = new DataAdapter($element, this.options);
4825
4826				var $container = this.render();
4827
4828				this._placeContainer($container);
4829
4830				var SelectionAdapter = this.options.get('selectionAdapter');
4831				this.selection       = new SelectionAdapter($element, this.options);
4832				this.$selection      = this.selection.render();
4833
4834				this.selection.position(this.$selection, $container);
4835
4836				var DropdownAdapter = this.options.get('dropdownAdapter');
4837				this.dropdown       = new DropdownAdapter($element, this.options);
4838				this.$dropdown      = this.dropdown.render();
4839
4840				this.dropdown.position(this.$dropdown, $container);
4841
4842				var ResultsAdapter = this.options.get('resultsAdapter');
4843				this.results       = new ResultsAdapter($element, this.options, this.dataAdapter);
4844				this.$results      = this.results.render();
4845
4846				this.results.position(this.$results, this.$dropdown);
4847
4848				// Bind events
4849
4850				var self = this;
4851
4852				// Bind the container to all of the adapters
4853				this._bindAdapters();
4854
4855				// Register any DOM event handlers
4856				this._registerDomEvents();
4857
4858				// Register any internal event handlers
4859				this._registerDataEvents();
4860				this._registerSelectionEvents();
4861				this._registerDropdownEvents();
4862				this._registerResultsEvents();
4863				this._registerEvents();
4864
4865				// Set the initial state
4866				this.dataAdapter.current(function (initialData) {
4867				  self.trigger('selection:update', {
4868						data: initialData
4869					});
4870				});
4871
4872				// Hide the original select
4873				$element.addClass('select2-hidden-accessible');
4874				$element.attr('aria-hidden', 'true');
4875	
4876				// Synchronize any monitored attributes
4877				this._syncAttributes();
4878
4879				$element.data('select2', this);
4880			};
4881
4882		  Utils.Extend(Select2, Utils.Observable);
4883
4884		  Select2.prototype._generateId = function ($element) {
4885				var id = '';
4886
4887				if ($element.attr('id') != null) {
4888				  id = $element.attr('id');
4889					} else if ($element.attr('name') != null) {
4890				  id = $element.attr('name') + '-' + Utils.generateChars(2);
4891					} else {
4892				  id = Utils.generateChars(4);
4893				  }
4894
4895				id = 'select2-' + id;
4896
4897				return id;
4898			};
4899
4900		  Select2.prototype._placeContainer = function ($container) {
4901				$container.insertAfter(this.$element);
4902
4903				var width = this._resolveWidth(this.$element, this.options.get('width'));
4904
4905				if (width != null) {
4906				  $container.css('width', width);
4907					}
4908			};
4909
4910		  Select2.prototype._resolveWidth = function ($element, method) {
4911				var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
4912
4913				if (method == 'resolve') {
4914				  var styleWidth = this._resolveWidth($element, 'style');
4915
4916					if (styleWidth != null) {
4917					return styleWidth;
4918					}
4919
4920				  return this._resolveWidth($element, 'element');
4921					}
4922
4923				if (method == 'element') {
4924				  var elementWidth = $element.outerWidth(false);
4925
4926					if (elementWidth <= 0) {
4927				  return 'auto';
4928					}
4929
4930				  return elementWidth + 'px';
4931					}
4932
4933				if (method == 'style') {
4934				  var style = $element.attr('style');
4935
4936					if (typeof(style) !== 'string') {
4937				  return null;
4938					}
4939
4940				  var attrs = style.split(';');
4941
4942					for (var i = 0, l = attrs.length; i < l; i = i + 1) {
4943			  var attr    = attrs[i].replace(/\s/g, '');
4944			  var matches = attr.match(WIDTH);
4945
4946						if (matches !== null && matches.length >= 1) {
4947						  return matches[1];
4948						}
4949					}
4950
4951			  return null;
4952					}
4953
4954				return method;
4955			};
4956
4957		  Select2.prototype._bindAdapters = function () {
4958				this.dataAdapter.bind(this, this.$container);
4959				this.selection.bind(this, this.$container);
4960
4961				this.dropdown.bind(this, this.$container);
4962				this.results.bind(this, this.$container);
4963			};
4964
4965		  Select2.prototype._registerDomEvents = function () {
4966				var self = this;
4967
4968				this.$element.on('change.select2', function () {
4969				  self.dataAdapter.current(function (data) {
4970						self.trigger('selection:update', {
4971							data: data
4972							});
4973					});
4974					});
4975
4976				this._sync = Utils.bind(this._syncAttributes, this);
4977
4978				if (this.$element[0].attachEvent) {
4979				  this.$element[0].attachEvent('onpropertychange', this._sync);
4980					}
4981
4982				var observer = window.MutationObserver ||
4983				window.WebKitMutationObserver ||
4984				window.MozMutationObserver
4985				;
4986
4987				if (observer != null) {
4988				  this._observer = new observer(function (mutations) {
4989						$.each(mutations, self._sync);
4990					});
4991				  this._observer.observe(this.$element[0], {
4992						attributes: true,
4993						subtree: false
4994				  });
4995					} else if (this.$element[0].addEventListener) {
4996				  this.$element[0].addEventListener('DOMAttrModified', self._sync, false);
4997					}
4998			};
4999
5000		  Select2.prototype._registerDataEvents = function () {
5001				var self = this;
5002
5003				this.dataAdapter.on('*', function (name, params) {
5004				  self.trigger(name, params);
5005					});
5006			};
5007
5008		  Select2.prototype._registerSelectionEvents = function () {
5009				var self           = this;
5010				var nonRelayEvents = ['toggle'];
5011
5012				this.selection.on('toggle', function () {
5013				  self.toggleDropdown();
5014					});
5015
5016				this.selection.on('*', function (name, params) {
5017					if ($.inArray(name, nonRelayEvents) !== -1) {
5018				  return;
5019					}
5020
5021				  self.trigger(name, params);
5022					});
5023			};
5024
5025		  Select2.prototype._registerDropdownEvents = function () {
5026				var self = this;
5027
5028				this.dropdown.on('*', function (name, params) {
5029				  self.trigger(name, params);
5030					});
5031			};
5032
5033		  Select2.prototype._registerResultsEvents = function () {
5034				var self = this;
5035
5036				this.results.on('*', function (name, params) {
5037				  self.trigger(name, params);
5038					});
5039			};
5040
5041		  Select2.prototype._registerEvents = function () {
5042				var self = this;
5043
5044				this.on('open', function () {
5045				  self.$container.addClass('select2-container--open');
5046					});
5047
5048				this.on('close', function () {
5049				  self.$container.removeClass('select2-container--open');
5050					});
5051
5052				this.on('enable', function () {
5053				  self.$container.removeClass('select2-container--disabled');
5054					});
5055
5056				this.on('disable', function () {
5057				  self.$container.addClass('select2-container--disabled');
5058					});
5059
5060				this.on('focus', function () {
5061				  self.$container.addClass('select2-container--focus');
5062					});
5063
5064				this.on('blur', function () {
5065				  self.$container.removeClass('select2-container--focus');
5066					});
5067
5068				this.on('query', function (params) {
5069					if (!self.isOpen()) {
5070				  self.trigger('open');
5071					}
5072
5073				  this.dataAdapter.query(params, function (data) {
5074						self.trigger('results:all', {
5075							data: data,
5076							query: params
5077							});
5078					});
5079					});
5080
5081				this.on('query:append', function (params) {
5082				  this.dataAdapter.query(params, function (data) {
5083						self.trigger('results:append', {
5084							data: data,
5085							query: params
5086							});
5087					});
5088					});
5089
5090				this.on('keypress', function (evt) {
5091				  var key = evt.which;
5092
5093					if (self.isOpen()) {
5094						if (key === KEYS.ENTER) {
5095								self.trigger('results:select');
5096
5097								evt.preventDefault();
5098						} else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5099							  self.trigger('results:toggle');
5100
5101							  evt.preventDefault();
5102						} else if (key === KEYS.UP) {
5103							  self.trigger('results:previous');
5104
5105							  evt.preventDefault();
5106						} else if (key === KEYS.DOWN) {
5107						  self.trigger('results:next');
5108
5109						  evt.preventDefault();
5110						} else if (key === KEYS.ESC || key === KEYS.TAB) {
5111						  self.close();
5112
5113						  evt.preventDefault();
5114						}
5115					} else {
5116						if (key === KEYS.ENTER || key === KEYS.SPACE ||
5117				  ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) {
5118						  self.open();
5119
5120						  evt.preventDefault();
5121						}
5122					}
5123					});
5124			};
5125
5126		  Select2.prototype._syncAttributes = function () {
5127				this.options.set('disabled', this.$element.prop('disabled'));
5128
5129				if (this.options.get('disabled')) {
5130					if (this.isOpen()) {
5131					this.close();
5132					}
5133
5134				  this.trigger('disable');
5135					} else {
5136				  this.trigger('enable');
5137					}
5138			};
5139
5140		  /**
5141		   * Override the trigger method to automatically trigger pre-events when
5142		   * there are events that can be prevented.
5143		   */
5144		  Select2.prototype.trigger = function (name, args) {
5145				var actualTrigger = Select2.__super__.trigger;
5146				var preTriggerMap = {
5147					'open': 'opening',
5148					'close': 'closing',
5149					'select': 'selecting',
5150					'unselect': 'unselecting'
5151					};
5152
5153				if (name in preTriggerMap) {
5154				  var preTriggerName = preTriggerMap[name];
5155				  var preTriggerArgs = {
5156						prevented: false,
5157						name: name,
5158						args: args
5159					};
5160
5161				  actualTrigger.call(this, preTriggerName, preTriggerArgs);
5162
5163					if (preTriggerArgs.prevented) {
5164					args.prevented = true;
5165
5166					return;
5167					}
5168					}
5169
5170				actualTrigger.call(this, name, args);
5171			};
5172
5173		  Select2.prototype.toggleDropdown = function () {
5174				if (this.options.get('disabled')) {
5175				  return;
5176					}
5177
5178				if (this.isOpen()) {
5179				  this.close();
5180					} else {
5181				  this.open();
5182					}
5183			};
5184
5185		  Select2.prototype.open = function () {
5186				if (this.isOpen()) {
5187				  return;
5188					}
5189
5190				this.trigger('query', {});
5191
5192				this.trigger('open');
5193			};
5194
5195		  Select2.prototype.close = function () {
5196				if (!this.isOpen()) {
5197				  return;
5198					}
5199
5200				this.trigger('close');
5201			};
5202
5203		  Select2.prototype.isOpen = function () {
5204				return this.$container.hasClass('select2-container--open');
5205			};
5206
5207		  Select2.prototype.enable = function (args) {
5208				if (this.options.get('debug') && window.console && console.warn) {
5209				  console.warn(
5210					'Select2: The `select2("enable")` method has been deprecated and will' +
5211					' be removed in later Select2 versions. Use $element.prop("disabled")' +
5212					' instead.'
5213				  );
5214					}
5215
5216				if (args == null || args.length === 0) {
5217				  args = [true];
5218					}
5219
5220				var disabled = !args[0];
5221
5222				this.$element.prop('disabled', disabled);
5223			};
5224
5225		  Select2.prototype.data = function () {
5226				if (this.options.get('debug') &&
5227				arguments.length > 0 && window.console && console.warn) {
5228				  console.warn(
5229					'Select2: Data can no longer be set using `sele
5229ct2("data")`. You ' +
5230					'should consider setting the value instead using `$element.val()`.'
5231				  );
5232					}
5233
5234				var data = [];
5235
5236				this.dataAdapter.current(function (currentData) {
5237				  data = currentData;
5238					});
5239
5240				return data;
5241			};
5242
5243		  Select2.prototype.val = function (args) {
5244				if (this.options.get('debug') && window.console && console.warn) {
5245				  console.warn(
5246					'Select2: The `select2("val")` method has been deprecated and will be' +
5247					' removed in later Select2 versions. Use $element.val() instead.'
5248				  );
5249					}
5250
5251				if (args == null || args.length === 0) {
5252				  return this.$element.val();
5253					}
5254
5255				var newVal = args[0];
5256
5257				if ($.isArray(newVal)) {
5258				  newVal = $.map(newVal, function (obj) {
5259						return obj.toString();
5260					});
5261					}
5262
5263				this.$element.val(newVal).trigger('change');
5264			};
5265
5266		  Select2.prototype.destroy = function () {
5267				this.$container.remove();
5268
5269				if (this.$element[0].detachEvent) {
5270				  this.$element[0].detachEvent('onpropertychange', this._sync);
5271					}
5272
5273				if (this._observer != null) {
5274				  this._observer.disconnect();
5275				  this._observer = null;
5276					} else if (this.$element[0].removeEventListener) {
5277				  this.$element[0]
5278					.removeEventListener('DOMAttrModified', this._sync, false);
5279					}
5280
5281				this._sync = null;
5282
5283				this.$element.off('.select2');
5284				this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5285
5286				this.$element.removeClass('select2-hidden-accessible');
5287				this.$element.attr('aria-hidden', 'false');
5288				this.$element.removeData('select2');
5289
5290				this.dataAdapter.destroy();
5291				this.selection.destroy();
5292				this.dropdown.destroy();
5293				this.results.destroy();
5294
5295				this.dataAdapter = null;
5296				this.selection   = null;
5297				this.dropdown    = null;
5298				this.results     = null;
5299			};
5300
5301		  Select2.prototype.render = function () {
5302				var $container = $(
5303				'<span class="select2 select2-container">' +
5304				'<span class="selection"></span>' +
5305				'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5306				'</span>'
5307				);
5308
5309				$container.attr('dir', this.options.get('dir'));
5310
5311				this.$container = $container;
5312
5313				this.$container.addClass('select2-container--' + this.options.get('theme'));
5314
5315				$container.data('element', this.$element);
5316
5317				return $container;
5318			};
5319
5320		  return Select2;
5321			});
5322
5323		S2.define('jquery.select2',[
5324		  'jquery',
5325		  'require',
5326
5327		  './select2/core',
5328		  './select2/defaults'
5329		], function ($, require, Select2, Defaults) {
5330		  // Force jQuery.mousewheel to be loaded if it hasn't already
5331		  require('jquery.mousewheel');
5332
5333			if ($.fn.select2 == null) {
5334		  // All methods that should return the element
5335		  var thisMethods = ['open', 'close', 'destroy'];
5336
5337		  $.fn.select2 = function (options) {
5338					options = options || {};
5339
5340					if (typeof options === 'object') {
5341			  this.each(function () {
5342								  var instanceOptions = $.extend({}, options, true);
5343
5344								  var instance = new Select2($(this), instanceOptions);
5345						});
5346
5347			  return this;
5348					} else if (typeof options === 'string') {
5349var instance = this.data('select2');
5350
5351						if (instance == null && window.console && console.error) {
5352										  console.error(
5353									'The select2(\'' + options + '\') method was called on an ' +
5354									'element that is not using Select2.'
5355										  );
5356						}
5357
5358			  var args = Array.prototype.slice.call(arguments, 1);
5359
5360			  var ret = instance[options](args);
5361
5362			  // Check if we should be returning `this`
5363						if ($.inArray(options, thisMethods) > -1) {
5364						  return this;
5365						}
5366
5367		return ret;
5368					} else {
5369	  throw new Error('Invalid arguments for Select2: ' + options);
5370						  }
5371				};
5372			}
5373
5374			if ($.fn.select2.defaults == null) {
5375	  $.fn.select2.defaults = Defaults;
5376			}
5377
5378	  return Select2;
5379			});
5380
5381		S2.define('jquery.mousewheel',[
5382		  'jquery'
5383		], function ($) {
5384		  // Used to shim jQuery.mousewheel for non-full builds.
5385		  return $;
5386			});
5387
5388		  // Return the AMD loader configuration so it can be used outside of this file
5389		  return {
5390				define: S2.define,
5391				require: S2.require
5392			};
5393	}());
5394
5395  // Autoload the jQuery bindings
5396  // We know that all of the modules exist above this, so we're safe
5397  var select2 = S2.require('jquery.select2');
5398
5399  // Hold the AMD module references on the jQuery function that was just loaded
5400  // This allows Select2 to use the internal loader outside of this file, such
5401  // as in the language files.
5402  jQuery.fn.select2.amd = S2;
5403
5404  // Return the Select2 instance for anyone who is importing it.
5405  return select2;
5406}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.