vendor: 106,644 bytes, lines 1-1746
1/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */ ! function(a) { 2 "function" == typeof define && define.amd ? define(["jquery"], a) : a("object" == typeof exports ? require("jquery") : jQuery) 3}(function(a) { 4 var b = function() { 5 if (a && a.fn && a.fn.select2 && a.fn.select2.amd) var b = a.fn.select2.amd; 6 var b; 7 return function() { 8 if (!b || !b.requirejs) { 9 b ? c = b : b = {}; 10 var a, c, d; 11 ! function(b) { 12 function e(a, b) { 13 return u.call(a, b) 14 } 15 16 function f(a, b) { 17 var c, d, e, f, g, h, i, j, k, l, m, n = b && b.split("/"), 18 o = s.map, 19 p = o && o["*"] || {}; 20 if (a && "." === a.charAt(0)) 21 if (b) { 22 for (a = a.split("/"), g = a.length - 1, s.nodeIdCompat && w.test(a[g]) && (a[g] = a[g].replace(w, "")), a = n.slice(0, n.length - 1).concat(a), k = 0; k < a.length; k += 1) 23 if (m = a[k], "." === m) a.splice(k, 1), k -= 1; 24 else if (".." === m) { 25 if (1 === k && (".." === a[2] || ".." === a[0])) break; 26 k > 0 && (a.splice(k - 1, 2), k -= 2) 27 } 28 a = a.join("/") 29 } else 0 === a.indexOf("./") && (a = a.substring(2)); 30 if ((n || p) && o) { 31 for (c = a.split("/"), k = c.length; k > 0; k -= 1) { 32 if (d = c.slice(0, k).join("/"), n) 33 for (l = n.length; l > 0; l -= 1) 34 if (e = o[n.slice(0, l).join("/")], e && (e = e[d])) { 35 f = e, h = k; 36 break 37 } 38 if (f) break; 39 !i && p && p[d] && (i = p[d], j = k) 40 }!f && i && (f = i, h = j), f && (c.splice(0, h, f), a = c.join("/")) 41 } 42 return a 43 } 44 45 function g(a, c) { 46 return function() { 47 var d = v.call(arguments, 0); 48 return "string" != typeof d[0] && 1 === d.length && d.push(null), n.apply(b, d.concat([a, c])) 49 } 50 } 51 52 function h(a) { 53 return function(b) { 54 return f(b, a) 55 } 56 } 57 58 function i(a) { 59 return function(b) { 60 q[a] = b 61 } 62 } 63 64 function j(a) { 65 if (e(r, a)) { 66 var c = r[a]; 67 delete r[a], t[a] = !0, m.apply(b, c) 68 } 69 if (!e(q, a) && !e(t, a)) throw new Error("No " + a); 70 return q[a] 71 } 72 73 function k(a) { 74 var b, c = a ? a.indexOf("!") : -1; 75 return c > -1 && (b = a.substring(0, c), a = a.substring(c + 1, a.length)), [b, a] 76 } 77 78 function l(a) { 79 return function() { 80 return s && s.config && s.config[a] || {} 81 } 82 } 83 var m, n, o, p, q = {}, 84 r = {}, 85 s = {}, 86 t = {}, 87 u = Object.prototype.hasOwnProperty, 88 v = [].slice, 89 w = /\.js$/; 90 o = function(a, b) { 91 var c, d = k(a), 92 e = d[0]; 93 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))), { 94 f: e ? e + "!" + a : a, 95 n: a, 96 pr: e, 97 p: c 98 } 99 }, p = { 100 require: function(a) { 101 return g(a) 102 }, 103 exports: function(a) { 104 var b = q[a]; 105 return "undefined" != typeof b ? b : q[a] = {} 106 }, 107 module: function(a) { 108 return { 109 id: a, 110 uri: "", 111 exports: q[a], 112 config: l(a) 113 } 114 } 115 }, m = function(a, c, d, f) { 116 var h, k, l, m, n, s, u = [], 117 v = typeof d; 118 if (f = f || a, "undefined" === v || "function" === v) { 119 for (c = !c.length && d.length ? ["require", "exports", "module"] : c, n = 0; n < c.length; n += 1) 120 if (m = o(c[n], f), k = m.f, "require" === k) u[n] = p.require(a); 121 else if ("exports" === k) u[n] = p.exports(a), s = !0; 122 else if ("module" === k) h = u[n] = p.module(a); 123 else if (e(q, k) || e(r, k) || e(t, k)) u[n] = j(k); 124 else { 125 if (!m.p) throw new Error(a + " missing " + k); 126 m.p.load(m.n, g(f, !0), i(k), {}), u[n] = q[k] 127 } 128 l = d ? d.apply(q[a], u) : void 0, a && (h && h.exports !== b && h.exports !== q[a] ? q[a] = h.exports : l === b && s || (q[a] = l)) 129 } else a && (q[a] = d) 130 }, a = c = n = function(a, c, d, e, f) { 131 if ("string" == typeof a) return p[a] ? p[a](c) : j(o(a, c).f); 132 if (!a.splice) { 133 if (s = a, s.deps && n(s.deps, s.callback), !c) return; 134 c.splice ? (a = c, c = d, d = null) : a = b 135 } 136 return c = c || function() {}, "function" == typeof d && (d = e, e = f), e ? m(b, a, c, d) : setTimeout(function() { 137 m(b, a, c, d) 138 }, 4), n 139 }, n.config = function(a) { 140 return n(a) 141 }, a._defined = q, d = function(a, b, c) { 142 if ("string" != typeof a) throw new Error("See almond README: incorrect module build, no module name"); 143 b.splice || (c = b, b = []), e(q, a) || e(r, a) || (r[a] = [a, b, c]) 144 }, d.amd = { 145 jQuery: !0 146 } 147 }(), b.requirejs = a, b.require = c, b.define = d 148 } 149 }(), b.define("almond", function() {}), b.define("jquery", [], function() { 150 var b = a || $; 151 return null == b && console && console.error && console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."), b 152 }), b.define("select2/utils", ["jquery"], function(a) { 153 function b(a) { 154 var b = a.prototype, 155 c = []; 156 for (var d in b) { 157 var e = b[d]; 158 "function" == typeof e && "constructor" !== d && c.push(d) 159 } 160 return c 161 } 162 var c = {}; 163 c.Extend = function(a, b) { 164 function c() { 165 this.constructor = a 166 } 167 var d = {}.hasOwnProperty; 168 for (var e in b) d.call(b, e) && (a[e] = b[e]); 169 return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a 170 }, c.Decorate = function(a, c) { 171 function d() { 172 var b = Array.prototype.unshift, 173 d = c.prototype.constructor.length, 174 e = a.prototype.constructor; 175 d > 0 && (b.call(arguments, a.prototype.constructor), e = c.prototype.constructor), e.apply(this, arguments) 176 } 177 178 function e() { 179 this.constructor = d 180 } 181 var f = b(c), 182 g = b(a); 183 c.displayName = a.displayName, d.prototype = new e; 184 for (var h = 0; h < g.length; h++) { 185 var i = g[h]; 186 d.prototype[i] = a.prototype[i] 187 } 188 for (var j = (function(a) { 189 var b = function() {}; 190 a in d.prototype && (b = d.prototype[a]); 191 var e = c.prototype[a]; 192 return function() { 193 var a = Array.prototype.unshift; 194 return a.call(arguments, b), e.apply(this, arguments) 195 } 196 }), k = 0; k < f.length; k++) { 197 var l = f[k]; 198 d.prototype[l] = j(l) 199 } 200 return d 201 }; 202 var d = function() { 203 this.listeners = {} 204 }; 205 return d.prototype.on = function(a, b) { 206 this.listeners = this.listeners || {}, a in this.listeners ? this.listeners[a].push(b) : this.listeners[a] = [b] 207 }, d.prototype.trigger = function(a) { 208 var b = Array.prototype.slice, 209 c = b.call(arguments, 1); 210 this.listeners = this.listeners || {}, null == c && (c = []), 0 === c.length && c.push({}), c[0]._type = a, a in this.listeners && this.invoke(this.listeners[a], b.call(arguments, 1)), "*" in this.listeners && this.invoke(this.listeners["*"], arguments) 211 }, d.prototype.invoke = function(a, b) { 212 for (var c = 0, d = a.length; d > c; c++) a[c].apply(this, b) 213 }, c.Observable = d, c.generateChars = function(a) { 214 for (var b = "", c = 0; a > c; c++) { 215 var d = Math.floor(36 * Math.random()); 216 b += d.toString(36) 217 } 218 return b 219 }, c.bind = function(a, b) { 220 return function() { 221 a.apply(b, arguments) 222 } 223 }, c._convertData = function(a) { 224 for (var b in a) { 225 var c = b.split("-"), 226 d = a; 227 if (1 !== c.length) { 228 for (var e = 0; e < c.length; e++) { 229 var f = c[e]; 230 f = f.substring(0, 1).toLowerCase() + f.substring(1), f in d || (d[f] = {}), e == c.length - 1 && (d[f] = a[b]), d = d[f] 231 } 232 delete a[b] 233 } 234 } 235 return a 236 }, c.hasScroll = function(b, c) { 237 var d = a(c), 238 e = c.style.overflowX, 239 f = c.style.overflowY; 240 return e !== f || "hidden" !== f && "visible" !== f ? "scroll" === e || "scroll" === f ? !0 : d.innerHeight() < c.scrollHeight || d.innerWidth() < c.scrollWidth : !1 241 }, c.escapeMarkup = function(a) { 242 var b = { 243 "\\": "\", 244 "&": "&", 245 "<": "<", 246 ">": ">", 247 '"': """, 248 "'": "'", 249 "/": "/" 250 }; 251 return "string" != typeof a ? a : String(a).replace(/[&<>"'\/\\]/g, function(a) { 252 return b[a] 253 }) 254 }, c.appendMany = function(b, c) { 255 if ("1.7" === a.fn.jquery.substr(0, 3)) { 256 var d = a(); 257 a.map(c, function(a) { 258 d = d.add(a) 259 }), c = d 260 } 261 b.append(c) 262 }, c 263 }), b.define("select2/results", ["jquery", "./utils"], function(a, b) { 264 function c(a, b, d) { 265 this.$element = a, this.data = d, this.options = b, c.__super__.constructor.call(this) 266 } 267 return b.Extend(c, b.Observable), c.prototype.render = function() { 268 var b = a('<ul class="select2-results__options" role="tree"></ul>'); 269 return this.options.get("multiple") && b.attr("aria-multiselectable", "true"), this.$results = b, b 270 }, c.prototype.clear = function() { 271 this.$results.empty() 272 }, c.prototype.displayMessage = function(b) { 273 var c = this.options.get("escapeMarkup"); 274 this.clear(), this.hideLoading(); 275 var d = a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'), 276 e = this.options.get("translations").get(b.message); 277 d.append(c(e(b.args))), d[0].className += " select2-results__message", this.$results.append(d) 278 }, c.prototype.hideMessages = function() { 279 this.$results.find(".select2-results__message").remove() 280 }, c.prototype.append = function(a) { 281 this.hideLoading(); 282 var b = []; 283 if (null == a.results || 0 === a.results.length) return void(0 === this.$results.children().length && this.trigger("results:message", { 284 message: "noResults" 285 })); 286 a.results = this.sort(a.results); 287 for (var c = 0; c < a.results.length; c++) { 288 var d = a.results[c], 289 e = this.option(d); 290 b.push(e) 291 } 292 this.$results.append(b) 293 }, c.prototype.position = function(a, b) { 294 var c = b.find(".select2-results"); 295 c.append(a) 296 }, c.prototype.sort = function(a) { 297 var b = this.options.get("sorter"); 298 return b(a) 299 }, c.prototype.highlightFirstItem = function() { 300 var a = this.$results.find(".select2-results__option[aria-selected]"), 301 b = a.filter("[aria-selected=true]"); 302 b.length > 0 ? b.first().trigger("mouseenter") : a.first().trigger("mouseenter"), this.ensureHighlightVisible() 303 }, c.prototype.setClasses = function() { 304 var b = this; 305 this.data.current(function(c) { 306 var d = a.map(c, function(a) { 307 return a.id.toString() 308 }), 309 e = b.$results.find(".select2-results__option[aria-selected]"); 310 e.each(function() { 311 var b = a(this), 312 c = a.data(this, "data"), 313 e = "" + c.id; 314 null != c.element && c.element.selected || null == c.element && a.inArray(e, d) > -1 ? b.attr("aria-selected", "true") : b.attr("aria-selected", "false") 315 }) 316 }) 317 }, c.prototype.showLoading = function(a) { 318 this.hideLoading(); 319 var b = this.options.get("translations").get("searching"), 320 c = { 321 disabled: !0, 322 loading: !0, 323 text: b(a) 324 }, 325 d = this.option(c); 326 d.className += " loading-results", this.$results.prepend(d) 327 }, c.prototype.hideLoading = function() { 328 this.$results.find(".loading-results").remove() 329 }, c.prototype.option = function(b) { 330 var c = document.createElement("li"); 331 c.className = "select2-results__option"; 332 var d = { 333 role: "treeitem", 334 "aria-selected": "false" 335 }; 336 b.disabled && (delete d["aria-selected"], d["aria-disabled"] = "true"), null == b.id && delete d["aria-selected"], null != b._resultId && (c.id = b._resultId), b.title && (c.title = b.title), b.children && (d.role = "group", d["aria-label"] = b.text, delete d["aria-selected"]); 337 for (var e in d) { 338 var f = d[e]; 339 c.setAttribute(e, f) 340 } 341 if (b.children) { 342 var g = a(c), 343 h = document.createElement("strong"); 344 h.className = "select2-results__group"; 345 a(h); 346 this.template(b, h); 347 for (var i = [], j = 0; j < b.children.length; j++) { 348 var k = b.children[j], 349 l = this.option(k); 350 i.push(l) 351 } 352 var m = a("<ul></ul>", { 353 "class": "select2-results__options select2-results__options--nested" 354 }); 355 m.append(i), g.append(h), g.append(m) 356 } else this.template(b, c); 357 return a.data(c, "data", b), c 358 }, c.prototype.bind = function(b, c) { 359 var d = this, 360 e = b.id + "-results"; 361 this.$results.attr("id", e), b.on("results:all", function(a) { 362 d.clear(), d.append(a.data), b.isOpen() && (d.setClasses(), d.highlightFirstItem()) 363 }), b.on("results:append", function(a) { 364 d.append(a.data), b.isOpen() && d.setClasses() 365 }), b.on("query", function(a) { 366 d.hideMessages(), d.showLoading(a) 367 }), b.on("select", function() { 368 b.isOpen() && (d.setClasses(), d.highlightFirstItem()) 369 }), b.on("unselect", function() { 370 b.isOpen() && (d.setClasses(), d.highlightFirstItem()) 371 }), b.on("open", function() { 372 d.$results.attr("aria-expanded", "true"), d.$results.attr("aria-hidden", "false"), d.setClasses(), d.ensureHighlightVisible() 373 }), b.on("close", function() { 374 d.$results.attr("aria-expanded", "false"), d.$results.attr("aria-hidden", "true"), d.$results.removeAttr("aria-activedescendant") 375 }), b.on("results:toggle", function() { 376 var a = d.getHighlightedResults(); 377 0 !== a.length && a.trigger("mouseup") 378 }), b.on("results:select", function() { 379 var a = d.getHighlightedResults(); 380 if (0 !== a.length) { 381 var b = a.data("data"); 382 "true" == a.attr("aria-selected") ? d.trigger("close", {}) : d.trigger("select", { 383 data: b 384 }) 385 } 386 }), b.on("results:previous", function() { 387 var a = d.getHighlightedResults(), 388 b = d.$results.find("[aria-selected]"), 389 c = b.index(a); 390 if (0 !== c) { 391 var e = c - 1; 392 0 === a.length && (e = 0); 393 var f = b.eq(e); 394 f.trigger("mouseenter"); 395 var g = d.$results.offset().top, 396 h = f.offset().top, 397 i = d.$results.scrollTop() + (h - g); 398 0 === e ? d.$results.scrollTop(0) : 0 > h - g && d.$results.scrollTop(i) 399 } 400 }), b.on("results:next", function() { 401 var a = d.getHighlightedResults(), 402 b = d.$results.find("[aria-selected]"), 403 c = b.index(a), 404 e = c + 1; 405 if (!(e >= b.length)) { 406 var f = b.eq(e); 407 f.trigger("mouseenter"); 408 var g = d.$results.offset().top + d.$results.outerHeight(!1), 409 h = f.offset().top + f.outerHeight(!1), 410 i = d.$results.scrollTop() + h - g; 411 0 === e ? d.$results.scrollTop(0) : h > g && d.$results.scrollTop(i) 412 } 413 }), b.on("results:focus", function(a) { 414 a.element.addClass("select2-results__option--highlighted") 415 }), b.on("results:message", function(a) { 416 d.displayMessage(a) 417 }), a.fn.mousewheel && this.$results.on("mousewheel", function(a) { 418 var b = d.$results.scrollTop(), 419 c = d.$results.get(0).scrollHeight - b + a.deltaY, 420 e = a.deltaY > 0 && b - a.deltaY <= 0, 421 f = a.deltaY < 0 && c <= d.$results.height(); 422 e ? (d.$results.scrollTop(0), a.preventDefault(), a.stopPropagation()) : f && (d.$results.scrollTop(d.$results.get(0).scrollHeight - d.$results.height()), a.preventDefault(), a.stopPropagation()) 423 }), this.$results.on("mouseup", ".select2-results__option[aria-selected]", function(b) { 424 var c = a(this), 425 e = c.data("data"); 426 return "true" === c.attr("aria-selected") ? void(d.options.get("multiple") ? d.trigger("unselect", { 427 originalEvent: b, 428 data: e 429 }) : d.trigger("close", {})) : void d.trigger("select", { 430 originalEvent: b, 431 data: e 432 }) 433 }), this.$results.on("mouseenter", ".select2-results__option[aria-selected]", function(b) { 434 var c = a(this).data("data"); 435 d.getHighlightedResults().removeClass("select2-results__option--highlighted"), d.trigger("results:focus", { 436 data: c, 437 element: a(this) 438 }) 439 }) 440 }, c.prototype.getHighlightedResults = function() { 441 var a = this.$results.find(".select2-results__option--highlighted"); 442 return a 443 }, c.prototype.destroy = function() { 444 this.$results.remove() 445 }, c.prototype.ensureHighlightVisible = function() { 446 var a = this.getHighlightedResults(); 447 if (0 !== a.length) { 448 var b = this.$results.find("[aria-selected]"), 449 c = b.index(a), 450 d = this.$results.offset().top, 451 e = a.offset().top, 452 f = this.$results.scrollTop() + (e - d), 453 g = e - d; 454 f -= 2 * a.outerHeight(!1), 2 >= c ? this.$results.scrollTop(0) : (g > this.$results.outerHeight() || 0 > g) && this.$results.scrollTop(f) 455 } 456 }, c.prototype.template = function(b, c) { 457 var d = this.options.get("templateResult"), 458 e = this.options.get("escapeMarkup"), 459 f = d(b, c); 460 null == f ? c.style.display = "none" : "string" == typeof f ? c.innerHTML = e(f) : a(c).append(f) 461 }, c 462 }), b.define("select2/keys", [], function() { 463 var a = { 464 BACKSPACE: 8, 465 TAB: 9, 466 ENTER: 13, 467 SHIFT: 16, 468 CTRL: 17, 469 ALT: 18, 470 ESC: 27, 471 SPACE: 32, 472 PAGE_UP: 33, 473 PAGE_DOWN: 34, 474 END: 35, 475 HOME: 36, 476 LEFT: 37, 477 UP: 38, 478 RIGHT: 39, 479 DOWN: 40, 480 DELETE: 46 481 }; 482 return a 483 }), b.define("select2/selection/base", ["jquery", "../utils", "../keys"], function(a, b, c) { 484 function d(a, b) { 485 this.$element = a, this.options = b, d.__super__.constructor.call(this) 486 } 487 return b.Extend(d, b.Observable), d.prototype.render = function() { 488 var b = a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>'); 489 return this._tabindex = 0, null != this.$element.data("old-tabindex") ? this._tabindex = this.$element.data("old-tabindex") : null != this.$element.attr("tabindex") && (this._tabindex = this.$element.attr("tabindex")), b.attr("title", this.$element.attr("title")), b.attr("tabindex", this._tabindex), this.$selection = b, b 490 }, d.prototype.bind = function(a, b) { 491 var d = this, 492 e = (a.id + "-container", a.id + "-results"); 493 this.container = a, this.$selection.on("focus", function(a) { 494 d.trigger("focus", a) 495 }), this.$selection.on("blur", function(a) { 496 d._handleBlur(a) 497 }), this.$selection.on("keydown", function(a) { 498 d.trigger("keypress", a), a.which === c.SPACE && a.preventDefault() 499 }), a.on("results:focus", function(a) { 500 d.$selection.attr("aria-activedescendant", a.data._resultId) 501 }), a.on("selection:update", function(a) { 502 d.update(a.data) 503 }), a.on("open", function() { 504 d.$selection.attr("aria-expanded", "true"), d.$selection.attr("aria-owns", e), d._attachCloseHandler(a) 505 }), a.on("close", function() { 506 d.$selection.attr("aria-expanded", "false"), d.$selection.removeAttr("aria-activedescendant"), d.$selection.removeAttr("aria-owns"), d.$selection.focus(), d._detachCloseHandler(a) 507 }), a.on("enable", function() { 508 d.$selection.attr("tabindex", d._tabindex) 509 }), a.on("disable", function() { 510 d.$selection.attr("tabindex", "-1") 511 }) 512 }, d.prototype._handleBlur = function(b) { 513 var c = this; 514 window.setTimeout(function() { 515 document.activeElement == c.$selection[0] || a.contains(c.$selection[0], document.activeElement) || c.trigger("blur", b) 516 }, 1) 517 }, d.prototype._attachCloseHandler = function(b) { 518 a(document.body).on("mousedown.select2." + b.id, function(b) { 519 var c = a(b.target), 520 d = c.closest(".select2"), 521 e = a(".select2.select2-container--open"); 522 e.each(function() { 523 var b = a(this); 524 if (this != d[0]) { 525 var c = b.data("element"); 526 c.select2("close") 527 } 528 }) 529 }) 530 }, d.prototype._detachCloseHandler = function(b) { 531 a(document.body).off("mousedown.select2." + b.id) 532 }, d.prototype.position = function(a, b) { 533 var c = b.find(".selection"); 534 c.append(a) 535 }, d.prototype.destroy = function() { 536 this._detachCloseHandler(this.container) 537 }, d.prototype.update = function(a) { 538 throw new Error("The `update` method must be defined in child classes.") 539 }, d 540 }), b.define("select2/selection/single", ["jquery", "./base", "../utils", "../keys"], function(a, b, c, d) { 541 function e() { 542 e.__super__.constructor.apply(this, arguments) 543 } 544 return c.Extend(e, b), e.prototype.render = function() { 545 var a = e.__super__.render.call(this); 546 return a.addClass("select2-selection--single"), a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'), a 547 }, e.prototype.bind = function(a, b) { 548 var c = this; 549 e.__super__.bind.apply(this, arguments); 550 var d = a.id + "-container"; 551 this.$selection.find(".select2-selection__rendered").attr("id", d), this.$selection.attr("aria-labelledby", d), this.$selection.on("mousedown", function(a) { 552 1 === a.which && c.trigger("toggle", { 553 originalEvent: a 554 }) 555 }), this.$selection.on("focus", function(a) {}), this.$selection.on("blur", function(a) {}), a.on("focus", function(b) { 556 a.isOpen() || c.$selection.focus() 557 }), a.on("selection:update", function(a) { 558 c.update(a.data) 559 }) 560 }, e.prototype.clear = function() { 561 this.$selection.find(".select2-selection__rendered").empty() 562 }, e.prototype.display = function(a, b) { 563 var c = this.options.get("templateSelection"), 564 d = this.options.get("escapeMarkup"); 565 return d(c(a, b)) 566 }, e.prototype.selectionContainer = function() { 567 return a("<span></span>") 568 }, e.prototype.update = function(a) { 569 if (0 === a.length) return void this.clear(); 570 var b = a[0], 571 c = this.$selection.find(".select2-selection__rendered"), 572 d = this.display(b, c); 573 c.empty().append(d), c.prop("title", b.title || b.text) 574 }, e 575 }), b.define("select2/selection/multiple", ["jquery", "./base", "../utils"], function(a, b, c) { 576 function d(a, b) { 577 d.__super__.constructor.apply(this, arguments) 578 } 579 return c.Extend(d, b), d.prototype.render = function() { 580 var a = d.__super__.render.call(this); 581 return a.addClass("select2-selection--multiple"), a.html('<ul class="select2-selection__rendered"></ul>'), a 582 }, d.prototype.bind = function(b, c) { 583 var e = this; 584 d.__super__.bind.apply(this, arguments), this.$selection.on("click", function(a) { 585 e.trigger("toggle", { 586 originalEvent: a 587 }) 588 }), this.$selection.on("click", ".select2-selection__choice__remove", function(b) { 589 if (!e.options.get("disabled")) { 590 var c = a(this), 591 d = c.parent(), 592 f = d.data("data"); 593 e.trigger("unselect", { 594 originalEvent: b, 595 data: f 596 }) 597 } 598 }) 599 }, d.prototype.clear = function() { 600 this.$selection.find(".select2-selection__rendered").empty() 601 }, d.prototype.display = function(a, b) { 602 var c = this.options.get("templateSelection"), 603 d = this.options.get("escapeMarkup"); 604 return d(c(a, b)) 605 }, d.prototype.selectionContainer = function() { 606 var b = a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>'); 607 return b 608 }, d.prototype.update = function(a) { 609 if (this.clear(), 0 !== a.length) { 610 for (var b = [], d = 0; d < a.length; d++) { 611 var e = a[d], 612 f = this.selectionContainer(), 613 g = this.display(e, f); 614 f.append(g), f.prop("title", e.title || e.text), f.data("data", e), b.push(f) 615 } 616 var h = this.$selection.find(".select2-selection__rendered"); 617 c.appendMany(h, b) 618 } 619 }, d 620 }), b.define("select2/selection/placeholder", ["../utils"], function(a) { 621 function b(a, b, c) { 622 this.placeholder = this.normalizePlaceholder(c.get("placeholder")), a.call(this, b, c) 623 } 624 return b.prototype.normalizePlaceholder = function(a, b) { 625 return "string" == typeof b && (b = { 626 id: "", 627 text: b 628 }), b 629 }, b.prototype.createPlaceholder = function(a, b) { 630 var c = this.selectionContainer(); 631 return c.html(this.display(b)), c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"), c 632 }, b.prototype.update = function(a, b) { 633 var c = 1 == b.length && b[0].id != this.placeholder.id, 634 d = b.length > 1; 635 if (d || c) return a.call(this, b); 636 this.clear(); 637 var e = this.createPlaceholder(this.placeholder); 638 this.$selection.find(".select2-selection__rendered").append(e) 639 }, b 640 }), b.define("select2/selection/allowClear", ["jquery", "../keys"], function(a, b) { 641 function c() {} 642 return c.prototype.bind = function(a, b, c) { 643 var d = this; 644 a.call(this, b, c), null == this.placeholder && this.options.get("debug") && window.console && console.error && console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."), this.$selection.on("mousedown", ".select2-selection__clear", function(a) { 645 d._handleClear(a) 646 }), b.on("keypress", function(a) { 647 d._handleKeyboardClear(a, b) 648 }) 649 }, c.prototype._handleClear = function(a, b) { 650 if (!this.options.get("disabled")) { 651 var c = this.$selection.find(".select2-selection__clear"); 652 if (0 !== c.length) { 653 b.stopPropagation(); 654 for (var d = c.data("data"), e = 0; e < d.length; e++) { 655 var f = { 656 data: d[e] 657 }; 658 if (this.trigger("unselect", f), f.prevented) return 659 } 660 this.$element.val(this.placeholder.id).trigger("change"), this.trigger("toggle", {}) 661 } 662 } 663 }, c.prototype._handleKeyboardClear = function(a, c, d) { 664 d.isOpen() || (c.which == b.DELETE || c.which == b.BACKSPACE) && this._handleClear(c) 665 }, c.prototype.update = function(b, c) { 666 if (b.call(this, c), !(this.$selection.find(".select2-selection__placeholder").length > 0 || 0 === c.length)) { 667 var d = a('<span class="select2-selection__clear">×</span>'); 668 d.data("data", c), this.$selection.find(".select2-selection__rendered").prepend(d) 669 } 670 }, c 671 }), b.define("select2/selection/search", ["jquery", "../utils", "../keys"], function(a, b, c) { 672 function d(a, b, c) { 673 a.call(this, b, c) 674 } 675 return d.prototype.render = function(b) { 676 var c = a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>'); 677 this.$searchContainer = c, this.$search = c.find("input"); 678 var d = b.call(this); 679 return this._transferTabIndex(), d 680 }, d.prototype.bind = function(a, b, d) { 681 var e = this; 682 a.call(this, b, d), b.on("open", function() { 683 e.$search.trigger("focus") 684 }), b.on("close", function() { 685 e.$search.val(""), e.$search.removeAttr("aria-activedescendant"), e.$search.trigger("focus") 686 }), b.on("enable", function() { 687 e.$search.prop("disabled", !1), e._transferTabIndex() 688 }), b.on("disable", function() { 689 e.$search.prop("disabled", !0) 690 }), b.on("focus", function(a) { 691 e.$search.trigger("focus") 692 }), b.on("results:focus", function(a) { 693 e.$search.attr("aria-activedescendant", a.id) 694 }), this.$selection.on("focusin", ".select2-search--inline", function(a) { 695 e.trigger("focus", a) 696 }), this.$selection.on("focusout", ".select2-search--inline", function(a) { 697 e._handleBlur(a) 698 }), this.$selection.on("keydown", ".select2-search--inline", function(a) { 699 a.stopPropagation(), e.trigger("keypress", a), e._keyUpPrevented = a.isDefaultPrevented(); 700 var b = a.which; 701 if (b === c.BACKSPACE && "" === e.$search.val()) { 702 var d = e.$searchContainer.prev(".select2-selection__choice"); 703 if (d.length > 0) { 704 var f = d.data("data"); 705 e.searchRemoveChoice(f), a.preventDefault() 706 } 707 } 708 }); 709 var f = document.documentMode, 710 g = f && 11 >= f; 711 this.$selection.on("input.searchcheck", ".select2-search--inline", function(a) { 712 return g ? void e.$selection.off("input.search input.searchcheck") : void e.$selection.off("keyup.search") 713 }), this.$selection.on("keyup.search input.search", ".select2-search--inline", function(a) { 714 if (g && "input" === a.type) return void e.$selection.off("input.search input.searchcheck"); 715 var b = a.which; 716 b != c.SHIFT && b != c.CTRL && b != c.ALT && b != c.TAB && e.handleSearch(a) 717 }) 718 }, d.prototype._transferTabIndex = function(a) { 719 this.$search.attr("tabindex", this.$selection.attr("tabindex")), this.$selection.attr("tabindex", "-1") 720 }, d.prototype.createPlaceholder = function(a, b) { 721 this.$search.attr("placeholder", b.text) 722 }, d.prototype.update = function(a, b) { 723 var c = this.$search[0] == document.activeElement; 724 this.$search.attr("placeholder", ""), a.call(this, b), this.$selection.find(".select2-selection__rendered").append(this.$searchContainer), this.resizeSearch(), c && this.$search.focus() 725 }, d.prototype.handleSearch = function() { 726 if (this.resizeSearch(), !this._keyUpPrevented) { 727 var a = this.$search.val(); 728 this.trigger("query", { 729 term: a 730 }) 731 } 732 this._keyUpPrevented = !1 733 }, d.prototype.searchRemoveChoice = function(a, b) { 734 this.trigger("unselect", { 735 data: b 736 }), this.$search.val(b.text), this.handleSearch() 737 }, d.prototype.resizeSearch = function() { 738 this.$search.css("width", "25px"); 739 var a = ""; 740 if ("" !== this.$search.attr("placeholder")) a = this.$selection.find(".select2-selection__rendered").innerWidth(); 741 else { 742 var b = this.$search.val().length + 1; 743 a = .75 * b + "em" 744 } 745 this.$search.css("width", a) 746 }, d 747 }), b.define("select2/selection/eventRelay", ["jquery"], function(a) { 748 function b() {} 749 return b.prototype.bind = function(b, c, d) { 750 var e = this, 751 f = ["open", "opening", "close", "closing", "select", "selecting", "unselect", "unselecting"], 752 g = ["opening", "closing", "selecting", "unselecting"]; 753 b.call(this, c, d), c.on("*", function(b, c) { 754 if (-1 !== a.inArray(b, f)) { 755 c = c || {}; 756 var d = a.Event("select2:" + b, { 757 params: c 758 }); 759 e.$element.trigger(d), -1 !== a.inArray(b, g) && (c.prevented = d.isDefaultPrevented()) 760 } 761 }) 762 }, b 763 }), b.define("select2/translation", ["jquery", "require"], function(a, b) { 764 function c(a) { 765 this.dict = a || {} 766 } 767 return c.prototype.all = function() { 768 return this.dict 769 }, c.prototype.get = function(a) { 770 return this.dict[a] 771 }, c.prototype.extend = function(b) { 772 this.dict = a.extend({}, b.all(), this.dict) 773 }, c._cache = {}, c.loadPath = function(a) { 774 if (!(a in c._cache)) { 775 var d = b(a); 776 c._cache[a] = d 777 } 778 return new c(c._cache[a]) 779 }, c 780 }), b.define("select2/diacritics", [], function() { 781 var a = {}; 782 return a 783 }), b.define("select2/data/base", ["../utils"], function(a) { 784 function b(a, c) { 785 b.__super__.constructor.call(this) 786 } 787 return a.Extend(b, a.Observable), b.prototype.current = function(a) { 788 throw new Error("The `current` method must be defined in child classes.") 789 }, b.prototype.query = function(a, b) { 790 throw new Error("The `query` method must be defined in child classes.") 791 }, b.prototype.bind = function(a, b) {}, b.prototype.destroy = function() {}, b.prototype.generateResultId = function(b, c) { 792 var d = b.id + "-result-"; 793 return d += a.generateChars(4), d += null != c.id ? "-" + c.id.toString() : "-" + a.generateChars(4) 794 }, b 795 }), b.define("select2/data/select", ["./base", "../utils", "jquery"], function(a, b, c) { 796 function d(a, b) { 797 this.$element = a, this.options = b, d.__super__.constructor.call(this) 798 } 799 return b.Extend(d, a), d.prototype.current = function(a) { 800 var b = [], 801 d = this; 802 this.$element.find(":selected").each(function() { 803 var a = c(this), 804 e = d.item(a); 805 b.push(e) 806 }), a(b) 807 }, d.prototype.select = function(a) { 808 var b = this; 809 if (a.selected = !0, c(a.element).is("option")) return a.element.selected = !0, void this.$element.trigger("change"); 810 if (this.$element.prop("multiple")) this.current(function(d) { 811 var e = []; 812 a = [a], a.push.apply(a, d); 813 for (var f = 0; f < a.length; f++) { 814 var g = a[f].id; - 1 === c.inArray(g, e) && e.push(g) 815 } 816 b.$element.val(e), b.$element.trigger("change") 817 }); 818 else { 819 var d = a.id; 820 this.$element.val(d), this.$element.trigger("change") 821 } 822 }, d.prototype.unselect = function(a) { 823 var b = this; 824 if (this.$element.prop("multiple")) return a.selected = !1, c(a.element).is("option") ? (a.element.selected = !1, void this.$element.trigger("change")) : void this.current(function(d) { 825 for (var e = [], f = 0; f < d.length; f++) { 826 var g = d[f].id; 827 g !== a.id && -1 === c.inArray(g, e) && e.push(g) 828 } 829 b.$element.val(e), b.$element.trigger("change") 830 }) 831 }, d.prototype.bind = function(a, b) { 832 var c = this; 833 this.container = a, a.on("select", function(a) { 834 c.select(a.data) 835 }), a.on("unselect", function(a) { 836 c.unselect(a.data) 837 }) 838 }, d.prototype.destroy = function() { 839 this.$element.find("*").each(function() { 840 c.removeData(this, "data") 841 }) 842 }, d.prototype.query = function(a, b) { 843 var d = [], 844 e = this, 845 f = this.$element.children(); 846 f.each(function() { 847 var b = c(this); 848 if (b.is("option") || b.is("optgroup")) { 849 var f = e.item(b), 850 g = e.matches(a, f); 851 null !== g && d.push(g) 852 } 853 }), b({ 854 results: d 855 }) 856 }, d.prototype.addOptions = function(a) { 857 b.appendMany(this.$element, a) 858 }, d.prototype.option = function(a) { 859 var b; 860 a.children ? (b = document.createElement("optgroup"), b.label = a.text) : (b = document.createElement("option"), void 0 !== b.textContent ? b.textContent = a.text : b.innerText = a.text), a.id && (b.value = a.id), a.disabled && (b.disabled = !0), a.selected && (b.selected = !0), a.title && (b.title = a.title); 861 var d = c(b), 862 e = this._normalizeItem(a); 863 return e.element = b, c.data(b, "data", e), d 864 }, d.prototype.item = function(a) { 865 var b = {}; 866 if (b = c.data(a[0], "data"), null != b) return b; 867 if (a.is("option")) b = { 868 id: a.val(), 869 text: a.text(), 870 disabled: a.prop("disabled"), 871 selected: a.prop("selected"), 872 title: a.prop("title") 873 }; 874 else if (a.is("optgroup")) { 875 b = { 876 text: a.prop("label"), 877 children: [], 878 title: a.prop("title") 879 }; 880 for (var d = a.children("option"), e = [], f = 0; f < d.length; f++) { 881 var g = c(d[f]), 882 h = this.item(g); 883 e.push(h) 884 } 885 b.children = e 886 } 887 return b = this._normalizeItem(b), b.element = a[0], c.data(a[0], "data", b), b 888 }, d.prototype._normalizeItem = function(a) { 889 c.isPlainObject(a) || (a = { 890 id: a, 891 text: a 892 }), a = c.extend({}, { 893 text: "" 894 }, a); 895 var b = { 896 selected: !1, 897 disabled: !1 898 }; 899 return null != a.id && (a.id = a.id.toString()), null != a.text && (a.text = a.text.toString()), null == a._resultId && a.id && null != this.container && (a._resultId = this.generateResultId(this.container, a)), c.extend({}, b, a) 900 }, d.prototype.matches = function(a, b) { 901 var c = this.options.get("matcher"); 902 return c(a, b) 903 }, d 904 }), b.define("select2/data/array", ["./select", "../utils", "jquery"], function(a, b, c) { 905 function d(a, b) { 906 var c = b.get("data") || []; 907 d.__super__.constructor.call(this, a, b), this.addOptions(this.convertToOptions(c)) 908 } 909 return b.Extend(d, a), d.prototype.select = function(a) { 910 var b = this.$element.find("option").filter(function(b, c) { 911 return c.value == a.id.toString() 912 }); 913 0 === b.length && (b = this.option(a), this.addOptions(b)), d.__super__.select.call(this, a) 914 }, d.prototype.convertToOptions = function(a) { 915 function d(a) { 916 return function() { 917 return c(this).val() == a.id 918 } 919 } 920 for (var e = this, f = this.$element.find("option"), g = f.map(function() { 921 return e.item(c(this)).id 922 }).get(), h = [], i = 0; i < a.length; i++) { 923 var j = this._normalizeItem(a[i]); 924 if (c.inArray(j.id, g) >= 0) { 925 var k = f.filter(d(j)), 926 l = this.item(k), 927 m = c.extend(!0, {}, j, l), 928 n = this.option(m); 929 k.replaceWith(n) 930 } else { 931 var o = this.option(j); 932 if (j.children) { 933 var p = this.convertToOptions(j.children); 934 b.appendMany(o, p) 935 } 936 h.push(o) 937 } 938 } 939 return h 940 }, d 941 }), b.define("select2/data/ajax", ["./array", "../utils", "jquery"], function(a, b, c) { 942 function d(a, b) { 943 this.ajaxOptions = this._applyDefaults(b.get("ajax")), null != this.ajaxOptions.processResults && (this.processResults = this.ajaxOptions.processResults), d.__super__.constructor.call(this, a, b) 944 } 945 return b.Extend(d, a), d.prototype._applyDefaults = function(a) { 946 var b = { 947 data: function(a) { 948 return c.extend({}, a, { 949 q: a.term 950 }) 951 }, 952 transport: function(a, b, d) { 953 var e = c.ajax(a); 954 return e.then(b), e.fail(d), e 955 } 956 }; 957 return c.extend({}, b, a, !0) 958 }, d.prototype.processResults = function(a) { 959 return a 960 }, d.prototype.query = function(a, b) { 961 function d() { 962 var d = f.transport(f, function(d) { 963 var f = e.processResults(d, a); 964 e.options.get("debug") && window.console && console.error && (f && f.results && c.isArray(f.results) || console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")), b(f) 965 }, function() { 966 d.status && "0" === d.status || e.trigger("results:message", { 967 message: "errorLoading" 968 }) 969 }); 970 e._request = d 971 } 972 var e = this; 973 null != this._request && (c.isFunction(this._request.abort) && this._request.abort(), this._request = null); 974 var f = c.extend({ 975 type: "GET" 976 }, this.ajaxOptions); 977 "function" == typeof f.url && (f.url = f.url.call(this.$element, a)), "function" == typeof f.data && (f.data = f.data.call(this.$element, a)), this.ajaxOptions.delay && null != a.term ? (this._queryTimeout && window.clearTimeout(this._queryTimeout), this._queryTimeout = window.setTimeout(d, this.ajaxOptions.delay)) : d() 978 }, d 979 }), b.define("select2/data/tags", ["jquery"], function(a) { 980 function b(b, c, d) { 981 var e = d.get("tags"), 982 f = d.get("createTag"); 983 void 0 !== f && (this.createTag = f); 984 var g = d.get("insertTag"); 985 if (void 0 !== g && (this.insertTag = g), b.call(this, c, d), a.isArray(e)) 986 for (var h = 0; h < e.length; h++) { 987 var i = e[h], 988 j = this._normalizeItem(i), 989 k = this.option(j); 990 this.$element.append(k) 991 } 992 } 993 return b.prototype.query = function(a, b, c) { 994 function d(a, f) { 995 for (var g = a.results, h = 0; h < g.length; h++) { 996 var i = g[h], 997 j = null != i.children && !d({ 998 results: i.children 999 }, !0), 1000 k = i.text === b.term; 1001 if (k || j) return f ? !1 : (a.data = g, void c(a)) 1002 } 1003 if (f) return !0; 1004 var l = e.createTag(b); 1005 if (null != l) { 1006 var m = e.option(l); 1007 m.attr("data-select2-tag", !0), e.addOptions([m]), e.insertTag(g, l) 1008 } 1009 a.results = g, c(a) 1010 } 1011 var e = this; 1012 return this._removeOldTags(), null == b.term || null != b.page ? void a.call(this, b, c) : void a.call(this, b, d) 1013 }, b.prototype.createTag = function(b, c) { 1014 var d = a.trim(c.term); 1015 return "" === d ? null : { 1016 id: d, 1017 text: d 1018 } 1019 }, b.prototype.insertTag = function(a, b, c) { 1020 b.unshift(c) 1021 }, b.prototype._removeOldTags = function(b) { 1022 var c = (this._lastTag, this.$element.find("option[data-select2-tag]")); 1023 c.each(function() { 1024 this.selected || a(this).remove() 1025 }) 1026 }, b 1027 }), b.define("select2/data/tokenizer", ["jquery"], function(a) { 1028 function b(a, b, c) { 1029 var d = c.get("tokenizer"); 1030 void 0 !== d && (this.tokenizer = d), a.call(this, b, c) 1031 } 1032 return b.prototype.bind = function(a, b, c) { 1033 a.call(this, b, c), this.$search = b.dropdown.$search || b.selection.$search || c.find(".select2-search__field") 1034 }, b.prototype.query = function(b, c, d) { 1035 function e(b) { 1036 var c = g._normalizeItem(b), 1037 d = g.$element.find("option").filter(function() { 1038 return a(this).val() === c.id 1039 }); 1040 if (!d.length) { 1041 var e = g.option(c); 1042 e.attr("data-select2-tag", !0), g._removeOldTags(), g.addOptions([e]) 1043 } 1044 f(c) 1045 } 1046 1047 function f(a) { 1048 g.trigger("select", { 1049 data: a 1050 }) 1051 } 1052 var g = this; 1053 c.term = c.term || ""; 1054 var h = this.tokenizer(c, this.options, e); 1055 h.term !== c.term && (this.$search.length && (this.$search.val(h.term), this.$search.focus()), c.term = h.term), b.call(this, c, d) 1056 }, b.prototype.tokenizer = function(b, c, d, e) { 1057 for (var f = d.get("tokenSeparators") || [], g = c.term, h = 0, i = this.createTag || function(a) { 1058 return { 1059 id: a.term, 1060 text: a.term 1061 } 1062 }; h < g.length;) { 1063 var j = g[h]; 1064 if (-1 !== a.inArray(j, f)) { 1065 var k = g.substr(0, h), 1066 l = a.extend({}, c, { 1067 term: k 1068 }), 1069 m = i(l); 1070 null != m ? (e(m), g = g.substr(h + 1) || "", h = 0) : h++ 1071 } else h++ 1072 } 1073 return { 1074 term: g 1075 } 1076 }, b 1077 }), b.define("select2/data/minimumInputLength", [], function() { 1078 function a(a, b, c) { 1079 this.minimumInputLength = c.get("minimumInputLength"), a.call(this, b, c) 1080 } 1081 return a.prototype.query = function(a, b, c) { 1082 return b.term = b.term || "", b.term.length < this.minimumInputLength ? void this.trigger("results:message", { 1083 message: "inputTooShort", 1084 args: { 1085 minimum: this.minimumInputLength, 1086 input: b.term, 1087 params: b 1088 } 1089 }) : void a.call(this, b, c) 1090 }, a 1091 }), b.define("select2/data/maximumInputLength", [], function() { 1092 function a(a, b, c) { 1093 this.maximumInputLength = c.get("maximumInputLength"), a.call(this, b, c) 1094 } 1095 return a.prototype.query = function(a, b, c) { 1096 return b.term = b.term || "", this.maximumInputLength > 0 && b.term.length > this.maximumInputLength ? void this.trigger("results:message", { 1097 message: "inputTooLong", 1098 args: { 1099 maximum: this.maximumInputLength, 1100 input: b.term, 1101 params: b 1102 } 1103 }) : void a.call(this, b, c) 1104 }, a 1105 }), b.define("select2/data/maximumSelectionLength", [], function() { 1106 function a(a, b, c) { 1107 this.maximumSelectionLength = c.get("maximumSelectionLength"), a.call(this, b, c) 1108 } 1109 return a.prototype.query = function(a, b, c) { 1110 var d = this; 1111 this.current(function(e) { 1112 var f = null != e ? e.length : 0; 1113 return d.maximumSelectionLength > 0 && f >= d.maximumSelectionLength ? void d.trigger("results:message", { 1114 message: "maximumSelected", 1115 args: { 1116 maximum: d.maximumSelectionLength 1117 } 1118 }) : void a.call(d, b, c) 1119 }) 1120 }, a 1121 }), b.define("select2/dropdown", ["jquery", "./utils"], function(a, b) { 1122 function c(a, b) { 1123 this.$element = a, this.options = b, c.__super__.constructor.call(this) 1124 } 1125 return b.Extend(c, b.Observable), c.prototype.render = function() { 1126 var b = a('<span class="select2-dropdown"><span class="select2-results"></span></span>'); 1127 return b.attr("dir", this.options.get("dir")), this.$dropdown = b, b 1128 }, c.prototype.bind = function() {}, c.prototype.position = function(a, b) {}, c.prototype.destroy = function() { 1129 this.$dropdown.remove() 1130 }, c 1131 }), b.define("select2/dropdown/search", ["jquery", "../utils"], function(a, b) { 1132 function c() {} 1133 return c.prototype.render = function(b) { 1134 var c = b.call(this), 1135 d = a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>'); 1136 return this.$searchContainer = d, this.$search = d.find("input"), c.prepend(d), c 1137 }, c.prototype.bind = function(b, c, d) { 1138 var e = this; 1139 b.call(this, c, d), this.$search.on("keydown", function(a) { 1140 e.trigger("keypress", a), e._keyUpPrevented = a.isDefaultPrevented() 1141 }), this.$search.on("input", function(b) { 1142 a(this).off("keyup") 1143 }), this.$search.on("keyup input", function(a) { 1144 e.handleSearch(a) 1145 }), c.on("open", function() { 1146 e.$search.attr("tabindex", 0), e.$search.focus(), window.setTimeout(function() { 1147 e.$search.focus() 1148 }, 0) 1149 }), c.on("close", function() { 1150 e.$search.attr("tabindex", -1), e.$search.val("") 1151 }), c.on("focus", function() { 1152 c.isOpen() && e.$search.focus() 1153 }), c.on("results:all", function(a) { 1154 if (null == a.query.term || "" === a.query.term) { 1155 var b = e.showSearch(a); 1156 b ? e.$searchContainer.removeClass("select2-search--hide") : e.$searchContainer.addClass("select2-search--hide") 1157 } 1158 }) 1159 }, c.prototype.handleSearch = function(a) { 1160 if (!this._keyUpPrevented) { 1161 var b = this.$search.val(); 1162 this.trigger("query", { 1163 term: b 1164 }) 1165 } 1166 this._keyUpPrevented = !1 1167 }, c.prototype.showSearch = function(a, b) { 1168 return !0 1169 }, c 1170 }), b.define("select2/dropdown/hidePlaceholder", [], function() { 1171 function a(a, b, c, d) { 1172 this.placeholder = this.normalizePlaceholder(c.get("placeholder")), a.call(this, b, c, d) 1173 } 1174 return a.prototype.append = function(a, b) { 1175 b.results = this.removePlaceholder(b.results), a.call(this, b) 1176 }, a.prototype.normalizePlaceholder = function(a, b) { 1177 return "string" == typeof b && (b = { 1178 id: "", 1179 text: b 1180 }), b 1181 }, a.prototype.removePlaceholder = function(a, b) { 1182 for (var c = b.slice(0), d = b.length - 1; d >= 0; d--) { 1183 var e = b[d]; 1184 this.placeholder.id === e.id && c.splice(d, 1) 1185 } 1186 return c 1187 }, a 1188 }), b.define("select2/dropdown/infiniteScroll", ["jquery"], function(a) { 1189 function b(a, b, c, d) { 1190 this.lastParams = {}, a.call(this, b, c, d), this.$loadingMore = this.createLoadingMore(), this.loading = !1 1191 } 1192 return b.prototype.append = function(a, b) { 1193 this.$loadingMore.remove(), this.loading = !1, a.call(this, b), this.showLoadingMore(b) && this.$results.append(this.$loadingMore) 1194 }, b.prototype.bind = function(b, c, d) { 1195 var e = this; 1196 b.call(this, c, d), c.on("query", function(a) { 1197 e.lastParams = a, e.loading = !0 1198 }), c.on("query:append", function(a) { 1199 e.lastParams = a, e.loading = !0 1200 }), this.$results.on("scroll", function() { 1201 var b = a.contains(document.documentElement, e.$loadingMore[0]); 1202 if (!e.loading && b) { 1203 var c = e.$results.offset().top + e.$results.outerHeight(!1), 1204 d = e.$loadingMore.offset().top + e.$loadingMore.outerHeight(!1); 1205 c + 50 >= d && e.loadMore() 1206 } 1207 }) 1208 }, b.prototype.loadMore = function() { 1209 this.loading = !0; 1210 var b = a.extend({}, { 1211 page: 1 1212 }, this.lastParams); 1213 b.page++, this.trigger("query:append", b) 1214 }, b.prototype.showLoadingMore = function(a, b) { 1215 return b.pagination && b.pagination.more 1216 }, b.prototype.createLoadingMore = function() { 1217 var b = a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'), 1218 c = this.options.get("translations").get("loadingMore"); 1219 return b.html(c(this.lastParams)), b 1220 }, b 1221 }), b.define("select2/dropdown/attachBody", ["jquery", "../utils"], function(a, b) { 1222 function c(b, c, d) { 1223 this.$dropdownParent = d.get("dropdownParent") || a(document.body), b.call(this, c, d) 1224 } 1225 return c.prototype.bind = function(a, b, c) { 1226 var d = this, 1227 e = !1; 1228 a.call(this, b, c), b.on("open", function() { 1229 d._showDropdown(), d._attachPositioningHandler(b), e || (e = !0, b.on("results:all", function() { 1230 d._positionDropdown(), d._resizeDropdown() 1231 }), b.on("results:append", function() { 1232 d._positionDropdown(), d._resizeDropdown() 1233 })) 1234 }), b.on("close", function() { 1235 d._hideDropdown(), d._detachPositioningHandler(b) 1236 }), this.$dropdownContainer.on("mousedown", function(a) { 1237 a.stopPropagation() 1238 }) 1239 }, c.prototype.destroy = function(a) { 1240 a.call(this), this.$dropdownContainer.remove() 1241 }, c.prototype.position = function(a, b, c) { 1242 b.attr("class", c.attr("class")), b.removeClass("select2"), b.addClass("select2-container--open"), b.css({ 1243 position: "absolute", 1244 top: -999999 1245 }), this.$container = c 1246 }, c.prototype.render = function(b) { 1247 var c = a("<span></span>"), 1248 d = b.call(this); 1249 return c.append(d), this.$dropdownContainer = c, c 1250 }, c.prototype._hideDropdown = function(a) { 1251 this.$dropdownContainer.detach() 1252 }, c.prototype._attachPositioningHandler = function(c, d) { 1253 var e = this, 1254 f = "scroll.select2." + d.id, 1255 g = "resize.select2." + d.id, 1256 h = "orientationchange.select2." + d.id, 1257 i = this.$container.parents().filter(b.hasScroll); 1258 i.each(function() { 1259 a(this).data("select2-scroll-position", { 1260 x: a(this).scrollLeft(), 1261 y: a(this).scrollTop() 1262 }) 1263 }), i.on(f, function(b) { 1264 var c = a(this).data("select2-scroll-position"); 1265 a(this).scrollTop(c.y) 1266 }), a(window).on(f + " " + g + " " + h, function(a) { 1267 e._positionDropdown(), e._resizeDropdown() 1268 }) 1269 }, c.prototype._detachPositioningHandler = function(c, d) { 1270 var e = "scroll.select2." + d.id, 1271 f = "resize.select2." + d.id, 1272 g = "orientationchange.select2." + d.id, 1273 h = this.$container.parents().filter(b.hasScroll); 1274 h.off(e), a(window).off(e + " " + f + " " + g) 1275 }, c.prototype._positionDropdown = function() { 1276 var b = a(window), 1277 c = this.$dropdown.hasClass("select2-dropdown--above"), 1278 d = this.$dropdown.hasClass("select2-dropdown--below"), 1279 e = null, 1280 f = this.$container.offset(); 1281 f.bottom = f.top + this.$container.outerHeight(!1); 1282 var g = { 1283 height: this.$container.outerHeight(!1) 1284 }; 1285 g.top = f.top, g.bottom = f.top + g.height; 1286 var h = { 1287 height: this.$dropdown.outerHeight(!1) 1288 }, 1289 i = { 1290 top: b.scrollTop(), 1291 bottom: b.scrollTop() + b.height() 1292 }, 1293 j = i.top < f.top - h.height, 1294 k = i.bottom > f.bottom + h.height, 1295 l = { 1296 left: f.left, 1297 top: g.bottom 1298 }, 1299 m = this.$dropdownParent; 1300 "static" === m.css("position") && (m = m.offsetParent()); 1301 var n = m.offset(); 1302 l.top -= n.top, l.left -= n.left, c || d || (e = "below"), k || !j || c ? !j && k && c && (e = "below") : e = "above", ("above" == e || c && "below" !== e) && (l.top = g.top - n.top - h.height), null != e && (this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--" + e), this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--" + e)), this.$dropdownContainer.css(l) 1303 }, c.prototype._resizeDropdown = function() { 1304 var a = { 1305 width: this.$container.outerWidth(!1) + "px" 1306 }; 1307 this.options.get("dropdownAutoWidth") && (a.minWidth = a.width, a.position = "relative", a.width = "auto"), this.$dropdown.css(a) 1308 }, c.prototype._showDropdown = function(a) { 1309 this.$dropdownContainer.appendTo(this.$dropdownParent), this._positionDropdown(), this._resizeDropdown() 1310 }, c 1311 }), b.define("select2/dropdown/minimumResultsForSearch", [], function() { 1312 function a(b) { 1313 for (var c = 0, d = 0; d < b.length; d++) { 1314 var e = b[d]; 1315 e.children ? c += a(e.children) : c++ 1316 } 1317 return c 1318 } 1319 1320 function b(a, b, c, d) { 1321 this.minimumResultsForSearch = c.get("minimumResultsForSearch"), this.minimumResultsForSearch < 0 && (this.minimumResultsForSearch = 1 / 0), a.call(this, b, c, d) 1322 } 1323 return b.prototype.showSearch = function(b, c) { 1324 return a(c.data.results) < this.minimumResultsForSearch ? !1 : b.call(this, c) 1325 }, b 1326 }), b.define("select2/dropdown/selectOnClose", [], function() { 1327 function a() {} 1328 return a.prototype.bind = function(a, b, c) { 1329 var d = this; 1330 a.call(this, b, c), b.on("close", function(a) { 1331 d._handleSelectOnClose(a) 1332 }) 1333 }, a.prototype._handleSelectOnClose = function(a, b) { 1334 if (b && null != b.originalSelect2Event) { 1335 var c = b.originalSelect2Event; 1336 if ("select" === c._type || "unselect" === c._type) return 1337 } 1338 var d = this.getHighlightedResults(); 1339 if (!(d.length < 1)) { 1340 var e = d.data("data"); 1341 null != e.element && e.element.selected || null == e.element && e.selected || this.trigger("select", { 1342 data: e 1343 }) 1344 } 1345 }, a 1346 }), b.define("select2/dropdown/closeOnSelect", [], function() { 1347 function a() {} 1348 return a.prototype.bind = function(a, b, c) { 1349 var d = this; 1350 a.call(this, b, c), b.on("select", function(a) { 1351 d._selectTriggered(a) 1352 }), b.on("unselect", function(a) { 1353 d._selectTriggered(a) 1354 }) 1355 }, a.prototype._selectTriggered = function(a, b) { 1356 var c = b.originalEvent; 1357 c && c.ctrlKey || this.trigger("close", { 1358 originalEvent: c, 1359 originalSelect2Event: b 1360 }) 1361 }, a 1362 }), b.define("select2/i18n/en", [], function() { 1363 return { 1364 errorLoading: function() { 1365 return "The results could not be loaded." 1366 }, 1367 inputTooLong: function(a) { 1368 var b = a.input.length - a.maximum, 1369 c = "Please delete " + b + " character"; 1370 return 1 != b && (c += "s"), c 1371 }, 1372 inputTooShort: function(a) { 1373 var b = a.minimum - a.input.length, 1374 c = "Please enter " + b + " or more characters"; 1375 return c 1376 }, 1377 loadingMore: function() { 1378 return "Loading more results..." 1379 }, 1380 maximumSelected: function(a) { 1381 var b = "You can only select " + a.maximum + " item"; 1382 return 1 != a.maximum && (b += "s"), b 1383 }, 1384 noResults: function() { 1385 return "No results found" 1386 }, 1387 searching: function() { 1388 return "Searching..." 1389 } 1390 } 1391 }), b.define("select2/defaults", ["jquery", "require", "./results", "./selection/single", "./selection/multiple", "./selection/placeholder", "./selection/allowClear", "./selection/search", "./selection/eventRelay", "./utils", "./translation", "./diacritics", "./data/select", "./data/array", "./data/ajax", "./data/tags", "./data/tokenizer", "./data/minimumInputLength", "./data/maximumInputLength", "./data/maximumSelectionLength", "./dropdown", "./dropdown/search", "./dropdown/hidePlaceholder", "./dropdown/infiniteScroll", "./dropdown/attachBody", "./dropdown/minimumResultsForSearch", "./dropdown/selectOnClose", "./dropdown/closeOnSelect", "./i18n/en"], function(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C) { 1392 function D() { 1393 this.reset() 1394 } 1395 D.prototype.apply = function(l) { 1396 if (l = a.extend(!0, {}, this.defaults, l), null == l.dataAdapter) { 1397 if (null != l.ajax ? l.dataAdapter = o : null != l.data ? l.dataAdapter = n : l.dataAdapter = m, l.minimumInputLength > 0 && (l.dataAdapter = j.Decorate(l.dataAdapter, r)), l.maximumInputLength > 0 && (l.dataAdapter = j.Decorate(l.dataAdapter, s)), l.maximumSelectionLength > 0 && (l.dataAdapter = j.Decorate(l.dataAdapter, t)), l.tags && (l.dataAdapter = j.Decorate(l.dataAdapter, p)), (null != l.tokenSeparators || null != l.tokenizer) && (l.dataAdapter = j.Decorate(l.dataAdapter, q)), null != l.query) { 1398 var C = b(l.amdBase + "compat/query"); 1399 l.dataAdapter = j.Decorate(l.dataAdapter, C) 1400 } 1401 if (null != l.initSelection) { 1402 var D = b(l.amdBase + "compat/initSelection"); 1403 l.dataAdapter = j.Decorate(l.dataAdapter, D) 1404 } 1405 } 1406 if (null == l.resultsAdapter && (l.resultsAdapter = c, null != l.ajax && (l.resultsAdapter = j.Decorate(l.resultsAdapter, x)), null != l.placeholder && (l.resultsAdapter = j.Decorate(l.resultsAdapter, w)), l.selectOnClose && (l.resultsAdapter = j.Decorate(l.resultsAdapter, A))), null == l.dropdownAdapter) { 1407 if (l.multiple) l.dropdownAdapter = u; 1408 else { 1409 var E = j.Decorate(u, v); 1410 l.dropdownAdapter = E 1411 } 1412 if (0 !== l.minimumResultsForSearch && (l.dropdownAdapter = j.Decorate(l.dropdownAdapter, z)), l.closeOnSelect && (l.dropdownAdapter = j.Decorate(l.dropdownAdapter, B)), null != l.dropdownCssClass || null != l.dropdownCss || null != l.adaptDropdownCssClass) { 1413 var F = b(l.amdBase + "compat/dropdownCss"); 1414 l.dropdownAdapter = j.Decorate(l.dropdownAdapter, F) 1415 } 1416 l.dropdownAdapter = j.Decorate(l.dropdownAdapter, y) 1417 } 1418 if (null == l.selectionAdapter) { 1419 if (l.multiple ? l.selectionAdapter = e : l.selectionAdapter = d, null != l.placeholder && (l.selectionAdapter = j.Decorate(l.selectionAdapter, f)), l.allowClear && (l.selectionAdapter = j.Decorate(l.selectionAdapter, g)), l.multiple && (l.selectionAdapter = j.Decorate(l.selectionAdapter, h)), null != l.containerCssClass || null != l.containerCss || null != l.adaptContainerCssClass) { 1420 var G = b(l.amdBase + "compat/containerCss"); 1421 l.selectionAdapter = j.Decorate(l.selectionAdapter, G) 1422 } 1423 l.selectionAdapter = j.Decorate(l.selectionAdapter, i) 1424 } 1425 if ("string" == typeof l.language) 1426 if (l.language.indexOf("-") > 0) { 1427 var H = l.language.split("-"), 1428 I = H[0]; 1429 l.language = [l.language, I] 1430 } else l.language = [l.language]; 1431 if (a.isArray(l.language)) { 1432 var J = new k; 1433 l.language.push("en"); 1434 for (var K = l.language, L = 0; L < K.length; L++) { 1435 var M = K[L], 1436 N = {}; 1437 try { 1438 N = k.loadPath(M) 1439 } catch (O) { 1440 try { 1441 M = this.defaults.amdLanguageBase + M, N = k.loadPath(M) 1442 } catch (P) { 1443 l.debug && window.console && console.warn && console.warn('Select2: The language file for "' + M + '" could not be automatically loaded. A fallback will be used instead.'); 1444 continue 1445 } 1446 } 1447 J.extend(N) 1448 } 1449 l.translations = J 1450 } else { 1451 var Q = k.loadPath(this.defaults.amdLanguageBase + "en"), 1452 R = new k(l.language); 1453 R.extend(Q), l.translations = R 1454 } 1455 return l 1456 }, D.prototype.reset = function() { 1457 function b(a) { 1458 function b(a) { 1459 return l[a] || a 1460 } 1461 return a.replace(/[^\u0000-\u007E]/g, b) 1462 } 1463 1464 function c(d, e) { 1465 if ("" === a.trim(d.term)) return e; 1466 if (e.children && e.children.length > 0) { 1467 for (var f = a.extend(!0, {}, e), g = e.children.length - 1; g >= 0; g--) { 1468 var h = e.children[g], 1469 i = c(d, h); 1470 null == i && f.children.splice(g, 1) 1471 } 1472 return f.children.length > 0 ? f : c(d, f) 1473 } 1474 var j = b(e.text).toUpperCase(), 1475 k = b(d.term).toUpperCase(); 1476 return j.indexOf(k) > -1 ? e : null 1477 } 1478 this.defaults = { 1479 amdBase: "./", 1480 amdLanguageBase: "./i18n/", 1481 closeOnSelect: !0, 1482 debug: !1, 1483 dropdownAutoWidth: !1, 1484 escapeMarkup: j.escapeMarkup, 1485 language: C, 1486 matcher: c, 1487 minimumInputLength: 0, 1488 maximumInputLength: 0, 1489 maximumSelectionLength: 0, 1490 minimumResultsForSearch: 0, 1491 selectOnClose: !1, 1492 sorter: function(a) { 1493 return a 1494 }, 1495 templateResult: function(a) { 1496 return a.text 1497 }, 1498 templateSelection: function(a) { 1499 return a.text 1500 }, 1501 theme: "default", 1502 width: "resolve" 1503 } 1504 }, D.prototype.set = function(b, c) { 1505 var d = a.camelCase(b), 1506 e = {}; 1507 e[d] = c; 1508 var f = j._convertData(e); 1509 a.extend(this.defaults, f) 1510 }; 1511 var E = new D; 1512 return E 1513 }), b.define("select2/options", ["require", "jquery", "./defaults", "./utils"], function(a, b, c, d) { 1514 function e(b, e) { 1515 if (this.options = b, null != e && this.fromElement(e), this.options = c.apply(this.options), e && e.is("input")) { 1516 var f = a(this.get("amdBase") + "compat/inputData"); 1517 this.options.dataAdapter = d.Decorate(this.options.dataAdapter, f) 1518 } 1519 } 1520 return e.prototype.fromElement = function(a) { 1521 var c = ["select2"]; 1522 null == this.options.multiple && (this.options.multiple = a.prop("multiple")), null == this.options.disabled && (this.options.disabled = a.prop("disabled")), null == this.options.language && (a.prop("lang") ? this.options.language = a.prop("lang").toLowerCase() : a.closest("[lang]").prop("lang") && (this.options.language = a.closest("[lang]").prop("lang"))), null == this.options.dir && (a.prop("dir") ? this.options.dir = a.prop("dir") : a.closest("[dir]").prop("dir") ? this.options.dir = a.closest("[dir]").prop("dir") : this.options.dir = "ltr"), a.prop("disabled", this.options.disabled), a.prop("multiple", this.options.multiple), a.data("select2Tags") && (this.options.debug && window.console && console.warn && console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'), a.data("data", a.data("select2Tags")), a.data("tags", !0)), a.data("ajaxUrl") && (this.options.debug && window.console && console.warn && console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."), a.attr("ajax--url", a.data("ajaxUrl")), a.data("ajax--url", a.data("ajaxUrl"))); 1523 var e = {}; 1524 e = b.fn.jquery && "1." == b.fn.jquery.substr(0, 2) && a[0].dataset ? b.extend(!0, {}, a[0].dataset, a.data()) : a.data(); 1525 var f = b.extend(!0, {}, e); 1526 f = d._convertData(f); 1527 for (var g in f) b.inArray(g, c) > -1 || (b.isPlainObject(this.options[g]) ? b.extend(this.options[g], f[g]) : this.options[g] = f[g]); 1528 return this 1529 }, e.prototype.get = function(a) { 1530 return this.options[a] 1531 }, e.prototype.set = function(a, b) { 1532 this.options[a] = b 1533 }, e 1534 }), b.define("select2/core", ["jquery", "./options", "./utils", "./keys"], function(a, b, c, d) { 1535 var e = function(a, c) { 1536 null != a.data("select2") && a.data("select2").destroy(), this.$element = a, this.id = this._generateId(a), c = c || {}, this.options = new b(c, a), e.__super__.constructor.call(this); 1537 var d = a.attr("tabindex") || 0; 1538 a.data("old-tabindex", d), a.attr("tabindex", "-1"); 1539 var f = this.options.get("dataAdapter"); 1540 this.dataAdapter = new f(a, this.options); 1541 var g = this.render(); 1542 this._placeContainer(g); 1543 var h = this.options.get("selectionAdapter"); 1544 this.selection = new h(a, this.options), this.$selection = this.selection.render(), this.selection.position(this.$selection, g); 1545 var i = this.options.get("dropdownAdapter"); 1546 this.dropdown = new i(a, this.options), this.$dropdown = this.dropdown.render(), this.dropdown.position(this.$dropdown, g); 1547 var j = this.options.get("resultsAdapter"); 1548 this.results = new j(a, this.options, this.dataAdapter), this.$results = this.results.render(), this.results.position(this.$results, this.$dropdown); 1549 var k = this; 1550 this._bindAdapters(), this._registerDomEvents(), this._registerDataEvents(), this._registerSelectionEvents(), this._registerDropdownEvents(), this._registerResultsEvents(), this._registerEvents(), this.dataAdapter.current(function(a) { 1551 k.trigger("selection:update", { 1552 data: a 1553 }) 1554 }), a.addClass("select2-hidden-accessible"), a.attr("aria-hidden", "true"), this._syncAttributes(), a.data("select2", this) 1555 }; 1556 return c.Extend(e, c.Observable), e.prototype._generateId = function(a) { 1557 var b = ""; 1558 return b = null != a.attr("id") ? a.attr("id") : null != a.attr("name") ? a.attr("name") + "-" + c.generateChars(2) : c.generateChars(4), b = b.replace(/(:|\.|\[|\]|,)/g, ""), b = "select2-" + b 1559 }, e.prototype._placeContainer = function(a) { 1560 a.insertAfter(this.$element); 1561 var b = this._resolveWidth(this.$element, this.options.get("width")); 1562 null != b && a.css("width", b) 1563 }, e.prototype._resolveWidth = function(a, b) { 1564 var c = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; 1565 if ("resolve" == b) { 1566 var d = this._resolveWidth(a, "style"); 1567 return null != d ? d : this._resolveWidth(a, "element") 1568 } 1569 if ("element" == b) { 1570 var e = a.outerWidth(!1); 1571 return 0 >= e ? "auto" : e + "px" 1572 } 1573 if ("style" == b) { 1574 var f = a.attr("style"); 1575 if ("string" != typeof f) return null; 1576 for (var g = f.split(";"), h = 0, i = g.length; i > h; h += 1) { 1577 var j = g[h].replace(/\s/g, ""), 1578 k = j.match(c); 1579 if (null !== k && k.length >= 1) return k[1] 1580 } 1581 return null 1582 } 1583 return b 1584 }, e.prototype._bindAdapters = function() { 1585 this.dataAdapter.bind(this, this.$container), this.selection.bind(this, this.$container), this.dropdown.bind(this, this.$container), this.results.bind(this, this.$container) 1586 }, e.prototype._registerDomEvents = function() { 1587 var b = this; 1588 this.$element.on("change.select2", function() { 1589 b.dataAdapter.current(function(a) { 1590 b.trigger("selection:update", { 1591 data: a 1592 }) 1593 }) 1594 }), this.$element.on("focus.select2", function(a) { 1595 b.trigger("focus", a) 1596 }), this._syncA = c.bind(this._syncAttributes, this), this._syncS = c.bind(this._syncSubtree, this), this.$element[0].attachEvent && this.$element[0].attachEvent("onpropertychange", this._syncA); 1597 var d = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; 1598 null != d ? (this._observer = new d(function(c) { 1599 a.each(c, b._syncA), a.each(c, b._syncS) 1600 }), this._observer.observe(this.$element[0], { 1601 attributes: !0, 1602 childList: !0, 1603 subtree: !1 1604 })) : this.$element[0].addEventListener && (this.$element[0].addEventListener("DOMAttrModified", b._syncA, !1), this.$element[0].addEventListener("DOMNodeInserted", b._syncS, !1), this.$element[0].addEventListener("DOMNodeRemoved", b._syncS, !1)) 1605 }, e.prototype._registerDataEvents = function() { 1606 var a = this; 1607 this.dataAdapter.on("*", function(b, c) { 1608 a.trigger(b, c) 1609 }) 1610 }, e.prototype._registerSelectionEvents = function() { 1611 var b = this, 1612 c = ["toggle", "focus"]; 1613 this.selection.on("toggle", function() { 1614 b.toggleDropdown() 1615 }), this.selection.on("focus", function(a) { 1616 b.focus(a) 1617 }), this.selection.on("*", function(d, e) { 1618 -1 === a.inArray(d, c) && b.trigger(d, e) 1619 }) 1620 }, e.prototype._registerDropdownEvents = function() { 1621 var a = this; 1622 this.dropdown.on("*", function(b, c) { 1623 a.trigger(b, c) 1624 }) 1625 }, e.prototype._registerResultsEvents = function() { 1626 var a = this; 1627 this.results.on("*", function(b, c) { 1628 a.trigger(b, c) 1629 }) 1630 }, e.prototype._registerEvents = function() { 1631 var a = this; 1632 this.on("open", function() { 1633 a.$container.addClass("select2-container--open") 1634 }), this.on("close", function() { 1635 a.$container.removeClass("select2-container--open") 1636 }), this.on("enable", function() { 1637 a.$container.removeClass("select2-container--disabled") 1638 }), this.on("disable", function() { 1639 a.$container.addClass("select2-container--disabled") 1640 }), this.on("blur", function() { 1641 a.$container.removeClass("select2-container--focus") 1642 }), this.on("query", function(b) { 1643 a.isOpen() || a.trigger("open", {}), this.dataAdapter.query(b, function(c) { 1644 a.trigger("results:all", { 1645 data: c, 1646 query: b 1647 }) 1648 }) 1649 }), this.on("query:append", function(b) { 1650 this.dataAdapter.query(b, function(c) { 1651 a.trigger("results:append", { 1652 data: c, 1653 query: b 1654 }) 1655 }) 1656 }), this.on("keypress", function(b) { 1657 var c = b.which; 1658 a.isOpen() ? c === d.ESC || c === d.TAB || c === d.UP && b.altKey ? (a.close(), b.preventDefault()) : c === d.ENTER ? (a.trigger("results:select", {}), b.preventDefault()) : c === d.SPACE && b.ctrlKey ? (a.trigger("results:toggle", {}), b.preventDefault()) : c === d.UP ? (a.trigger("results:previous", {}), b.preventDefault()) : c === d.DOWN && (a.trigger("results:next", {}), b.preventDefault()) : (c === d.ENTER || c === d.SPACE || c === d.DOWN && b.altKey) && (a.open(), b.preventDefault()) 1659 }) 1660 }, e.prototype._syncAttributes = function() { 1661 this.options.set("disabled", this.$element.prop("disabled")), this.options.get("disabled") ? (this.isOpen() && this.close(), this.trigger("disable", {})) : this.trigger("enable", {}) 1662 }, e.prototype._syncSubtree = function(a, b) { 1663 var c = !1, 1664 d = this; 1665 if (!a || !a.target || "OPTION" === a.target.nodeName || "OPTGROUP" === a.target.nodeName) { 1666 if (b) 1667 if (b.addedNodes && b.addedNodes.length > 0) 1668 for (var e = 0; e < b.addedNodes.length; e++) { 1669 var f = b.addedNodes[e]; 1670 f.selected && (c = !0) 1671 } else b.removedNodes && b.removedNodes.length > 0 && (c = !0); 1672 else c = !0; 1673 c && this.dataAdapter.current(function(a) { 1674 d.trigger("selection:update", { 1675 data: a 1676 }) 1677 }) 1678 } 1679 }, e.prototype.trigger = function(a, b) { 1680 var c = e.__super__.trigger, 1681 d = { 1682 open: "opening", 1683 close: "closing", 1684 select: "selecting", 1685 unselect: "unselecting" 1686 }; 1687 if (void 0 === b && (b = {}), a in d) { 1688 var f = d[a], 1689 g = { 1690 prevented: !1, 1691 name: a, 1692 args: b 1693 }; 1694 if (c.call(this, f, g), g.prevented) return void(b.prevented = !0) 1695 } 1696 c.call(this, a, b) 1697 }, e.prototype.toggleDropdown = function() { 1698 this.options.get("disabled") || (this.isOpen() ? this.close() : this.open()) 1699 }, e.prototype.open = function() { 1700 this.isOpen() || this.trigger("query", {}) 1701 }, e.prototype.close = function() { 1702 this.isOpen() && this.trigger("close", {}) 1703 }, e.prototype.isOpen = function() { 1704 return this.$container.hasClass("select2-container--open") 1705 }, e.prototype.hasFocus = function() { 1706 return this.$container.hasClass("select2-container--focus") 1707 }, e.prototype.focus = function(a) { 1708 this.hasFocus() || (this.$container.addClass("select2-container--focus"), this.trigger("focus", {})) 1709 }, e.prototype.enable = function(a) { 1710 this.options.get("debug") && window.console && console.warn && console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'), (null == a || 0 === a.length) && (a = [!0]); 1711 var b = !a[0]; 1712 this.$element.prop("disabled", b) 1713 }, e.prototype.data = function() { 1714 this.options.get("debug") && arguments.length > 0 && window.console && console.warn && console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.'); 1715 var a = []; 1716 return this.dataAdapter.current(function(b) { 1717 a = b 1718 }), a 1719 }, e.prototype.val = function(b) { 1720 if (this.options.get("debug") && window.console && console.warn && console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'), null == b || 0 === b.length) return this.$element.val(); 1721 var c = b[0]; 1722 a.isArray(c) && (c = a.map(c, function(a) { 1723 return a.toString() 1724 })), this.$element.val(c).trigger("change") 1725 }, e.prototype.destroy = function() { 1726 this.$container.remove(), this.$element[0].detachEvent && this.$element[0].detachEvent("onpropertychange", this._syncA), null != this._observer ? (this._observer.disconnect(), this._observer = null) : this.$element[0].removeEventListener && (this.$element[0].removeEventListener("DOMAttrModified", this._syncA, !1), this.$element[0].removeEventListener("DOMNodeInserted", this._syncS, !1), this.$element[0].removeEventListener("DOMNodeRemoved", this._syncS, !1)), this._syncA = null, this._syncS = null, this.$element.off(".select2"), this.$element.attr("tabindex", this.$element.data("old-tabindex")), this.$element.removeClass("select2-hidden-accessible"), this.$element.attr("aria-hidden", "false"), this.$element.removeData("select2"), this.dataAdapter.destroy(), this.selection.destroy(), this.dropdown.destroy(), this.results.destroy(), this.dataAdapter = null, this.selection = null, this.dropdown = null, this.results = null; 1727 }, e.prototype.render = function() { 1728 var b = a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>'); 1729 return b.attr("dir", this.options.get("dir")), this.$container = b, this.$container.addClass("select2-container--" + this.options.get("theme")), b.data("element", this.$element), b 1730 }, e 1731 }), b.define("jquery-mousewheel", ["jquery"], function(a) { 1732 return a 1733 }), b.define("jquery.select2", ["jquery", "jquery-mousewheel", "./select2/core", "./select2/defaults"], function(a, b, c, d) { 1734 if (null == a.fn.select2) { 1735 var e = ["open", "close", "destroy"]; 1736 a.fn.select2 = function(b) { 1737 if (b = b || {}, "object" == typeof b) return this.each(function() { 1738 var d = a.extend(!0, {}, b); 1739 new c(a(this), d) 1740 }), this; 1741 if ("string" == typeof b) { 1742 var d, f = Array.prototype.slice.call(arguments, 1); 1743 return this.each(function() { 1744 var c = a(this).data("select2"); 1745 null == c && window.console && console.error && console.error("The select2('" + b + "') method was called on an element that is not using Select2."), d = c[b].apply(c, f) 1746 }), a.inArray(b, e) >
1746 -1 ? this : d 1747 } 1748 throw new Error("Invalid arguments for Select2: " + b) 1749 } 1750 } 1751 return null == a.fn.select2.defaults && (a.fn.select2.defaults = d), c 1752 }), { 1753 define: b.define, 1754 require: b.require 1755 } 1756 }(), 1757 c = b.require("jquery.select2"); 1758 return a.fn.select2.amd = b, c 1759});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.