/* Copyright 2012 Igor Vaynberg Version: 3.4.3 Timestamp: Tue Sep 17 06:47:14 PDT 2013 This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU General Public License version 2 (the "GPL License"). You may choose either license to govern your use of this software only upon the condition that you accept all of the terms of either the Apache License or the GPL License. You may obtain a copy of the Apache License and the GPL License at: http://www.apache.org/licenses/LICENSE-2.0 http://www.gnu.org/licenses/gpl-2.0.html Unless required by applicable law or agreed to in writing, software distributed under the Apache License or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License and the GPL License for the specific language governing permissions and limitations under the Apache License and the GPL License. */(function(e){typeof e.fn.each2=="undefined"&&e.extend(e.fn,{each2:function(t){var n=e([0]),r=-1,i=this.length;while(++r=0&&n(e)})}function T(e){if(e[0]===document.activeElement)return;window.setTimeout(function(){var t=e[0],n=e.val().length,r;e.focus();if(e.is(":visible")&&t===document.activeElement)if(t.setSelectionRange)t.setSelectionRange(n,n);else if(t.createTextRange){r=t.createTextRange();r.collapse(!1);r.select()}},0)}function N(t){t=e(t)[0];var n=0,r=0;if("selectionStart"in t){n=t.selectionStart;r=t.selectionEnd-n}else if("selection"in document){t.focus();var i=document.selection.createRange();r=document.selection.createRange().text.length;i.moveStart("character",-t.value.length);n=i.text.length-r}return{offset:n,length:r}}function C(e){e.preventDefault();e.stopPropagation()}function k(e){e.preventDefault();e.stopImmediatePropagation()}function L(t){if(!u){var n=t[0].currentStyle||window.getComputedStyle(t[0],null);u=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:n.fontSize,fontFamily:n.fontFamily,fontStyle:n.fontStyle,fontWeight:n.fontWeight,letterSpacing:n.letterSpacing,textTransform:n.textTransform,whiteSpace:"nowrap"});u.attr("class","select2-sizer");e("body").append(u)}u.text(t.val());return u.width()}function A(t,n,r){var i,s=[],o;i=t.attr("class");if(i){i=""+i;e(i.split(" ")).each2(function(){this.indexOf("select2-")===0&&s.push(this)})}i=n.attr("class");if(i){i=""+i;e(i.split(" ")).each2(function(){if(this.indexOf("select2-")!==0){o=r(this);o&&s.push(this)}})}t.attr("class",s.join(" "))}function O(e,t,n,r){var i=p(e.toUpperCase()).indexOf(p(t.toUpperCase())),s=t.length;if(i<0){n.push(r(e));return}n.push(r(e.substring(0,i)));n.push("");n.push(r(e.substring(i,i+s)));n.push("");n.push(r(e.substring(i+s,e.length)))}function M(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function _(n){var r,i=null,s=n.quietMillis||100,o=n.url,u=this;return function(a){window.clearTimeout(r);r=window.setTimeout(function(){var r=n.data,s=o,f=n.transport||e.fn.select2.ajaxDefaults.transport,l={type:n.type||"GET",cache:n.cache||!1,jsonpCallback:n.jsonpCallback||t,dataType:n.dataType||"json"},c=e.extend({},e.fn.select2.ajaxDefaults.params,l);r=r?r.call(u,a.term,a.page,a.context):null;s=typeof s=="function"?s.call(u,a.term,a.page,a.context):s;i&&i.abort();n.params&&(e.isFunction(n.params)?e.extend(c,n.params.call(u)):e.extend(c,n.params));e.extend(c,{url:s,dataType:n.dataType,data:r,success:function(e){var t=n.results(e,a.page);a.callback(t)}});i=f.call(u,c)},s)}}function D(t){var n=t,r,i,s=function(e){return""+e.text};if(e.isArray(n)){i=n;n={results:i}}if(e.isFunction(n)===!1){i=n;n=function(){return i}}var o=n();if(o.text){s=o.text;if(!e.isFunction(s)){r=o.text;s=function(e){return e[r]}}}return function(t){var r=t.term,i={results:[]},o;if(r===""){t.callback(n());return}o=function(n,i){var u,a;n=n[0];if(n.children){u={};for(a in n)n.hasOwnProperty(a)&&(u[a]=n[a]);u.children=[];e(n.children).each2(function(e,t){o(t,u.children)});(u.children.length||t.matcher(r,s(u),n))&&i.push(u)}else t.matcher(r,s(n),n)&&i.push(n)};e(n().results).each2(function(e,t){o(t,i.results)});t.callback(i)}}function P(n){var r=e.isFunction(n);return function(i){var s=i.term,o={results:[]};e(r?n():n).each(function(){var e=this.text!==t,n=e?this.text:this;(s===""||i.matcher(s,n))&&o.results.push(e?this:{id:this,text:this})});i.callback(o)}}function H(t,n){if(e.isFunction(t))return!0;if(!t)return!1;throw new Error(n+" must be a function or a falsy value")}function B(t){return e.isFunction(t)?t():t}function j(t){var n=0;e.each(t,function(e,t){t.children?n+=j(t.children):n++});return n}function F(e,n,r,i){var s=e,o=!1,u,a,f,l,c;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return t;for(;;){a=-1;for(f=0,l=i.tokenSeparators.length;f=0)break}if(a<0)break;u=e.substring(0,a);e=e.substring(a+c.length);if(u.length>0){u=i.createSearchChoice.call(this,u,n);if(u!==t&&u!==null&&i.id(u)!==t&&i.id(u)!==null){o=!1;for(f=0,l=n.length;f=112&&e<=123}},c="
",h={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z"};f=e(document);o=function(){var e=1;return function(){return e++}}();f.on("mousemove",function(e){a.x=e.pageX;a.y=e.pageY});r=I(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(n){var r,i,s=".select2-results",u,a;this.opts=n=this.prepareOpts(n);this.id=n.id;n.element.data("select2")!==t&&n.element.data("select2")!==null&&n.element.data("select2").destroy();this.container=this.createContainer();this.containerId="s2id_"+(n.element.attr("id")||"autogen"+o());this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1");this.container.attr("id",this.containerId);this.body=S(function(){return n.element.closest("body")});A(this.container,this.opts.element,this.opts.adaptContainerCssClass);this.container.attr("style",n.element.attr("style"));this.container.css(B(n.containerCss));this.container.addClass(B(n.containerCssClass));this.elementTabIndex=this.opts.element.attr("tabindex");this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",C);this.container.data("select2",this);this.dropdown=this.container.find(".select2-drop");A(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass);this.dropdown.addClass(B(n.dropdownCssClass));this.dropdown.data("select2",this);this.dropdown.on("click",C);this.results=r=this.container.find(s);this.search=i=this.container.find("input.select2-input");this.queryCount=0;this.resultsPage=0;this.context=null;this.initContainer();this.container.on("click",C);w(this.results);this.dropdown.on("mousemove-filtered touchstart touchmove touchend",s,this.bind(this.highlightUnderEvent));x(80,this.results);this.dropdown.on("scroll-debounced",s,this.bind(this.loadMoreIfNeeded));e(this.container).on("change",".select2-input",function(e){e.stopPropagation()});e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()});e.fn.mousewheel&&r.mousewheel(function(e,t,n,i){var s=r.scrollTop(),o;if(i>0&&s-i<=0){r.scrollTop(0);C(e)}else if(i<0&&r.get(0).scrollHeight-r.scrollTop()+i<=r.height()){r.scrollTop(r.get(0).scrollHeight-r.height());C(e)}});b(i);i.on("keyup-change input paste",this.bind(this.updateResults));i.on("focus",function(){i.addClass("select2-focused")});i.on("blur",function(){i.removeClass("select2-focused")});this.dropdown.on("mouseup",s,this.bind(function(t){if(e(t.target).closest(".select2-result-selectable").length>0){this.highlightUnderEvent(t);this.selectHighlighted(t)}}));this.dropdown.on("click mouseup mousedown",function(e){e.stopPropagation()});if(e.isFunction(this.opts.initSelection)){this.initSelection();this.monitorSource()}n.maximumInputLength!==null&&this.search.attr("maxlength",n.maximumInputLength);var u=n.element.prop("disabled");u===t&&(u=!1);this.enable(!u);var a=n.element.prop("readonly");a===t&&(a=!1);this.readonly(a);l=l||v();this.autofocus=n.element.prop("autofocus");n.element.prop("autofocus",!1);this.autofocus&&this.focus();this.nextSearchTerm=t},destroy:function(){var e=this.opts.element,n=e.data("select2");this.close();if(this.propertyObserver){delete this.propertyObserver;this.propertyObserver=null}if(n!==t){n.container.remove();n.dropdown.remove();e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1);this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex");e.show()}},optionToData:function(e){if(e.is("option"))return{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:m(e.attr("locked"),"locked")||m(e.data("locked"),!0)};if(e.is("optgroup"))return{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}},prepareOpts:function(n){var r,i,s,o,u=this;r=n.element;r.get(0).tagName.toLowerCase()==="select"&&(this.select=i=n.element);i&&e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in n)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a ","
"," ","
    ","
","
"].join(""));return t},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var n,r,i;this.opts.minimumResultsForSearch>=0&&this.showSearch(!0);this.parent.opening.apply(this,arguments);this.showSearchInput!==!1&&this.search.val(this.focusser.val());this.search.focus();n=this.search.get(0);if(n.createTextRange){r=n.createTextRange();r.collapse(!1);r.select()}else if(n.setSelectionRange){i=this.search.val().length;n.setSelectionRange(i,i)}if(this.search.val()===""&&this.nextSearchTerm!=t){this.search.val(this.nextSearchTerm);this.search.select()}this.focusser.prop("disabled",!0).val("");this.updateResults(!0);this.opts.element.trigger(e.Event("select2-open"))},close:function(e){if(!this.opened())return;this.parent.close.apply(this,arguments);e=e||{focus:!0};this.focusser.removeAttr("disabled");e.focus&&this.focusser.focus()},focus:function(){if(this.opened())this.close();else{this.focusser.removeAttr("disabled");this.focusser.focus()}},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments);this.focusser.removeAttr("disabled");this.focusser.focus()},destroy:function(){e("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id"));this.parent.destroy.apply(this,arguments)},initContainer:function(){var t,r=this.container,i=this.dropdown;this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0);this.selection=t=r.find(".select2-choice");this.focusser=r.find(".select2-focusser");this.focusser.attr("id","s2id_autogen"+o());e("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id"));this.focusser.attr("tabindex",this.elementTabIndex);this.search.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;if(e.which===n.PAGE_UP||e.which===n.PAGE_DOWN){C(e);return}switch(e.which){case n.UP:case n.DOWN:this.moveHighlight(e.which===n.UP?-1:1);C(e);return;case n.ENTER:this.selectHighlighted();C(e);return;case n.TAB:this.selectHighlighted({noFocus:!0});return;case n.ESC:this.cancel(e);C(e);return}}));this.search.on("blur",this.bind(function(e){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)}));this.focusser.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;if(e.which===n.TAB||n.isControl(e)||n.isFunctionKey(e)||e.which===n.ESC)return;if(this.opts.openOnEnter===!1&&e.which===n.ENTER){C(e);return}if(e.which==n.DOWN||e.which==n.UP||e.which==n.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;this.open();C(e);return}if(e.which==n.DELETE||e.which==n.BACKSPACE){this.opts.allowClear&&this.clear();C(e);return}}));b(this.focusser);this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){e.stopPropagation();if(this.opened())return;this.open()}}));t.on("mousedown","abbr",this.bind(function(e){if(!this.isInterfaceEnabled())return;this.clear();k(e);this.close();this.selection.focus()}));t.on("mousedown",this.bind(function(t){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus"));this.opened()?this.close():this.isInterfaceEnabled()&&this.open();C(t)}));i.on("mousedown",this.bind(function(){this.search.focus()}));t.on("focus",this.bind(function(e){C(e)}));this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus"));this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){if(!this.opened()){this.container.removeClass("select2-container-active");this.opts.element.trigger(e.Event("select2-blur"))}}));this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus"));this.container.addClass("select2-container-active")}));this.initContainerWidth();this.opts.element.addClass("select2-offscreen");this.setPlaceholder()},clear:function(t){var n=this.selection.data("select2-data");if(n){var r=e.Event("select2-clearing");this.opts.element.trigger(r);if(r.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():"");this.selection.find(".select2-chosen").empty();this.selection.removeData("select2-data");this.setPlaceholder();if(t!==!1){this.opts.element.trigger({type:"select2-removed",val:this.id(n),choice:n});this.triggerChange({removed:n})}}},initSelection:function(){var e;if(this.isPlaceholderOptionSelected()){this.updateSelection(null);this.close();this.setPlaceholder()}else{var n=this;this.opts.initSelection.call(null,this.opts.element,function(e){if(e!==t&&e!==null){n.updateSelection(e);n.close();n.setPlaceholder()}})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()?(e=this.getPlaceholderOption())!==t&&e.is(":selected")||this.opts.element.val()===""||this.opts.element.val()===t||this.opts.element.val()===null:!1},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;t.element.get(0).tagName.toLowerCase()==="select"?t.initSelection=function(e,t){var r=e.find(":selected");t(n.optionToData(r))}:"data"in t&&(t.initSelection=t.initSelection||function(n,r){var i=n.val(),s=null;t.query({matcher:function(e,n,r){var o=m(i,t.id(r));o&&(s=r);return o},callback:e.isFunction(r)?function(){r(s)}:e.noop})});return t},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===t?t:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e));this.selection.addClass("select2-default");this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,n){var r=0,i=this,s=!0;this.findHighlightableChoices().each2(function(e,t){if(m(i.id(t.data("select2-data")),i.opts.element.val())){r=e;return!1}});n!==!1&&(t===!0&&r>=0?this.highlight(r):this.highlight(0));if(t===!0){var o=this.opts.minimumResultsForSearch;o>=0&&this.showSearch(j(e.results)>=o)}},showSearch:function(t){if(this.showSearchInput===t)return;this.showSearchInput=t;this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t);this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t);e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t)},onSelect:function(e,t){if(!this.triggerSelect(e))return;var n=this.opts.element.val(),r=this.data();this.opts.element.val(this.id(e));this.updateSelection(e);this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e});this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val());this.close();(!t||!t.noFocus)&&this.focusser.focus();m(n,this.id(e))||this.triggerChange({added:e,removed:r})},updateSelection:function(e){var n=this.selection.find(".select2-chosen"),r,i;this.selection.data("select2-data",e);n.empty();e!==null&&(r=this.opts.formatSelection(e,n,this.opts.escapeMarkup));r!==t&&n.append(r);i=this.opts.formatSelectionCssClass(e,n);i!==t&&n.addClass(i);this.selection.removeClass("select2-default");this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var e,n=!1,r=null,i=this,s=this.data();if(arguments.length===0)return this.opts.element.val();e=arguments[0];arguments.length>1&&(n=arguments[1]);if(this.select){this.select.val(e).find(":selected").each2(function(e,t){r=i.optionToData(t);return!1});this.updateSelection(r);this.setPlaceholder();n&&this.triggerChange({added:r,removed:s})}else{if(!e&&e!==0){this.clear(n);return}if(this.opts.initSelection===t)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e);this.opts.initSelection(this.opts.element,function(e){i.opts.element.val(e?i.id(e):"");i.updateSelection(e);i.setPlaceholder();n&&i.triggerChange({added:e,removed:s})})}},clearSearch:function(){this.search.val("");this.focusser.val("")},data:function(e){var n,r=!1;if(arguments.length===0){n=this.selection.data("select2-data");n==t&&(n=null);return n}arguments.length>1&&(r=arguments[1]);if(!e)this.clear(r);else{n=this.data();this.opts.element.val(e?this.id(e):"");this.updateSelection(e);r&&this.triggerChange({added:e,removed:n})}}});s=I(r,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["
    ","
  • "," ","
  • ","
","
","
    ","
","
"].join(""));return t},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;t.element.get(0).tagName.toLowerCase()==="select"?t.initSelection=function(e,t){var r=[];e.find(":selected").each2(function(e,t){r.push(n.optionToData(t))});t(r)}:"data"in t&&(t.initSelection=t.initSelection||function(n,r){var i=g(n.val(),t.separator),s=[];t.query({matcher:function(n,r,o){var u=e.grep(i,function(e){return m(e,t.id(o))}).length;u&&s.push(o);return u},callback:e.isFunction(r)?function(){var e=[];for(var n=0;n0)return;this.selectChoice(null);this.clearPlaceholder();this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus"));this.open();this.focusSearch();t.preventDefault()}));this.container.on("focus",t,this.bind(function(){if(!this.isInterfaceEnabled())return;this.container.hasClass("select2-container-active")||this.opts.element.trigger(e.Event("select2-focus"));this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active");this.clearPlaceholder()}));this.initContainerWidth();this.opts.element.addClass("select2-offscreen");this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){var e;if(this.opts.element.val()===""&&this.opts.element.text()===""){this.updateSelection([]);this.close();this.clearSearch()}if(this.select||this.opts.element.val()!==""){var n=this;this.opts.initSelection.call(null,this.opts.element,function(e){if(e!==t&&e!==null){n.updateSelection(e);n.close();n.clearSearch()}})}},clearSearch:function(){var e=this.getPlaceholder(),n=this.getMaxSearchWidth();if(e!==t&&this.getVal().length===0&&this.search.hasClass("select2-focused")===!1){this.search.val(e).addClass("select2-default");this.search.width(n>0?n:this.container.css("width"))}else this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder();this.resizeSearch();this.parent.opening.apply(this,arguments);this.focusSearch();this.updateResults(!0);this.search.focus();this.opts.element.trigger(e.Event("select2-open"))},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments)},focus:function(){this.close();this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(t){var n=[],r=[],i=this;e(t).each(function(){if(d(i.id(this),n)<0){n.push(i.id(this));r.push(this)}});t=r;this.selection.find(".select2-search-choice").remove();e(t).each(function(){i.addSelectedChoice(this)});i.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts);if(e!=null&&e!=t){this.search.val(e);e.length>0&&this.open()}},onSelect:function(e,t){if(!this.triggerSelect(e))return;this.addSelectedChoice(e);this.opts.element.trigger({type:"selected",val:this.id(e),choice:e});(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(e,!1,this.opts.closeOnSelect===!0);if(this.opts.closeOnSelect){this.close();this.search.width(10)}else if(this.countSelectableResults()>0){this.search.width(10);this.resizeSearch();this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0);this.positionDropdown()}else{this.close();this.search.width(10)}this.triggerChange({added:e});(!t||!t.noFocus)&&this.focusSearch()},cancel:function(){this.close();this.focusSearch()},addSelectedChoice:function(n){var r=!n.locked,i=e("
  • "),s=e("
  • "),o=r?i:s,u=this.id(n),a=this.getVal(),f,l;f=this.opts.formatSelection(n,o.find("div"),this.opts.escapeMarkup);f!=t&&o.find("div").replaceWith("
    "+f+"
    ");l=this.opts.formatSelectionCssClass(n,o.find("div"));l!=t&&o.addClass(l);r&&o.find(".select2-search-choice-close").on("mousedown",C).on("click dblclick",this.bind(function(t){if(!this.isInterfaceEnabled())return;e(t.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(e(t.target));this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");this.close();this.focusSearch()})).dequeue();C(t)})).on("focus",this.bind(function(){if(!this.isInterfaceEnabled())return;this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active")}));o.data("select2-data",n);o.insertBefore(this.searchContainer);a.push(u);this.setVal(a)},unselect:function(e){var t=this.getVal(),n,r;e=e.closest(".select2-search-choice");if(e.length===0)throw"Invalid argument: "+e+". Must be .select2-search-choice";n=e.data("select2-data");if(!n)return;while((r=d(this.id(n),t))>=0){t.splice(r,1);this.setVal(t);this.select&&this.postprocessResults()}e.remove();this.opts.element.trigger({type:"removed",val:this.id(n),choice:n});this.triggerChange({removed:n})},postprocessResults:function(e,t,n){var r=this.getVal(),i=this.results.find(".select2-result"),s=this.results.find(".select2-result-with-children"),o=this;i.each2(function(e,t){var n=o.id(t.data("select2-data"));if(d(n,r)>=0){t.addClass("select2-selected");t.find(".select2-result-selectable").addClass("select2-selected")}});s.each2(function(e,t){!t.is(".select2-result-selectable")&&t.find(".select2-result-selectable:not(.select2-selected)").length===0&&t.addClass("select2-selected")});this.highlight()==-1&&n!==!1&&o.highlight(0);!this.opts.createSearchChoice&&!i.filter(".select2-result:not(.select2-selected)").length>0&&(!e||e&&!e.more&&this.results.find(".select2-no-results").length===0)&&H(o.opts.formatNoMatches,"formatNoMatches")&&this.results.append("
  • "+o.opts.formatNoMatches(o.search.val())+"
  • ")},getMaxSearchWidth:function(){return this.selection.width()-y(this.search)},resizeSearch:function(){var e,t,n,r,i,s=y(this.search);e=L(this.search)+10;t=this.search.offset().left;n=this.selection.width();r=this.selection.offset().left;i=n-(t-r)-s;i. Attach to instead.");this.search.width(0);this.searchContainer.hide()},onSortEnd:function(){var t=[],n=this;this.searchContainer.show();this.searchContainer.appendTo(this.searchContainer.parent());this.resizeSearch();this.selection.find(".select2-search-choice").each(function(){t.push(n.opts.id(e(this).data("select2-data")))});this.setVal(t);this.triggerChange()},data:function(t,n){var r=this,i,s;if(arguments.length===0)return this.selection.find(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get();s=this.data();t||(t=[]);i=e.map(t,function(e){return r.opts.id(e)});this.setVal(i);this.updateSelection(t);this.clearSearch();n&&this.triggerChange(this.buildChangeDetails(s,this.data()))}});e.fn.select2=function(){var n=Array.prototype.slice.call(arguments,0),r,o,u,a,f,l=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],c=["opened","isFocused","container","dropdown"],h=["val","data"],p={search:"externalSearch"};this.each(function(){if(n.length===0||typeof n[0]=="object"){r=n.length===0?{}:e.extend({},n[0]);r.element=e(this);if(r.element.get(0).tagName.toLowerCase()==="select")f=r.element.prop("multiple");else{f=r.multiple||!1;"tags"in r&&(r.multiple=f=!0)}o=f?new s:new i;o.init(r)}else{if(typeof n[0]!="string")throw"Invalid arguments to select2 plugin: "+n;if(d(n[0],l)<0)throw"Unknown method: "+n[0];a=t;o=e(this).data("select2");if(o===t)return;u=n[0];if(u==="container")a=o.container;else if(u==="dropdown")a=o.dropdown;else{p[u]&&(u=p[u]);a=o[u].apply(o,n.slice(1))}if(d(n[0],c)>=0||d(n[0],h)&&n.length==1)return!1}});return a===t?this:a};e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,n,r){var i=[];O(e.text,n.term,i,r);return i.join("")},formatSelection:function(e,n,r){return e?r(e.text):t},sortResults:function(e,t,n){return e},formatResultCssClass:function(e){return t},formatSelectionCssClass:function(e,n){return t},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(e,t){var n=t-e.length;return"Please enter "+n+" more character"+(n==1?"":"s")},formatInputTooLong:function(e,t){var n=e.length-t;return"Please delete "+n+" character"+(n==1?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(e==1?"":"s")},formatLoadMore:function(e){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e.id},matcher:function(e,t){return p(""+t).toUpperCase().indexOf(p(""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:F,escapeMarkup:M,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,n){return t}};e.fn.select2.ajaxDefaults={transport:e.ajax,params:{type:"GET",cache:!1,dataType:"json"}};window.Select2={query:{ajax:_,local:D,tags:P},util:{debounce:E,markMatch:O,escapeMarkup:M,stripDiacritics:p},"class":{"abstract":r,single:i,multi:s}}})(jQuery);