1
0
mirror of synced 2024-11-26 14:56:07 +03:00
select2/dist/js/select2.min.js

2 lines
41 KiB
JavaScript
Raw Normal View History

window.$=window.$||{},function(){$&&$.fn&&$.fn.select2&&$.fn.select2.amd&&(c=$.fn.select2.amd.define,b=$.fn.select2.amd.require);var a,b,c;!function(d){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(n=n.slice(0,n.length-1),a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,b){return function(){return n.apply(d,v.call(arguments,0).concat([a,b]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var b=r[a];delete r[a],t[a]=!0,m.apply(d,b)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,b,c,f){var h,k,l,m,n,s,u=[],v=typeof c;if(f=f||a,"undefined"===v||"function"===v){for(b=!b.length&&c.length?["require","exports","module"]:b,n=0;n<b.length;n+=1)if(m=o(b[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=c?c.apply(q[a],u):void 0,a&&(h&&h.exports!==d&&h.exports!==q[a]?q[a]=h.exports:l===d&&s||(q[a]=l))}else a&&(q[a]=c)},a=b=n=function(a,b,c,e,f){if("string"==typeof a)return p[a]?p[a](b):j(o(a,b).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!b)return;b.splice?(a=b,b=c,c=null):a=d}return b=b||function(){},"function"==typeof c&&(c=e,e=f),e?m(d,a,b,c):setTimeout(function(){m(d,a,b,c)},4),n},n.config=function(a){return n(a)},a._defined=q,c=function(a,b,c){b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},c.amd={jQuery:!0}}(),c("almond",function(){}),c("jquery",[],function(){return jQuery}),c("select2/utils",[],function(){function a(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var b={};b.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},b.Decorate=function(b,c){function d(){var a=Array.prototype.unshift,d=c.prototype.constructor.length,e=b.prototype.constructor;d>0&&(a.call(arguments,b.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=a(c),g=a(b);c.displayName=b.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=b.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var c=function(){this.listeners={}};return c.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},c.prototype.trigger=function(a){var
return b.html(c(this.lastParams)),b},b}),c("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more character";return 1!=b&&(c+="s"),c},searching:function(){return"Searching…"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select"+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"}}}),c("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/search","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/minimumInputLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r){function s(){this.reset()}s.prototype.apply=function(i){if(i=a.extend({},this.defaults,i),null==i.dataAdapter&&(i.dataAdapter=null!=i.ajax?l:null!=i.data?k:j),i.minimumInputLength>0&&(i.dataAdapter=g.Decorate(i.dataAdapter,n)),null!=i.tags&&(i.dataAdapter=g.Decorate(i.dataAdapter,m)),null==i.resultsAdapter&&(i.resultsAdapter=b,null!=i.ajax&&(i.resultsAdapter=g.Decorate(i.resultsAdapter,r)),null!=i.placeholder&&(i.resultsAdapter=g.Decorate(i.resultsAdapter,q))),null==i.dropdownAdapter)if(i.multiple)i.dropdownAdapter=o;else{var s=g.Decorate(o,p);i.dropdownAdapter=s}if(null==i.selectionAdapter&&(i.selectionAdapter=i.multiple?d:c,null!=i.placeholder&&(i.selectionAdapter=g.Decorate(i.selectionAdapter,e)),i.multiple&&(i.selectionAdapter=g.Decorate(i.selectionAdapter,f))),"string"==typeof i.language&&(i.language=[i.language]),a.isArray(i.language)){for(var t=new h,u=i.language.concat(this.defaults.language),v=0;v<u.length;v++){var w=u[v],x={};try{x=h.loadPath(w)}catch(y){w="select2/i18n/"+w,x=h.loadPath(w)}t.extend(x)}i.translations=t}else i.translations=new Translations(i.language);return i},s.prototype.reset=function(){function b(a){function b(a){return i[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={language:["select2/i18n/en"],matcher:c,minimumInputLength:0,theme:"default",templateResult:function(a){return a.text},templateSelection:function(a){return a.text}}};var t=new s;return t}),c("select2/options",["./defaults"],function(a){function b(b,c){this.options=b,null!=c&&this.fromElement(c),this.options=a.apply(this.options)}return b.prototype.fromElement=function(a){return null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),this},b.prototype.get=function(a){return this.options[a]},b.prototype.set=function(a,b){this.options[a]=b},b}),c("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){if(null==a.data("select2")){this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=this.options.get("dataAdapter");this.data=new d(a,this.options);var f=this.render();this._placeContainer(f);var g=this.options.get("selectionAdapter");this.selection=new g(a,this.options);var h=this.selection.render();this._placeSelection(h);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options);var j=this.dropdown.render();this._placeDropdown(j);var k=this.options.get("resultsAdapter");this.results=new k(a,this.options,this.data);var l=this.results.render();this._placeResults(l);var m=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEve