Path: blob/master/sites/whatsapp-phishing/vendor/select2/select2.js
738 views
/*!1* Select2 4.0.32* https://select2.github.io3*4* Released under the MIT license5* https://github.com/select2/select2/blob/master/LICENSE.md6*/7(function (factory) {8if (typeof define === 'function' && define.amd) {9// AMD. Register as an anonymous module.10define(['jquery'], factory);11} else if (typeof module === 'object' && module.exports) {12// Node/CommonJS13module.exports = function (root, jQuery) {14if (jQuery === undefined) {15// require('jQuery') returns a factory that requires window to16// build a jQuery instance, we normalize how we use modules17// that require this pattern but the window provided is a noop18// if it's defined (how jquery works)19if (typeof window !== 'undefined') {20jQuery = require('jquery');21}22else {23jQuery = require('jquery')(root);24}25}26factory(jQuery);27return jQuery;28};29} else {30// Browser globals31factory(jQuery);32}33} (function (jQuery) {34// This is needed so we can catch the AMD loader configuration and use it35// The inner file should be wrapped (by `banner.start.js`) in a function that36// returns the AMD loader references.37var S2 =(function () {38// Restore the Select2 AMD loader so it can be used39// Needed mostly in the language files, where the loader is not inserted40if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {41var S2 = jQuery.fn.select2.amd;42}43var S2;(function () { if (!S2 || !S2.requirejs) {44if (!S2) { S2 = {}; } else { require = S2; }45/**46* @license almond 0.3.1 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.47* Available via the MIT or new BSD license.48* see: http://github.com/jrburke/almond for details49*/50//Going sloppy to avoid 'use strict' string cost, but strict practices should51//be followed.52/*jslint sloppy: true */53/*global setTimeout: false */5455var requirejs, require, define;56(function (undef) {57var main, req, makeMap, handlers,58defined = {},59waiting = {},60config = {},61defining = {},62hasOwn = Object.prototype.hasOwnProperty,63aps = [].slice,64jsSuffixRegExp = /\.js$/;6566function hasProp(obj, prop) {67return hasOwn.call(obj, prop);68}6970/**71* Given a relative module name, like ./something, normalize it to72* a real name that can be mapped to a path.73* @param {String} name the relative name74* @param {String} baseName a real name that the name arg is relative75* to.76* @returns {String} normalized name77*/78function normalize(name, baseName) {79var nameParts, nameSegment, mapValue, foundMap, lastIndex,80foundI, foundStarMap, starI, i, j, part,81baseParts = baseName && baseName.split("/"),82map = config.map,83starMap = (map && map['*']) || {};8485//Adjust any relative paths.86if (name && name.charAt(0) === ".") {87//If have a base name, try to normalize against it,88//otherwise, assume it is a top-level require that will89//be relative to baseUrl in the end.90if (baseName) {91name = name.split('/');92lastIndex = name.length - 1;9394// Node .js allowance:95if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {96name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');97}9899//Lop off the last part of baseParts, so that . matches the100//"directory" and not name of the baseName's module. For instance,101//baseName of "one/two/three", maps to "one/two/three.js", but we102//want the directory, "one/two" for this normalization.103name = baseParts.slice(0, baseParts.length - 1).concat(name);104105//start trimDots106for (i = 0; i < name.length; i += 1) {107part = name[i];108if (part === ".") {109name.splice(i, 1);110i -= 1;111} else if (part === "..") {112if (i === 1 && (name[2] === '..' || name[0] === '..')) {113//End of the line. Keep at least one non-dot114//path segment at the front so it can be mapped115//correctly to disk. Otherwise, there is likely116//no path mapping for a path starting with '..'.117//This can still fail, but catches the most reasonable118//uses of ..119break;120} else if (i > 0) {121name.splice(i - 1, 2);122i -= 2;123}124}125}126//end trimDots127128name = name.join("/");129} else if (name.indexOf('./') === 0) {130// No baseName, so this is ID is resolved relative131// to baseUrl, pull off the leading dot.132name = name.substring(2);133}134}135136//Apply map config if available.137if ((baseParts || starMap) && map) {138nameParts = name.split('/');139140for (i = nameParts.length; i > 0; i -= 1) {141nameSegment = nameParts.slice(0, i).join("/");142143if (baseParts) {144//Find the longest baseName segment match in the config.145//So, do joins on the biggest to smallest lengths of baseParts.146for (j = baseParts.length; j > 0; j -= 1) {147mapValue = map[baseParts.slice(0, j).join('/')];148149//baseName segment has config, find if it has one for150//this name.151if (mapValue) {152mapValue = mapValue[nameSegment];153if (mapValue) {154//Match, update name to the new value.155foundMap = mapValue;156foundI = i;157break;158}159}160}161}162163if (foundMap) {164break;165}166167//Check for a star map match, but just hold on to it,168//if there is a shorter segment match later in a matching169//config, then favor over this star map.170if (!foundStarMap && starMap && starMap[nameSegment]) {171foundStarMap = starMap[nameSegment];172starI = i;173}174}175176if (!foundMap && foundStarMap) {177foundMap = foundStarMap;178foundI = starI;179}180181if (foundMap) {182nameParts.splice(0, foundI, foundMap);183name = nameParts.join('/');184}185}186187return name;188}189190function makeRequire(relName, forceSync) {191return function () {192//A version of a require function that passes a moduleName193//value for items that may need to194//look up paths relative to the moduleName195var args = aps.call(arguments, 0);196197//If first arg is not require('string'), and there is only198//one arg, it is the array form without a callback. Insert199//a null so that the following concat is correct.200if (typeof args[0] !== 'string' && args.length === 1) {201args.push(null);202}203return req.apply(undef, args.concat([relName, forceSync]));204};205}206207function makeNormalize(relName) {208return function (name) {209return normalize(name, relName);210};211}212213function makeLoad(depName) {214return function (value) {215defined[depName] = value;216};217}218219function callDep(name) {220if (hasProp(waiting, name)) {221var args = waiting[name];222delete waiting[name];223defining[name] = true;224main.apply(undef, args);225}226227if (!hasProp(defined, name) && !hasProp(defining, name)) {228throw new Error('No ' + name);229}230return defined[name];231}232233//Turns a plugin!resource to [plugin, resource]234//with the plugin being undefined if the name235//did not have a plugin prefix.236function splitPrefix(name) {237var prefix,238index = name ? name.indexOf('!') : -1;239if (index > -1) {240prefix = name.substring(0, index);241name = name.substring(index + 1, name.length);242}243return [prefix, name];244}245246/**247* Makes a name map, normalizing the name, and using a plugin248* for normalization if necessary. Grabs a ref to plugin249* too, as an optimization.250*/251makeMap = function (name, relName) {252var plugin,253parts = splitPrefix(name),254prefix = parts[0];255256name = parts[1];257258if (prefix) {259prefix = normalize(prefix, relName);260plugin = callDep(prefix);261}262263//Normalize according264if (prefix) {265if (plugin && plugin.normalize) {266name = plugin.normalize(name, makeNormalize(relName));267} else {268name = normalize(name, relName);269}270} else {271name = normalize(name, relName);272parts = splitPrefix(name);273prefix = parts[0];274name = parts[1];275if (prefix) {276plugin = callDep(prefix);277}278}279280//Using ridiculous property names for space reasons281return {282f: prefix ? prefix + '!' + name : name, //fullName283n: name,284pr: prefix,285p: plugin286};287};288289function makeConfig(name) {290return function () {291return (config && config.config && config.config[name]) || {};292};293}294295handlers = {296require: function (name) {297return makeRequire(name);298},299exports: function (name) {300var e = defined[name];301if (typeof e !== 'undefined') {302return e;303} else {304return (defined[name] = {});305}306},307module: function (name) {308return {309id: name,310uri: '',311exports: defined[name],312config: makeConfig(name)313};314}315};316317main = function (name, deps, callback, relName) {318var cjsModule, depName, ret, map, i,319args = [],320callbackType = typeof callback,321usingExports;322323//Use name if no relName324relName = relName || name;325326//Call the callback to define the module, if necessary.327if (callbackType === 'undefined' || callbackType === 'function') {328//Pull out the defined dependencies and pass the ordered329//values to the callback.330//Default to [require, exports, module] if no deps331deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;332for (i = 0; i < deps.length; i += 1) {333map = makeMap(deps[i], relName);334depName = map.f;335336//Fast path CommonJS standard dependencies.337if (depName === "require") {338args[i] = handlers.require(name);339} else if (depName === "exports") {340//CommonJS module spec 1.1341args[i] = handlers.exports(name);342usingExports = true;343} else if (depName === "module") {344//CommonJS module spec 1.1345cjsModule = args[i] = handlers.module(name);346} else if (hasProp(defined, depName) ||347hasProp(waiting, depName) ||348hasProp(defining, depName)) {349args[i] = callDep(depName);350} else if (map.p) {351map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});352args[i] = defined[depName];353} else {354throw new Error(name + ' missing ' + depName);355}356}357358ret = callback ? callback.apply(defined[name], args) : undefined;359360if (name) {361//If setting exports via "module" is in play,362//favor that over return value and exports. After that,363//favor a non-undefined return value over exports use.364if (cjsModule && cjsModule.exports !== undef &&365cjsModule.exports !== defined[name]) {366defined[name] = cjsModule.exports;367} else if (ret !== undef || !usingExports) {368//Use the return value from the function.369defined[name] = ret;370}371}372} else if (name) {373//May just be an object definition for the module. Only374//worry about defining if have a module name.375defined[name] = callback;376}377};378379requirejs = require = req = function (deps, callback, relName, forceSync, alt) {380if (typeof deps === "string") {381if (handlers[deps]) {382//callback in this case is really relName383return handlers[deps](callback);384}385//Just return the module wanted. In this scenario, the386//deps arg is the module name, and second arg (if passed)387//is just the relName.388//Normalize module name, if it contains . or ..389return callDep(makeMap(deps, callback).f);390} else if (!deps.splice) {391//deps is a config object, not an array.392config = deps;393if (config.deps) {394req(config.deps, config.callback);395}396if (!callback) {397return;398}399400if (callback.splice) {401//callback is an array, which means it is a dependency list.402//Adjust args if there are dependencies403deps = callback;404callback = relName;405relName = null;406} else {407deps = undef;408}409}410411//Support require(['a'])412callback = callback || function () {};413414//If relName is a function, it is an errback handler,415//so remove it.416if (typeof relName === 'function') {417relName = forceSync;418forceSync = alt;419}420421//Simulate async callback;422if (forceSync) {423main(undef, deps, callback, relName);424} else {425//Using a non-zero value because of concern for what old browsers426//do, and latest browsers "upgrade" to 4 if lower value is used:427//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:428//If want a value immediately, use require('id') instead -- something429//that works in almond on the global level, but not guaranteed and430//unlikely to work in other AMD implementations.431setTimeout(function () {432main(undef, deps, callback, relName);433}, 4);434}435436return req;437};438439/**440* Just drops the config on the floor, but returns req in case441* the config return value is used.442*/443req.config = function (cfg) {444return req(cfg);445};446447/**448* Expose module registry for debugging and tooling449*/450requirejs._defined = defined;451452define = function (name, deps, callback) {453if (typeof name !== 'string') {454throw new Error('See almond README: incorrect module build, no module name');455}456457//This module may not have dependencies458if (!deps.splice) {459//deps is not an array, so probably means460//an object literal or factory function for461//the value. Adjust args.462callback = deps;463deps = [];464}465466if (!hasProp(defined, name) && !hasProp(waiting, name)) {467waiting[name] = [name, deps, callback];468}469};470471define.amd = {472jQuery: true473};474}());475476S2.requirejs = requirejs;S2.require = require;S2.define = define;477}478}());479S2.define("almond", function(){});480481/* global jQuery:false, $:false */482S2.define('jquery',[],function () {483var _$ = jQuery || $;484485if (_$ == null && console && console.error) {486console.error(487'Select2: An instance of jQuery or a jQuery-compatible library was not ' +488'found. Make sure that you are including jQuery before Select2 on your ' +489'web page.'490);491}492493return _$;494});495496S2.define('select2/utils',[497'jquery'498], function ($) {499var Utils = {};500501Utils.Extend = function (ChildClass, SuperClass) {502var __hasProp = {}.hasOwnProperty;503504function BaseConstructor () {505this.constructor = ChildClass;506}507508for (var key in SuperClass) {509if (__hasProp.call(SuperClass, key)) {510ChildClass[key] = SuperClass[key];511}512}513514BaseConstructor.prototype = SuperClass.prototype;515ChildClass.prototype = new BaseConstructor();516ChildClass.__super__ = SuperClass.prototype;517518return ChildClass;519};520521function getMethods (theClass) {522var proto = theClass.prototype;523524var methods = [];525526for (var methodName in proto) {527var m = proto[methodName];528529if (typeof m !== 'function') {530continue;531}532533if (methodName === 'constructor') {534continue;535}536537methods.push(methodName);538}539540return methods;541}542543Utils.Decorate = function (SuperClass, DecoratorClass) {544var decoratedMethods = getMethods(DecoratorClass);545var superMethods = getMethods(SuperClass);546547function DecoratedClass () {548var unshift = Array.prototype.unshift;549550var argCount = DecoratorClass.prototype.constructor.length;551552var calledConstructor = SuperClass.prototype.constructor;553554if (argCount > 0) {555unshift.call(arguments, SuperClass.prototype.constructor);556557calledConstructor = DecoratorClass.prototype.constructor;558}559560calledConstructor.apply(this, arguments);561}562563DecoratorClass.displayName = SuperClass.displayName;564565function ctr () {566this.constructor = DecoratedClass;567}568569DecoratedClass.prototype = new ctr();570571for (var m = 0; m < superMethods.length; m++) {572var superMethod = superMethods[m];573574DecoratedClass.prototype[superMethod] =575SuperClass.prototype[superMethod];576}577578var calledMethod = function (methodName) {579// Stub out the original method if it's not decorating an actual method580var originalMethod = function () {};581582if (methodName in DecoratedClass.prototype) {583originalMethod = DecoratedClass.prototype[methodName];584}585586var decoratedMethod = DecoratorClass.prototype[methodName];587588return function () {589var unshift = Array.prototype.unshift;590591unshift.call(arguments, originalMethod);592593return decoratedMethod.apply(this, arguments);594};595};596597for (var d = 0; d < decoratedMethods.length; d++) {598var decoratedMethod = decoratedMethods[d];599600DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);601}602603return DecoratedClass;604};605606var Observable = function () {607this.listeners = {};608};609610Observable.prototype.on = function (event, callback) {611this.listeners = this.listeners || {};612613if (event in this.listeners) {614this.listeners[event].push(callback);615} else {616this.listeners[event] = [callback];617}618};619620Observable.prototype.trigger = function (event) {621var slice = Array.prototype.slice;622var params = slice.call(arguments, 1);623624this.listeners = this.listeners || {};625626// Params should always come in as an array627if (params == null) {628params = [];629}630631// If there are no arguments to the event, use a temporary object632if (params.length === 0) {633params.push({});634}635636// Set the `_type` of the first object to the event637params[0]._type = event;638639if (event in this.listeners) {640this.invoke(this.listeners[event], slice.call(arguments, 1));641}642643if ('*' in this.listeners) {644this.invoke(this.listeners['*'], arguments);645}646};647648Observable.prototype.invoke = function (listeners, params) {649for (var i = 0, len = listeners.length; i < len; i++) {650listeners[i].apply(this, params);651}652};653654Utils.Observable = Observable;655656Utils.generateChars = function (length) {657var chars = '';658659for (var i = 0; i < length; i++) {660var randomChar = Math.floor(Math.random() * 36);661chars += randomChar.toString(36);662}663664return chars;665};666667Utils.bind = function (func, context) {668return function () {669func.apply(context, arguments);670};671};672673Utils._convertData = function (data) {674for (var originalKey in data) {675var keys = originalKey.split('-');676677var dataLevel = data;678679if (keys.length === 1) {680continue;681}682683for (var k = 0; k < keys.length; k++) {684var key = keys[k];685686// Lowercase the first letter687// By default, dash-separated becomes camelCase688key = key.substring(0, 1).toLowerCase() + key.substring(1);689690if (!(key in dataLevel)) {691dataLevel[key] = {};692}693694if (k == keys.length - 1) {695dataLevel[key] = data[originalKey];696}697698dataLevel = dataLevel[key];699}700701delete data[originalKey];702}703704return data;705};706707Utils.hasScroll = function (index, el) {708// Adapted from the function created by @ShadowScripter709// and adapted by @BillBarry on the Stack Exchange Code Review website.710// The original code can be found at711// http://codereview.stackexchange.com/q/13338712// and was designed to be used with the Sizzle selector engine.713714var $el = $(el);715var overflowX = el.style.overflowX;716var overflowY = el.style.overflowY;717718//Check both x and y declarations719if (overflowX === overflowY &&720(overflowY === 'hidden' || overflowY === 'visible')) {721return false;722}723724if (overflowX === 'scroll' || overflowY === 'scroll') {725return true;726}727728return ($el.innerHeight() < el.scrollHeight ||729$el.innerWidth() < el.scrollWidth);730};731732Utils.escapeMarkup = function (markup) {733var replaceMap = {734'\\': '\',735'&': '&',736'<': '<',737'>': '>',738'"': '"',739'\'': ''',740'/': '/'741};742743// Do not try to escape the markup if it's not a string744if (typeof markup !== 'string') {745return markup;746}747748return String(markup).replace(/[&<>"'\/\\]/g, function (match) {749return replaceMap[match];750});751};752753// Append an array of jQuery nodes to a given element.754Utils.appendMany = function ($element, $nodes) {755// jQuery 1.7.x does not support $.fn.append() with an array756// Fall back to a jQuery object collection using $.fn.add()757if ($.fn.jquery.substr(0, 3) === '1.7') {758var $jqNodes = $();759760$.map($nodes, function (node) {761$jqNodes = $jqNodes.add(node);762});763764$nodes = $jqNodes;765}766767$element.append($nodes);768};769770return Utils;771});772773S2.define('select2/results',[774'jquery',775'./utils'776], function ($, Utils) {777function Results ($element, options, dataAdapter) {778this.$element = $element;779this.data = dataAdapter;780this.options = options;781782Results.__super__.constructor.call(this);783}784785Utils.Extend(Results, Utils.Observable);786787Results.prototype.render = function () {788var $results = $(789'<ul class="select2-results__options" role="tree"></ul>'790);791792if (this.options.get('multiple')) {793$results.attr('aria-multiselectable', 'true');794}795796this.$results = $results;797798return $results;799};800801Results.prototype.clear = function () {802this.$results.empty();803};804805Results.prototype.displayMessage = function (params) {806var escapeMarkup = this.options.get('escapeMarkup');807808this.clear();809this.hideLoading();810811var $message = $(812'<li role="treeitem" aria-live="assertive"' +813' class="select2-results__option"></li>'814);815816var message = this.options.get('translations').get(params.message);817818$message.append(819escapeMarkup(820message(params.args)821)822);823824$message[0].className += ' select2-results__message';825826this.$results.append($message);827};828829Results.prototype.hideMessages = function () {830this.$results.find('.select2-results__message').remove();831};832833Results.prototype.append = function (data) {834this.hideLoading();835836var $options = [];837838if (data.results == null || data.results.length === 0) {839if (this.$results.children().length === 0) {840this.trigger('results:message', {841message: 'noResults'842});843}844845return;846}847848data.results = this.sort(data.results);849850for (var d = 0; d < data.results.length; d++) {851var item = data.results[d];852853var $option = this.option(item);854855$options.push($option);856}857858this.$results.append($options);859};860861Results.prototype.position = function ($results, $dropdown) {862var $resultsContainer = $dropdown.find('.select2-results');863$resultsContainer.append($results);864};865866Results.prototype.sort = function (data) {867var sorter = this.options.get('sorter');868869return sorter(data);870};871872Results.prototype.highlightFirstItem = function () {873var $options = this.$results874.find('.select2-results__option[aria-selected]');875876var $selected = $options.filter('[aria-selected=true]');877878// Check if there are any selected options879if ($selected.length > 0) {880// If there are selected options, highlight the first881$selected.first().trigger('mouseenter');882} else {883// If there are no selected options, highlight the first option884// in the dropdown885$options.first().trigger('mouseenter');886}887888this.ensureHighlightVisible();889};890891Results.prototype.setClasses = function () {892var self = this;893894this.data.current(function (selected) {895var selectedIds = $.map(selected, function (s) {896return s.id.toString();897});898899var $options = self.$results900.find('.select2-results__option[aria-selected]');901902$options.each(function () {903var $option = $(this);904905var item = $.data(this, 'data');906907// id needs to be converted to a string when comparing908var id = '' + item.id;909910if ((item.element != null && item.element.selected) ||911(item.element == null && $.inArray(id, selectedIds) > -1)) {912$option.attr('aria-selected', 'true');913} else {914$option.attr('aria-selected', 'false');915}916});917918});919};920921Results.prototype.showLoading = function (params) {922this.hideLoading();923924var loadingMore = this.options.get('translations').get('searching');925926var loading = {927disabled: true,928loading: true,929text: loadingMore(params)930};931var $loading = this.option(loading);932$loading.className += ' loading-results';933934this.$results.prepend($loading);935};936937Results.prototype.hideLoading = function () {938this.$results.find('.loading-results').remove();939};940941Results.prototype.option = function (data) {942var option = document.createElement('li');943option.className = 'select2-results__option';944945var attrs = {946'role': 'treeitem',947'aria-selected': 'false'948};949950if (data.disabled) {951delete attrs['aria-selected'];952attrs['aria-disabled'] = 'true';953}954955if (data.id == null) {956delete attrs['aria-selected'];957}958959if (data._resultId != null) {960option.id = data._resultId;961}962963if (data.title) {964option.title = data.title;965}966967if (data.children) {968attrs.role = 'group';969attrs['aria-label'] = data.text;970delete attrs['aria-selected'];971}972973for (var attr in attrs) {974var val = attrs[attr];975976option.setAttribute(attr, val);977}978979if (data.children) {980var $option = $(option);981982var label = document.createElement('strong');983label.className = 'select2-results__group';984985var $label = $(label);986this.template(data, label);987988var $children = [];989990for (var c = 0; c < data.children.length; c++) {991var child = data.children[c];992993var $child = this.option(child);994995$children.push($child);996}997998var $childrenContainer = $('<ul></ul>', {999'class': 'select2-results__options select2-results__options--nested'1000});10011002$childrenContainer.append($children);10031004$option.append(label);1005$option.append($childrenContainer);1006} else {1007this.template(data, option);1008}10091010$.data(option, 'data', data);10111012return option;1013};10141015Results.prototype.bind = function (container, $container) {1016var self = this;10171018var id = container.id + '-results';10191020this.$results.attr('id', id);10211022container.on('results:all', function (params) {1023self.clear();1024self.append(params.data);10251026if (container.isOpen()) {1027self.setClasses();1028self.highlightFirstItem();1029}1030});10311032container.on('results:append', function (params) {1033self.append(params.data);10341035if (container.isOpen()) {1036self.setClasses();1037}1038});10391040container.on('query', function (params) {1041self.hideMessages();1042self.showLoading(params);1043});10441045container.on('select', function () {1046if (!container.isOpen()) {1047return;1048}10491050self.setClasses();1051self.highlightFirstItem();1052});10531054container.on('unselect', function () {1055if (!container.isOpen()) {1056return;1057}10581059self.setClasses();1060self.highlightFirstItem();1061});10621063container.on('open', function () {1064// When the dropdown is open, aria-expended="true"1065self.$results.attr('aria-expanded', 'true');1066self.$results.attr('aria-hidden', 'false');10671068self.setClasses();1069self.ensureHighlightVisible();1070});10711072container.on('close', function () {1073// When the dropdown is closed, aria-expended="false"1074self.$results.attr('aria-expanded', 'false');1075self.$results.attr('aria-hidden', 'true');1076self.$results.removeAttr('aria-activedescendant');1077});10781079container.on('results:toggle', function () {1080var $highlighted = self.getHighlightedResults();10811082if ($highlighted.length === 0) {1083return;1084}10851086$highlighted.trigger('mouseup');1087});10881089container.on('results:select', function () {1090var $highlighted = self.getHighlightedResults();10911092if ($highlighted.length === 0) {1093return;1094}10951096var data = $highlighted.data('data');10971098if ($highlighted.attr('aria-selected') == 'true') {1099self.trigger('close', {});1100} else {1101self.trigger('select', {1102data: data1103});1104}1105});11061107container.on('results:previous', function () {1108var $highlighted = self.getHighlightedResults();11091110var $options = self.$results.find('[aria-selected]');11111112var currentIndex = $options.index($highlighted);11131114// If we are already at te top, don't move further1115if (currentIndex === 0) {1116return;1117}11181119var nextIndex = currentIndex - 1;11201121// If none are highlighted, highlight the first1122if ($highlighted.length === 0) {1123nextIndex = 0;1124}11251126var $next = $options.eq(nextIndex);11271128$next.trigger('mouseenter');11291130var currentOffset = self.$results.offset().top;1131var nextTop = $next.offset().top;1132var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);11331134if (nextIndex === 0) {1135self.$results.scrollTop(0);1136} else if (nextTop - currentOffset < 0) {1137self.$results.scrollTop(nextOffset);1138}1139});11401141container.on('results:next', function () {1142var $highlighted = self.getHighlightedResults();11431144var $options = self.$results.find('[aria-selected]');11451146var currentIndex = $options.index($highlighted);11471148var nextIndex = currentIndex + 1;11491150// If we are at the last option, stay there1151if (nextIndex >= $options.length) {1152return;1153}11541155var $next = $options.eq(nextIndex);11561157$next.trigger('mouseenter');11581159var currentOffset = self.$results.offset().top +1160self.$results.outerHeight(false);1161var nextBottom = $next.offset().top + $next.outerHeight(false);1162var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;11631164if (nextIndex === 0) {1165self.$results.scrollTop(0);1166} else if (nextBottom > currentOffset) {1167self.$results.scrollTop(nextOffset);1168}1169});11701171container.on('results:focus', function (params) {1172params.element.addClass('select2-results__option--highlighted');1173});11741175container.on('results:message', function (params) {1176self.displayMessage(params);1177});11781179if ($.fn.mousewheel) {1180this.$results.on('mousewheel', function (e) {1181var top = self.$results.scrollTop();11821183var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;11841185var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;1186var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();11871188if (isAtTop) {1189self.$results.scrollTop(0);11901191e.preventDefault();1192e.stopPropagation();1193} else if (isAtBottom) {1194self.$results.scrollTop(1195self.$results.get(0).scrollHeight - self.$results.height()1196);11971198e.preventDefault();1199e.stopPropagation();1200}1201});1202}12031204this.$results.on('mouseup', '.select2-results__option[aria-selected]',1205function (evt) {1206var $this = $(this);12071208var data = $this.data('data');12091210if ($this.attr('aria-selected') === 'true') {1211if (self.options.get('multiple')) {1212self.trigger('unselect', {1213originalEvent: evt,1214data: data1215});1216} else {1217self.trigger('close', {});1218}12191220return;1221}12221223self.trigger('select', {1224originalEvent: evt,1225data: data1226});1227});12281229this.$results.on('mouseenter', '.select2-results__option[aria-selected]',1230function (evt) {1231var data = $(this).data('data');12321233self.getHighlightedResults()1234.removeClass('select2-results__option--highlighted');12351236self.trigger('results:focus', {1237data: data,1238element: $(this)1239});1240});1241};12421243Results.prototype.getHighlightedResults = function () {1244var $highlighted = this.$results1245.find('.select2-results__option--highlighted');12461247return $highlighted;1248};12491250Results.prototype.destroy = function () {1251this.$results.remove();1252};12531254Results.prototype.ensureHighlightVisible = function () {1255var $highlighted = this.getHighlightedResults();12561257if ($highlighted.length === 0) {1258return;1259}12601261var $options = this.$results.find('[aria-selected]');12621263var currentIndex = $options.index($highlighted);12641265var currentOffset = this.$results.offset().top;1266var nextTop = $highlighted.offset().top;1267var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);12681269var offsetDelta = nextTop - currentOffset;1270nextOffset -= $highlighted.outerHeight(false) * 2;12711272if (currentIndex <= 2) {1273this.$results.scrollTop(0);1274} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {1275this.$results.scrollTop(nextOffset);1276}1277};12781279Results.prototype.template = function (result, container) {1280var template = this.options.get('templateResult');1281var escapeMarkup = this.options.get('escapeMarkup');12821283var content = template(result, container);12841285if (content == null) {1286container.style.display = 'none';1287} else if (typeof content === 'string') {1288container.innerHTML = escapeMarkup(content);1289} else {1290$(container).append(content);1291}1292};12931294return Results;1295});12961297S2.define('select2/keys',[12981299], function () {1300var KEYS = {1301BACKSPACE: 8,1302TAB: 9,1303ENTER: 13,1304SHIFT: 16,1305CTRL: 17,1306ALT: 18,1307ESC: 27,1308SPACE: 32,1309PAGE_UP: 33,1310PAGE_DOWN: 34,1311END: 35,1312HOME: 36,1313LEFT: 37,1314UP: 38,1315RIGHT: 39,1316DOWN: 40,1317DELETE: 461318};13191320return KEYS;1321});13221323S2.define('select2/selection/base',[1324'jquery',1325'../utils',1326'../keys'1327], function ($, Utils, KEYS) {1328function BaseSelection ($element, options) {1329this.$element = $element;1330this.options = options;13311332BaseSelection.__super__.constructor.call(this);1333}13341335Utils.Extend(BaseSelection, Utils.Observable);13361337BaseSelection.prototype.render = function () {1338var $selection = $(1339'<span class="select2-selection" role="combobox" ' +1340' aria-haspopup="true" aria-expanded="false">' +1341'</span>'1342);13431344this._tabindex = 0;13451346if (this.$element.data('old-tabindex') != null) {1347this._tabindex = this.$element.data('old-tabindex');1348} else if (this.$element.attr('tabindex') != null) {1349this._tabindex = this.$element.attr('tabindex');1350}13511352$selection.attr('title', this.$element.attr('title'));1353$selection.attr('tabindex', this._tabindex);13541355this.$selection = $selection;13561357return $selection;1358};13591360BaseSelection.prototype.bind = function (container, $container) {1361var self = this;13621363var id = container.id + '-container';1364var resultsId = container.id + '-results';13651366this.container = container;13671368this.$selection.on('focus', function (evt) {1369self.trigger('focus', evt);1370});13711372this.$selection.on('blur', function (evt) {1373self._handleBlur(evt);1374});13751376this.$selection.on('keydown', function (evt) {1377self.trigger('keypress', evt);13781379if (evt.which === KEYS.SPACE) {1380evt.preventDefault();1381}1382});13831384container.on('results:focus', function (params) {1385self.$selection.attr('aria-activedescendant', params.data._resultId);1386});13871388container.on('selection:update', function (params) {1389self.update(params.data);1390});13911392container.on('open', function () {1393// When the dropdown is open, aria-expanded="true"1394self.$selection.attr('aria-expanded', 'true');1395self.$selection.attr('aria-owns', resultsId);13961397self._attachCloseHandler(container);1398});13991400container.on('close', function () {1401// When the dropdown is closed, aria-expanded="false"1402self.$selection.attr('aria-expanded', 'false');1403self.$selection.removeAttr('aria-activedescendant');1404self.$selection.removeAttr('aria-owns');14051406self.$selection.focus();14071408self._detachCloseHandler(container);1409});14101411container.on('enable', function () {1412self.$selection.attr('tabindex', self._tabindex);1413});14141415container.on('disable', function () {1416self.$selection.attr('tabindex', '-1');1417});1418};14191420BaseSelection.prototype._handleBlur = function (evt) {1421var self = this;14221423// This needs to be delayed as the active element is the body when the tab1424// key is pressed, possibly along with others.1425window.setTimeout(function () {1426// Don't trigger `blur` if the focus is still in the selection1427if (1428(document.activeElement == self.$selection[0]) ||1429($.contains(self.$selection[0], document.activeElement))1430) {1431return;1432}14331434self.trigger('blur', evt);1435}, 1);1436};14371438BaseSelection.prototype._attachCloseHandler = function (container) {1439var self = this;14401441$(document.body).on('mousedown.select2.' + container.id, function (e) {1442var $target = $(e.target);14431444var $select = $target.closest('.select2');14451446var $all = $('.select2.select2-container--open');14471448$all.each(function () {1449var $this = $(this);14501451if (this == $select[0]) {1452return;1453}14541455var $element = $this.data('element');14561457$element.select2('close');1458});1459});1460};14611462BaseSelection.prototype._detachCloseHandler = function (container) {1463$(document.body).off('mousedown.select2.' + container.id);1464};14651466BaseSelection.prototype.position = function ($selection, $container) {1467var $selectionContainer = $container.find('.selection');1468$selectionContainer.append($selection);1469};14701471BaseSelection.prototype.destroy = function () {1472this._detachCloseHandler(this.container);1473};14741475BaseSelection.prototype.update = function (data) {1476throw new Error('The `update` method must be defined in child classes.');1477};14781479return BaseSelection;1480});14811482S2.define('select2/selection/single',[1483'jquery',1484'./base',1485'../utils',1486'../keys'1487], function ($, BaseSelection, Utils, KEYS) {1488function SingleSelection () {1489SingleSelection.__super__.constructor.apply(this, arguments);1490}14911492Utils.Extend(SingleSelection, BaseSelection);14931494SingleSelection.prototype.render = function () {1495var $selection = SingleSelection.__super__.render.call(this);14961497$selection.addClass('select2-selection--single');14981499$selection.html(1500'<span class="select2-selection__rendered"></span>' +1501'<span class="select2-selection__arrow" role="presentation">' +1502'<b role="presentation"></b>' +1503'</span>'1504);15051506return $selection;1507};15081509SingleSelection.prototype.bind = function (container, $container) {1510var self = this;15111512SingleSelection.__super__.bind.apply(this, arguments);15131514var id = container.id + '-container';15151516this.$selection.find('.select2-selection__rendered').attr('id', id);1517this.$selection.attr('aria-labelledby', id);15181519this.$selection.on('mousedown', function (evt) {1520// Only respond to left clicks1521if (evt.which !== 1) {1522return;1523}15241525self.trigger('toggle', {1526originalEvent: evt1527});1528});15291530this.$selection.on('focus', function (evt) {1531// User focuses on the container1532});15331534this.$selection.on('blur', function (evt) {1535// User exits the container1536});15371538container.on('focus', function (evt) {1539if (!container.isOpen()) {1540self.$selection.focus();1541}1542});15431544container.on('selection:update', function (params) {1545self.update(params.data);1546});1547};15481549SingleSelection.prototype.clear = function () {1550this.$selection.find('.select2-selection__rendered').empty();1551};15521553SingleSelection.prototype.display = function (data, container) {1554var template = this.options.get('templateSelection');1555var escapeMarkup = this.options.get('escapeMarkup');15561557return escapeMarkup(template(data, container));1558};15591560SingleSelection.prototype.selectionContainer = function () {1561return $('<span></span>');1562};15631564SingleSelection.prototype.update = function (data) {1565if (data.length === 0) {1566this.clear();1567return;1568}15691570var selection = data[0];15711572var $rendered = this.$selection.find('.select2-selection__rendered');1573var formatted = this.display(selection, $rendered);15741575$rendered.empty().append(formatted);1576$rendered.prop('title', selection.title || selection.text);1577};15781579return SingleSelection;1580});15811582S2.define('select2/selection/multiple',[1583'jquery',1584'./base',1585'../utils'1586], function ($, BaseSelection, Utils) {1587function MultipleSelection ($element, options) {1588MultipleSelection.__super__.constructor.apply(this, arguments);1589}15901591Utils.Extend(MultipleSelection, BaseSelection);15921593MultipleSelection.prototype.render = function () {1594var $selection = MultipleSelection.__super__.render.call(this);15951596$selection.addClass('select2-selection--multiple');15971598$selection.html(1599'<ul class="select2-selection__rendered"></ul>'1600);16011602return $selection;1603};16041605MultipleSelection.prototype.bind = function (container, $container) {1606var self = this;16071608MultipleSelection.__super__.bind.apply(this, arguments);16091610this.$selection.on('click', function (evt) {1611self.trigger('toggle', {1612originalEvent: evt1613});1614});16151616this.$selection.on(1617'click',1618'.select2-selection__choice__remove',1619function (evt) {1620// Ignore the event if it is disabled1621if (self.options.get('disabled')) {1622return;1623}16241625var $remove = $(this);1626var $selection = $remove.parent();16271628var data = $selection.data('data');16291630self.trigger('unselect', {1631originalEvent: evt,1632data: data1633});1634}1635);1636};16371638MultipleSelection.prototype.clear = function () {1639this.$selection.find('.select2-selection__rendered').empty();1640};16411642MultipleSelection.prototype.display = function (data, container) {1643var template = this.options.get('templateSelection');1644var escapeMarkup = this.options.get('escapeMarkup');16451646return escapeMarkup(template(data, container));1647};16481649MultipleSelection.prototype.selectionContainer = function () {1650var $container = $(1651'<li class="select2-selection__choice">' +1652'<span class="select2-selection__choice__remove" role="presentation">' +1653'×' +1654'</span>' +1655'</li>'1656);16571658return $container;1659};16601661MultipleSelection.prototype.update = function (data) {1662this.clear();16631664if (data.length === 0) {1665return;1666}16671668var $selections = [];16691670for (var d = 0; d < data.length; d++) {1671var selection = data[d];16721673var $selection = this.selectionContainer();1674var formatted = this.display(selection, $selection);16751676$selection.append(formatted);1677$selection.prop('title', selection.title || selection.text);16781679$selection.data('data', selection);16801681$selections.push($selection);1682}16831684var $rendered = this.$selection.find('.select2-selection__rendered');16851686Utils.appendMany($rendered, $selections);1687};16881689return MultipleSelection;1690});16911692S2.define('select2/selection/placeholder',[1693'../utils'1694], function (Utils) {1695function Placeholder (decorated, $element, options) {1696this.placeholder = this.normalizePlaceholder(options.get('placeholder'));16971698decorated.call(this, $element, options);1699}17001701Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {1702if (typeof placeholder === 'string') {1703placeholder = {1704id: '',1705text: placeholder1706};1707}17081709return placeholder;1710};17111712Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {1713var $placeholder = this.selectionContainer();17141715$placeholder.html(this.display(placeholder));1716$placeholder.addClass('select2-selection__placeholder')1717.removeClass('select2-selection__choice');17181719return $placeholder;1720};17211722Placeholder.prototype.update = function (decorated, data) {1723var singlePlaceholder = (1724data.length == 1 && data[0].id != this.placeholder.id1725);1726var multipleSelections = data.length > 1;17271728if (multipleSelections || singlePlaceholder) {1729return decorated.call(this, data);1730}17311732this.clear();17331734var $placeholder = this.createPlaceholder(this.placeholder);17351736this.$selection.find('.select2-selection__rendered').append($placeholder);1737};17381739return Placeholder;1740});17411742S2.define('select2/selection/allowClear',[1743'jquery',1744'../keys'1745], function ($, KEYS) {1746function AllowClear () { }17471748AllowClear.prototype.bind = function (decorated, container, $container) {1749var self = this;17501751decorated.call(this, container, $container);17521753if (this.placeholder == null) {1754if (this.options.get('debug') && window.console && console.error) {1755console.error(1756'Select2: The `allowClear` option should be used in combination ' +1757'with the `placeholder` option.'1758);1759}1760}17611762this.$selection.on('mousedown', '.select2-selection__clear',1763function (evt) {1764self._handleClear(evt);1765});17661767container.on('keypress', function (evt) {1768self._handleKeyboardClear(evt, container);1769});1770};17711772AllowClear.prototype._handleClear = function (_, evt) {1773// Ignore the event if it is disabled1774if (this.options.get('disabled')) {1775return;1776}17771778var $clear = this.$selection.find('.select2-selection__clear');17791780// Ignore the event if nothing has been selected1781if ($clear.length === 0) {1782return;1783}17841785evt.stopPropagation();17861787var data = $clear.data('data');17881789for (var d = 0; d < data.length; d++) {1790var unselectData = {1791data: data[d]1792};17931794// Trigger the `unselect` event, so people can prevent it from being1795// cleared.1796this.trigger('unselect', unselectData);17971798// If the event was prevented, don't clear it out.1799if (unselectData.prevented) {1800return;1801}1802}18031804this.$element.val(this.placeholder.id).trigger('change');18051806this.trigger('toggle', {});1807};18081809AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {1810if (container.isOpen()) {1811return;1812}18131814if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {1815this._handleClear(evt);1816}1817};18181819AllowClear.prototype.update = function (decorated, data) {1820decorated.call(this, data);18211822if (this.$selection.find('.select2-selection__placeholder').length > 0 ||1823data.length === 0) {1824return;1825}18261827var $remove = $(1828'<span class="select2-selection__clear">' +1829'×' +1830'</span>'1831);1832$remove.data('data', data);18331834this.$selection.find('.select2-selection__rendered').prepend($remove);1835};18361837return AllowClear;1838});18391840S2.define('select2/selection/search',[1841'jquery',1842'../utils',1843'../keys'1844], function ($, Utils, KEYS) {1845function Search (decorated, $element, options) {1846decorated.call(this, $element, options);1847}18481849Search.prototype.render = function (decorated) {1850var $search = $(1851'<li class="select2-search select2-search--inline">' +1852'<input class="select2-search__field" type="search" tabindex="-1"' +1853' autocomplete="off" autocorrect="off" autocapitalize="off"' +1854' spellcheck="false" role="textbox" aria-autocomplete="list" />' +1855'</li>'1856);18571858this.$searchContainer = $search;1859this.$search = $search.find('input');18601861var $rendered = decorated.call(this);18621863this._transferTabIndex();18641865return $rendered;1866};18671868Search.prototype.bind = function (decorated, container, $container) {1869var self = this;18701871decorated.call(this, container, $container);18721873container.on('open', function () {1874self.$search.trigger('focus');1875});18761877container.on('close', function () {1878self.$search.val('');1879self.$search.removeAttr('aria-activedescendant');1880self.$search.trigger('focus');1881});18821883container.on('enable', function () {1884self.$search.prop('disabled', false);18851886self._transferTabIndex();1887});18881889container.on('disable', function () {1890self.$search.prop('disabled', true);1891});18921893container.on('focus', function (evt) {1894self.$search.trigger('focus');1895});18961897container.on('results:focus', function (params) {1898self.$search.attr('aria-activedescendant', params.id);1899});19001901this.$selection.on('focusin', '.select2-search--inline', function (evt) {1902self.trigger('focus', evt);1903});19041905this.$selection.on('focusout', '.select2-search--inline', function (evt) {1906self._handleBlur(evt);1907});19081909this.$selection.on('keydown', '.select2-search--inline', function (evt) {1910evt.stopPropagation();19111912self.trigger('keypress', evt);19131914self._keyUpPrevented = evt.isDefaultPrevented();19151916var key = evt.which;19171918if (key === KEYS.BACKSPACE && self.$search.val() === '') {1919var $previousChoice = self.$searchContainer1920.prev('.select2-selection__choice');19211922if ($previousChoice.length > 0) {1923var item = $previousChoice.data('data');19241925self.searchRemoveChoice(item);19261927evt.preventDefault();1928}1929}1930});19311932// Try to detect the IE version should the `documentMode` property that1933// is stored on the document. This is only implemented in IE and is1934// slightly cleaner than doing a user agent check.1935// This property is not available in Edge, but Edge also doesn't have1936// this bug.1937var msie = document.documentMode;1938var disableInputEvents = msie && msie <= 11;19391940// Workaround for browsers which do not support the `input` event1941// This will prevent double-triggering of events for browsers which support1942// both the `keyup` and `input` events.1943this.$selection.on(1944'input.searchcheck',1945'.select2-search--inline',1946function (evt) {1947// IE will trigger the `input` event when a placeholder is used on a1948// search box. To get around this issue, we are forced to ignore all1949// `input` events in IE and keep using `keyup`.1950if (disableInputEvents) {1951self.$selection.off('input.search input.searchcheck');1952return;1953}19541955// Unbind the duplicated `keyup` event1956self.$selection.off('keyup.search');1957}1958);19591960this.$selection.on(1961'keyup.search input.search',1962'.select2-search--inline',1963function (evt) {1964// IE will trigger the `input` event when a placeholder is used on a1965// search box. To get around this issue, we are forced to ignore all1966// `input` events in IE and keep using `keyup`.1967if (disableInputEvents && evt.type === 'input') {1968self.$selection.off('input.search input.searchcheck');1969return;1970}19711972var key = evt.which;19731974// We can freely ignore events from modifier keys1975if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {1976return;1977}19781979// Tabbing will be handled during the `keydown` phase1980if (key == KEYS.TAB) {1981return;1982}19831984self.handleSearch(evt);1985}1986);1987};19881989/**1990* This method will transfer the tabindex attribute from the rendered1991* selection to the search box. This allows for the search box to be used as1992* the primary focus instead of the selection container.1993*1994* @private1995*/1996Search.prototype._transferTabIndex = function (decorated) {1997this.$search.attr('tabindex', this.$selection.attr('tabindex'));1998this.$selection.attr('tabindex', '-1');1999};20002001Search.prototype.createPlaceholder = function (decorated, placeholder) {2002this.$search.attr('placeholder', placeholder.text);2003};20042005Search.prototype.update = function (decorated, data) {2006var searchHadFocus = this.$search[0] == document.activeElement;20072008this.$search.attr('placeholder', '');20092010decorated.call(this, data);20112012this.$selection.find('.select2-selection__rendered')2013.append(this.$searchContainer);20142015this.resizeSearch();2016if (searchHadFocus) {2017this.$search.focus();2018}2019};20202021Search.prototype.handleSearch = function () {2022this.resizeSearch();20232024if (!this._keyUpPrevented) {2025var input = this.$search.val();20262027this.trigger('query', {2028term: input2029});2030}20312032this._keyUpPrevented = false;2033};20342035Search.prototype.searchRemoveChoice = function (decorated, item) {2036this.trigger('unselect', {2037data: item2038});20392040this.$search.val(item.text);2041this.handleSearch();2042};20432044Search.prototype.resizeSearch = function () {2045this.$search.css('width', '25px');20462047var width = '';20482049if (this.$search.attr('placeholder') !== '') {2050width = this.$selection.find('.select2-selection__rendered').innerWidth();2051} else {2052var minimumWidth = this.$search.val().length + 1;20532054width = (minimumWidth * 0.75) + 'em';2055}20562057this.$search.css('width', width);2058};20592060return Search;2061});20622063S2.define('select2/selection/eventRelay',[2064'jquery'2065], function ($) {2066function EventRelay () { }20672068EventRelay.prototype.bind = function (decorated, container, $container) {2069var self = this;2070var relayEvents = [2071'open', 'opening',2072'close', 'closing',2073'select', 'selecting',2074'unselect', 'unselecting'2075];20762077var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];20782079decorated.call(this, container, $container);20802081container.on('*', function (name, params) {2082// Ignore events that should not be relayed2083if ($.inArray(name, relayEvents) === -1) {2084return;2085}20862087// The parameters should always be an object2088params = params || {};20892090// Generate the jQuery event for the Select2 event2091var evt = $.Event('select2:' + name, {2092params: params2093});20942095self.$element.trigger(evt);20962097// Only handle preventable events if it was one2098if ($.inArray(name, preventableEvents) === -1) {2099return;2100}21012102params.prevented = evt.isDefaultPrevented();2103});2104};21052106return EventRelay;2107});21082109S2.define('select2/translation',[2110'jquery',2111'require'2112], function ($, require) {2113function Translation (dict) {2114this.dict = dict || {};2115}21162117Translation.prototype.all = function () {2118return this.dict;2119};21202121Translation.prototype.get = function (key) {2122return this.dict[key];2123};21242125Translation.prototype.extend = function (translation) {2126this.dict = $.extend({}, translation.all(), this.dict);2127};21282129// Static functions21302131Translation._cache = {};21322133Translation.loadPath = function (path) {2134if (!(path in Translation._cache)) {2135var translations = require(path);21362137Translation._cache[path] = translations;2138}21392140return new Translation(Translation._cache[path]);2141};21422143return Translation;2144});21452146S2.define('select2/diacritics',[2147], function () {2148var diacritics = {2149'\u24B6': 'A',2150'\uFF21': 'A',2151'\u00C0': 'A',2152'\u00C1': 'A',2153'\u00C2': 'A',2154'\u1EA6': 'A',2155'\u1EA4': 'A',2156'\u1EAA': 'A',2157'\u1EA8': 'A',2158'\u00C3': 'A',2159'\u0100': 'A',2160'\u0102': 'A',2161'\u1EB0': 'A',2162'\u1EAE': 'A',2163'\u1EB4': 'A',2164'\u1EB2': 'A',2165'\u0226': 'A',2166'\u01E0': 'A',2167'\u00C4': 'A',2168'\u01DE': 'A',2169'\u1EA2': 'A',2170'\u00C5': 'A',2171'\u01FA': 'A',2172'\u01CD': 'A',2173'\u0200': 'A',2174'\u0202': 'A',2175'\u1EA0': 'A',2176'\u1EAC': 'A',2177'\u1EB6': 'A',2178'\u1E00': 'A',2179'\u0104': 'A',2180'\u023A': 'A',2181'\u2C6F': 'A',2182'\uA732': 'AA',2183'\u00C6': 'AE',2184'\u01FC': 'AE',2185'\u01E2': 'AE',2186'\uA734': 'AO',2187'\uA736': 'AU',2188'\uA738': 'AV',2189'\uA73A': 'AV',2190'\uA73C': 'AY',2191'\u24B7': 'B',2192'\uFF22': 'B',2193'\u1E02': 'B',2194'\u1E04': 'B',2195'\u1E06': 'B',2196'\u0243': 'B',2197'\u0182': 'B',2198'\u0181': 'B',2199'\u24B8': 'C',2200'\uFF23': 'C',2201'\u0106': 'C',2202'\u0108': 'C',2203'\u010A': 'C',2204'\u010C': 'C',2205'\u00C7': 'C',2206'\u1E08': 'C',2207'\u0187': 'C',2208'\u023B': 'C',2209'\uA73E': 'C',2210'\u24B9': 'D',2211'\uFF24': 'D',2212'\u1E0A': 'D',2213'\u010E': 'D',2214'\u1E0C': 'D',2215'\u1E10': 'D',2216'\u1E12': 'D',2217'\u1E0E': 'D',2218'\u0110': 'D',2219'\u018B': 'D',2220'\u018A': 'D',2221'\u0189': 'D',2222'\uA779': 'D',2223'\u01F1': 'DZ',2224'\u01C4': 'DZ',2225'\u01F2': 'Dz',2226'\u01C5': 'Dz',2227'\u24BA': 'E',2228'\uFF25': 'E',2229'\u00C8': 'E',2230'\u00C9': 'E',2231'\u00CA': 'E',2232'\u1EC0': 'E',2233'\u1EBE': 'E',2234'\u1EC4': 'E',2235'\u1EC2': 'E',2236'\u1EBC': 'E',2237'\u0112': 'E',2238'\u1E14': 'E',2239'\u1E16': 'E',2240'\u0114': 'E',2241'\u0116': 'E',2242'\u00CB': 'E',2243'\u1EBA': 'E',2244'\u011A': 'E',2245'\u0204': 'E',2246'\u0206': 'E',2247'\u1EB8': 'E',2248'\u1EC6': 'E',2249'\u0228': 'E',2250'\u1E1C': 'E',2251'\u0118': 'E',2252'\u1E18': 'E',2253'\u1E1A': 'E',2254'\u0190': 'E',2255'\u018E': 'E',2256'\u24BB': 'F',2257'\uFF26': 'F',2258'\u1E1E': 'F',2259'\u0191': 'F',2260'\uA77B': 'F',2261'\u24BC': 'G',2262'\uFF27': 'G',2263'\u01F4': 'G',2264'\u011C': 'G',2265'\u1E20': 'G',2266'\u011E': 'G',2267'\u0120': 'G',2268'\u01E6': 'G',2269'\u0122': 'G',2270'\u01E4': 'G',2271'\u0193': 'G',2272'\uA7A0': 'G',2273'\uA77D': 'G',2274'\uA77E': 'G',2275'\u24BD': 'H',2276'\uFF28': 'H',2277'\u0124': 'H',2278'\u1E22': 'H',2279'\u1E26': 'H',2280'\u021E': 'H',2281'\u1E24': 'H',2282'\u1E28': 'H',2283'\u1E2A': 'H',2284'\u0126': 'H',2285'\u2C67': 'H',2286'\u2C75': 'H',2287'\uA78D': 'H',2288'\u24BE': 'I',2289'\uFF29': 'I',2290'\u00CC': 'I',2291'\u00CD': 'I',2292'\u00CE': 'I',2293'\u0128': 'I',2294'\u012A': 'I',2295'\u012C': 'I',2296'\u0130': 'I',2297'\u00CF': 'I',2298'\u1E2E': 'I',2299'\u1EC8': 'I',2300'\u01CF': 'I',2301'\u0208': 'I',2302'\u020A': 'I',2303'\u1ECA': 'I',2304'\u012E': 'I',2305'\u1E2C': 'I',2306'\u0197': 'I',2307'\u24BF': 'J',2308'\uFF2A': 'J',2309'\u0134': 'J',2310'\u0248': 'J',2311'\u24C0': 'K',2312'\uFF2B': 'K',2313'\u1E30': 'K',2314'\u01E8': 'K',2315'\u1E32': 'K',2316'\u0136': 'K',2317'\u1E34': 'K',2318'\u0198': 'K',2319'\u2C69': 'K',2320'\uA740': 'K',2321'\uA742': 'K',2322'\uA744': 'K',2323'\uA7A2': 'K',2324'\u24C1': 'L',2325'\uFF2C': 'L',2326'\u013F': 'L',2327'\u0139': 'L',2328'\u013D': 'L',2329'\u1E36': 'L',2330'\u1E38': 'L',2331'\u013B': 'L',2332'\u1E3C': 'L',2333'\u1E3A': 'L',2334'\u0141': 'L',2335'\u023D': 'L',2336'\u2C62': 'L',2337'\u2C60': 'L',2338'\uA748': 'L',2339'\uA746': 'L',2340'\uA780': 'L',2341'\u01C7': 'LJ',2342'\u01C8': 'Lj',2343'\u24C2': 'M',2344'\uFF2D': 'M',2345'\u1E3E': 'M',2346'\u1E40': 'M',2347'\u1E42': 'M',2348'\u2C6E': 'M',2349'\u019C': 'M',2350'\u24C3': 'N',2351'\uFF2E': 'N',2352'\u01F8': 'N',2353'\u0143': 'N',2354'\u00D1': 'N',2355'\u1E44': 'N',2356'\u0147': 'N',2357'\u1E46': 'N',2358'\u0145': 'N',2359'\u1E4A': 'N',2360'\u1E48': 'N',2361'\u0220': 'N',2362'\u019D': 'N',2363'\uA790': 'N',2364'\uA7A4': 'N',2365'\u01CA': 'NJ',2366'\u01CB': 'Nj',2367'\u24C4': 'O',2368'\uFF2F': 'O',2369'\u00D2': 'O',2370'\u00D3': 'O',2371'\u00D4': 'O',2372'\u1ED2': 'O',2373'\u1ED0': 'O',2374'\u1ED6': 'O',2375'\u1ED4': 'O',2376'\u00D5': 'O',2377'\u1E4C': 'O',2378'\u022C': 'O',2379'\u1E4E': 'O',2380'\u014C': 'O',2381'\u1E50': 'O',2382'\u1E52': 'O',2383'\u014E': 'O',2384'\u022E': 'O',2385'\u0230': 'O',2386'\u00D6': 'O',2387'\u022A': 'O',2388'\u1ECE': 'O',2389'\u0150': 'O',2390'\u01D1': 'O',2391'\u020C': 'O',2392'\u020E': 'O',2393'\u01A0': 'O',2394'\u1EDC': 'O',2395'\u1EDA': 'O',2396'\u1EE0': 'O',2397'\u1EDE': 'O',2398'\u1EE2': 'O',2399'\u1ECC': 'O',2400'\u1ED8': 'O',2401'\u01EA': 'O',2402'\u01EC': 'O',2403'\u00D8': 'O',2404'\u01FE': 'O',2405'\u0186': 'O',2406'\u019F': 'O',2407'\uA74A': 'O',2408'\uA74C': 'O',2409'\u01A2': 'OI',2410'\uA74E': 'OO',2411'\u0222': 'OU',2412'\u24C5': 'P',2413'\uFF30': 'P',2414'\u1E54': 'P',2415'\u1E56': 'P',2416'\u01A4': 'P',2417'\u2C63': 'P',2418'\uA750': 'P',2419'\uA752': 'P',2420'\uA754': 'P',2421'\u24C6': 'Q',2422'\uFF31': 'Q',2423'\uA756': 'Q',2424'\uA758': 'Q',2425'\u024A': 'Q',2426'\u24C7': 'R',2427'\uFF32': 'R',2428'\u0154': 'R',2429'\u1E58': 'R',2430'\u0158': 'R',2431'\u0210': 'R',2432'\u0212': 'R',2433'\u1E5A': 'R',2434'\u1E5C': 'R',2435'\u0156': 'R',2436'\u1E5E': 'R',2437'\u024C': 'R',2438'\u2C64': 'R',2439'\uA75A': 'R',2440'\uA7A6': 'R',2441'\uA782': 'R',2442'\u24C8': 'S',2443'\uFF33': 'S',2444'\u1E9E': 'S',2445'\u015A': 'S',2446'\u1E64': 'S',2447'\u015C': 'S',2448'\u1E60': 'S',2449'\u0160': 'S',2450'\u1E66': 'S',2451'\u1E62': 'S',2452'\u1E68': 'S',2453'\u0218': 'S',2454'\u015E': 'S',2455'\u2C7E': 'S',2456'\uA7A8': 'S',2457'\uA784': 'S',2458'\u24C9': 'T',2459'\uFF34': 'T',2460'\u1E6A': 'T',2461'\u0164': 'T',2462'\u1E6C': 'T',2463'\u021A': 'T',2464'\u0162': 'T',2465'\u1E70': 'T',2466'\u1E6E': 'T',2467'\u0166': 'T',2468'\u01AC': 'T',2469'\u01AE': 'T',2470'\u023E': 'T',2471'\uA786': 'T',2472'\uA728': 'TZ',2473'\u24CA': 'U',2474'\uFF35': 'U',2475'\u00D9': 'U',2476'\u00DA': 'U',2477'\u00DB': 'U',2478'\u0168': 'U',2479'\u1E78': 'U',2480'\u016A': 'U',2481'\u1E7A': 'U',2482'\u016C': 'U',2483'\u00DC': 'U',2484'\u01DB': 'U',2485'\u01D7': 'U',2486'\u01D5': 'U',2487'\u01D9': 'U',2488'\u1EE6': 'U',2489'\u016E': 'U',2490'\u0170': 'U',2491'\u01D3': 'U',2492'\u0214': 'U',2493'\u0216': 'U',2494'\u01AF': 'U',2495'\u1EEA': 'U',2496'\u1EE8': 'U',2497'\u1EEE': 'U',2498'\u1EEC': 'U',2499'\u1EF0': 'U',2500'\u1EE4': 'U',2501'\u1E72': 'U',2502'\u0172': 'U',2503'\u1E76': 'U',2504'\u1E74': 'U',2505'\u0244': 'U',2506'\u24CB': 'V',2507'\uFF36': 'V',2508'\u1E7C': 'V',2509'\u1E7E': 'V',2510'\u01B2': 'V',2511'\uA75E': 'V',2512'\u0245': 'V',2513'\uA760': 'VY',2514'\u24CC': 'W',2515'\uFF37': 'W',2516'\u1E80': 'W',2517'\u1E82': 'W',2518'\u0174': 'W',2519'\u1E86': 'W',2520'\u1E84': 'W',2521'\u1E88': 'W',2522'\u2C72': 'W',2523'\u24CD': 'X',2524'\uFF38': 'X',2525'\u1E8A': 'X',2526'\u1E8C': 'X',2527'\u24CE': 'Y',2528'\uFF39': 'Y',2529'\u1EF2': 'Y',2530'\u00DD': 'Y',2531'\u0176': 'Y',2532'\u1EF8': 'Y',2533'\u0232': 'Y',2534'\u1E8E': 'Y',2535'\u0178': 'Y',2536'\u1EF6': 'Y',2537'\u1EF4': 'Y',2538'\u01B3': 'Y',2539'\u024E': 'Y',2540'\u1EFE': 'Y',2541'\u24CF': 'Z',2542'\uFF3A': 'Z',2543'\u0179': 'Z',2544'\u1E90': 'Z',2545'\u017B': 'Z',2546'\u017D': 'Z',2547'\u1E92': 'Z',2548'\u1E94': 'Z',2549'\u01B5': 'Z',2550'\u0224': 'Z',2551'\u2C7F': 'Z',2552'\u2C6B': 'Z',2553'\uA762': 'Z',2554'\u24D0': 'a',2555'\uFF41': 'a',2556'\u1E9A': 'a',2557'\u00E0': 'a',2558'\u00E1': 'a',2559'\u00E2': 'a',2560'\u1EA7': 'a',2561'\u1EA5': 'a',2562'\u1EAB': 'a',2563'\u1EA9': 'a',2564'\u00E3': 'a',2565'\u0101': 'a',2566'\u0103': 'a',2567'\u1EB1': 'a',2568'\u1EAF': 'a',2569'\u1EB5': 'a',2570'\u1EB3': 'a',2571'\u0227': 'a',2572'\u01E1': 'a',2573'\u00E4': 'a',2574'\u01DF': 'a',2575'\u1EA3': 'a',2576'\u00E5': 'a',2577'\u01FB': 'a',2578'\u01CE': 'a',2579'\u0201': 'a',2580'\u0203': 'a',2581'\u1EA1': 'a',2582'\u1EAD': 'a',2583'\u1EB7': 'a',2584'\u1E01': 'a',2585'\u0105': 'a',2586'\u2C65': 'a',2587'\u0250': 'a',2588'\uA733': 'aa',2589'\u00E6': 'ae',2590'\u01FD': 'ae',2591'\u01E3': 'ae',2592'\uA735': 'ao',2593'\uA737': 'au',2594'\uA739': 'av',2595'\uA73B': 'av',2596'\uA73D': 'ay',2597'\u24D1': 'b',2598'\uFF42': 'b',2599'\u1E03': 'b',2600'\u1E05': 'b',2601'\u1E07': 'b',2602'\u0180': 'b',2603'\u0183': 'b',2604'\u0253': 'b',2605'\u24D2': 'c',2606'\uFF43': 'c',2607'\u0107': 'c',2608'\u0109': 'c',2609'\u010B': 'c',2610'\u010D': 'c',2611'\u00E7': 'c',2612'\u1E09': 'c',2613'\u0188': 'c',2614'\u023C': 'c',2615'\uA73F': 'c',2616'\u2184': 'c',2617'\u24D3': 'd',2618'\uFF44': 'd',2619'\u1E0B': 'd',2620'\u010F': 'd',2621'\u1E0D': 'd',2622'\u1E11': 'd',2623'\u1E13': 'd',2624'\u1E0F': 'd',2625'\u0111': 'd',2626'\u018C': 'd',2627'\u0256': 'd',2628'\u0257': 'd',2629'\uA77A': 'd',2630'\u01F3': 'dz',2631'\u01C6': 'dz',2632'\u24D4': 'e',2633'\uFF45': 'e',2634'\u00E8': 'e',2635'\u00E9': 'e',2636'\u00EA': 'e',2637'\u1EC1': 'e',2638'\u1EBF': 'e',2639'\u1EC5': 'e',2640'\u1EC3': 'e',2641'\u1EBD': 'e',2642'\u0113': 'e',2643'\u1E15': 'e',2644'\u1E17': 'e',2645'\u0115': 'e',2646'\u0117': 'e',2647'\u00EB': 'e',2648'\u1EBB': 'e',2649'\u011B': 'e',2650'\u0205': 'e',2651'\u0207': 'e',2652'\u1EB9': 'e',2653'\u1EC7': 'e',2654'\u0229': 'e',2655'\u1E1D': 'e',2656'\u0119': 'e',2657'\u1E19': 'e',2658'\u1E1B': 'e',2659'\u0247': 'e',2660'\u025B': 'e',2661'\u01DD': 'e',2662'\u24D5': 'f',2663'\uFF46': 'f',2664'\u1E1F': 'f',2665'\u0192': 'f',2666'\uA77C': 'f',2667'\u24D6': 'g',2668'\uFF47': 'g',2669'\u01F5': 'g',2670'\u011D': 'g',2671'\u1E21': 'g',2672'\u011F': 'g',2673'\u0121': 'g',2674'\u01E7': 'g',2675'\u0123': 'g',2676'\u01E5': 'g',2677'\u0260': 'g',2678'\uA7A1': 'g',2679'\u1D79': 'g',2680'\uA77F': 'g',2681'\u24D7': 'h',2682'\uFF48': 'h',2683'\u0125': 'h',2684'\u1E23': 'h',2685'\u1E27': 'h',2686'\u021F': 'h',2687'\u1E25': 'h',2688'\u1E29': 'h',2689'\u1E2B': 'h',2690'\u1E96': 'h',2691'\u0127': 'h',2692'\u2C68': 'h',2693'\u2C76': 'h',2694'\u0265': 'h',2695'\u0195': 'hv',2696'\u24D8': 'i',2697'\uFF49': 'i',2698'\u00EC': 'i',2699'\u00ED': 'i',2700'\u00EE': 'i',2701'\u0129': 'i',2702'\u012B': 'i',2703'\u012D': 'i',2704'\u00EF': 'i',2705'\u1E2F': 'i',2706'\u1EC9': 'i',2707'\u01D0': 'i',2708'\u0209': 'i',2709'\u020B': 'i',2710'\u1ECB': 'i',2711'\u012F': 'i',2712'\u1E2D': 'i',2713'\u0268': 'i',2714'\u0131': 'i',2715'\u24D9': 'j',2716'\uFF4A': 'j',2717'\u0135': 'j',2718'\u01F0': 'j',2719'\u0249': 'j',2720'\u24DA': 'k',2721'\uFF4B': 'k',2722'\u1E31': 'k',2723'\u01E9': 'k',2724'\u1E33': 'k',2725'\u0137': 'k',2726'\u1E35': 'k',2727'\u0199': 'k',2728'\u2C6A': 'k',2729'\uA741': 'k',2730'\uA743': 'k',2731'\uA745': 'k',2732'\uA7A3': 'k',2733'\u24DB': 'l',2734'\uFF4C': 'l',2735'\u0140': 'l',2736'\u013A': 'l',2737'\u013E': 'l',2738'\u1E37': 'l',2739'\u1E39': 'l',2740'\u013C': 'l',2741'\u1E3D': 'l',2742'\u1E3B': 'l',2743'\u017F': 'l',2744'\u0142': 'l',2745'\u019A': 'l',2746'\u026B': 'l',2747'\u2C61': 'l',2748'\uA749': 'l',2749'\uA781': 'l',2750'\uA747': 'l',2751'\u01C9': 'lj',2752'\u24DC': 'm',2753'\uFF4D': 'm',2754'\u1E3F': 'm',2755'\u1E41': 'm',2756'\u1E43': 'm',2757'\u0271': 'm',2758'\u026F': 'm',2759'\u24DD': 'n',2760'\uFF4E': 'n',2761'\u01F9': 'n',2762'\u0144': 'n',2763'\u00F1': 'n',2764'\u1E45': 'n',2765'\u0148': 'n',2766'\u1E47': 'n',2767'\u0146': 'n',2768'\u1E4B': 'n',2769'\u1E49': 'n',2770'\u019E': 'n',2771'\u0272': 'n',2772'\u0149': 'n',2773'\uA791': 'n',2774'\uA7A5': 'n',2775'\u01CC': 'nj',2776'\u24DE': 'o',2777'\uFF4F': 'o',2778'\u00F2': 'o',2779'\u00F3': 'o',2780'\u00F4': 'o',2781'\u1ED3': 'o',2782'\u1ED1': 'o',2783'\u1ED7': 'o',2784'\u1ED5': 'o',2785'\u00F5': 'o',2786'\u1E4D': 'o',2787'\u022D': 'o',2788'\u1E4F': 'o',2789'\u014D': 'o',2790'\u1E51': 'o',2791'\u1E53': 'o',2792'\u014F': 'o',2793'\u022F': 'o',2794'\u0231': 'o',2795'\u00F6': 'o',2796'\u022B': 'o',2797'\u1ECF': 'o',2798'\u0151': 'o',2799'\u01D2': 'o',2800'\u020D': 'o',2801'\u020F': 'o',2802'\u01A1': 'o',2803'\u1EDD': 'o',2804'\u1EDB': 'o',2805'\u1EE1': 'o',2806'\u1EDF': 'o',2807'\u1EE3': 'o',2808'\u1ECD': 'o',2809'\u1ED9': 'o',2810'\u01EB': 'o',2811'\u01ED': 'o',2812'\u00F8': 'o',2813'\u01FF': 'o',2814'\u0254': 'o',2815'\uA74B': 'o',2816'\uA74D': 'o',2817'\u0275': 'o',2818'\u01A3': 'oi',2819'\u0223': 'ou',2820'\uA74F': 'oo',2821'\u24DF': 'p',2822'\uFF50': 'p',2823'\u1E55': 'p',2824'\u1E57': 'p',2825'\u01A5': 'p',2826'\u1D7D': 'p',2827'\uA751': 'p',2828'\uA753': 'p',2829'\uA755': 'p',2830'\u24E0': 'q',2831'\uFF51': 'q',2832'\u024B': 'q',2833'\uA757': 'q',2834'\uA759': 'q',2835'\u24E1': 'r',2836'\uFF52': 'r',2837'\u0155': 'r',2838'\u1E59': 'r',2839'\u0159': 'r',2840'\u0211': 'r',2841'\u0213': 'r',2842'\u1E5B': 'r',2843'\u1E5D': 'r',2844'\u0157': 'r',2845'\u1E5F': 'r',2846'\u024D': 'r',2847'\u027D': 'r',2848'\uA75B': 'r',2849'\uA7A7': 'r',2850'\uA783': 'r',2851'\u24E2': 's',2852'\uFF53': 's',2853'\u00DF': 's',2854'\u015B': 's',2855'\u1E65': 's',2856'\u015D': 's',2857'\u1E61': 's',2858'\u0161': 's',2859'\u1E67': 's',2860'\u1E63': 's',2861'\u1E69': 's',2862'\u0219': 's',2863'\u015F': 's',2864'\u023F': 's',2865'\uA7A9': 's',2866'\uA785': 's',2867'\u1E9B': 's',2868'\u24E3': 't',2869'\uFF54': 't',2870'\u1E6B': 't',2871'\u1E97': 't',2872'\u0165': 't',2873'\u1E6D': 't',2874'\u021B': 't',2875'\u0163': 't',2876'\u1E71': 't',2877'\u1E6F': 't',2878'\u0167': 't',2879'\u01AD': 't',2880'\u0288': 't',2881'\u2C66': 't',2882'\uA787': 't',2883'\uA729': 'tz',2884'\u24E4': 'u',2885'\uFF55': 'u',2886'\u00F9': 'u',2887'\u00FA': 'u',2888'\u00FB': 'u',2889'\u0169': 'u',2890'\u1E79': 'u',2891'\u016B': 'u',2892'\u1E7B': 'u',2893'\u016D': 'u',2894'\u00FC': 'u',2895'\u01DC': 'u',2896'\u01D8': 'u',2897'\u01D6': 'u',2898'\u01DA': 'u',2899'\u1EE7': 'u',2900'\u016F': 'u',2901'\u0171': 'u',2902'\u01D4': 'u',2903'\u0215': 'u',2904'\u0217': 'u',2905'\u01B0': 'u',2906'\u1EEB': 'u',2907'\u1EE9': 'u',2908'\u1EEF': 'u',2909'\u1EED': 'u',2910'\u1EF1': 'u',2911'\u1EE5': 'u',2912'\u1E73': 'u',2913'\u0173': 'u',2914'\u1E77': 'u',2915'\u1E75': 'u',2916'\u0289': 'u',2917'\u24E5': 'v',2918'\uFF56': 'v',2919'\u1E7D': 'v',2920'\u1E7F': 'v',2921'\u028B': 'v',2922'\uA75F': 'v',2923'\u028C': 'v',2924'\uA761': 'vy',2925'\u24E6': 'w',2926'\uFF57': 'w',2927'\u1E81': 'w',2928'\u1E83': 'w',2929'\u0175': 'w',2930'\u1E87': 'w',2931'\u1E85': 'w',2932'\u1E98': 'w',2933'\u1E89': 'w',2934'\u2C73': 'w',2935'\u24E7': 'x',2936'\uFF58': 'x',2937'\u1E8B': 'x',2938'\u1E8D': 'x',2939'\u24E8': 'y',2940'\uFF59': 'y',2941'\u1EF3': 'y',2942'\u00FD': 'y',2943'\u0177': 'y',2944'\u1EF9': 'y',2945'\u0233': 'y',2946'\u1E8F': 'y',2947'\u00FF': 'y',2948'\u1EF7': 'y',2949'\u1E99': 'y',2950'\u1EF5': 'y',2951'\u01B4': 'y',2952'\u024F': 'y',2953'\u1EFF': 'y',2954'\u24E9': 'z',2955'\uFF5A': 'z',2956'\u017A': 'z',2957'\u1E91': 'z',2958'\u017C': 'z',2959'\u017E': 'z',2960'\u1E93': 'z',2961'\u1E95': 'z',2962'\u01B6': 'z',2963'\u0225': 'z',2964'\u0240': 'z',2965'\u2C6C': 'z',2966'\uA763': 'z',2967'\u0386': '\u0391',2968'\u0388': '\u0395',2969'\u0389': '\u0397',2970'\u038A': '\u0399',2971'\u03AA': '\u0399',2972'\u038C': '\u039F',2973'\u038E': '\u03A5',2974'\u03AB': '\u03A5',2975'\u038F': '\u03A9',2976'\u03AC': '\u03B1',2977'\u03AD': '\u03B5',2978'\u03AE': '\u03B7',2979'\u03AF': '\u03B9',2980'\u03CA': '\u03B9',2981'\u0390': '\u03B9',2982'\u03CC': '\u03BF',2983'\u03CD': '\u03C5',2984'\u03CB': '\u03C5',2985'\u03B0': '\u03C5',2986'\u03C9': '\u03C9',2987'\u03C2': '\u03C3'2988};29892990return diacritics;2991});29922993S2.define('select2/data/base',[2994'../utils'2995], function (Utils) {2996function BaseAdapter ($element, options) {2997BaseAdapter.__super__.constructor.call(this);2998}29993000Utils.Extend(BaseAdapter, Utils.Observable);30013002BaseAdapter.prototype.current = function (callback) {3003throw new Error('The `current` method must be defined in child classes.');3004};30053006BaseAdapter.prototype.query = function (params, callback) {3007throw new Error('The `query` method must be defined in child classes.');3008};30093010BaseAdapter.prototype.bind = function (container, $container) {3011// Can be implemented in subclasses3012};30133014BaseAdapter.prototype.destroy = function () {3015// Can be implemented in subclasses3016};30173018BaseAdapter.prototype.generateResultId = function (container, data) {3019var id = container.id + '-result-';30203021id += Utils.generateChars(4);30223023if (data.id != null) {3024id += '-' + data.id.toString();3025} else {3026id += '-' + Utils.generateChars(4);3027}3028return id;3029};30303031return BaseAdapter;3032});30333034S2.define('select2/data/select',[3035'./base',3036'../utils',3037'jquery'3038], function (BaseAdapter, Utils, $) {3039function SelectAdapter ($element, options) {3040this.$element = $element;3041this.options = options;30423043SelectAdapter.__super__.constructor.call(this);3044}30453046Utils.Extend(SelectAdapter, BaseAdapter);30473048SelectAdapter.prototype.current = function (callback) {3049var data = [];3050var self = this;30513052this.$element.find(':selected').each(function () {3053var $option = $(this);30543055var option = self.item($option);30563057data.push(option);3058});30593060callback(data);3061};30623063SelectAdapter.prototype.select = function (data) {3064var self = this;30653066data.selected = true;30673068// If data.element is a DOM node, use it instead3069if ($(data.element).is('option')) {3070data.element.selected = true;30713072this.$element.trigger('change');30733074return;3075}30763077if (this.$element.prop('multiple')) {3078this.current(function (currentData) {3079var val = [];30803081data = [data];3082data.push.apply(data, currentData);30833084for (var d = 0; d < data.length; d++) {3085var id = data[d].id;30863087if ($.inArray(id, val) === -1) {3088val.push(id);3089}3090}30913092self.$element.val(val);3093self.$element.trigger('change');3094});3095} else {3096var val = data.id;30973098this.$element.val(val);3099this.$element.trigger('change');3100}3101};31023103SelectAdapter.prototype.unselect = function (data) {3104var self = this;31053106if (!this.$element.prop('multiple')) {3107return;3108}31093110data.selected = false;31113112if ($(data.element).is('option')) {3113data.element.selected = false;31143115this.$element.trigger('change');31163117return;3118}31193120this.current(function (currentData) {3121var val = [];31223123for (var d = 0; d < currentData.length; d++) {3124var id = currentData[d].id;31253126if (id !== data.id && $.inArray(id, val) === -1) {3127val.push(id);3128}3129}31303131self.$element.val(val);31323133self.$element.trigger('change');3134});3135};31363137SelectAdapter.prototype.bind = function (container, $container) {3138var self = this;31393140this.container = container;31413142container.on('select', function (params) {3143self.select(params.data);3144});31453146container.on('unselect', function (params) {3147self.unselect(params.data);3148});3149};31503151SelectAdapter.prototype.destroy = function () {3152// Remove anything added to child elements3153this.$element.find('*').each(function () {3154// Remove any custom data set by Select23155$.removeData(this, 'data');3156});3157};31583159SelectAdapter.prototype.query = function (params, callback) {3160var data = [];3161var self = this;31623163var $options = this.$element.children();31643165$options.each(function () {3166var $option = $(this);31673168if (!$option.is('option') && !$option.is('optgroup')) {3169return;3170}31713172var option = self.item($option);31733174var matches = self.matches(params, option);31753176if (matches !== null) {3177data.push(matches);3178}3179});31803181callback({3182results: data3183});3184};31853186SelectAdapter.prototype.addOptions = function ($options) {3187Utils.appendMany(this.$element, $options);3188};31893190SelectAdapter.prototype.option = function (data) {3191var option;31923193if (data.children) {3194option = document.createElement('optgroup');3195option.label = data.text;3196} else {3197option = document.createElement('option');31983199if (option.textContent !== undefined) {3200option.textContent = data.text;3201} else {3202option.innerText = data.text;3203}3204}32053206if (data.id !== undefined) {3207option.value = data.id;3208}32093210if (data.disabled) {3211option.disabled = true;3212}32133214if (data.selected) {3215option.selected = true;3216}32173218if (data.title) {3219option.title = data.title;3220}32213222var $option = $(option);32233224var normalizedData = this._normalizeItem(data);3225normalizedData.element = option;32263227// Override the option's data with the combined data3228$.data(option, 'data', normalizedData);32293230return $option;3231};32323233SelectAdapter.prototype.item = function ($option) {3234var data = {};32353236data = $.data($option[0], 'data');32373238if (data != null) {3239return data;3240}32413242if ($option.is('option')) {3243data = {3244id: $option.val(),3245text: $option.text(),3246disabled: $option.prop('disabled'),3247selected: $option.prop('selected'),3248title: $option.prop('title')3249};3250} else if ($option.is('optgroup')) {3251data = {3252text: $option.prop('label'),3253children: [],3254title: $option.prop('title')3255};32563257var $children = $option.children('option');3258var children = [];32593260for (var c = 0; c < $children.length; c++) {3261var $child = $($children[c]);32623263var child = this.item($child);32643265children.push(child);3266}32673268data.children = children;3269}32703271data = this._normalizeItem(data);3272data.element = $option[0];32733274$.data($option[0], 'data', data);32753276return data;3277};32783279SelectAdapter.prototype._normalizeItem = function (item) {3280if (!$.isPlainObject(item)) {3281item = {3282id: item,3283text: item3284};3285}32863287item = $.extend({}, {3288text: ''3289}, item);32903291var defaults = {3292selected: false,3293disabled: false3294};32953296if (item.id != null) {3297item.id = item.id.toString();3298}32993300if (item.text != null) {3301item.text = item.text.toString();3302}33033304if (item._resultId == null && item.id && this.container != null) {3305item._resultId = this.generateResultId(this.container, item);3306}33073308return $.extend({}, defaults, item);3309};33103311SelectAdapter.prototype.matches = function (params, data) {3312var matcher = this.options.get('matcher');33133314return matcher(params, data);3315};33163317return SelectAdapter;3318});33193320S2.define('select2/data/array',[3321'./select',3322'../utils',3323'jquery'3324], function (SelectAdapter, Utils, $) {3325function ArrayAdapter ($element, options) {3326var data = options.get('data') || [];33273328ArrayAdapter.__super__.constructor.call(this, $element, options);33293330this.addOptions(this.convertToOptions(data));3331}33323333Utils.Extend(ArrayAdapter, SelectAdapter);33343335ArrayAdapter.prototype.select = function (data) {3336var $option = this.$element.find('option').filter(function (i, elm) {3337return elm.value == data.id.toString();3338});33393340if ($option.length === 0) {3341$option = this.option(data);33423343this.addOptions($option);3344}33453346ArrayAdapter.__super__.select.call(this, data);3347};33483349ArrayAdapter.prototype.convertToOptions = function (data) {3350var self = this;33513352var $existing = this.$element.find('option');3353var existingIds = $existing.map(function () {3354return self.item($(this)).id;3355}).get();33563357var $options = [];33583359// Filter out all items except for the one passed in the argument3360function onlyItem (item) {3361return function () {3362return $(this).val() == item.id;3363};3364}33653366for (var d = 0; d < data.length; d++) {3367var item = this._normalizeItem(data[d]);33683369// Skip items which were pre-loaded, only merge the data3370if ($.inArray(item.id, existingIds) >= 0) {3371var $existingOption = $existing.filter(onlyItem(item));33723373var existingData = this.item($existingOption);3374var newData = $.extend(true, {}, item, existingData);33753376var $newOption = this.option(newData);33773378$existingOption.replaceWith($newOption);33793380continue;3381}33823383var $option = this.option(item);33843385if (item.children) {3386var $children = this.convertToOptions(item.children);33873388Utils.appendMany($option, $children);3389}33903391$options.push($option);3392}33933394return $options;3395};33963397return ArrayAdapter;3398});33993400S2.define('select2/data/ajax',[3401'./array',3402'../utils',3403'jquery'3404], function (ArrayAdapter, Utils, $) {3405function AjaxAdapter ($element, options) {3406this.ajaxOptions = this._applyDefaults(options.get('ajax'));34073408if (this.ajaxOptions.processResults != null) {3409this.processResults = this.ajaxOptions.processResults;3410}34113412AjaxAdapter.__super__.constructor.call(this, $element, options);3413}34143415Utils.Extend(AjaxAdapter, ArrayAdapter);34163417AjaxAdapter.prototype._applyDefaults = function (options) {3418var defaults = {3419data: function (params) {3420return $.extend({}, params, {3421q: params.term3422});3423},3424transport: function (params, success, failure) {3425var $request = $.ajax(params);34263427$request.then(success);3428$request.fail(failure);34293430return $request;3431}3432};34333434return $.extend({}, defaults, options, true);3435};34363437AjaxAdapter.prototype.processResults = function (results) {3438return results;3439};34403441AjaxAdapter.prototype.query = function (params, callback) {3442var matches = [];3443var self = this;34443445if (this._request != null) {3446// JSONP requests cannot always be aborted3447if ($.isFunction(this._request.abort)) {3448this._request.abort();3449}34503451this._request = null;3452}34533454var options = $.extend({3455type: 'GET'3456}, this.ajaxOptions);34573458if (typeof options.url === 'function') {3459options.url = options.url.call(this.$element, params);3460}34613462if (typeof options.data === 'function') {3463options.data = options.data.call(this.$element, params);3464}34653466function request () {3467var $request = options.transport(options, function (data) {3468var results = self.processResults(data, params);34693470if (self.options.get('debug') && window.console && console.error) {3471// Check to make sure that the response included a `results` key.3472if (!results || !results.results || !$.isArray(results.results)) {3473console.error(3474'Select2: The AJAX results did not return an array in the ' +3475'`results` key of the response.'3476);3477}3478}34793480callback(results);3481}, function () {3482// Attempt to detect if a request was aborted3483// Only works if the transport exposes a status property3484if ($request.status && $request.status === '0') {3485return;3486}34873488self.trigger('results:message', {3489message: 'errorLoading'3490});3491});34923493self._request = $request;3494}34953496if (this.ajaxOptions.delay && params.term != null) {3497if (this._queryTimeout) {3498window.clearTimeout(this._queryTimeout);3499}35003501this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);3502} else {3503request();3504}3505};35063507return AjaxAdapter;3508});35093510S2.define('select2/data/tags',[3511'jquery'3512], function ($) {3513function Tags (decorated, $element, options) {3514var tags = options.get('tags');35153516var createTag = options.get('createTag');35173518if (createTag !== undefined) {3519this.createTag = createTag;3520}35213522var insertTag = options.get('insertTag');35233524if (insertTag !== undefined) {3525this.insertTag = insertTag;3526}35273528decorated.call(this, $element, options);35293530if ($.isArray(tags)) {3531for (var t = 0; t < tags.length; t++) {3532var tag = tags[t];3533var item = this._normalizeItem(tag);35343535var $option = this.option(item);35363537this.$element.append($option);3538}3539}3540}35413542Tags.prototype.query = function (decorated, params, callback) {3543var self = this;35443545this._removeOldTags();35463547if (params.term == null || params.page != null) {3548decorated.call(this, params, callback);3549return;3550}35513552function wrapper (obj, child) {3553var data = obj.results;35543555for (var i = 0; i < data.length; i++) {3556var option = data[i];35573558var checkChildren = (3559option.children != null &&3560!wrapper({3561results: option.children3562}, true)3563);35643565var optionText = (option.text || '').toUpperCase();3566var paramsTerm = (params.term || '').toUpperCase();35673568var checkText = optionText === paramsTerm;35693570if (checkText || checkChildren) {3571if (child) {3572return false;3573}35743575obj.data = data;3576callback(obj);35773578return;3579}3580}35813582if (child) {3583return true;3584}35853586var tag = self.createTag(params);35873588if (tag != null) {3589var $option = self.option(tag);3590$option.attr('data-select2-tag', true);35913592self.addOptions([$option]);35933594self.insertTag(data, tag);3595}35963597obj.results = data;35983599callback(obj);3600}36013602decorated.call(this, params, wrapper);3603};36043605Tags.prototype.createTag = function (decorated, params) {3606var term = $.trim(params.term);36073608if (term === '') {3609return null;3610}36113612return {3613id: term,3614text: term3615};3616};36173618Tags.prototype.insertTag = function (_, data, tag) {3619data.unshift(tag);3620};36213622Tags.prototype._removeOldTags = function (_) {3623var tag = this._lastTag;36243625var $options = this.$element.find('option[data-select2-tag]');36263627$options.each(function () {3628if (this.selected) {3629return;3630}36313632$(this).remove();3633});3634};36353636return Tags;3637});36383639S2.define('select2/data/tokenizer',[3640'jquery'3641], function ($) {3642function Tokenizer (decorated, $element, options) {3643var tokenizer = options.get('tokenizer');36443645if (tokenizer !== undefined) {3646this.tokenizer = tokenizer;3647}36483649decorated.call(this, $element, options);3650}36513652Tokenizer.prototype.bind = function (decorated, container, $container) {3653decorated.call(this, container, $container);36543655this.$search = container.dropdown.$search || container.selection.$search ||3656$container.find('.select2-search__field');3657};36583659Tokenizer.prototype.query = function (decorated, params, callback) {3660var self = this;36613662function createAndSelect (data) {3663// Normalize the data object so we can use it for checks3664var item = self._normalizeItem(data);36653666// Check if the data object already exists as a tag3667// Select it if it doesn't3668var $existingOptions = self.$element.find('option').filter(function () {3669return $(this).val() === item.id;3670});36713672// If an existing option wasn't found for it, create the option3673if (!$existingOptions.length) {3674var $option = self.option(item);3675$option.attr('data-select2-tag', true);36763677self._removeOldTags();3678self.addOptions([$option]);3679}36803681// Select the item, now that we know there is an option for it3682select(item);3683}36843685function select (data) {3686self.trigger('select', {3687data: data3688});3689}36903691params.term = params.term || '';36923693var tokenData = this.tokenizer(params, this.options, createAndSelect);36943695if (tokenData.term !== params.term) {3696// Replace the search term if we have the search box3697if (this.$search.length) {3698this.$search.val(tokenData.term);3699this.$search.focus();3700}37013702params.term = tokenData.term;3703}37043705decorated.call(this, params, callback);3706};37073708Tokenizer.prototype.tokenizer = function (_, params, options, callback) {3709var separators = options.get('tokenSeparators') || [];3710var term = params.term;3711var i = 0;37123713var createTag = this.createTag || function (params) {3714return {3715id: params.term,3716text: params.term3717};3718};37193720while (i < term.length) {3721var termChar = term[i];37223723if ($.inArray(termChar, separators) === -1) {3724i++;37253726continue;3727}37283729var part = term.substr(0, i);3730var partParams = $.extend({}, params, {3731term: part3732});37333734var data = createTag(partParams);37353736if (data == null) {3737i++;3738continue;3739}37403741callback(data);37423743// Reset the term to not include the tokenized portion3744term = term.substr(i + 1) || '';3745i = 0;3746}37473748return {3749term: term3750};3751};37523753return Tokenizer;3754});37553756S2.define('select2/data/minimumInputLength',[37573758], function () {3759function MinimumInputLength (decorated, $e, options) {3760this.minimumInputLength = options.get('minimumInputLength');37613762decorated.call(this, $e, options);3763}37643765MinimumInputLength.prototype.query = function (decorated, params, callback) {3766params.term = params.term || '';37673768if (params.term.length < this.minimumInputLength) {3769this.trigger('results:message', {3770message: 'inputTooShort',3771args: {3772minimum: this.minimumInputLength,3773input: params.term,3774params: params3775}3776});37773778return;3779}37803781decorated.call(this, params, callback);3782};37833784return MinimumInputLength;3785});37863787S2.define('select2/data/maximumInputLength',[37883789], function () {3790function MaximumInputLength (decorated, $e, options) {3791this.maximumInputLength = options.get('maximumInputLength');37923793decorated.call(this, $e, options);3794}37953796MaximumInputLength.prototype.query = function (decorated, params, callback) {3797params.term = params.term || '';37983799if (this.maximumInputLength > 0 &&3800params.term.length > this.maximumInputLength) {3801this.trigger('results:message', {3802message: 'inputTooLong',3803args: {3804maximum: this.maximumInputLength,3805input: params.term,3806params: params3807}3808});38093810return;3811}38123813decorated.call(this, params, callback);3814};38153816return MaximumInputLength;3817});38183819S2.define('select2/data/maximumSelectionLength',[38203821], function (){3822function MaximumSelectionLength (decorated, $e, options) {3823this.maximumSelectionLength = options.get('maximumSelectionLength');38243825decorated.call(this, $e, options);3826}38273828MaximumSelectionLength.prototype.query =3829function (decorated, params, callback) {3830var self = this;38313832this.current(function (currentData) {3833var count = currentData != null ? currentData.length : 0;3834if (self.maximumSelectionLength > 0 &&3835count >= self.maximumSelectionLength) {3836self.trigger('results:message', {3837message: 'maximumSelected',3838args: {3839maximum: self.maximumSelectionLength3840}3841});3842return;3843}3844decorated.call(self, params, callback);3845});3846};38473848return MaximumSelectionLength;3849});38503851S2.define('select2/dropdown',[3852'jquery',3853'./utils'3854], function ($, Utils) {3855function Dropdown ($element, options) {3856this.$element = $element;3857this.options = options;38583859Dropdown.__super__.constructor.call(this);3860}38613862Utils.Extend(Dropdown, Utils.Observable);38633864Dropdown.prototype.render = function () {3865var $dropdown = $(3866'<span class="select2-dropdown">' +3867'<span class="select2-results"></span>' +3868'</span>'3869);38703871$dropdown.attr('dir', this.options.get('dir'));38723873this.$dropdown = $dropdown;38743875return $dropdown;3876};38773878Dropdown.prototype.bind = function () {3879// Should be implemented in subclasses3880};38813882Dropdown.prototype.position = function ($dropdown, $container) {3883// Should be implmented in subclasses3884};38853886Dropdown.prototype.destroy = function () {3887// Remove the dropdown from the DOM3888this.$dropdown.remove();3889};38903891return Dropdown;3892});38933894S2.define('select2/dropdown/search',[3895'jquery',3896'../utils'3897], function ($, Utils) {3898function Search () { }38993900Search.prototype.render = function (decorated) {3901var $rendered = decorated.call(this);39023903var $search = $(3904'<span class="select2-search select2-search--dropdown">' +3905'<input class="select2-search__field" type="search" tabindex="-1"' +3906' autocomplete="off" autocorrect="off" autocapitalize="off"' +3907' spellcheck="false" role="textbox" />' +3908'</span>'3909);39103911this.$searchContainer = $search;3912this.$search = $search.find('input');39133914$rendered.prepend($search);39153916return $rendered;3917};39183919Search.prototype.bind = function (decorated, container, $container) {3920var self = this;39213922decorated.call(this, container, $container);39233924this.$search.on('keydown', function (evt) {3925self.trigger('keypress', evt);39263927self._keyUpPrevented = evt.isDefaultPrevented();3928});39293930// Workaround for browsers which do not support the `input` event3931// This will prevent double-triggering of events for browsers which support3932// both the `keyup` and `input` events.3933this.$search.on('input', function (evt) {3934// Unbind the duplicated `keyup` event3935$(this).off('keyup');3936});39373938this.$search.on('keyup input', function (evt) {3939self.handleSearch(evt);3940});39413942container.on('open', function () {3943self.$search.attr('tabindex', 0);39443945self.$search.focus();39463947window.setTimeout(function () {3948self.$search.focus();3949}, 0);3950});39513952container.on('close', function () {3953self.$search.attr('tabindex', -1);39543955self.$search.val('');3956});39573958container.on('focus', function () {3959if (container.isOpen()) {3960self.$search.focus();3961}3962});39633964container.on('results:all', function (params) {3965if (params.query.term == null || params.query.term === '') {3966var showSearch = self.showSearch(params);39673968if (showSearch) {3969self.$searchContainer.removeClass('select2-search--hide');3970} else {3971self.$searchContainer.addClass('select2-search--hide');3972}3973}3974});3975};39763977Search.prototype.handleSearch = function (evt) {3978if (!this._keyUpPrevented) {3979var input = this.$search.val();39803981this.trigger('query', {3982term: input3983});3984}39853986this._keyUpPrevented = false;3987};39883989Search.prototype.showSearch = function (_, params) {3990return true;3991};39923993return Search;3994});39953996S2.define('select2/dropdown/hidePlaceholder',[39973998], function () {3999function HidePlaceholder (decorated, $element, options, dataAdapter) {4000this.placeholder = this.normalizePlaceholder(options.get('placeholder'));40014002decorated.call(this, $element, options, dataAdapter);4003}40044005HidePlaceholder.prototype.append = function (decorated, data) {4006data.results = this.removePlaceholder(data.results);40074008decorated.call(this, data);4009};40104011HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {4012if (typeof placeholder === 'string') {4013placeholder = {4014id: '',4015text: placeholder4016};4017}40184019return placeholder;4020};40214022HidePlaceholder.prototype.removePlaceholder = function (_, data) {4023var modifiedData = data.slice(0);40244025for (var d = data.length - 1; d >= 0; d--) {4026var item = data[d];40274028if (this.placeholder.id === item.id) {4029modifiedData.splice(d, 1);4030}4031}40324033return modifiedData;4034};40354036return HidePlaceholder;4037});40384039S2.define('select2/dropdown/infiniteScroll',[4040'jquery'4041], function ($) {4042function InfiniteScroll (decorated, $element, options, dataAdapter) {4043this.lastParams = {};40444045decorated.call(this, $element, options, dataAdapter);40464047this.$loadingMore = this.createLoadingMore();4048this.loading = false;4049}40504051InfiniteScroll.prototype.append = function (decorated, data) {4052this.$loadingMore.remove();4053this.loading = false;40544055decorated.call(this, data);40564057if (this.showLoadingMore(data)) {4058this.$results.append(this.$loadingMore);4059}4060};40614062InfiniteScroll.prototype.bind = function (decorated, container, $container) {4063var self = this;40644065decorated.call(this, container, $container);40664067container.on('query', function (params) {4068self.lastParams = params;4069self.loading = true;4070});40714072container.on('query:append', function (params) {4073self.lastParams = params;4074self.loading = true;4075});40764077this.$results.on('scroll', function () {4078var isLoadMoreVisible = $.contains(4079document.documentElement,4080self.$loadingMore[0]4081);40824083if (self.loading || !isLoadMoreVisible) {4084return;4085}40864087var currentOffset = self.$results.offset().top +4088self.$results.outerHeight(false);4089var loadingMoreOffset = self.$loadingMore.offset().top +4090self.$loadingMore.outerHeight(false);40914092if (currentOffset + 50 >= loadingMoreOffset) {4093self.loadMore();4094}4095});4096};40974098InfiniteScroll.prototype.loadMore = function () {4099this.loading = true;41004101var params = $.extend({}, {page: 1}, this.lastParams);41024103params.page++;41044105this.trigger('query:append', params);4106};41074108InfiniteScroll.prototype.showLoadingMore = function (_, data) {4109return data.pagination && data.pagination.more;4110};41114112InfiniteScroll.prototype.createLoadingMore = function () {4113var $option = $(4114'<li ' +4115'class="select2-results__option select2-results__option--load-more"' +4116'role="treeitem" aria-disabled="true"></li>'4117);41184119var message = this.options.get('translations').get('loadingMore');41204121$option.html(message(this.lastParams));41224123return $option;4124};41254126return InfiniteScroll;4127});41284129S2.define('select2/dropdown/attachBody',[4130'jquery',4131'../utils'4132], function ($, Utils) {4133function AttachBody (decorated, $element, options) {4134this.$dropdownParent = options.get('dropdownParent') || $(document.body);41354136decorated.call(this, $element, options);4137}41384139AttachBody.prototype.bind = function (decorated, container, $container) {4140var self = this;41414142var setupResultsEvents = false;41434144decorated.call(this, container, $container);41454146container.on('open', function () {4147self._showDropdown();4148self._attachPositioningHandler(container);41494150if (!setupResultsEvents) {4151setupResultsEvents = true;41524153container.on('results:all', function () {4154self._positionDropdown();4155self._resizeDropdown();4156});41574158container.on('results:append', function () {4159self._positionDropdown();4160self._resizeDropdown();4161});4162}4163});41644165container.on('close', function () {4166self._hideDropdown();4167self._detachPositioningHandler(container);4168});41694170this.$dropdownContainer.on('mousedown', function (evt) {4171evt.stopPropagation();4172});4173};41744175AttachBody.prototype.destroy = function (decorated) {4176decorated.call(this);41774178this.$dropdownContainer.remove();4179};41804181AttachBody.prototype.position = function (decorated, $dropdown, $container) {4182// Clone all of the container classes4183$dropdown.attr('class', $container.attr('class'));41844185$dropdown.removeClass('select2');4186$dropdown.addClass('select2-container--open');41874188$dropdown.css({4189position: 'absolute',4190top: -9999994191});41924193this.$container = $container;4194};41954196AttachBody.prototype.render = function (decorated) {4197var $container = $('<span></span>');41984199var $dropdown = decorated.call(this);4200$container.append($dropdown);42014202this.$dropdownContainer = $container;42034204return $container;4205};42064207AttachBody.prototype._hideDropdown = function (decorated) {4208this.$dropdownContainer.detach();4209};42104211AttachBody.prototype._attachPositioningHandler =4212function (decorated, container) {4213var self = this;42144215var scrollEvent = 'scroll.select2.' + container.id;4216var resizeEvent = 'resize.select2.' + container.id;4217var orientationEvent = 'orientationchange.select2.' + container.id;42184219var $watchers = this.$container.parents().filter(Utils.hasScroll);4220$watchers.each(function () {4221$(this).data('select2-scroll-position', {4222x: $(this).scrollLeft(),4223y: $(this).scrollTop()4224});4225});42264227$watchers.on(scrollEvent, function (ev) {4228var position = $(this).data('select2-scroll-position');4229$(this).scrollTop(position.y);4230});42314232$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,4233function (e) {4234self._positionDropdown();4235self._resizeDropdown();4236});4237};42384239AttachBody.prototype._detachPositioningHandler =4240function (decorated, container) {4241var scrollEvent = 'scroll.select2.' + container.id;4242var resizeEvent = 'resize.select2.' + container.id;4243var orientationEvent = 'orientationchange.select2.' + container.id;42444245var $watchers = this.$container.parents().filter(Utils.hasScroll);4246$watchers.off(scrollEvent);42474248$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);4249};42504251AttachBody.prototype._positionDropdown = function () {4252var $window = $(window);42534254var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');4255var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');42564257var newDirection = null;42584259var offset = this.$container.offset();42604261offset.bottom = offset.top + this.$container.outerHeight(false);42624263var container = {4264height: this.$container.outerHeight(false)4265};42664267container.top = offset.top;4268container.bottom = offset.top + container.height;42694270var dropdown = {4271height: this.$dropdown.outerHeight(false)4272};42734274var viewport = {4275top: $window.scrollTop(),4276bottom: $window.scrollTop() + $window.height()4277};42784279var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);4280var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);42814282var css = {4283left: offset.left,4284top: container.bottom4285};42864287// Determine what the parent element is to use for calciulating the offset4288var $offsetParent = this.$dropdownParent;42894290// For statically positoned elements, we need to get the element4291// that is determining the offset4292if ($offsetParent.css('position') === 'static') {4293$offsetParent = $offsetParent.offsetParent();4294}42954296var parentOffset = $offsetParent.offset();42974298css.top -= parentOffset.top;4299css.left -= parentOffset.left;43004301if (!isCurrentlyAbove && !isCurrentlyBelow) {4302newDirection = 'below';4303}43044305if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {4306newDirection = 'above';4307} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {4308newDirection = 'below';4309}43104311if (newDirection == 'above' ||4312(isCurrentlyAbove && newDirection !== 'below')) {4313css.top = container.top - parentOffset.top - dropdown.height;4314}43154316if (newDirection != null) {4317this.$dropdown4318.removeClass('select2-dropdown--below select2-dropdown--above')4319.addClass('select2-dropdown--' + newDirection);4320this.$container4321.removeClass('select2-container--below select2-container--above')4322.addClass('select2-container--' + newDirection);4323}43244325this.$dropdownContainer.css(css);4326};43274328AttachBody.prototype._resizeDropdown = function () {4329var css = {4330width: this.$container.outerWidth(false) + 'px'4331};43324333if (this.options.get('dropdownAutoWidth')) {4334css.minWidth = css.width;4335css.position = 'relative';4336css.width = 'auto';4337}43384339this.$dropdown.css(css);4340};43414342AttachBody.prototype._showDropdown = function (decorated) {4343this.$dropdownContainer.appendTo(this.$dropdownParent);43444345this._positionDropdown();4346this._resizeDropdown();4347};43484349return AttachBody;4350});43514352S2.define('select2/dropdown/minimumResultsForSearch',[43534354], function () {4355function countResults (data) {4356var count = 0;43574358for (var d = 0; d < data.length; d++) {4359var item = data[d];43604361if (item.children) {4362count += countResults(item.children);4363} else {4364count++;4365}4366}43674368return count;4369}43704371function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {4372this.minimumResultsForSearch = options.get('minimumResultsForSearch');43734374if (this.minimumResultsForSearch < 0) {4375this.minimumResultsForSearch = Infinity;4376}43774378decorated.call(this, $element, options, dataAdapter);4379}43804381MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {4382if (countResults(params.data.results) < this.minimumResultsForSearch) {4383return false;4384}43854386return decorated.call(this, params);4387};43884389return MinimumResultsForSearch;4390});43914392S2.define('select2/dropdown/selectOnClose',[43934394], function () {4395function SelectOnClose () { }43964397SelectOnClose.prototype.bind = function (decorated, container, $container) {4398var self = this;43994400decorated.call(this, container, $container);44014402container.on('close', function (params) {4403self._handleSelectOnClose(params);4404});4405};44064407SelectOnClose.prototype._handleSelectOnClose = function (_, params) {4408if (params && params.originalSelect2Event != null) {4409var event = params.originalSelect2Event;44104411// Don't select an item if the close event was triggered from a select or4412// unselect event4413if (event._type === 'select' || event._type === 'unselect') {4414return;4415}4416}44174418var $highlightedResults = this.getHighlightedResults();44194420// Only select highlighted results4421if ($highlightedResults.length < 1) {4422return;4423}44244425var data = $highlightedResults.data('data');44264427// Don't re-select already selected resulte4428if (4429(data.element != null && data.element.selected) ||4430(data.element == null && data.selected)4431) {4432return;4433}44344435this.trigger('select', {4436data: data4437});4438};44394440return SelectOnClose;4441});44424443S2.define('select2/dropdown/closeOnSelect',[44444445], function () {4446function CloseOnSelect () { }44474448CloseOnSelect.prototype.bind = function (decorated, container, $container) {4449var self = this;44504451decorated.call(this, container, $container);44524453container.on('select', function (evt) {4454self._selectTriggered(evt);4455});44564457container.on('unselect', function (evt) {4458self._selectTriggered(evt);4459});4460};44614462CloseOnSelect.prototype._selectTriggered = function (_, evt) {4463var originalEvent = evt.originalEvent;44644465// Don't close if the control key is being held4466if (originalEvent && originalEvent.ctrlKey) {4467return;4468}44694470this.trigger('close', {4471originalEvent: originalEvent,4472originalSelect2Event: evt4473});4474};44754476return CloseOnSelect;4477});44784479S2.define('select2/i18n/en',[],function () {4480// English4481return {4482errorLoading: function () {4483return 'The results could not be loaded.';4484},4485inputTooLong: function (args) {4486var overChars = args.input.length - args.maximum;44874488var message = 'Please delete ' + overChars + ' character';44894490if (overChars != 1) {4491message += 's';4492}44934494return message;4495},4496inputTooShort: function (args) {4497var remainingChars = args.minimum - args.input.length;44984499var message = 'Please enter ' + remainingChars + ' or more characters';45004501return message;4502},4503loadingMore: function () {4504return 'Loading more results…';4505},4506maximumSelected: function (args) {4507var message = 'You can only select ' + args.maximum + ' item';45084509if (args.maximum != 1) {4510message += 's';4511}45124513return message;4514},4515noResults: function () {4516return 'No results found';4517},4518searching: function () {4519return 'Searching…';4520}4521};4522});4523S2.define('select2/defaults',[4524'jquery',4525'require',45264527'./results',45284529'./selection/single',4530'./selection/multiple',4531'./selection/placeholder',4532'./selection/allowClear',4533'./selection/search',4534'./selection/eventRelay',45354536'./utils',4537'./translation',4538'./diacritics',45394540'./data/select',4541'./data/array',4542'./data/ajax',4543'./data/tags',4544'./data/tokenizer',4545'./data/minimumInputLength',4546'./data/maximumInputLength',4547'./data/maximumSelectionLength',45484549'./dropdown',4550'./dropdown/search',4551'./dropdown/hidePlaceholder',4552'./dropdown/infiniteScroll',4553'./dropdown/attachBody',4554'./dropdown/minimumResultsForSearch',4555'./dropdown/selectOnClose',4556'./dropdown/closeOnSelect',45574558'./i18n/en'4559], function ($, require,45604561ResultsList,45624563SingleSelection, MultipleSelection, Placeholder, AllowClear,4564SelectionSearch, EventRelay,45654566Utils, Translation, DIACRITICS,45674568SelectData, ArrayData, AjaxData, Tags, Tokenizer,4569MinimumInputLength, MaximumInputLength, MaximumSelectionLength,45704571Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,4572AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,45734574EnglishTranslation) {4575function Defaults () {4576this.reset();4577}45784579Defaults.prototype.apply = function (options) {4580options = $.extend(true, {}, this.defaults, options);45814582if (options.dataAdapter == null) {4583if (options.ajax != null) {4584options.dataAdapter = AjaxData;4585} else if (options.data != null) {4586options.dataAdapter = ArrayData;4587} else {4588options.dataAdapter = SelectData;4589}45904591if (options.minimumInputLength > 0) {4592options.dataAdapter = Utils.Decorate(4593options.dataAdapter,4594MinimumInputLength4595);4596}45974598if (options.maximumInputLength > 0) {4599options.dataAdapter = Utils.Decorate(4600options.dataAdapter,4601MaximumInputLength4602);4603}46044605if (options.maximumSelectionLength > 0) {4606options.dataAdapter = Utils.Decorate(4607options.dataAdapter,4608MaximumSelectionLength4609);4610}46114612if (options.tags) {4613options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);4614}46154616if (options.tokenSeparators != null || options.tokenizer != null) {4617options.dataAdapter = Utils.Decorate(4618options.dataAdapter,4619Tokenizer4620);4621}46224623if (options.query != null) {4624var Query = require(options.amdBase + 'compat/query');46254626options.dataAdapter = Utils.Decorate(4627options.dataAdapter,4628Query4629);4630}46314632if (options.initSelection != null) {4633var InitSelection = require(options.amdBase + 'compat/initSelection');46344635options.dataAdapter = Utils.Decorate(4636options.dataAdapter,4637InitSelection4638);4639}4640}46414642if (options.resultsAdapter == null) {4643options.resultsAdapter = ResultsList;46444645if (options.ajax != null) {4646options.resultsAdapter = Utils.Decorate(4647options.resultsAdapter,4648InfiniteScroll4649);4650}46514652if (options.placeholder != null) {4653options.resultsAdapter = Utils.Decorate(4654options.resultsAdapter,4655HidePlaceholder4656);4657}46584659if (options.selectOnClose) {4660options.resultsAdapter = Utils.Decorate(4661options.resultsAdapter,4662SelectOnClose4663);4664}4665}46664667if (options.dropdownAdapter == null) {4668if (options.multiple) {4669options.dropdownAdapter = Dropdown;4670} else {4671var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);46724673options.dropdownAdapter = SearchableDropdown;4674}46754676if (options.minimumResultsForSearch !== 0) {4677options.dropdownAdapter = Utils.Decorate(4678options.dropdownAdapter,4679MinimumResultsForSearch4680);4681}46824683if (options.closeOnSelect) {4684options.dropdownAdapter = Utils.Decorate(4685options.dropdownAdapter,4686CloseOnSelect4687);4688}46894690if (4691options.dropdownCssClass != null ||4692options.dropdownCss != null ||4693options.adaptDropdownCssClass != null4694) {4695var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');46964697options.dropdownAdapter = Utils.Decorate(4698options.dropdownAdapter,4699DropdownCSS4700);4701}47024703options.dropdownAdapter = Utils.Decorate(4704options.dropdownAdapter,4705AttachBody4706);4707}47084709if (options.selectionAdapter == null) {4710if (options.multiple) {4711options.selectionAdapter = MultipleSelection;4712} else {4713options.selectionAdapter = SingleSelection;4714}47154716// Add the placeholder mixin if a placeholder was specified4717if (options.placeholder != null) {4718options.selectionAdapter = Utils.Decorate(4719options.selectionAdapter,4720Placeholder4721);4722}47234724if (options.allowClear) {4725options.selectionAdapter = Utils.Decorate(4726options.selectionAdapter,4727AllowClear4728);4729}47304731if (options.multiple) {4732options.selectionAdapter = Utils.Decorate(4733options.selectionAdapter,4734SelectionSearch4735);4736}47374738if (4739options.containerCssClass != null ||4740options.containerCss != null ||4741options.adaptContainerCssClass != null4742) {4743var ContainerCSS = require(options.amdBase + 'compat/containerCss');47444745options.selectionAdapter = Utils.Decorate(4746options.selectionAdapter,4747ContainerCSS4748);4749}47504751options.selectionAdapter = Utils.Decorate(4752options.selectionAdapter,4753EventRelay4754);4755}47564757if (typeof options.language === 'string') {4758// Check if the language is specified with a region4759if (options.language.indexOf('-') > 0) {4760// Extract the region information if it is included4761var languageParts = options.language.split('-');4762var baseLanguage = languageParts[0];47634764options.language = [options.language, baseLanguage];4765} else {4766options.language = [options.language];4767}4768}47694770if ($.isArray(options.language)) {4771var languages = new Translation();4772options.language.push('en');47734774var languageNames = options.language;47754776for (var l = 0; l < languageNames.length; l++) {4777var name = languageNames[l];4778var language = {};47794780try {4781// Try to load it with the original name4782language = Translation.loadPath(name);4783} catch (e) {4784try {4785// If we couldn't load it, check if it wasn't the full path4786name = this.defaults.amdLanguageBase + name;4787language = Translation.loadPath(name);4788} catch (ex) {4789// The translation could not be loaded at all. Sometimes this is4790// because of a configuration problem, other times this can be4791// because of how Select2 helps load all possible translation files.4792if (options.debug && window.console && console.warn) {4793console.warn(4794'Select2: The language file for "' + name + '" could not be ' +4795'automatically loaded. A fallback will be used instead.'4796);4797}47984799continue;4800}4801}48024803languages.extend(language);4804}48054806options.translations = languages;4807} else {4808var baseTranslation = Translation.loadPath(4809this.defaults.amdLanguageBase + 'en'4810);4811var customTranslation = new Translation(options.language);48124813customTranslation.extend(baseTranslation);48144815options.translations = customTranslation;4816}48174818return options;4819};48204821Defaults.prototype.reset = function () {4822function stripDiacritics (text) {4823// Used 'uni range + named function' from http://jsperf.com/diacritics/184824function match(a) {4825return DIACRITICS[a] || a;4826}48274828return text.replace(/[^\u0000-\u007E]/g, match);4829}48304831function matcher (params, data) {4832// Always return the object if there is nothing to compare4833if ($.trim(params.term) === '') {4834return data;4835}48364837// Do a recursive check for options with children4838if (data.children && data.children.length > 0) {4839// Clone the data object if there are children4840// This is required as we modify the object to remove any non-matches4841var match = $.extend(true, {}, data);48424843// Check each child of the option4844for (var c = data.children.length - 1; c >= 0; c--) {4845var child = data.children[c];48464847var matches = matcher(params, child);48484849// If there wasn't a match, remove the object in the array4850if (matches == null) {4851match.children.splice(c, 1);4852}4853}48544855// If any children matched, return the new object4856if (match.children.length > 0) {4857return match;4858}48594860// If there were no matching children, check just the plain object4861return matcher(params, match);4862}48634864var original = stripDiacritics(data.text).toUpperCase();4865var term = stripDiacritics(params.term).toUpperCase();48664867// Check if the text contains the term4868if (original.indexOf(term) > -1) {4869return data;4870}48714872// If it doesn't contain the term, don't return anything4873return null;4874}48754876this.defaults = {4877amdBase: './',4878amdLanguageBase: './i18n/',4879closeOnSelect: true,4880debug: false,4881dropdownAutoWidth: false,4882escapeMarkup: Utils.escapeMarkup,4883language: EnglishTranslation,4884matcher: matcher,4885minimumInputLength: 0,4886maximumInputLength: 0,4887maximumSelectionLength: 0,4888minimumResultsForSearch: 0,4889selectOnClose: false,4890sorter: function (data) {4891return data;4892},4893templateResult: function (result) {4894return result.text;4895},4896templateSelection: function (selection) {4897return selection.text;4898},4899theme: 'default',4900width: 'resolve'4901};4902};49034904Defaults.prototype.set = function (key, value) {4905var camelKey = $.camelCase(key);49064907var data = {};4908data[camelKey] = value;49094910var convertedData = Utils._convertData(data);49114912$.extend(this.defaults, convertedData);4913};49144915var defaults = new Defaults();49164917return defaults;4918});49194920S2.define('select2/options',[4921'require',4922'jquery',4923'./defaults',4924'./utils'4925], function (require, $, Defaults, Utils) {4926function Options (options, $element) {4927this.options = options;49284929if ($element != null) {4930this.fromElement($element);4931}49324933this.options = Defaults.apply(this.options);49344935if ($element && $element.is('input')) {4936var InputCompat = require(this.get('amdBase') + 'compat/inputData');49374938this.options.dataAdapter = Utils.Decorate(4939this.options.dataAdapter,4940InputCompat4941);4942}4943}49444945Options.prototype.fromElement = function ($e) {4946var excludedData = ['select2'];49474948if (this.options.multiple == null) {4949this.options.multiple = $e.prop('multiple');4950}49514952if (this.options.disabled == null) {4953this.options.disabled = $e.prop('disabled');4954}49554956if (this.options.language == null) {4957if ($e.prop('lang')) {4958this.options.language = $e.prop('lang').toLowerCase();4959} else if ($e.closest('[lang]').prop('lang')) {4960this.options.language = $e.closest('[lang]').prop('lang');4961}4962}49634964if (this.options.dir == null) {4965if ($e.prop('dir')) {4966this.options.dir = $e.prop('dir');4967} else if ($e.closest('[dir]').prop('dir')) {4968this.options.dir = $e.closest('[dir]').prop('dir');4969} else {4970this.options.dir = 'ltr';4971}4972}49734974$e.prop('disabled', this.options.disabled);4975$e.prop('multiple', this.options.multiple);49764977if ($e.data('select2Tags')) {4978if (this.options.debug && window.console && console.warn) {4979console.warn(4980'Select2: The `data-select2-tags` attribute has been changed to ' +4981'use the `data-data` and `data-tags="true"` attributes and will be ' +4982'removed in future versions of Select2.'4983);4984}49854986$e.data('data', $e.data('select2Tags'));4987$e.data('tags', true);4988}49894990if ($e.data('ajaxUrl')) {4991if (this.options.debug && window.console && console.warn) {4992console.warn(4993'Select2: The `data-ajax-url` attribute has been changed to ' +4994'`data-ajax--url` and support for the old attribute will be removed' +4995' in future versions of Select2.'4996);4997}49984999$e.attr('ajax--url', $e.data('ajaxUrl'));5000$e.data('ajax--url', $e.data('ajaxUrl'));5001}50025003var dataset = {};50045005// Prefer the element's `dataset` attribute if it exists5006// jQuery 1.x does not correctly handle data attributes with multiple dashes5007if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {5008dataset = $.extend(true, {}, $e[0].dataset, $e.data());5009} else {5010dataset = $e.data();5011}50125013var data = $.extend(true, {}, dataset);50145015data = Utils._convertData(data);50165017for (var key in data) {5018if ($.inArray(key, excludedData) > -1) {5019continue;5020}50215022if ($.isPlainObject(this.options[key])) {5023$.extend(this.options[key], data[key]);5024} else {5025this.options[key] = data[key];5026}5027}50285029return this;5030};50315032Options.prototype.get = function (key) {5033return this.options[key];5034};50355036Options.prototype.set = function (key, val) {5037this.options[key] = val;5038};50395040return Options;5041});50425043S2.define('select2/core',[5044'jquery',5045'./options',5046'./utils',5047'./keys'5048], function ($, Options, Utils, KEYS) {5049var Select2 = function ($element, options) {5050if ($element.data('select2') != null) {5051$element.data('select2').destroy();5052}50535054this.$element = $element;50555056this.id = this._generateId($element);50575058options = options || {};50595060this.options = new Options(options, $element);50615062Select2.__super__.constructor.call(this);50635064// Set up the tabindex50655066var tabindex = $element.attr('tabindex') || 0;5067$element.data('old-tabindex', tabindex);5068$element.attr('tabindex', '-1');50695070// Set up containers and adapters50715072var DataAdapter = this.options.get('dataAdapter');5073this.dataAdapter = new DataAdapter($element, this.options);50745075var $container = this.render();50765077this._placeContainer($container);50785079var SelectionAdapter = this.options.get('selectionAdapter');5080this.selection = new SelectionAdapter($element, this.options);5081this.$selection = this.selection.render();50825083this.selection.position(this.$selection, $container);50845085var DropdownAdapter = this.options.get('dropdownAdapter');5086this.dropdown = new DropdownAdapter($element, this.options);5087this.$dropdown = this.dropdown.render();50885089this.dropdown.position(this.$dropdown, $container);50905091var ResultsAdapter = this.options.get('resultsAdapter');5092this.results = new ResultsAdapter($element, this.options, this.dataAdapter);5093this.$results = this.results.render();50945095this.results.position(this.$results, this.$dropdown);50965097// Bind events50985099var self = this;51005101// Bind the container to all of the adapters5102this._bindAdapters();51035104// Register any DOM event handlers5105this._registerDomEvents();51065107// Register any internal event handlers5108this._registerDataEvents();5109this._registerSelectionEvents();5110this._registerDropdownEvents();5111this._registerResultsEvents();5112this._registerEvents();51135114// Set the initial state5115this.dataAdapter.current(function (initialData) {5116self.trigger('selection:update', {5117data: initialData5118});5119});51205121// Hide the original select5122$element.addClass('select2-hidden-accessible');5123$element.attr('aria-hidden', 'true');51245125// Synchronize any monitored attributes5126this._syncAttributes();51275128$element.data('select2', this);5129};51305131Utils.Extend(Select2, Utils.Observable);51325133Select2.prototype._generateId = function ($element) {5134var id = '';51355136if ($element.attr('id') != null) {5137id = $element.attr('id');5138} else if ($element.attr('name') != null) {5139id = $element.attr('name') + '-' + Utils.generateChars(2);5140} else {5141id = Utils.generateChars(4);5142}51435144id = id.replace(/(:|\.|\[|\]|,)/g, '');5145id = 'select2-' + id;51465147return id;5148};51495150Select2.prototype._placeContainer = function ($container) {5151$container.insertAfter(this.$element);51525153var width = this._resolveWidth(this.$element, this.options.get('width'));51545155if (width != null) {5156$container.css('width', width);5157}5158};51595160Select2.prototype._resolveWidth = function ($element, method) {5161var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;51625163if (method == 'resolve') {5164var styleWidth = this._resolveWidth($element, 'style');51655166if (styleWidth != null) {5167return styleWidth;5168}51695170return this._resolveWidth($element, 'element');5171}51725173if (method == 'element') {5174var elementWidth = $element.outerWidth(false);51755176if (elementWidth <= 0) {5177return 'auto';5178}51795180return elementWidth + 'px';5181}51825183if (method == 'style') {5184var style = $element.attr('style');51855186if (typeof(style) !== 'string') {5187return null;5188}51895190var attrs = style.split(';');51915192for (var i = 0, l = attrs.length; i < l; i = i + 1) {5193var attr = attrs[i].replace(/\s/g, '');5194var matches = attr.match(WIDTH);51955196if (matches !== null && matches.length >= 1) {5197return matches[1];5198}5199}52005201return null;5202}52035204return method;5205};52065207Select2.prototype._bindAdapters = function () {5208this.dataAdapter.bind(this, this.$container);5209this.selection.bind(this, this.$container);52105211this.dropdown.bind(this, this.$container);5212this.results.bind(this, this.$container);5213};52145215Select2.prototype._registerDomEvents = function () {5216var self = this;52175218this.$element.on('change.select2', function () {5219self.dataAdapter.current(function (data) {5220self.trigger('selection:update', {5221data: data5222});5223});5224});52255226this.$element.on('focus.select2', function (evt) {5227self.trigger('focus', evt);5228});52295230this._syncA = Utils.bind(this._syncAttributes, this);5231this._syncS = Utils.bind(this._syncSubtree, this);52325233if (this.$element[0].attachEvent) {5234this.$element[0].attachEvent('onpropertychange', this._syncA);5235}52365237var observer = window.MutationObserver ||5238window.WebKitMutationObserver ||5239window.MozMutationObserver5240;52415242if (observer != null) {5243this._observer = new observer(function (mutations) {5244$.each(mutations, self._syncA);5245$.each(mutations, self._syncS);5246});5247this._observer.observe(this.$element[0], {5248attributes: true,5249childList: true,5250subtree: false5251});5252} else if (this.$element[0].addEventListener) {5253this.$element[0].addEventListener(5254'DOMAttrModified',5255self._syncA,5256false5257);5258this.$element[0].addEventListener(5259'DOMNodeInserted',5260self._syncS,5261false5262);5263this.$element[0].addEventListener(5264'DOMNodeRemoved',5265self._syncS,5266false5267);5268}5269};52705271Select2.prototype._registerDataEvents = function () {5272var self = this;52735274this.dataAdapter.on('*', function (name, params) {5275self.trigger(name, params);5276});5277};52785279Select2.prototype._registerSelectionEvents = function () {5280var self = this;5281var nonRelayEvents = ['toggle', 'focus'];52825283this.selection.on('toggle', function () {5284self.toggleDropdown();5285});52865287this.selection.on('focus', function (params) {5288self.focus(params);5289});52905291this.selection.on('*', function (name, params) {5292if ($.inArray(name, nonRelayEvents) !== -1) {5293return;5294}52955296self.trigger(name, params);5297});5298};52995300Select2.prototype._registerDropdownEvents = function () {5301var self = this;53025303this.dropdown.on('*', function (name, params) {5304self.trigger(name, params);5305});5306};53075308Select2.prototype._registerResultsEvents = function () {5309var self = this;53105311this.results.on('*', function (name, params) {5312self.trigger(name, params);5313});5314};53155316Select2.prototype._registerEvents = function () {5317var self = this;53185319this.on('open', function () {5320self.$container.addClass('select2-container--open');5321});53225323this.on('close', function () {5324self.$container.removeClass('select2-container--open');5325});53265327this.on('enable', function () {5328self.$container.removeClass('select2-container--disabled');5329});53305331this.on('disable', function () {5332self.$container.addClass('select2-container--disabled');5333});53345335this.on('blur', function () {5336self.$container.removeClass('select2-container--focus');5337});53385339this.on('query', function (params) {5340if (!self.isOpen()) {5341self.trigger('open', {});5342}53435344this.dataAdapter.query(params, function (data) {5345self.trigger('results:all', {5346data: data,5347query: params5348});5349});5350});53515352this.on('query:append', function (params) {5353this.dataAdapter.query(params, function (data) {5354self.trigger('results:append', {5355data: data,5356query: params5357});5358});5359});53605361this.on('keypress', function (evt) {5362var key = evt.which;53635364if (self.isOpen()) {5365if (key === KEYS.ESC || key === KEYS.TAB ||5366(key === KEYS.UP && evt.altKey)) {5367self.close();53685369evt.preventDefault();5370} else if (key === KEYS.ENTER) {5371self.trigger('results:select', {});53725373evt.preventDefault();5374} else if ((key === KEYS.SPACE && evt.ctrlKey)) {5375self.trigger('results:toggle', {});53765377evt.preventDefault();5378} else if (key === KEYS.UP) {5379self.trigger('results:previous', {});53805381evt.preventDefault();5382} else if (key === KEYS.DOWN) {5383self.trigger('results:next', {});53845385evt.preventDefault();5386}5387} else {5388if (key === KEYS.ENTER || key === KEYS.SPACE ||5389(key === KEYS.DOWN && evt.altKey)) {5390self.open();53915392evt.preventDefault();5393}5394}5395});5396};53975398Select2.prototype._syncAttributes = function () {5399this.options.set('disabled', this.$element.prop('disabled'));54005401if (this.options.get('disabled')) {5402if (this.isOpen()) {5403this.close();5404}54055406this.trigger('disable', {});5407} else {5408this.trigger('enable', {});5409}5410};54115412Select2.prototype._syncSubtree = function (evt, mutations) {5413var changed = false;5414var self = this;54155416// Ignore any mutation events raised for elements that aren't options or5417// optgroups. This handles the case when the select element is destroyed5418if (5419evt && evt.target && (5420evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'5421)5422) {5423return;5424}54255426if (!mutations) {5427// If mutation events aren't supported, then we can only assume that the5428// change affected the selections5429changed = true;5430} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {5431for (var n = 0; n < mutations.addedNodes.length; n++) {5432var node = mutations.addedNodes[n];54335434if (node.selected) {5435changed = true;5436}5437}5438} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {5439changed = true;5440}54415442// Only re-pull the data if we think there is a change5443if (changed) {5444this.dataAdapter.current(function (currentData) {5445self.trigger('selection:update', {5446data: currentData5447});5448});5449}5450};54515452/**5453* Override the trigger method to automatically trigger pre-events when5454* there are events that can be prevented.5455*/5456Select2.prototype.trigger = function (name, args) {5457var actualTrigger = Select2.__super__.trigger;5458var preTriggerMap = {5459'open': 'opening',5460'close': 'closing',5461'select': 'selecting',5462'unselect': 'unselecting'5463};54645465if (args === undefined) {5466args = {};5467}54685469if (name in preTriggerMap) {5470var preTriggerName = preTriggerMap[name];5471var preTriggerArgs = {5472prevented: false,5473name: name,5474args: args5475};54765477actualTrigger.call(this, preTriggerName, preTriggerArgs);54785479if (preTriggerArgs.prevented) {5480args.prevented = true;54815482return;5483}5484}54855486actualTrigger.call(this, name, args);5487};54885489Select2.prototype.toggleDropdown = function () {5490if (this.options.get('disabled')) {5491return;5492}54935494if (this.isOpen()) {5495this.close();5496} else {5497this.open();5498}5499};55005501Select2.prototype.open = function () {5502if (this.isOpen()) {5503return;5504}55055506this.trigger('query', {});5507};55085509Select2.prototype.close = function () {5510if (!this.isOpen()) {5511return;5512}55135514this.trigger('close', {});5515};55165517Select2.prototype.isOpen = function () {5518return this.$container.hasClass('select2-container--open');5519};55205521Select2.prototype.hasFocus = function () {5522return this.$container.hasClass('select2-container--focus');5523};55245525Select2.prototype.focus = function (data) {5526// No need to re-trigger focus events if we are already focused5527if (this.hasFocus()) {5528return;5529}55305531this.$container.addClass('select2-container--focus');5532this.trigger('focus', {});5533};55345535Select2.prototype.enable = function (args) {5536if (this.options.get('debug') && window.console && console.warn) {5537console.warn(5538'Select2: The `select2("enable")` method has been deprecated and will' +5539' be removed in later Select2 versions. Use $element.prop("disabled")' +5540' instead.'5541);5542}55435544if (args == null || args.length === 0) {5545args = [true];5546}55475548var disabled = !args[0];55495550this.$element.prop('disabled', disabled);5551};55525553Select2.prototype.data = function () {5554if (this.options.get('debug') &&5555arguments.length > 0 && window.console && console.warn) {5556console.warn(5557'Select2: Data can no longer be set using `select2("data")`. You ' +5558'should consider setting the value instead using `$element.val()`.'5559);5560}55615562var data = [];55635564this.dataAdapter.current(function (currentData) {5565data = currentData;5566});55675568return data;5569};55705571Select2.prototype.val = function (args) {5572if (this.options.get('debug') && window.console && console.warn) {5573console.warn(5574'Select2: The `select2("val")` method has been deprecated and will be' +5575' removed in later Select2 versions. Use $element.val() instead.'5576);5577}55785579if (args == null || args.length === 0) {5580return this.$element.val();5581}55825583var newVal = args[0];55845585if ($.isArray(newVal)) {5586newVal = $.map(newVal, function (obj) {5587return obj.toString();5588});5589}55905591this.$element.val(newVal).trigger('change');5592};55935594Select2.prototype.destroy = function () {5595this.$container.remove();55965597if (this.$element[0].detachEvent) {5598this.$element[0].detachEvent('onpropertychange', this._syncA);5599}56005601if (this._observer != null) {5602this._observer.disconnect();5603this._observer = null;5604} else if (this.$element[0].removeEventListener) {5605this.$element[0]5606.removeEventListener('DOMAttrModified', this._syncA, false);5607this.$element[0]5608.removeEventListener('DOMNodeInserted', this._syncS, false);5609this.$element[0]5610.removeEventListener('DOMNodeRemoved', this._syncS, false);5611}56125613this._syncA = null;5614this._syncS = null;56155616this.$element.off('.select2');5617this.$element.attr('tabindex', this.$element.data('old-tabindex'));56185619this.$element.removeClass('select2-hidden-accessible');5620this.$element.attr('aria-hidden', 'false');5621this.$element.removeData('select2');56225623this.dataAdapter.destroy();5624this.selection.destroy();5625this.dropdown.destroy();5626this.results.destroy();56275628this.dataAdapter = null;5629this.selection = null;5630this.dropdown = null;5631this.results = null;5632};56335634Select2.prototype.render = function () {5635var $container = $(5636'<span class="select2 select2-container">' +5637'<span class="selection"></span>' +5638'<span class="dropdown-wrapper" aria-hidden="true"></span>' +5639'</span>'5640);56415642$container.attr('dir', this.options.get('dir'));56435644this.$container = $container;56455646this.$container.addClass('select2-container--' + this.options.get('theme'));56475648$container.data('element', this.$element);56495650return $container;5651};56525653return Select2;5654});56555656S2.define('select2/compat/utils',[5657'jquery'5658], function ($) {5659function syncCssClasses ($dest, $src, adapter) {5660var classes, replacements = [], adapted;56615662classes = $.trim($dest.attr('class'));56635664if (classes) {5665classes = '' + classes; // for IE which returns object56665667$(classes.split(/\s+/)).each(function () {5668// Save all Select2 classes5669if (this.indexOf('select2-') === 0) {5670replacements.push(this);5671}5672});5673}56745675classes = $.trim($src.attr('class'));56765677if (classes) {5678classes = '' + classes; // for IE which returns object56795680$(classes.split(/\s+/)).each(function () {5681// Only adapt non-Select2 classes5682if (this.indexOf('select2-') !== 0) {5683adapted = adapter(this);56845685if (adapted != null) {5686replacements.push(adapted);5687}5688}5689});5690}56915692$dest.attr('class', replacements.join(' '));5693}56945695return {5696syncCssClasses: syncCssClasses5697};5698});56995700S2.define('select2/compat/containerCss',[5701'jquery',5702'./utils'5703], function ($, CompatUtils) {5704// No-op CSS adapter that discards all classes by default5705function _containerAdapter (clazz) {5706return null;5707}57085709function ContainerCSS () { }57105711ContainerCSS.prototype.render = function (decorated) {5712var $container = decorated.call(this);57135714var containerCssClass = this.options.get('containerCssClass') || '';57155716if ($.isFunction(containerCssClass)) {5717containerCssClass = containerCssClass(this.$element);5718}57195720var containerCssAdapter = this.options.get('adaptContainerCssClass');5721containerCssAdapter = containerCssAdapter || _containerAdapter;57225723if (containerCssClass.indexOf(':all:') !== -1) {5724containerCssClass = containerCssClass.replace(':all:', '');57255726var _cssAdapter = containerCssAdapter;57275728containerCssAdapter = function (clazz) {5729var adapted = _cssAdapter(clazz);57305731if (adapted != null) {5732// Append the old one along with the adapted one5733return adapted + ' ' + clazz;5734}57355736return clazz;5737};5738}57395740var containerCss = this.options.get('containerCss') || {};57415742if ($.isFunction(containerCss)) {5743containerCss = containerCss(this.$element);5744}57455746CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);57475748$container.css(containerCss);5749$container.addClass(containerCssClass);57505751return $container;5752};57535754return ContainerCSS;5755});57565757S2.define('select2/compat/dropdownCss',[5758'jquery',5759'./utils'5760], function ($, CompatUtils) {5761// No-op CSS adapter that discards all classes by default5762function _dropdownAdapter (clazz) {5763return null;5764}57655766function DropdownCSS () { }57675768DropdownCSS.prototype.render = function (decorated) {5769var $dropdown = decorated.call(this);57705771var dropdownCssClass = this.options.get('dropdownCssClass') || '';57725773if ($.isFunction(dropdownCssClass)) {5774dropdownCssClass = dropdownCssClass(this.$element);5775}57765777var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');5778dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;57795780if (dropdownCssClass.indexOf(':all:') !== -1) {5781dropdownCssClass = dropdownCssClass.replace(':all:', '');57825783var _cssAdapter = dropdownCssAdapter;57845785dropdownCssAdapter = function (clazz) {5786var adapted = _cssAdapter(clazz);57875788if (adapted != null) {5789// Append the old one along with the adapted one5790return adapted + ' ' + clazz;5791}57925793return clazz;5794};5795}57965797var dropdownCss = this.options.get('dropdownCss') || {};57985799if ($.isFunction(dropdownCss)) {5800dropdownCss = dropdownCss(this.$element);5801}58025803CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);58045805$dropdown.css(dropdownCss);5806$dropdown.addClass(dropdownCssClass);58075808return $dropdown;5809};58105811return DropdownCSS;5812});58135814S2.define('select2/compat/initSelection',[5815'jquery'5816], function ($) {5817function InitSelection (decorated, $element, options) {5818if (options.get('debug') && window.console && console.warn) {5819console.warn(5820'Select2: The `initSelection` option has been deprecated in favor' +5821' of a custom data adapter that overrides the `current` method. ' +5822'This method is now called multiple times instead of a single ' +5823'time when the instance is initialized. Support will be removed ' +5824'for the `initSelection` option in future versions of Select2'5825);5826}58275828this.initSelection = options.get('initSelection');5829this._isInitialized = false;58305831decorated.call(this, $element, options);5832}58335834InitSelection.prototype.current = function (decorated, callback) {5835var self = this;58365837if (this._isInitialized) {5838decorated.call(this, callback);58395840return;5841}58425843this.initSelection.call(null, this.$element, function (data) {5844self._isInitialized = true;58455846if (!$.isArray(data)) {5847data = [data];5848}58495850callback(data);5851});5852};58535854return InitSelection;5855});58565857S2.define('select2/compat/inputData',[5858'jquery'5859], function ($) {5860function InputData (decorated, $element, options) {5861this._currentData = [];5862this._valueSeparator = options.get('valueSeparator') || ',';58635864if ($element.prop('type') === 'hidden') {5865if (options.get('debug') && console && console.warn) {5866console.warn(5867'Select2: Using a hidden input with Select2 is no longer ' +5868'supported and may stop working in the future. It is recommended ' +5869'to use a `<select>` element instead.'5870);5871}5872}58735874decorated.call(this, $element, options);5875}58765877InputData.prototype.current = function (_, callback) {5878function getSelected (data, selectedIds) {5879var selected = [];58805881if (data.selected || $.inArray(data.id, selectedIds) !== -1) {5882data.selected = true;5883selected.push(data);5884} else {5885data.selected = false;5886}58875888if (data.children) {5889selected.push.apply(selected, getSelected(data.children, selectedIds));5890}58915892return selected;5893}58945895var selected = [];58965897for (var d = 0; d < this._currentData.length; d++) {5898var data = this._currentData[d];58995900selected.push.apply(5901selected,5902getSelected(5903data,5904this.$element.val().split(5905this._valueSeparator5906)5907)5908);5909}59105911callback(selected);5912};59135914InputData.prototype.select = function (_, data) {5915if (!this.options.get('multiple')) {5916this.current(function (allData) {5917$.map(allData, function (data) {5918data.selected = false;5919});5920});59215922this.$element.val(data.id);5923this.$element.trigger('change');5924} else {5925var value = this.$element.val();5926value += this._valueSeparator + data.id;59275928this.$element.val(value);5929this.$element.trigger('change');5930}5931};59325933InputData.prototype.unselect = function (_, data) {5934var self = this;59355936data.selected = false;59375938this.current(function (allData) {5939var values = [];59405941for (var d = 0; d < allData.length; d++) {5942var item = allData[d];59435944if (data.id == item.id) {5945continue;5946}59475948values.push(item.id);5949}59505951self.$element.val(values.join(self._valueSeparator));5952self.$element.trigger('change');5953});5954};59555956InputData.prototype.query = function (_, params, callback) {5957var results = [];59585959for (var d = 0; d < this._currentData.length; d++) {5960var data = this._currentData[d];59615962var matches = this.matches(params, data);59635964if (matches !== null) {5965results.push(matches);5966}5967}59685969callback({5970results: results5971});5972};59735974InputData.prototype.addOptions = function (_, $options) {5975var options = $.map($options, function ($option) {5976return $.data($option[0], 'data');5977});59785979this._currentData.push.apply(this._currentData, options);5980};59815982return InputData;5983});59845985S2.define('select2/compat/matcher',[5986'jquery'5987], function ($) {5988function oldMatcher (matcher) {5989function wrappedMatcher (params, data) {5990var match = $.extend(true, {}, data);59915992if (params.term == null || $.trim(params.term) === '') {5993return match;5994}59955996if (data.children) {5997for (var c = data.children.length - 1; c >= 0; c--) {5998var child = data.children[c];59996000// Check if the child object matches6001// The old matcher returned a boolean true or false6002var doesMatch = matcher(params.term, child.text, child);60036004// If the child didn't match, pop it off6005if (!doesMatch) {6006match.children.splice(c, 1);6007}6008}60096010if (match.children.length > 0) {6011return match;6012}6013}60146015if (matcher(params.term, data.text, data)) {6016return match;6017}60186019return null;6020}60216022return wrappedMatcher;6023}60246025return oldMatcher;6026});60276028S2.define('select2/compat/query',[60296030], function () {6031function Query (decorated, $element, options) {6032if (options.get('debug') && window.console && console.warn) {6033console.warn(6034'Select2: The `query` option has been deprecated in favor of a ' +6035'custom data adapter that overrides the `query` method. Support ' +6036'will be removed for the `query` option in future versions of ' +6037'Select2.'6038);6039}60406041decorated.call(this, $element, options);6042}60436044Query.prototype.query = function (_, params, callback) {6045params.callback = callback;60466047var query = this.options.get('query');60486049query.call(null, params);6050};60516052return Query;6053});60546055S2.define('select2/dropdown/attachContainer',[60566057], function () {6058function AttachContainer (decorated, $element, options) {6059decorated.call(this, $element, options);6060}60616062AttachContainer.prototype.position =6063function (decorated, $dropdown, $container) {6064var $dropdownContainer = $container.find('.dropdown-wrapper');6065$dropdownContainer.append($dropdown);60666067$dropdown.addClass('select2-dropdown--below');6068$container.addClass('select2-container--below');6069};60706071return AttachContainer;6072});60736074S2.define('select2/dropdown/stopPropagation',[60756076], function () {6077function StopPropagation () { }60786079StopPropagation.prototype.bind = function (decorated, container, $container) {6080decorated.call(this, container, $container);60816082var stoppedEvents = [6083'blur',6084'change',6085'click',6086'dblclick',6087'focus',6088'focusin',6089'focusout',6090'input',6091'keydown',6092'keyup',6093'keypress',6094'mousedown',6095'mouseenter',6096'mouseleave',6097'mousemove',6098'mouseover',6099'mouseup',6100'search',6101'touchend',6102'touchstart'6103];61046105this.$dropdown.on(stoppedEvents.join(' '), function (evt) {6106evt.stopPropagation();6107});6108};61096110return StopPropagation;6111});61126113S2.define('select2/selection/stopPropagation',[61146115], function () {6116function StopPropagation () { }61176118StopPropagation.prototype.bind = function (decorated, container, $container) {6119decorated.call(this, container, $container);6120var stoppedEvents = [6121'blur',6122'change',6123'click',6124'dblclick',6125'focus',6126'focusin',6127'focusout',6128'input',6129'keydown',6130'keyup',6131'keypress',6132'mousedown',6133'mouseenter',6134'mouseleave',6135'mousemove',6136'mouseover',6137'mouseup',6138'search',6139'touchend',6140'touchstart'6141];61426143this.$selection.on(stoppedEvents.join(' '), function (evt) {6144evt.stopPropagation();6145});6146};61476148return StopPropagation;6149});61506151/*!6152* jQuery Mousewheel 3.1.136153*6154* Copyright jQuery Foundation and other contributors6155* Released under the MIT license6156* http://jquery.org/license6157*/61586159(function (factory) {6160if ( typeof S2.define === 'function' && S2.define.amd ) {6161// AMD. Register as an anonymous module.6162S2.define('jquery-mousewheel',['jquery'], factory);6163} else if (typeof exports === 'object') {6164// Node/CommonJS style for Browserify6165module.exports = factory;6166} else {6167// Browser globals6168factory(jQuery);6169}6170}(function ($) {61716172var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],6173toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?6174['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],6175slice = Array.prototype.slice,6176nullLowestDeltaTimeout, lowestDelta;61776178if ( $.event.fixHooks ) {6179for ( var i = toFix.length; i; ) {6180$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;6181}6182}61836184var special = $.event.special.mousewheel = {6185version: '3.1.12',61866187setup: function() {6188if ( this.addEventListener ) {6189for ( var i = toBind.length; i; ) {6190this.addEventListener( toBind[--i], handler, false );6191}6192} else {6193this.onmousewheel = handler;6194}6195// Store the line height and page height for this particular element6196$.data(this, 'mousewheel-line-height', special.getLineHeight(this));6197$.data(this, 'mousewheel-page-height', special.getPageHeight(this));6198},61996200teardown: function() {6201if ( this.removeEventListener ) {6202for ( var i = toBind.length; i; ) {6203this.removeEventListener( toBind[--i], handler, false );6204}6205} else {6206this.onmousewheel = null;6207}6208// Clean up the data we added to the element6209$.removeData(this, 'mousewheel-line-height');6210$.removeData(this, 'mousewheel-page-height');6211},62126213getLineHeight: function(elem) {6214var $elem = $(elem),6215$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();6216if (!$parent.length) {6217$parent = $('body');6218}6219return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;6220},62216222getPageHeight: function(elem) {6223return $(elem).height();6224},62256226settings: {6227adjustOldDeltas: true, // see shouldAdjustOldDeltas() below6228normalizeOffset: true // calls getBoundingClientRect for each event6229}6230};62316232$.fn.extend({6233mousewheel: function(fn) {6234return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');6235},62366237unmousewheel: function(fn) {6238return this.unbind('mousewheel', fn);6239}6240});624162426243function handler(event) {6244var orgEvent = event || window.event,6245args = slice.call(arguments, 1),6246delta = 0,6247deltaX = 0,6248deltaY = 0,6249absDelta = 0,6250offsetX = 0,6251offsetY = 0;6252event = $.event.fix(orgEvent);6253event.type = 'mousewheel';62546255// Old school scrollwheel delta6256if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }6257if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }6258if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }6259if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }62606261// Firefox < 17 horizontal scrolling related to DOMMouseScroll event6262if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {6263deltaX = deltaY * -1;6264deltaY = 0;6265}62666267// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy6268delta = deltaY === 0 ? deltaX : deltaY;62696270// New school wheel delta (wheel event)6271if ( 'deltaY' in orgEvent ) {6272deltaY = orgEvent.deltaY * -1;6273delta = deltaY;6274}6275if ( 'deltaX' in orgEvent ) {6276deltaX = orgEvent.deltaX;6277if ( deltaY === 0 ) { delta = deltaX * -1; }6278}62796280// No change actually happened, no reason to go any further6281if ( deltaY === 0 && deltaX === 0 ) { return; }62826283// Need to convert lines and pages to pixels if we aren't already in pixels6284// There are three delta modes:6285// * deltaMode 0 is by pixels, nothing to do6286// * deltaMode 1 is by lines6287// * deltaMode 2 is by pages6288if ( orgEvent.deltaMode === 1 ) {6289var lineHeight = $.data(this, 'mousewheel-line-height');6290delta *= lineHeight;6291deltaY *= lineHeight;6292deltaX *= lineHeight;6293} else if ( orgEvent.deltaMode === 2 ) {6294var pageHeight = $.data(this, 'mousewheel-page-height');6295delta *= pageHeight;6296deltaY *= pageHeight;6297deltaX *= pageHeight;6298}62996300// Store lowest absolute delta to normalize the delta values6301absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );63026303if ( !lowestDelta || absDelta < lowestDelta ) {6304lowestDelta = absDelta;63056306// Adjust older deltas if necessary6307if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {6308lowestDelta /= 40;6309}6310}63116312// Adjust older deltas if necessary6313if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {6314// Divide all the things by 40!6315delta /= 40;6316deltaX /= 40;6317deltaY /= 40;6318}63196320// Get a whole, normalized value for the deltas6321delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);6322deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);6323deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);63246325// Normalise offsetX and offsetY properties6326if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {6327var boundingRect = this.getBoundingClientRect();6328offsetX = event.clientX - boundingRect.left;6329offsetY = event.clientY - boundingRect.top;6330}63316332// Add information to the event object6333event.deltaX = deltaX;6334event.deltaY = deltaY;6335event.deltaFactor = lowestDelta;6336event.offsetX = offsetX;6337event.offsetY = offsetY;6338// Go ahead and set deltaMode to 0 since we converted to pixels6339// Although this is a little odd since we overwrite the deltaX/Y6340// properties with normalized deltas.6341event.deltaMode = 0;63426343// Add event and delta to the front of the arguments6344args.unshift(event, delta, deltaX, deltaY);63456346// Clearout lowestDelta after sometime to better6347// handle multiple device types that give different6348// a different lowestDelta6349// Ex: trackpad = 3 and mouse wheel = 1206350if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }6351nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);63526353return ($.event.dispatch || $.event.handle).apply(this, args);6354}63556356function nullLowestDelta() {6357lowestDelta = null;6358}63596360function shouldAdjustOldDeltas(orgEvent, absDelta) {6361// If this is an older event and the delta is divisable by 120,6362// then we are assuming that the browser is treating this as an6363// older mouse wheel event and that we should divide the deltas6364// by 40 to try and get a more usable deltaFactor.6365// Side note, this actually impacts the reported scroll distance6366// in older browsers and can cause scrolling to be slower than native.6367// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.6368return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;6369}63706371}));63726373S2.define('jquery.select2',[6374'jquery',6375'jquery-mousewheel',63766377'./select2/core',6378'./select2/defaults'6379], function ($, _, Select2, Defaults) {6380if ($.fn.select2 == null) {6381// All methods that should return the element6382var thisMethods = ['open', 'close', 'destroy'];63836384$.fn.select2 = function (options) {6385options = options || {};63866387if (typeof options === 'object') {6388this.each(function () {6389var instanceOptions = $.extend(true, {}, options);63906391var instance = new Select2($(this), instanceOptions);6392});63936394return this;6395} else if (typeof options === 'string') {6396var ret;6397var args = Array.prototype.slice.call(arguments, 1);63986399this.each(function () {6400var instance = $(this).data('select2');64016402if (instance == null && window.console && console.error) {6403console.error(6404'The select2(\'' + options + '\') method was called on an ' +6405'element that is not using Select2.'6406);6407}64086409ret = instance[options].apply(instance, args);6410});64116412// Check if we should be returning `this`6413if ($.inArray(options, thisMethods) > -1) {6414return this;6415}64166417return ret;6418} else {6419throw new Error('Invalid arguments for Select2: ' + options);6420}6421};6422}64236424if ($.fn.select2.defaults == null) {6425$.fn.select2.defaults = Defaults;6426}64276428return Select2;6429});64306431// Return the AMD loader configuration so it can be used outside of this file6432return {6433define: S2.define,6434require: S2.require6435};6436}());64376438// Autoload the jQuery bindings6439// We know that all of the modules exist above this, so we're safe6440var select2 = S2.require('jquery.select2');64416442// Hold the AMD module references on the jQuery function that was just loaded6443// This allows Select2 to use the internal loader outside of this file, such6444// as in the language files.6445jQuery.fn.select2.amd = S2;64466447// Return the Select2 instance for anyone who is importing it.6448return select2;6449}));64506451