| 
					
				 | 
			
			
				@@ -9594,10 +9594,13 @@ define('select2/utils',[], function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 define('select2/data/select',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  '../utils' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-], function (Utils) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  '../utils', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  'jquery' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+], function (Utils, $) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   function SelectAdapter ($element, options) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.$element = $element; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    SelectAdapter.__super__.constructor.call(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   Utils.Extend(SelectAdapter, Utils.Observable); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9617,6 +9620,32 @@ define('select2/data/select',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     callback(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  SelectAdapter.prototype.select = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var val; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (this.$element.prop("multiple")) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      var currentData = this.current(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      data = [data]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      data.push(currentData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      val = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      for (var d = 0; d < data.length; d++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        id = data[d].id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ids.indexOf(id) === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          val.push(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      val = data.id; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.$element.val(val); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.$element.trigger("change"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   SelectAdapter.prototype.query = function (params, callback) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var data = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var self = this; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9644,6 +9673,10 @@ define('select2/data/select',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   SelectAdapter.prototype.matches = function (params, data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if ($.trim(params.term) == "") { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (data.text.indexOf(params.term) > -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9659,7 +9692,9 @@ define('select2/results',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ], function (Utils) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   function Results ($element, dataAdapter) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.$element = $element; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.dataAdapter = dataAdapter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.data = dataAdapter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    Results.__super__.constructor.call(this); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   Utils.Extend(Results, Utils.Observable); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9669,9 +9704,62 @@ define('select2/results',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       '<ul class="options"></ul>' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.$results = $results; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return $results; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  Results.prototype.clear = function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.$results.empty(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  Results.prototype.append = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var $options = []; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    for (var d = 0; d < data.length; d++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      var item = data[d]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      var $option = this.option(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      $options.push($option); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.$results.append($options); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  Results.prototype.option = function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var $option = $( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      '<li class="option"></li>' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $option.html(data.text); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    $option.data("data", data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    return $option; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  Results.prototype.bind = function ($container) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.on("results:all", function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.clear(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.append(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.on("results:append", function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.append(data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.$results.on("click", ".option", function (evt) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      var data = $(this).data("data"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.trigger("selected", { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        originalEvent: evt, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        data: data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return Results; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9817,15 +9905,10 @@ define('select2/core',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // Bind events 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.selection.bind($container); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // Set the initial state 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var self = this; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    this.data.current(function (initialData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      self.selection.update(initialData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.selection.bind($container); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.results.bind($container); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.$element.on("change", function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       self.data.current(function (data) { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9836,6 +9919,21 @@ define('select2/core',[ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     this.selection.on("toggle", function () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       $container.toggleClass("open"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.results.on("selected", function (params) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.data.select(params.data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      $container.removeClass("open"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // Set the initial state 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.data.current(function (initialData) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.selection.update(initialData); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    this.data.query({}, function (data) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      self.results.trigger("results:all", data); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   Utils.Extend(Select2, Utils.Observable); 
			 |