Responsive Lightbox & Gallery - Version 2.3.1

Version Description

  • Fix: Plugin capabilities not granted properly
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Responsive Lightbox & Gallery
Version 2.3.1
Comparing to
See all releases

Code changes from version 2.3.0 to 2.3.1

assets/jstree/jstree.js CHANGED
@@ -979,7 +979,7 @@
979
  */
980
  get_string : function (key) {
981
  var a = this.settings.core.strings;
982
- if($.isFunction(a)) { return a.call(this, key); }
983
  if(a && a[key]) { return a[key]; }
984
  return key;
985
  },
@@ -1271,7 +1271,7 @@
1271
  */
1272
  load_node : function (obj, callback) {
1273
  var k, l, i, j, c;
1274
- if($.isArray(obj)) {
1275
  this._load_nodes(obj.slice(), callback);
1276
  return true;
1277
  }
@@ -1441,7 +1441,7 @@
1441
  }
1442
  // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false);
1443
  }
1444
- if($.isFunction(s)) {
1445
  return s.call(this, obj, $.proxy(function (d) {
1446
  if(d === false) {
1447
  callback.call(this, false);
@@ -1457,10 +1457,10 @@
1457
  if(typeof s === 'object') {
1458
  if(s.url) {
1459
  s = $.extend(true, {}, s);
1460
- if($.isFunction(s.url)) {
1461
  s.url = s.url.call(this, obj);
1462
  }
1463
- if($.isFunction(s.data)) {
1464
  s.data = s.data.call(this, obj);
1465
  }
1466
  return $.ajax(s)
@@ -1484,7 +1484,7 @@
1484
  this.settings.core.error.call(this, this._data.core.last_error);
1485
  }, this));
1486
  }
1487
- if ($.isArray(s)) {
1488
  t = $.extend(true, [], s);
1489
  } else if ($.isPlainObject(s)) {
1490
  t = $.extend(true, {}, s);
@@ -1607,7 +1607,7 @@
1607
  data = JSON.parse(data);
1608
  }
1609
  }
1610
- if(!$.isArray(data)) { data = [data]; }
1611
  var w = null,
1612
  args = {
1613
  'df' : this._model.default_state,
@@ -2047,7 +2047,7 @@
2047
  }
2048
  tmp = $.vakata.attributes(d, true);
2049
  $.each(tmp, function (i, v) {
2050
- v = $.trim(v);
2051
  if(!v.length) { return true; }
2052
  data.li_attr[i] = v;
2053
  if(i === 'id') {
@@ -2058,7 +2058,7 @@
2058
  if(tmp.length) {
2059
  tmp = $.vakata.attributes(tmp, true);
2060
  $.each(tmp, function (i, v) {
2061
- v = $.trim(v);
2062
  if(v.length) {
2063
  data.a_attr[i] = v;
2064
  }
@@ -2649,7 +2649,7 @@
2649
  */
2650
  open_node : function (obj, callback, animation) {
2651
  var t1, t2, d, t;
2652
- if($.isArray(obj)) {
2653
  obj = obj.slice();
2654
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2655
  this.open_node(obj[t1], callback, animation);
@@ -2769,7 +2769,7 @@
2769
  */
2770
  close_node : function (obj, animation) {
2771
  var t1, t2, t, d;
2772
- if($.isArray(obj)) {
2773
  obj = obj.slice();
2774
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2775
  this.close_node(obj[t1], animation);
@@ -2833,7 +2833,7 @@
2833
  */
2834
  toggle_node : function (obj) {
2835
  var t1, t2;
2836
- if($.isArray(obj)) {
2837
  obj = obj.slice();
2838
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2839
  this.toggle_node(obj[t1]);
@@ -2934,7 +2934,7 @@
2934
  */
2935
  enable_node : function (obj) {
2936
  var t1, t2;
2937
- if($.isArray(obj)) {
2938
  obj = obj.slice();
2939
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2940
  this.enable_node(obj[t1]);
@@ -2963,7 +2963,7 @@
2963
  */
2964
  disable_node : function (obj) {
2965
  var t1, t2;
2966
- if($.isArray(obj)) {
2967
  obj = obj.slice();
2968
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2969
  this.disable_node(obj[t1]);
@@ -3002,7 +3002,7 @@
3002
  */
3003
  hide_node : function (obj, skip_redraw) {
3004
  var t1, t2;
3005
- if($.isArray(obj)) {
3006
  obj = obj.slice();
3007
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3008
  this.hide_node(obj[t1], true);
@@ -3040,7 +3040,7 @@
3040
  */
3041
  show_node : function (obj, skip_redraw) {
3042
  var t1, t2;
3043
- if($.isArray(obj)) {
3044
  obj = obj.slice();
3045
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3046
  this.show_node(obj[t1], true);
@@ -3252,7 +3252,7 @@
3252
  */
3253
  select_node : function (obj, supress_event, prevent_open, e) {
3254
  var dom, t1, t2, th;
3255
- if($.isArray(obj)) {
3256
  obj = obj.slice();
3257
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3258
  this.select_node(obj[t1], supress_event, prevent_open, e);
@@ -3305,7 +3305,7 @@
3305
  */
3306
  deselect_node : function (obj, supress_event, e) {
3307
  var t1, t2, dom;
3308
- if($.isArray(obj)) {
3309
  obj = obj.slice();
3310
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3311
  this.deselect_node(obj[t1], supress_event, e);
@@ -3513,7 +3513,7 @@
3513
  if(state.core) {
3514
  var res, n, t, _this, i;
3515
  if(state.core.loaded) {
3516
- if(!this.settings.core.loaded_state || !$.isArray(state.core.loaded) || !state.core.loaded.length) {
3517
  delete state.core.loaded;
3518
  this.set_state(state, callback);
3519
  }
@@ -3526,7 +3526,7 @@
3526
  return false;
3527
  }
3528
  if(state.core.open) {
3529
- if(!$.isArray(state.core.open) || !state.core.open.length) {
3530
  delete state.core.open;
3531
  this.set_state(state, callback);
3532
  }
@@ -3600,7 +3600,7 @@
3600
  */
3601
  refresh : function (skip_loading, forget_state) {
3602
  this._data.core.state = forget_state === true ? {} : this.get_state();
3603
- if(forget_state && $.isFunction(forget_state)) { this._data.core.state = forget_state.call(this, this._data.core.state); }
3604
  this._cnt = 0;
3605
  this._model.data = {};
3606
  this._model.data[$.jstree.root] = {
@@ -3734,7 +3734,7 @@
3734
  */
3735
  set_text : function (obj, val) {
3736
  var t1, t2;
3737
- if($.isArray(obj)) {
3738
  obj = obj.slice();
3739
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3740
  this.set_text(obj[t1], val);
@@ -3782,7 +3782,7 @@
3782
  'li_attr' : $.extend(true, {}, obj.li_attr),
3783
  'a_attr' : $.extend(true, {}, obj.a_attr),
3784
  'state' : {},
3785
- 'data' : options && options.no_data ? false : $.extend(true, $.isArray(obj.data)?[]:{}, obj.data)
3786
  //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ),
3787
  }, i, j;
3788
  if(options && options.flat) {
@@ -3934,7 +3934,7 @@
3934
  */
3935
  rename_node : function (obj, val) {
3936
  var t1, t2, old;
3937
- if($.isArray(obj)) {
3938
  obj = obj.slice();
3939
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3940
  this.rename_node(obj[t1], val);
@@ -3969,7 +3969,7 @@
3969
  */
3970
  delete_node : function (obj) {
3971
  var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft;
3972
- if($.isArray(obj)) {
3973
  obj = obj.slice();
3974
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3975
  this.delete_node(obj[t1]);
@@ -4071,7 +4071,7 @@
4071
  }
4072
  return tmp.functions[chk];
4073
  }
4074
- if(chc === false || ($.isFunction(chc) && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) {
4075
  this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
4076
  return false;
4077
  }
@@ -4107,7 +4107,7 @@
4107
  return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); });
4108
  }
4109
 
4110
- if($.isArray(obj)) {
4111
  if(obj.length === 1) {
4112
  obj = obj[0];
4113
  }
@@ -4280,7 +4280,7 @@
4280
  return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); });
4281
  }
4282
 
4283
- if($.isArray(obj)) {
4284
  if(obj.length === 1) {
4285
  obj = obj[0];
4286
  }
@@ -4395,7 +4395,7 @@
4395
  */
4396
  cut : function (obj) {
4397
  if(!obj) { obj = this._data.core.selected.concat(); }
4398
- if(!$.isArray(obj)) { obj = [obj]; }
4399
  if(!obj.length) { return false; }
4400
  var tmp = [], o, t1, t2;
4401
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
@@ -4422,7 +4422,7 @@
4422
  */
4423
  copy : function (obj) {
4424
  if(!obj) { obj = this._data.core.selected.concat(); }
4425
- if(!$.isArray(obj)) { obj = [obj]; }
4426
  if(!obj.length) { return false; }
4427
  var tmp = [], o, t1, t2;
4428
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
@@ -4615,7 +4615,7 @@
4615
  h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
4616
  $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) {
4617
  if (h2 && e.target !== h2) {
4618
- $(h2).blur();
4619
  }
4620
  });
4621
  },
@@ -4819,7 +4819,7 @@
4819
  */
4820
  set_icon : function (obj, icon) {
4821
  var t1, t2, dom, old;
4822
- if($.isArray(obj)) {
4823
  obj = obj.slice();
4824
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4825
  this.set_icon(obj[t1], icon);
@@ -4868,7 +4868,7 @@
4868
  */
4869
  hide_icon : function (obj) {
4870
  var t1, t2;
4871
- if($.isArray(obj)) {
4872
  obj = obj.slice();
4873
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4874
  this.hide_icon(obj[t1]);
@@ -4888,7 +4888,7 @@
4888
  */
4889
  show_icon : function (obj) {
4890
  var t1, t2, dom;
4891
- if($.isArray(obj)) {
4892
  obj = obj.slice();
4893
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4894
  this.show_icon(obj[t1]);
@@ -4914,7 +4914,7 @@
4914
  if(node && node.attributes) {
4915
  $.each(node.attributes, function (i, v) {
4916
  if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; }
4917
- if(v.value !== null && $.trim(v.value) !== '') {
4918
  if(with_values) { attr[v.name] = v.value; }
4919
  else { attr.push(v.name); }
4920
  }
@@ -5548,7 +5548,7 @@
5548
  */
5549
  this.disable_checkbox = function (obj) {
5550
  var t1, t2, dom;
5551
- if($.isArray(obj)) {
5552
  obj = obj.slice();
5553
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5554
  this.disable_checkbox(obj[t1]);
@@ -5584,7 +5584,7 @@
5584
  */
5585
  this.enable_checkbox = function (obj) {
5586
  var t1, t2, dom;
5587
- if($.isArray(obj)) {
5588
  obj = obj.slice();
5589
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5590
  this.enable_checkbox(obj[t1]);
@@ -5732,7 +5732,7 @@
5732
  this.check_node = function (obj, e) {
5733
  if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }
5734
  var dom, t1, t2, th;
5735
- if($.isArray(obj)) {
5736
  obj = obj.slice();
5737
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5738
  this.check_node(obj[t1], e);
@@ -5772,7 +5772,7 @@
5772
  this.uncheck_node = function (obj, e) {
5773
  if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); }
5774
  var t1, t2, dom;
5775
- if($.isArray(obj)) {
5776
  obj = obj.slice();
5777
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5778
  this.uncheck_node(obj[t1], e);
@@ -5927,7 +5927,7 @@
5927
  };
5928
  this.load_node = function (obj, callback) {
5929
  var k, l, i, j, c, tmp;
5930
- if(!$.isArray(obj) && !this.settings.checkbox.tie_selection) {
5931
  tmp = this.get_node(obj);
5932
  if(tmp && tmp.state.loaded) {
5933
  for(k = 0, l = tmp.children_d.length; k < l; k++) {
@@ -6263,7 +6263,7 @@
6263
  }
6264
 
6265
  i = s.items;
6266
- if($.isFunction(i)) {
6267
  i = i.call(this, obj, $.proxy(function (i) {
6268
  this._show_contextmenu(obj, x, y, i);
6269
  }, this));
@@ -6336,7 +6336,7 @@
6336
  },
6337
  _execute : function (i) {
6338
  i = vakata_context.items[i];
6339
- return i && (!i._disabled || ($.isFunction(i._disabled) && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, {
6340
  "item" : i,
6341
  "reference" : vakata_context.reference,
6342
  "element" : vakata_context.element,
@@ -6364,7 +6364,7 @@
6364
  str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + ">&#160;<"+"/a><"+"/li>";
6365
  }
6366
  sep = false;
6367
- str += "<"+"li class='" + (val._class || "") + (val._disabled === true || ($.isFunction(val._disabled) && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">";
6368
  str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">";
6369
  if($.vakata.context.settings.icons) {
6370
  str += "<"+"i ";
@@ -6374,7 +6374,7 @@
6374
  }
6375
  str += "><"+"/i><"+"span class='vakata-contextmenu-sep'>&#160;<"+"/span>";
6376
  }
6377
- str += ($.isFunction(val.label) ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+val.shortcut+'">'+ (val.shortcut_label || '') +'</span>':'') + "<"+"/a>";
6378
  if(val.submenu) {
6379
  tmp = $.vakata.context._parse(val.submenu, true);
6380
  if(tmp) { str += tmp; }
@@ -6561,7 +6561,7 @@
6561
  e.preventDefault();
6562
  //})
6563
  //.on("mouseup", "a", function (e) {
6564
- if(!$(this).blur().parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) {
6565
  $.vakata.context.hide();
6566
  }
6567
  })
@@ -6619,7 +6619,7 @@
6619
  e.preventDefault();
6620
  var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();
6621
  if(a.parent().not('.vakata-context-disabled')) {
6622
- a.click();
6623
  }
6624
  });
6625
 
@@ -6747,7 +6747,7 @@
6747
  txt = $.vakata.html.escape(txt);
6748
  }
6749
  if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") &&
6750
- (this.settings.dnd.is_draggable === true || ($.isFunction(this.settings.dnd.is_draggable) && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e)))
6751
  ) {
6752
  drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] };
6753
  elm = e.currentTarget;
@@ -7287,7 +7287,7 @@
7287
  }
7288
  else {
7289
  if(e.type === "touchend" && e.target === vakata_dnd.target) {
7290
- var to = setTimeout(function () { $(e.target).click(); }, 100);
7291
  $(e.target).one('click', function() { if(to) { clearTimeout(to); } });
7292
  }
7293
  }
@@ -7348,7 +7348,7 @@
7348
  }
7349
  this._data.massload = {};
7350
  if (toLoad.length) {
7351
- if($.isFunction(s)) {
7352
  return s.call(this, toLoad, $.proxy(function (data) {
7353
  var i, j;
7354
  if(data) {
@@ -7369,10 +7369,10 @@
7369
  }
7370
  if(typeof s === 'object' && s && s.url) {
7371
  s = $.extend(true, {}, s);
7372
- if($.isFunction(s.url)) {
7373
  s.url = s.url.call(this, toLoad);
7374
  }
7375
- if($.isFunction(s.data)) {
7376
  s.data = s.data.call(this, toLoad);
7377
  }
7378
  return $.ajax(s)
@@ -7544,7 +7544,7 @@
7544
  * @trigger search.jstree
7545
  */
7546
  this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) {
7547
- if(str === false || $.trim(str.toString()) === "") {
7548
  return this.clear_search();
7549
  }
7550
  inside = this.get_node(inside);
@@ -7566,10 +7566,10 @@
7566
  show_only_matches_children = s.show_only_matches_children;
7567
  }
7568
  if(!skip_async && a !== false) {
7569
- if($.isFunction(a)) {
7570
  return a.call(this, str, $.proxy(function (d) {
7571
  if(d && d.d) { d = d.d; }
7572
- this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () {
7573
  this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
7574
  });
7575
  }, this), inside);
@@ -7591,7 +7591,7 @@
7591
  }, this))
7592
  .done($.proxy(function (d) {
7593
  if(d && d.d) { d = d.d; }
7594
- this._load_nodes(!$.isArray(d) ? [] : $.vakata.array_unique(d), function () {
7595
  this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
7596
  });
7597
  }, this));
@@ -7975,7 +7975,7 @@
7975
  if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }
7976
  if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }
7977
  if(!!k && k.state) { k = k.state; }
7978
- if(!!k && $.isFunction(this.settings.state.filter)) { k = this.settings.state.filter.call(this, k); }
7979
  if(!!k) {
7980
  if (!this.settings.state.preserve_loaded) {
7981
  delete k.core.loaded;
@@ -8121,7 +8121,7 @@
8121
  opt = options ? $.extend(true, {}, options, {no_id:false}) : {},
8122
  tmp = parent.get_json.call(this, obj, opt, flat);
8123
  if(tmp === false) { return false; }
8124
- if($.isArray(tmp)) {
8125
  for(i = 0, j = tmp.length; i < j; i++) {
8126
  tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default";
8127
  if(options && options.no_id) {
@@ -8144,7 +8144,7 @@
8144
  return tmp;
8145
  };
8146
  this._delete_ids = function (tmp) {
8147
- if($.isArray(tmp)) {
8148
  for(var i = 0, j = tmp.length; i < j; i++) {
8149
  tmp[i] = this._delete_ids(tmp[i]);
8150
  }
@@ -8157,7 +8157,7 @@
8157
  if(tmp.a_attr && tmp.a_attr.id) {
8158
  delete tmp.a_attr.id;
8159
  }
8160
- if(tmp.children && $.isArray(tmp.children)) {
8161
  tmp.children = this._delete_ids(tmp.children);
8162
  }
8163
  return tmp;
@@ -8241,7 +8241,7 @@
8241
  */
8242
  this.set_type = function (obj, type) {
8243
  var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a;
8244
- if($.isArray(obj)) {
8245
  obj = obj.slice();
8246
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
8247
  this.set_type(obj[t1], type);
979
  */
980
  get_string : function (key) {
981
  var a = this.settings.core.strings;
982
+ if(typeof a === 'function') { return a.call(this, key); }
983
  if(a && a[key]) { return a[key]; }
984
  return key;
985
  },
1271
  */
1272
  load_node : function (obj, callback) {
1273
  var k, l, i, j, c;
1274
+ if(Array.isArray(obj)) {
1275
  this._load_nodes(obj.slice(), callback);
1276
  return true;
1277
  }
1441
  }
1442
  // return callback.call(this, obj.id === $.jstree.root ? this._append_html_data(obj, this._data.core.original_container_html.clone(true)) : false);
1443
  }
1444
+ if(typeof s === 'function') {
1445
  return s.call(this, obj, $.proxy(function (d) {
1446
  if(d === false) {
1447
  callback.call(this, false);
1457
  if(typeof s === 'object') {
1458
  if(s.url) {
1459
  s = $.extend(true, {}, s);
1460
+ if(typeof s.url === 'function') {
1461
  s.url = s.url.call(this, obj);
1462
  }
1463
+ if(typeof s.data === 'function') {
1464
  s.data = s.data.call(this, obj);
1465
  }
1466
  return $.ajax(s)
1484
  this.settings.core.error.call(this, this._data.core.last_error);
1485
  }, this));
1486
  }
1487
+ if (Array.isArray(s)) {
1488
  t = $.extend(true, [], s);
1489
  } else if ($.isPlainObject(s)) {
1490
  t = $.extend(true, {}, s);
1607
  data = JSON.parse(data);
1608
  }
1609
  }
1610
+ if(!Array.isArray(data)) { data = [data]; }
1611
  var w = null,
1612
  args = {
1613
  'df' : this._model.default_state,
2047
  }
2048
  tmp = $.vakata.attributes(d, true);
2049
  $.each(tmp, function (i, v) {
2050
+ v = v.trim();
2051
  if(!v.length) { return true; }
2052
  data.li_attr[i] = v;
2053
  if(i === 'id') {
2058
  if(tmp.length) {
2059
  tmp = $.vakata.attributes(tmp, true);
2060
  $.each(tmp, function (i, v) {
2061
+ v = v.trim();
2062
  if(v.length) {
2063
  data.a_attr[i] = v;
2064
  }
2649
  */
2650
  open_node : function (obj, callback, animation) {
2651
  var t1, t2, d, t;
2652
+ if(Array.isArray(obj)) {
2653
  obj = obj.slice();
2654
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2655
  this.open_node(obj[t1], callback, animation);
2769
  */
2770
  close_node : function (obj, animation) {
2771
  var t1, t2, t, d;
2772
+ if(Array.isArray(obj)) {
2773
  obj = obj.slice();
2774
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2775
  this.close_node(obj[t1], animation);
2833
  */
2834
  toggle_node : function (obj) {
2835
  var t1, t2;
2836
+ if(Array.isArray(obj)) {
2837
  obj = obj.slice();
2838
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2839
  this.toggle_node(obj[t1]);
2934
  */
2935
  enable_node : function (obj) {
2936
  var t1, t2;
2937
+ if(Array.isArray(obj)) {
2938
  obj = obj.slice();
2939
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2940
  this.enable_node(obj[t1]);
2963
  */
2964
  disable_node : function (obj) {
2965
  var t1, t2;
2966
+ if(Array.isArray(obj)) {
2967
  obj = obj.slice();
2968
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
2969
  this.disable_node(obj[t1]);
3002
  */
3003
  hide_node : function (obj, skip_redraw) {
3004
  var t1, t2;
3005
+ if(Array.isArray(obj)) {
3006
  obj = obj.slice();
3007
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3008
  this.hide_node(obj[t1], true);
3040
  */
3041
  show_node : function (obj, skip_redraw) {
3042
  var t1, t2;
3043
+ if(Array.isArray(obj)) {
3044
  obj = obj.slice();
3045
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3046
  this.show_node(obj[t1], true);
3252
  */
3253
  select_node : function (obj, supress_event, prevent_open, e) {
3254
  var dom, t1, t2, th;
3255
+ if(Array.isArray(obj)) {
3256
  obj = obj.slice();
3257
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3258
  this.select_node(obj[t1], supress_event, prevent_open, e);
3305
  */
3306
  deselect_node : function (obj, supress_event, e) {
3307
  var t1, t2, dom;
3308
+ if(Array.isArray(obj)) {
3309
  obj = obj.slice();
3310
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3311
  this.deselect_node(obj[t1], supress_event, e);
3513
  if(state.core) {
3514
  var res, n, t, _this, i;
3515
  if(state.core.loaded) {
3516
+ if(!this.settings.core.loaded_state || !Array.isArray(state.core.loaded) || !state.core.loaded.length) {
3517
  delete state.core.loaded;
3518
  this.set_state(state, callback);
3519
  }
3526
  return false;
3527
  }
3528
  if(state.core.open) {
3529
+ if(!Array.isArray(state.core.open) || !state.core.open.length) {
3530
  delete state.core.open;
3531
  this.set_state(state, callback);
3532
  }
3600
  */
3601
  refresh : function (skip_loading, forget_state) {
3602
  this._data.core.state = forget_state === true ? {} : this.get_state();
3603
+ if(forget_state && typeof forget_state === 'function') { this._data.core.state = forget_state.call(this, this._data.core.state); }
3604
  this._cnt = 0;
3605
  this._model.data = {};
3606
  this._model.data[$.jstree.root] = {
3734
  */
3735
  set_text : function (obj, val) {
3736
  var t1, t2;
3737
+ if(Array.isArray(obj)) {
3738
  obj = obj.slice();
3739
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3740
  this.set_text(obj[t1], val);
3782
  'li_attr' : $.extend(true, {}, obj.li_attr),
3783
  'a_attr' : $.extend(true, {}, obj.a_attr),
3784
  'state' : {},
3785
+ 'data' : options && options.no_data ? false : $.extend(true, Array.isArray(obj.data)?[]:{}, obj.data)
3786
  //( this.get_node(obj, true).length ? this.get_node(obj, true).data() : obj.data ),
3787
  }, i, j;
3788
  if(options && options.flat) {
3934
  */
3935
  rename_node : function (obj, val) {
3936
  var t1, t2, old;
3937
+ if(Array.isArray(obj)) {
3938
  obj = obj.slice();
3939
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3940
  this.rename_node(obj[t1], val);
3969
  */
3970
  delete_node : function (obj) {
3971
  var t1, t2, par, pos, tmp, i, j, k, l, c, top, lft;
3972
+ if(Array.isArray(obj)) {
3973
  obj = obj.slice();
3974
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
3975
  this.delete_node(obj[t1]);
4071
  }
4072
  return tmp.functions[chk];
4073
  }
4074
+ if(chc === false || (typeof chc === 'function' && chc.call(this, chk, obj, par, pos, more) === false) || (chc && chc[chk] === false)) {
4075
  this._data.core.last_error = { 'error' : 'check', 'plugin' : 'core', 'id' : 'core_03', 'reason' : 'User config for core.check_callback prevents function: ' + chk, 'data' : JSON.stringify({ 'chk' : chk, 'pos' : pos, 'obj' : obj && obj.id ? obj.id : false, 'par' : par && par.id ? par.id : false }) };
4076
  return false;
4077
  }
4107
  return this.load_node(par, function () { this.move_node(obj, par, pos, callback, true, false, origin); });
4108
  }
4109
 
4110
+ if(Array.isArray(obj)) {
4111
  if(obj.length === 1) {
4112
  obj = obj[0];
4113
  }
4280
  return this.load_node(par, function () { this.copy_node(obj, par, pos, callback, true, false, origin); });
4281
  }
4282
 
4283
+ if(Array.isArray(obj)) {
4284
  if(obj.length === 1) {
4285
  obj = obj[0];
4286
  }
4395
  */
4396
  cut : function (obj) {
4397
  if(!obj) { obj = this._data.core.selected.concat(); }
4398
+ if(!Array.isArray(obj)) { obj = [obj]; }
4399
  if(!obj.length) { return false; }
4400
  var tmp = [], o, t1, t2;
4401
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4422
  */
4423
  copy : function (obj) {
4424
  if(!obj) { obj = this._data.core.selected.concat(); }
4425
+ if(!Array.isArray(obj)) { obj = [obj]; }
4426
  if(!obj.length) { return false; }
4427
  var tmp = [], o, t1, t2;
4428
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4615
  h2.css(fn).width(Math.min(h1.text("pW" + h2[0].value).width(),w))[0].select();
4616
  $(document).one('mousedown.jstree touchstart.jstree dnd_start.vakata', function (e) {
4617
  if (h2 && e.target !== h2) {
4618
+ $(h2).trigger( 'blur' );
4619
  }
4620
  });
4621
  },
4819
  */
4820
  set_icon : function (obj, icon) {
4821
  var t1, t2, dom, old;
4822
+ if(Array.isArray(obj)) {
4823
  obj = obj.slice();
4824
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4825
  this.set_icon(obj[t1], icon);
4868
  */
4869
  hide_icon : function (obj) {
4870
  var t1, t2;
4871
+ if(Array.isArray(obj)) {
4872
  obj = obj.slice();
4873
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4874
  this.hide_icon(obj[t1]);
4888
  */
4889
  show_icon : function (obj) {
4890
  var t1, t2, dom;
4891
+ if(Array.isArray(obj)) {
4892
  obj = obj.slice();
4893
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
4894
  this.show_icon(obj[t1]);
4914
  if(node && node.attributes) {
4915
  $.each(node.attributes, function (i, v) {
4916
  if($.inArray(v.name.toLowerCase(),['style','contenteditable','hasfocus','tabindex']) !== -1) { return; }
4917
+ if(v.value !== null && (v.value).trim() !== '') {
4918
  if(with_values) { attr[v.name] = v.value; }
4919
  else { attr.push(v.name); }
4920
  }
5548
  */
5549
  this.disable_checkbox = function (obj) {
5550
  var t1, t2, dom;
5551
+ if(Array.isArray(obj)) {
5552
  obj = obj.slice();
5553
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5554
  this.disable_checkbox(obj[t1]);
5584
  */
5585
  this.enable_checkbox = function (obj) {
5586
  var t1, t2, dom;
5587
+ if(Array.isArray(obj)) {
5588
  obj = obj.slice();
5589
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5590
  this.enable_checkbox(obj[t1]);
5732
  this.check_node = function (obj, e) {
5733
  if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }
5734
  var dom, t1, t2, th;
5735
+ if(Array.isArray(obj)) {
5736
  obj = obj.slice();
5737
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5738
  this.check_node(obj[t1], e);
5772
  this.uncheck_node = function (obj, e) {
5773
  if(this.settings.checkbox.tie_selection) { return this.deselect_node(obj, false, e); }
5774
  var t1, t2, dom;
5775
+ if(Array.isArray(obj)) {
5776
  obj = obj.slice();
5777
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
5778
  this.uncheck_node(obj[t1], e);
5927
  };
5928
  this.load_node = function (obj, callback) {
5929
  var k, l, i, j, c, tmp;
5930
+ if(!Array.isArray(obj) && !this.settings.checkbox.tie_selection) {
5931
  tmp = this.get_node(obj);
5932
  if(tmp && tmp.state.loaded) {
5933
  for(k = 0, l = tmp.children_d.length; k < l; k++) {
6263
  }
6264
 
6265
  i = s.items;
6266
+ if(typeof i === 'function') {
6267
  i = i.call(this, obj, $.proxy(function (i) {
6268
  this._show_contextmenu(obj, x, y, i);
6269
  }, this));
6336
  },
6337
  _execute : function (i) {
6338
  i = vakata_context.items[i];
6339
+ return i && (!i._disabled || (typeof i._disabled === 'function' && !i._disabled({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }))) && i.action ? i.action.call(null, {
6340
  "item" : i,
6341
  "reference" : vakata_context.reference,
6342
  "element" : vakata_context.element,
6364
  str += "<"+"li class='vakata-context-separator'><"+"a href='#' " + ($.vakata.context.settings.icons ? '' : 'style="margin-left:0px;"') + ">&#160;<"+"/a><"+"/li>";
6365
  }
6366
  sep = false;
6367
+ str += "<"+"li class='" + (val._class || "") + (val._disabled === true || (typeof val._disabled === 'function' && val._disabled({ "item" : val, "reference" : vakata_context.reference, "element" : vakata_context.element })) ? " vakata-contextmenu-disabled " : "") + "' "+(val.shortcut?" data-shortcut='"+val.shortcut+"' ":'')+">";
6368
  str += "<"+"a href='#' rel='" + (vakata_context.items.length - 1) + "' " + (val.title ? "title='" + val.title + "'" : "") + ">";
6369
  if($.vakata.context.settings.icons) {
6370
  str += "<"+"i ";
6374
  }
6375
  str += "><"+"/i><"+"span class='vakata-contextmenu-sep'>&#160;<"+"/span>";
6376
  }
6377
+ str += (typeof val.label === 'function' ? val.label({ "item" : i, "reference" : vakata_context.reference, "element" : vakata_context.element }) : val.label) + (val.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+val.shortcut+'">'+ (val.shortcut_label || '') +'</span>':'') + "<"+"/a>";
6378
  if(val.submenu) {
6379
  tmp = $.vakata.context._parse(val.submenu, true);
6380
  if(tmp) { str += tmp; }
6561
  e.preventDefault();
6562
  //})
6563
  //.on("mouseup", "a", function (e) {
6564
+ if(!$(this).trigger( 'blur' ).parent().hasClass("vakata-context-disabled") && $.vakata.context._execute($(this).attr("rel")) !== false) {
6565
  $.vakata.context.hide();
6566
  }
6567
  })
6619
  e.preventDefault();
6620
  var a = vakata_context.element.find('.vakata-contextmenu-shortcut-' + e.which).parent();
6621
  if(a.parent().not('.vakata-context-disabled')) {
6622
+ a.trigger( 'click' );
6623
  }
6624
  });
6625
 
6747
  txt = $.vakata.html.escape(txt);
6748
  }
6749
  if(obj && obj.id && obj.id !== $.jstree.root && (e.which === 1 || e.type === "touchstart" || e.type === "dragstart") &&
6750
+ (this.settings.dnd.is_draggable === true || (typeof this.settings.dnd.is_draggable === 'function' && this.settings.dnd.is_draggable.call(this, (mlt > 1 ? this.get_top_selected(true) : [obj]), e)))
6751
  ) {
6752
  drg = { 'jstree' : true, 'origin' : this, 'obj' : this.get_node(obj,true), 'nodes' : mlt > 1 ? this.get_top_selected() : [obj.id] };
6753
  elm = e.currentTarget;
7287
  }
7288
  else {
7289
  if(e.type === "touchend" && e.target === vakata_dnd.target) {
7290
+ var to = setTimeout(function () { $(e.target).trigger( 'click' ); }, 100);
7291
  $(e.target).one('click', function() { if(to) { clearTimeout(to); } });
7292
  }
7293
  }
7348
  }
7349
  this._data.massload = {};
7350
  if (toLoad.length) {
7351
+ if(typeof s === 'function') {
7352
  return s.call(this, toLoad, $.proxy(function (data) {
7353
  var i, j;
7354
  if(data) {
7369
  }
7370
  if(typeof s === 'object' && s && s.url) {
7371
  s = $.extend(true, {}, s);
7372
+ if(typeof s.url === 'function') {
7373
  s.url = s.url.call(this, toLoad);
7374
  }
7375
+ if(typeof s.data === 'function') {
7376
  s.data = s.data.call(this, toLoad);
7377
  }
7378
  return $.ajax(s)
7544
  * @trigger search.jstree
7545
  */
7546
  this.search = function (str, skip_async, show_only_matches, inside, append, show_only_matches_children) {
7547
+ if(str === false || (str.toString()).trim() === "") {
7548
  return this.clear_search();
7549
  }
7550
  inside = this.get_node(inside);
7566
  show_only_matches_children = s.show_only_matches_children;
7567
  }
7568
  if(!skip_async && a !== false) {
7569
+ if(typeof a === 'function') {
7570
  return a.call(this, str, $.proxy(function (d) {
7571
  if(d && d.d) { d = d.d; }
7572
+ this._load_nodes(!Array.isArray(d) ? [] : $.vakata.array_unique(d), function () {
7573
  this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
7574
  });
7575
  }, this), inside);
7591
  }, this))
7592
  .done($.proxy(function (d) {
7593
  if(d && d.d) { d = d.d; }
7594
+ this._load_nodes(!Array.isArray(d) ? [] : $.vakata.array_unique(d), function () {
7595
  this.search(str, true, show_only_matches, inside, append, show_only_matches_children);
7596
  });
7597
  }, this));
7975
  if(!!k) { try { k = JSON.parse(k); } catch(ex) { return false; } }
7976
  if(!!k && k.ttl && k.sec && +(new Date()) - k.sec > k.ttl) { return false; }
7977
  if(!!k && k.state) { k = k.state; }
7978
+ if(!!k && typeof this.settings.state.filter === 'function') { k = this.settings.state.filter.call(this, k); }
7979
  if(!!k) {
7980
  if (!this.settings.state.preserve_loaded) {
7981
  delete k.core.loaded;
8121
  opt = options ? $.extend(true, {}, options, {no_id:false}) : {},
8122
  tmp = parent.get_json.call(this, obj, opt, flat);
8123
  if(tmp === false) { return false; }
8124
+ if(Array.isArray(tmp)) {
8125
  for(i = 0, j = tmp.length; i < j; i++) {
8126
  tmp[i].type = tmp[i].id && m[tmp[i].id] && m[tmp[i].id].type ? m[tmp[i].id].type : "default";
8127
  if(options && options.no_id) {
8144
  return tmp;
8145
  };
8146
  this._delete_ids = function (tmp) {
8147
+ if(Array.isArray(tmp)) {
8148
  for(var i = 0, j = tmp.length; i < j; i++) {
8149
  tmp[i] = this._delete_ids(tmp[i]);
8150
  }
8157
  if(tmp.a_attr && tmp.a_attr.id) {
8158
  delete tmp.a_attr.id;
8159
  }
8160
+ if(tmp.children && Array.isArray(tmp.children)) {
8161
  tmp.children = this._delete_ids(tmp.children);
8162
  }
8163
  return tmp;
8241
  */
8242
  this.set_type = function (obj, type) {
8243
  var m = this._model.data, t, t1, t2, old_type, old_icon, k, d, a;
8244
+ if(Array.isArray(obj)) {
8245
  obj = obj.slice();
8246
  for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
8247
  this.set_type(obj[t1], type);
assets/jstree/jstree.min.js CHANGED
@@ -1,6 +1 @@
1
- /*! jsTree - v3.3.10 - 2020-06-16 - (MIT) */
2
- !function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):"undefined"!=typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a,b){"use strict";if(!a.jstree){var c=0,d=!1,e=!1,f=!1,g=[],h=a("script:last").attr("src"),i=window.document,j=window.setImmediate,k=window.Promise;!j&&k&&(j=function(a,b){k.resolve(b).then(a)}),a.jstree={version:"3.3.10",defaults:{plugins:[]},plugins:{},path:h&&-1!==h.indexOf("/")?h.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},a.jstree.create=function(b,d){var e=new a.jstree.core(++c),f=d;return d=a.extend(!0,{},a.jstree.defaults,d),f&&f.plugins&&(d.plugins=f.plugins),a.each(d.plugins,function(a,b){"core"!==a&&(e=e.plugin(b,d[b]))}),a(b).data("jstree",e),e.init(b,d),e},a.jstree.destroy=function(){a(".jstree:jstree").jstree("destroy"),a(i).off(".jstree")},a.jstree.core=function(a){this._id=a,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},a.jstree.reference=function(b){var c=null,d=null;if(!b||!b.id||b.tagName&&b.nodeType||(b=b.id),!d||!d.length)try{d=a(b)}catch(e){}if(!d||!d.length)try{d=a("#"+b.replace(a.jstree.idregex,"\\$&"))}catch(e){}return d&&d.length&&(d=d.closest(".jstree")).length&&(d=d.data("jstree"))?c=d:a(".jstree").each(function(){var d=a(this).data("jstree");return d&&d._model.data[b]?(c=d,!1):void 0}),c},a.fn.jstree=function(c){var d="string"==typeof c,e=Array.prototype.slice.call(arguments,1),f=null;return c!==!0||this.length?(this.each(function(){var g=a.jstree.reference(this),h=d&&g?g[c]:null;return f=d&&h?h.apply(g,e):null,g||d||c!==b&&!a.isPlainObject(c)||a.jstree.create(this,c),(g&&!d||c===!0)&&(f=g||!1),null!==f&&f!==b?!1:void 0}),null!==f&&f!==b?f:this):!1},a.expr.pseudos.jstree=a.expr.createPseudo(function(c){return function(c){return a(c).hasClass("jstree")&&a(c).data("jstree")!==b}}),a.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:a.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(b){b.type="click",a(b.currentTarget).trigger(b)},enter:function(b){b.type="click",a(b.currentTarget).trigger(b)},left:function(b){if(b.preventDefault(),this.is_open(b.currentTarget))this.close_node(b.currentTarget);else{var c=this.get_parent(b.currentTarget);c&&c.id!==a.jstree.root&&this.get_node(c,!0).children(".jstree-anchor").focus()}},up:function(a){a.preventDefault();var b=this.get_prev_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},right:function(b){if(b.preventDefault(),this.is_closed(b.currentTarget))this.open_node(b.currentTarget,function(a){this.get_node(a,!0).children(".jstree-anchor").focus()});else if(this.is_open(b.currentTarget)){var c=this.get_node(b.currentTarget,!0).children(".jstree-children")[0];c&&a(this._firstChild(c)).children(".jstree-anchor").focus()}},down:function(a){a.preventDefault();var b=this.get_next_dom(a.currentTarget);b&&b.length&&b.children(".jstree-anchor").focus()},"*":function(a){this.open_all()},home:function(b){b.preventDefault();var c=this._firstChild(this.get_container_ul()[0]);c&&a(c).children(".jstree-anchor").filter(":visible").focus()},end:function(a){a.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(a){a.preventDefault(),this.edit(a.currentTarget)}}},a.jstree.core.prototype={plugin:function(b,c){var d=a.jstree.plugins[b];return d?(this._data[b]={},d.prototype=this,new d(c,this)):this},init:function(b,c){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=a(b).addClass("jstree jstree-"+this._id),this.settings=c,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='presentation'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(a.jstree.root)},destroy:function(a){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(b){}a||this.element.empty(),this.teardown()},_create_prototype_node:function(){var a=i.createElement("LI"),b,c;return a.setAttribute("role","presentation"),b=i.createElement("I"),b.className="jstree-icon jstree-ocl",b.setAttribute("role","presentation"),a.appendChild(b),b=i.createElement("A"),b.className="jstree-anchor",b.setAttribute("href","#"),b.setAttribute("tabindex","-1"),b.setAttribute("role","treeitem"),c=i.createElement("I"),c.className="jstree-icon jstree-themeicon",c.setAttribute("role","presentation"),b.appendChild(c),a.appendChild(b),b=c=null,a},_kbevent_to_func:function(a){var b={8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"},c=[];if(a.ctrlKey&&c.push("ctrl"),a.altKey&&c.push("alt"),a.shiftKey&&c.push("shift"),c.push(b[a.which]||a.which),c=c.sort().join("-").toLowerCase(),"shift-shift"===c||"ctrl-ctrl"===c||"alt-alt"===c)return null;var d=this.settings.core.keyboard,e,f;for(e in d)if(d.hasOwnProperty(e)&&(f=e,"-"!==f&&"+"!==f&&(f=f.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS"),f=f.split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),f===c))return d[e];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var b="",c=null,d=0;this.element.on("dblclick.jstree",function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;if(i.selection&&i.selection.empty)i.selection.empty();else if(window.getSelection){var b=window.getSelection();try{b.removeAllRanges(),b.collapse()}catch(c){}}}).on("mousedown.jstree",a.proxy(function(a){a.target===this.element[0]&&(a.preventDefault(),d=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(a){a.preventDefault()}).on("click.jstree",".jstree-ocl",a.proxy(function(a){this.toggle_node(a.target)},this)).on("dblclick.jstree",".jstree-anchor",a.proxy(function(a){return a.target.tagName&&"input"===a.target.tagName.toLowerCase()?!0:void(this.settings.core.dblclick_toggle&&this.toggle_node(a.target))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(b){b.preventDefault(),b.currentTarget!==i.activeElement&&a(b.currentTarget).focus(),this.activate_node(b.currentTarget,b)},this)).on("keydown.jstree",".jstree-anchor",a.proxy(function(a){if(a.target.tagName&&"input"===a.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===a.which?a.which=39:39===a.which&&(a.which=37));var b=this._kbevent_to_func(a);if(b){var c=b.call(this,a);if(c===!1||c===!0)return c}},this)).on("load_node.jstree",a.proxy(function(b,c){c.status&&(c.node.id!==a.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(a.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){var b=[],c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)b=b.concat(this._model.data[this._data.core.selected[c]].parents);for(b=a.vakata.array_unique(b),c=0,d=b.length;d>c;c++)this.open_node(b[c],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",a.proxy(function(d){if(d.target.tagName&&"input"===d.target.tagName.toLowerCase())return!0;c&&clearTimeout(c),c=setTimeout(function(){b=""},500);var e=String.fromCharCode(d.which).toLowerCase(),f=this.element.find(".jstree-anchor").filter(":visible"),g=f.index(i.activeElement)||0,h=!1;if(b+=e,b.length>1){if(f.slice(g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g).each(a.proxy(function(c,d){return 0===a(d).text().toLowerCase().indexOf(b)?(a(d).focus(),h=!0,!1):void 0},this)),h)return}if(new RegExp("^"+e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(b)){if(f.slice(g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return;if(f.slice(0,g+1).each(a.proxy(function(b,c){return a(c).text().toLowerCase().charAt(0)===e?(a(c).focus(),h=!0,!1):void 0},this)),h)return}},this)).on("init.jstree",a.proxy(function(){var a=this.settings.core.themes;this._data.core.themes.dots=a.dots,this._data.core.themes.stripes=a.stripes,this._data.core.themes.icons=a.icons,this._data.core.themes.ellipsis=a.ellipsis,this.set_theme(a.name||"default",a.url),this.set_theme_variant(a.variant)},this)).on("loading.jstree",a.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",a.proxy(function(b){this._data.core.focused=null,a(b.currentTarget).filter(".jstree-hovered").trigger("mouseleave"),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",a.proxy(function(b){var c=this.get_node(b.currentTarget);c&&c.id&&(this._data.core.focused=c.id),this.element.find(".jstree-hovered").not(b.currentTarget).trigger("mouseleave"),a(b.currentTarget).trigger("mouseenter"),this.element.attr("tabindex","-1")},this)).on("focus.jstree",a.proxy(function(){if(+new Date-d>500&&!this._data.core.focused&&this.settings.core.restore_focus){d=0;var a=this.get_node(this.element.attr("aria-activedescendant"),!0);a&&a.find("> .jstree-anchor").focus()}},this)).on("mouseenter.jstree",".jstree-anchor",a.proxy(function(a){this.hover_node(a.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),a(i).off(".jstree-"+this._id)},trigger:function(a,b){b||(b={}),b.instance=this,this.element.triggerHandler(a.replace(".jstree","")+".jstree",b)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(b){var c=this.settings.core.strings;return a.isFunction(c)?c.call(this,b):c&&c[b]?c[b]:b},_firstChild:function(a){a=a?a.firstChild:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_nextSibling:function(a){a=a?a.nextSibling:null;while(null!==a&&1!==a.nodeType)a=a.nextSibling;return a},_previousSibling:function(a){a=a?a.previousSibling:null;while(null!==a&&1!==a.nodeType)a=a.previousSibling;return a},get_node:function(b,c){b&&b.id&&(b=b.id),b instanceof a&&b.length&&b[0].id&&(b=b[0].id);var d;try{if(this._model.data[b])b=this._model.data[b];else if("string"==typeof b&&this._model.data[b.replace(/^#/,"")])b=this._model.data[b.replace(/^#/,"")];else if("string"==typeof b&&(d=a("#"+b.replace(a.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else if((d=this.element.find(b)).length&&this._model.data[d.closest(".jstree-node").attr("id")])b=this._model.data[d.closest(".jstree-node").attr("id")];else{if(!(d=this.element.find(b)).length||!d.hasClass("jstree"))return!1;b=this._model.data[a.jstree.root]}return c&&(b=b.id===a.jstree.root?this.element:a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)),b}catch(e){return!1}},get_path:function(b,c,d){if(b=b.parents?b:this.get_node(b),!b||b.id===a.jstree.root||!b.parents)return!1;var e,f,g=[];for(g.push(d?b.id:b.text),e=0,f=b.parents.length;f>e;e++)g.push(d?b.parents[e]:this.get_text(b.parents[e]));return g=g.reverse().slice(1),c?g.join(c):g},get_next_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this._firstChild(this.get_container_ul()[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}if(b.hasClass("jstree-open")){d=this._firstChild(b.children(".jstree-children")[0]);while(d&&0===d.offsetHeight)d=this._nextSibling(d);if(null!==d)return a(d)}d=b[0];do d=this._nextSibling(d);while(d&&0===d.offsetHeight);return null!==d?a(d):b.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(b,c){var d;if(b=this.get_node(b,!0),b[0]===this.element[0]){d=this.get_container_ul()[0].lastChild;while(d&&0===d.offsetHeight)d=this._previousSibling(d);return d?a(d):!1}if(!b||!b.length)return!1;if(c){d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);return d?a(d):!1}d=b[0];do d=this._previousSibling(d);while(d&&0===d.offsetHeight);if(null!==d){b=a(d);while(b.hasClass("jstree-open"))b=b.children(".jstree-children").first().children(".jstree-node:visible:last");return b}return d=b[0].parentNode.parentNode,d&&d.className&&-1!==d.className.indexOf("jstree-node")?a(d):!1},get_parent:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.parent:!1},get_children_dom:function(a){return a=this.get_node(a,!0),a[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):a&&a.length?a.children(".jstree-children").children(".jstree-node"):!1},is_parent:function(a){return a=this.get_node(a),a&&(a.state.loaded===!1||a.children.length>0)},is_loaded:function(a){return a=this.get_node(a),a&&a.state.loaded},is_loading:function(a){return a=this.get_node(a),a&&a.state&&a.state.loading},is_open:function(a){return a=this.get_node(a),a&&a.state.opened},is_closed:function(a){return a=this.get_node(a),a&&this.is_parent(a)&&!a.state.opened},is_leaf:function(a){return!this.is_parent(a)},load_node:function(b,c){var d,e,f,g,h;if(a.isArray(b))return this._load_nodes(b.slice(),c),!0;if(b=this.get_node(b),!b)return c&&c.call(this,b,!1),!1;if(b.state.loaded){for(b.state.loaded=!1,f=0,g=b.parents.length;g>f;f++)this._model.data[b.parents[f]].children_d=a.vakata.array_filter(this._model.data[b.parents[f]].children_d,function(c){return-1===a.inArray(c,b.children_d)});for(d=0,e=b.children_d.length;e>d;d++)this._model.data[b.children_d[d]].state.selected&&(h=!0),delete this._model.data[b.children_d[d]];h&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(c){return-1===a.inArray(c,b.children_d)})),b.children=[],b.children_d=[],h&&this.trigger("changed",{action:"load_node",node:b,selected:this._data.core.selected})}return b.state.failed=!1,b.state.loading=!0,this.get_node(b,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(b,a.proxy(function(a){b=this._model.data[b.id],b.state.loading=!1,b.state.loaded=a,b.state.failed=!b.state.loaded;var d=this.get_node(b,!0),e=0,f=0,g=this._model.data,h=!1;for(e=0,f=b.children.length;f>e;e++)if(g[b.children[e]]&&!g[b.children[e]].state.hidden){h=!0;break}b.state.loaded&&d&&d.length&&(d.removeClass("jstree-closed jstree-open jstree-leaf"),h?"#"!==b.id&&d.addClass(b.state.opened?"jstree-open":"jstree-closed"):d.addClass("jstree-leaf")),d.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:b,status:a}),c&&c.call(this,b,a)},this)),!0},_load_nodes:function(a,b,c,d){var e=!0,f=function(){this._load_nodes(a,b,!0)},g=this._model.data,h,i,j=[];for(h=0,i=a.length;i>h;h++)g[a[h]]&&(!g[a[h]].state.loaded&&!g[a[h]].state.failed||!c&&d)&&(this.is_loading(a[h])||this.load_node(a[h],f),e=!1);if(e){for(h=0,i=a.length;i>h;h++)g[a[h]]&&g[a[h]].state.loaded&&j.push(a[h]);b&&!b.done&&(b.call(this,j),b.done=!0)}},load_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=[],e=this._model.data,f=e[b.id].children_d,g,h;for(b.state&&!b.state.loaded&&d.push(b.id),g=0,h=f.length;h>g;g++)e[f[g]]&&e[f[g]].state&&!e[f[g]].state.loaded&&d.push(f[g]);d.length?this._load_nodes(d,function(){this.load_all(b,c)}):(c&&c.call(this,b),this.trigger("load_all",{node:b}))},_load_node:function(b,c){var d=this.settings.core.data,e,f=function g(){return 3!==this.nodeType&&8!==this.nodeType};return d?a.isFunction(d)?d.call(this,b,a.proxy(function(d){d===!1?c.call(this,!1):this["string"==typeof d?"_append_html_data":"_append_json_data"](b,"string"==typeof d?a(a.parseHTML(d)).filter(f):d,function(a){c.call(this,a)})},this)):"object"==typeof d?d.url?(d=a.extend(!0,{},d),a.isFunction(d.url)&&(d.url=d.url.call(this,b)),a.isFunction(d.data)&&(d.data=d.data.call(this,b)),a.ajax(d).done(a.proxy(function(d,e,g){var h=g.getResponseHeader("Content-Type");return h&&-1!==h.indexOf("json")||"object"==typeof d?this._append_json_data(b,d,function(a){c.call(this,a)}):h&&-1!==h.indexOf("html")||"string"==typeof d?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:g})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))},this)).fail(a.proxy(function(a){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:b.id,xhr:a})},c.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=a.isArray(d)?a.extend(!0,[],d):a.isPlainObject(d)?a.extend(!0,{},d):d,b.id===a.jstree.root?this._append_json_data(b,e,function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1))):"string"==typeof d?b.id===a.jstree.root?this._append_html_data(b,a(a.parseHTML(d)).filter(f),function(a){c.call(this,a)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:b.id})},this.settings.core.error.call(this,this._data.core.last_error),c.call(this,!1)):c.call(this,!1):b.id===a.jstree.root?this._append_html_data(b,this._data.core.original_container_html.clone(!0),function(a){c.call(this,a)}):c.call(this,!1)},_node_changed:function(b){b=this.get_node(b),b&&-1===a.inArray(b.id,this._model.changed)&&this._model.changed.push(b.id)},_append_html_data:function(b,c,d){b=this.get_node(b),b.children=[],b.children_d=[];var e=c.is("ul")?c.children():c,f=b.id,g=[],h=[],i=this._model.data,j=i[f],k=this._data.core.selected.length,l,m,n;for(e.each(a.proxy(function(b,c){l=this._parse_model_from_html(a(c),f,j.parents.concat()),l&&(g.push(l),h.push(l),i[l].children_d.length&&(h=h.concat(i[l].children_d)))},this)),j.children=g,j.children_d=h,m=0,n=j.parents.length;n>m;m++)i[j.parents[m]].children_d=i[j.parents[m]].children_d.concat(h);this.trigger("model",{nodes:h,parent:f}),f!==a.jstree.root?(this._node_changed(f),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==k&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),d.call(this,!0)},_append_json_data:function(b,c,d,e){if(null!==this.element){b=this.get_node(b),b.children=[],b.children_d=[],c.d&&(c=c.d,"string"==typeof c&&(c=JSON.parse(c))),a.isArray(c)||(c=[c]);var f=null,g={df:this._model.default_state,dat:c,par:b.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},h=this,i=function(a,b){a.data&&(a=a.data);var c=a.dat,d=a.par,e=[],f=[],g=[],i=a.df,j=a.t_id,k=a.t_cnt,l=a.m,m=l[d],n=a.sel,o,p,q,r,s=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f,h,j,k,m={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in i)i.hasOwnProperty(f)&&(m.state[f]=i[f]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(m.icon=a.data.jstree.icon),(m.icon===b||null===m.icon||""===m.icon)&&(m.icon=!0),a&&a.data&&(m.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(m.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(m.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(m.li_attr[f]=a.li_attr[f]);if(m.li_attr.id||(m.li_attr.id=e),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(m.a_attr[f]=a.a_attr[f]);for(a&&a.children&&a.children===!0&&(m.state.loaded=!1,m.children=[],m.children_d=[]),l[m.id]=m,f=0,h=m.children.length;h>f;f++)j=s(l[m.children[f]],m.id,d),k=l[j],m.children_d.push(j),k.children_d.length&&(m.children_d=m.children_d.concat(k.children_d));return delete a.data,delete a.children,l[m.id].original=a,m.state.selected&&g.push(m.id),m.id},t=function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,h,m,n,o;do e="j"+j+"_"+ ++k;while(l[e]);o={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in i)i.hasOwnProperty(f)&&(o.state[f]=i[f]);if(a&&a.id&&(o.id=a.id.toString()),a&&a.text&&(o.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(o.icon=a.data.jstree.icon),(o.icon===b||null===o.icon||""===o.icon)&&(o.icon=!0),a&&a.data&&(o.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(o.state[f]=a.data.jstree[f]);if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(o.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(o.li_attr[f]=a.li_attr[f]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=e),o.li_attr.id||(o.li_attr.id=o.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(o.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,h=a.children.length;h>f;f++)m=t(a.children[f],o.id,d),n=l[m],o.children.push(m),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return a&&a.children&&a.children===!0&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete a.data,delete a.children,o.original=a,l[o.id]=o,o.state.selected&&g.push(o.id),o.id};if(c.length&&c[0].id!==b&&c[0].parent!==b){for(p=0,q=c.length;q>p;p++)c[p].children||(c[p].children=[]),c[p].state||(c[p].state={}),l[c[p].id.toString()]=c[p];for(p=0,q=c.length;q>p;p++)l[c[p].parent.toString()]?(l[c[p].parent.toString()].children.push(c[p].id.toString()),m.children_d.push(c[p].id.toString())):"undefined"!=typeof h&&(h._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:c[p].id.toString(),parent:c[p].parent.toString()})},h.settings.core.error.call(h,h._data.core.last_error));for(p=0,q=m.children.length;q>p;p++)o=s(l[m.children[p]],d,m.parents.concat()),f.push(o),l[o].children_d.length&&(f=f.concat(l[o].children_d));for(p=0,q=m.parents.length;q>p;p++)l[m.parents[p]].children_d=l[m.parents[p]].children_d.concat(f);r={cnt:k,mod:l,sel:n,par:d,dpc:f,add:g}}else{for(p=0,q=c.length;q>p;p++)o=t(c[p],d,m.parents.concat()),o&&(e.push(o),f.push(o),l[o].children_d.length&&(f=f.concat(l[o].children_d)));for(m.children=e,m.children_d=f,p=0,q=m.parents.length;q>p;p++)l[m.parents[p]].children_d=l[m.parents[p]].children_d.concat(f);r={cnt:k,mod:l,sel:n,par:d,dpc:f,add:g}}return"undefined"!=typeof window&&"undefined"!=typeof window.document?r:void postMessage(r)},k=function(b,c){if(null!==this.element){this._cnt=b.cnt;var e,f=this._model.data;for(e in f)f.hasOwnProperty(e)&&f[e].state&&f[e].state.loading&&b.mod[e]&&(b.mod[e].state.loading=!0);if(this._model.data=b.mod,c){var g,i=b.add,k=b.sel,l=this._data.core.selected.slice();if(f=this._model.data,k.length!==l.length||a.vakata.array_unique(k.concat(l)).length!==k.length){for(e=0,g=k.length;g>e;e++)-1===a.inArray(k[e],i)&&-1===a.inArray(k[e],l)&&(f[k[e]].state.selected=!1);for(e=0,g=l.length;g>e;e++)-1===a.inArray(l[e],k)&&(f[l[e]].state.selected=!0)}}b.add.length&&(this._data.core.selected=this._data.core.selected.concat(b.add)),this.trigger("model",{nodes:b.dpc,parent:b.par}),b.par!==a.jstree.root?(this._node_changed(b.par),this.redraw()):this.redraw(!0),b.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!c&&j?j(function(){d.call(h,!0)}):d.call(h,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+i.toString()],{type:"text/javascript"}))),!this._data.core.working||e?(this._data.core.working=!0,f=new window.Worker(this._wrk),f.onmessage=a.proxy(function(a){k.call(this,a.data,!0);try{f.terminate(),f=null}catch(b){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),g.par?f.postMessage(g):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([b,c,d,!0])}catch(l){k.call(this,i(g),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else k.call(this,i(g),!1)}},_parse_model_from_html:function(c,d,e){e=e?[].concat(e):[],d&&e.unshift(d);var f,g,h=this._model.data,i={id:!1,text:!1,icon:!0,parent:d,parents:e,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},j,k,l;for(j in this._model.default_state)this._model.default_state.hasOwnProperty(j)&&(i.state[j]=this._model.default_state[j]);if(k=a.vakata.attributes(c,!0),a.each(k,function(b,c){return c=a.trim(c),c.length?(i.li_attr[b]=c,void("id"===b&&(i.id=c.toString()))):!0}),k=c.children("a").first(),k.length&&(k=a.vakata.attributes(k,!0),a.each(k,function(b,c){c=a.trim(c),c.length&&(i.a_attr[b]=c)})),k=c.children("a").first().length?c.children("a").first().clone():c.clone(),k.children("ins, i, ul").remove(),k=k.html(),k=a("<div></div>").html(k),i.text=this.settings.core.force_text?k.text():k.html(),k=c.data(),i.data=k?a.extend(!0,{},k):null,i.state.opened=c.hasClass("jstree-open"),i.state.selected=c.children("a").hasClass("jstree-clicked"),i.state.disabled=c.children("a").hasClass("jstree-disabled"),i.data&&i.data.jstree)for(j in i.data.jstree)i.data.jstree.hasOwnProperty(j)&&(i.state[j]=i.data.jstree[j]);k=c.children("a").children(".jstree-themeicon"),k.length&&(i.icon=k.hasClass("jstree-themeicon-hidden")?!1:k.attr("rel")),i.state.icon!==b&&(i.icon=i.state.icon),(i.icon===b||null===i.icon||""===i.icon)&&(i.icon=!0),k=c.children("ul").children("li");do l="j"+this._id+"_"+ ++this._cnt;while(h[l]);return i.id=i.li_attr.id?i.li_attr.id.toString():l,k.length?(k.each(a.proxy(function(b,c){f=this._parse_model_from_html(a(c),i.id,e),g=this._model.data[f],i.children.push(f),g.children_d.length&&(i.children_d=i.children_d.concat(g.children_d))},this)),i.children_d=i.children_d.concat(i.children)):c.hasClass("jstree-closed")&&(i.state.loaded=!1),i.li_attr["class"]&&(i.li_attr["class"]=i.li_attr["class"].replace("jstree-closed","").replace("jstree-open","")),i.a_attr["class"]&&(i.a_attr["class"]=i.a_attr["class"].replace("jstree-clicked","").replace("jstree-disabled","")),h[i.id]=i,i.state.selected&&this._data.core.selected.push(i.id),i.id},_parse_model_from_flat_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=a.id.toString(),f=this._model.data,g=this._model.default_state,h,i,j,k,l={id:e,text:a.text||"",icon:a.icon!==b?a.icon:!0,parent:c,parents:d,children:a.children||[],children_d:a.children_d||[],data:a.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(h in g)g.hasOwnProperty(h)&&(l.state[h]=g[h]);if(a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(h in a.data.jstree)a.data.jstree.hasOwnProperty(h)&&(l.state[h]=a.data.jstree[h]);if(a&&"object"==typeof a.state)for(h in a.state)a.state.hasOwnProperty(h)&&(l.state[h]=a.state[h]);if(a&&"object"==typeof a.li_attr)for(h in a.li_attr)a.li_attr.hasOwnProperty(h)&&(l.li_attr[h]=a.li_attr[h]);if(l.li_attr.id||(l.li_attr.id=e),a&&"object"==typeof a.a_attr)for(h in a.a_attr)a.a_attr.hasOwnProperty(h)&&(l.a_attr[h]=a.a_attr[h]);for(a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),f[l.id]=l,h=0,i=l.children.length;i>h;h++)j=this._parse_model_from_flat_json(f[l.children[h]],l.id,d),k=f[j],l.children_d.push(j),k.children_d.length&&(l.children_d=l.children_d.concat(k.children_d));return delete a.data,delete a.children,f[l.id].original=a,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(a,c,d){d=d?d.concat():[],c&&d.unshift(c);var e=!1,f,g,h,i,j=this._model.data,k=this._model.default_state,l;do e="j"+this._id+"_"+ ++this._cnt;while(j[e]);l={id:!1,text:"string"==typeof a?a:"",icon:"object"==typeof a&&a.icon!==b?a.icon:!0,parent:c,parents:d,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(f in k)k.hasOwnProperty(f)&&(l.state[f]=k[f]);if(a&&a.id&&(l.id=a.id.toString()),a&&a.text&&(l.text=a.text),a&&a.data&&a.data.jstree&&a.data.jstree.icon&&(l.icon=a.data.jstree.icon),(l.icon===b||null===l.icon||""===l.icon)&&(l.icon=!0),a&&a.data&&(l.data=a.data,a.data.jstree))for(f in a.data.jstree)a.data.jstree.hasOwnProperty(f)&&(l.state[f]=a.data.jstree[f]);
3
- if(a&&"object"==typeof a.state)for(f in a.state)a.state.hasOwnProperty(f)&&(l.state[f]=a.state[f]);if(a&&"object"==typeof a.li_attr)for(f in a.li_attr)a.li_attr.hasOwnProperty(f)&&(l.li_attr[f]=a.li_attr[f]);if(l.li_attr.id&&!l.id&&(l.id=l.li_attr.id.toString()),l.id||(l.id=e),l.li_attr.id||(l.li_attr.id=l.id),a&&"object"==typeof a.a_attr)for(f in a.a_attr)a.a_attr.hasOwnProperty(f)&&(l.a_attr[f]=a.a_attr[f]);if(a&&a.children&&a.children.length){for(f=0,g=a.children.length;g>f;f++)h=this._parse_model_from_json(a.children[f],l.id,d),i=j[h],l.children.push(h),i.children_d.length&&(l.children_d=l.children_d.concat(i.children_d));l.children_d=l.children.concat(l.children_d)}return a&&a.children&&a.children===!0&&(l.state.loaded=!1,l.children=[],l.children_d=[]),delete a.data,delete a.children,l.original=a,j[l.id]=l,l.state.selected&&this._data.core.selected.push(l.id),l.id},_redraw:function(){var b=this._model.force_full_redraw?this._model.data[a.jstree.root].children.concat([]):this._model.changed.concat([]),c=i.createElement("UL"),d,e,f,g=this._data.core.focused;for(e=0,f=b.length;f>e;e++)d=this.redraw_node(b[e],!0,this._model.force_full_redraw),d&&this._model.force_full_redraw&&c.appendChild(d);this._model.force_full_redraw&&(c.className=this.get_container_ul()[0].className,c.setAttribute("role","group"),this.element.empty().append(c)),null!==g&&this.settings.core.restore_focus&&(d=this.get_node(g,!0),d&&d.length&&d.children(".jstree-anchor")[0]!==i.activeElement?d.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:b})},redraw:function(a){a&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(b){var c=this.get_node(b),d=!1,e=!1,f=!1,g=i;if(!c)return!1;if(c.id===a.jstree.root)return this.redraw(!0);if(b=this.get_node(b,!0),!b||!b.length)return!1;if(b.children(".jstree-children").remove(),b=b[0],c.children.length&&c.state.loaded){for(f=g.createElement("UL"),f.setAttribute("role","group"),f.className="jstree-children",d=0,e=c.children.length;e>d;d++)f.appendChild(this.redraw_node(c.children[d],!0,!0));b.appendChild(f)}},redraw_node:function(b,c,d,e){var f=this.get_node(b),g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n="",o=i,p=this._model.data,q=!1,r=!1,s=null,t=0,u=0,v=!1,w=!1;if(!f)return!1;if(f.id===a.jstree.root)return this.redraw(!0);if(c=c||0===f.children.length,b=i.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(f.id[0])?"\\3"+f.id[0]+" "+f.id.substr(1).replace(a.jstree.idregex,"\\$&"):f.id.replace(a.jstree.idregex,"\\$&"))):i.getElementById(f.id))b=a(b),d||(g=b.parent().parent()[0],g===this.element[0]&&(g=null),h=b.index()),c||!f.children.length||b.children(".jstree-children").length||(c=!0),c||(j=b.children(".jstree-children")[0]),q=b.children(".jstree-anchor")[0]===i.activeElement,b.remove();else if(c=!0,!d){if(g=f.parent!==a.jstree.root?a("#"+f.parent.replace(a.jstree.idregex,"\\$&"),this.element)[0]:null,!(null===g||g&&p[f.parent].state.opened))return!1;h=a.inArray(f.id,null===g?p[a.jstree.root].children:p[f.parent].children)}b=this._data.core.node.cloneNode(!0),n="jstree-node ";for(k in f.li_attr)if(f.li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"!==k?b.setAttribute(k,f.li_attr[k]):n+=f.li_attr[k]}for(f.a_attr.id||(f.a_attr.id=f.id+"_anchor"),b.setAttribute("aria-selected",!!f.state.selected),b.childNodes[1].setAttribute("aria-selected",!!f.state.selected),b.setAttribute("aria-level",f.parents.length),b.childNodes[1].setAttribute("aria-level",f.parents.length),b.setAttribute("aria-labelledby",f.a_attr.id),f.state.disabled&&(b.setAttribute("aria-disabled",!0),b.childNodes[1].setAttribute("aria-disabled",!0)),k=0,l=f.children.length;l>k;k++)if(!p[f.children[k]].state.hidden){v=!0;break}if(null!==f.parent&&p[f.parent]&&!f.state.hidden&&(k=a.inArray(f.id,p[f.parent].children),w=f.id,-1!==k))for(k++,l=p[f.parent].children.length;l>k;k++)if(p[p[f.parent].children[k]].state.hidden||(w=p[f.parent].children[k]),w!==f.id)break;f.state.hidden&&(n+=" jstree-hidden"),f.state.loading&&(n+=" jstree-loading"),f.state.loaded&&!v?n+=" jstree-leaf":(n+=f.state.opened&&f.state.loaded?" jstree-open":" jstree-closed",b.setAttribute("aria-expanded",f.state.opened&&f.state.loaded),b.childNodes[1].setAttribute("aria-expanded",f.state.opened&&f.state.loaded)),w===f.id&&(n+=" jstree-last"),b.id=f.id,b.className=n,n=(f.state.selected?" jstree-clicked":"")+(f.state.disabled?" jstree-disabled":"");for(l in f.a_attr)if(f.a_attr.hasOwnProperty(l)){if("href"===l&&"#"===f.a_attr[l])continue;"class"!==l?b.childNodes[1].setAttribute(l,f.a_attr[l]):n+=" "+f.a_attr[l]}if(n.length&&(b.childNodes[1].className="jstree-anchor "+n),(f.icon&&f.icon!==!0||f.icon===!1)&&(f.icon===!1?b.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===f.icon.indexOf("/")&&-1===f.icon.indexOf(".")?b.childNodes[1].childNodes[0].className+=" "+f.icon+" jstree-themeicon-custom":(b.childNodes[1].childNodes[0].style.backgroundImage='url("'+f.icon+'")',b.childNodes[1].childNodes[0].style.backgroundPosition="center center",b.childNodes[1].childNodes[0].style.backgroundSize="auto",b.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?b.childNodes[1].appendChild(o.createTextNode(f.text)):b.childNodes[1].innerHTML+=f.text,c&&f.children.length&&(f.state.opened||e)&&f.state.loaded){for(m=o.createElement("UL"),m.setAttribute("role","group"),m.className="jstree-children",k=0,l=f.children.length;l>k;k++)m.appendChild(this.redraw_node(f.children[k],c,!0));b.appendChild(m)}if(j&&b.appendChild(j),!d){for(g||(g=this.element[0]),k=0,l=g.childNodes.length;l>k;k++)if(g.childNodes[k]&&g.childNodes[k].className&&-1!==g.childNodes[k].className.indexOf("jstree-children")){s=g.childNodes[k];break}s||(s=o.createElement("UL"),s.setAttribute("role","group"),s.className="jstree-children",g.appendChild(s)),g=s,h<g.childNodes.length?g.insertBefore(b,g.childNodes[h]):g.appendChild(b),q&&(t=this.element[0].scrollTop,u=this.element[0].scrollLeft,b.childNodes[1].focus(),this.element[0].scrollTop=t,this.element[0].scrollLeft=u)}return f.state.opened&&!f.state.loaded&&(f.state.opened=!1,setTimeout(a.proxy(function(){this.open_node(f.id,!1,0)},this),0)),b},open_node:function(c,d,e){var f,g,h,i;if(a.isArray(c)){for(c=c.slice(),f=0,g=c.length;g>f;f++)this.open_node(c[f],d,e);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(e=e===b?this.settings.core.animation:e,this.is_closed(c)?this.is_loaded(c)?(h=this.get_node(c,!0),i=this,h.length&&(e&&h.children(".jstree-children").length&&h.children(".jstree-children").stop(!0,!0),c.children.length&&!this._firstChild(h.children(".jstree-children")[0])&&this.draw_children(c),e?(this.trigger("before_open",{node:c}),h.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-anchor").attr("aria-expanded",!0).end().children(".jstree-children").stop(!0,!0).slideDown(e,function(){this.style.display="",i.element&&i.trigger("after_open",{node:c})})):(this.trigger("before_open",{node:c}),h[0].className=h[0].className.replace("jstree-closed","jstree-open"),h[0].setAttribute("aria-expanded",!0),h[0].childNodes[1].setAttribute("aria-expanded",!0))),c.state.opened=!0,d&&d.call(this,c,!0),h.length||this.trigger("before_open",{node:c}),this.trigger("open_node",{node:c}),e&&h.length||this.trigger("after_open",{node:c}),!0):this.is_loading(c)?setTimeout(a.proxy(function(){this.open_node(c,d,e)},this),500):void this.load_node(c,function(a,b){return b?this.open_node(a,d,e):d?d.call(this,a,!1):!1}):(d&&d.call(this,c,!1),!1)):!1},_open_to:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c,d,e=b.parents;for(c=0,d=e.length;d>c;c+=1)c!==a.jstree.root&&this.open_node(e[c],!1,0);return a("#"+b.id.replace(a.jstree.idregex,"\\$&"),this.element)},close_node:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.close_node(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?this.is_closed(c)?!1:(d=d===b?this.settings.core.animation:d,g=this,h=this.get_node(c,!0),c.state.opened=!1,this.trigger("close_node",{node:c}),void(h.length?d?h.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-anchor").attr("aria-expanded",!1).end().children(".jstree-children").stop(!0,!0).slideUp(d,function(){this.style.display="",h.children(".jstree-children").remove(),g.element&&g.trigger("after_close",{node:c})}):(h[0].className=h[0].className.replace("jstree-open","jstree-closed"),h.children(".jstree-anchor").attr("aria-expanded",!1),h.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:c})):this.trigger("after_close",{node:c}))):!1},toggle_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.toggle_node(b[c]);return!0}return this.is_closed(b)?this.open_node(b):this.is_open(b)?this.close_node(b):void 0},open_all:function(b,c,d){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var e=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),f,g,h;if(!e.length){for(f=0,g=b.children_d.length;g>f;f++)this.is_closed(this._model.data[b.children_d[f]])&&(this._model.data[b.children_d[f]].state.opened=!0);return this.trigger("open_all",{node:b})}d=d||e,h=this,e=this.is_closed(b)?e.find(".jstree-closed").addBack():e.find(".jstree-closed"),e.each(function(){h.open_node(this,function(a,b){b&&this.is_parent(a)&&this.open_all(a,c,d)},c||0)}),0===d.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(d)})},close_all:function(b,c){if(b||(b=a.jstree.root),b=this.get_node(b),!b)return!1;var d=b.id===a.jstree.root?this.get_container_ul():this.get_node(b,!0),e=this,f,g;for(d.length&&(d=this.is_open(b)?d.find(".jstree-open").addBack():d.find(".jstree-open"),a(d.get().reverse()).each(function(){e.close_node(this,c||0)})),f=0,g=b.children_d.length;g>f;f++)this._model.data[b.children_d[f]].state.opened=!1;this.trigger("close_all",{node:b})},is_disabled:function(a){return a=this.get_node(a),a&&a.state&&a.state.disabled},enable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!1,this.get_node(b,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),void this.trigger("enable_node",{node:b})):!1},disable_node:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_node(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.state.disabled=!0,this.get_node(b,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),void this.trigger("disable_node",{node:b})):!1},is_hidden:function(a){return a=this.get_node(a),a.state.hidden===!0},hide_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.hide_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden||(b.state.hidden=!0,this._node_changed(b.parent),c||this.redraw(),this.trigger("hide_node",{node:b}))):!1},show_node:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.show_node(b[d],!0);return c||this.redraw(),!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?void(b.state.hidden&&(b.state.hidden=!1,this._node_changed(b.parent),c||this.redraw(),this.trigger("show_node",{node:b}))):!1},hide_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&!d[c].state.hidden&&(d[c].state.hidden=!0,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("hide_all",{nodes:e}),e},show_all:function(b){var c,d=this._model.data,e=[];for(c in d)d.hasOwnProperty(c)&&c!==a.jstree.root&&d[c].state.hidden&&(d[c].state.hidden=!1,e.push(c));return this._model.force_full_redraw=!0,b||this.redraw(),this.trigger("show_all",{nodes:e}),e},activate_node:function(a,c){if(this.is_disabled(a))return!1;if(c&&"object"==typeof c||(c={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==b?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&(!c.shiftKey||this._data.core.last_clicked&&this.get_parent(a)&&this.get_parent(a)===this._data.core.last_clicked.parent))if(c.shiftKey){var d=this.get_node(a).id,e=this._data.core.last_clicked.id,f=this.get_node(this._data.core.last_clicked.parent).children,g=!1,h,i;for(h=0,i=f.length;i>h;h+=1)f[h]===d&&(g=!g),f[h]===e&&(g=!g),this.is_disabled(f[h])||!g&&f[h]!==d&&f[h]!==e?this.deselect_node(f[h],!0,c):this.is_hidden(f[h])||this.select_node(f[h],!0,!1,c);this.trigger("changed",{action:"select_node",node:this.get_node(a),selected:this._data.core.selected,event:c})}else this.is_selected(a)?this.deselect_node(a,!1,c):this.select_node(a,!1,!1,c);else!this.settings.core.multiple&&(c.metaKey||c.ctrlKey||c.shiftKey)&&this.is_selected(a)?this.deselect_node(a,!1,c):(this.deselect_all(!0),this.select_node(a,!1,!1,c),this._data.core.last_clicked=this.get_node(a));this.trigger("activate_node",{node:this.get_node(a),event:c})},hover_node:function(a){if(a=this.get_node(a,!0),!a||!a.length||a.children(".jstree-hovered").length)return!1;var b=this.element.find(".jstree-hovered"),c=this.element;b&&b.length&&this.dehover_node(b),a.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(a)}),setTimeout(function(){c.attr("aria-activedescendant",a[0].id)},0)},dehover_node:function(a){return a=this.get_node(a,!0),a&&a.length&&a.children(".jstree-hovered").length?(a.children(".jstree-anchor").removeClass("jstree-hovered"),void this.trigger("dehover_node",{node:this.get_node(a)})):!1},select_node:function(b,c,d,e){var f,g,h,i;if(a.isArray(b)){for(b=b.slice(),g=0,h=b.length;h>g;g++)this.select_node(b[g],c,d,e);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.selected||(b.state.selected=!0,this._data.core.selected.push(b.id),d||(f=this._open_to(b)),f&&f.length&&f.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked").attr("aria-selected",!0),this.trigger("select_node",{node:b,selected:this._data.core.selected,event:e}),c||this.trigger("changed",{action:"select_node",node:b,selected:this._data.core.selected,event:e})))):!1},deselect_node:function(b,c,d){var e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.deselect_node(b[e],c,d);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(g=this.get_node(b,!0),void(b.state.selected&&(b.state.selected=!1,this._data.core.selected=a.vakata.array_remove_item(this._data.core.selected,b.id),g.length&&g.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_node",{node:b,selected:this._data.core.selected,event:d}),c||this.trigger("changed",{action:"deselect_node",node:b,selected:this._data.core.selected,event:d})))):!1},select_all:function(b){var c=this._data.core.selected.concat([]),d,e;for(this._data.core.selected=this._model.data[a.jstree.root].children_d.concat(),d=0,e=this._data.core.selected.length;e>d;d++)this._model.data[this._data.core.selected[d]]&&(this._model.data[this._data.core.selected[d]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),b||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:c})},deselect_all:function(a){var b=this._data.core.selected.concat([]),c,d;for(c=0,d=this._data.core.selected.length;d>c;c++)this._model.data[this._data.core.selected[c]]&&(this._model.data[this._data.core.selected[c]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").attr("aria-selected",!1).parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:b}),a||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:b})},is_selected:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.selected:!1},get_selected:function(b){return b?a.map(this._data.core.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.core.selected.slice()},get_top_selected:function(b){var c=this.get_selected(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},get_bottom_selected:function(b){var c=this.get_selected(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},get_state:function(){var b={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}},c;for(c in this._model.data)this._model.data.hasOwnProperty(c)&&c!==a.jstree.root&&(this._model.data[c].state.loaded&&this.settings.core.loaded_state&&b.core.loaded.push(c),this._model.data[c].state.opened&&b.core.open.push(c),this._model.data[c].state.selected&&b.core.selected.push(c));return b},set_state:function(c,d){if(c){if(c.core&&c.core.selected&&c.core.initial_selection===b&&(c.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),c.core){var e,f,g,h,i;if(c.core.loaded)return this.settings.core.loaded_state&&a.isArray(c.core.loaded)&&c.core.loaded.length?this._load_nodes(c.core.loaded,function(a){delete c.core.loaded,this.set_state(c,d)}):(delete c.core.loaded,this.set_state(c,d)),!1;if(c.core.open)return a.isArray(c.core.open)&&c.core.open.length?this._load_nodes(c.core.open,function(a){this.open_node(a,!1,0),delete c.core.open,this.set_state(c,d)}):(delete c.core.open,this.set_state(c,d)),!1;if(c.core.scroll)return c.core.scroll&&c.core.scroll.left!==b&&this.element.scrollLeft(c.core.scroll.left),c.core.scroll&&c.core.scroll.top!==b&&this.element.scrollTop(c.core.scroll.top),delete c.core.scroll,this.set_state(c,d),!1;if(c.core.selected)return h=this,(c.core.initial_selection===b||c.core.initial_selection===this._data.core.selected.concat([]).sort().join(","))&&(this.deselect_all(),a.each(c.core.selected,function(a,b){h.select_node(b,!1,!0)})),delete c.core.initial_selection,delete c.core.selected,this.set_state(c,d),!1;for(i in c)c.hasOwnProperty(i)&&"core"!==i&&-1===a.inArray(i,this.settings.plugins)&&delete c[i];if(a.isEmptyObject(c.core))return delete c.core,this.set_state(c,d),!1}return a.isEmptyObject(c)?(c=null,d&&d.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(b,c){this._data.core.state=c===!0?{}:this.get_state(),c&&a.isFunction(c)&&(this._data.core.state=c.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[a.jstree.root]={id:a.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var d=this.get_container_ul()[0].className;b||(this.element.html("<ul class='"+d+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='presentation' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(a.jstree.root,function(b,c){c&&(this.get_container_ul()[0].className=d,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(a.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(b){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var c=[],d=[],e=this._data.core.selected.concat([]);d.push(b.id),b.state.opened===!0&&c.push(b.id),this.get_node(b,!0).find(".jstree-open").each(function(){d.push(this.id),c.push(this.id)}),this._load_nodes(d,a.proxy(function(a){this.open_node(c,!1,0),this.select_node(e),this.trigger("refresh_node",{node:b,nodes:a})},this),!1,!0)},set_id:function(b,c){if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;var d,e,f=this._model.data,g=b.id;for(c=c.toString(),f[b.parent].children[a.inArray(b.id,f[b.parent].children)]=c,d=0,e=b.parents.length;e>d;d++)f[b.parents[d]].children_d[a.inArray(b.id,f[b.parents[d]].children_d)]=c;for(d=0,e=b.children.length;e>d;d++)f[b.children[d]].parent=c;for(d=0,e=b.children_d.length;e>d;d++)f[b.children_d[d]].parents[a.inArray(b.id,f[b.children_d[d]].parents)]=c;return d=a.inArray(b.id,this._data.core.selected),-1!==d&&(this._data.core.selected[d]=c),d=this.get_node(b.id,!0),d&&(d.attr("id",c),this.element.attr("aria-activedescendant")===b.id&&this.element.attr("aria-activedescendant",c)),delete f[b.id],b.id=c,b.li_attr.id=c,f[c]=b,this.trigger("set_id",{node:b,"new":b.id,old:g}),!0},get_text:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.text:!1},set_text:function(b,c){var d,e;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.set_text(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(b.text=c,this.get_node(b,!0).length&&this.redraw_node(b.id),this.trigger("set_text",{obj:b,text:c}),!0):!1},get_json:function(b,c,d){if(b=this.get_node(b||a.jstree.root),!b)return!1;c&&c.flat&&!d&&(d=[]);var e={id:b.id,text:b.text,icon:this.get_icon(b),li_attr:a.extend(!0,{},b.li_attr),a_attr:a.extend(!0,{},b.a_attr),state:{},data:c&&c.no_data?!1:a.extend(!0,a.isArray(b.data)?[]:{},b.data)},f,g;if(c&&c.flat?e.parent=b.parent:e.children=[],c&&c.no_state)delete e.state;else for(f in b.state)b.state.hasOwnProperty(f)&&(e.state[f]=b.state[f]);if(c&&c.no_li_attr&&delete e.li_attr,c&&c.no_a_attr&&delete e.a_attr,c&&c.no_id&&(delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id),c&&c.flat&&b.id!==a.jstree.root&&d.push(e),!c||!c.no_children)for(f=0,g=b.children.length;g>f;f++)c&&c.flat?this.get_json(b.children[f],c,d):e.children.push(this.get_json(b.children[f],c));return c&&c.flat?d:b.id===a.jstree.root?e.children:e},create_node:function(c,d,e,f,g){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return!1;if(e=e===b?"last":e,!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(c))return this.load_node(c,function(){this.create_node(c,d,e,f,!0)});d||(d={text:this.get_string("New node")}),d="string"==typeof d?{text:d}:a.extend(!0,{},d),d.text===b&&(d.text=this.get_string("New node"));var h,i,j,k;switch(c.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":h=this.get_node(c.parent),e=a.inArray(c.id,h.children),c=h;break;case"after":h=this.get_node(c.parent),e=a.inArray(c.id,h.children)+1,c=h;break;case"inside":case"first":e=0;break;case"last":e=c.children.length;break;default:e||(e=0)}if(e>c.children.length&&(e=c.children.length),d.id||(d.id=!0),!this.check("create_node",d,c,e))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(d.id===!0&&delete d.id,d=this._parse_model_from_json(d,c.id,c.parents.concat()),!d)return!1;for(h=this.get_node(d),i=[],i.push(d),i=i.concat(h.children_d),this.trigger("model",{nodes:i,parent:c.id}),c.children_d=c.children_d.concat(i),j=0,k=c.parents.length;k>j;j++)this._model.data[c.parents[j]].children_d=this._model.data[c.parents[j]].children_d.concat(i);for(d=h,h=[],j=0,k=c.children.length;k>j;j++)h[j>=e?j+1:j]=c.children[j];return h[e]=d.id,c.children=h,this.redraw_node(c,!0),this.trigger("create_node",{node:this.get_node(d),parent:c.id,position:e}),f&&f.call(this,this.get_node(d)),d.id},rename_node:function(b,c){var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.rename_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=b.text,this.check("rename_node",b,this.get_parent(b),c)?(this.set_text(b,c),this.trigger("rename_node",{node:b,text:c,old:f}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1)):!1},delete_node:function(b){var c,d,e,f,g,h,i,j,k,l,m,n;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.delete_node(b[c]);return!0}if(b=this.get_node(b),!b||b.id===a.jstree.root)return!1;if(e=this.get_node(b.parent),f=a.inArray(b.id,e.children),l=!1,!this.check("delete_node",b,e,f))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==f&&(e.children=a.vakata.array_remove(e.children,f)),g=b.children_d.concat([]),g.push(b.id),h=0,i=b.parents.length;i>h;h++)this._model.data[b.parents[h]].children_d=a.vakata.array_filter(this._model.data[b.parents[h]].children_d,function(b){return-1===a.inArray(b,g)});for(j=0,k=g.length;k>j;j++)if(this._model.data[g[j]].state.selected){l=!0;break}for(l&&(this._data.core.selected=a.vakata.array_filter(this._data.core.selected,function(b){return-1===a.inArray(b,g)})),this.trigger("delete_node",{node:b,parent:e.id}),l&&this.trigger("changed",{action:"delete_node",node:b,selected:this._data.core.selected,parent:e.id}),j=0,k=g.length;k>j;j++)delete this._model.data[g[j]];return-1!==a.inArray(this._data.core.focused,g)&&(this._data.core.focused=null,m=this.element[0].scrollTop,n=this.element[0].scrollLeft,e.id===a.jstree.root?this._model.data[a.jstree.root].children[0]&&this.get_node(this._model.data[a.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(e,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=m,this.element[0].scrollLeft=n),this.redraw_node(e,!0),!0},check:function(b,c,d,e,f){c=c&&c.id?c:this.get_node(c),d=d&&d.id?d:this.get_node(d);var g=b.match(/^move_node|copy_node|create_node$/i)?d:c,h=this.settings.core.check_callback;if("move_node"===b||"copy_node"===b){if(!(f&&f.is_multi||"move_node"!==b||a.inArray(c.id,d.children)!==e))return this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1;if(!(f&&f.is_multi||c.id!==d.id&&("move_node"!==b||a.inArray(c.id,d.children)!==e)&&-1===a.inArray(d.id,c.children_d)))return this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1}return g&&g.data&&(g=g.data),g&&g.functions&&(g.functions[b]===!1||g.functions[b]===!0)?(g.functions[b]===!1&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})}),g.functions[b]):h===!1||a.isFunction(h)&&h.call(this,b,c,d,e,f)===!1||h&&h[b]===!1?(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+b,data:JSON.stringify({chk:b,pos:e,obj:c&&c.id?c.id:!1,par:d&&d.id?d.id:!1})},!1):!0},last_error:function(){return this._data.core.last_error},move_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t,u,v,w;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.move_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(r=this.move_node(c[j],d,e,f,g,!1,i))&&(d=r,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;if(l=(c.parent||a.jstree.root).toString(),n=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,o=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),p=!o||!o._id||this._id!==o._id,m=o&&o._id&&l&&o._model.data[l]&&o._model.data[l].children?a.inArray(c.id,o._model.data[l].children):-1,o&&o._id&&(c=o._model.data[c.id]),p)return(r=this.copy_node(c,d,e,f,g,!1,i))?(o&&o.delete_node(c),r):!1;switch(d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,n.children);break;case"after":e=a.inArray(d.id,n.children)+1;break;case"inside":case"first":e=0;break;case"last":e=n.children.length;break;default:e||(e=0)}if(e>n.children.length&&(e=n.children.length),!this.check("move_node",c,n,e,{core:!0,origin:i,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(c.parent===n.id){for(q=n.children.concat(),r=a.inArray(c.id,q),-1!==r&&(q=a.vakata.array_remove(q,r),e>r&&e--),r=[],s=0,t=q.length;t>s;s++)r[s>=e?s+1:s]=q[s];r[e]=c.id,n.children=r,this._node_changed(n.id),this.redraw(n.id===a.jstree.root)}else{for(r=c.children_d.concat(),r.push(c.id),s=0,t=c.parents.length;t>s;s++){for(q=[],w=o._model.data[c.parents[s]].children_d,u=0,v=w.length;v>u;u++)-1===a.inArray(w[u],r)&&q.push(w[u]);o._model.data[c.parents[s]].children_d=q}for(o._model.data[l].children=a.vakata.array_remove_item(o._model.data[l].children,c.id),s=0,t=n.parents.length;t>s;s++)this._model.data[n.parents[s]].children_d=this._model.data[n.parents[s]].children_d.concat(r);for(q=[],s=0,t=n.children.length;t>s;s++)q[s>=e?s+1:s]=n.children[s];for(q[e]=c.id,n.children=q,n.children_d.push(c.id),n.children_d=n.children_d.concat(c.children_d),c.parent=n.id,r=n.parents.concat(),r.unshift(n.id),w=c.parents.length,c.parents=r,r=r.concat(),s=0,t=c.children_d.length;t>s;s++)this._model.data[c.children_d[s]].parents=this._model.data[c.children_d[s]].parents.slice(0,-1*w),Array.prototype.push.apply(this._model.data[c.children_d[s]].parents,r);(l===a.jstree.root||n.id===a.jstree.root)&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(l),this._node_changed(n.id)),h||this.redraw()}return f&&f.call(this,c,n,e),this.trigger("move_node",{node:c,parent:n.id,position:e,old_parent:l,old_position:m,is_multi:o&&o._id&&o._id!==this._id,is_foreign:!o||!o._id,old_instance:o,new_instance:this}),c.id},copy_node:function(c,d,e,f,g,h,i){var j,k,l,m,n,o,p,q,r,s,t;if(d=this.get_node(d),e=e===b?0:e,!d)return!1;if(!e.toString().match(/^(before|after)$/)&&!g&&!this.is_loaded(d))return this.load_node(d,function(){this.copy_node(c,d,e,f,!0,!1,i)});if(a.isArray(c)){if(1!==c.length){for(j=0,k=c.length;k>j;j++)(m=this.copy_node(c[j],d,e,f,g,!0,i))&&(d=m,e="after");return this.redraw(),!0}c=c[0]}if(c=c&&c.id?c:this.get_node(c),!c||c.id===a.jstree.root)return!1;switch(q=(c.parent||a.jstree.root).toString(),r=e.toString().match(/^(before|after)$/)&&d.id!==a.jstree.root?this.get_node(d.parent):d,s=i?i:this._model.data[c.id]?this:a.jstree.reference(c.id),t=!s||!s._id||this._id!==s._id,s&&s._id&&(c=s._model.data[c.id]),d.id===a.jstree.root&&("before"===e&&(e="first"),"after"===e&&(e="last")),e){case"before":e=a.inArray(d.id,r.children);break;case"after":e=a.inArray(d.id,r.children)+1;break;case"inside":case"first":e=0;break;case"last":e=r.children.length;break;default:e||(e=0)}if(e>r.children.length&&(e=r.children.length),!this.check("copy_node",c,r,e,{core:!0,origin:i,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(p=s?s.get_json(c,{no_id:!0,no_data:!0,no_state:!0}):c,!p)return!1;if(p.id===!0&&delete p.id,p=this._parse_model_from_json(p,r.id,r.parents.concat()),
4
- !p)return!1;for(m=this.get_node(p),c&&c.state&&c.state.loaded===!1&&(m.state.loaded=!1),l=[],l.push(p),l=l.concat(m.children_d),this.trigger("model",{nodes:l,parent:r.id}),n=0,o=r.parents.length;o>n;n++)this._model.data[r.parents[n]].children_d=this._model.data[r.parents[n]].children_d.concat(l);for(l=[],n=0,o=r.children.length;o>n;n++)l[n>=e?n+1:n]=r.children[n];return l[e]=m.id,r.children=l,r.children_d.push(m.id),r.children_d=r.children_d.concat(m.children_d),r.id===a.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(r.id),h||this.redraw(r.id===a.jstree.root),f&&f.call(this,m,r,e),this.trigger("copy_node",{node:m,original:c,parent:r.id,position:e,old_parent:q,old_position:s&&s._id&&q&&s._model.data[q]&&s._model.data[q].children?a.inArray(c.id,s._model.data[q].children):-1,is_multi:s&&s._id&&s._id!==this._id,is_foreign:!s||!s._id,old_instance:s,new_instance:this}),m.id},cut:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="move_node",void this.trigger("cut",{node:b})):!1},copy:function(b){if(b||(b=this._data.core.selected.concat()),a.isArray(b)||(b=[b]),!b.length)return!1;var c=[],g,h,i;for(h=0,i=b.length;i>h;h++)g=this.get_node(b[h]),g&&g.id&&g.id!==a.jstree.root&&c.push(g);return c.length?(d=c,f=this,e="copy_node",void this.trigger("copy",{node:b})):!1},get_buffer:function(){return{mode:e,node:d,inst:f}},can_paste:function(){return e!==!1&&d!==!1},paste:function(a,b){return a=this.get_node(a),a&&e&&e.match(/^(copy_node|move_node)$/)&&d?(this[e](d,a,b,!1,!1,!1,f)&&this.trigger("paste",{parent:a.id,node:d,mode:e}),d=!1,e=!1,void(f=!1)):!1},clear_buffer:function(){d=!1,e=!1,f=!1,this.trigger("clear_buffer")},edit:function(b,c,d){var e,f,g,h,j,k,l,m,n,o=!1;return(b=this.get_node(b))?this.check("edit",b,this.get_parent(b))?(n=b,c="string"==typeof c?c:b.text,this.set_text(b,""),b=this._open_to(b),n.text=c,e=this._data.core.rtl,f=this.element.width(),this._data.core.focused=n.id,g=b.children(".jstree-anchor").focus(),h=a("<span></span>"),j=c,k=a("<div></div>",{css:{position:"absolute",top:"-200px",left:e?"0px":"-1000px",visibility:"hidden"}}).appendTo(i.body),l=a("<input />",{value:j,"class":"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:a.proxy(function(c){c.stopImmediatePropagation(),c.preventDefault();var e=h.children(".jstree-rename-input"),f=e.val(),i=this.settings.core.force_text,m;""===f&&(f=j),k.remove(),h.replaceWith(g),h.remove(),j=i?j:a("<div></div>").append(a.parseHTML(j)).html(),b=this.get_node(b),this.set_text(b,j),m=!!this.rename_node(b,i?a("<div></div>").text(f).text():a("<div></div>").append(a.parseHTML(f)).html()),m||this.set_text(b,j),this._data.core.focused=n.id,setTimeout(a.proxy(function(){var a=this.get_node(n.id,!0);a.length&&(this._data.core.focused=n.id,a.children(".jstree-anchor").focus())},this),0),d&&d.call(this,n,m,o),l=null},this),keydown:function(a){var b=a.which;27===b&&(o=!0,this.value=j),(27===b||13===b||37===b||38===b||39===b||40===b||32===b)&&a.stopImmediatePropagation(),(27===b||13===b)&&(a.preventDefault(),this.blur())},click:function(a){a.stopImmediatePropagation()},mousedown:function(a){a.stopImmediatePropagation()},keyup:function(a){l.width(Math.min(k.text("pW"+this.value).width(),f))},keypress:function(a){return 13===a.which?!1:void 0}}),m={fontFamily:g.css("fontFamily")||"",fontSize:g.css("fontSize")||"",fontWeight:g.css("fontWeight")||"",fontStyle:g.css("fontStyle")||"",fontStretch:g.css("fontStretch")||"",fontVariant:g.css("fontVariant")||"",letterSpacing:g.css("letterSpacing")||"",wordSpacing:g.css("wordSpacing")||""},h.attr("class",g.attr("class")).append(g.contents().clone()).append(l),g.replaceWith(h),k.css(m),l.css(m).width(Math.min(k.text("pW"+l[0].value).width(),f))[0].select(),void a(i).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(b){l&&b.target!==l&&a(l).blur()})):(this.settings.core.error.call(this,this._data.core.last_error),!1):!1},set_theme:function(b,c){if(!b)return!1;if(c===!0){var d=this.settings.core.themes.dir;d||(d=a.jstree.path+"/themes"),c=d+"/"+b+"/style.css"}c&&-1===a.inArray(c,g)&&(a("head").append('<link rel="stylesheet" href="'+c+'" type="text/css" />'),g.push(c)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=b,this.element.addClass("jstree-"+b),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+b+"-responsive"),this.trigger("set_theme",{theme:b})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(a){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),this._data.core.themes.variant=a,a&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(c,d){var e,f,g,h;if(a.isArray(c)){for(c=c.slice(),e=0,f=c.length;f>e;e++)this.set_icon(c[e],d);return!0}return c=this.get_node(c),c&&c.id!==a.jstree.root?(h=c.icon,c.icon=d===!0||null===d||d===b||""===d?!0:d,g=this.get_node(c,!0).children(".jstree-anchor").children(".jstree-themeicon"),d===!1?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),this.hide_icon(c)):d===!0||null===d||d===b||""===d?(g.removeClass("jstree-themeicon-custom "+h).css("background","").removeAttr("rel"),h===!1&&this.show_icon(c)):-1===d.indexOf("/")&&-1===d.indexOf(".")?(g.removeClass(h).css("background",""),g.addClass(d+" jstree-themeicon-custom").attr("rel",d),h===!1&&this.show_icon(c)):(g.removeClass(h).css("background",""),g.addClass("jstree-themeicon-custom").css("background","url('"+d+"') center center no-repeat").attr("rel",d),h===!1&&this.show_icon(c)),!0):!1},get_icon:function(b){return b=this.get_node(b),b&&b.id!==a.jstree.root?b.icon:!1},hide_icon:function(b){var c,d;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.hide_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(b.icon=!1,this.get_node(b,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0):!1},show_icon:function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.show_icon(b[c]);return!0}return b=this.get_node(b),b&&b!==a.jstree.root?(e=this.get_node(b,!0),b.icon=e.length?e.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"):!0,b.icon||(b.icon=!0),e.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0):!1}},a.vakata={},a.vakata.attributes=function(b,c){b=a(b)[0];var d=c?{}:[];return b&&b.attributes&&a.each(b.attributes,function(b,e){-1===a.inArray(e.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==e.value&&""!==a.trim(e.value)&&(c?d[e.name]=e.value:d.push(e.name))}),d},a.vakata.array_unique=function(a){var c=[],d,e,f,g={};for(d=0,f=a.length;f>d;d++)g[a[d]]===b&&(c.push(a[d]),g[a[d]]=!0);return c},a.vakata.array_remove=function(a,b){return a.splice(b,1),a},a.vakata.array_remove_item=function(b,c){var d=a.inArray(c,b);return-1!==d?a.vakata.array_remove(b,d):b},a.vakata.array_filter=function(a,b,c,d,e){if(a.filter)return a.filter(b,c);d=[];for(e in a)~~e+""==e+""&&e>=0&&b.call(c,a[e],+e,a)&&d.push(a[e]);return d},a.jstree.plugins.changed=function(a,b){var c=[];this.trigger=function(a,d){var e,f;if(d||(d={}),"changed"===a.replace(".jstree","")){d.changed={selected:[],deselected:[]};var g={};for(e=0,f=c.length;f>e;e++)g[c[e]]=1;for(e=0,f=d.selected.length;f>e;e++)g[d.selected[e]]?g[d.selected[e]]=2:d.changed.selected.push(d.selected[e]);for(e=0,f=c.length;f>e;e++)1===g[c[e]]&&d.changed.deselected.push(c[e]);c=d.selected.slice()}b.trigger.call(this,a,d)},this.refresh=function(a,d){return c=[],b.refresh.apply(this,arguments)}};var l=i.createElement("I");l.className="jstree-icon jstree-checkbox",l.setAttribute("role","presentation"),a.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},a.jstree.plugins.checkbox=function(c,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",a.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",a.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",a.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",a.proxy(function(a,b){var c=this._model.data,d=c[b.parent],e=b.nodes,f,g;for(f=0,g=e.length;g>f;f++)c[e[f]].state.checked=c[e[f]].state.checked||c[e[f]].original&&c[e[f]].original.state&&c[e[f]].original.state.checked,c[e[f]].state.checked&&this._data.checkbox.selected.push(e[f])},this)),(-1!==this.settings.checkbox.cascade.indexOf("up")||-1!==this.settings.checkbox.cascade.indexOf("down"))&&this.element.on("model.jstree",a.proxy(function(b,c){var d=this._model.data,e=d[c.parent],f=c.nodes,g=[],h,i,j,k,l,m,n=this.settings.checkbox.cascade,o=this.settings.checkbox.tie_selection;if(-1!==n.indexOf("down"))if(e.state[o?"selected":"checked"]){for(i=0,j=f.length;j>i;i++)d[f[i]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(f)}else for(i=0,j=f.length;j>i;i++)if(d[f[i]].state[o?"selected":"checked"]){for(k=0,l=d[f[i]].children_d.length;l>k;k++)d[d[f[i]].children_d[k]].state[o?"selected":"checked"]=!0;this._data[o?"core":"checkbox"].selected=this._data[o?"core":"checkbox"].selected.concat(d[f[i]].children_d)}if(-1!==n.indexOf("up")){for(i=0,j=e.children_d.length;j>i;i++)d[e.children_d[i]].children.length||g.push(d[e.children_d[i]].parent);for(g=a.vakata.array_unique(g),k=0,l=g.length;l>k;k++){e=d[g[k]];while(e&&e.id!==a.jstree.root){for(h=0,i=0,j=e.children.length;j>i;i++)h+=d[e.children[i]].state[o?"selected":"checked"];if(h!==j)break;e.state[o?"selected":"checked"]=!0,this._data[o?"core":"checkbox"].selected.push(e.id),m=this.get_node(e,!0),m&&m.length&&m.attr("aria-selected",!0).children(".jstree-anchor").addClass(o?"jstree-clicked":"jstree-checked"),e=this.get_node(e.parent)}}}this._data[o?"core":"checkbox"].selected=a.vakata.array_unique(this._data[o?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",a.proxy(function(b,c){var d=this,e=c.node,f=this._model.data,g=this.get_node(e.parent),h,i,j,k,l=this.settings.checkbox.cascade,m=this.settings.checkbox.tie_selection,n={},o=this._data[m?"core":"checkbox"].selected;for(h=0,i=o.length;i>h;h++)n[o[h]]=!0;if(-1!==l.indexOf("down")){var p=this._cascade_new_checked_state(e.id,!0),q=e.children_d.concat(e.id);for(h=0,i=q.length;i>h;h++)p.indexOf(q[h])>-1?n[q[h]]=!0:delete n[q[h]]}if(-1!==l.indexOf("up"))while(g&&g.id!==a.jstree.root){for(j=0,h=0,i=g.children.length;i>h;h++)j+=f[g.children[h]].state[m?"selected":"checked"];if(j!==i)break;g.state[m?"selected":"checked"]=!0,n[g.id]=!0,k=this.get_node(g,!0),k&&k.length&&k.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),g=this.get_node(g.parent)}o=[];for(h in n)n.hasOwnProperty(h)&&o.push(h);this._data[m?"core":"checkbox"].selected=o},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",a.proxy(function(b,c){var d=this.get_node(a.jstree.root),e=this._model.data,f,g,h;for(f=0,g=d.children_d.length;g>f;f++)h=e[d.children_d[f]],h&&h.original&&h.original.state&&h.original.state.undetermined&&(h.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",a.proxy(function(b,c){var d=this,e=c.node,f=this.get_node(e,!0),g,h,i,j=this.settings.checkbox.cascade,k=this.settings.checkbox.tie_selection,l=this._data[k?"core":"checkbox"].selected,m={},n=[],o=e.children_d.concat(e.id);if(-1!==j.indexOf("down")){var p=this._cascade_new_checked_state(e.id,!1);l=a.vakata.array_filter(l,function(a){return-1===o.indexOf(a)||p.indexOf(a)>-1})}if(-1!==j.indexOf("up")&&-1===l.indexOf(e.id)){for(g=0,h=e.parents.length;h>g;g++)i=this._model.data[e.parents[g]],i.state[k?"selected":"checked"]=!1,i&&i.original&&i.original.state&&i.original.state.undetermined&&(i.original.state.undetermined=!1),i=this.get_node(e.parents[g],!0),i&&i.length&&i.attr("aria-selected",!1).children(".jstree-anchor").removeClass(k?"jstree-clicked":"jstree-checked");l=a.vakata.array_filter(l,function(a){return-1===e.parents.indexOf(a)})}this._data[k?"core":"checkbox"].selected=l},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",a.proxy(function(b,c){var d=this.get_node(c.parent),e=this._model.data,f,g,h,i,j=this.settings.checkbox.tie_selection;while(d&&d.id!==a.jstree.root&&!d.state[j?"selected":"checked"]){for(h=0,f=0,g=d.children.length;g>f;f++)h+=e[d.children[f]].state[j?"selected":"checked"];if(!(g>0&&h===g))break;d.state[j?"selected":"checked"]=!0,this._data[j?"core":"checkbox"].selected.push(d.id),i=this.get_node(d,!0),i&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(j?"jstree-clicked":"jstree-checked"),d=this.get_node(d.parent)}},this)).on("move_node.jstree",a.proxy(function(b,c){var d=c.is_multi,e=c.old_parent,f=this.get_node(c.parent),g=this._model.data,h,i,j,k,l,m=this.settings.checkbox.tie_selection;if(!d){h=this.get_node(e);while(h&&h.id!==a.jstree.root&&!h.state[m?"selected":"checked"]){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(!(k>0&&i===k))break;h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"),h=this.get_node(h.parent)}}h=f;while(h&&h.id!==a.jstree.root){for(i=0,j=0,k=h.children.length;k>j;j++)i+=g[h.children[j]].state[m?"selected":"checked"];if(i===k)h.state[m?"selected":"checked"]||(h.state[m?"selected":"checked"]=!0,this._data[m?"core":"checkbox"].selected.push(h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!0).children(".jstree-anchor").addClass(m?"jstree-clicked":"jstree-checked"));else{if(!h.state[m?"selected":"checked"])break;h.state[m?"selected":"checked"]=!1,this._data[m?"core":"checkbox"].selected=a.vakata.array_remove_item(this._data[m?"core":"checkbox"].selected,h.id),l=this.get_node(h,!0),l&&l.length&&l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(m?"jstree-clicked":"jstree-checked")}h=this.get_node(h.parent)}},this))},this.get_undetermined=function(c){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];var d,e,f,g,h={},i=this._model.data,j=this.settings.checkbox.tie_selection,k=this._data[j?"core":"checkbox"].selected,l=[],m=this,n=[];for(d=0,e=k.length;e>d;d++)if(i[k[d]]&&i[k[d]].parents)for(f=0,g=i[k[d]].parents.length;g>f;f++){if(h[i[k[d]].parents[f]]!==b)break;i[k[d]].parents[f]!==a.jstree.root&&(h[i[k[d]].parents[f]]=!0,l.push(i[k[d]].parents[f]))}for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var c=m.get_node(this),j;if(c)if(c.state.loaded){for(d=0,e=c.children_d.length;e>d;d++)if(j=i[c.children_d[d]],!j.state.loaded&&j.original&&j.original.state&&j.original.state.undetermined&&j.original.state.undetermined===!0)for(h[j.id]===b&&j.id!==a.jstree.root&&(h[j.id]=!0,l.push(j.id)),f=0,g=j.parents.length;g>f;f++)h[j.parents[f]]===b&&j.parents[f]!==a.jstree.root&&(h[j.parents[f]]=!0,l.push(j.parents[f]))}else if(c.original&&c.original.state&&c.original.state.undetermined&&c.original.state.undetermined===!0)for(h[c.id]===b&&c.id!==a.jstree.root&&(h[c.id]=!0,l.push(c.id)),f=0,g=c.parents.length;g>f;f++)h[c.parents[f]]===b&&c.parents[f]!==a.jstree.root&&(h[c.parents[f]]=!0,l.push(c.parents[f]))}),d=0,e=l.length;e>d;d++)i[l[d]].state[j?"selected":"checked"]||n.push(c?i[l[d]]:l[d]);return n},this._undetermined=function(){if(null!==this.element){var a=this.get_undetermined(!1),b,c,d;for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),b=0,c=a.length;c>b;b++)d=this.get_node(a[b],!0),d&&d.length&&d.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments)){var g,h,i=null,j=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(!this.settings.checkbox.tie_selection&&this._model.data[b.id].state.checked&&(i.className+=" jstree-checked"),j=l.cloneNode(!1),this._model.data[b.id].state.checkbox_disabled&&(j.className+=" jstree-checkbox-disabled"),i.insertBefore(j,i.childNodes[0]))}return e||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(a.proxy(this._undetermined,this),50)),b},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(b){b=this.get_node(b);var c=this.settings.checkbox.cascade,d,e,f=this.settings.checkbox.tie_selection,g=this._data[f?"core":"checkbox"].selected,h=this._model.data;if(!b||b.state[f?"selected":"checked"]===!0||-1===c.indexOf("undetermined")||-1===c.indexOf("down")&&-1===c.indexOf("up"))return!1;if(!b.state.loaded&&b.original.state.undetermined===!0)return!0;for(d=0,e=b.children_d.length;e>d;d++)if(-1!==a.inArray(b.children_d[d],g)||!h[b.children_d[d]].state.loaded&&h[b.children_d[d]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.disable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled||(b.state.checkbox_disabled=!0,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:b})))):!1},this.enable_checkbox=function(b){var c,d,e;if(a.isArray(b)){for(b=b.slice(),c=0,d=b.length;d>c;c++)this.enable_checkbox(b[c]);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(e=this.get_node(b,!0),void(b.state.checkbox_disabled&&(b.state.checkbox_disabled=!1,e&&e.length&&e.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:b})))):!1},this.activate_node=function(b,c){return a(c.target).hasClass("jstree-checkbox-disabled")?!1:(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||a(c.target).hasClass("jstree-checkbox"))&&(c.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!a(c.target).hasClass("jstree-checkbox")?d.activate_node.call(this,b,c):this.is_disabled(b)?!1:(this.is_checked(b)?this.uncheck_node(b,c):this.check_node(b,c),void this.trigger("activate_node",{node:this.get_node(b)})))},this._cascade_new_checked_state=function(a,b){var c=this,d=this.settings.checkbox.tie_selection,e=this._model.data[a],f=[],g=[],h,i,j;if(!this.settings.checkbox.cascade_to_disabled&&e.state.disabled||!this.settings.checkbox.cascade_to_hidden&&e.state.hidden)j=this.get_checked_descendants(a),e.state[d?"selected":"checked"]&&j.push(e.id),f=f.concat(j);else{if(e.children)for(h=0,i=e.children.length;i>h;h++){var k=e.children[h];j=c._cascade_new_checked_state(k,b),f=f.concat(j),j.indexOf(k)>-1&&g.push(k)}var l=c.get_node(e,!0),m=g.length>0&&g.length<e.children.length;e.original&&e.original.state&&e.original.state.undetermined&&(e.original.state.undetermined=m),m?(e.state[d?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked")):b&&g.length===e.children.length?(e.state[d?"selected":"checked"]=b,f.push(e.id),l.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked")):(e.state[d?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked"))}return f},this.get_checked_descendants=function(b){var c=this,d=c.settings.checkbox.tie_selection,e=c._model.data[b];return a.vakata.array_filter(e.children_d,function(a){return c._model.data[a].state[d?"selected":"checked"]})},this.check_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.select_node(b,!1,!0,c);var d,e,f,g;if(a.isArray(b)){for(b=b.slice(),e=0,f=b.length;f>e;e++)this.check_node(b[e],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(d=this.get_node(b,!0),void(b.state.checked||(b.state.checked=!0,this._data.checkbox.selected.push(b.id),d&&d.length&&d.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.uncheck_node=function(b,c){if(this.settings.checkbox.tie_selection)return this.deselect_node(b,!1,c);var d,e,f;if(a.isArray(b)){for(b=b.slice(),d=0,e=b.length;e>d;d++)this.uncheck_node(b[d],c);return!0}return b=this.get_node(b),b&&b.id!==a.jstree.root?(f=this.get_node(b,!0),void(b.state.checked&&(b.state.checked=!1,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,b.id),f.length&&f.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:b,selected:this._data.checkbox.selected,event:c})))):!1},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var b=this._data.checkbox.selected.concat([]),c,d;for(this._data.checkbox.selected=this._model.data[a.jstree.root].children_d.concat(),c=0,d=this._data.checkbox.selected.length;d>c;c++)this._model.data[this._data.checkbox.selected[c]]&&(this._model.data[this._data.checkbox.selected[c]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();var a=this._data.checkbox.selected.concat([]),b,c;for(b=0,c=this._data.checkbox.selected.length;c>b;b++)this._model.data[this._data.checkbox.selected[b]]&&(this._model.data[this._data.checkbox.selected[b]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:a})},this.is_checked=function(b){return this.settings.checkbox.tie_selection?this.is_selected(b):(b=this.get_node(b),b&&b.id!==a.jstree.root?b.state.checked:!1)},this.get_checked=function(b){return this.settings.checkbox.tie_selection?this.get_selected(b):b?a.map(this._data.checkbox.selected,a.proxy(function(a){return this.get_node(a)},this)):this._data.checkbox.selected.slice()},this.get_top_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_top_selected(b);var c=this.get_checked(!0),d={},e,f,g,h;for(e=0,f=c.length;f>e;e++)d[c[e].id]=c[e];for(e=0,f=c.length;f>e;e++)for(g=0,h=c[e].children_d.length;h>g;g++)d[c[e].children_d[g]]&&delete d[c[e].children_d[g]];c=[];for(e in d)d.hasOwnProperty(e)&&c.push(e);return b?a.map(c,a.proxy(function(a){return this.get_node(a)},this)):c},this.get_bottom_checked=function(b){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(b);var c=this.get_checked(!0),d=[],e,f;for(e=0,f=c.length;f>e;e++)c[e].children.length||d.push(c[e].id);return b?a.map(d,a.proxy(function(a){return this.get_node(a)},this)):d},this.load_node=function(b,c){var e,f,g,h,i,j;if(!a.isArray(b)&&!this.settings.checkbox.tie_selection&&(j=this.get_node(b),j&&j.state.loaded))for(e=0,f=j.children_d.length;f>e;e++)this._model.data[j.children_d[e]].state.checked&&(i=!0,this._data.checkbox.selected=a.vakata.array_remove_item(this._data.checkbox.selected,j.children_d[e]));return d.load_node.apply(this,arguments)},this.get_state=function(){var a=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection?a:(a.checkbox=this._data.checkbox.selected.slice(),a)},this.set_state=function(b,c){var e=d.set_state.apply(this,arguments);if(e&&b.checkbox){if(!this.settings.checkbox.tie_selection){this.uncheck_all();var f=this;a.each(b.checkbox,function(a,b){f.check_node(b)})}return delete b.checkbox,this.set_state(b,c),!1}return e},this.refresh=function(a,b){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},a.jstree.defaults.conditionalselect=function(){return!0},a.jstree.plugins.conditionalselect=function(a,b){this.activate_node=function(a,c){return this.settings.conditionalselect.call(this,this.get_node(a),c)?b.activate_node.call(this,a,c):void 0}},a.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(b,c){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.create_node(d,{},"last",function(a){try{c.edit(a)}catch(b){setTimeout(function(){c.edit(a)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.edit(d)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.delete_node(c.get_selected()):c.delete_node(d)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.cut(c.get_top_selected()):c.cut(d)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.is_selected(d)?c.copy(c.get_top_selected()):c.copy(d)}},paste:{separator_before:!1,icon:!1,_disabled:function(b){return!a.jstree.reference(b.reference).can_paste()},separator_after:!1,label:"Paste",action:function(b){var c=a.jstree.reference(b.reference),d=c.get_node(b.reference);c.paste(d)}}}}}}},a.jstree.plugins.contextmenu=function(c,d){this.bind=function(){d.bind.call(this);var b=0,c=null,e,f;this.element.on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",a.proxy(function(a,d){"input"!==a.target.tagName.toLowerCase()&&(a.preventDefault(),b=a.ctrlKey?+new Date:0,(d||c)&&(b=+new Date+1e4),c&&clearTimeout(c),this.is_loading(a.currentTarget)||this.show_contextmenu(a.currentTarget,a.pageX,a.pageY,a))},this)).on("click.jstree",".jstree-anchor",a.proxy(function(c){this._data.contextmenu.visible&&(!b||+new Date-b>250)&&a.vakata.context.hide(),b=0},this)).on("touchstart.jstree",".jstree-anchor",function(b){b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(e=b.originalEvent.changedTouches[0].clientX,f=b.originalEvent.changedTouches[0].clientY,c=setTimeout(function(){a(b.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(b){c&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(Math.abs(e-b.originalEvent.changedTouches[0].clientX)>10||Math.abs(f-b.originalEvent.changedTouches[0].clientY)>10)&&(clearTimeout(c),a.vakata.context.hide())}).on("touchend.vakata.jstree",function(a){c&&clearTimeout(c)}),a(i).on("context_hide.vakata.jstree",a.proxy(function(b,c){this._data.contextmenu.visible=!1,a(c.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&a.vakata.context.hide(),d.teardown.call(this)},this.show_contextmenu=function(c,d,e,f){if(c=this.get_node(c),!c||c.id===a.jstree.root)return!1;var g=this.settings.contextmenu,h=this.get_node(c,!0),i=h.children(".jstree-anchor"),j=!1,k=!1;(g.show_at_node||d===b||e===b)&&(j=i.offset(),d=j.left,e=j.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(c)&&this.activate_node(c,f),k=g.items,a.isFunction(k)&&(k=k.call(this,c,a.proxy(function(a){this._show_contextmenu(c,d,e,a)},this))),a.isPlainObject(k)&&this._show_contextmenu(c,d,e,k)},this._show_contextmenu=function(b,c,d,e){var f=this.get_node(b,!0),g=f.children(".jstree-anchor");a(i).one("context_show.vakata.jstree",a.proxy(function(b,c){var d="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";a(c.element).addClass(d),g.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,a.vakata.context.show(g,{x:c,y:d},e),this.trigger("show_contextmenu",{node:b,x:c,y:d})}},function(a){var b=!1,c={element:!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1};a.vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(b){a(i).triggerHandler("context_"+b+".vakata",{reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}})},_execute:function(b){return b=c.items[b],b&&(!b._disabled||a.isFunction(b._disabled)&&!b._disabled({
5
- item:b,reference:c.reference,element:c.element}))&&b.action?b.action.call(null,{item:b,reference:c.reference,element:c.element,position:{x:c.position_x,y:c.position_y}}):!1},_parse:function(b,d){if(!b)return!1;d||(c.html="",c.items=[]);var e="",f=!1,g;return d&&(e+="<ul>"),a.each(b,function(b,d){return d?(c.items.push(d),!f&&d.separator_before&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),f=!1,e+="<li class='"+(d._class||"")+(d._disabled===!0||a.isFunction(d._disabled)&&d._disabled({item:d,reference:c.reference,element:c.element})?" vakata-contextmenu-disabled ":"")+"' "+(d.shortcut?" data-shortcut='"+d.shortcut+"' ":"")+">",e+="<a href='#' rel='"+(c.items.length-1)+"' "+(d.title?"title='"+d.title+"'":"")+">",a.vakata.context.settings.icons&&(e+="<i ",d.icon&&(e+=-1!==d.icon.indexOf("/")||-1!==d.icon.indexOf(".")?" style='background:url(\""+d.icon+"\") center center no-repeat' ":" class='"+d.icon+"' "),e+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),e+=(a.isFunction(d.label)?d.label({item:b,reference:c.reference,element:c.element}):d.label)+(d.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+d.shortcut+'">'+(d.shortcut_label||"")+"</span>":"")+"</a>",d.submenu&&(g=a.vakata.context._parse(d.submenu,!0),g&&(e+=g)),e+="</li>",void(d.separator_after&&(e+="<li class='vakata-context-separator'><a href='#' "+(a.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",f=!0))):!0}),e=e.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),d&&(e+="</ul>"),d||(c.html=e,a.vakata.context._trigger("parse")),e.length>10?e:!1},_show_submenu:function(c){if(c=a(c),c.length&&c.children("ul").length){var d=c.children("ul"),e=c.offset().left,f=e+c.outerWidth(),g=c.offset().top,h=d.width(),i=d.height(),j=a(window).width()+a(window).scrollLeft(),k=a(window).height()+a(window).scrollTop();b?c[f-(h+10+c.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):c[f+h>j&&e>j-f?"addClass":"removeClass"]("vakata-context-right"),g+i+10>k&&d.css("bottom","-1px"),c.hasClass("vakata-context-right")?h>e&&d.css("margin-right",e-h):h>j-f&&d.css("margin-left",j-f-h),d.show()}},show:function(d,e,f){var g,h,j,k,l,m,n,o,p=!0;switch(c.element&&c.element.length&&c.element.width(""),p){case!e&&!d:return!1;case!!e&&!!d:c.reference=d,c.position_x=e.x,c.position_y=e.y;break;case!e&&!!d:c.reference=d,g=d.offset(),c.position_x=g.left+d.outerHeight(),c.position_y=g.top;break;case!!e&&!d:c.position_x=e.x,c.position_y=e.y}d&&!f&&a(d).data("vakata_contextmenu")&&(f=a(d).data("vakata_contextmenu")),a.vakata.context._parse(f)&&c.element.html(c.html),c.items.length&&(c.element.appendTo(i.body),h=c.element,j=c.position_x,k=c.position_y,l=h.width(),m=h.height(),n=a(window).width()+a(window).scrollLeft(),o=a(window).height()+a(window).scrollTop(),b&&(j-=h.outerWidth()-a(d).outerWidth(),j<a(window).scrollLeft()+20&&(j=a(window).scrollLeft()+20)),j+l+20>n&&(j=n-(l+20)),k+m+20>o&&(k=o-(m+20)),c.element.css({left:j,top:k}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),c.is_visible=!0,a.vakata.context._trigger("show"))},hide:function(){c.is_visible&&(c.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),c.is_visible=!1,a.vakata.context._trigger("hide"))}},a(function(){b="rtl"===a(i.body).css("direction");var d=!1;c.element=a("<ul class='vakata-context'></ul>"),c.element.on("mouseenter","li",function(b){b.stopImmediatePropagation(),a.contains(this,b.relatedTarget)||(d&&clearTimeout(d),c.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),a(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),a.vakata.context._show_submenu(this))}).on("mouseleave","li",function(b){a.contains(this,b.relatedTarget)||a(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(b){a(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),a.vakata.context.settings.hide_onmouseleave&&(d=setTimeout(function(b){return function(){a.vakata.context.hide()}}(this),a.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(b){b.preventDefault(),a(this).blur().parent().hasClass("vakata-context-disabled")||a.vakata.context._execute(a(this).attr("rel"))===!1||a.vakata.context.hide()}).on("keydown","a",function(b){var d=null;switch(b.which){case 13:case 32:b.type="click",b.preventDefault(),a(b.currentTarget).trigger(b);break;case 37:c.is_visible&&(c.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 38:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 39:c.is_visible&&(c.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 40:c.is_visible&&(d=c.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first(),d.length||(d=c.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),d.addClass("vakata-context-hover").children("a").focus(),b.stopImmediatePropagation(),b.preventDefault());break;case 27:a.vakata.context.hide(),b.preventDefault()}}).on("keydown",function(a){a.preventDefault();var b=c.element.find(".vakata-contextmenu-shortcut-"+a.which).parent();b.parent().not(".vakata-context-disabled")&&b.click()}),a(i).on("mousedown.vakata.jstree",function(b){c.is_visible&&c.element[0]!==b.target&&!a.contains(c.element[0],b.target)&&a.vakata.context.hide()}).on("context_show.vakata.jstree",function(a,d){c.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),b&&c.element.addClass("vakata-context-rtl").css("direction","rtl"),c.element.find("ul").hide().end()})})}(a),a.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1};var m,n;a.jstree.plugins.dnd=function(b,c){this.init=function(a,b){c.init.call(this,a,b),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in i.createElement("span")},this.bind=function(){c.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",a.proxy(function(b){if(this.settings.dnd.large_drag_target&&a(b.target).closest(".jstree-node")[0]!==b.currentTarget)return!0;if("touchstart"===b.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var c=this.get_node(b.target),d=this.is_selected(c)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,e=d>1?d+" "+this.get_string("nodes"):this.get_text(b.currentTarget);if(this.settings.core.force_text&&(e=a.vakata.html.escape(e)),c&&c.id&&c.id!==a.jstree.root&&(1===b.which||"touchstart"===b.type||"dragstart"===b.type)&&(this.settings.dnd.is_draggable===!0||a.isFunction(this.settings.dnd.is_draggable)&&this.settings.dnd.is_draggable.call(this,d>1?this.get_top_selected(!0):[c],b))){if(m={jstree:!0,origin:this,obj:this.get_node(c,!0),nodes:d>1?this.get_top_selected():[c.id]},n=b.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),a.vakata.dnd.start(b,m,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+e+'<ins class="jstree-copy" style="display:none;">+</ins></div>');a.vakata.dnd._trigger("start",b,{helper:a(),element:n,data:m})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(b){return b.preventDefault(),a.vakata.dnd._trigger("move",b,{helper:a(),element:n,data:m}),!1}).on("drop.jstree",a.proxy(function(b){return b.preventDefault(),a.vakata.dnd._trigger("stop",b,{helper:a(),element:n,data:m}),!1},this))},this.redraw_node=function(a,b,d,e){if(a=c.redraw_node.apply(this,arguments),a&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)a.setAttribute("draggable",!0);else{var f,g,h=null;for(f=0,g=a.childNodes.length;g>f;f++)if(a.childNodes[f]&&a.childNodes[f].className&&-1!==a.childNodes[f].className.indexOf("jstree-anchor")){h=a.childNodes[f];break}h&&h.setAttribute("draggable",!0)}return a}},a(function(){var c=!1,d=!1,e=!1,f=!1,g=a('<div id="jstree-marker">&#160;</div>').hide();a(i).on("dragover.vakata.jstree",function(b){n&&a.vakata.dnd._trigger("move",b,{helper:a(),element:n,data:m})}).on("drop.vakata.jstree",function(b){n&&(a.vakata.dnd._trigger("stop",b,{helper:a(),element:n,data:m}),n=null,m=null)}).on("dnd_start.vakata.jstree",function(a,b){c=!1,e=!1,b&&b.data&&b.data.jstree&&g.appendTo(i.body)}).on("dnd_move.vakata.jstree",function(h,i){var j=i.event.target!==e.target;if(f&&(!i.event||"dragover"!==i.event.type||j)&&clearTimeout(f),i&&i.data&&i.data.jstree&&(!i.event.target.id||"jstree-marker"!==i.event.target.id)){e=i.event;var k=a.jstree.reference(i.event.target),l=!1,m=!1,n=!1,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F;if(k&&k._data&&k._data.dnd)if(g.attr("class","jstree-"+k.get_theme()+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")),D=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey)),i.helper.children().attr("class","jstree-"+k.get_theme()+" jstree-"+k.get_theme()+"-"+k.get_theme_variant()+" "+(k.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[D?"show":"hide"](),i.event.target!==k.element[0]&&i.event.target!==k.get_container_ul()[0]||0!==k.get_container_ul().children().length){if(l=k.settings.dnd.large_drop_target?a(i.event.target).closest(".jstree-node").children(".jstree-anchor"):a(i.event.target).closest(".jstree-anchor"),l&&l.length&&l.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(m=l.offset(),n=(i.event.pageY!==b?i.event.pageY:i.event.originalEvent.pageY)-m.top,r=l.outerHeight(),u=r/3>n?["b","i","a"]:n>r-r/3?["a","i","b"]:n>r/2?["i","a","b"]:["i","b","a"],a.each(u,function(b,e){switch(e){case"b":p=m.left-6,q=m.top,s=k.get_parent(l),t=l.parent().index(),F="jstree-below";break;case"i":B=k.settings.dnd.inside_pos,C=k.get_node(l.parent()),p=m.left-2,q=m.top+r/2+1,s=C.id,t="first"===B?0:"last"===B?C.children.length:Math.min(B,C.children.length),F="jstree-inside";break;case"a":p=m.left-6,q=m.top+r,s=k.get_parent(l),t=l.parent().index()+1,F="jstree-above"}for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(y=i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",z=t,"move_node"===y&&"a"===e&&i.data.origin&&i.data.origin===k&&s===k.get_parent(i.data.nodes[w])&&(A=k.get_node(s),z>a.inArray(i.data.nodes[w],A.children)&&(z-=1)),v=v&&(k&&k.settings&&k.settings.dnd&&k.settings.dnd.check_while_dragging===!1||k.check(y,i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],s,z,{dnd:!0,ref:k.get_node(l.parent()),pos:e,origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin})),!v){k&&k.last_error&&(d=k.last_error());break}return"i"===e&&l.parent().is(".jstree-closed")&&k.settings.dnd.open_timeout&&(!i.event||"dragover"!==i.event.type||j)&&(f&&clearTimeout(f),f=setTimeout(function(a,b){return function(){a.open_node(b)}}(k,l),k.settings.dnd.open_timeout)),v?(E=k.get_node(s,!0),E.hasClass(".jstree-dnd-parent")||(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),E.addClass("jstree-dnd-parent")),c={ins:k,par:s,pos:"i"!==e||"last"!==B||0!==t||k.is_loaded(C)?t:"last"},g.css({left:p+"px",top:q+"px"}).show(),g.removeClass("jstree-above jstree-inside jstree-below").addClass(F),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"),d={},u=!0,!1):void 0}),u===!0))return}else{for(v=!0,w=0,x=i.data.nodes.length;x>w;w++)if(v=v&&k.check(i.data.origin&&(i.data.origin.settings.dnd.always_copy||i.data.origin.settings.dnd.copy&&(i.event.metaKey||i.event.ctrlKey))?"copy_node":"move_node",i.data.origin&&i.data.origin!==k?i.data.origin.get_node(i.data.nodes[w]):i.data.nodes[w],a.jstree.root,"last",{dnd:!0,ref:k.get_node(a.jstree.root),pos:"i",origin:i.data.origin,is_multi:i.data.origin&&i.data.origin!==k,is_foreign:!i.data.origin}),!v)break;if(v)return c={ins:k,par:a.jstree.root,pos:"last"},g.hide(),i.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(i.event.originalEvent&&i.event.originalEvent.dataTransfer&&(i.event.originalEvent.dataTransfer.dropEffect=D?"copy":"move"))}a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),c=!1,i.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),i.event.originalEvent&&i.event.originalEvent.dataTransfer,g.hide()}}).on("dnd_scroll.vakata.jstree",function(a,b){b&&b.data&&b.data.jstree&&(g.hide(),c=!1,e=!1,b.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(b,h){if(a(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),f&&clearTimeout(f),h&&h.data&&h.data.jstree){g.hide().detach();var i,j,k=[];if(c){for(i=0,j=h.data.nodes.length;j>i;i++)k[i]=h.data.origin?h.data.origin.get_node(h.data.nodes[i]):h.data.nodes[i];c.ins[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(h.event.metaKey||h.event.ctrlKey))?"copy_node":"move_node"](k,c.par,c.pos,!1,!1,!1,h.data.origin)}else i=a(h.event.target).closest(".jstree"),i.length&&d&&d.error&&"check"===d.error&&(i=i.jstree(!0),i&&i.settings.core.error.call(this,d));e=!1,c=!1}}).on("keyup.jstree keydown.jstree",function(b,h){h=a.vakata.dnd._get(),h&&h.data&&h.data.jstree&&("keyup"===b.type&&27===b.which?(f&&clearTimeout(f),c=!1,d=!1,e=!1,f=!1,g.hide().detach(),a.vakata.dnd._clean()):(h.helper.find(".jstree-copy").first()[h.data.origin&&(h.data.origin.settings.dnd.always_copy||h.data.origin.settings.dnd.copy&&(b.metaKey||b.ctrlKey))?"show":"hide"](),e&&(e.metaKey=b.metaKey,e.ctrlKey=b.ctrlKey,a.vakata.dnd._trigger("move",e))))})}),function(a){a.vakata.html={div:a("<div></div>"),escape:function(b){return a.vakata.html.div.text(b).html()},strip:function(b){return a.vakata.html.div.empty().append(a.parseHTML(b)).text()}};var c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1};a.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(c,d,e){e===b&&(e=a.vakata.dnd._get()),e.event=d,a(i).triggerHandler("dnd_"+c+".vakata",e)},_get:function(){return{data:c.data,element:c.element,helper:c.helper}},_clean:function(){c.helper&&c.helper.remove(),c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),c={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},n=null,a(i).off("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).off("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop)},_scroll:function(b){if(!c.scroll_e||!c.scroll_l&&!c.scroll_t)return c.scroll_i&&(clearInterval(c.scroll_i),c.scroll_i=!1),!1;if(!c.scroll_i)return c.scroll_i=setInterval(a.vakata.dnd._scroll,100),!1;if(b===!0)return!1;var d=c.scroll_e.scrollTop(),e=c.scroll_e.scrollLeft();c.scroll_e.scrollTop(d+c.scroll_t*a.vakata.dnd.settings.scroll_speed),c.scroll_e.scrollLeft(e+c.scroll_l*a.vakata.dnd.settings.scroll_speed),(d!==c.scroll_e.scrollTop()||e!==c.scroll_e.scrollLeft())&&a.vakata.dnd._trigger("scroll",c.scroll_e)},start:function(b,d,e){"touchstart"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag&&a.vakata.dnd.stop({});try{b.currentTarget.unselectable="on",b.currentTarget.onselectstart=function(){return!1},b.currentTarget.style&&(b.currentTarget.style.touchAction="none",b.currentTarget.style.msTouchAction="none",b.currentTarget.style.MozUserSelect="none")}catch(f){}return c.init_x=b.pageX,c.init_y=b.pageY,c.data=d,c.is_down=!0,c.element=b.currentTarget,c.target=b.target,c.is_touch="touchstart"===b.type,e!==!1&&(c.helper=a("<div id='vakata-dnd'></div>").html(e).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),a(i).on("mousemove.vakata.jstree touchmove.vakata.jstree",a.vakata.dnd.drag),a(i).on("mouseup.vakata.jstree touchend.vakata.jstree",a.vakata.dnd.stop),!1},drag:function(b){if("touchmove"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_down){if(!c.is_drag){if(!(Math.abs(b.pageX-c.init_x)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)||Math.abs(b.pageY-c.init_y)>(c.is_touch?a.vakata.dnd.settings.threshold_touch:a.vakata.dnd.settings.threshold)))return;c.helper&&(c.helper.appendTo(i.body),c.helper_w=c.helper.outerWidth()),c.is_drag=!0,a(c.target).one("click.vakata",!1),a.vakata.dnd._trigger("start",b)}var d=!1,e=!1,f=!1,g=!1,h=!1,j=!1,k=!1,l=!1,m=!1,n=!1;return c.scroll_t=0,c.scroll_l=0,c.scroll_e=!1,a(a(b.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(a(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var d=a(this),e=d.offset();return this.scrollHeight>this.offsetHeight&&(e.top+d.height()-b.pageY<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=1),b.pageY-e.top<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(e.left+d.width()-b.pageX<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=1),b.pageX-e.left<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=-1)),c.scroll_t||c.scroll_l?(c.scroll_e=a(this),!1):void 0}),c.scroll_e||(d=a(i),e=a(window),f=d.height(),g=e.height(),h=d.width(),j=e.width(),k=d.scrollTop(),l=d.scrollLeft(),f>g&&b.pageY-k<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=-1),f>g&&g-(b.pageY-k)<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_t=1),h>j&&b.pageX-l<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=-1),h>j&&j-(b.pageX-l)<a.vakata.dnd.settings.scroll_proximity&&(c.scroll_l=1),(c.scroll_t||c.scroll_l)&&(c.scroll_e=d)),c.scroll_e&&a.vakata.dnd._scroll(!0),c.helper&&(m=parseInt(b.pageY+a.vakata.dnd.settings.helper_top,10),n=parseInt(b.pageX+a.vakata.dnd.settings.helper_left,10),f&&m+25>f&&(m=f-50),h&&n+c.helper_w>h&&(n=h-(c.helper_w+2)),c.helper.css({left:n+"px",top:m+"px"})),a.vakata.dnd._trigger("move",b),!1}},stop:function(b){if("touchend"===b.type&&b.originalEvent&&b.originalEvent.changedTouches&&b.originalEvent.changedTouches[0]&&(b.pageX=b.originalEvent.changedTouches[0].pageX,b.pageY=b.originalEvent.changedTouches[0].pageY,b.target=i.elementFromPoint(b.originalEvent.changedTouches[0].pageX-window.pageXOffset,b.originalEvent.changedTouches[0].pageY-window.pageYOffset)),c.is_drag)b.target!==c.target&&a(c.target).off("click.vakata"),a.vakata.dnd._trigger("stop",b);else if("touchend"===b.type&&b.target===c.target){var d=setTimeout(function(){a(b.target).click()},100);a(b.target).one("click",function(){d&&clearTimeout(d)})}return a.vakata.dnd._clean(),!1}}}(a),a.jstree.defaults.massload=null,a.jstree.plugins.massload=function(b,c){this.init=function(a,b){this._data.massload={},c.init.call(this,a,b)},this._load_nodes=function(b,d,e,f){var g=this.settings.massload,h=[],i=this._model.data,j,k,l;if(!e){for(j=0,k=b.length;k>j;j++)(!i[b[j]]||!i[b[j]].state.loaded&&!i[b[j]].state.failed||f)&&(h.push(b[j]),l=this.get_node(b[j],!0),l&&l.length&&l.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},h.length){if(a.isFunction(g))return g.call(this,h,a.proxy(function(a){var g,h;if(a)for(g in a)a.hasOwnProperty(g)&&(this._data.massload[g]=a[g]);for(g=0,h=b.length;h>g;g++)l=this.get_node(b[g],!0),l&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this));if("object"==typeof g&&g&&g.url)return g=a.extend(!0,{},g),a.isFunction(g.url)&&(g.url=g.url.call(this,h)),a.isFunction(g.data)&&(g.data=g.data.call(this,h)),a.ajax(g).done(a.proxy(function(a,g,h){var i,j;if(a)for(i in a)a.hasOwnProperty(i)&&(this._data.massload[i]=a[i]);for(i=0,j=b.length;j>i;i++)l=this.get_node(b[i],!0),l&&l.length&&l.removeClass("jstree-loading").attr("aria-busy",!1);c._load_nodes.call(this,b,d,e,f)},this)).fail(a.proxy(function(a){c._load_nodes.call(this,b,d,e,f)},this))}}return c._load_nodes.call(this,b,d,e,f)},this._load_node=function(b,d){var e=this._data.massload[b.id],f=null,g;return e?(f=this["string"==typeof e?"_append_html_data":"_append_json_data"](b,"string"==typeof e?a(a.parseHTML(e)).filter(function(){return 3!==this.nodeType}):e,function(a){d.call(this,a)}),g=this.get_node(b.id,!0),g&&g.length&&g.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[b.id],f):c._load_node.call(this,b,d)}},a.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},a.jstree.plugins.search=function(c,d){this.bind=function(){d.bind.call(this),this._data.search.str="",this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",a.proxy(function(b,c){if(this._data.search.som&&c.res.length){var d=this._model.data,e,f,g=[],h,i;for(e=0,f=c.res.length;f>e;e++)if(d[c.res[e]]&&!d[c.res[e]].state.hidden&&(g.push(c.res[e]),g=g.concat(d[c.res[e]].parents),this._data.search.smc))for(h=0,i=d[c.res[e]].children_d.length;i>h;h++)d[d[c.res[e]].children_d[h]]&&!d[d[c.res[e]].children_d[h]].state.hidden&&g.push(d[c.res[e]].children_d[h]);g=a.vakata.array_remove_item(a.vakata.array_unique(g),a.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(g,!0),this.redraw(!0)}},this)).on("clear_search.jstree",a.proxy(function(a,b){this._data.search.som&&b.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(c,d,e,f,g,h){if(c===!1||""===a.trim(c.toString()))return this.clear_search();f=this.get_node(f),f=f&&f.id?f.id:null,c=c.toString();var i=this.settings.search,j=i.ajax?i.ajax:!1,k=this._model.data,l=null,m=[],n=[],o,p;if(this._data.search.res.length&&!g&&this.clear_search(),e===b&&(e=i.show_only_matches),h===b&&(h=i.show_only_matches_children),!d&&j!==!1)return a.isFunction(j)?j.call(this,c,a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this),f):(j=a.extend({},j),j.data||(j.data={}),j.data.str=c,f&&(j.data.inside=f),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=a.ajax(j).fail(a.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(j)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(a.proxy(function(b){b&&b.d&&(b=b.d),this._load_nodes(a.isArray(b)?a.vakata.array_unique(b):[],function(){this.search(c,!0,e,f,g,h)})},this)),this._data.search.lastRequest);if(g||(this._data.search.str=c,this._data.search.dom=a(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=e,this._data.search.smc=h),l=new a.vakata.search(c,!0,{caseSensitive:i.case_sensitive,fuzzy:i.fuzzy}),a.each(k[f?f:a.jstree.root].children_d,function(a,b){var d=k[b];d.text&&!d.state.hidden&&(!i.search_leaves_only||d.state.loaded&&0===d.children.length)&&(i.search_callback&&i.search_callback.call(this,c,d)||!i.search_callback&&l.search(d.text).isMatch)&&(m.push(b),n=n.concat(d.parents))}),m.length){for(n=a.vakata.array_unique(n),o=0,p=n.length;p>o;o++)n[o]!==a.jstree.root&&k[n[o]]&&this.open_node(n[o],null,0)===!0&&this._data.search.opn.push(n[o]);g?(this._data.search.dom=this._data.search.dom.add(a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=a.vakata.array_unique(this._data.search.res.concat(m))):(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(m,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=m),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:c,res:this._data.search.res,show_only_matches:e})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=a(this.element[0].querySelectorAll("#"+a.map(this._data.search.res,function(b){return-1!=="0123456789".indexOf(b[0])?"\\3"+b[0]+" "+b.substr(1).replace(a.jstree.idregex,"\\$&"):b.replace(a.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=a()},this.redraw_node=function(b,c,e,f){if(b=d.redraw_node.apply(this,arguments),b&&-1!==a.inArray(b.id,this._data.search.res)){var g,h,i=null;for(g=0,h=b.childNodes.length;h>g;g++)if(b.childNodes[g]&&b.childNodes[g].className&&-1!==b.childNodes[g].className.indexOf("jstree-anchor")){i=b.childNodes[g];break}i&&(i.className+=" jstree-search")}return b}},function(a){a.vakata.search=function(b,c,d){d=d||{},d=a.extend({},a.vakata.search.defaults,d),d.fuzzy!==!1&&(d.fuzzy=!0),b=d.caseSensitive?b:b.toLowerCase();var e=d.location,f=d.distance,g=d.threshold,h=b.length,i,j,k,l;return h>32&&(d.fuzzy=!1),d.fuzzy&&(i=1<<h-1,j=function(){var a={},c=0;for(c=0;h>c;c++)a[b.charAt(c)]=0;for(c=0;h>c;c++)a[b.charAt(c)]|=1<<h-c-1;return a}(),k=function(a,b){var c=a/h,d=Math.abs(e-b);return f?c+d/f:d?1:c}),l=function(a){if(a=d.caseSensitive?a:a.toLowerCase(),b===a||-1!==a.indexOf(b))return{isMatch:!0,score:0};if(!d.fuzzy)return{isMatch:!1,score:1};var c,f,l=a.length,m=g,n=a.indexOf(b,e),o,p,q=h+l,r,s,t,u,v,w=1,x=[];for(-1!==n&&(m=Math.min(k(0,n),m),n=a.lastIndexOf(b,e+h),-1!==n&&(m=Math.min(k(0,n),m))),n=-1,c=0;h>c;c++){o=0,p=q;while(p>o)k(c,e+p)<=m?o=p:q=p,p=Math.floor((q-o)/2+o);for(q=p,s=Math.max(1,e-p+1),t=Math.min(e+p,l)+h,u=new Array(t+2),u[t+1]=(1<<c)-1,f=t;f>=s;f--)if(v=j[a.charAt(f-1)],0===c?u[f]=(u[f+1]<<1|1)&v:u[f]=(u[f+1]<<1|1)&v|((r[f+1]|r[f])<<1|1)|r[f+1],u[f]&i&&(w=k(c,f-1),m>=w)){if(m=w,n=f-1,x.push(n),!(n>e))break;s=Math.max(1,2*e-n)}if(k(c+1,e)>m)break;r=u}return{isMatch:n>=0,score:w}},c===!0?{search:l}:l(c)},a.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1}}(a),a.jstree.defaults.sort=function(a,b){return this.get_text(a)>this.get_text(b)?1:-1},a.jstree.plugins.sort=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("model.jstree",a.proxy(function(a,b){this.sort(b.parent,!0)},this)).on("rename_node.jstree create_node.jstree",a.proxy(function(a,b){this.sort(b.parent||b.node.parent,!1),this.redraw_node(b.parent||b.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",a.proxy(function(a,b){this.sort(b.parent,!1),this.redraw_node(b.parent,!0)},this))},this.sort=function(b,c){var d,e;if(b=this.get_node(b),b&&b.children&&b.children.length&&(b.children.sort(a.proxy(this.settings.sort,this)),c))for(d=0,e=b.children_d.length;e>d;d++)this.sort(b.children_d[d],!1)}};var o=!1;a.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},a.jstree.plugins.state=function(b,c){this.bind=function(){c.bind.call(this);var b=a.proxy(function(){this.element.on(this.settings.state.events,a.proxy(function(){o&&clearTimeout(o),o=setTimeout(a.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",a.proxy(function(a,c){this.element.one("restore_state.jstree",b),this.restore_state()||b()},this))},this.save_state=function(){var b=this.get_state();this.settings.state.preserve_loaded||delete b.core.loaded;var c={state:b,ttl:this.settings.state.ttl,sec:+new Date};a.vakata.storage.set(this.settings.state.key,JSON.stringify(c))},this.restore_state=function(){var b=a.vakata.storage.get(this.settings.state.key);if(b)try{b=JSON.parse(b)}catch(c){return!1}return b&&b.ttl&&b.sec&&+new Date-b.sec>b.ttl?!1:(b&&b.state&&(b=b.state),b&&a.isFunction(this.settings.state.filter)&&(b=this.settings.state.filter.call(this,b)),b?(this.settings.state.preserve_loaded||delete b.core.loaded,this.element.one("set_state.jstree",function(c,d){d.instance.trigger("restore_state",{state:a.extend(!0,{},b)})}),this.set_state(b),!0):!1)},this.clear_state=function(){return a.vakata.storage.del(this.settings.state.key)}},function(a,b){a.vakata.storage={set:function(a,b){return window.localStorage.setItem(a,b)},get:function(a){return window.localStorage.getItem(a)},del:function(a){return window.localStorage.removeItem(a)}}}(a),a.jstree.defaults.types={"default":{}},a.jstree.defaults.types[a.jstree.root]={},a.jstree.plugins.types=function(c,d){this.init=function(c,e){var f,g;if(e&&e.types&&e.types["default"])for(f in e.types)if("default"!==f&&f!==a.jstree.root&&e.types.hasOwnProperty(f))for(g in e.types["default"])e.types["default"].hasOwnProperty(g)&&e.types[f][g]===b&&(e.types[f][g]=e.types["default"][g]);d.init.call(this,c,e),this._model.data[a.jstree.root].type=a.jstree.root},this.refresh=function(b,c){d.refresh.call(this,b,c),this._model.data[a.jstree.root].type=a.jstree.root},this.bind=function(){this.element.on("model.jstree",a.proxy(function(c,d){var e=this._model.data,f=d.nodes,g=this.settings.types,h,i,j="default",k;for(h=0,i=f.length;i>h;h++){if(j="default",e[f[h]].original&&e[f[h]].original.type&&g[e[f[h]].original.type]&&(j=e[f[h]].original.type),e[f[h]].data&&e[f[h]].data.jstree&&e[f[h]].data.jstree.type&&g[e[f[h]].data.jstree.type]&&(j=e[f[h]].data.jstree.type),
6
- e[f[h]].type=j,e[f[h]].icon===!0&&g[j].icon!==b&&(e[f[h]].icon=g[j].icon),g[j].li_attr!==b&&"object"==typeof g[j].li_attr)for(k in g[j].li_attr)if(g[j].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].li_attr[k]===b?e[f[h]].li_attr[k]=g[j].li_attr[k]:"class"===k&&(e[f[h]].li_attr["class"]=g[j].li_attr["class"]+" "+e[f[h]].li_attr["class"])}if(g[j].a_attr!==b&&"object"==typeof g[j].a_attr)for(k in g[j].a_attr)if(g[j].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[f[h]].a_attr[k]===b?e[f[h]].a_attr[k]=g[j].a_attr[k]:"href"===k&&"#"===e[f[h]].a_attr[k]?e[f[h]].a_attr.href=g[j].a_attr.href:"class"===k&&(e[f[h]].a_attr["class"]=g[j].a_attr["class"]+" "+e[f[h]].a_attr["class"])}}e[a.jstree.root].type=a.jstree.root},this)),d.bind.call(this)},this.get_json=function(b,c,e){var f,g,h=this._model.data,i=c?a.extend(!0,{},c,{no_id:!1}):{},j=d.get_json.call(this,b,i,e);if(j===!1)return!1;if(a.isArray(j))for(f=0,g=j.length;g>f;f++)j[f].type=j[f].id&&h[j[f].id]&&h[j[f].id].type?h[j[f].id].type:"default",c&&c.no_id&&(delete j[f].id,j[f].li_attr&&j[f].li_attr.id&&delete j[f].li_attr.id,j[f].a_attr&&j[f].a_attr.id&&delete j[f].a_attr.id);else j.type=j.id&&h[j.id]&&h[j.id].type?h[j.id].type:"default",c&&c.no_id&&(j=this._delete_ids(j));return j},this._delete_ids=function(b){if(a.isArray(b)){for(var c=0,d=b.length;d>c;c++)b[c]=this._delete_ids(b[c]);return b}return delete b.id,b.li_attr&&b.li_attr.id&&delete b.li_attr.id,b.a_attr&&b.a_attr.id&&delete b.a_attr.id,b.children&&a.isArray(b.children)&&(b.children=this._delete_ids(b.children)),b},this.check=function(c,e,f,g,h){if(d.check.call(this,c,e,f,g,h)===!1)return!1;e=e&&e.id?e:this.get_node(e),f=f&&f.id?f:this.get_node(f);var i=e&&e.id?h&&h.origin?h.origin:a.jstree.reference(e.id):null,j,k,l,m;switch(i=i&&i._model&&i._model.data?i._model.data:null,c){case"create_node":case"move_node":case"copy_node":if("move_node"!==c||-1===a.inArray(e.id,f.children)){if(j=this.get_rules(f),j.max_children!==b&&-1!==j.max_children&&j.max_children===f.children.length)return this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(j.valid_children!==b&&-1!==j.valid_children&&-1===a.inArray(e.type||"default",j.valid_children))return this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;if(i&&e.children_d&&e.parents){for(k=0,l=0,m=e.children_d.length;m>l;l++)k=Math.max(k,i[e.children_d[l]].parents.length);k=k-e.parents.length+1}(0>=k||k===b)&&(k=1);do{if(j.max_depth!==b&&-1!==j.max_depth&&j.max_depth<k)return this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+c,data:JSON.stringify({chk:c,pos:g,obj:e&&e.id?e.id:!1,par:f&&f.id?f.id:!1})},!1;f=this.get_node(f.parent),j=this.get_rules(f),k++}while(f)}}return!0},this.get_rules=function(a){if(a=this.get_node(a),!a)return!1;var c=this.get_type(a,!0);return c.max_depth===b&&(c.max_depth=-1),c.max_children===b&&(c.max_children=-1),c.valid_children===b&&(c.valid_children=-1),c},this.get_type=function(b,c){return b=this.get_node(b),b?c?a.extend({type:b.type},this.settings.types[b.type]):b.type:!1},this.set_type=function(c,d){var e=this._model.data,f,g,h,i,j,k,l,m;if(a.isArray(c)){for(c=c.slice(),g=0,h=c.length;h>g;g++)this.set_type(c[g],d);return!0}if(f=this.settings.types,c=this.get_node(c),!f[d]||!c)return!1;if(l=this.get_node(c,!0),l&&l.length&&(m=l.children(".jstree-anchor")),i=c.type,j=this.get_icon(c),c.type=d,(j===!0||!f[i]||f[i].icon!==b&&j===f[i].icon)&&this.set_icon(c,f[d].icon!==b?f[d].icon:!0),f[i]&&f[i].li_attr!==b&&"object"==typeof f[i].li_attr)for(k in f[i].li_attr)if(f[i].li_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].li_attr["class"]=(e[c.id].li_attr["class"]||"").replace(f[i].li_attr[k],""),l&&l.removeClass(f[i].li_attr[k])):e[c.id].li_attr[k]===f[i].li_attr[k]&&(e[c.id].li_attr[k]=null,l&&l.removeAttr(k))}if(f[i]&&f[i].a_attr!==b&&"object"==typeof f[i].a_attr)for(k in f[i].a_attr)if(f[i].a_attr.hasOwnProperty(k)){if("id"===k)continue;"class"===k?(e[c.id].a_attr["class"]=(e[c.id].a_attr["class"]||"").replace(f[i].a_attr[k],""),m&&m.removeClass(f[i].a_attr[k])):e[c.id].a_attr[k]===f[i].a_attr[k]&&("href"===k?(e[c.id].a_attr[k]="#",m&&m.attr("href","#")):(delete e[c.id].a_attr[k],m&&m.removeAttr(k)))}if(f[d].li_attr!==b&&"object"==typeof f[d].li_attr)for(k in f[d].li_attr)if(f[d].li_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].li_attr[k]===b?(e[c.id].li_attr[k]=f[d].li_attr[k],l&&("class"===k?l.addClass(f[d].li_attr[k]):l.attr(k,f[d].li_attr[k]))):"class"===k&&(e[c.id].li_attr["class"]=f[d].li_attr[k]+" "+e[c.id].li_attr["class"],l&&l.addClass(f[d].li_attr[k]))}if(f[d].a_attr!==b&&"object"==typeof f[d].a_attr)for(k in f[d].a_attr)if(f[d].a_attr.hasOwnProperty(k)){if("id"===k)continue;e[c.id].a_attr[k]===b?(e[c.id].a_attr[k]=f[d].a_attr[k],m&&("class"===k?m.addClass(f[d].a_attr[k]):m.attr(k,f[d].a_attr[k]))):"href"===k&&"#"===e[c.id].a_attr[k]?(e[c.id].a_attr.href=f[d].a_attr.href,m&&m.attr("href",f[d].a_attr.href)):"class"===k&&(e[c.id].a_attr["class"]=f[d].a_attr["class"]+" "+e[c.id].a_attr["class"],m&&m.addClass(f[d].a_attr[k]))}return!0}},a.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(a,b){return a+" ("+b+")"}},a.jstree.plugins.unique=function(c,d){this.check=function(b,c,e,f,g){if(d.check.call(this,b,c,e,f,g)===!1)return!1;if(c=c&&c.id?c:this.get_node(c),e=e&&e.id?e:this.get_node(e),!e||!e.children)return!0;var h="rename_node"===b?f:c.text,i=[],j=this.settings.unique.case_sensitive,k=this.settings.unique.trim_whitespace,l=this._model.data,m,n,o;for(m=0,n=e.children.length;n>m;m++)o=l[e.children[m]].text,j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),i.push(o);switch(j||(h=h.toLowerCase()),k&&(h=h.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),b){case"delete_node":return!0;case"rename_node":return o=c.text||"",j||(o=o.toLowerCase()),k&&(o=o.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),m=-1===a.inArray(h,i)||c.text&&o===h,m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"create_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"copy_node":return m=-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m;case"move_node":return m=c.parent===e.id&&(!g||!g.is_multi)||-1===a.inArray(h,i),m||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+h+" already exists. Preventing: "+b,data:JSON.stringify({chk:b,pos:f,obj:c&&c.id?c.id:!1,par:e&&e.id?e.id:!1})}),m}return!0},this.create_node=function(c,e,f,g,h){if(!e||e.text===b){if(null===c&&(c=a.jstree.root),c=this.get_node(c),!c)return d.create_node.call(this,c,e,f,g,h);if(f=f===b?"last":f,!f.toString().match(/^(before|after)$/)&&!h&&!this.is_loaded(c))return d.create_node.call(this,c,e,f,g,h);e||(e={});var i,j,k,l,m,n=this._model.data,o=this.settings.unique.case_sensitive,p=this.settings.unique.trim_whitespace,q=this.settings.unique.duplicate,r;for(j=i=this.get_string("New node"),k=[],l=0,m=c.children.length;m>l;l++)r=n[c.children[l]].text,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),k.push(r);l=1,r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));while(-1!==a.inArray(r,k))j=q.call(this,i,++l).toString(),r=j,o||(r=r.toLowerCase()),p&&(r=r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));e.text=j}return d.create_node.call(this,c,e,f,g,h)}};var p=i.createElement("DIV");if(p.setAttribute("unselectable","on"),p.setAttribute("role","presentation"),p.className="jstree-wholerow",p.innerHTML="&#160;",a.jstree.plugins.wholerow=function(b,c){this.bind=function(){c.bind.call(this),this.element.on("ready.jstree set_state.jstree",a.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",a.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",a.proxy(function(a,b){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");var c=!1,d,e;for(d=0,e=b.selected.length;e>d;d++)c=this.get_node(b.selected[d],!0),c&&c.length&&c.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",a.proxy(function(a,b){this.get_node(b.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",a.proxy(function(a,b){"hover_node"===a.type&&this.is_disabled(b.node)||this.get_node(b.node,!0).children(".jstree-wholerow")["hover_node"===a.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",a.proxy(function(b){if(this._data.contextmenu){b.preventDefault();var c=a.Event("contextmenu",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey,pageX:b.pageX,pageY:b.pageY});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c)}},this)).on("click.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("dblclick.jstree",".jstree-wholerow",function(b){b.stopImmediatePropagation();var c=a.Event("dblclick",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",a.proxy(function(b){b.stopImmediatePropagation();var c=a.Event("click",{metaKey:b.metaKey,ctrlKey:b.ctrlKey,altKey:b.altKey,shiftKey:b.shiftKey});a(b.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(c).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",a.proxy(function(a){return a.stopImmediatePropagation(),this.is_disabled(a.currentTarget)||this.hover_node(a.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",a.proxy(function(a){this.dehover_node(a.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),c.teardown.call(this)},this.redraw_node=function(b,d,e,f){if(b=c.redraw_node.apply(this,arguments)){var g=p.cloneNode(!0);-1!==a.inArray(b.id,this._data.core.selected)&&(g.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===b.id&&(g.className+=" jstree-wholerow-hovered"),b.insertBefore(g,b.childNodes[0])}return b}},window.customElements&&Object&&Object.create){var q=Object.create(HTMLElement.prototype);q.createdCallback=function(){var b={core:{},plugins:[]},c;for(c in a.jstree.plugins)a.jstree.plugins.hasOwnProperty(c)&&this.attributes[c]&&(b.plugins.push(c),this.getAttribute(c)&&JSON.parse(this.getAttribute(c))&&(b[c]=JSON.parse(this.getAttribute(c))));for(c in a.jstree.defaults.core)a.jstree.defaults.core.hasOwnProperty(c)&&this.attributes[c]&&(b.core[c]=JSON.parse(this.getAttribute(c))||this.getAttribute(c));a(this).jstree(b)};try{window.customElements.define("vakata-jstree",function(){},{prototype:q})}catch(r){}}}});
1
+ !function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(E,P){"use strict";if(!E.jstree){var s=0,a=!1,n=!1,o=!1,r=[],e=E("script:last").attr("src"),y=window.document,c=window.setImmediate,i=window.Promise;!c&&i&&(c=function(e,t){i.resolve(t).then(e)}),E.jstree={version:"3.3.10",defaults:{plugins:[]},plugins:{},path:e&&-1!==e.indexOf("/")?e.replace(/\/[^\/]+$/,""):"",idregex:/[\\:&!^|()\[\]<>@*'+~#";.,=\- \/${}%?`]/g,root:"#"},E.jstree.create=function(e,r){var i=new E.jstree.core(++s),t=r;return r=E.extend(!0,{},E.jstree.defaults,r),t&&t.plugins&&(r.plugins=t.plugins),E.each(r.plugins,function(e,t){"core"!==e&&(i=i.plugin(t,r[t]))}),E(e).data("jstree",i),i.init(e,r),i},E.jstree.destroy=function(){E(".jstree:jstree").jstree("destroy"),E(y).off(".jstree")},E.jstree.core=function(e){this._id=e,this._cnt=0,this._wrk=null,this._data={core:{themes:{name:!1,dots:!1,icons:!1,ellipsis:!1},selected:[],last_error:{},working:!1,worker_queue:[],focused:null}}},E.jstree.reference=function(t){var r=null,e=null;if(!t||!t.id||t.tagName&&t.nodeType||(t=t.id),!e||!e.length)try{e=E(t)}catch(e){}if(!e||!e.length)try{e=E("#"+t.replace(E.jstree.idregex,"\\$&"))}catch(e){}return e&&e.length&&(e=e.closest(".jstree")).length&&(e=e.data("jstree"))?r=e:E(".jstree").each(function(){var e=E(this).data("jstree");if(e&&e._model.data[t])return r=e,!1}),r},E.fn.jstree=function(r){var i="string"==typeof r,s=Array.prototype.slice.call(arguments,1),a=null;return!(!0===r&&!this.length)&&(this.each(function(){var e=E.jstree.reference(this),t=i&&e?e[r]:null;if(a=i&&t?t.apply(e,s):null,e||i||r!==P&&!E.isPlainObject(r)||E.jstree.create(this,r),(e&&!i||!0===r)&&(a=e||!1),null!==a&&a!==P)return!1}),null!==a&&a!==P?a:this)},E.expr.pseudos.jstree=E.expr.createPseudo(function(e){return function(e){return E(e).hasClass("jstree")&&E(e).data("jstree")!==P}}),E.jstree.defaults.core={data:!1,strings:!1,check_callback:!1,error:E.noop,animation:200,multiple:!0,themes:{name:!1,url:!1,dir:!1,dots:!0,icons:!0,ellipsis:!1,stripes:!1,variant:!1,responsive:!1},expand_selected_onload:!0,worker:!0,force_text:!1,dblclick_toggle:!0,loaded_state:!1,restore_focus:!0,keyboard:{"ctrl-space":function(e){e.type="click",E(e.currentTarget).trigger(e)},enter:function(e){e.type="click",E(e.currentTarget).trigger(e)},left:function(e){var t;e.preventDefault(),this.is_open(e.currentTarget)?this.close_node(e.currentTarget):(t=this.get_parent(e.currentTarget))&&t.id!==E.jstree.root&&this.get_node(t,!0).children(".jstree-anchor").focus()},up:function(e){e.preventDefault();var t=this.get_prev_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},right:function(e){var t;e.preventDefault(),this.is_closed(e.currentTarget)?this.open_node(e.currentTarget,function(e){this.get_node(e,!0).children(".jstree-anchor").focus()}):!this.is_open(e.currentTarget)||(t=this.get_node(e.currentTarget,!0).children(".jstree-children")[0])&&E(this._firstChild(t)).children(".jstree-anchor").focus()},down:function(e){e.preventDefault();var t=this.get_next_dom(e.currentTarget);t&&t.length&&t.children(".jstree-anchor").focus()},"*":function(e){this.open_all()},home:function(e){e.preventDefault();var t=this._firstChild(this.get_container_ul()[0]);t&&E(t).children(".jstree-anchor").filter(":visible").focus()},end:function(e){e.preventDefault(),this.element.find(".jstree-anchor").filter(":visible").last().focus()},f2:function(e){e.preventDefault(),this.edit(e.currentTarget)}}},E.jstree.core.prototype={plugin:function(e,t){var r=E.jstree.plugins[e];return r?(this._data[e]={},r.prototype=this,new r(t,this)):this},init:function(e,t){this._model={data:{},changed:[],force_full_redraw:!1,redraw_timeout:!1,default_state:{loaded:!0,opened:!1,selected:!1,disabled:!1}},this._model.data[E.jstree.root]={id:E.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this.element=E(e).addClass("jstree jstree-"+this._id),this.settings=t,this._data.core.ready=!1,this._data.core.loaded=!1,this._data.core.rtl="rtl"===this.element.css("direction"),this.element[this._data.core.rtl?"addClass":"removeClass"]("jstree-rtl"),this.element.attr("role","tree"),this.settings.core.multiple&&this.element.attr("aria-multiselectable",!0),this.element.attr("tabindex")||this.element.attr("tabindex","0"),this.bind(),this.trigger("init"),this._data.core.original_container_html=this.element.find(" > ul > li").clone(!0),this._data.core.original_container_html.find("li").addBack().contents().filter(function(){return 3===this.nodeType&&(!this.nodeValue||/^\s+$/.test(this.nodeValue))}).remove(),this.element.html("<ul class='jstree-container-ul jstree-children' role='group'><li id='j"+this._id+"_loading' class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='presentation'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading"),this._data.core.li_height=this.get_container_ul().children("li").first().outerHeight()||24,this._data.core.node=this._create_prototype_node(),this.trigger("loading"),this.load_node(E.jstree.root)},destroy:function(e){if(this.trigger("destroy"),this._wrk)try{window.URL.revokeObjectURL(this._wrk),this._wrk=null}catch(e){}e||this.element.empty(),this.teardown()},_create_prototype_node:function(){var e,t,r=y.createElement("LI");return r.setAttribute("role","presentation"),(e=y.createElement("I")).className="jstree-icon jstree-ocl",e.setAttribute("role","presentation"),r.appendChild(e),(e=y.createElement("A")).className="jstree-anchor",e.setAttribute("href","#"),e.setAttribute("tabindex","-1"),e.setAttribute("role","treeitem"),(t=y.createElement("I")).className="jstree-icon jstree-themeicon",t.setAttribute("role","presentation"),e.appendChild(t),r.appendChild(e),e=t=null,r},_kbevent_to_func:function(e){var t=[];if(e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),t.push({8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock",16:"Shift",17:"Ctrl",18:"Alt",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*",173:"-"}[e.which]||e.which),"shift-shift"===(t=t.sort().join("-").toLowerCase())||"ctrl-ctrl"===t||"alt-alt"===t)return null;var r,i,s=this.settings.core.keyboard;for(r in s)if(s.hasOwnProperty(r)&&("-"!==(i=r)&&"+"!==i&&(i=(i=i.replace("--","-MINUS").replace("+-","-MINUS").replace("++","-PLUS").replace("-+","-PLUS")).split(/-|\+/).sort().join("-").replace("MINUS","-").replace("PLUS","+").toLowerCase()),i===t))return s[r];return null},teardown:function(){this.unbind(),this.element.removeClass("jstree").removeData("jstree").find("[class^='jstree']").addBack().attr("class",function(){return this.className.replace(/jstree[^ ]*|$/gi,"")}),this.element=null},bind:function(){var a="",n=null,t=0;this.element.on("dblclick.jstree",function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;if(y.selection&&y.selection.empty)y.selection.empty();else if(window.getSelection){var t=window.getSelection();try{t.removeAllRanges(),t.collapse()}catch(e){}}}).on("mousedown.jstree",E.proxy(function(e){e.target===this.element[0]&&(e.preventDefault(),t=+new Date)},this)).on("mousedown.jstree",".jstree-ocl",function(e){e.preventDefault()}).on("click.jstree",".jstree-ocl",E.proxy(function(e){this.toggle_node(e.target)},this)).on("dblclick.jstree",".jstree-anchor",E.proxy(function(e){return!(!e.target.tagName||"input"!==e.target.tagName.toLowerCase())||void(this.settings.core.dblclick_toggle&&this.toggle_node(e.target))},this)).on("click.jstree",".jstree-anchor",E.proxy(function(e){e.preventDefault(),e.currentTarget!==y.activeElement&&E(e.currentTarget).focus(),this.activate_node(e.currentTarget,e)},this)).on("keydown.jstree",".jstree-anchor",E.proxy(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;this._data.core.rtl&&(37===e.which?e.which=39:39===e.which&&(e.which=37));var t=this._kbevent_to_func(e);if(t){var r=t.call(this,e);if(!1===r||!0===r)return r}},this)).on("load_node.jstree",E.proxy(function(e,t){t.status&&(t.node.id!==E.jstree.root||this._data.core.loaded||(this._data.core.loaded=!0,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.trigger("loaded")),this._data.core.ready||setTimeout(E.proxy(function(){if(this.element&&!this.get_container_ul().find(".jstree-loading").length){if(this._data.core.ready=!0,this._data.core.selected.length){if(this.settings.core.expand_selected_onload){for(var e=[],t=0,r=this._data.core.selected.length;t<r;t++)e=e.concat(this._model.data[this._data.core.selected[t]].parents);for(t=0,r=(e=E.vakata.array_unique(e)).length;t<r;t++)this.open_node(e[t],!1,0)}this.trigger("changed",{action:"ready",selected:this._data.core.selected})}this.trigger("ready")}},this),0))},this)).on("keypress.jstree",E.proxy(function(e){if(e.target.tagName&&"input"===e.target.tagName.toLowerCase())return!0;n&&clearTimeout(n),n=setTimeout(function(){a=""},500);var r=String.fromCharCode(e.which).toLowerCase(),t=this.element.find(".jstree-anchor").filter(":visible"),i=t.index(y.activeElement)||0,s=!1;if(1<(a+=r).length){if(t.slice(i).each(E.proxy(function(e,t){if(0===E(t).text().toLowerCase().indexOf(a))return E(t).focus(),!(s=!0)},this)),s)return;if(t.slice(0,i).each(E.proxy(function(e,t){if(0===E(t).text().toLowerCase().indexOf(a))return E(t).focus(),!(s=!0)},this)),s)return}if(new RegExp("^"+r.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"+$").test(a)){if(t.slice(i+1).each(E.proxy(function(e,t){if(E(t).text().toLowerCase().charAt(0)===r)return E(t).focus(),!(s=!0)},this)),s)return;if(t.slice(0,i+1).each(E.proxy(function(e,t){if(E(t).text().toLowerCase().charAt(0)===r)return E(t).focus(),!(s=!0)},this)),s)return}},this)).on("init.jstree",E.proxy(function(){var e=this.settings.core.themes;this._data.core.themes.dots=e.dots,this._data.core.themes.stripes=e.stripes,this._data.core.themes.icons=e.icons,this._data.core.themes.ellipsis=e.ellipsis,this.set_theme(e.name||"default",e.url),this.set_theme_variant(e.variant)},this)).on("loading.jstree",E.proxy(function(){this[this._data.core.themes.dots?"show_dots":"hide_dots"](),this[this._data.core.themes.icons?"show_icons":"hide_icons"](),this[this._data.core.themes.stripes?"show_stripes":"hide_stripes"](),this[this._data.core.themes.ellipsis?"show_ellipsis":"hide_ellipsis"]()},this)).on("blur.jstree",".jstree-anchor",E.proxy(function(e){this._data.core.focused=null,E(e.currentTarget).filter(".jstree-hovered").trigger("mouseleave"),this.element.attr("tabindex","0")},this)).on("focus.jstree",".jstree-anchor",E.proxy(function(e){var t=this.get_node(e.currentTarget);t&&t.id&&(this._data.core.focused=t.id),this.element.find(".jstree-hovered").not(e.currentTarget).trigger("mouseleave"),E(e.currentTarget).trigger("mouseenter"),this.element.attr("tabindex","-1")},this)).on("focus.jstree",E.proxy(function(){var e;500<new Date-t&&!this._data.core.focused&&this.settings.core.restore_focus&&(t=0,(e=this.get_node(this.element.attr("aria-activedescendant"),!0))&&e.find("> .jstree-anchor").focus())},this)).on("mouseenter.jstree",".jstree-anchor",E.proxy(function(e){this.hover_node(e.currentTarget)},this)).on("mouseleave.jstree",".jstree-anchor",E.proxy(function(e){this.dehover_node(e.currentTarget)},this))},unbind:function(){this.element.off(".jstree"),E(y).off(".jstree-"+this._id)},trigger:function(e,t){((t=t||{}).instance=this).element.triggerHandler(e.replace(".jstree","")+".jstree",t)},get_container:function(){return this.element},get_container_ul:function(){return this.element.children(".jstree-children").first()},get_string:function(e){var t=this.settings.core.strings;return"function"==typeof t?t.call(this,e):t&&t[e]?t[e]:e},_firstChild:function(e){for(e=e?e.firstChild:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_nextSibling:function(e){for(e=e?e.nextSibling:null;null!==e&&1!==e.nodeType;)e=e.nextSibling;return e},_previousSibling:function(e){for(e=e?e.previousSibling:null;null!==e&&1!==e.nodeType;)e=e.previousSibling;return e},get_node:function(e,t){var r;e&&e.id&&(e=e.id),e instanceof E&&e.length&&e[0].id&&(e=e[0].id);try{if(this._model.data[e])e=this._model.data[e];else if("string"==typeof e&&this._model.data[e.replace(/^#/,"")])e=this._model.data[e.replace(/^#/,"")];else if("string"==typeof e&&(r=E("#"+e.replace(E.jstree.idregex,"\\$&"),this.element)).length&&this._model.data[r.closest(".jstree-node").attr("id")])e=this._model.data[r.closest(".jstree-node").attr("id")];else if((r=this.element.find(e)).length&&this._model.data[r.closest(".jstree-node").attr("id")])e=this._model.data[r.closest(".jstree-node").attr("id")];else{if(!(r=this.element.find(e)).length||!r.hasClass("jstree"))return!1;e=this._model.data[E.jstree.root]}return t&&(e=e.id===E.jstree.root?this.element:E("#"+e.id.replace(E.jstree.idregex,"\\$&"),this.element)),e}catch(e){return!1}},get_path:function(e,t,r){if(!(e=e.parents?e:this.get_node(e))||e.id===E.jstree.root||!e.parents)return!1;var i,s,a=[];for(a.push(r?e.id:e.text),i=0,s=e.parents.length;i<s;i++)a.push(r?e.parents[i]:this.get_text(e.parents[i]));return a=a.reverse().slice(1),t?a.join(t):a},get_next_dom:function(e,t){var r;if((e=this.get_node(e,!0))[0]===this.element[0]){for(r=this._firstChild(this.get_container_ul()[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);return!!r&&E(r)}if(!e||!e.length)return!1;if(t){for(r=e[0];(r=this._nextSibling(r))&&0===r.offsetHeight;);return!!r&&E(r)}if(e.hasClass("jstree-open")){for(r=this._firstChild(e.children(".jstree-children")[0]);r&&0===r.offsetHeight;)r=this._nextSibling(r);if(null!==r)return E(r)}for(r=e[0];(r=this._nextSibling(r))&&0===r.offsetHeight;);return null!==r?E(r):e.parentsUntil(".jstree",".jstree-node").nextAll(".jstree-node:visible").first()},get_prev_dom:function(e,t){var r;if((e=this.get_node(e,!0))[0]===this.element[0]){for(r=this.get_container_ul()[0].lastChild;r&&0===r.offsetHeight;)r=this._previousSibling(r);return!!r&&E(r)}if(!e||!e.length)return!1;if(t){for(r=e[0];(r=this._previousSibling(r))&&0===r.offsetHeight;);return!!r&&E(r)}for(r=e[0];(r=this._previousSibling(r))&&0===r.offsetHeight;);if(null===r)return!(!(r=e[0].parentNode.parentNode)||!r.className||-1===r.className.indexOf("jstree-node"))&&E(r);for(e=E(r);e.hasClass("jstree-open");)e=e.children(".jstree-children").first().children(".jstree-node:visible:last");return e},get_parent:function(e){return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&e.parent},get_children_dom:function(e){return(e=this.get_node(e,!0))[0]===this.element[0]?this.get_container_ul().children(".jstree-node"):!(!e||!e.length)&&e.children(".jstree-children").children(".jstree-node")},is_parent:function(e){return(e=this.get_node(e))&&(!1===e.state.loaded||0<e.children.length)},is_loaded:function(e){return(e=this.get_node(e))&&e.state.loaded},is_loading:function(e){return(e=this.get_node(e))&&e.state&&e.state.loading},is_open:function(e){return(e=this.get_node(e))&&e.state.opened},is_closed:function(e){return(e=this.get_node(e))&&this.is_parent(e)&&!e.state.opened},is_leaf:function(e){return!this.is_parent(e)},load_node:function(n,o){var e,t,r,i,s;if(Array.isArray(n))return this._load_nodes(n.slice(),o),!0;if(!(n=this.get_node(n)))return o&&o.call(this,n,!1),!1;if(n.state.loaded){for(n.state.loaded=!1,r=0,i=n.parents.length;r<i;r++)this._model.data[n.parents[r]].children_d=E.vakata.array_filter(this._model.data[n.parents[r]].children_d,function(e){return-1===E.inArray(e,n.children_d)});for(e=0,t=n.children_d.length;e<t;e++)this._model.data[n.children_d[e]].state.selected&&(s=!0),delete this._model.data[n.children_d[e]];s&&(this._data.core.selected=E.vakata.array_filter(this._data.core.selected,function(e){return-1===E.inArray(e,n.children_d)})),n.children=[],n.children_d=[],s&&this.trigger("changed",{action:"load_node",node:n,selected:this._data.core.selected})}return n.state.failed=!1,n.state.loading=!0,this.get_node(n,!0).addClass("jstree-loading").attr("aria-busy",!0),this._load_node(n,E.proxy(function(e){(n=this._model.data[n.id]).state.loading=!1,n.state.loaded=e,n.state.failed=!n.state.loaded;for(var t=this.get_node(n,!0),r=0,i=this._model.data,s=!1,r=0,a=n.children.length;r<a;r++)if(i[n.children[r]]&&!i[n.children[r]].state.hidden){s=!0;break}n.state.loaded&&t&&t.length&&(t.removeClass("jstree-closed jstree-open jstree-leaf"),s?"#"!==n.id&&t.addClass(n.state.opened?"jstree-open":"jstree-closed"):t.addClass("jstree-leaf")),t.removeClass("jstree-loading").attr("aria-busy",!1),this.trigger("load_node",{node:n,status:e}),o&&o.call(this,n,e)},this)),!0},_load_nodes:function(e,t,r,i){for(var s=!0,a=function(){this._load_nodes(e,t,!0)},n=this._model.data,o=[],d=0,c=e.length;d<c;d++)n[e[d]]&&(!n[e[d]].state.loaded&&!n[e[d]].state.failed||!r&&i)&&(this.is_loading(e[d])||this.load_node(e[d],a),s=!1);if(s){for(d=0,c=e.length;d<c;d++)n[e[d]]&&n[e[d]].state.loaded&&o.push(e[d]);t&&!t.done&&(t.call(this,o),t.done=!0)}},load_all:function(e,t){if(e=e||E.jstree.root,!(e=this.get_node(e)))return!1;var r,i,s=[],a=this._model.data,n=a[e.id].children_d;for(e.state&&!e.state.loaded&&s.push(e.id),r=0,i=n.length;r<i;r++)a[n[r]]&&a[n[r]].state&&!a[n[r]].state.loaded&&s.push(n[r]);s.length?this._load_nodes(s,function(){this.load_all(e,t)}):(t&&t.call(this,e),this.trigger("load_all",{node:e}))},_load_node:function(s,a){function n(){return 3!==this.nodeType&&8!==this.nodeType}var e,t=this.settings.core.data;return t?"function"==typeof t?t.call(this,s,E.proxy(function(e){!1===e?a.call(this,!1):this["string"==typeof e?"_append_html_data":"_append_json_data"](s,"string"==typeof e?E(E.parseHTML(e)).filter(n):e,function(e){a.call(this,e)})},this)):"object"==typeof t?t.url?("function"==typeof(t=E.extend(!0,{},t)).url&&(t.url=t.url.call(this,s)),"function"==typeof t.data&&(t.data=t.data.call(this,s)),E.ajax(t).done(E.proxy(function(e,t,r){var i=r.getResponseHeader("Content-Type");return i&&-1!==i.indexOf("json")||"object"==typeof e?this._append_json_data(s,e,function(e){a.call(this,e)}):i&&-1!==i.indexOf("html")||"string"==typeof e?this._append_html_data(s,E(E.parseHTML(e)).filter(n),function(e){a.call(this,e)}):(this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:s.id,xhr:r})},this.settings.core.error.call(this,this._data.core.last_error),a.call(this,!1))},this)).fail(E.proxy(function(e){this._data.core.last_error={error:"ajax",plugin:"core",id:"core_04",reason:"Could not load node",data:JSON.stringify({id:s.id,xhr:e})},a.call(this,!1),this.settings.core.error.call(this,this._data.core.last_error)},this))):(e=Array.isArray(t)?E.extend(!0,[],t):E.isPlainObject(t)?E.extend(!0,{},t):t,s.id===E.jstree.root?this._append_json_data(s,e,function(e){a.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_05",reason:"Could not load node",data:JSON.stringify({id:s.id})},this.settings.core.error.call(this,this._data.core.last_error),a.call(this,!1))):"string"==typeof t?s.id===E.jstree.root?this._append_html_data(s,E(E.parseHTML(t)).filter(n),function(e){a.call(this,e)}):(this._data.core.last_error={error:"nodata",plugin:"core",id:"core_06",reason:"Could not load node",data:JSON.stringify({id:s.id})},this.settings.core.error.call(this,this._data.core.last_error),a.call(this,!1)):a.call(this,!1):s.id===E.jstree.root?this._append_html_data(s,this._data.core.original_container_html.clone(!0),function(e){a.call(this,e)}):a.call(this,!1)},_node_changed:function(e){(e=this.get_node(e))&&-1===E.inArray(e.id,this._model.changed)&&this._model.changed.push(e.id)},_append_html_data:function(e,t,r){(e=this.get_node(e)).children=[],e.children_d=[];var i,s,a,n=t.is("ul")?t.children():t,o=e.id,d=[],c=[],l=this._model.data,h=l[o],_=this._data.core.selected.length;for(n.each(E.proxy(function(e,t){(i=this._parse_model_from_html(E(t),o,h.parents.concat()))&&(d.push(i),c.push(i),l[i].children_d.length&&(c=c.concat(l[i].children_d)))},this)),h.children=d,h.children_d=c,s=0,a=h.parents.length;s<a;s++)l[h.parents[s]].children_d=l[h.parents[s]].children_d.concat(c);this.trigger("model",{nodes:c,parent:o}),o!==E.jstree.root?(this._node_changed(o),this.redraw()):(this.get_container_ul().children(".jstree-initial-node").remove(),this.redraw(!0)),this._data.core.selected.length!==_&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),r.call(this,!0)},_append_json_data:function(e,t,d,r){if(null!==this.element){(e=this.get_node(e)).children=[],e.children_d=[],t.d&&"string"==typeof(t=t.d)&&(t=JSON.parse(t)),Array.isArray(t)||(t=[t]);var i=null,s={df:this._model.default_state,dat:t,par:e.id,m:this._model.data,t_id:this._id,t_cnt:this._cnt,sel:this._data.core.selected},j=this,a=function(e,c){e.data&&(e=e.data);var t,r,i,s,a=e.dat,n=e.par,o=[],d=[],l=[],h=e.df,_=e.t_id,u=e.t_cnt,g=e.m,f=g[n],p=e.sel,m=function(e,t,r){r=r?r.concat():[],t&&r.unshift(t);var i,s,a,n,o=e.id.toString(),d={id:o,text:e.text||"",icon:e.icon===c||e.icon,parent:t,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in h)h.hasOwnProperty(i)&&(d.state[i]=h[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(d.icon=e.data.jstree.icon),d.icon!==c&&null!==d.icon&&""!==d.icon||(d.icon=!0),e&&e.data&&(d.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(d.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(d.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(d.li_attr[i]=e.li_attr[i]);if(d.li_attr.id||(d.li_attr.id=o),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(d.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(d.state.loaded=!1,d.children=[],d.children_d=[]),i=0,s=(g[d.id]=d).children.length;i<s;i++)a=m(g[d.children[i]],d.id,r),n=g[a],d.children_d.push(a),n.children_d.length&&(d.children_d=d.children_d.concat(n.children_d));return delete e.data,delete e.children,g[d.id].original=e,d.state.selected&&l.push(d.id),d.id},v=function(e,t,r){r=r?r.concat():[],t&&r.unshift(t);for(var i,s,a,n,o,d=!1;d="j"+_+"_"+ ++u,g[d];);for(i in o={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===c||e.icon,parent:t,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},h)h.hasOwnProperty(i)&&(o.state[i]=h[i]);if(e&&e.id&&(o.id=e.id.toString()),e&&e.text&&(o.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(o.icon=e.data.jstree.icon),o.icon!==c&&null!==o.icon&&""!==o.icon||(o.icon=!0),e&&e.data&&(o.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(o.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(o.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(o.li_attr[i]=e.li_attr[i]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=d),o.li_attr.id||(o.li_attr.id=o.id),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(o.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,s=e.children.length;i<s;i++)a=v(e.children[i],o.id,r),n=g[a],o.children.push(a),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children_d.concat(o.children)}return e&&e.children&&!0===e.children&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete e.data,delete e.children,o.original=e,(g[o.id]=o).state.selected&&l.push(o.id),o.id};if(a.length&&a[0].id!==c&&a[0].parent!==c){for(r=0,i=a.length;r<i;r++)a[r].children||(a[r].children=[]),a[r].state||(a[r].state={}),g[a[r].id.toString()]=a[r];for(r=0,i=a.length;r<i;r++)g[a[r].parent.toString()]?(g[a[r].parent.toString()].children.push(a[r].id.toString()),f.children_d.push(a[r].id.toString())):void 0!==j&&(j._data.core.last_error={error:"parse",plugin:"core",id:"core_07",reason:"Node with invalid parent",data:JSON.stringify({id:a[r].id.toString(),parent:a[r].parent.toString()})},j.settings.core.error.call(j,j._data.core.last_error));for(r=0,i=f.children.length;r<i;r++)t=m(g[f.children[r]],n,f.parents.concat()),d.push(t),g[t].children_d.length&&(d=d.concat(g[t].children_d));for(r=0,i=f.parents.length;r<i;r++)g[f.parents[r]].children_d=g[f.parents[r]].children_d.concat(d);s={cnt:u,mod:g,sel:p,par:n,dpc:d,add:l}}else{for(r=0,i=a.length;r<i;r++)(t=v(a[r],n,f.parents.concat()))&&(o.push(t),d.push(t),g[t].children_d.length&&(d=d.concat(g[t].children_d)));for(f.children=o,f.children_d=d,r=0,i=f.parents.length;r<i;r++)g[f.parents[r]].children_d=g[f.parents[r]].children_d.concat(d);s={cnt:u,mod:g,sel:p,par:n,dpc:d,add:l}}if("undefined"!=typeof window&&void 0!==window.document)return s;postMessage(s)},n=function(e,t){if(null!==this.element){this._cnt=e.cnt;var r,i=this._model.data;for(r in i)i.hasOwnProperty(r)&&i[r].state&&i[r].state.loading&&e.mod[r]&&(e.mod[r].state.loading=!0);if(this._model.data=e.mod,t){var s,a=e.add,n=e.sel,o=this._data.core.selected.slice(),i=this._model.data;if(n.length!==o.length||E.vakata.array_unique(n.concat(o)).length!==n.length){for(r=0,s=n.length;r<s;r++)-1===E.inArray(n[r],a)&&-1===E.inArray(n[r],o)&&(i[n[r]].state.selected=!1);for(r=0,s=o.length;r<s;r++)-1===E.inArray(o[r],n)&&(i[o[r]].state.selected=!0)}}e.add.length&&(this._data.core.selected=this._data.core.selected.concat(e.add)),this.trigger("model",{nodes:e.dpc,parent:e.par}),e.par!==E.jstree.root?(this._node_changed(e.par),this.redraw()):this.redraw(!0),e.add.length&&this.trigger("changed",{action:"model",selected:this._data.core.selected}),!t&&c?c(function(){d.call(j,!0)}):d.call(j,!0)}};if(this.settings.core.worker&&window.Blob&&window.URL&&window.Worker)try{null===this._wrk&&(this._wrk=window.URL.createObjectURL(new window.Blob(["self.onmessage = "+a.toString()],{type:"text/javascript"}))),!this._data.core.working||r?(this._data.core.working=!0,(i=new window.Worker(this._wrk)).onmessage=E.proxy(function(e){n.call(this,e.data,!0);try{i.terminate(),i=null}catch(e){}this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1},this),s.par?i.postMessage(s):this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1):this._data.core.worker_queue.push([e,t,d,!0])}catch(e){n.call(this,a(s),!1),this._data.core.worker_queue.length?this._append_json_data.apply(this,this._data.core.worker_queue.shift()):this._data.core.working=!1}else n.call(this,a(s),!1)}},_parse_model_from_html:function(e,t,r){r=r?[].concat(r):[],t&&r.unshift(t);var i,s,a,n,o,d=this._model.data,c={id:!1,text:!1,icon:!0,parent:t,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(a in this._model.default_state)this._model.default_state.hasOwnProperty(a)&&(c.state[a]=this._model.default_state[a]);if(n=E.vakata.attributes(e,!0),E.each(n,function(e,t){return!(t=t.trim()).length||(c.li_attr[e]=t,void("id"===e&&(c.id=t.toString())))}),(n=e.children("a").first()).length&&(n=E.vakata.attributes(n,!0),E.each(n,function(e,t){(t=t.trim()).length&&(c.a_attr[e]=t)})),(n=e.children("a").first().length?e.children("a").first().clone():e.clone()).children("ins, i, ul").remove(),n=n.html(),n=E("<div></div>").html(n),c.text=this.settings.core.force_text?n.text():n.html(),n=e.data(),c.data=n?E.extend(!0,{},n):null,c.state.opened=e.hasClass("jstree-open"),c.state.selected=e.children("a").hasClass("jstree-clicked"),c.state.disabled=e.children("a").hasClass("jstree-disabled"),c.data&&c.data.jstree)for(a in c.data.jstree)c.data.jstree.hasOwnProperty(a)&&(c.state[a]=c.data.jstree[a]);for((n=e.children("a").children(".jstree-themeicon")).length&&(c.icon=!n.hasClass("jstree-themeicon-hidden")&&n.attr("rel")),c.state.icon!==P&&(c.icon=c.state.icon),c.icon!==P&&null!==c.icon&&""!==c.icon||(c.icon=!0),n=e.children("ul").children("li");d[o="j"+this._id+"_"+ ++this._cnt];);return c.id=c.li_attr.id?c.li_attr.id.toString():o,n.length?(n.each(E.proxy(function(e,t){i=this._parse_model_from_html(E(t),c.id,r),s=this._model.data[i],c.children.push(i),s.children_d.length&&(c.children_d=c.children_d.concat(s.children_d))},this)),c.children_d=c.children_d.concat(c.children)):e.hasClass("jstree-closed")&&(c.state.loaded=!1),c.li_attr.class&&(c.li_attr.class=c.li_attr.class.replace("jstree-closed","").replace("jstree-open","")),c.a_attr.class&&(c.a_attr.class=c.a_attr.class.replace("jstree-clicked","").replace("jstree-disabled","")),(d[c.id]=c).state.selected&&this._data.core.selected.push(c.id),c.id},_parse_model_from_flat_json:function(e,t,r){r=r?r.concat():[],t&&r.unshift(t);var i,s,a,n,o=e.id.toString(),d=this._model.data,c=this._model.default_state,l={id:o,text:e.text||"",icon:e.icon===P||e.icon,parent:t,parents:r,children:e.children||[],children_d:e.children_d||[],data:e.data,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1};for(i in c)c.hasOwnProperty(i)&&(l.state[i]=c[i]);if(e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(l.icon=e.data.jstree.icon),l.icon!==P&&null!==l.icon&&""!==l.icon||(l.icon=!0),e&&e.data&&(l.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(l.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(l.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(l.li_attr[i]=e.li_attr[i]);if(l.li_attr.id||(l.li_attr.id=o),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(l.a_attr[i]=e.a_attr[i]);for(e&&e.children&&!0===e.children&&(l.state.loaded=!1,l.children=[],l.children_d=[]),i=0,s=(d[l.id]=l).children.length;i<s;i++)n=d[a=this._parse_model_from_flat_json(d[l.children[i]],l.id,r)],l.children_d.push(a),n.children_d.length&&(l.children_d=l.children_d.concat(n.children_d));return delete e.data,delete e.children,d[l.id].original=e,l.state.selected&&this._data.core.selected.push(l.id),l.id},_parse_model_from_json:function(e,t,r){r=r?r.concat():[],t&&r.unshift(t);for(var i,s,a,n,o,d=!1,c=this._model.data,l=this._model.default_state;c[d="j"+this._id+"_"+ ++this._cnt];);for(i in o={id:!1,text:"string"==typeof e?e:"",icon:"object"!=typeof e||e.icon===P||e.icon,parent:t,parents:r,children:[],children_d:[],data:null,state:{},li_attr:{id:!1},a_attr:{href:"#"},original:!1},l)l.hasOwnProperty(i)&&(o.state[i]=l[i]);if(e&&e.id&&(o.id=e.id.toString()),e&&e.text&&(o.text=e.text),e&&e.data&&e.data.jstree&&e.data.jstree.icon&&(o.icon=e.data.jstree.icon),o.icon!==P&&null!==o.icon&&""!==o.icon||(o.icon=!0),e&&e.data&&(o.data=e.data,e.data.jstree))for(i in e.data.jstree)e.data.jstree.hasOwnProperty(i)&&(o.state[i]=e.data.jstree[i]);if(e&&"object"==typeof e.state)for(i in e.state)e.state.hasOwnProperty(i)&&(o.state[i]=e.state[i]);if(e&&"object"==typeof e.li_attr)for(i in e.li_attr)e.li_attr.hasOwnProperty(i)&&(o.li_attr[i]=e.li_attr[i]);if(o.li_attr.id&&!o.id&&(o.id=o.li_attr.id.toString()),o.id||(o.id=d),o.li_attr.id||(o.li_attr.id=o.id),e&&"object"==typeof e.a_attr)for(i in e.a_attr)e.a_attr.hasOwnProperty(i)&&(o.a_attr[i]=e.a_attr[i]);if(e&&e.children&&e.children.length){for(i=0,s=e.children.length;i<s;i++)n=c[a=this._parse_model_from_json(e.children[i],o.id,r)],o.children.push(a),n.children_d.length&&(o.children_d=o.children_d.concat(n.children_d));o.children_d=o.children.concat(o.children_d)}return e&&e.children&&!0===e.children&&(o.state.loaded=!1,o.children=[],o.children_d=[]),delete e.data,delete e.children,o.original=e,(c[o.id]=o).state.selected&&this._data.core.selected.push(o.id),o.id},_redraw:function(){for(var e,t=this._model.force_full_redraw?this._model.data[E.jstree.root].children.concat([]):this._model.changed.concat([]),r=y.createElement("UL"),i=this._data.core.focused,s=0,a=t.length;s<a;s++)(e=this.redraw_node(t[s],!0,this._model.force_full_redraw))&&this._model.force_full_redraw&&r.appendChild(e);this._model.force_full_redraw&&(r.className=this.get_container_ul()[0].className,r.setAttribute("role","group"),this.element.empty().append(r)),null!==i&&this.settings.core.restore_focus&&((e=this.get_node(i,!0))&&e.length&&e.children(".jstree-anchor")[0]!==y.activeElement?e.children(".jstree-anchor").focus():this._data.core.focused=null),this._model.force_full_redraw=!1,this._model.changed=[],this.trigger("redraw",{nodes:t})},redraw:function(e){e&&(this._model.force_full_redraw=!0),this._redraw()},draw_children:function(e){var t=this.get_node(e),r=!1,i=!1,s=!1,a=y;if(!t)return!1;if(t.id===E.jstree.root)return this.redraw(!0);if(!(e=this.get_node(e,!0))||!e.length)return!1;if(e.children(".jstree-children").remove(),e=e[0],t.children.length&&t.state.loaded){for((s=a.createElement("UL")).setAttribute("role","group"),s.className="jstree-children",r=0,i=t.children.length;r<i;r++)s.appendChild(this.redraw_node(t.children[r],!0,!0));e.appendChild(s)}},redraw_node:function(e,t,r,i){var s=this.get_node(e),a=!1,n=!1,o=!1,d=!1,c=!1,l=!1,h="",_=y,u=this._model.data,g=!1,f=null,p=0,m=0,v=!1,j=!1;if(!s)return!1;if(s.id===E.jstree.root)return this.redraw(!0);if(t=t||0===s.children.length,e=y.querySelector?this.element[0].querySelector("#"+(-1!=="0123456789".indexOf(s.id[0])?"\\3"+s.id[0]+" "+s.id.substr(1).replace(E.jstree.idregex,"\\$&"):s.id.replace(E.jstree.idregex,"\\$&"))):y.getElementById(s.id))e=E(e),r||((a=e.parent().parent()[0])===this.element[0]&&(a=null),n=e.index()),t||!s.children.length||e.children(".jstree-children").length||(t=!0),t||(o=e.children(".jstree-children")[0]),g=e.children(".jstree-anchor")[0]===y.activeElement,e.remove();else if(t=!0,!r){if(!(null===(a=s.parent!==E.jstree.root?E("#"+s.parent.replace(E.jstree.idregex,"\\$&"),this.element)[0]:null)||a&&u[s.parent].state.opened))return!1;n=E.inArray(s.id,null===a?u[E.jstree.root].children:u[s.parent].children)}for(d in e=this._data.core.node.cloneNode(!0),h="jstree-node ",s.li_attr)if(s.li_attr.hasOwnProperty(d)){if("id"===d)continue;"class"!==d?e.setAttribute(d,s.li_attr[d]):h+=s.li_attr[d]}for(s.a_attr.id||(s.a_attr.id=s.id+"_anchor"),e.setAttribute("aria-selected",!!s.state.selected),e.childNodes[1].setAttribute("aria-selected",!!s.state.selected),e.setAttribute("aria-level",s.parents.length),e.childNodes[1].setAttribute("aria-level",s.parents.length),e.setAttribute("aria-labelledby",s.a_attr.id),s.state.disabled&&(e.setAttribute("aria-disabled",!0),e.childNodes[1].setAttribute("aria-disabled",!0)),d=0,c=s.children.length;d<c;d++)if(!u[s.children[d]].state.hidden){v=!0;break}if(null!==s.parent&&u[s.parent]&&!s.state.hidden&&(d=E.inArray(s.id,u[s.parent].children),j=s.id,-1!==d))for(d++,c=u[s.parent].children.length;d<c&&(u[u[s.parent].children[d]].state.hidden||(j=u[s.parent].children[d]),j===s.id);d++);for(c in s.state.hidden&&(h+=" jstree-hidden"),s.state.loading&&(h+=" jstree-loading"),s.state.loaded&&!v?h+=" jstree-leaf":(h+=s.state.opened&&s.state.loaded?" jstree-open":" jstree-closed",e.setAttribute("aria-expanded",s.state.opened&&s.state.loaded),e.childNodes[1].setAttribute("aria-expanded",s.state.opened&&s.state.loaded)),j===s.id&&(h+=" jstree-last"),e.id=s.id,e.className=h,h=(s.state.selected?" jstree-clicked":"")+(s.state.disabled?" jstree-disabled":""),s.a_attr)if(s.a_attr.hasOwnProperty(c)){if("href"===c&&"#"===s.a_attr[c])continue;"class"!==c?e.childNodes[1].setAttribute(c,s.a_attr[c]):h+=" "+s.a_attr[c]}if(h.length&&(e.childNodes[1].className="jstree-anchor "+h),(s.icon&&!0!==s.icon||!1===s.icon)&&(!1===s.icon?e.childNodes[1].childNodes[0].className+=" jstree-themeicon-hidden":-1===s.icon.indexOf("/")&&-1===s.icon.indexOf(".")?e.childNodes[1].childNodes[0].className+=" "+s.icon+" jstree-themeicon-custom":(e.childNodes[1].childNodes[0].style.backgroundImage='url("'+s.icon+'")',e.childNodes[1].childNodes[0].style.backgroundPosition="center center",e.childNodes[1].childNodes[0].style.backgroundSize="auto",e.childNodes[1].childNodes[0].className+=" jstree-themeicon-custom")),this.settings.core.force_text?e.childNodes[1].appendChild(_.createTextNode(s.text)):e.childNodes[1].innerHTML+=s.text,t&&s.children.length&&(s.state.opened||i)&&s.state.loaded){for((l=_.createElement("UL")).setAttribute("role","group"),l.className="jstree-children",d=0,c=s.children.length;d<c;d++)l.appendChild(this.redraw_node(s.children[d],t,!0));e.appendChild(l)}if(o&&e.appendChild(o),!r){for(d=0,c=(a=a||this.element[0]).childNodes.length;d<c;d++)if(a.childNodes[d]&&a.childNodes[d].className&&-1!==a.childNodes[d].className.indexOf("jstree-children")){f=a.childNodes[d];break}f||((f=_.createElement("UL")).setAttribute("role","group"),f.className="jstree-children",a.appendChild(f)),n<(a=f).childNodes.length?a.insertBefore(e,a.childNodes[n]):a.appendChild(e),g&&(p=this.element[0].scrollTop,m=this.element[0].scrollLeft,e.childNodes[1].focus(),this.element[0].scrollTop=p,this.element[0].scrollLeft=m)}return s.state.opened&&!s.state.loaded&&(s.state.opened=!1,setTimeout(E.proxy(function(){this.open_node(s.id,!1,0)},this),0)),e},open_node:function(e,r,i){var t,s,a,n;if(Array.isArray(e)){for(t=0,s=(e=e.slice()).length;t<s;t++)this.open_node(e[t],r,i);return!0}return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&(i=i===P?this.settings.core.animation:i,this.is_closed(e)?this.is_loaded(e)?(a=this.get_node(e,!0),n=this,a.length&&(i&&a.children(".jstree-children").length&&a.children(".jstree-children").stop(!0,!0),e.children.length&&!this._firstChild(a.children(".jstree-children")[0])&&this.draw_children(e),i?(this.trigger("before_open",{node:e}),a.children(".jstree-children").css("display","none").end().removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded",!0).children(".jstree-anchor").attr("aria-expanded",!0).end().children(".jstree-children").stop(!0,!0).slideDown(i,function(){this.style.display="",n.element&&n.trigger("after_open",{node:e})})):(this.trigger("before_open",{node:e}),a[0].className=a[0].className.replace("jstree-closed","jstree-open"),a[0].setAttribute("aria-expanded",!0),a[0].childNodes[1].setAttribute("aria-expanded",!0))),e.state.opened=!0,r&&r.call(this,e,!0),a.length||this.trigger("before_open",{node:e}),this.trigger("open_node",{node:e}),i&&a.length||this.trigger("after_open",{node:e}),!0):this.is_loading(e)?setTimeout(E.proxy(function(){this.open_node(e,r,i)},this),500):void this.load_node(e,function(e,t){return t?this.open_node(e,r,i):!!r&&r.call(this,e,!1)}):(r&&r.call(this,e,!1),!1))},_open_to:function(e){if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;for(var t=e.parents,r=0,i=t.length;r<i;r+=1)r!==E.jstree.root&&this.open_node(t[r],!1,0);return E("#"+e.id.replace(E.jstree.idregex,"\\$&"),this.element)},close_node:function(e,t){var r,i,s,a;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.close_node(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&(!this.is_closed(e)&&(t=t===P?this.settings.core.animation:t,a=(s=this).get_node(e,!0),e.state.opened=!1,this.trigger("close_node",{node:e}),void(a.length?t?a.children(".jstree-children").attr("style","display:block !important").end().removeClass("jstree-open").addClass("jstree-closed").attr("aria-expanded",!1).children(".jstree-anchor").attr("aria-expanded",!1).end().children(".jstree-children").stop(!0,!0).slideUp(t,function(){this.style.display="",a.children(".jstree-children").remove(),s.element&&s.trigger("after_close",{node:e})}):(a[0].className=a[0].className.replace("jstree-open","jstree-closed"),a.children(".jstree-anchor").attr("aria-expanded",!1),a.attr("aria-expanded",!1).children(".jstree-children").remove(),this.trigger("after_close",{node:e})):this.trigger("after_close",{node:e}))))},toggle_node:function(e){var t,r;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.toggle_node(e[t]);return!0}return this.is_closed(e)?this.open_node(e):this.is_open(e)?this.close_node(e):void 0},open_all:function(e,r,i){if(e=e||E.jstree.root,!(e=this.get_node(e)))return!1;var t,s,a,n=e.id===E.jstree.root?this.get_container_ul():this.get_node(e,!0);if(!n.length){for(t=0,s=e.children_d.length;t<s;t++)this.is_closed(this._model.data[e.children_d[t]])&&(this._model.data[e.children_d[t]].state.opened=!0);return this.trigger("open_all",{node:e})}i=i||n,(n=(a=this).is_closed(e)?n.find(".jstree-closed").addBack():n.find(".jstree-closed")).each(function(){a.open_node(this,function(e,t){t&&this.is_parent(e)&&this.open_all(e,r,i)},r||0)}),0===i.find(".jstree-closed").length&&this.trigger("open_all",{node:this.get_node(i)})},close_all:function(e,t){if(e=e||E.jstree.root,!(e=this.get_node(e)))return!1;var r,i,s=e.id===E.jstree.root?this.get_container_ul():this.get_node(e,!0),a=this;for(s.length&&(s=this.is_open(e)?s.find(".jstree-open").addBack():s.find(".jstree-open"),E(s.get().reverse()).each(function(){a.close_node(this,t||0)})),r=0,i=e.children_d.length;r<i;r++)this._model.data[e.children_d[r]].state.opened=!1;this.trigger("close_all",{node:e})},is_disabled:function(e){return(e=this.get_node(e))&&e.state&&e.state.disabled},enable_node:function(e){var t,r;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.enable_node(e[t]);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;e.state.disabled=!1,this.get_node(e,!0).children(".jstree-anchor").removeClass("jstree-disabled").attr("aria-disabled",!1),this.trigger("enable_node",{node:e})},disable_node:function(e){var t,r;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.disable_node(e[t]);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;e.state.disabled=!0,this.get_node(e,!0).children(".jstree-anchor").addClass("jstree-disabled").attr("aria-disabled",!0),this.trigger("disable_node",{node:e})},is_hidden:function(e){return!0===(e=this.get_node(e)).state.hidden},hide_node:function(e,t){var r,i;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.hide_node(e[r],!0);return t||this.redraw(),!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;e.state.hidden||(e.state.hidden=!0,this._node_changed(e.parent),t||this.redraw(),this.trigger("hide_node",{node:e}))},show_node:function(e,t){var r,i;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.show_node(e[r],!0);return t||this.redraw(),!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;e.state.hidden&&(e.state.hidden=!1,this._node_changed(e.parent),t||this.redraw(),this.trigger("show_node",{node:e}))},hide_all:function(e){var t,r=this._model.data,i=[];for(t in r)r.hasOwnProperty(t)&&t!==E.jstree.root&&!r[t].state.hidden&&(r[t].state.hidden=!0,i.push(t));return this._model.force_full_redraw=!0,e||this.redraw(),this.trigger("hide_all",{nodes:i}),i},show_all:function(e){var t,r=this._model.data,i=[];for(t in r)r.hasOwnProperty(t)&&t!==E.jstree.root&&r[t].state.hidden&&(r[t].state.hidden=!1,i.push(t));return this._model.force_full_redraw=!0,e||this.redraw(),this.trigger("show_all",{nodes:i}),i},activate_node:function(e,t){if(this.is_disabled(e))return!1;if(t&&"object"==typeof t||(t={}),this._data.core.last_clicked=this._data.core.last_clicked&&this._data.core.last_clicked.id!==P?this.get_node(this._data.core.last_clicked.id):null,this._data.core.last_clicked&&!this._data.core.last_clicked.state.selected&&(this._data.core.last_clicked=null),!this._data.core.last_clicked&&this._data.core.selected.length&&(this._data.core.last_clicked=this.get_node(this._data.core.selected[this._data.core.selected.length-1])),this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&(!t.shiftKey||this._data.core.last_clicked&&this.get_parent(e)&&this.get_parent(e)===this._data.core.last_clicked.parent))if(t.shiftKey){for(var r=this.get_node(e).id,i=this._data.core.last_clicked.id,s=this.get_node(this._data.core.last_clicked.parent).children,a=!1,n=0,o=s.length;n<o;n+=1)s[n]===r&&(a=!a),s[n]===i&&(a=!a),this.is_disabled(s[n])||!a&&s[n]!==r&&s[n]!==i?this.deselect_node(s[n],!0,t):this.is_hidden(s[n])||this.select_node(s[n],!0,!1,t);this.trigger("changed",{action:"select_node",node:this.get_node(e),selected:this._data.core.selected,event:t})}else this.is_selected(e)?this.deselect_node(e,!1,t):this.select_node(e,!1,!1,t);else!this.settings.core.multiple&&(t.metaKey||t.ctrlKey||t.shiftKey)&&this.is_selected(e)?this.deselect_node(e,!1,t):(this.deselect_all(!0),this.select_node(e,!1,!1,t),this._data.core.last_clicked=this.get_node(e));this.trigger("activate_node",{node:this.get_node(e),event:t})},hover_node:function(e){if(!(e=this.get_node(e,!0))||!e.length||e.children(".jstree-hovered").length)return!1;var t=this.element.find(".jstree-hovered"),r=this.element;t&&t.length&&this.dehover_node(t),e.children(".jstree-anchor").addClass("jstree-hovered"),this.trigger("hover_node",{node:this.get_node(e)}),setTimeout(function(){r.attr("aria-activedescendant",e[0].id)},0)},dehover_node:function(e){if(!(e=this.get_node(e,!0))||!e.length||!e.children(".jstree-hovered").length)return!1;e.children(".jstree-anchor").removeClass("jstree-hovered"),this.trigger("dehover_node",{node:this.get_node(e)})},select_node:function(e,t,r,i){var s,a,n;if(Array.isArray(e)){for(a=0,n=(e=e.slice()).length;a<n;a++)this.select_node(e[a],t,r,i);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;s=this.get_node(e,!0),e.state.selected||(e.state.selected=!0,this._data.core.selected.push(e.id),r||(s=this._open_to(e)),s&&s.length&&s.attr("aria-selected",!0).children(".jstree-anchor").addClass("jstree-clicked").attr("aria-selected",!0),this.trigger("select_node",{node:e,selected:this._data.core.selected,event:i}),t||this.trigger("changed",{action:"select_node",node:e,selected:this._data.core.selected,event:i}))},deselect_node:function(e,t,r){var i,s,a;if(Array.isArray(e)){for(i=0,s=(e=e.slice()).length;i<s;i++)this.deselect_node(e[i],t,r);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;a=this.get_node(e,!0),e.state.selected&&(e.state.selected=!1,this._data.core.selected=E.vakata.array_remove_item(this._data.core.selected,e.id),a.length&&a.attr("aria-selected",!1).children(".jstree-anchor").removeClass("jstree-clicked").attr("aria-selected",!1),this.trigger("deselect_node",{node:e,selected:this._data.core.selected,event:r}),t||this.trigger("changed",{action:"deselect_node",node:e,selected:this._data.core.selected,event:r}))},select_all:function(e){var t,r,i=this._data.core.selected.concat([]);for(this._data.core.selected=this._model.data[E.jstree.root].children_d.concat(),t=0,r=this._data.core.selected.length;t<r;t++)this._model.data[this._data.core.selected[t]]&&(this._model.data[this._data.core.selected[t]].state.selected=!0);this.redraw(!0),this.trigger("select_all",{selected:this._data.core.selected}),e||this.trigger("changed",{action:"select_all",selected:this._data.core.selected,old_selection:i})},deselect_all:function(e){for(var t=this._data.core.selected.concat([]),r=0,i=this._data.core.selected.length;r<i;r++)this._model.data[this._data.core.selected[r]]&&(this._model.data[this._data.core.selected[r]].state.selected=!1);this._data.core.selected=[],this.element.find(".jstree-clicked").removeClass("jstree-clicked").attr("aria-selected",!1).parent().attr("aria-selected",!1),this.trigger("deselect_all",{selected:this._data.core.selected,node:t}),e||this.trigger("changed",{action:"deselect_all",selected:this._data.core.selected,old_selection:t})},is_selected:function(e){return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&e.state.selected},get_selected:function(e){return e?E.map(this._data.core.selected,E.proxy(function(e){return this.get_node(e)},this)):this._data.core.selected.slice()},get_top_selected:function(e){for(var t,r,i=this.get_selected(!0),s={},a=0,n=i.length;a<n;a++)s[i[a].id]=i[a];for(a=0,n=i.length;a<n;a++)for(t=0,r=i[a].children_d.length;t<r;t++)s[i[a].children_d[t]]&&delete s[i[a].children_d[t]];for(a in i=[],s)s.hasOwnProperty(a)&&i.push(a);return e?E.map(i,E.proxy(function(e){return this.get_node(e)},this)):i},get_bottom_selected:function(e){for(var t=this.get_selected(!0),r=[],i=0,s=t.length;i<s;i++)t[i].children.length||r.push(t[i].id);return e?E.map(r,E.proxy(function(e){return this.get_node(e)},this)):r},get_state:function(){var e,t={core:{open:[],loaded:[],scroll:{left:this.element.scrollLeft(),top:this.element.scrollTop()},selected:[]}};for(e in this._model.data)this._model.data.hasOwnProperty(e)&&e!==E.jstree.root&&(this._model.data[e].state.loaded&&this.settings.core.loaded_state&&t.core.loaded.push(e),this._model.data[e].state.opened&&t.core.open.push(e),this._model.data[e].state.selected&&t.core.selected.push(e));return t},set_state:function(t,r){if(t){if(t.core&&t.core.selected&&t.core.initial_selection===P&&(t.core.initial_selection=this._data.core.selected.concat([]).sort().join(",")),t.core){var i,e;if(t.core.loaded)return this.settings.core.loaded_state&&Array.isArray(t.core.loaded)&&t.core.loaded.length?this._load_nodes(t.core.loaded,function(e){delete t.core.loaded,this.set_state(t,r)}):(delete t.core.loaded,this.set_state(t,r)),!1;if(t.core.open)return Array.isArray(t.core.open)&&t.core.open.length?this._load_nodes(t.core.open,function(e){this.open_node(e,!1,0),delete t.core.open,this.set_state(t,r)}):(delete t.core.open,this.set_state(t,r)),!1;if(t.core.scroll)return t.core.scroll&&t.core.scroll.left!==P&&this.element.scrollLeft(t.core.scroll.left),t.core.scroll&&t.core.scroll.top!==P&&this.element.scrollTop(t.core.scroll.top),delete t.core.scroll,this.set_state(t,r),!1;if(t.core.selected)return i=this,t.core.initial_selection!==P&&t.core.initial_selection!==this._data.core.selected.concat([]).sort().join(",")||(this.deselect_all(),E.each(t.core.selected,function(e,t){i.select_node(t,!1,!0)})),delete t.core.initial_selection,delete t.core.selected,this.set_state(t,r),!1;for(e in t)t.hasOwnProperty(e)&&"core"!==e&&-1===E.inArray(e,this.settings.plugins)&&delete t[e];if(E.isEmptyObject(t.core))return delete t.core,this.set_state(t,r),!1}return E.isEmptyObject(t)?(t=null,r&&r.call(this),this.trigger("set_state"),!1):!0}return!1},refresh:function(e,t){this._data.core.state=!0===t?{}:this.get_state(),t&&"function"==typeof t&&(this._data.core.state=t.call(this,this._data.core.state)),this._cnt=0,this._model.data={},this._model.data[E.jstree.root]={id:E.jstree.root,parent:null,parents:[],children:[],children_d:[],state:{loaded:!1}},this._data.core.selected=[],this._data.core.last_clicked=null,this._data.core.focused=null;var r=this.get_container_ul()[0].className;e||(this.element.html("<ul class='"+r+"' role='group'><li class='jstree-initial-node jstree-loading jstree-leaf jstree-last' role='presentation' id='j"+this._id+"_loading'><i class='jstree-icon jstree-ocl'></i><a class='jstree-anchor' role='treeitem' href='#'><i class='jstree-icon jstree-themeicon-hidden'></i>"+this.get_string("Loading ...")+"</a></li></ul>"),this.element.attr("aria-activedescendant","j"+this._id+"_loading")),this.load_node(E.jstree.root,function(e,t){t&&(this.get_container_ul()[0].className=r,this._firstChild(this.get_container_ul()[0])&&this.element.attr("aria-activedescendant",this._firstChild(this.get_container_ul()[0]).id),this.set_state(E.extend(!0,{},this._data.core.state),function(){this.trigger("refresh")})),this._data.core.state=null})},refresh_node:function(t){if(!(t=this.get_node(t))||t.id===E.jstree.root)return!1;var r=[],e=[],i=this._data.core.selected.concat([]);e.push(t.id),!0===t.state.opened&&r.push(t.id),this.get_node(t,!0).find(".jstree-open").each(function(){e.push(this.id),r.push(this.id)}),this._load_nodes(e,E.proxy(function(e){this.open_node(r,!1,0),this.select_node(i),this.trigger("refresh_node",{node:t,nodes:e})},this),!1,!0)},set_id:function(e,t){if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;var r,i,s=this._model.data,a=e.id;for(t=t.toString(),s[e.parent].children[E.inArray(e.id,s[e.parent].children)]=t,r=0,i=e.parents.length;r<i;r++)s[e.parents[r]].children_d[E.inArray(e.id,s[e.parents[r]].children_d)]=t;for(r=0,i=e.children.length;r<i;r++)s[e.children[r]].parent=t;for(r=0,i=e.children_d.length;r<i;r++)s[e.children_d[r]].parents[E.inArray(e.id,s[e.children_d[r]].parents)]=t;return-1!==(r=E.inArray(e.id,this._data.core.selected))&&(this._data.core.selected[r]=t),(r=this.get_node(e.id,!0))&&(r.attr("id",t),this.element.attr("aria-activedescendant")===e.id&&this.element.attr("aria-activedescendant",t)),delete s[e.id],e.id=t,s[e.li_attr.id=t]=e,this.trigger("set_id",{node:e,new:e.id,old:a}),!0},get_text:function(e){return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&e.text},set_text:function(e,t){var r,i;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.set_text(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&(e.text=t,this.get_node(e,!0).length&&this.redraw_node(e.id),this.trigger("set_text",{obj:e,text:t}),!0)},get_json:function(e,t,r){if(!(e=this.get_node(e||E.jstree.root)))return!1;t&&t.flat&&!r&&(r=[]);var i,s,a={id:e.id,text:e.text,icon:this.get_icon(e),li_attr:E.extend(!0,{},e.li_attr),a_attr:E.extend(!0,{},e.a_attr),state:{},data:(!t||!t.no_data)&&E.extend(!0,Array.isArray(e.data)?[]:{},e.data)};if(t&&t.flat?a.parent=e.parent:a.children=[],t&&t.no_state)delete a.state;else for(i in e.state)e.state.hasOwnProperty(i)&&(a.state[i]=e.state[i]);if(t&&t.no_li_attr&&delete a.li_attr,t&&t.no_a_attr&&delete a.a_attr,t&&t.no_id&&(delete a.id,a.li_attr&&a.li_attr.id&&delete a.li_attr.id,a.a_attr&&a.a_attr.id&&delete a.a_attr.id),t&&t.flat&&e.id!==E.jstree.root&&r.push(a),!t||!t.no_children)for(i=0,s=e.children.length;i<s;i++)t&&t.flat?this.get_json(e.children[i],t,r):a.children.push(this.get_json(e.children[i],t));return t&&t.flat?r:e.id===E.jstree.root?a.children:a},create_node:function(e,t,r,i,s){if(null===e&&(e=E.jstree.root),!(e=this.get_node(e)))return!1;if(!(r=r===P?"last":r).toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(e))return this.load_node(e,function(){this.create_node(e,t,r,i,!0)});var a,n,o,d;switch((t="string"==typeof(t=t||{text:this.get_string("New node")})?{text:t}:E.extend(!0,{},t)).text===P&&(t.text=this.get_string("New node")),e.id===E.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":a=this.get_node(e.parent),r=E.inArray(e.id,a.children),e=a;break;case"after":a=this.get_node(e.parent),r=E.inArray(e.id,a.children)+1,e=a;break;case"inside":case"first":r=0;break;case"last":r=e.children.length;break;default:r=r||0}if(r>e.children.length&&(r=e.children.length),t.id||(t.id=!0),!this.check("create_node",t,e,r))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!0===t.id&&delete t.id,!(t=this._parse_model_from_json(t,e.id,e.parents.concat())))return!1;for(a=this.get_node(t),(n=[]).push(t),n=n.concat(a.children_d),this.trigger("model",{nodes:n,parent:e.id}),e.children_d=e.children_d.concat(n),o=0,d=e.parents.length;o<d;o++)this._model.data[e.parents[o]].children_d=this._model.data[e.parents[o]].children_d.concat(n);for(t=a,a=[],o=0,d=e.children.length;o<d;o++)a[r<=o?o+1:o]=e.children[o];return a[r]=t.id,e.children=a,this.redraw_node(e,!0),this.trigger("create_node",{node:this.get_node(t),parent:e.id,position:r}),i&&i.call(this,this.get_node(t)),t.id},rename_node:function(e,t){var r,i,s;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.rename_node(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&(s=e.text,this.check("rename_node",e,this.get_parent(e),t)?(this.set_text(e,t),this.trigger("rename_node",{node:e,text:t,old:s}),!0):(this.settings.core.error.call(this,this._data.core.last_error),!1))},delete_node:function(e){var t,r,i,s,a,n,o,d,c,l,h,_;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.delete_node(e[t]);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;if(i=this.get_node(e.parent),s=E.inArray(e.id,i.children),l=!1,!this.check("delete_node",e,i,s))return this.settings.core.error.call(this,this._data.core.last_error),!1;for(-1!==s&&(i.children=E.vakata.array_remove(i.children,s)),(a=e.children_d.concat([])).push(e.id),n=0,o=e.parents.length;n<o;n++)this._model.data[e.parents[n]].children_d=E.vakata.array_filter(this._model.data[e.parents[n]].children_d,function(e){return-1===E.inArray(e,a)});for(d=0,c=a.length;d<c;d++)if(this._model.data[a[d]].state.selected){l=!0;break}for(l&&(this._data.core.selected=E.vakata.array_filter(this._data.core.selected,function(e){return-1===E.inArray(e,a)})),this.trigger("delete_node",{node:e,parent:i.id}),l&&this.trigger("changed",{action:"delete_node",node:e,selected:this._data.core.selected,parent:i.id}),d=0,c=a.length;d<c;d++)delete this._model.data[a[d]];return-1!==E.inArray(this._data.core.focused,a)&&(this._data.core.focused=null,h=this.element[0].scrollTop,_=this.element[0].scrollLeft,i.id===E.jstree.root?this._model.data[E.jstree.root].children[0]&&this.get_node(this._model.data[E.jstree.root].children[0],!0).children(".jstree-anchor").focus():this.get_node(i,!0).children(".jstree-anchor").focus(),this.element[0].scrollTop=h,this.element[0].scrollLeft=_),this.redraw_node(i,!0),!0},check:function(e,t,r,i,s){t=t&&t.id?t:this.get_node(t),r=r&&r.id?r:this.get_node(r);var a=e.match(/^move_node|copy_node|create_node$/i)?r:t,n=this.settings.core.check_callback;if("move_node"===e||"copy_node"===e){if(!(s&&s.is_multi||"move_node"!==e||E.inArray(t.id,r.children)!==i))return!(this._data.core.last_error={error:"check",plugin:"core",id:"core_08",reason:"Moving node to its current position",data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});if(!(s&&s.is_multi||t.id!==r.id&&("move_node"!==e||E.inArray(t.id,r.children)!==i)&&-1===E.inArray(r.id,t.children_d)))return!(this._data.core.last_error={error:"check",plugin:"core",id:"core_01",reason:"Moving parent inside child",data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})})}return a&&a.data&&(a=a.data),a&&a.functions&&(!1===a.functions[e]||!0===a.functions[e])?(!1===a.functions[e]&&(this._data.core.last_error={error:"check",plugin:"core",id:"core_02",reason:"Node data prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),a.functions[e]):!(!1===n||"function"==typeof n&&!1===n.call(this,e,t,r,i,s)||n&&!1===n[e])||!(this._data.core.last_error={error:"check",plugin:"core",id:"core_03",reason:"User config for core.check_callback prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})})},last_error:function(){return this._data.core.last_error},move_node:function(e,t,r,i,s,a,n){var o,d,c,l,h,_,u,g,f,p,m,v,j,y;if(t=this.get_node(t),r=r===P?0:r,!t)return!1;if(!r.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(t))return this.load_node(t,function(){this.move_node(e,t,r,i,!0,!1,n)});if(Array.isArray(e)){if(1!==e.length){for(o=0,d=e.length;o<d;o++)(f=this.move_node(e[o],t,r,i,s,!1,n))&&(t=f,r="after");return this.redraw(),!0}e=e[0]}if(!(e=e&&e.id?e:this.get_node(e))||e.id===E.jstree.root)return!1;if(c=(e.parent||E.jstree.root).toString(),h=r.toString().match(/^(before|after)$/)&&t.id!==E.jstree.root?this.get_node(t.parent):t,u=!(_=n||(this._model.data[e.id]?this:E.jstree.reference(e.id)))||!_._id||this._id!==_._id,l=_&&_._id&&c&&_._model.data[c]&&_._model.data[c].children?E.inArray(e.id,_._model.data[c].children):-1,_&&_._id&&(e=_._model.data[e.id]),u)return!!(f=this.copy_node(e,t,r,i,s,!1,n))&&(_&&_.delete_node(e),f);switch(t.id===E.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":r=E.inArray(t.id,h.children);break;case"after":r=E.inArray(t.id,h.children)+1;break;case"inside":case"first":r=0;break;case"last":r=h.children.length;break;default:r=r||0}if(r>h.children.length&&(r=h.children.length),!this.check("move_node",e,h,r,{core:!0,origin:n,is_multi:_&&_._id&&_._id!==this._id,is_foreign:!_||!_._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(e.parent===h.id){for(g=h.children.concat(),-1!==(f=E.inArray(e.id,g))&&(g=E.vakata.array_remove(g,f),f<r&&r--),f=[],p=0,m=g.length;p<m;p++)f[r<=p?p+1:p]=g[p];f[r]=e.id,h.children=f,this._node_changed(h.id),this.redraw(h.id===E.jstree.root)}else{for((f=e.children_d.concat()).push(e.id),p=0,m=e.parents.length;p<m;p++){for(g=[],v=0,j=(y=_._model.data[e.parents[p]].children_d).length;v<j;v++)-1===E.inArray(y[v],f)&&g.push(y[v]);_._model.data[e.parents[p]].children_d=g}for(_._model.data[c].children=E.vakata.array_remove_item(_._model.data[c].children,e.id),p=0,m=h.parents.length;p<m;p++)this._model.data[h.parents[p]].children_d=this._model.data[h.parents[p]].children_d.concat(f);for(g=[],p=0,m=h.children.length;p<m;p++)g[r<=p?p+1:p]=h.children[p];for(g[r]=e.id,h.children=g,h.children_d.push(e.id),h.children_d=h.children_d.concat(e.children_d),e.parent=h.id,(f=h.parents.concat()).unshift(h.id),y=e.parents.length,f=(e.parents=f).concat(),p=0,m=e.children_d.length;p<m;p++)this._model.data[e.children_d[p]].parents=this._model.data[e.children_d[p]].parents.slice(0,-1*y),Array.prototype.push.apply(this._model.data[e.children_d[p]].parents,f);c!==E.jstree.root&&h.id!==E.jstree.root||(this._model.force_full_redraw=!0),this._model.force_full_redraw||(this._node_changed(c),this._node_changed(h.id)),a||this.redraw()}return i&&i.call(this,e,h,r),this.trigger("move_node",{node:e,parent:h.id,position:r,old_parent:c,old_position:l,is_multi:_&&_._id&&_._id!==this._id,is_foreign:!_||!_._id,old_instance:_,new_instance:this}),e.id},copy_node:function(e,t,r,i,s,a,n){var o,d,c,l,h,_,u,g,f,p;if(t=this.get_node(t),r=r===P?0:r,!t)return!1;if(!r.toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(t))return this.load_node(t,function(){this.copy_node(e,t,r,i,!0,!1,n)});if(Array.isArray(e)){if(1!==e.length){for(o=0,d=e.length;o<d;o++)(l=this.copy_node(e[o],t,r,i,s,!0,n))&&(t=l,r="after");return this.redraw(),!0}e=e[0]}if(!(e=e&&e.id?e:this.get_node(e))||e.id===E.jstree.root)return!1;switch(g=(e.parent||E.jstree.root).toString(),f=r.toString().match(/^(before|after)$/)&&t.id!==E.jstree.root?this.get_node(t.parent):t,(p=n||(this._model.data[e.id]?this:E.jstree.reference(e.id)))&&p._id&&(this._id,p._id),p&&p._id&&(e=p._model.data[e.id]),t.id===E.jstree.root&&("before"===r&&(r="first"),"after"===r&&(r="last")),r){case"before":r=E.inArray(t.id,f.children);break;case"after":r=E.inArray(t.id,f.children)+1;break;case"inside":case"first":r=0;break;case"last":r=f.children.length;break;default:r=r||0}if(r>f.children.length&&(r=f.children.length),!this.check("copy_node",e,f,r,{core:!0,origin:n,is_multi:p&&p._id&&p._id!==this._id,is_foreign:!p||!p._id}))return this.settings.core.error.call(this,this._data.core.last_error),!1;if(!(u=p?p.get_json(e,{no_id:!0,no_data:!0,no_state:!0}):e))return!1;if(!0===u.id&&delete u.id,!(u=this._parse_model_from_json(u,f.id,f.parents.concat())))return!1;for(l=this.get_node(u),e&&e.state&&!1===e.state.loaded&&(l.state.loaded=!1),(c=[]).push(u),c=c.concat(l.children_d),this.trigger("model",{nodes:c,parent:f.id}),h=0,_=f.parents.length;h<_;h++)this._model.data[f.parents[h]].children_d=this._model.data[f.parents[h]].children_d.concat(c);for(c=[],h=0,_=f.children.length;h<_;h++)c[r<=h?h+1:h]=f.children[h];return c[r]=l.id,f.children=c,f.children_d.push(l.id),f.children_d=f.children_d.concat(l.children_d),f.id===E.jstree.root&&(this._model.force_full_redraw=!0),this._model.force_full_redraw||this._node_changed(f.id),a||this.redraw(f.id===E.jstree.root),i&&i.call(this,l,f,r),this.trigger("copy_node",{node:l,original:e,parent:f.id,position:r,old_parent:g,old_position:p&&p._id&&g&&p._model.data[g]&&p._model.data[g].children?E.inArray(e.id,p._model.data[g].children):-1,is_multi:p&&p._id&&p._id!==this._id,is_foreign:!p||!p._id,old_instance:p,new_instance:this}),l.id},cut:function(e){if(e=e||this._data.core.selected.concat(),Array.isArray(e)||(e=[e]),!e.length)return!1;for(var t,r=[],i=0,s=e.length;i<s;i++)(t=this.get_node(e[i]))&&t.id&&t.id!==E.jstree.root&&r.push(t);if(!r.length)return!1;a=r,n="move_node",(o=this).trigger("cut",{node:e})},copy:function(e){if(e=e||this._data.core.selected.concat(),Array.isArray(e)||(e=[e]),!e.length)return!1;for(var t,r=[],i=0,s=e.length;i<s;i++)(t=this.get_node(e[i]))&&t.id&&t.id!==E.jstree.root&&r.push(t);if(!r.length)return!1;a=r,n="copy_node",(o=this).trigger("copy",{node:e})},get_buffer:function(){return{mode:n,node:a,inst:o}},can_paste:function(){return!1!==n&&!1!==a},paste:function(e,t){if(!((e=this.get_node(e))&&n&&n.match(/^(copy_node|move_node)$/)&&a))return!1;this[n](a,e,t,!1,!1,!1,o)&&this.trigger("paste",{parent:e.id,node:a,mode:n}),o=n=a=!1},clear_buffer:function(){o=n=a=!1,this.trigger("clear_buffer")},edit:function(s,e,a){var t,r,n,o,d,c,l,i,h,_=!1;return!!(s=this.get_node(s))&&(this.check("edit",s,this.get_parent(s))?(h=s,e="string"==typeof e?e:s.text,this.set_text(s,""),s=this._open_to(s),h.text=e,t=this._data.core.rtl,r=this.element.width(),this._data.core.focused=h.id,n=s.children(".jstree-anchor").focus(),o=E("<span></span>"),d=e,c=E("<div></div>",{css:{position:"absolute",top:"-200px",left:t?"0px":"-1000px",visibility:"hidden"}}).appendTo(y.body),l=E("<input />",{value:d,class:"jstree-rename-input",css:{padding:"0",border:"1px solid silver","box-sizing":"border-box",display:"inline-block",height:this._data.core.li_height+"px",lineHeight:this._data.core.li_height+"px",width:"150px"},blur:E.proxy(function(e){e.stopImmediatePropagation(),e.preventDefault();var t,r=o.children(".jstree-rename-input").val(),i=this.settings.core.force_text;""===r&&(r=d),c.remove(),o.replaceWith(n),o.remove(),d=i?d:E("<div></div>").append(E.parseHTML(d)).html(),s=this.get_node(s),this.set_text(s,d),(t=!!this.rename_node(s,i?E("<div></div>").text(r).text():E("<div></div>").append(E.parseHTML(r)).html()))||this.set_text(s,d),this._data.core.focused=h.id,setTimeout(E.proxy(function(){var e=this.get_node(h.id,!0);e.length&&(this._data.core.focused=h.id,e.children(".jstree-anchor").focus())},this),0),a&&a.call(this,h,t,_),l=null},this),keydown:function(e){var t=e.which;27===t&&(_=!0,this.value=d),27!==t&&13!==t&&37!==t&&38!==t&&39!==t&&40!==t&&32!==t||e.stopImmediatePropagation(),27!==t&&13!==t||(e.preventDefault(),this.blur())},click:function(e){e.stopImmediatePropagation()},mousedown:function(e){e.stopImmediatePropagation()},keyup:function(e){l.width(Math.min(c.text("pW"+this.value).width(),r))},keypress:function(e){if(13===e.which)return!1}}),i={fontFamily:n.css("fontFamily")||"",fontSize:n.css("fontSize")||"",fontWeight:n.css("fontWeight")||"",fontStyle:n.css("fontStyle")||"",fontStretch:n.css("fontStretch")||"",fontVariant:n.css("fontVariant")||"",letterSpacing:n.css("letterSpacing")||"",wordSpacing:n.css("wordSpacing")||""},o.attr("class",n.attr("class")).append(n.contents().clone()).append(l),n.replaceWith(o),c.css(i),l.css(i).width(Math.min(c.text("pW"+l[0].value).width(),r))[0].select(),void E(y).one("mousedown.jstree touchstart.jstree dnd_start.vakata",function(e){l&&e.target!==l&&E(l).trigger("blur")})):(this.settings.core.error.call(this,this._data.core.last_error),!1))},set_theme:function(e,t){if(!e)return!1;!0===t&&(t=(this.settings.core.themes.dir||E.jstree.path+"/themes")+"/"+e+"/style.css"),t&&-1===E.inArray(t,r)&&(E("head").append('<link rel="stylesheet" href="'+t+'" type="text/css" />'),r.push(t)),this._data.core.themes.name&&this.element.removeClass("jstree-"+this._data.core.themes.name),this._data.core.themes.name=e,this.element.addClass("jstree-"+e),this.element[this.settings.core.themes.responsive?"addClass":"removeClass"]("jstree-"+e+"-responsive"),this.trigger("set_theme",{theme:e})},get_theme:function(){return this._data.core.themes.name},set_theme_variant:function(e){this._data.core.themes.variant&&this.element.removeClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant),(this._data.core.themes.variant=e)&&this.element.addClass("jstree-"+this._data.core.themes.name+"-"+this._data.core.themes.variant)},get_theme_variant:function(){return this._data.core.themes.variant},show_stripes:function(){this._data.core.themes.stripes=!0,this.get_container_ul().addClass("jstree-striped"),this.trigger("show_stripes")},hide_stripes:function(){this._data.core.themes.stripes=!1,this.get_container_ul().removeClass("jstree-striped"),this.trigger("hide_stripes")},toggle_stripes:function(){this._data.core.themes.stripes?this.hide_stripes():this.show_stripes()},show_dots:function(){this._data.core.themes.dots=!0,this.get_container_ul().removeClass("jstree-no-dots"),this.trigger("show_dots")},hide_dots:function(){this._data.core.themes.dots=!1,this.get_container_ul().addClass("jstree-no-dots"),this.trigger("hide_dots")},toggle_dots:function(){this._data.core.themes.dots?this.hide_dots():this.show_dots()},show_icons:function(){this._data.core.themes.icons=!0,this.get_container_ul().removeClass("jstree-no-icons"),this.trigger("show_icons")},hide_icons:function(){this._data.core.themes.icons=!1,this.get_container_ul().addClass("jstree-no-icons"),this.trigger("hide_icons")},toggle_icons:function(){this._data.core.themes.icons?this.hide_icons():this.show_icons()},show_ellipsis:function(){this._data.core.themes.ellipsis=!0,this.get_container_ul().addClass("jstree-ellipsis"),this.trigger("show_ellipsis")},hide_ellipsis:function(){this._data.core.themes.ellipsis=!1,this.get_container_ul().removeClass("jstree-ellipsis"),this.trigger("hide_ellipsis")},toggle_ellipsis:function(){this._data.core.themes.ellipsis?this.hide_ellipsis():this.show_ellipsis()},set_icon:function(e,t){var r,i,s,a;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.set_icon(e[r],t);return!0}return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&(a=e.icon,e.icon=!0===t||null===t||t===P||""===t||t,s=this.get_node(e,!0).children(".jstree-anchor").children(".jstree-themeicon"),!1===t?(s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"),this.hide_icon(e)):(!0===t||null===t||t===P||""===t?s.removeClass("jstree-themeicon-custom "+a).css("background","").removeAttr("rel"):-1===t.indexOf("/")&&-1===t.indexOf(".")?(s.removeClass(a).css("background",""),s.addClass(t+" jstree-themeicon-custom").attr("rel",t)):(s.removeClass(a).css("background",""),s.addClass("jstree-themeicon-custom").css("background","url('"+t+"') center center no-repeat").attr("rel",t)),!1===a&&this.show_icon(e)),!0)},get_icon:function(e){return!(!(e=this.get_node(e))||e.id===E.jstree.root)&&e.icon},hide_icon:function(e){var t,r;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.hide_icon(e[t]);return!0}return!(!(e=this.get_node(e))||e===E.jstree.root)&&(e.icon=!1,this.get_node(e,!0).children(".jstree-anchor").children(".jstree-themeicon").addClass("jstree-themeicon-hidden"),!0)},show_icon:function(e){var t,r,i;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.show_icon(e[t]);return!0}return!(!(e=this.get_node(e))||e===E.jstree.root)&&(i=this.get_node(e,!0),e.icon=!i.length||i.children(".jstree-anchor").children(".jstree-themeicon").attr("rel"),e.icon||(e.icon=!0),i.children(".jstree-anchor").children(".jstree-themeicon").removeClass("jstree-themeicon-hidden"),!0)}},E.vakata={},E.vakata.attributes=function(e,r){e=E(e)[0];var i=r?{}:[];return e&&e.attributes&&E.each(e.attributes,function(e,t){-1===E.inArray(t.name.toLowerCase(),["style","contenteditable","hasfocus","tabindex"])&&null!==t.value&&""!==t.value.trim()&&(r?i[t.name]=t.value:i.push(t.name))}),i},E.vakata.array_unique=function(e){for(var t=[],r={},i=0,s=e.length;i<s;i++)r[e[i]]===P&&(t.push(e[i]),r[e[i]]=!0);return t},E.vakata.array_remove=function(e,t){return e.splice(t,1),e},E.vakata.array_remove_item=function(e,t){var r=E.inArray(t,e);return-1!==r?E.vakata.array_remove(e,r):e},E.vakata.array_filter=function(e,t,r,i,s){if(e.filter)return e.filter(t,r);for(s in i=[],e)~~s+""==s+""&&0<=s&&t.call(r,e[s],+s,e)&&i.push(e[s]);return i},E.jstree.plugins.changed=function(e,a){var n=[];this.trigger=function(e,t){if(t=t||{},"changed"===e.replace(".jstree","")){t.changed={selected:[],deselected:[]};for(var r={},i=0,s=n.length;i<s;i++)r[n[i]]=1;for(i=0,s=t.selected.length;i<s;i++)r[t.selected[i]]?r[t.selected[i]]=2:t.changed.selected.push(t.selected[i]);for(i=0,s=n.length;i<s;i++)1===r[n[i]]&&t.changed.deselected.push(n[i]);n=t.selected.slice()}a.trigger.call(this,e,t)},this.refresh=function(e,t){return n=[],a.refresh.apply(this,arguments)}};var h,_,u,d,l,g,f,w,p=y.createElement("I");p.className="jstree-icon jstree-checkbox",p.setAttribute("role","presentation"),E.jstree.defaults.checkbox={visible:!0,three_state:!0,whole_node:!0,keep_selected_style:!0,cascade:"",tie_selection:!0,cascade_to_disabled:!0,cascade_to_hidden:!0},E.jstree.plugins.checkbox=function(e,d){this.bind=function(){d.bind.call(this),this._data.checkbox.uto=!1,this._data.checkbox.selected=[],this.settings.checkbox.three_state&&(this.settings.checkbox.cascade="up+down+undetermined"),this.element.on("init.jstree",E.proxy(function(){this._data.checkbox.visible=this.settings.checkbox.visible,this.settings.checkbox.keep_selected_style||this.element.addClass("jstree-checkbox-no-clicked"),this.settings.checkbox.tie_selection&&this.element.addClass("jstree-checkbox-selection")},this)).on("loading.jstree",E.proxy(function(){this[this._data.checkbox.visible?"show_checkboxes":"hide_checkboxes"]()},this)),-1!==this.settings.checkbox.cascade.indexOf("undetermined")&&this.element.on("changed.jstree uncheck_node.jstree check_node.jstree uncheck_all.jstree check_all.jstree move_node.jstree copy_node.jstree redraw.jstree open_node.jstree",E.proxy(function(){this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(E.proxy(this._undetermined,this),50)},this)),this.settings.checkbox.tie_selection||this.element.on("model.jstree",E.proxy(function(e,t){for(var r=this._model.data,i=(r[t.parent],t.nodes),s=0,a=i.length;s<a;s++)r[i[s]].state.checked=r[i[s]].state.checked||r[i[s]].original&&r[i[s]].original.state&&r[i[s]].original.state.checked,r[i[s]].state.checked&&this._data.checkbox.selected.push(i[s])},this)),-1===this.settings.checkbox.cascade.indexOf("up")&&-1===this.settings.checkbox.cascade.indexOf("down")||this.element.on("model.jstree",E.proxy(function(e,t){var r,i,s,a,n,o,d=this._model.data,c=d[t.parent],l=t.nodes,h=[],_=this.settings.checkbox.cascade,u=this.settings.checkbox.tie_selection;if(-1!==_.indexOf("down"))if(c.state[u?"selected":"checked"]){for(i=0,s=l.length;i<s;i++)d[l[i]].state[u?"selected":"checked"]=!0;this._data[u?"core":"checkbox"].selected=this._data[u?"core":"checkbox"].selected.concat(l)}else for(i=0,s=l.length;i<s;i++)if(d[l[i]].state[u?"selected":"checked"]){for(a=0,n=d[l[i]].children_d.length;a<n;a++)d[d[l[i]].children_d[a]].state[u?"selected":"checked"]=!0;this._data[u?"core":"checkbox"].selected=this._data[u?"core":"checkbox"].selected.concat(d[l[i]].children_d)}if(-1!==_.indexOf("up")){for(i=0,s=c.children_d.length;i<s;i++)d[c.children_d[i]].children.length||h.push(d[c.children_d[i]].parent);for(a=0,n=(h=E.vakata.array_unique(h)).length;a<n;a++)for(c=d[h[a]];c&&c.id!==E.jstree.root;){for(i=r=0,s=c.children.length;i<s;i++)r+=d[c.children[i]].state[u?"selected":"checked"];if(r!==s)break;c.state[u?"selected":"checked"]=!0,this._data[u?"core":"checkbox"].selected.push(c.id),(o=this.get_node(c,!0))&&o.length&&o.attr("aria-selected",!0).children(".jstree-anchor").addClass(u?"jstree-clicked":"jstree-checked"),c=this.get_node(c.parent)}}this._data[u?"core":"checkbox"].selected=E.vakata.array_unique(this._data[u?"core":"checkbox"].selected)},this)).on(this.settings.checkbox.tie_selection?"select_node.jstree":"check_node.jstree",E.proxy(function(e,t){var r,i,s=t.node,a=this._model.data,n=this.get_node(s.parent),o=this.settings.checkbox.cascade,d=this.settings.checkbox.tie_selection,c={},l=this._data[d?"core":"checkbox"].selected;for(u=0,g=l.length;u<g;u++)c[l[u]]=!0;if(-1!==o.indexOf("down"))for(var h=this._cascade_new_checked_state(s.id,!0),_=s.children_d.concat(s.id),u=0,g=_.length;u<g;u++)-1<h.indexOf(_[u])?c[_[u]]=!0:delete c[_[u]];if(-1!==o.indexOf("up"))for(;n&&n.id!==E.jstree.root;){for(u=r=0,g=n.children.length;u<g;u++)r+=a[n.children[u]].state[d?"selected":"checked"];if(r!==g)break;n.state[d?"selected":"checked"]=!0,c[n.id]=!0,(i=this.get_node(n,!0))&&i.length&&i.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),n=this.get_node(n.parent)}for(u in l=[],c)c.hasOwnProperty(u)&&l.push(u);this._data[d?"core":"checkbox"].selected=l},this)).on(this.settings.checkbox.tie_selection?"deselect_all.jstree":"uncheck_all.jstree",E.proxy(function(e,t){for(var r,i=this.get_node(E.jstree.root),s=this._model.data,a=0,n=i.children_d.length;a<n;a++)(r=s[i.children_d[a]])&&r.original&&r.original.state&&r.original.state.undetermined&&(r.original.state.undetermined=!1)},this)).on(this.settings.checkbox.tie_selection?"deselect_node.jstree":"uncheck_node.jstree",E.proxy(function(e,t){var r,i,s,a,n=t.node,o=(this.get_node(n,!0),this.settings.checkbox.cascade),d=this.settings.checkbox.tie_selection,c=this._data[d?"core":"checkbox"].selected,l=n.children_d.concat(n.id);if(-1!==o.indexOf("down")&&(a=this._cascade_new_checked_state(n.id,!1),c=E.vakata.array_filter(c,function(e){return-1===l.indexOf(e)||-1<a.indexOf(e)})),-1!==o.indexOf("up")&&-1===c.indexOf(n.id)){for(r=0,i=n.parents.length;r<i;r++)(s=this._model.data[n.parents[r]]).state[d?"selected":"checked"]=!1,s&&s.original&&s.original.state&&s.original.state.undetermined&&(s.original.state.undetermined=!1),(s=this.get_node(n.parents[r],!0))&&s.length&&s.attr("aria-selected",!1).children(".jstree-anchor").removeClass(d?"jstree-clicked":"jstree-checked");c=E.vakata.array_filter(c,function(e){return-1===n.parents.indexOf(e)})}this._data[d?"core":"checkbox"].selected=c},this)),-1!==this.settings.checkbox.cascade.indexOf("up")&&this.element.on("delete_node.jstree",E.proxy(function(e,t){for(var r,i,s,a,n=this.get_node(t.parent),o=this._model.data,d=this.settings.checkbox.tie_selection;n&&n.id!==E.jstree.root&&!n.state[d?"selected":"checked"];){for(r=s=0,i=n.children.length;r<i;r++)s+=o[n.children[r]].state[d?"selected":"checked"];if(!(0<i&&s===i))break;n.state[d?"selected":"checked"]=!0,this._data[d?"core":"checkbox"].selected.push(n.id),(a=this.get_node(n,!0))&&a.length&&a.attr("aria-selected",!0).children(".jstree-anchor").addClass(d?"jstree-clicked":"jstree-checked"),n=this.get_node(n.parent)}},this)).on("move_node.jstree",E.proxy(function(e,t){var r,i,s,a,n,o=t.is_multi,d=t.old_parent,c=this.get_node(t.parent),l=this._model.data,h=this.settings.checkbox.tie_selection;if(!o)for(r=this.get_node(d);r&&r.id!==E.jstree.root&&!r.state[h?"selected":"checked"];){for(s=i=0,a=r.children.length;s<a;s++)i+=l[r.children[s]].state[h?"selected":"checked"];if(!(0<a&&i===a))break;r.state[h?"selected":"checked"]=!0,this._data[h?"core":"checkbox"].selected.push(r.id),(n=this.get_node(r,!0))&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"),r=this.get_node(r.parent)}for(r=c;r&&r.id!==E.jstree.root;){for(s=i=0,a=r.children.length;s<a;s++)i+=l[r.children[s]].state[h?"selected":"checked"];if(i===a)r.state[h?"selected":"checked"]||(r.state[h?"selected":"checked"]=!0,this._data[h?"core":"checkbox"].selected.push(r.id),(n=this.get_node(r,!0))&&n.length&&n.attr("aria-selected",!0).children(".jstree-anchor").addClass(h?"jstree-clicked":"jstree-checked"));else{if(!r.state[h?"selected":"checked"])break;r.state[h?"selected":"checked"]=!1,this._data[h?"core":"checkbox"].selected=E.vakata.array_remove_item(this._data[h?"core":"checkbox"].selected,r.id),(n=this.get_node(r,!0))&&n.length&&n.attr("aria-selected",!1).children(".jstree-anchor").removeClass(h?"jstree-clicked":"jstree-checked")}r=this.get_node(r.parent)}},this))},this.get_undetermined=function(e){if(-1===this.settings.checkbox.cascade.indexOf("undetermined"))return[];for(var r,i,s={},a=this._model.data,t=this.settings.checkbox.tie_selection,n=this._data[t?"core":"checkbox"].selected,o=[],d=this,c=[],l=0,h=n.length;l<h;l++)if(a[n[l]]&&a[n[l]].parents)for(r=0,i=a[n[l]].parents.length;r<i&&s[a[n[l]].parents[r]]===P;r++)a[n[l]].parents[r]!==E.jstree.root&&(s[a[n[l]].parents[r]]=!0,o.push(a[n[l]].parents[r]));for(this.element.find(".jstree-closed").not(":has(.jstree-children)").each(function(){var e,t=d.get_node(this);if(t)if(t.state.loaded){for(l=0,h=t.children_d.length;l<h;l++)if(!(e=a[t.children_d[l]]).state.loaded&&e.original&&e.original.state&&e.original.state.undetermined&&!0===e.original.state.undetermined)for(s[e.id]===P&&e.id!==E.jstree.root&&(s[e.id]=!0,o.push(e.id)),r=0,i=e.parents.length;r<i;r++)s[e.parents[r]]===P&&e.parents[r]!==E.jstree.root&&(s[e.parents[r]]=!0,o.push(e.parents[r]))}else if(t.original&&t.original.state&&t.original.state.undetermined&&!0===t.original.state.undetermined)for(s[t.id]===P&&t.id!==E.jstree.root&&(s[t.id]=!0,o.push(t.id)),r=0,i=t.parents.length;r<i;r++)s[t.parents[r]]===P&&t.parents[r]!==E.jstree.root&&(s[t.parents[r]]=!0,o.push(t.parents[r]))}),l=0,h=o.length;l<h;l++)a[o[l]].state[t?"selected":"checked"]||c.push(e?a[o[l]]:o[l]);return c},this._undetermined=function(){if(null!==this.element){var e,t,r,i=this.get_undetermined(!1);for(this.element.find(".jstree-undetermined").removeClass("jstree-undetermined"),e=0,t=i.length;e<t;e++)(r=this.get_node(i[e],!0))&&r.length&&r.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-undetermined")}},this.redraw_node=function(e,t,r,i){if(e=d.redraw_node.apply(this,arguments)){for(var s=null,a=null,n=0,o=e.childNodes.length;n<o;n++)if(e.childNodes[n]&&e.childNodes[n].className&&-1!==e.childNodes[n].className.indexOf("jstree-anchor")){s=e.childNodes[n];break}s&&(!this.settings.checkbox.tie_selection&&this._model.data[e.id].state.checked&&(s.className+=" jstree-checked"),a=p.cloneNode(!1),this._model.data[e.id].state.checkbox_disabled&&(a.className+=" jstree-checkbox-disabled"),s.insertBefore(a,s.childNodes[0]))}return r||-1===this.settings.checkbox.cascade.indexOf("undetermined")||(this._data.checkbox.uto&&clearTimeout(this._data.checkbox.uto),this._data.checkbox.uto=setTimeout(E.proxy(this._undetermined,this),50)),e},this.show_checkboxes=function(){this._data.core.themes.checkboxes=!0,this.get_container_ul().removeClass("jstree-no-checkboxes")},this.hide_checkboxes=function(){this._data.core.themes.checkboxes=!1,this.get_container_ul().addClass("jstree-no-checkboxes")},this.toggle_checkboxes=function(){this._data.core.themes.checkboxes?this.hide_checkboxes():this.show_checkboxes()},this.is_undetermined=function(e){e=this.get_node(e);var t,r,i=this.settings.checkbox.cascade,s=this.settings.checkbox.tie_selection,a=this._data[s?"core":"checkbox"].selected,n=this._model.data;if(!e||!0===e.state[s?"selected":"checked"]||-1===i.indexOf("undetermined")||-1===i.indexOf("down")&&-1===i.indexOf("up"))return!1;if(!e.state.loaded&&!0===e.original.state.undetermined)return!0;for(t=0,r=e.children_d.length;t<r;t++)if(-1!==E.inArray(e.children_d[t],a)||!n[e.children_d[t]].state.loaded&&n[e.children_d[t]].original.state.undetermined)return!0;return!1},this.disable_checkbox=function(e){var t,r,i;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.disable_checkbox(e[t]);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;i=this.get_node(e,!0),e.state.checkbox_disabled||(e.state.checkbox_disabled=!0,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").addClass("jstree-checkbox-disabled"),this.trigger("disable_checkbox",{node:e}))},this.enable_checkbox=function(e){var t,r,i;if(Array.isArray(e)){for(t=0,r=(e=e.slice()).length;t<r;t++)this.enable_checkbox(e[t]);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;i=this.get_node(e,!0),e.state.checkbox_disabled&&(e.state.checkbox_disabled=!1,i&&i.length&&i.children(".jstree-anchor").children(".jstree-checkbox").removeClass("jstree-checkbox-disabled"),this.trigger("enable_checkbox",{node:e}))},this.activate_node=function(e,t){return!E(t.target).hasClass("jstree-checkbox-disabled")&&(this.settings.checkbox.tie_selection&&(this.settings.checkbox.whole_node||E(t.target).hasClass("jstree-checkbox"))&&(t.ctrlKey=!0),this.settings.checkbox.tie_selection||!this.settings.checkbox.whole_node&&!E(t.target).hasClass("jstree-checkbox")?d.activate_node.call(this,e,t):!this.is_disabled(e)&&(this.is_checked(e)?this.uncheck_node(e,t):this.check_node(e,t),void this.trigger("activate_node",{node:this.get_node(e)})))},this._cascade_new_checked_state=function(e,t){var r,i,s=this.settings.checkbox.tie_selection,a=this._model.data[e],n=[],o=[];if(!this.settings.checkbox.cascade_to_disabled&&a.state.disabled||!this.settings.checkbox.cascade_to_hidden&&a.state.hidden)c=this.get_checked_descendants(e),a.state[s?"selected":"checked"]&&c.push(a.id),n=n.concat(c);else{if(a.children)for(r=0,i=a.children.length;r<i;r++){var d=a.children[r],c=this._cascade_new_checked_state(d,t),n=n.concat(c);-1<c.indexOf(d)&&o.push(d)}var l=this.get_node(a,!0),h=0<o.length&&o.length<a.children.length;a.original&&a.original.state&&a.original.state.undetermined&&(a.original.state.undetermined=h),!h&&t&&o.length===a.children.length?(a.state[s?"selected":"checked"]=t,n.push(a.id),l.attr("aria-selected",!0).children(".jstree-anchor").addClass(s?"jstree-clicked":"jstree-checked")):(a.state[s?"selected":"checked"]=!1,l.attr("aria-selected",!1).children(".jstree-anchor").removeClass(s?"jstree-clicked":"jstree-checked"))}return n},this.get_checked_descendants=function(e){var t=this,r=t.settings.checkbox.tie_selection,i=t._model.data[e];return E.vakata.array_filter(i.children_d,function(e){return t._model.data[e].state[r?"selected":"checked"]})},this.check_node=function(e,t){if(this.settings.checkbox.tie_selection)return this.select_node(e,!1,!0,t);var r,i,s;if(Array.isArray(e)){for(i=0,s=(e=e.slice()).length;i<s;i++)this.check_node(e[i],t);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;r=this.get_node(e,!0),e.state.checked||(e.state.checked=!0,this._data.checkbox.selected.push(e.id),r&&r.length&&r.children(".jstree-anchor").addClass("jstree-checked"),this.trigger("check_node",{node:e,selected:this._data.checkbox.selected,event:t}))},this.uncheck_node=function(e,t){if(this.settings.checkbox.tie_selection)return this.deselect_node(e,!1,t);var r,i,s;if(Array.isArray(e)){for(r=0,i=(e=e.slice()).length;r<i;r++)this.uncheck_node(e[r],t);return!0}if(!(e=this.get_node(e))||e.id===E.jstree.root)return!1;s=this.get_node(e,!0),e.state.checked&&(e.state.checked=!1,this._data.checkbox.selected=E.vakata.array_remove_item(this._data.checkbox.selected,e.id),s.length&&s.children(".jstree-anchor").removeClass("jstree-checked"),this.trigger("uncheck_node",{node:e,selected:this._data.checkbox.selected,event:t}))},this.check_all=function(){if(this.settings.checkbox.tie_selection)return this.select_all();var e,t;this._data.checkbox.selected.concat([]);for(this._data.checkbox.selected=this._model.data[E.jstree.root].children_d.concat(),e=0,t=this._data.checkbox.selected.length;e<t;e++)this._model.data[this._data.checkbox.selected[e]]&&(this._model.data[this._data.checkbox.selected[e]].state.checked=!0);this.redraw(!0),this.trigger("check_all",{selected:this._data.checkbox.selected})},this.uncheck_all=function(){if(this.settings.checkbox.tie_selection)return this.deselect_all();for(var e=this._data.checkbox.selected.concat([]),t=0,r=this._data.checkbox.selected.length;t<r;t++)this._model.data[this._data.checkbox.selected[t]]&&(this._model.data[this._data.checkbox.selected[t]].state.checked=!1);this._data.checkbox.selected=[],this.element.find(".jstree-checked").removeClass("jstree-checked"),this.trigger("uncheck_all",{selected:this._data.checkbox.selected,node:e})},this.is_checked=function(e){return this.settings.checkbox.tie_selection?this.is_selected(e):!(!(e=this.get_node(e))||e.id===E.jstree.root)&&e.state.checked},this.get_checked=function(e){return this.settings.checkbox.tie_selection?this.get_selected(e):e?E.map(this._data.checkbox.selected,E.proxy(function(e){return this.get_node(e)},this)):this._data.checkbox.selected.slice()},this.get_top_checked=function(e){if(this.settings.checkbox.tie_selection)return this.get_top_selected(e);for(var t,r,i=this.get_checked(!0),s={},a=0,n=i.length;a<n;a++)s[i[a].id]=i[a];for(a=0,n=i.length;a<n;a++)for(t=0,r=i[a].children_d.length;t<r;t++)s[i[a].children_d[t]]&&delete s[i[a].children_d[t]];for(a in i=[],s)s.hasOwnProperty(a)&&i.push(a);return e?E.map(i,E.proxy(function(e){return this.get_node(e)},this)):i},this.get_bottom_checked=function(e){if(this.settings.checkbox.tie_selection)return this.get_bottom_selected(e);for(var t=this.get_checked(!0),r=[],i=0,s=t.length;i<s;i++)t[i].children.length||r.push(t[i].id);return e?E.map(r,E.proxy(function(e){return this.get_node(e)},this)):r},this.load_node=function(e,t){var r,i,s;if(!Array.isArray(e)&&!this.settings.checkbox.tie_selection&&(s=this.get_node(e))&&s.state.loaded)for(r=0,i=s.children_d.length;r<i;r++)this._model.data[s.children_d[r]].state.checked&&(this._data.checkbox.selected=E.vakata.array_remove_item(this._data.checkbox.selected,s.children_d[r]));return d.load_node.apply(this,arguments)},this.get_state=function(){var e=d.get_state.apply(this,arguments);return this.settings.checkbox.tie_selection||(e.checkbox=this._data.checkbox.selected.slice()),e},this.set_state=function(e,t){var r,i=d.set_state.apply(this,arguments);return i&&e.checkbox?(this.settings.checkbox.tie_selection||(this.uncheck_all(),r=this,E.each(e.checkbox,function(e,t){r.check_node(t)})),delete e.checkbox,this.set_state(e,t),!1):i},this.refresh=function(e,t){return this.settings.checkbox.tie_selection&&(this._data.checkbox.selected=[]),d.refresh.apply(this,arguments)}},E.jstree.defaults.conditionalselect=function(){return!0},E.jstree.plugins.conditionalselect=function(e,r){this.activate_node=function(e,t){if(this.settings.conditionalselect.call(this,this.get_node(e),t))return r.activate_node.call(this,e,t)}},E.jstree.defaults.contextmenu={select_node:!0,show_at_node:!0,items:function(e,t){return{create:{separator_before:!1,separator_after:!0,_disabled:!1,label:"Create",action:function(e){var r=E.jstree.reference(e.reference),t=r.get_node(e.reference);r.create_node(t,{},"last",function(t){try{r.edit(t)}catch(e){setTimeout(function(){r.edit(t)},0)}})}},rename:{separator_before:!1,separator_after:!1,_disabled:!1,label:"Rename",action:function(e){var t=E.jstree.reference(e.reference),r=t.get_node(e.reference);t.edit(r)}},remove:{separator_before:!1,icon:!1,separator_after:!1,_disabled:!1,label:"Delete",action:function(e){var t=E.jstree.reference(e.reference),r=t.get_node(e.reference);t.is_selected(r)?t.delete_node(t.get_selected()):t.delete_node(r)}},ccp:{separator_before:!0,icon:!1,separator_after:!1,label:"Edit",action:!1,submenu:{cut:{separator_before:!1,separator_after:!1,label:"Cut",action:function(e){var t=E.jstree.reference(e.reference),r=t.get_node(e.reference);t.is_selected(r)?t.cut(t.get_top_selected()):t.cut(r)}},copy:{separator_before:!1,icon:!1,separator_after:!1,label:"Copy",action:function(e){var t=E.jstree.reference(e.reference),r=t.get_node(e.reference);t.is_selected(r)?t.copy(t.get_top_selected()):t.copy(r)}},paste:{separator_before:!1,icon:!1,_disabled:function(e){return!E.jstree.reference(e.reference).can_paste()},separator_after:!1,label:"Paste",action:function(e){var t=E.jstree.reference(e.reference),r=t.get_node(e.reference);t.paste(r)}}}}}}},E.jstree.plugins.contextmenu=function(e,a){this.bind=function(){a.bind.call(this);var t,r,i=0,s=null;this.element.on("init.jstree loading.jstree ready.jstree",E.proxy(function(){this.get_container_ul().addClass("jstree-contextmenu")},this)).on("contextmenu.jstree",".jstree-anchor",E.proxy(function(e,t){"input"!==e.target.tagName.toLowerCase()&&(e.preventDefault(),i=e.ctrlKey?+new Date:0,(t||s)&&(i=+new Date+1e4),s&&clearTimeout(s),this.is_loading(e.currentTarget)||this.show_contextmenu(e.currentTarget,e.pageX,e.pageY,e))},this)).on("click.jstree",".jstree-anchor",E.proxy(function(e){this._data.contextmenu.visible&&(!i||250<new Date-i)&&E.vakata.context.hide(),i=0},this)).on("touchstart.jstree",".jstree-anchor",function(e){e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(t=e.originalEvent.changedTouches[0].clientX,r=e.originalEvent.changedTouches[0].clientY,s=setTimeout(function(){E(e.currentTarget).trigger("contextmenu",!0)},750))}).on("touchmove.vakata.jstree",function(e){s&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(10<Math.abs(t-e.originalEvent.changedTouches[0].clientX)||10<Math.abs(r-e.originalEvent.changedTouches[0].clientY))&&(clearTimeout(s),E.vakata.context.hide())}).on("touchend.vakata.jstree",function(e){s&&clearTimeout(s)}),E(y).on("context_hide.vakata.jstree",E.proxy(function(e,t){this._data.contextmenu.visible=!1,E(t.reference).removeClass("jstree-context")},this))},this.teardown=function(){this._data.contextmenu.visible&&E.vakata.context.hide(),a.teardown.call(this)},this.show_contextmenu=function(t,r,i,e){if(!(t=this.get_node(t))||t.id===E.jstree.root)return!1;var s=this.settings.contextmenu,a=this.get_node(t,!0).children(".jstree-anchor"),n=!1,o=!1;!s.show_at_node&&r!==P&&i!==P||(n=a.offset(),r=n.left,i=n.top+this._data.core.li_height),this.settings.contextmenu.select_node&&!this.is_selected(t)&&this.activate_node(t,e),"function"==typeof(o=s.items)&&(o=o.call(this,t,E.proxy(function(e){this._show_contextmenu(t,r,i,e)},this))),E.isPlainObject(o)&&this._show_contextmenu(t,r,i,o)},this._show_contextmenu=function(e,t,r,i){var s=this.get_node(e,!0).children(".jstree-anchor");E(y).one("context_show.vakata.jstree",E.proxy(function(e,t){var r="jstree-contextmenu jstree-"+this.get_theme()+"-contextmenu";E(t.element).addClass(r),s.addClass("jstree-context")},this)),this._data.contextmenu.visible=!0,E.vakata.context.show(s,{x:t,y:r},i),this.trigger("show_contextmenu",{node:e,x:t,y:r})}},u={element:_=!1,reference:!1,position_x:0,position_y:0,items:[],html:"",is_visible:!1},(h=E).vakata.context={settings:{hide_onmouseleave:0,icons:!0},_trigger:function(e){h(y).triggerHandler("context_"+e+".vakata",{reference:u.reference,element:u.element,position:{x:u.position_x,y:u.position_y}})},_execute:function(e){return!(!(e=u.items[e])||e._disabled&&("function"!=typeof e._disabled||e._disabled({item:e,reference:u.reference,element:u.element}))||!e.action)&&e.action.call(null,{item:e,reference:u.reference,element:u.element,position:{x:u.position_x,y:u.position_y}})},_parse:function(e,t){if(!e)return!1;t||(u.html="",u.items=[]);var r,i="",s=!1;return t&&(i+="<ul>"),h.each(e,function(e,t){return!t||(u.items.push(t),!s&&t.separator_before&&(i+="<li class='vakata-context-separator'><a href='#' "+(h.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>"),s=!1,i+="<li class='"+(t._class||"")+(!0===t._disabled||"function"==typeof t._disabled&&t._disabled({item:t,reference:u.reference,element:u.element})?" vakata-contextmenu-disabled ":"")+"' "+(t.shortcut?" data-shortcut='"+t.shortcut+"' ":"")+">",i+="<a href='#' rel='"+(u.items.length-1)+"' "+(t.title?"title='"+t.title+"'":"")+">",h.vakata.context.settings.icons&&(i+="<i ",t.icon&&(-1!==t.icon.indexOf("/")||-1!==t.icon.indexOf(".")?i+=" style='background:url(\""+t.icon+"\") center center no-repeat' ":i+=" class='"+t.icon+"' "),i+="></i><span class='vakata-contextmenu-sep'>&#160;</span>"),i+=("function"==typeof t.label?t.label({item:e,reference:u.reference,element:u.element}):t.label)+(t.shortcut?' <span class="vakata-contextmenu-shortcut vakata-contextmenu-shortcut-'+t.shortcut+'">'+(t.shortcut_label||"")+"</span>":"")+"</a>",t.submenu&&(r=h.vakata.context._parse(t.submenu,!0))&&(i+=r),i+="</li>",void(t.separator_after&&(i+="<li class='vakata-context-separator'><a href='#' "+(h.vakata.context.settings.icons?"":'style="margin-left:0px;"')+">&#160;</a></li>",s=!0)))}),i=i.replace(/<li class\='vakata-context-separator'\><\/li\>$/,""),t&&(i+="</ul>"),t||(u.html=i,h.vakata.context._trigger("parse")),10<i.length&&i},_show_submenu:function(e){var t,r,i,s,a,n,o,d;(e=h(e)).length&&e.children("ul").length&&(t=e.children("ul"),i=(r=e.offset().left)+e.outerWidth(),s=e.offset().top,a=t.width(),n=t.height(),o=h(window).width()+h(window).scrollLeft(),d=h(window).height()+h(window).scrollTop(),_?e[i-(a+10+e.outerWidth())<0?"addClass":"removeClass"]("vakata-context-left"):e[o<i+a&&o-i<r?"addClass":"removeClass"]("vakata-context-right"),d<s+n+10&&t.css("bottom","-1px"),e.hasClass("vakata-context-right")?r<a&&t.css("margin-right",r-a):o-i<a&&t.css("margin-left",o-i-a),t.show())},show:function(e,t,r){var i,s,a,n,o,d,c,l;switch(u.element&&u.element.length&&u.element.width(""),!0){case!t&&!e:return!1;case!!t&&!!e:u.reference=e,u.position_x=t.x,u.position_y=t.y;break;case!t&&!!e:i=(u.reference=e).offset(),u.position_x=i.left+e.outerHeight(),u.position_y=i.top;break;case!!t&&!e:u.position_x=t.x,u.position_y=t.y}e&&!r&&h(e).data("vakata_contextmenu")&&(r=h(e).data("vakata_contextmenu")),h.vakata.context._parse(r)&&u.element.html(u.html),u.items.length&&(u.element.appendTo(y.body),s=u.element,a=u.position_x,n=u.position_y,o=s.width(),d=s.height(),c=h(window).width()+h(window).scrollLeft(),l=h(window).height()+h(window).scrollTop(),_&&(a-=s.outerWidth()-h(e).outerWidth())<h(window).scrollLeft()+20&&(a=h(window).scrollLeft()+20),c<a+o+20&&(a=c-(o+20)),l<n+d+20&&(n=l-(d+20)),u.element.css({left:a,top:n}).show().find("a").first().focus().parent().addClass("vakata-context-hover"),u.is_visible=!0,h.vakata.context._trigger("show"))},hide:function(){u.is_visible&&(u.element.hide().find("ul").hide().end().find(":focus").blur().end().detach(),u.is_visible=!1,h.vakata.context._trigger("hide"))}},h(function(){_="rtl"===h(y.body).css("direction");var t=!1;u.element=h("<ul class='vakata-context'></ul>"),u.element.on("mouseenter","li",function(e){e.stopImmediatePropagation(),h.contains(this,e.relatedTarget)||(t&&clearTimeout(t),u.element.find(".vakata-context-hover").removeClass("vakata-context-hover").end(),h(this).siblings().find("ul").hide().end().end().parentsUntil(".vakata-context","li").addBack().addClass("vakata-context-hover"),h.vakata.context._show_submenu(this))}).on("mouseleave","li",function(e){h.contains(this,e.relatedTarget)||h(this).find(".vakata-context-hover").addBack().removeClass("vakata-context-hover")}).on("mouseleave",function(e){h(this).find(".vakata-context-hover").removeClass("vakata-context-hover"),h.vakata.context.settings.hide_onmouseleave&&(t=setTimeout(function(){h.vakata.context.hide()},h.vakata.context.settings.hide_onmouseleave))}).on("click","a",function(e){e.preventDefault(),h(this).trigger("blur").parent().hasClass("vakata-context-disabled")||!1===h.vakata.context._execute(h(this).attr("rel"))||h.vakata.context.hide()}).on("keydown","a",function(e){var t=null;switch(e.which){case 13:case 32:e.type="click",e.preventDefault(),h(e.currentTarget).trigger(e);break;case 37:u.is_visible&&(u.element.find(".vakata-context-hover").last().closest("li").first().find("ul").hide().find(".vakata-context-hover").removeClass("vakata-context-hover").end().end().children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 38:u.is_visible&&((t=u.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").prevAll("li:not(.vakata-context-separator)").first()).length||(t=u.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").last()),t.addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 39:u.is_visible&&(u.element.find(".vakata-context-hover").last().children("ul").show().children("li:not(.vakata-context-separator)").removeClass("vakata-context-hover").first().addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 40:u.is_visible&&((t=u.element.find("ul:visible").addBack().last().children(".vakata-context-hover").removeClass("vakata-context-hover").nextAll("li:not(.vakata-context-separator)").first()).length||(t=u.element.find("ul:visible").addBack().last().children("li:not(.vakata-context-separator)").first()),t.addClass("vakata-context-hover").children("a").focus(),e.stopImmediatePropagation(),e.preventDefault());break;case 27:h.vakata.context.hide(),e.preventDefault()}}).on("keydown",function(e){e.preventDefault();var t=u.element.find(".vakata-contextmenu-shortcut-"+e.which).parent();t.parent().not(".vakata-context-disabled")&&t.trigger("click")}),h(y).on("mousedown.vakata.jstree",function(e){u.is_visible&&u.element[0]!==e.target&&!h.contains(u.element[0],e.target)&&h.vakata.context.hide()}).on("context_show.vakata.jstree",function(e,t){u.element.find("li:has(ul)").children("a").addClass("vakata-context-parent"),_&&u.element.addClass("vakata-context-rtl").css("direction","rtl"),u.element.find("ul").hide().end()})}),E.jstree.defaults.dnd={copy:!0,open_timeout:500,is_draggable:!0,check_while_dragging:!0,always_copy:!1,inside_pos:0,drag_selection:!0,touch:!0,large_drop_target:!1,large_drag_target:!1,use_html5:!1},E.jstree.plugins.dnd=function(e,o){this.init=function(e,t){o.init.call(this,e,t),this.settings.dnd.use_html5=this.settings.dnd.use_html5&&"draggable"in y.createElement("span")},this.bind=function(){o.bind.call(this),this.element.on(this.settings.dnd.use_html5?"dragstart.jstree":"mousedown.jstree touchstart.jstree",this.settings.dnd.large_drag_target?".jstree-node":".jstree-anchor",E.proxy(function(e){if(this.settings.dnd.large_drag_target&&E(e.target).closest(".jstree-node")[0]!==e.currentTarget)return!0;if("touchstart"===e.type&&(!this.settings.dnd.touch||"selected"===this.settings.dnd.touch&&!E(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").hasClass("jstree-clicked")))return!0;var t=this.get_node(e.target),r=this.is_selected(t)&&this.settings.dnd.drag_selection?this.get_top_selected().length:1,i=1<r?r+" "+this.get_string("nodes"):this.get_text(e.currentTarget);if(this.settings.core.force_text&&(i=E.vakata.html.escape(i)),t&&t.id&&t.id!==E.jstree.root&&(1===e.which||"touchstart"===e.type||"dragstart"===e.type)&&(!0===this.settings.dnd.is_draggable||"function"==typeof this.settings.dnd.is_draggable&&this.settings.dnd.is_draggable.call(this,1<r?this.get_top_selected(!0):[t],e))){if(d={jstree:!0,origin:this,obj:this.get_node(t,!0),nodes:1<r?this.get_top_selected():[t.id]},l=e.currentTarget,!this.settings.dnd.use_html5)return this.element.trigger("mousedown.jstree"),E.vakata.dnd.start(e,d,'<div id="jstree-dnd" class="jstree-'+this.get_theme()+" jstree-"+this.get_theme()+"-"+this.get_theme_variant()+" "+(this.settings.core.themes.responsive?" jstree-dnd-responsive":"")+'"><i class="jstree-icon jstree-er"></i>'+i+'<ins class="jstree-copy" style="display:none;">+</ins></div>');E.vakata.dnd._trigger("start",e,{helper:E(),element:l,data:d})}},this)),this.settings.dnd.use_html5&&this.element.on("dragover.jstree",function(e){return e.preventDefault(),E.vakata.dnd._trigger("move",e,{helper:E(),element:l,data:d}),!1}).on("drop.jstree",E.proxy(function(e){return e.preventDefault(),E.vakata.dnd._trigger("stop",e,{helper:E(),element:l,data:d}),!1},this))},this.redraw_node=function(e,t,r,i){if((e=o.redraw_node.apply(this,arguments))&&this.settings.dnd.use_html5)if(this.settings.dnd.large_drag_target)e.setAttribute("draggable",!0);else{for(var s=null,a=0,n=e.childNodes.length;a<n;a++)if(e.childNodes[a]&&e.childNodes[a].className&&-1!==e.childNodes[a].className.indexOf("jstree-anchor")){s=e.childNodes[a];break}s&&s.setAttribute("draggable",!0)}return e}},E(function(){var A=!1,N=!1,T=!1,O=!1,S=E('<div id="jstree-marker">&#160;</div>').hide();E(y).on("dragover.vakata.jstree",function(e){l&&E.vakata.dnd._trigger("move",e,{helper:E(),element:l,data:d})}).on("drop.vakata.jstree",function(e){l&&(E.vakata.dnd._trigger("stop",e,{helper:E(),element:l,data:d}),d=l=null)}).on("dnd_start.vakata.jstree",function(e,t){T=A=!1,t&&t.data&&t.data.jstree&&S.appendTo(y.body)}).on("dnd_move.vakata.jstree",function(e,s){var a=s.event.target!==T.target;if(O&&(s.event&&"dragover"===s.event.type&&!a||clearTimeout(O)),s&&s.data&&s.data.jstree&&(!s.event.target.id||"jstree-marker"!==s.event.target.id)){T=s.event;var n,o,d,c,l,h,_,u,g,f,p,m,v,j,y,k,x,b=E.jstree.reference(s.event.target),w=!1,C=!1,t=!1;if(b&&b._data&&b._data.dnd)if(S.attr("class","jstree-"+b.get_theme()+(b.settings.core.themes.responsive?" jstree-dnd-responsive":"")),y=s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey)),s.helper.children().attr("class","jstree-"+b.get_theme()+" jstree-"+b.get_theme()+"-"+b.get_theme_variant()+" "+(b.settings.core.themes.responsive?" jstree-dnd-responsive":"")).find(".jstree-copy").first()[y?"show":"hide"](),s.event.target!==b.element[0]&&s.event.target!==b.get_container_ul()[0]||0!==b.get_container_ul().children().length){if((w=b.settings.dnd.large_drop_target?E(s.event.target).closest(".jstree-node").children(".jstree-anchor"):E(s.event.target).closest(".jstree-anchor"))&&w.length&&w.parent().is(".jstree-closed, .jstree-open, .jstree-leaf")&&(C=w.offset(),t=(s.event.pageY!==P?s.event.pageY:s.event.originalEvent.pageY)-C.top,d=w.outerHeight(),h=t<d/3?["b","i","a"]:d-d/3<t?["a","i","b"]:d/2<t?["i","a","b"]:["i","b","a"],E.each(h,function(e,t){switch(t){case"b":n=C.left-6,o=C.top,c=b.get_parent(w),l=w.parent().index(),x="jstree-below";break;case"i":v=b.settings.dnd.inside_pos,j=b.get_node(w.parent()),n=C.left-2,o=C.top+d/2+1,c=j.id,l="first"===v?0:"last"===v?j.children.length:Math.min(v,j.children.length),x="jstree-inside";break;case"a":n=C.left-6,o=C.top+d,c=b.get_parent(w),l=w.parent().index()+1,x="jstree-above"}for(_=!0,u=0,g=s.data.nodes.length;u<g;u++)if(f=s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey))?"copy_node":"move_node",p=l,"move_node"==f&&"a"===t&&s.data.origin&&s.data.origin===b&&c===b.get_parent(s.data.nodes[u])&&(m=b.get_node(c),p>E.inArray(s.data.nodes[u],m.children)&&--p),!(_=_&&(b&&b.settings&&b.settings.dnd&&!1===b.settings.dnd.check_while_dragging||b.check(f,s.data.origin&&s.data.origin!==b?s.data.origin.get_node(s.data.nodes[u]):s.data.nodes[u],c,p,{dnd:!0,ref:b.get_node(w.parent()),pos:t,origin:s.data.origin,is_multi:s.data.origin&&s.data.origin!==b,is_foreign:!s.data.origin})))){b&&b.last_error&&(N=b.last_error());break}var r,i;if("i"===t&&w.parent().is(".jstree-closed")&&b.settings.dnd.open_timeout&&(s.event&&"dragover"===s.event.type&&!a||(O&&clearTimeout(O),O=setTimeout((i=w,function(){r.open_node(i)}),(r=b).settings.dnd.open_timeout))),_)return(k=b.get_node(c,!0)).hasClass(".jstree-dnd-parent")||(E(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),k.addClass("jstree-dnd-parent")),A={ins:b,par:c,pos:"i"!==t||"last"!==v||0!==l||b.is_loaded(j)?l:"last"},S.css({left:n+"px",top:o+"px"}).show(),S.removeClass("jstree-above jstree-inside jstree-below").addClass(x),s.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),s.event.originalEvent&&s.event.originalEvent.dataTransfer&&(s.event.originalEvent.dataTransfer.dropEffect=y?"copy":"move"),N={},!(h=!0)}),!0===h))return}else{for(_=!0,u=0,g=s.data.nodes.length;u<g&&(_=_&&b.check(s.data.origin&&(s.data.origin.settings.dnd.always_copy||s.data.origin.settings.dnd.copy&&(s.event.metaKey||s.event.ctrlKey))?"copy_node":"move_node",s.data.origin&&s.data.origin!==b?s.data.origin.get_node(s.data.nodes[u]):s.data.nodes[u],E.jstree.root,"last",{dnd:!0,ref:b.get_node(E.jstree.root),pos:"i",origin:s.data.origin,is_multi:s.data.origin&&s.data.origin!==b,is_foreign:!s.data.origin}));u++);if(_)return A={ins:b,par:E.jstree.root,pos:"last"},S.hide(),s.helper.find(".jstree-icon").first().removeClass("jstree-er").addClass("jstree-ok"),void(s.event.originalEvent&&s.event.originalEvent.dataTransfer&&(s.event.originalEvent.dataTransfer.dropEffect=y?"copy":"move"))}E(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),A=!1,s.helper.find(".jstree-icon").removeClass("jstree-ok").addClass("jstree-er"),s.event.originalEvent&&s.event.originalEvent.dataTransfer,S.hide()}}).on("dnd_scroll.vakata.jstree",function(e,t){t&&t.data&&t.data.jstree&&(S.hide(),T=A=!1,t.helper.find(".jstree-icon").first().removeClass("jstree-ok").addClass("jstree-er"))}).on("dnd_stop.vakata.jstree",function(e,t){if(E(".jstree-dnd-parent").removeClass("jstree-dnd-parent"),O&&clearTimeout(O),t&&t.data&&t.data.jstree){S.hide().detach();var r,i,s=[];if(A){for(r=0,i=t.data.nodes.length;r<i;r++)s[r]=t.data.origin?t.data.origin.get_node(t.data.nodes[r]):t.data.nodes[r];A.ins[t.data.origin&&(t.data.origin.settings.dnd.always_copy||t.data.origin.settings.dnd.copy&&(t.event.metaKey||t.event.ctrlKey))?"copy_node":"move_node"](s,A.par,A.pos,!1,!1,!1,t.data.origin)}else(r=E(t.event.target).closest(".jstree")).length&&N&&N.error&&"check"===N.error&&(r=r.jstree(!0))&&r.settings.core.error.call(this,N);A=T=!1}}).on("keyup.jstree keydown.jstree",function(e,t){(t=E.vakata.dnd._get())&&t.data&&t.data.jstree&&("keyup"===e.type&&27===e.which?(O&&clearTimeout(O),O=T=N=A=!1,S.hide().detach(),E.vakata.dnd._clean()):(t.helper.find(".jstree-copy").first()[t.data.origin&&(t.data.origin.settings.dnd.always_copy||t.data.origin.settings.dnd.copy&&(e.metaKey||e.ctrlKey))?"show":"hide"](),T&&(T.metaKey=e.metaKey,T.ctrlKey=e.ctrlKey,E.vakata.dnd._trigger("move",T))))})}),f={element:!((g=E).vakata.html={div:g("<div></div>"),escape:function(e){return g.vakata.html.div.text(e).html()},strip:function(e){return g.vakata.html.div.empty().append(g.parseHTML(e)).text()}}),target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},g.vakata.dnd={settings:{scroll_speed:10,scroll_proximity:20,helper_left:5,helper_top:10,threshold:5,threshold_touch:10},_trigger:function(e,t,r){r===P&&(r=g.vakata.dnd._get()),r.event=t,g(y).triggerHandler("dnd_"+e+".vakata",r)},_get:function(){return{data:f.data,element:f.element,helper:f.helper}},_clean:function(){f.helper&&f.helper.remove(),f.scroll_i&&(clearInterval(f.scroll_i),f.scroll_i=!1),f={element:!1,target:!1,is_down:!1,is_drag:!1,helper:!1,helper_w:0,data:!1,init_x:0,init_y:0,scroll_l:0,scroll_t:0,scroll_e:!1,scroll_i:!1,is_touch:!1},l=null,g(y).off("mousemove.vakata.jstree touchmove.vakata.jstree",g.vakata.dnd.drag),g(y).off("mouseup.vakata.jstree touchend.vakata.jstree",g.vakata.dnd.stop)},_scroll:function(e){if(!f.scroll_e||!f.scroll_l&&!f.scroll_t)return f.scroll_i&&(clearInterval(f.scroll_i),f.scroll_i=!1),!1;if(!f.scroll_i)return f.scroll_i=setInterval(g.vakata.dnd._scroll,100),!1;if(!0===e)return!1;var t=f.scroll_e.scrollTop(),r=f.scroll_e.scrollLeft();f.scroll_e.scrollTop(t+f.scroll_t*g.vakata.dnd.settings.scroll_speed),f.scroll_e.scrollLeft(r+f.scroll_l*g.vakata.dnd.settings.scroll_speed),t===f.scroll_e.scrollTop()&&r===f.scroll_e.scrollLeft()||g.vakata.dnd._trigger("scroll",f.scroll_e)},start:function(e,t,r){"touchstart"===e.type&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(e.pageX=e.originalEvent.changedTouches[0].pageX,e.pageY=e.originalEvent.changedTouches[0].pageY,e.target=y.elementFromPoint(e.originalEvent.changedTouches[0].pageX-window.pageXOffset,e.originalEvent.changedTouches[0].pageY-window.pageYOffset)),f.is_drag&&g.vakata.dnd.stop({});try{e.currentTarget.unselectable="on",e.currentTarget.onselectstart=function(){return!1},e.currentTarget.style&&(e.currentTarget.style.touchAction="none",e.currentTarget.style.msTouchAction="none",e.currentTarget.style.MozUserSelect="none")}catch(e){}return f.init_x=e.pageX,f.init_y=e.pageY,f.data=t,f.is_down=!0,f.element=e.currentTarget,f.target=e.target,f.is_touch="touchstart"===e.type,!1!==r&&(f.helper=g("<div id='vakata-dnd'></div>").html(r).css({display:"block",margin:"0",padding:"0",position:"absolute",top:"-2000px",lineHeight:"16px",zIndex:"10000"})),g(y).on("mousemove.vakata.jstree touchmove.vakata.jstree",g.vakata.dnd.drag),g(y).on("mouseup.vakata.jstree touchend.vakata.jstree",g.vakata.dnd.stop),!1},drag:function(r){if("touchmove"===r.type&&r.originalEvent&&r.originalEvent.changedTouches&&r.originalEvent.changedTouches[0]&&(r.pageX=r.originalEvent.changedTouches[0].pageX,r.pageY=r.originalEvent.changedTouches[0].pageY,r.target=y.elementFromPoint(r.originalEvent.changedTouches[0].pageX-window.pageXOffset,r.originalEvent.changedTouches[0].pageY-window.pageYOffset)),f.is_down){if(!f.is_drag){if(!(Math.abs(r.pageX-f.init_x)>(f.is_touch?g.vakata.dnd.settings.threshold_touch:g.vakata.dnd.settings.threshold)||Math.abs(r.pageY-f.init_y)>(f.is_touch?g.vakata.dnd.settings.threshold_touch:g.vakata.dnd.settings.threshold)))return;f.helper&&(f.helper.appendTo(y.body),f.helper_w=f.helper.outerWidth()),f.is_drag=!0,g(f.target).one("click.vakata",!1),g.vakata.dnd._trigger("start",r)}var e=!1,t=!1,i=!1,s=!1,a=!1,n=!1,o=!1,d=!1,c=!1,l=!1;return f.scroll_t=0,f.scroll_l=0,f.scroll_e=!1,g(g(r.target).parentsUntil("body").addBack().get().reverse()).filter(function(){return/^auto|scroll$/.test(g(this).css("overflow"))&&(this.scrollHeight>this.offsetHeight||this.scrollWidth>this.offsetWidth)}).each(function(){var e=g(this),t=e.offset();if(this.scrollHeight>this.offsetHeight&&(t.top+e.height()-r.pageY<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_t=1),r.pageY-t.top<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_t=-1)),this.scrollWidth>this.offsetWidth&&(t.left+e.width()-r.pageX<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_l=1),r.pageX-t.left<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_l=-1)),f.scroll_t||f.scroll_l)return f.scroll_e=g(this),!1}),f.scroll_e||(e=g(y),t=g(window),i=e.height(),s=t.height(),a=e.width(),n=t.width(),o=e.scrollTop(),d=e.scrollLeft(),s<i&&r.pageY-o<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_t=-1),s<i&&s-(r.pageY-o)<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_t=1),n<a&&r.pageX-d<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_l=-1),n<a&&n-(r.pageX-d)<g.vakata.dnd.settings.scroll_proximity&&(f.scroll_l=1),(f.scroll_t||f.scroll_l)&&(f.scroll_e=e)),f.scroll_e&&g.vakata.dnd._scroll(!0),f.helper&&(c=parseInt(r.pageY+g.vakata.dnd.settings.helper_top,10),l=parseInt(r.pageX+g.vakata.dnd.settings.helper_left,10),i&&i<c+25&&(c=i-50),a&&l+f.helper_w>a&&(l=a-(f.helper_w+2)),f.helper.css({left:l+"px",top:c+"px"})),g.vakata.dnd._trigger("move",r),!1}},stop:function(e){var t;return"touchend"===e.type&&e.originalEvent&&e.originalEvent.changedTouches&&e.originalEvent.changedTouches[0]&&(e.pageX=e.originalEvent.changedTouches[0].pageX,e.pageY=e.originalEvent.changedTouches[0].pageY,e.target=y.elementFromPoint(e.originalEvent.changedTouches[0].pageX-window.pageXOffset,e.originalEvent.changedTouches[0].pageY-window.pageYOffset)),f.is_drag?(e.target!==f.target&&g(f.target).off("click.vakata"),g.vakata.dnd._trigger("stop",e)):"touchend"===e.type&&e.target===f.target&&(t=setTimeout(function(){g(e.target).trigger("click")},100),g(e.target).one("click",function(){t&&clearTimeout(t)})),g.vakata.dnd._clean(),!1}},E.jstree.defaults.massload=null,E.jstree.plugins.massload=function(e,l){this.init=function(e,t){this._data.massload={},l.init.call(this,e,t)},this._load_nodes=function(a,n,o,d){var e,t,c,r=this.settings.massload,i=[],s=this._model.data;if(!o){for(e=0,t=a.length;e<t;e++)s[a[e]]&&(s[a[e]].state.loaded||s[a[e]].state.failed)&&!d||(i.push(a[e]),(c=this.get_node(a[e],!0))&&c.length&&c.addClass("jstree-loading").attr("aria-busy",!0));if(this._data.massload={},i.length){if("function"==typeof r)return r.call(this,i,E.proxy(function(e){var t,r;if(e)for(t in e)e.hasOwnProperty(t)&&(this._data.massload[t]=e[t]);for(t=0,r=a.length;t<r;t++)(c=this.get_node(a[t],!0))&&c.length&&c.removeClass("jstree-loading").attr("aria-busy",!1);l._load_nodes.call(this,a,n,o,d)},this));if("object"==typeof r&&r&&r.url)return"function"==typeof(r=E.extend(!0,{},r)).url&&(r.url=r.url.call(this,i)),"function"==typeof r.data&&(r.data=r.data.call(this,i)),E.ajax(r).done(E.proxy(function(e,t,r){var i,s;if(e)for(i in e)e.hasOwnProperty(i)&&(this._data.massload[i]=e[i]);for(i=0,s=a.length;i<s;i++)(c=this.get_node(a[i],!0))&&c.length&&c.removeClass("jstree-loading").attr("aria-busy",!1);l._load_nodes.call(this,a,n,o,d)},this)).fail(E.proxy(function(e){l._load_nodes.call(this,a,n,o,d)},this))}}return l._load_nodes.call(this,a,n,o,d)},this._load_node=function(e,t){var r,i=this._data.massload[e.id],s=null;return i?(s=this["string"==typeof i?"_append_html_data":"_append_json_data"](e,"string"==typeof i?E(E.parseHTML(i)).filter(function(){return 3!==this.nodeType}):i,function(e){t.call(this,e)}),(r=this.get_node(e.id,!0))&&r.length&&r.removeClass("jstree-loading").attr("aria-busy",!1),delete this._data.massload[e.id],s):l._load_node.call(this,e,t)}},E.jstree.defaults.search={ajax:!1,fuzzy:!1,case_sensitive:!1,show_only_matches:!1,show_only_matches_children:!1,close_opened_onclear:!0,search_leaves_only:!1,search_callback:!1},E.jstree.plugins.search=function(e,o){this.bind=function(){o.bind.call(this),this._data.search.str="",this._data.search.dom=E(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=!1,this._data.search.smc=!1,this._data.search.hdn=[],this.element.on("search.jstree",E.proxy(function(e,t){if(this._data.search.som&&t.res.length){for(var r,i,s=this._model.data,a=[],n=0,o=t.res.length;n<o;n++)if(s[t.res[n]]&&!s[t.res[n]].state.hidden&&(a.push(t.res[n]),a=a.concat(s[t.res[n]].parents),this._data.search.smc))for(r=0,i=s[t.res[n]].children_d.length;r<i;r++)s[s[t.res[n]].children_d[r]]&&!s[s[t.res[n]].children_d[r]].state.hidden&&a.push(s[t.res[n]].children_d[r]);a=E.vakata.array_remove_item(E.vakata.array_unique(a),E.jstree.root),this._data.search.hdn=this.hide_all(!0),this.show_node(a,!0),this.redraw(!0)}},this)).on("clear_search.jstree",E.proxy(function(e,t){this._data.search.som&&t.res.length&&(this.show_node(this._data.search.hdn,!0),this.redraw(!0))},this))},this.search=function(i,e,t,r,s,a){if(!1===i||""===i.toString().trim())return this.clear_search();r=(r=this.get_node(r))&&r.id?r.id:null,i=i.toString();var n,o,d=this.settings.search,c=!!d.ajax&&d.ajax,l=this._model.data,h=null,_=[],u=[];if(this._data.search.res.length&&!s&&this.clear_search(),t===P&&(t=d.show_only_matches),a===P&&(a=d.show_only_matches_children),!e&&!1!==c)return"function"==typeof c?c.call(this,i,E.proxy(function(e){e&&e.d&&(e=e.d),this._load_nodes(Array.isArray(e)?E.vakata.array_unique(e):[],function(){this.search(i,!0,t,r,s,a)})},this),r):((c=E.extend({},c)).data||(c.data={}),c.data.str=i,r&&(c.data.inside=r),this._data.search.lastRequest&&this._data.search.lastRequest.abort(),this._data.search.lastRequest=E.ajax(c).fail(E.proxy(function(){this._data.core.last_error={error:"ajax",plugin:"search",id:"search_01",reason:"Could not load search parents",data:JSON.stringify(c)},this.settings.core.error.call(this,this._data.core.last_error)},this)).done(E.proxy(function(e){e&&e.d&&(e=e.d),this._load_nodes(Array.isArray(e)?E.vakata.array_unique(e):[],function(){this.search(i,!0,t,r,s,a)})},this)),this._data.search.lastRequest);if(s||(this._data.search.str=i,this._data.search.dom=E(),this._data.search.res=[],this._data.search.opn=[],this._data.search.som=t,this._data.search.smc=a),h=new E.vakata.search(i,!0,{caseSensitive:d.case_sensitive,fuzzy:d.fuzzy}),E.each(l[r||E.jstree.root].children_d,function(e,t){var r=l[t];r.text&&!r.state.hidden&&(!d.search_leaves_only||r.state.loaded&&0===r.children.length)&&(d.search_callback&&d.search_callback.call(this,i,r)||!d.search_callback&&h.search(r.text).isMatch)&&(_.push(t),u=u.concat(r.parents))}),_.length){for(n=0,o=(u=E.vakata.array_unique(u)).length;n<o;n++)u[n]!==E.jstree.root&&l[u[n]]&&!0===this.open_node(u[n],null,0)&&this._data.search.opn.push(u[n]);s?(this._data.search.dom=this._data.search.dom.add(E(this.element[0].querySelectorAll("#"+E.map(_,function(e){return-1!=="0123456789".indexOf(e[0])?"\\3"+e[0]+" "+e.substr(1).replace(E.jstree.idregex,"\\$&"):e.replace(E.jstree.idregex,"\\$&")}).join(", #")))),this._data.search.res=E.vakata.array_unique(this._data.search.res.concat(_))):(this._data.search.dom=E(this.element[0].querySelectorAll("#"+E.map(_,function(e){return-1!=="0123456789".indexOf(e[0])?"\\3"+e[0]+" "+e.substr(1).replace(E.jstree.idregex,"\\$&"):e.replace(E.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.res=_),this._data.search.dom.children(".jstree-anchor").addClass("jstree-search")}this.trigger("search",{nodes:this._data.search.dom,str:i,res:this._data.search.res,show_only_matches:t})},this.clear_search=function(){this.settings.search.close_opened_onclear&&this.close_node(this._data.search.opn,0),this.trigger("clear_search",{nodes:this._data.search.dom,str:this._data.search.str,res:this._data.search.res}),this._data.search.res.length&&(this._data.search.dom=E(this.element[0].querySelectorAll("#"+E.map(this._data.search.res,function(e){return-1!=="0123456789".indexOf(e[0])?"\\3"+e[0]+" "+e.substr(1).replace(E.jstree.idregex,"\\$&"):e.replace(E.jstree.idregex,"\\$&")}).join(", #"))),this._data.search.dom.children(".jstree-anchor").removeClass("jstree-search")),this._data.search.str="",this._data.search.res=[],this._data.search.opn=[],this._data.search.dom=E()},this.redraw_node=function(e,t,r,i){if((e=o.redraw_node.apply(this,arguments))&&-1!==E.inArray(e.id,this._data.search.res)){for(var s=null,a=0,n=e.childNodes.length;a<n;a++)if(e.childNodes[a]&&e.childNodes[a].className&&-1!==e.childNodes[a].className.indexOf("jstree-anchor")){s=e.childNodes[a];break}s&&(s.className+=" jstree-search")}return e}},(w=E).vakata.search=function(p,e,m){m=m||{},!1!==(m=w.extend({},w.vakata.search.defaults,m)).fuzzy&&(m.fuzzy=!0),p=m.caseSensitive?p:p.toLowerCase();var v,j,y,t,k=m.location,s=m.distance,x=m.threshold,b=p.length;return 32<b&&(m.fuzzy=!1),m.fuzzy&&(v=1<<b-1,j=function(){for(var e={},t=0,t=0;t<b;t++)e[p.charAt(t)]=0;for(t=0;t<b;t++)e[p.charAt(t)]|=1<<b-t-1;return e}(),y=function(e,t){var r=e/b,i=Math.abs(k-t);return s?r+i/s:i?1:r}),t=function(e){if(e=m.caseSensitive?e:e.toLowerCase(),p===e||-1!==e.indexOf(p))return{isMatch:!0,score:0};if(!m.fuzzy)return{isMatch:!1,score:1};var t,r,i,s,a,n,o,d,c,l=e.length,h=x,_=e.indexOf(p,k),u=b+l,g=1,f=[];for(-1!==_&&(h=Math.min(y(0,_),h),-1!==(_=e.lastIndexOf(p,k+b))&&(h=Math.min(y(0,_),h))),_=-1,t=0;t<b;t++){for(i=0,s=u;i<s;)y(t,k+s)<=h?i=s:u=s,s=Math.floor((u-i)/2+i);for(u=s,n=Math.max(1,k-s+1),o=Math.min(k+s,l)+b,(d=new Array(o+2))[o+1]=(1<<t)-1,r=o;n<=r;r--)if(c=j[e.charAt(r-1)],d[r]=0===t?(d[r+1]<<1|1)&c:(d[r+1]<<1|1)&c|(a[r+1]|a[r])<<1|1|a[r+1],d[r]&v&&(g=y(t,r-1))<=h){if(h=g,_=r-1,f.push(_),!(k<_))break;n=Math.max(1,2*k-_)}if(y(t+1,k)>h)break;a=d}return{isMatch:0<=_,score:g}},!0===e?{search:t}:t(e)},w.vakata.search.defaults={location:0,distance:100,threshold:.6,fuzzy:!1,caseSensitive:!1},E.jstree.defaults.sort=function(e,t){return this.get_text(e)>this.get_text(t)?1:-1};var m=!(E.jstree.plugins.sort=function(e,t){this.bind=function(){t.bind.call(this),this.element.on("model.jstree",E.proxy(function(e,t){this.sort(t.parent,!0)},this)).on("rename_node.jstree create_node.jstree",E.proxy(function(e,t){this.sort(t.parent||t.node.parent,!1),this.redraw_node(t.parent||t.node.parent,!0)},this)).on("move_node.jstree copy_node.jstree",E.proxy(function(e,t){this.sort(t.parent,!1),this.redraw_node(t.parent,!0)},this))},this.sort=function(e,t){var r,i;if((e=this.get_node(e))&&e.children&&e.children.length&&(e.children.sort(E.proxy(this.settings.sort,this)),t))for(r=0,i=e.children_d.length;r<i;r++)this.sort(e.children_d[r],!1)}});E.jstree.defaults.state={key:"jstree",events:"changed.jstree open_node.jstree close_node.jstree check_node.jstree uncheck_node.jstree",ttl:!1,filter:!1,preserve_loaded:!1},E.jstree.plugins.state=function(e,t){this.bind=function(){t.bind.call(this);var r=E.proxy(function(){this.element.on(this.settings.state.events,E.proxy(function(){m&&clearTimeout(m),m=setTimeout(E.proxy(function(){this.save_state()},this),100)},this)),this.trigger("state_ready")},this);this.element.on("ready.jstree",E.proxy(function(e,t){this.element.one("restore_state.jstree",r),this.restore_state()||r()},this))},this.save_state=function(){var e=this.get_state();this.settings.state.preserve_loaded||delete e.core.loaded;var t={state:e,ttl:this.settings.state.ttl,sec:+new Date};E.vakata.storage.set(this.settings.state.key,JSON.stringify(t))},this.restore_state=function(){var r=E.vakata.storage.get(this.settings.state.key);if(r)try{r=JSON.parse(r)}catch(e){return!1}return!(r&&r.ttl&&r.sec&&new Date-r.sec>r.ttl)&&(r&&r.state&&(r=r.state),r&&"function"==typeof this.settings.state.filter&&(r=this.settings.state.filter.call(this,r)),!!r&&(this.settings.state.preserve_loaded||delete r.core.loaded,this.element.one("set_state.jstree",function(e,t){t.instance.trigger("restore_state",{state:E.extend(!0,{},r)})}),this.set_state(r),!0))},this.clear_state=function(){return E.vakata.storage.del(this.settings.state.key)}},E.vakata.storage={set:function(e,t){return window.localStorage.setItem(e,t)},get:function(e){return window.localStorage.getItem(e)},del:function(e){return window.localStorage.removeItem(e)}},E.jstree.defaults.types={default:{}},E.jstree.defaults.types[E.jstree.root]={},E.jstree.plugins.types=function(e,l){this.init=function(e,t){var r,i;if(t&&t.types&&t.types.default)for(r in t.types)if("default"!==r&&r!==E.jstree.root&&t.types.hasOwnProperty(r))for(i in t.types.default)t.types.default.hasOwnProperty(i)&&t.types[r][i]===P&&(t.types[r][i]=t.types.default[i]);l.init.call(this,e,t),this._model.data[E.jstree.root].type=E.jstree.root},this.refresh=function(e,t){l.refresh.call(this,e,t),this._model.data[E.jstree.root].type=E.jstree.root},this.bind=function(){this.element.on("model.jstree",E.proxy(function(e,t){for(var r,i=this._model.data,s=t.nodes,a=this.settings.types,n="default",o=0,d=s.length;o<d;o++){if(n="default",i[s[o]].original&&i[s[o]].original.type&&a[i[s[o]].original.type]&&(n=i[s[o]].original.type),i[s[o]].data&&i[s[o]].data.jstree&&i[s[o]].data.jstree.type&&a[i[s[o]].data.jstree.type]&&(n=i[s[o]].data.jstree.type),i[s[o]].type=n,!0===i[s[o]].icon&&a[n].icon!==P&&(i[s[o]].icon=a[n].icon),a[n].li_attr!==P&&"object"==typeof a[n].li_attr)for(r in a[n].li_attr)if(a[n].li_attr.hasOwnProperty(r)){if("id"===r)continue;i[s[o]].li_attr[r]===P?i[s[o]].li_attr[r]=a[n].li_attr[r]:"class"===r&&(i[s[o]].li_attr.class=a[n].li_attr.class+" "+i[s[o]].li_attr.class)}if(a[n].a_attr!==P&&"object"==typeof a[n].a_attr)for(r in a[n].a_attr)if(a[n].a_attr.hasOwnProperty(r)){if("id"===r)continue;i[s[o]].a_attr[r]===P?i[s[o]].a_attr[r]=a[n].a_attr[r]:"href"===r&&"#"===i[s[o]].a_attr[r]?i[s[o]].a_attr.href=a[n].a_attr.href:"class"===r&&(i[s[o]].a_attr.class=a[n].a_attr.class+" "+i[s[o]].a_attr.class)}}i[E.jstree.root].type=E.jstree.root},this)),l.bind.call(this)},this.get_json=function(e,t,r){var i,s,a=this._model.data,n=t?E.extend(!0,{},t,{no_id:!1}):{},o=l.get_json.call(this,e,n,r);if(!1===o)return!1;if(Array.isArray(o))for(i=0,s=o.length;i<s;i++)o[i].type=o[i].id&&a[o[i].id]&&a[o[i].id].type?a[o[i].id].type:"default",t&&t.no_id&&(delete o[i].id,o[i].li_attr&&o[i].li_attr.id&&delete o[i].li_attr.id,o[i].a_attr&&o[i].a_attr.id&&delete o[i].a_attr.id);else o.type=o.id&&a[o.id]&&a[o.id].type?a[o.id].type:"default",t&&t.no_id&&(o=this._delete_ids(o));return o},this._delete_ids=function(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)e[t]=this._delete_ids(e[t]);return e}return delete e.id,e.li_attr&&e.li_attr.id&&delete e.li_attr.id,e.a_attr&&e.a_attr.id&&delete e.a_attr.id,e.children&&Array.isArray(e.children)&&(e.children=this._delete_ids(e.children)),e},this.check=function(e,t,r,i,s){if(!1===l.check.call(this,e,t,r,i,s))return!1;t=t&&t.id?t:this.get_node(t),r=r&&r.id?r:this.get_node(r);var a,n,o,d,c=(c=t&&t.id?s&&s.origin?s.origin:E.jstree.reference(t.id):null)&&c._model&&c._model.data?c._model.data:null;switch(e){case"create_node":case"move_node":case"copy_node":if("move_node"!==e||-1===E.inArray(t.id,r.children)){if((a=this.get_rules(r)).max_children!==P&&-1!==a.max_children&&a.max_children===r.children.length)return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_01",reason:"max_children prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});if(a.valid_children!==P&&-1!==a.valid_children&&-1===E.inArray(t.type||"default",a.valid_children))return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_02",reason:"valid_children prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});if(c&&t.children_d&&t.parents){for(o=n=0,d=t.children_d.length;o<d;o++)n=Math.max(n,c[t.children_d[o]].parents.length);n=n-t.parents.length+1}(n<=0||n===P)&&(n=1);do{if(a.max_depth!==P&&-1!==a.max_depth&&a.max_depth<n)return!(this._data.core.last_error={error:"check",plugin:"types",id:"types_03",reason:"max_depth prevents function: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})});r=this.get_node(r.parent),a=this.get_rules(r),n++}while(r)}}return!0},this.get_rules=function(e){if(!(e=this.get_node(e)))return!1;var t=this.get_type(e,!0);return t.max_depth===P&&(t.max_depth=-1),t.max_children===P&&(t.max_children=-1),t.valid_children===P&&(t.valid_children=-1),t},this.get_type=function(e,t){return!!(e=this.get_node(e))&&(t?E.extend({type:e.type},this.settings.types[e.type]):e.type)},this.set_type=function(e,t){var r,i,s,a,n,o,d,c,l=this._model.data;if(Array.isArray(e)){for(i=0,s=(e=e.slice()).length;i<s;i++)this.set_type(e[i],t);return!0}if(r=this.settings.types,e=this.get_node(e),!r[t]||!e)return!1;if((d=this.get_node(e,!0))&&d.length&&(c=d.children(".jstree-anchor")),a=e.type,n=this.get_icon(e),e.type=t,!0!==n&&r[a]&&(r[a].icon===P||n!==r[a].icon)||this.set_icon(e,r[t].icon===P||r[t].icon),r[a]&&r[a].li_attr!==P&&"object"==typeof r[a].li_attr)for(o in r[a].li_attr)if(r[a].li_attr.hasOwnProperty(o)){if("id"===o)continue;"class"===o?(l[e.id].li_attr.class=(l[e.id].li_attr.class||"").replace(r[a].li_attr[o],""),d&&d.removeClass(r[a].li_attr[o])):l[e.id].li_attr[o]===r[a].li_attr[o]&&(l[e.id].li_attr[o]=null,d&&d.removeAttr(o))}if(r[a]&&r[a].a_attr!==P&&"object"==typeof r[a].a_attr)for(o in r[a].a_attr)if(r[a].a_attr.hasOwnProperty(o)){if("id"===o)continue;"class"===o?(l[e.id].a_attr.class=(l[e.id].a_attr.class||"").replace(r[a].a_attr[o],""),c&&c.removeClass(r[a].a_attr[o])):l[e.id].a_attr[o]===r[a].a_attr[o]&&("href"===o?(l[e.id].a_attr[o]="#",c&&c.attr("href","#")):(delete l[e.id].a_attr[o],c&&c.removeAttr(o)))}if(r[t].li_attr!==P&&"object"==typeof r[t].li_attr)for(o in r[t].li_attr)if(r[t].li_attr.hasOwnProperty(o)){if("id"===o)continue;l[e.id].li_attr[o]===P?(l[e.id].li_attr[o]=r[t].li_attr[o],d&&("class"===o?d.addClass(r[t].li_attr[o]):d.attr(o,r[t].li_attr[o]))):"class"===o&&(l[e.id].li_attr.class=r[t].li_attr[o]+" "+l[e.id].li_attr.class,d&&d.addClass(r[t].li_attr[o]))}if(r[t].a_attr!==P&&"object"==typeof r[t].a_attr)for(o in r[t].a_attr)if(r[t].a_attr.hasOwnProperty(o)){if("id"===o)continue;l[e.id].a_attr[o]===P?(l[e.id].a_attr[o]=r[t].a_attr[o],c&&("class"===o?c.addClass(r[t].a_attr[o]):c.attr(o,r[t].a_attr[o]))):"href"===o&&"#"===l[e.id].a_attr[o]?(l[e.id].a_attr.href=r[t].a_attr.href,c&&c.attr("href",r[t].a_attr.href)):"class"===o&&(l[e.id].a_attr.class=r[t].a_attr.class+" "+l[e.id].a_attr.class,c&&c.addClass(r[t].a_attr[o]))}return!0}},E.jstree.defaults.unique={case_sensitive:!1,trim_whitespace:!1,duplicate:function(e,t){return e+" ("+t+")"}},E.jstree.plugins.unique=function(e,f){this.check=function(e,t,r,i,s){if(!1===f.check.call(this,e,t,r,i,s))return!1;if(t=t&&t.id?t:this.get_node(t),!(r=r&&r.id?r:this.get_node(r))||!r.children)return!0;for(var a,n="rename_node"===e?i:t.text,o=[],d=this.settings.unique.case_sensitive,c=this.settings.unique.trim_whitespace,l=this._model.data,h=0,_=r.children.length;h<_;h++)a=l[r.children[h]].text,d||(a=a.toLowerCase()),c&&(a=a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),o.push(a);switch(d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),e){case"delete_node":return!0;case"rename_node":return a=t.text||"",d||(a=a.toLowerCase()),c&&(a=a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),(h=-1===E.inArray(n,o)||t.text&&a===n)||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_01",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h;case"create_node":return(h=-1===E.inArray(n,o))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_04",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h;case"copy_node":return(h=-1===E.inArray(n,o))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_02",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h;case"move_node":return(h=t.parent===r.id&&(!s||!s.is_multi)||-1===E.inArray(n,o))||(this._data.core.last_error={error:"check",plugin:"unique",id:"unique_03",reason:"Child with name "+n+" already exists. Preventing: "+e,data:JSON.stringify({chk:e,pos:i,obj:!(!t||!t.id)&&t.id,par:!(!r||!r.id)&&r.id})}),h}return!0},this.create_node=function(e,t,r,i,s){if(!t||t.text===P){if(null===e&&(e=E.jstree.root),!(e=this.get_node(e)))return f.create_node.call(this,e,t,r,i,s);if(!(r=r===P?"last":r).toString().match(/^(before|after)$/)&&!s&&!this.is_loaded(e))return f.create_node.call(this,e,t,r,i,s);t=t||{};for(var a,n,o=this._model.data,d=this.settings.unique.case_sensitive,c=this.settings.unique.trim_whitespace,l=this.settings.unique.duplicate,h=a=this.get_string("New node"),_=[],u=0,g=e.children.length;u<g;u++)n=o[e.children[u]].text,d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")),_.push(n);for(u=1,n=h,d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));-1!==E.inArray(n,_);)n=h=l.call(this,a,++u).toString(),d||(n=n.toLowerCase()),c&&(n=n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""));t.text=h}return f.create_node.call(this,e,t,r,i,s)}};var v=y.createElement("DIV");if(v.setAttribute("unselectable","on"),v.setAttribute("role","presentation"),v.className="jstree-wholerow",v.innerHTML="&#160;",E.jstree.plugins.wholerow=function(e,a){this.bind=function(){a.bind.call(this),this.element.on("ready.jstree set_state.jstree",E.proxy(function(){this.hide_dots()},this)).on("init.jstree loading.jstree ready.jstree",E.proxy(function(){this.get_container_ul().addClass("jstree-wholerow-ul")},this)).on("deselect_all.jstree",E.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked")},this)).on("changed.jstree",E.proxy(function(e,t){this.element.find(".jstree-wholerow-clicked").removeClass("jstree-wholerow-clicked");for(var r=!1,i=0,s=t.selected.length;i<s;i++)(r=this.get_node(t.selected[i],!0))&&r.length&&r.children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("open_node.jstree",E.proxy(function(e,t){this.get_node(t.node,!0).find(".jstree-clicked").parent().children(".jstree-wholerow").addClass("jstree-wholerow-clicked")},this)).on("hover_node.jstree dehover_node.jstree",E.proxy(function(e,t){"hover_node"===e.type&&this.is_disabled(t.node)||this.get_node(t.node,!0).children(".jstree-wholerow")["hover_node"===e.type?"addClass":"removeClass"]("jstree-wholerow-hovered")},this)).on("contextmenu.jstree",".jstree-wholerow",E.proxy(function(e){var t;this._data.contextmenu&&(e.preventDefault(),t=E.Event("contextmenu",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,pageX:e.pageX,pageY:e.pageY}),E(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t))},this)).on("click.jstree",".jstree-wholerow",function(e){e.stopImmediatePropagation();var t=E.Event("click",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});E(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t).focus()}).on("dblclick.jstree",".jstree-wholerow",function(e){e.stopImmediatePropagation();var t=E.Event("dblclick",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});E(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t).focus()}).on("click.jstree",".jstree-leaf > .jstree-ocl",E.proxy(function(e){e.stopImmediatePropagation();var t=E.Event("click",{metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey});E(e.currentTarget).closest(".jstree-node").children(".jstree-anchor").first().trigger(t).focus()},this)).on("mouseover.jstree",".jstree-wholerow, .jstree-icon",E.proxy(function(e){return e.stopImmediatePropagation(),this.is_disabled(e.currentTarget)||this.hover_node(e.currentTarget),!1},this)).on("mouseleave.jstree",".jstree-node",E.proxy(function(e){this.dehover_node(e.currentTarget)},this))},this.teardown=function(){this.settings.wholerow&&this.element.find(".jstree-wholerow").remove(),a.teardown.call(this)},this.redraw_node=function(e,t,r,i){var s;return(e=a.redraw_node.apply(this,arguments))&&(s=v.cloneNode(!0),-1!==E.inArray(e.id,this._data.core.selected)&&(s.className+=" jstree-wholerow-clicked"),this._data.core.focused&&this._data.core.focused===e.id&&(s.className+=" jstree-wholerow-hovered"),e.insertBefore(s,e.childNodes[0])),e}},window.customElements&&Object&&Object.create){var t=Object.create(HTMLElement.prototype);t.createdCallback=function(){var e,t={core:{},plugins:[]};for(e in E.jstree.plugins)E.jstree.plugins.hasOwnProperty(e)&&this.attributes[e]&&(t.plugins.push(e),this.getAttribute(e)&&JSON.parse(this.getAttribute(e))&&(t[e]=JSON.parse(this.getAttribute(e))));for(e in E.jstree.defaults.core)E.jstree.defaults.core.hasOwnProperty(e)&&this.attributes[e]&&(t.core[e]=JSON.parse(this.getAttribute(e))||this.getAttribute(e));E(this).jstree(t)};try{window.customElements.define("vakata-jstree",function(){},{prototype:t})}catch(e){}}}});
 
 
 
 
 
assets/select2/select2.full.js CHANGED
@@ -3697,7 +3697,7 @@ S2.define('select2/data/ajax',[
3697
 
3698
  if (this._request != null) {
3699
  // JSONP requests cannot always be aborted
3700
- if ($.isFunction(this._request.abort)) {
3701
  this._request.abort();
3702
  }
3703
 
3697
 
3698
  if (this._request != null) {
3699
  // JSONP requests cannot always be aborted
3700
+ if (typeof this._request.abort === 'function') {
3701
  this._request.abort();
3702
  }
3703
 
assets/select2/select2.full.min.js CHANGED
@@ -1,2 +1 @@
1
- /*! Select2 4.1.0-beta.1 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
- !function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(d){var e=function(){if(d&&d.fn&&d.fn.select2&&d.fn.select2.amd)var e=d.fn.select2.amd;var t,n,i,h,s,r,f,g,m,v,y,_,o,a,w,l;function b(e,t){return o.call(e,t)}function c(e,t){var n,i,o,s,r,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(r=(e=e.split("/")).length-1,y.nodeIdCompat&&w.test(e[r])&&(e[r]=e[r].replace(w,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),u-=1;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;u-=1){if(i=n.slice(0,u).join("/"),h)for(d=h.length;0<d;d-=1)if(o=(o=f[h.slice(0,d).join("/")])&&o[i]){s=o,a=u;break}if(s)break;!l&&g&&g[i]&&(l=g[i],c=u)}!s&&l&&(s=l,a=c),s&&(n.splice(0,a,s),e=n.join("/"))}return e}function x(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),r.apply(h,e.concat([t,n]))}}function A(t){return function(e){m[t]=e}}function D(e){if(b(v,e)){var t=v[e];delete v[e],_[e]=!0,s.apply(h,t)}if(!b(m,e)&&!b(_,e))throw new Error("No "+e);return m[e]}function u(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function S(e){return e?u(e):[]}return e&&e.requirejs||(e?n=e:e={},m={},v={},y={},_={},o=Object.prototype.hasOwnProperty,a=[].slice,w=/\.js$/,f=function(e,t){var n,i=u(e),o=i[0],s=t[1];return e=i[1],o&&(n=D(o=c(o,s))),o?e=n&&n.normalize?n.normalize(e,function(t){return function(e){return c(e,t)}}(s)):c(e,s):(o=(i=u(e=c(e,s)))[0],e=i[1],o&&(n=D(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},g={require:function(e){return x(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:function(e){return function(){return y&&y.config&&y.config[e]||{}}}(e)}}},s=function(e,t,n,i){var o,s,r,a,l,c,u,d=[],p=typeof n;if(c=S(i=i||e),"undefined"==p||"function"==p){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(s=(a=f(t[l],c)).f))d[l]=g.require(e);else if("exports"===s)d[l]=g.exports(e),u=!0;else if("module"===s)o=d[l]=g.module(e);else if(b(m,s)||b(v,s)||b(_,s))d[l]=D(s);else{if(!a.p)throw new Error(e+" missing "+s);a.p.load(a.n,x(i,!0),A(s),{}),d[l]=m[s]}r=n?n.apply(m[e],d):void 0,e&&(o&&o.exports!==h&&o.exports!==m[e]?m[e]=o.exports:r===h&&u||(m[e]=r))}else e&&(m[e]=n)},t=n=r=function(e,t,n,i,o){if("string"==typeof e)return g[e]?g[e](t):D(f(e,S(t)).f);if(!e.splice){if((y=e).deps&&r(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=i,i=o),i?s(h,e,t,n):setTimeout(function(){s(h,e,t,n)},4),r},r.config=function(e){return r(e)},t._defined=m,(i=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),b(m,e)||b(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=t,e.require=n,e.define=i),e.define("almond",function(){}),e.define("jquery",[],function(){var e=d||$;return null==e&&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."),e}),e.define("select2/utils",["jquery"],function(s){var o={};function u(e){var t=e.prototype,n=[];for(var i in t){"function"==typeof t[i]&&"constructor"!==i&&n.push(i)}return n}o.Extend=function(e,t){var n={}.hasOwnProperty;function i(){this.constructor=e}for(var o in t)n.call(t,o)&&(e[o]=t[o]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},o.Decorate=function(i,o){var e=u(o),t=u(i);function s(){var e=Array.prototype.unshift,t=o.prototype.constructor.length,n=i.prototype.constructor;0<t&&(e.call(arguments,i.prototype.constructor),n=o.prototype.constructor),n.apply(this,arguments)}o.displayName=i.displayName,s.prototype=new function(){this.constructor=s};for(var n=0;n<t.length;n++){var r=t[n];s.prototype[r]=i.prototype[r]}function a(e){var t=function(){};e in s.prototype&&(t=s.prototype[e]);var n=o.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}for(var l=0;l<e.length;l++){var c=e[l];s.prototype[c]=a(c)}return s};function e(){this.listeners={}}e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n].apply(this,t)},o.Observable=e,o.generateChars=function(e){for(var t="",n=0;n<e;n++){t+=Math.floor(36*Math.random()).toString(36)}return t},o.bind=function(e,t){return function(){e.apply(t,arguments)}},o._convertData=function(e){for(var t in e){var n=t.split("-"),i=e;if(1!==n.length){for(var o=0;o<n.length;o++){var s=n[o];(s=s.substring(0,1).toLowerCase()+s.substring(1))in i||(i[s]={}),o==n.length-1&&(i[s]=e[t]),i=i[s]}delete e[t]}}return e},o.hasScroll=function(e,t){var n=s(t),i=t.style.overflowX,o=t.style.overflowY;return(i!==o||"hidden"!==o&&"visible"!==o)&&("scroll"===i||"scroll"===o||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},o.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},o.__cache={};var n=0;return o.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null!=t||(t=e.id?"select2-data-"+e.id:"select2-data-"+(++n).toString()+"-"+o.generateChars(4),e.setAttribute("data-select2-id",t)),t},o.StoreData=function(e,t,n){var i=o.GetUniqueElementId(e);o.__cache[i]||(o.__cache[i]={}),o.__cache[i][t]=n},o.GetData=function(e,t){var n=o.GetUniqueElementId(e);return t?o.__cache[n]&&null!=o.__cache[n][t]?o.__cache[n][t]:s(e).data(t):o.__cache[n]},o.RemoveData=function(e){var t=o.GetUniqueElementId(e);null!=o.__cache[t]&&delete o.__cache[t],e.removeAttribute("data-select2-id")},o.copyNonInternalCssClasses=function(e,t){var n=e.getAttribute("class").trim().split(/\s+/);n=n.filter(function(e){return 0===e.indexOf("select2-")});var i=t.getAttribute("class").trim().split(/\s+/);i=i.filter(function(e){return 0!==e.indexOf("select2-")});var o=n.concat(i);e.setAttribute("class",o.join(" "))},o}),e.define("select2/results",["jquery","./utils"],function(h,f){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return f.Extend(i,f.Observable),i.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var i=e.results[n],o=this.option(i);t.push(o)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},i.prototype.position=function(e,t){t.find(".select2-results").append(e)},i.prototype.sort=function(e){return this.options.get("sorter")(e)},i.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},i.prototype.setClasses=function(){var t=this;this.data.current(function(e){var i=e.map(function(e){return e.id.toString()});t.$results.find(".select2-results__option--selectable").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<i.indexOf(n)?(this.classList.add("select2-results__option--selected"),e.attr("aria-selected","true")):(this.classList.remove("select2-results__option--selected"),e.attr("aria-selected","false"))})})},i.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},i.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},i.prototype.option=function(e){var t=document.createElement("li");t.classList.add("select2-results__option"),t.classList.add("select2-results__option--selectable");var n={role:"option"},i=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var o in(null!=e.element&&i.call(e.element,":disabled")||null==e.element&&e.disabled)&&(n["aria-disabled"]="true",t.classList.remove("select2-results__option--selectable"),t.classList.add("select2-results__option--disabled")),null==e.id&&t.classList.remove("select2-results__option--selectable"),null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,t.classList.remove("select2-results__option--selectable"),t.classList.add("select2-results__option--group")),n){var s=n[o];t.setAttribute(o,s)}if(e.children){var r=h(t),a=document.createElement("strong");a.className="select2-results__group",this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),r.append(a),r.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e=l.getHighlightedResults();if(0!==e.length){var t=f.GetData(e[0],"data");e.hasClass("select2-results__option--selected")?l.trigger("close",{}):l.trigger("select",{data:t})}}),t.on("results:previous",function(){var e=l.getHighlightedResults(),t=l.$results.find(".select2-results__option--selectable"),n=t.index(e);if(!(n<=0)){var i=n-1;0===e.length&&(i=0);var o=t.eq(i);o.trigger("mouseenter");var s=l.$results.offset().top,r=o.offset().top,a=l.$results.scrollTop()+(r-s);0===i?l.$results.scrollTop(0):r-s<0&&l.$results.scrollTop(a)}}),t.on("results:next",function(){var e=l.getHighlightedResults(),t=l.$results.find(".select2-results__option--selectable"),n=t.index(e)+1;if(!(n>=t.length)){var i=t.eq(n);i.trigger("mouseenter");var o=l.$results.offset().top+l.$results.outerHeight(!1),s=i.offset().top+i.outerHeight(!1),r=l.$results.scrollTop()+s-o;0===n?l.$results.scrollTop(0):o<s&&l.$results.scrollTop(r)}}),t.on("results:focus",function(e){e.element[0].classList.add("select2-results__option--highlighted"),e.element[0].setAttribute("aria-selected","true")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,i=0<e.deltaY&&t-e.deltaY<=0,o=e.deltaY<0&&n<=l.$results.height();i?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):o&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option--selectable",function(e){var t=h(this),n=f.GetData(this,"data");t.hasClass("select2-results__option--selected")?l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{}):l.trigger("select",{originalEvent:e,data:n})}),this.$results.on("mouseenter",".select2-results__option--selectable",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),l.trigger("results:focus",{data:t,element:h(this)})})},i.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},i.prototype.destroy=function(){this.$results.remove()},i.prototype.ensureHighlightVisible=function(){var e=this.getHighlightedResults();if(0!==e.length){var t=this.$results.find(".select2-results__option--selectable").index(e),n=this.$results.offset().top,i=e.offset().top,o=this.$results.scrollTop()+(i-n),s=i-n;o-=2*e.outerHeight(!1),t<=2?this.$results.scrollTop(0):(s>this.$results.outerHeight()||s<0)&&this.$results.scrollTop(o)}},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),o=n(e,t);null==o?t.style.display="none":"string"==typeof o?t.innerHTML=i(o):h(t).append(o)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,i,o){function s(e,t){this.$element=e,this.options=t,s.__super__.constructor.call(this)}return i.Extend(s,i.Observable),s.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=i.GetData(this.$element[0],"old-tabindex")?this._tabindex=i.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},s.prototype.bind=function(e,t){var n=this,i=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===o.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},s.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},s.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&i.GetData(this,"element").select2("close")})})},s.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},s.prototype.position=function(e,t){t.find(".selection").append(e)},s.prototype.destroy=function(){this._detachCloseHandler(this.container)},s.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},s.prototype.isEnabled=function(){return!this.isDisabled()},s.prototype.isDisabled=function(){return this.options.get("disabled")},s}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,i){function o(){o.__super__.constructor.apply(this,arguments)}return n.Extend(o,t),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},o.prototype.bind=function(t,e){var n=this;o.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},o.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return e("<span></span>")},o.prototype.update=function(e){if(0!==e.length){var t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=this.display(t,n);n.empty().append(i);var o=t.title||t.text;o?n.attr("title",o):n.removeAttr("title")}else this.clear()},o}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(o,e,d){function s(e,t){s.__super__.constructor.apply(this,arguments)}return d.Extend(s,e),s.prototype.render=function(){var e=s.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},s.prototype.bind=function(e,t){var i=this;s.__super__.bind.apply(this,arguments);var n=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",n),this.$selection.on("click",function(e){i.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){if(!i.isDisabled()){var t=o(this).parent(),n=d.GetData(t[0],"data");i.trigger("unselect",{originalEvent:e,data:n})}}),this.$selection.on("keydown",".select2-selection__choice__remove",function(e){i.isDisabled()||e.stopPropagation()})},s.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},s.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},s.prototype.selectionContainer=function(){return o('<li class="select2-selection__choice"><button type="button" class="select2-selection__choice__remove" tabindex="-1"><span aria-hidden="true">&times;</span></button><span class="select2-selection__choice__display"></span></li>')},s.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",i=0;i<e.length;i++){var o=e[i],s=this.selectionContainer(),r=this.display(o,s),a=n+d.generateChars(4)+"-";o.id?a+=o.id:a+=d.generateChars(4),s.find(".select2-selection__choice__display").append(r).attr("id",a);var l=o.title||o.text;l&&s.attr("title",l);var c=this.options.get("translations").get("removeItem"),u=s.find(".select2-selection__choice__remove");u.attr("title",c()),u.attr("aria-label",c()),u.attr("aria-describedby",a),d.StoreData(s[0],"data",o),t.push(s)}this.$selection.find(".select2-selection__rendered").append(t)}},s}),e.define("select2/selection/placeholder",[],function(){function e(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n[0].classList.add("select2-selection__placeholder"),n[0].classList.remove("select2-selection__choice"),n},e.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var i=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(i)},e}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(s,i,a){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),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(e){i._handleClear(e)}),t.on("keypress",function(e){i._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var i=a.GetData(n[0],"data"),o=this.$element.val();this.$element.val(this.placeholder.id);var s={data:i};if(this.trigger("clear",s),s.prevented)this.$element.val(o);else{for(var r=0;r<i.length;r++)if(s={data:i[r]},this.trigger("unselect",s),s.prevented)return void this.$element.val(o);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=i.DELETE&&t.which!=i.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){if(e.call(this,t),this.$selection.find(".select2-selection__clear").remove(),!(0<this.$selection.find(".select2-selection__placeholder").length||0===t.length)){var n=this.$selection.find(".select2-selection__rendered").attr("id"),i=this.options.get("translations").get("removeAllItems"),o=s('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>');o.attr("title",i()),o.attr("aria-label",i()),o.attr("aria-describedby",n),a.StoreData(o[0],"data",t),this.$selection.prepend(o)}},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,l,c){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=i('<span class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');this.$searchContainer=t,this.$search=t.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete"));var n=e.call(this);return this._transferTabIndex(),n.append(this.$searchContainer),n},e.prototype.bind=function(e,t,n){var i=this,o=t.id+"-results",s=t.id+"-container";e.call(this,t,n),i.$search.attr("aria-describedby",s),t.on("open",function(){i.$search.attr("aria-controls",o),i.$search.trigger("focus")}),t.on("close",function(){i.$search.val(""),i.resizeSearch(),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.trigger("focus")}),t.on("enable",function(){i.$search.prop("disabled",!1),i._transferTabIndex()}),t.on("disable",function(){i.$search.prop("disabled",!0)}),t.on("focus",function(e){i.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){i.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){i._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){if(e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented(),e.which===c.BACKSPACE&&""===i.$search.val()){var t=i.$selection.find(".select2-selection__choice").last();if(0<t.length){var n=l.GetData(t[0],"data");i.searchRemoveChoice(n),e.preventDefault()}}}),this.$selection.on("click",".select2-search--inline",function(e){i.$search.val()&&e.stopPropagation()});var r=document.documentMode,a=r&&r<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){a?i.$selection.off("input.search input.searchcheck"):i.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){if(a&&"input"===e.type)i.$selection.off("input.search input.searchcheck");else{var t=e.which;t!=c.SHIFT&&t!=c.CTRL&&t!=c.ALT&&t!=c.TAB&&i.handleSearch(e)}})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var e=this.$search.val();this.trigger("query",{term:e})}this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="100%";""===this.$search.attr("placeholder")&&(e=.75*(this.$search.val().length+1)+"em");this.$search.css("width",e)},e}),e.define("select2/selection/selectionCss",["../utils"],function(i){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("selectionCssClass")||"";return-1!==n.indexOf(":all:")&&(n=n.replace(":all:",""),i.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(n),t},e}),e.define("select2/selection/eventRelay",["jquery"],function(r){function e(){}return e.prototype.bind=function(e,t,n){var i=this,o=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],s=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){if(-1!==o.indexOf(e)){t=t||{};var n=r.Event("select2:"+e,{params:t});i.$element.trigger(n),-1!==s.indexOf(e)&&(t.prevented=n.isDefaultPrevented())}})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function i(e){this.dict=e||{}}return i.prototype.all=function(){return this.dict},i.prototype.get=function(e){return this.dict[e]},i.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},i._cache={},i.loadPath=function(e){if(!(e in i._cache)){var t=n(e);i._cache[e]=t}return new i(i._cache[e])},i}),e.define("select2/diacritics",[],function(){return{"Ⓐ":"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","Œ":"OE","Ƣ":"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","œ":"oe","ƣ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(i){function n(e,t){n.__super__.constructor.call(this)}return i.Extend(n,i.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=i.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+i.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,l,c){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return l.Extend(n,e),n.prototype.current=function(e){var t=this;e(Array.prototype.map.call(this.$element[0].querySelectorAll(":checked"),function(e){return t.item(c(e))}))},n.prototype.select=function(o){var s=this;if(o.selected=!0,null!=o.element&&"option"===o.element.tagName.toLowerCase())return o.element.selected=!0,void this.$element.trigger("input").trigger("change");if(this.$element.prop("multiple"))this.current(function(e){var t=[];(o=[o]).push.apply(o,e);for(var n=0;n<o.length;n++){var i=o[n].id;-1===t.indexOf(i)&&t.push(i)}s.$element.val(t),s.$element.trigger("input").trigger("change")});else{var e=o.id;this.$element.val(e),this.$element.trigger("input").trigger("change")}},n.prototype.unselect=function(o){var s=this;if(this.$element.prop("multiple")){if(o.selected=!1,null!=o.element&&"option"===o.element.tagName.toLowerCase())return o.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n].id;i!==o.id&&-1===t.indexOf(i)&&t.push(i)}s.$element.val(t),s.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){l.RemoveData(this)})},n.prototype.query=function(i,e){var o=[],s=this;this.$element.children().each(function(){if("option"===this.tagName.toLowerCase()||"optgroup"===this.tagName.toLowerCase()){var e=c(this),t=s.item(e),n=s.matches(i,t);null!==n&&o.push(n)}}),e({results:o})},n.prototype.addOptions=function(e){this.$element.append(e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=this._normalizeItem(e);return n.element=t,l.StoreData(t,"data",n),c(t)},n.prototype.item=function(e){var t={};if(null!=(t=l.GetData(e[0],"data")))return t;var n=e[0];if("option"===n.tagName.toLowerCase())t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if("optgroup"===n.tagName.toLowerCase()){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var i=e.children("option"),o=[],s=0;s<i.length;s++){var r=c(i[s]),a=this.item(r);o.push(a)}t.children=o}return(t=this._normalizeItem(t)).element=e[0],l.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=c.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),c.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,t,f){function i(e,t){this._dataToConvert=t.get("data")||[],i.__super__.constructor.call(this,e,t)}return t.Extend(i,e),i.prototype.bind=function(e,t){i.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},i.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),i.__super__.select.call(this,n)},i.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),i=n.map(function(){return t.item(f(this)).id}).get(),o=[];function s(e){return function(){return f(this).val()==e.id}}for(var r=0;r<e.length;r++){var a=this._normalizeItem(e[r]);if(0<=i.indexOf(a.id)){var l=n.filter(s(a)),c=this.item(l),u=f.extend(!0,{},a,c),d=this.option(u);l.replaceWith(d)}else{var p=this.option(a);if(a.children){var h=this.convertToOptions(a.children);p.append(h)}o.push(p)}}return o},i}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,s){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return s.extend({},e,{q:e.term})},transport:function(e,t,n){var i=s.ajax(e);return i.then(t),i.fail(n),i}};return s.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,i){var o=this;null!=this._request&&(s.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var t=s.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=o.processResults(e,n);o.options.get("debug")&&window.console&&console.error&&(t&&t.results&&Array.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),i(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||o.trigger("results:message",{message:"errorLoading"})});o._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(t){function e(e,t,n){var i=n.get("tags"),o=n.get("createTag");void 0!==o&&(this.createTag=o);var s=n.get("insertTag");if(void 0!==s&&(this.insertTag=s),e.call(this,t,n),Array.isArray(i))for(var r=0;r<i.length;r++){var a=i[r],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var i=t.results,o=0;o<i.length;o++){var s=i[o],r=null!=s.children&&!e({results:s.children},!0);if((s.text||"").toUpperCase()===(c.term||"").toUpperCase()||r)return!n&&(t.data=i,void u(t))}if(n)return!0;var a=d.createTag(c);if(null!=a){var l=d.option(a);l.attr("data-select2-tag",!0),d.addOptions([l]),d.insertTag(i,a)}t.results=i,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){if(null==t.term)return null;var n=t.term.trim();return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||t(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var i=n.get("tokenizer");void 0!==i&&(this.tokenizer=i),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var i=this;t.term=t.term||"";var o=this.tokenizer(t,this.options,function(e){var t=i._normalizeItem(e);if(!i.$element.find("option").filter(function(){return d(this).val()===t.id}).length){var n=i.option(t);n.attr("data-select2-tag",!0),i._removeOldTags(),i.addOptions([n])}!function(e){i.trigger("select",{data:e})}(t)});o.term!==t.term&&(this.$search.length&&(this.$search.val(o.term),this.$search.trigger("focus")),t.term=o.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,i){for(var o=n.get("tokenSeparators")||[],s=t.term,r=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};r<s.length;){var l=s[r];if(-1!==o.indexOf(l)){var c=s.substr(0,r),u=a(d.extend({},t,{term:c}));null!=u?(i(u),s=s.substr(r+1)||"",r=0):r++}else r++}return{term:s}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(){i._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var i=this;this._checkIfMaximumSelected(function(){e.call(i,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var i=this;this.current(function(e){var t=null!=e?e.length:0;0<i.maximumSelectionLength&&t>=i.maximumSelectionLength?i.trigger("results:message",{message:"maximumSelected",args:{maximum:i.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery"],function(s){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=s('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),t.prepend(n),t},e.prototype.bind=function(e,t,n){var i=this,o=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){s(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-controls",o),i.$search.trigger("focus"),window.setTimeout(function(){i.$search.trigger("focus")},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.val(""),i.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||i.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer[0].classList.remove("select2-search--hide"):i.$searchContainer[0].classList.add("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")})},e.prototype.handleSearch=function(e){if(!this._keyUpPrevented){var t=this.$search.val();this.trigger("query",{term:t})}this._keyUpPrevented=!1},e.prototype.showSearch=function(e,t){return!0},e}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var o=t[i];this.placeholder.id===o.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);if(!this.loading&&e){var t=this.$results.offset().top+this.$results.outerHeight(!1);this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=t+50&&this.loadMore()}},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),i._bindContainerResultHandlers(t)}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t[0].classList.remove("select2"),t[0].classList.add("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){if(!this._containerResultsHandlersBound){var n=this;t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0}},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,o="resize.select2."+t.id,s="orientationchange.select2."+t.id,r=this.$container.parents().filter(a.hasScroll);r.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),r.on(i,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+o+" "+s,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+o)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown[0].classList.contains("select2-dropdown--above"),n=this.$dropdown[0].classList.contains("select2-dropdown--below"),i=null,o=this.$container.offset();o.bottom=o.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=o.top,s.bottom=o.top+s.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<o.top-r,u=l>o.bottom+r,d={left:o.left,top:s.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=s.top-h.top-r),null!=i&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+i),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,i=0;i<t.length;i++){var o=t[i];o.children?n+=e(o.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("close",function(e){i._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var i=this.getHighlightedResults();if(!(i.length<1)){var o=s.GetData(i[0],"data");null!=o.element&&o.element.selected||null==o.element&&o.selected||this.trigger("select",{data:o})}},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(e){i._selectTriggered(e)}),t.on("unselect",function(e){i._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/dropdown/dropdownCss",["../utils"],function(i){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("dropdownCssClass")||"";return-1!==n.indexOf(":all:")&&(n=n.replace(":all:",""),i.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(n),t},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"},removeItem:function(){return"Remove item"}}}),e.define("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/selectionCss","./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","./dropdown/dropdownCss","./i18n/en"],function(l,s,r,a,c,u,d,p,h,f,g,t,m,v,y,_,w,b,$,x,A,D,S,O,E,L,C,T,q,e){function n(){this.reset()}return n.prototype.apply=function(e){if(null==(e=l.extend(!0,{},this.defaults,e)).dataAdapter&&(null!=e.ajax?e.dataAdapter=y:null!=e.data?e.dataAdapter=v:e.dataAdapter=m,0<e.minimumInputLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,b)),0<e.maximumInputLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,$)),0<e.maximumSelectionLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,x)),e.tags&&(e.dataAdapter=f.Decorate(e.dataAdapter,_)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=f.Decorate(e.dataAdapter,w))),null==e.resultsAdapter&&(e.resultsAdapter=s,null!=e.ajax&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,O)),null!=e.placeholder&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,S)),e.selectOnClose&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,C))),null==e.dropdownAdapter){if(e.multiple)e.dropdownAdapter=A;else{var t=f.Decorate(A,D);e.dropdownAdapter=t}0!==e.minimumResultsForSearch&&(e.dropdownAdapter=f.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=f.Decorate(e.dropdownAdapter,T)),null!=e.dropdownCssClass&&(e.dropdownAdapter=f.Decorate(e.dropdownAdapter,q)),e.dropdownAdapter=f.Decorate(e.dropdownAdapter,E)}null==e.selectionAdapter&&(e.multiple?e.selectionAdapter=a:e.selectionAdapter=r,null!=e.placeholder&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,c)),e.allowClear&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,u)),e.multiple&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,d)),null!=e.selectionCssClass&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,p)),e.selectionAdapter=f.Decorate(e.selectionAdapter,h)),e.language=this._resolveLanguage(e.language),e.language.push("en");for(var n=[],i=0;i<e.language.length;i++){var o=e.language[i];-1===n.indexOf(o)&&n.push(o)}return e.language=n,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdLanguageBase:"./i18n/",autocomplete:"off",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:f.escapeMarkup,language:{},matcher:function e(t,n){if(null==t.term||""===t.term.trim())return n;if(n.children&&0<n.children.length){for(var i=l.extend(!0,{},n),o=n.children.length-1;0<=o;o--)null==e(t,n.children[o])&&i.children.splice(o,1);return 0<i.children.length?i:e(t,i)}var s=a(n.text).toUpperCase(),r=a(t.term).toUpperCase();return-1<s.indexOf(r)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,i=this.defaults.language,o=t.prop("lang"),s=t.closest("[lang]").prop("lang"),r=Array.prototype.concat.call(this._resolveLanguage(o),this._resolveLanguage(n),this._resolveLanguage(i),this._resolveLanguage(s));return e.language=r,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(l.isEmptyObject(e))return[];if(l.isPlainObject(e))return[e];var t;t=Array.isArray(e)?e:[e];for(var n=[],i=0;i<t.length;i++)if(n.push(t[i]),"string"==typeof t[i]&&0<t[i].indexOf("-")){var o=t[i].split("-")[0];n.push(o)}return n},n.prototype._processTranslations=function(e,t){for(var n=new g,i=0;i<e.length;i++){var o=new g,s=e[i];if("string"==typeof s)try{o=g.loadPath(s)}catch(e){try{s=this.defaults.amdLanguageBase+s,o=g.loadPath(s)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+s+'" could not be automatically loaded. A fallback will be used instead.')}}else o=l.isPlainObject(s)?new g(s):s;n.extend(o)}return n},n.prototype.set=function(e,t){var n={};n[l.camelCase(e)]=t;var i=f._convertData(n);l.extend(!0,this.defaults,i)},new n}),e.define("select2/options",["jquery","./defaults","./utils"],function(d,n,p){function e(e,t){this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=n.applyFromElement(this.options,t)),this.options=n.apply(this.options)}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.autocomplete&&e.prop("autocomplete")&&(this.options.autocomplete=e.prop("autocomplete")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"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.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"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."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function i(e,t){return t.toUpperCase()}for(var o=0;o<e[0].attributes.length;o++){var s=e[0].attributes[o].name,r="data-";if(s.substr(0,r.length)==r){var a=s.substring(r.length),l=p.GetData(e[0],a);n[a.replace(/-([a-z])/g,i)]=l}}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n);for(var u in c=p._convertData(c))-1<t.indexOf(u)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(t,c,u,i){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var i=this.options.get("dataAdapter");this.dataAdapter=new i(e,this.options);var o=this.render();this._placeContainer(o);var s=this.options.get("selectionAdapter");this.selection=new s(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,o);var r=this.options.get("dropdownAdapter");this.dropdown=new r(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,o);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e[0].classList.add("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var i=this._resolveWidth(e,"style");return null!=i?i:this._resolveWidth(e,"element")}if("element"==t){var o=e.outerWidth(!1);return o<=0?"auto":o+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var s=e.attr("style");if("string"!=typeof s)return null;for(var r=s.split(";"),a=0,l=r.length;a<l;a+=1){var c=r[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this._observer=new window.MutationObserver(function(e){t._syncA(),t._syncS(e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,i=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===i.indexOf(e)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container[0].classList.add("select2-container--open")}),this.on("close",function(){n.$container[0].classList.remove("select2-container--open")}),this.on("enable",function(){n.$container[0].classList.remove("select2-container--disabled")}),this.on("disable",function(){n.$container[0].classList.add("select2-container--disabled")}),this.on("blur",function(){n.$container[0].classList.remove("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===i.ESC||t===i.TAB||t===i.UP&&e.altKey?(n.close(e),e.preventDefault()):t===i.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===i.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===i.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===i.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===i.ENTER||t===i.SPACE||t===i.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e){var t=this;if(e.addedNodes&&0<e.addedNodes.length)for(var n=0;n<e.addedNodes.length;n++){if(e.addedNodes[n].selected)return!0}else{if(e.removedNodes&&0<e.removedNodes.length)return!0;if(Array.isArray(e))return e.some(function(e){return t._isChangeMutation(e)})}return!1},d.prototype._syncSubtree=function(e){var t=this._isChangeMutation(e),n=this;t&&this.dataAdapter.current(function(e){n.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,i={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in i){var o=i[e],s={prevented:!1,name:e,args:t};if(n.call(this,o,s),s.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},d.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){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!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&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()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){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==e||0===e.length)return this.$element.val();var t=e[0];Array.isArray(t)&&(t=t.map(function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this._observer.disconnect(),this._observer=null,this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element[0].classList.remove("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),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},d.prototype.render=function(){var e=t('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container[0].classList.add("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("select2/dropdown/attachContainer",[],function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t[0].classList.add("select2-dropdown--below"),n[0].classList.add("select2-container--below")},e}),e.define("select2/dropdown/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),e.define("select2/selection/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),l=function(p){var h,f,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],g=Array.prototype.slice;if(p.event.fixHooks)for(var n=e.length;n;)p.event.fixHooks[e[--n]]=p.event.mouseHooks;var m=p.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;p.data(this,"mousewheel-line-height",m.getLineHeight(this)),p.data(this,"mousewheel-page-height",m.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;p.removeData(this,"mousewheel-line-height"),p.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=p(e),n=t["offsetParent"in p.fn?"offsetParent":"parent"]();return n.length||(n=p("body")),parseInt(n.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return p(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=g.call(arguments,1),o=0,s=0,r=0,a=0,l=0;if((e=p.event.fix(n)).type="mousewheel","detail"in n&&(r=-1*n.detail),"wheelDelta"in n&&(r=n.wheelDelta),"wheelDeltaY"in n&&(r=n.wheelDeltaY),"wheelDeltaX"in n&&(s=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(s=-1*r,r=0),o=0===r?s:r,"deltaY"in n&&(o=r=-1*n.deltaY),"deltaX"in n&&(s=n.deltaX,0===r&&(o=-1*s)),0!==r||0!==s){if(1===n.deltaMode){var c=p.data(this,"mousewheel-line-height");o*=c,r*=c,s*=c}else if(2===n.deltaMode){var u=p.data(this,"mousewheel-page-height");o*=u,r*=u,s*=u}if(t=Math.max(Math.abs(r),Math.abs(s)),(!f||t<f)&&y(n,f=t)&&(f/=40),y(n,t)&&(o/=40,s/=40,r/=40),o=Math[1<=o?"floor":"ceil"](o/f),s=Math[1<=s?"floor":"ceil"](s/f),r=Math[1<=r?"floor":"ceil"](r/f),m.settings.normalizeOffset&&this.getBoundingClientRect){var d=this.getBoundingClientRect();a=e.clientX-d.left,l=e.clientY-d.top}return e.deltaX=s,e.deltaY=r,e.deltaFactor=f,e.offsetX=a,e.offsetY=l,e.deltaMode=0,i.unshift(e,o,s,r),h&&clearTimeout(h),h=setTimeout(v,200),(p.event.dispatch||p.event.handle).apply(this,i)}}function v(){f=null}function y(e,t){return m.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}p.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})},"function"==typeof e.define&&e.define.amd?e.define("jquery-mousewheel",["jquery"],l):"object"==typeof exports?module.exports=l:l(d),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(o,e,s,t,r){if(null==o.fn.select2){var a=["open","close","destroy"];o.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=o.extend(!0,{},t);new s(o(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=r.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,i)}),-1<a.indexOf(t)?this:n}}return null==o.fn.select2.defaults&&(o.fn.select2.defaults=t),s}),{define:e.define,require:e.require}}(),t=e.require("jquery.select2");return d.fn.select2.amd=e,t});
1
+ !function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(t){var e,n,i,o,h,s,r,f,g,m,v,y,_,a,l,w,c,u=(t&&t.fn&&t.fn.select2&&t.fn.select2.amd&&(e=t.fn.select2.amd),e&&e.requirejs||(e?i=e:e={},m={},v={},y={},_={},a=Object.prototype.hasOwnProperty,l=[].slice,w=/\.js$/,f=function(e,t){var n,i,o=p(e),s=o[0],r=t[1];return e=o[1],s&&(n=A(s=d(s,r))),s?e=n&&n.normalize?n.normalize(e,(i=r,function(e){return d(e,i)})):d(e,r):(s=(o=p(e=d(e,r)))[0],e=o[1],s&&(n=A(s))),{f:s?s+"!"+e:e,n:e,pr:s,p:n}},g={require:function(e){return x(e)},exports:function(e){var t=m[e];return void 0!==t?t:m[e]={}},module:function(e){return{id:e,uri:"",exports:m[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},s=function(e,t,n,i){var o,s,r,a,l,c,u=[],d=typeof n,p=D(i=i||e);if("undefined"==d||"function"==d){for(t=!t.length&&n.length?["require","exports","module"]:t,l=0;l<t.length;l+=1)if("require"===(s=(a=f(t[l],p)).f))u[l]=g.require(e);else if("exports"===s)u[l]=g.exports(e),c=!0;else if("module"===s)o=u[l]=g.module(e);else if(b(m,s)||b(v,s)||b(_,s))u[l]=A(s);else{if(!a.p)throw new Error(e+" missing "+s);a.p.load(a.n,x(i,!0),function(t){return function(e){m[t]=e}}(s),{}),u[l]=m[s]}r=n?n.apply(m[e],u):void 0,e&&(o&&o.exports!==h&&o.exports!==m[e]?m[e]=o.exports:r===h&&c||(m[e]=r))}else e&&(m[e]=n)},n=i=r=function(e,t,n,i,o){if("string"==typeof e)return g[e]?g[e](t):A(f(e,D(t)).f);if(!e.splice){if((y=e).deps&&r(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=h}return t=t||function(){},"function"==typeof n&&(n=i,i=o),i?s(h,e,t,n):setTimeout(function(){s(h,e,t,n)},4),r},r.config=function(e){return r(e)},n._defined=m,(o=function(e,t,n){if("string"!=typeof e)throw new Error("See almond README: incorrect module build, no module name");t.splice||(n=t,t=[]),b(m,e)||b(v,e)||(v[e]=[e,t,n])}).amd={jQuery:!0},e.requirejs=n,e.require=i,e.define=o),e.define("almond",function(){}),e.define("jquery",[],function(){var e=t||$;return null==e&&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."),e}),e.define("select2/utils",["jquery"],function(s){var o={};function c(e){var t=e.prototype,n=[];for(var i in t)"function"==typeof t[i]&&"constructor"!==i&&n.push(i);return n}function e(){this.listeners={}}o.Extend=function(e,t){var n={}.hasOwnProperty;function i(){this.constructor=e}for(var o in t)n.call(t,o)&&(e[o]=t[o]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},o.Decorate=function(i,o){var e=c(o),t=c(i);function s(){var e=Array.prototype.unshift,t=o.prototype.constructor.length,n=i.prototype.constructor;0<t&&(e.call(arguments,i.prototype.constructor),n=o.prototype.constructor),n.apply(this,arguments)}o.displayName=i.displayName,s.prototype=new function(){this.constructor=s};for(var n=0;n<t.length;n++){var r=t[n];s.prototype[r]=i.prototype[r]}for(var a=0;a<e.length;a++){var l=e[a];s.prototype[l]=function(e){var t=function(){};e in s.prototype&&(t=s.prototype[e]);var n=o.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}(l)}return s},e.prototype.on=function(e,t){this.listeners=this.listeners||{},e in this.listeners?this.listeners[e].push(t):this.listeners[e]=[t]},e.prototype.trigger=function(e){var t=Array.prototype.slice,n=t.call(arguments,1);this.listeners=this.listeners||{},null==n&&(n=[]),0===n.length&&n.push({}),(n[0]._type=e)in this.listeners&&this.invoke(this.listeners[e],t.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},e.prototype.invoke=function(e,t){for(var n=0,i=e.length;n<i;n++)e[n].apply(this,t)},o.Observable=e,o.generateChars=function(e){for(var t="",n=0;n<e;n++)t+=Math.floor(36*Math.random()).toString(36);return t},o.bind=function(e,t){return function(){e.apply(t,arguments)}},o._convertData=function(e){for(var t in e){var n=t.split("-"),i=e;if(1!==n.length){for(var o=0;o<n.length;o++){var s=n[o];(s=s.substring(0,1).toLowerCase()+s.substring(1))in i||(i[s]={}),o==n.length-1&&(i[s]=e[t]),i=i[s]}delete e[t]}}return e},o.hasScroll=function(e,t){var n=s(t),i=t.style.overflowX,o=t.style.overflowY;return(i!==o||"hidden"!==o&&"visible"!==o)&&("scroll"===i||"scroll"===o||n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth)},o.escapeMarkup=function(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},o.__cache={};var n=0;return o.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null!=t||(t=e.id?"select2-data-"+e.id:"select2-data-"+(++n).toString()+"-"+o.generateChars(4),e.setAttribute("data-select2-id",t)),t},o.StoreData=function(e,t,n){var i=o.GetUniqueElementId(e);o.__cache[i]||(o.__cache[i]={}),o.__cache[i][t]=n},o.GetData=function(e,t){var n=o.GetUniqueElementId(e);return t?o.__cache[n]&&null!=o.__cache[n][t]?o.__cache[n][t]:s(e).data(t):o.__cache[n]},o.RemoveData=function(e){var t=o.GetUniqueElementId(e);null!=o.__cache[t]&&delete o.__cache[t],e.removeAttribute("data-select2-id")},o.copyNonInternalCssClasses=function(e,t){var n=(n=e.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0===e.indexOf("select2-")}),i=(i=t.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0!==e.indexOf("select2-")}),o=n.concat(i);e.setAttribute("class",o.join(" "))},o}),e.define("select2/results",["jquery","./utils"],function(h,f){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return f.Extend(i,f.Observable),i.prototype.render=function(){var e=h('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=h('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null!=e.results&&0!==e.results.length){e.results=this.sort(e.results);for(var n=0;n<e.results.length;n++){var i=e.results[n],o=this.option(i);t.push(o)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},i.prototype.position=function(e,t){t.find(".select2-results").append(e)},i.prototype.sort=function(e){return this.options.get("sorter")(e)},i.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");0<t.length?t.first().trigger("mouseenter"):e.first().trigger("mouseenter"),this.ensureHighlightVisible()},i.prototype.setClasses=function(){var t=this;this.data.current(function(e){var i=e.map(function(e){return e.id.toString()});t.$results.find(".select2-results__option--selectable").each(function(){var e=h(this),t=f.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<i.indexOf(n)?(this.classList.add("select2-results__option--selected"),e.attr("aria-selected","true")):(this.classList.remove("select2-results__option--selected"),e.attr("aria-selected","false"))})})},i.prototype.showLoading=function(e){this.hideLoading();var t={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},n=this.option(t);n.className+=" loading-results",this.$results.prepend(n)},i.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},i.prototype.option=function(e){var t=document.createElement("li");t.classList.add("select2-results__option"),t.classList.add("select2-results__option--selectable");var n={role:"option"},i=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(var o in(null!=e.element&&i.call(e.element,":disabled")||null==e.element&&e.disabled)&&(n["aria-disabled"]="true",t.classList.remove("select2-results__option--selectable"),t.classList.add("select2-results__option--disabled")),null==e.id&&t.classList.remove("select2-results__option--selectable"),null!=e._resultId&&(t.id=e._resultId),e.title&&(t.title=e.title),e.children&&(n.role="group",n["aria-label"]=e.text,t.classList.remove("select2-results__option--selectable"),t.classList.add("select2-results__option--group")),n){var s=n[o];t.setAttribute(o,s)}if(e.children){var r=h(t),a=document.createElement("strong");a.className="select2-results__group",this.template(e,a);for(var l=[],c=0;c<e.children.length;c++){var u=e.children[c],d=this.option(u);l.push(d)}var p=h("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});p.append(l),r.append(a),r.append(p)}else this.template(e,t);return f.StoreData(t,"data",e),t},i.prototype.bind=function(t,e){var l=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){l.clear(),l.append(e.data),t.isOpen()&&(l.setClasses(),l.highlightFirstItem())}),t.on("results:append",function(e){l.append(e.data),t.isOpen()&&l.setClasses()}),t.on("query",function(e){l.hideMessages(),l.showLoading(e)}),t.on("select",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(l.setClasses(),l.options.get("scrollAfterSelect")&&l.highlightFirstItem())}),t.on("open",function(){l.$results.attr("aria-expanded","true"),l.$results.attr("aria-hidden","false"),l.setClasses(),l.ensureHighlightVisible()}),t.on("close",function(){l.$results.attr("aria-expanded","false"),l.$results.attr("aria-hidden","true"),l.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=l.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e,t=l.getHighlightedResults();0!==t.length&&(e=f.GetData(t[0],"data"),t.hasClass("select2-results__option--selected")?l.trigger("close",{}):l.trigger("select",{data:e}))}),t.on("results:previous",function(){var e,t,n,i,o,s=l.getHighlightedResults(),r=l.$results.find(".select2-results__option--selectable"),a=r.index(s);a<=0||(e=a-1,0===s.length&&(e=0),(t=r.eq(e)).trigger("mouseenter"),n=l.$results.offset().top,i=t.offset().top,o=l.$results.scrollTop()+(i-n),0===e?l.$results.scrollTop(0):i-n<0&&l.$results.scrollTop(o))}),t.on("results:next",function(){var e,t,n,i,o=l.getHighlightedResults(),s=l.$results.find(".select2-results__option--selectable"),r=s.index(o)+1;r>=s.length||((e=s.eq(r)).trigger("mouseenter"),t=l.$results.offset().top+l.$results.outerHeight(!1),n=e.offset().top+e.outerHeight(!1),i=l.$results.scrollTop()+n-t,0===r?l.$results.scrollTop(0):t<n&&l.$results.scrollTop(i))}),t.on("results:focus",function(e){e.element[0].classList.add("select2-results__option--highlighted"),e.element[0].setAttribute("aria-selected","true")}),t.on("results:message",function(e){l.displayMessage(e)}),h.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=l.$results.scrollTop(),n=l.$results.get(0).scrollHeight-t+e.deltaY,i=0<e.deltaY&&t-e.deltaY<=0,o=e.deltaY<0&&n<=l.$results.height();i?(l.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):o&&(l.$results.scrollTop(l.$results.get(0).scrollHeight-l.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option--selectable",function(e){var t=h(this),n=f.GetData(this,"data");t.hasClass("select2-results__option--selected")?l.options.get("multiple")?l.trigger("unselect",{originalEvent:e,data:n}):l.trigger("close",{}):l.trigger("select",{originalEvent:e,data:n})}),this.$results.on("mouseenter",".select2-results__option--selectable",function(e){var t=f.GetData(this,"data");l.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),l.trigger("results:focus",{data:t,element:h(this)})})},i.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},i.prototype.destroy=function(){this.$results.remove()},i.prototype.ensureHighlightVisible=function(){var e,t,n,i,o,s=this.getHighlightedResults();0!==s.length&&(e=this.$results.find(".select2-results__option--selectable").index(s),t=this.$results.offset().top,n=s.offset().top,i=this.$results.scrollTop()+(n-t),o=n-t,i-=2*s.outerHeight(!1),e<=2?this.$results.scrollTop(0):(o>this.$results.outerHeight()||o<0)&&this.$results.scrollTop(i))},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),o=n(e,t);null==o?t.style.display="none":"string"==typeof o?t.innerHTML=i(o):h(t).append(o)},i}),e.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),e.define("select2/selection/base",["jquery","../utils","../keys"],function(n,i,o){function s(e,t){this.$element=e,this.options=t,s.__super__.constructor.call(this)}return i.Extend(s,i.Observable),s.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=i.GetData(this.$element[0],"old-tabindex")?this._tabindex=i.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},s.prototype.bind=function(e,t){var n=this,i=e.id+"-results";this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===o.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data)}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",i),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection.removeAttr("aria-activedescendant"),n.$selection.removeAttr("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},s.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||n.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},s.prototype._attachCloseHandler=function(e){n(document.body).on("mousedown.select2."+e.id,function(e){var t=n(e.target).closest(".select2");n(".select2.select2-container--open").each(function(){this!=t[0]&&i.GetData(this,"element").select2("close")})})},s.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},s.prototype.position=function(e,t){t.find(".selection").append(e)},s.prototype.destroy=function(){this._detachCloseHandler(this.container)},s.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},s.prototype.isEnabled=function(){return!this.isDisabled()},s.prototype.isDisabled=function(){return this.options.get("disabled")},s}),e.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,i){function o(){o.__super__.constructor.apply(this,arguments)}return n.Extend(o,t),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),e},o.prototype.bind=function(t,e){var n=this;o.__super__.bind.apply(this,arguments);var i=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",i).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",i),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},o.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return e("<span></span>")},o.prototype.update=function(e){var t,n,i,o;0!==e.length?(t=e[0],n=this.$selection.find(".select2-selection__rendered"),i=this.display(t,n),n.empty().append(i),(o=t.title||t.text)?n.attr("title",o):n.removeAttr("title")):this.clear()},o}),e.define("select2/selection/multiple",["jquery","./base","../utils"],function(o,e,d){function s(e,t){s.__super__.constructor.apply(this,arguments)}return d.Extend(s,e),s.prototype.render=function(){var e=s.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},s.prototype.bind=function(e,t){var i=this;s.__super__.bind.apply(this,arguments);var n=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",n),this.$selection.on("click",function(e){i.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){var t,n;i.isDisabled()||(t=o(this).parent(),n=d.GetData(t[0],"data"),i.trigger("unselect",{originalEvent:e,data:n}))}),this.$selection.on("keydown",".select2-selection__choice__remove",function(e){i.isDisabled()||e.stopPropagation()})},s.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},s.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},s.prototype.selectionContainer=function(){return o('<li class="select2-selection__choice"><button type="button" class="select2-selection__choice__remove" tabindex="-1"><span aria-hidden="true">&times;</span></button><span class="select2-selection__choice__display"></span></li>')},s.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",i=0;i<e.length;i++){var o=e[i],s=this.selectionContainer(),r=this.display(o,s),a=n+d.generateChars(4)+"-";o.id?a+=o.id:a+=d.generateChars(4),s.find(".select2-selection__choice__display").append(r).attr("id",a);var l=o.title||o.text;l&&s.attr("title",l);var c=this.options.get("translations").get("removeItem"),u=s.find(".select2-selection__choice__remove");u.attr("title",c()),u.attr("aria-label",c()),u.attr("aria-describedby",a),d.StoreData(s[0],"data",o),t.push(s)}this.$selection.find(".select2-selection__rendered").append(t)}},s}),e.define("select2/selection/placeholder",[],function(){function e(e,t,n){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n)}return e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.createPlaceholder=function(e,t){var n=this.selectionContainer();return n.html(this.display(t)),n[0].classList.add("select2-selection__placeholder"),n[0].classList.remove("select2-selection__choice"),n},e.prototype.update=function(e,t){var n=1==t.length&&t[0].id!=this.placeholder.id;if(1<t.length||n)return e.call(this,t);this.clear();var i=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(i)},e}),e.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(s,i,a){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),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(e){i._handleClear(e)}),t.on("keypress",function(e){i._handleKeyboardClear(e,t)})},e.prototype._handleClear=function(e,t){if(!this.isDisabled()){var n=this.$selection.find(".select2-selection__clear");if(0!==n.length){t.stopPropagation();var i=a.GetData(n[0],"data"),o=this.$element.val();this.$element.val(this.placeholder.id);var s={data:i};if(this.trigger("clear",s),s.prevented)this.$element.val(o);else{for(var r=0;r<i.length;r++)if(s={data:i[r]},this.trigger("unselect",s),s.prevented)return void this.$element.val(o);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=i.DELETE&&t.which!=i.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){var n,i,o;e.call(this,t),this.$selection.find(".select2-selection__clear").remove(),0<this.$selection.find(".select2-selection__placeholder").length||0===t.length||(n=this.$selection.find(".select2-selection__rendered").attr("id"),i=this.options.get("translations").get("removeAllItems"),(o=s('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>')).attr("title",i()),o.attr("aria-label",i()),o.attr("aria-describedby",n),a.StoreData(o[0],"data",t),this.$selection.prepend(o))},e}),e.define("select2/selection/search",["jquery","../utils","../keys"],function(i,l,c){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=i('<span class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');this.$searchContainer=t,this.$search=t.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete"));var n=e.call(this);return this._transferTabIndex(),n.append(this.$searchContainer),n},e.prototype.bind=function(e,t,n){var i=this,o=t.id+"-results",s=t.id+"-container";e.call(this,t,n),i.$search.attr("aria-describedby",s),t.on("open",function(){i.$search.attr("aria-controls",o),i.$search.trigger("focus")}),t.on("close",function(){i.$search.val(""),i.resizeSearch(),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.trigger("focus")}),t.on("enable",function(){i.$search.prop("disabled",!1),i._transferTabIndex()}),t.on("disable",function(){i.$search.prop("disabled",!0)}),t.on("focus",function(e){i.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){i.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){i._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){var t,n;e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented(),e.which!==c.BACKSPACE||""!==i.$search.val()||0<(t=i.$selection.find(".select2-selection__choice").last()).length&&(n=l.GetData(t[0],"data"),i.searchRemoveChoice(n),e.preventDefault())}),this.$selection.on("click",".select2-search--inline",function(e){i.$search.val()&&e.stopPropagation()});var r=document.documentMode,a=r&&r<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){a?i.$selection.off("input.search input.searchcheck"):i.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){var t;a&&"input"===e.type?i.$selection.off("input.search input.searchcheck"):(t=e.which)!=c.SHIFT&&t!=c.CTRL&&t!=c.ALT&&t!=c.TAB&&i.handleSearch(e)})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){var e;this.resizeSearch(),this._keyUpPrevented||(e=this.$search.val(),this.trigger("query",{term:e})),this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="100%";""===this.$search.attr("placeholder")&&(e=.75*(this.$search.val().length+1)+"em"),this.$search.css("width",e)},e}),e.define("select2/selection/selectionCss",["../utils"],function(i){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("selectionCssClass")||"";return-1!==n.indexOf(":all:")&&(n=n.replace(":all:",""),i.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(n),t},e}),e.define("select2/selection/eventRelay",["jquery"],function(r){function e(){}return e.prototype.bind=function(e,t,n){var i=this,o=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],s=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){var n;-1!==o.indexOf(e)&&(t=t||{},n=r.Event("select2:"+e,{params:t}),i.$element.trigger(n),-1!==s.indexOf(e)&&(t.prevented=n.isDefaultPrevented()))})},e}),e.define("select2/translation",["jquery","require"],function(t,n){function i(e){this.dict=e||{}}return i.prototype.all=function(){return this.dict},i.prototype.get=function(e){return this.dict[e]},i.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},i._cache={},i.loadPath=function(e){var t;return e in i._cache||(t=n(e),i._cache[e]=t),new i(i._cache[e])},i}),e.define("select2/diacritics",[],function(){return{"Ⓐ":"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","Œ":"OE","Ƣ":"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","œ":"oe","ƣ":"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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),e.define("select2/data/base",["../utils"],function(i){function n(e,t){n.__super__.constructor.call(this)}return i.Extend(n,i.Observable),n.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},n.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},n.prototype.bind=function(e,t){},n.prototype.destroy=function(){},n.prototype.generateResultId=function(e,t){var n=e.id+"-result-";return n+=i.generateChars(4),null!=t.id?n+="-"+t.id.toString():n+="-"+i.generateChars(4),n},n}),e.define("select2/data/select",["./base","../utils","jquery"],function(e,l,c){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return l.Extend(n,e),n.prototype.current=function(e){var t=this;e(Array.prototype.map.call(this.$element[0].querySelectorAll(":checked"),function(e){return t.item(c(e))}))},n.prototype.select=function(o){var e,s=this;if(o.selected=!0,null!=o.element&&"option"===o.element.tagName.toLowerCase())return o.element.selected=!0,void this.$element.trigger("input").trigger("change");this.$element.prop("multiple")?this.current(function(e){var t=[];(o=[o]).push.apply(o,e);for(var n=0;n<o.length;n++){var i=o[n].id;-1===t.indexOf(i)&&t.push(i)}s.$element.val(t),s.$element.trigger("input").trigger("change")}):(e=o.id,this.$element.val(e),this.$element.trigger("input").trigger("change"))},n.prototype.unselect=function(o){var s=this;if(this.$element.prop("multiple")){if(o.selected=!1,null!=o.element&&"option"===o.element.tagName.toLowerCase())return o.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n].id;i!==o.id&&-1===t.indexOf(i)&&t.push(i)}s.$element.val(t),s.$element.trigger("input").trigger("change")})}},n.prototype.bind=function(e,t){var n=this;(this.container=e).on("select",function(e){n.select(e.data)}),e.on("unselect",function(e){n.unselect(e.data)})},n.prototype.destroy=function(){this.$element.find("*").each(function(){l.RemoveData(this)})},n.prototype.query=function(i,e){var o=[],s=this;this.$element.children().each(function(){var e,t,n;"option"!==this.tagName.toLowerCase()&&"optgroup"!==this.tagName.toLowerCase()||(e=c(this),t=s.item(e),null!==(n=s.matches(i,t))&&o.push(n))}),e({results:o})},n.prototype.addOptions=function(e){this.$element.append(e)},n.prototype.option=function(e){var t;e.children?(t=document.createElement("optgroup")).label=e.text:void 0!==(t=document.createElement("option")).textContent?t.textContent=e.text:t.innerText=e.text,void 0!==e.id&&(t.value=e.id),e.disabled&&(t.disabled=!0),e.selected&&(t.selected=!0),e.title&&(t.title=e.title);var n=this._normalizeItem(e);return n.element=t,l.StoreData(t,"data",n),c(t)},n.prototype.item=function(e){var t={};if(null!=(t=l.GetData(e[0],"data")))return t;var n=e[0];if("option"===n.tagName.toLowerCase())t={id:e.val(),text:e.text(),disabled:e.prop("disabled"),selected:e.prop("selected"),title:e.prop("title")};else if("optgroup"===n.tagName.toLowerCase()){t={text:e.prop("label"),children:[],title:e.prop("title")};for(var i=e.children("option"),o=[],s=0;s<i.length;s++){var r=c(i[s]),a=this.item(r);o.push(a)}t.children=o}return(t=this._normalizeItem(t)).element=e[0],l.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){return e!==Object(e)&&(e={id:e,text:e}),null!=(e=c.extend({},{text:""},e)).id&&(e.id=e.id.toString()),null!=e.text&&(e.text=e.text.toString()),null==e._resultId&&e.id&&null!=this.container&&(e._resultId=this.generateResultId(this.container,e)),c.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),e.define("select2/data/array",["./select","../utils","jquery"],function(e,t,h){function i(e,t){this._dataToConvert=t.get("data")||[],i.__super__.constructor.call(this,e,t)}return t.Extend(i,e),i.prototype.bind=function(e,t){i.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},i.prototype.select=function(n){var e=this.$element.find("option").filter(function(e,t){return t.value==n.id.toString()});0===e.length&&(e=this.option(n),this.addOptions(e)),i.__super__.select.call(this,n)},i.prototype.convertToOptions=function(e){for(var t=this,n=this.$element.find("option"),i=n.map(function(){return t.item(h(this)).id}).get(),o=[],s=0;s<e.length;s++){var r,a,l,c,u,d,p=this._normalizeItem(e[s]);0<=i.indexOf(p.id)?(r=n.filter(function(e){return function(){return h(this).val()==e.id}}(p)),a=this.item(r),l=h.extend(!0,{},p,a),c=this.option(l),r.replaceWith(c)):(u=this.option(p),p.children&&(d=this.convertToOptions(p.children),u.append(d)),o.push(u))}return o},i}),e.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,s){function n(e,t){this.ajaxOptions=this._applyDefaults(t.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),n.__super__.constructor.call(this,e,t)}return t.Extend(n,e),n.prototype._applyDefaults=function(e){var t={data:function(e){return s.extend({},e,{q:e.term})},transport:function(e,t,n){var i=s.ajax(e);return i.then(t),i.fail(n),i}};return s.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(n,i){var o=this;null!=this._request&&("function"==typeof this._request.abort&&this._request.abort(),this._request=null);var t=s.extend({type:"GET"},this.ajaxOptions);function e(){var e=t.transport(t,function(e){var t=o.processResults(e,n);o.options.get("debug")&&window.console&&console.error&&(t&&t.results&&Array.isArray(t.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),i(t)},function(){"status"in e&&(0===e.status||"0"===e.status)||o.trigger("results:message",{message:"errorLoading"})});o._request=e}"function"==typeof t.url&&(t.url=t.url.call(this.$element,n)),"function"==typeof t.data&&(t.data=t.data.call(this.$element,n)),this.ajaxOptions.delay&&null!=n.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),e.define("select2/data/tags",["jquery"],function(t){function e(e,t,n){var i=n.get("tags"),o=n.get("createTag");void 0!==o&&(this.createTag=o);var s=n.get("insertTag");if(void 0!==s&&(this.insertTag=s),e.call(this,t,n),Array.isArray(i))for(var r=0;r<i.length;r++){var a=i[r],l=this._normalizeItem(a),c=this.option(l);this.$element.append(c)}}return e.prototype.query=function(e,c,u){var d=this;this._removeOldTags(),null!=c.term&&null==c.page?e.call(this,c,function e(t,n){for(var i=t.results,o=0;o<i.length;o++){var s=i[o],r=null!=s.children&&!e({results:s.children},!0);if((s.text||"").toUpperCase()===(c.term||"").toUpperCase()||r)return!n&&(t.data=i,void u(t))}if(n)return!0;var a,l=d.createTag(c);null!=l&&((a=d.option(l)).attr("data-select2-tag",!0),d.addOptions([a]),d.insertTag(i,l)),t.results=i,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){if(null==t.term)return null;var n=t.term.trim();return""===n?null:{id:n,text:n}},e.prototype.insertTag=function(e,t,n){t.unshift(n)},e.prototype._removeOldTags=function(e){this.$element.find("option[data-select2-tag]").each(function(){this.selected||t(this).remove()})},e}),e.define("select2/data/tokenizer",["jquery"],function(d){function e(e,t,n){var i=n.get("tokenizer");void 0!==i&&(this.tokenizer=i),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$search=t.dropdown.$search||t.selection.$search||n.find(".select2-search__field")},e.prototype.query=function(e,t,n){var o=this;t.term=t.term||"";var i=this.tokenizer(t,this.options,function(e){var t,n,i=o._normalizeItem(e);o.$element.find("option").filter(function(){return d(this).val()===i.id}).length||((t=o.option(i)).attr("data-select2-tag",!0),o._removeOldTags(),o.addOptions([t])),n=i,o.trigger("select",{data:n})});i.term!==t.term&&(this.$search.length&&(this.$search.val(i.term),this.$search.trigger("focus")),t.term=i.term),e.call(this,t,n)},e.prototype.tokenizer=function(e,t,n,i){for(var o=n.get("tokenSeparators")||[],s=t.term,r=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};r<s.length;){var l,c,u=s[r];-1!==o.indexOf(u)?(l=s.substr(0,r),null!=(c=a(d.extend({},t,{term:l})))?(i(c),s=s.substr(r+1)||"",r=0):r++):r++}return{term:s}},e}),e.define("select2/data/minimumInputLength",[],function(){function e(e,t,n){this.minimumInputLength=n.get("minimumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",t.term.length<this.minimumInputLength?this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumInputLength",[],function(){function e(e,t,n){this.maximumInputLength=n.get("maximumInputLength"),e.call(this,t,n)}return e.prototype.query=function(e,t,n){t.term=t.term||"",0<this.maximumInputLength&&t.term.length>this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),e.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(){i._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var i=this;this._checkIfMaximumSelected(function(){e.call(i,t,n)})},e.prototype._checkIfMaximumSelected=function(e,n){var i=this;this.current(function(e){var t=null!=e?e.length:0;0<i.maximumSelectionLength&&t>=i.maximumSelectionLength?i.trigger("results:message",{message:"maximumSelected",args:{maximum:i.maximumSelectionLength}}):n&&n()})},e}),e.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('<span class="select2-dropdown"><span class="select2-results"></span></span>');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),e.define("select2/dropdown/search",["jquery"],function(s){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=s('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" /></span>');return this.$searchContainer=n,this.$search=n.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),t.prepend(n),t},e.prototype.bind=function(e,t,n){var i=this,o=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){s(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-controls",o),i.$search.trigger("focus"),window.setTimeout(function(){i.$search.trigger("focus")},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search.removeAttr("aria-controls"),i.$search.removeAttr("aria-activedescendant"),i.$search.val(""),i.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||i.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer[0].classList.remove("select2-search--hide"):i.$searchContainer[0].classList.add("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search.removeAttr("aria-activedescendant")})},e.prototype.handleSearch=function(e){var t;this._keyUpPrevented||(t=this.$search.val(),this.trigger("query",{term:t})),this._keyUpPrevented=!1},e.prototype.showSearch=function(e,t){return!0},e}),e.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return"string"==typeof t&&(t={id:"",text:t}),t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var o=t[i];this.placeholder.id===o.id&&n.splice(i,1)}return n},e}),e.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e,t=n.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&t&&(e=this.$results.offset().top+this.$results.outerHeight(!1),this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=e+50&&this.loadMore())},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),e.define("select2/dropdown/attachBody",["jquery","../utils"],function(f,a){function e(e,t,n){this.$dropdownParent=f(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),i._bindContainerResultHandlers(t)}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t[0].classList.remove("select2"),t[0].classList.add("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=f("<span></span>"),n=e.call(this);return t.append(n),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){var n;this._containerResultsHandlersBound||(n=this,t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0)},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,o="resize.select2."+t.id,s="orientationchange.select2."+t.id,r=this.$container.parents().filter(a.hasScroll);r.each(function(){a.StoreData(this,"select2-scroll-position",{x:f(this).scrollLeft(),y:f(this).scrollTop()})}),r.on(i,function(e){var t=a.GetData(this,"select2-scroll-position");f(this).scrollTop(t.y)}),f(window).on(i+" "+o+" "+s,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id;this.$container.parents().filter(a.hasScroll).off(n),f(window).off(n+" "+i+" "+o)},e.prototype._positionDropdown=function(){var e=f(window),t=this.$dropdown[0].classList.contains("select2-dropdown--above"),n=this.$dropdown[0].classList.contains("select2-dropdown--below"),i=null,o=this.$container.offset();o.bottom=o.top+this.$container.outerHeight(!1);var s={height:this.$container.outerHeight(!1)};s.top=o.top,s.bottom=o.top+s.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<o.top-r,u=l>o.bottom+r,d={left:o.left,top:s.bottom},p=this.$dropdownParent;"static"===p.css("position")&&(p=p.offsetParent());var h={top:0,left:0};(f.contains(document.body,p[0])||p[0].isConnected)&&(h=p.offset()),d.top-=h.top,d.left-=h.left,t||n||(i="below"),u||!c||t?!c&&u&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(d.top=s.top-h.top-r),null!=i&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+i),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+i)),this.$dropdownContainer.css(d)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),e.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,i=0;i<t.length;i++){var o=t[i];o.children?n+=e(o.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),e.define("select2/dropdown/selectOnClose",["../utils"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("close",function(e){i._handleSelectOnClose(e)})},e.prototype._handleSelectOnClose=function(e,t){if(t&&null!=t.originalSelect2Event){var n=t.originalSelect2Event;if("select"===n._type||"unselect"===n._type)return}var i,o=this.getHighlightedResults();o.length<1||null!=(i=s.GetData(o[0],"data")).element&&i.element.selected||null==i.element&&i.selected||this.trigger("select",{data:i})},e}),e.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(e){i._selectTriggered(e)}),t.on("unselect",function(e){i._selectTriggered(e)})},e.prototype._selectTriggered=function(e,t){var n=t.originalEvent;n&&(n.ctrlKey||n.metaKey)||this.trigger("close",{originalEvent:n,originalSelect2Event:t})},e}),e.define("select2/dropdown/dropdownCss",["../utils"],function(i){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("dropdownCssClass")||"";return-1!==n.indexOf(":all:")&&(n=n.replace(":all:",""),i.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(n),t},e}),e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return 1!=t&&(n+="s"),n},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return 1!=e.maximum&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"},removeItem:function(){return"Remove item"}}}),e.define("select2/defaults",["jquery","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/selectionCss","./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","./dropdown/dropdownCss","./i18n/en"],function(l,s,r,a,c,u,d,p,h,f,g,t,m,v,y,_,w,b,$,x,A,D,S,O,E,L,C,T,q,e){function n(){this.reset()}return n.prototype.apply=function(e){var t;null==(e=l.extend(!0,{},this.defaults,e)).dataAdapter&&(null!=e.ajax?e.dataAdapter=y:null!=e.data?e.dataAdapter=v:e.dataAdapter=m,0<e.minimumInputLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,b)),0<e.maximumInputLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,$)),0<e.maximumSelectionLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,x)),e.tags&&(e.dataAdapter=f.Decorate(e.dataAdapter,_)),null==e.tokenSeparators&&null==e.tokenizer||(e.dataAdapter=f.Decorate(e.dataAdapter,w))),null==e.resultsAdapter&&(e.resultsAdapter=s,null!=e.ajax&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,O)),null!=e.placeholder&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,S)),e.selectOnClose&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,C))),null==e.dropdownAdapter&&(e.multiple?e.dropdownAdapter=A:(t=f.Decorate(A,D),e.dropdownAdapter=t),0!==e.minimumResultsForSearch&&(e.dropdownAdapter=f.Decorate(e.dropdownAdapter,L)),e.closeOnSelect&&(e.dropdownAdapter=f.Decorate(e.dropdownAdapter,T)),null!=e.dropdownCssClass&&(e.dropdownAdapter=f.Decorate(e.dropdownAdapter,q)),e.dropdownAdapter=f.Decorate(e.dropdownAdapter,E)),null==e.selectionAdapter&&(e.multiple?e.selectionAdapter=a:e.selectionAdapter=r,null!=e.placeholder&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,c)),e.allowClear&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,u)),e.multiple&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,d)),null!=e.selectionCssClass&&(e.selectionAdapter=f.Decorate(e.selectionAdapter,p)),e.selectionAdapter=f.Decorate(e.selectionAdapter,h)),e.language=this._resolveLanguage(e.language),e.language.push("en");for(var n=[],i=0;i<e.language.length;i++){var o=e.language[i];-1===n.indexOf(o)&&n.push(o)}return e.language=n,e.translations=this._processTranslations(e.language,e.debug),e},n.prototype.reset=function(){function a(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return t[e]||e})}this.defaults={amdLanguageBase:"./i18n/",autocomplete:"off",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:f.escapeMarkup,language:{},matcher:function e(t,n){if(null==t.term||""===t.term.trim())return n;if(n.children&&0<n.children.length){for(var i=l.extend(!0,{},n),o=n.children.length-1;0<=o;o--)null==e(t,n.children[o])&&i.children.splice(o,1);return 0<i.children.length?i:e(t,i)}var s=a(n.text).toUpperCase(),r=a(t.term).toUpperCase();return-1<s.indexOf(r)?n:null},minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,scrollAfterSelect:!1,sorter:function(e){return e},templateResult:function(e){return e.text},templateSelection:function(e){return e.text},theme:"default",width:"resolve"}},n.prototype.applyFromElement=function(e,t){var n=e.language,i=this.defaults.language,o=t.prop("lang"),s=t.closest("[lang]").prop("lang"),r=Array.prototype.concat.call(this._resolveLanguage(o),this._resolveLanguage(n),this._resolveLanguage(i),this._resolveLanguage(s));return e.language=r,e},n.prototype._resolveLanguage=function(e){if(!e)return[];if(l.isEmptyObject(e))return[];if(l.isPlainObject(e))return[e];for(var t,n=Array.isArray(e)?e:[e],i=[],o=0;o<n.length;o++)i.push(n[o]),"string"==typeof n[o]&&0<n[o].indexOf("-")&&(t=n[o].split("-")[0],i.push(t));return i},n.prototype._processTranslations=function(e,t){for(var n=new g,i=0;i<e.length;i++){var o=new g,s=e[i];if("string"==typeof s)try{o=g.loadPath(s)}catch(e){try{s=this.defaults.amdLanguageBase+s,o=g.loadPath(s)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+s+'" could not be automatically loaded. A fallback will be used instead.')}}else o=l.isPlainObject(s)?new g(s):s;n.extend(o)}return n},n.prototype.set=function(e,t){var n={};n[l.camelCase(e)]=t;var i=f._convertData(n);l.extend(!0,this.defaults,i)},new n}),e.define("select2/options",["jquery","./defaults","./utils"],function(d,n,p){function e(e,t){this.options=e,null!=t&&this.fromElement(t),null!=t&&(this.options=n.applyFromElement(this.options,t)),this.options=n.apply(this.options)}return e.prototype.fromElement=function(e){var t=["select2"];null==this.options.multiple&&(this.options.multiple=e.prop("multiple")),null==this.options.disabled&&(this.options.disabled=e.prop("disabled")),null==this.options.autocomplete&&e.prop("autocomplete")&&(this.options.autocomplete=e.prop("autocomplete")),null==this.options.dir&&(e.prop("dir")?this.options.dir=e.prop("dir"):e.closest("[dir]").prop("dir")?this.options.dir=e.closest("[dir]").prop("dir"):this.options.dir="ltr"),e.prop("disabled",this.options.disabled),e.prop("multiple",this.options.multiple),p.GetData(e[0],"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.'),p.StoreData(e[0],"data",p.GetData(e[0],"select2Tags")),p.StoreData(e[0],"tags",!0)),p.GetData(e[0],"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."),e.attr("ajax--url",p.GetData(e[0],"ajaxUrl")),p.StoreData(e[0],"ajax-Url",p.GetData(e[0],"ajaxUrl")));var n={};function i(e,t){return t.toUpperCase()}for(var o=0;o<e[0].attributes.length;o++){var s,r,a=e[0].attributes[o].name,l="data-";a.substr(0,l.length)==l&&(s=a.substring(l.length),r=p.GetData(e[0],s),n[s.replace(/-([a-z])/g,i)]=r)}d.fn.jquery&&"1."==d.fn.jquery.substr(0,2)&&e[0].dataset&&(n=d.extend(!0,{},e[0].dataset,n));var c=d.extend(!0,{},p.GetData(e[0]),n),c=p._convertData(c);for(var u in c)-1<t.indexOf(u)||(d.isPlainObject(this.options[u])?d.extend(this.options[u],c[u]):this.options[u]=c[u]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),e.define("select2/core",["jquery","./options","./utils","./keys"],function(t,c,u,i){var d=function(e,t){null!=u.GetData(e[0],"select2")&&u.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new c(t,e),d.__super__.constructor.call(this);var n=e.attr("tabindex")||0;u.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");var i=this.options.get("dataAdapter");this.dataAdapter=new i(e,this.options);var o=this.render();this._placeContainer(o);var s=this.options.get("selectionAdapter");this.selection=new s(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,o);var r=this.options.get("dropdownAdapter");this.dropdown=new r(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,o);var a=this.options.get("resultsAdapter");this.results=new a(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var l=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){l.trigger("selection:update",{data:e})}),e[0].classList.add("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),u.StoreData(e[0],"select2",this),e.data("select2",this)};return u.Extend(d,u.Observable),d.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+u.generateChars(2):u.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},d.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},d.prototype._resolveWidth=function(e,t){var n=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==t){var i=this._resolveWidth(e,"style");return null!=i?i:this._resolveWidth(e,"element")}if("element"==t){var o=e.outerWidth(!1);return o<=0?"auto":o+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;var s=e.attr("style");if("string"!=typeof s)return null;for(var r=s.split(";"),a=0,l=r.length;a<l;a+=1){var c=r[a].replace(/\s/g,"").match(n);if(null!==c&&1<=c.length)return c[1]}return null},d.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},d.prototype._registerDomEvents=function(){var t=this;this.$element.on("change.select2",function(){t.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})}),this.$element.on("focus.select2",function(e){t.trigger("focus",e)}),this._syncA=u.bind(this._syncAttributes,this),this._syncS=u.bind(this._syncSubtree,this),this._observer=new window.MutationObserver(function(e){t._syncA(),t._syncS(e)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})},d.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerSelectionEvents=function(){var n=this,i=["toggle","focus"];this.selection.on("toggle",function(){n.toggleDropdown()}),this.selection.on("focus",function(e){n.focus(e)}),this.selection.on("*",function(e,t){-1===i.indexOf(e)&&n.trigger(e,t)})},d.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},d.prototype._registerEvents=function(){var n=this;this.on("open",function(){n.$container[0].classList.add("select2-container--open")}),this.on("close",function(){n.$container[0].classList.remove("select2-container--open")}),this.on("enable",function(){n.$container[0].classList.remove("select2-container--disabled")}),this.on("disable",function(){n.$container[0].classList.add("select2-container--disabled")}),this.on("blur",function(){n.$container[0].classList.remove("select2-container--focus")}),this.on("query",function(t){n.isOpen()||n.trigger("open",{}),this.dataAdapter.query(t,function(e){n.trigger("results:all",{data:e,query:t})})}),this.on("query:append",function(t){this.dataAdapter.query(t,function(e){n.trigger("results:append",{data:e,query:t})})}),this.on("keypress",function(e){var t=e.which;n.isOpen()?t===i.ESC||t===i.TAB||t===i.UP&&e.altKey?(n.close(e),e.preventDefault()):t===i.ENTER?(n.trigger("results:select",{}),e.preventDefault()):t===i.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===i.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===i.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===i.ENTER||t===i.SPACE||t===i.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},d.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},d.prototype._isChangeMutation=function(e){var t=this;if(e.addedNodes&&0<e.addedNodes.length){for(var n=0;n<e.addedNodes.length;n++)if(e.addedNodes[n].selected)return!0}else{if(e.removedNodes&&0<e.removedNodes.length)return!0;if(Array.isArray(e))return e.some(function(e){return t._isChangeMutation(e)})}return!1},d.prototype._syncSubtree=function(e){var t=this._isChangeMutation(e),n=this;t&&this.dataAdapter.current(function(e){n.trigger("selection:update",{data:e})})},d.prototype.trigger=function(e,t){var n=d.__super__.trigger,i={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in i){var o=i[e],s={prevented:!1,name:e,args:t};if(n.call(this,o,s),s.prevented)return void(t.prevented=!0)}n.call(this,e,t)},d.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},d.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},d.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},d.prototype.isEnabled=function(){return!this.isDisabled()},d.prototype.isDisabled=function(){return this.options.get("disabled")},d.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},d.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},d.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},d.prototype.enable=function(e){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!=e&&0!==e.length||(e=[!0]);var t=!e[0];this.$element.prop("disabled",t)},d.prototype.data=function(){this.options.get("debug")&&0<arguments.length&&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()`.');var t=[];return this.dataAdapter.current(function(e){t=e}),t},d.prototype.val=function(e){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==e||0===e.length)return this.$element.val();var t=e[0];Array.isArray(t)&&(t=t.map(function(e){return e.toString()})),this.$element.val(t).trigger("input").trigger("change")},d.prototype.destroy=function(){this.$container.remove(),this._observer.disconnect(),this._observer=null,this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",u.GetData(this.$element[0],"old-tabindex")),this.$element[0].classList.remove("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),u.RemoveData(this.$element[0]),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},d.prototype.render=function(){var e=t('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container[0].classList.add("select2-container--"+this.options.get("theme")),u.StoreData(e[0],"element",this.$element),e},d}),e.define("select2/dropdown/attachContainer",[],function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t[0].classList.add("select2-dropdown--below"),n[0].classList.add("select2-container--below")},e}),e.define("select2/dropdown/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),e.define("select2/selection/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n),this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),c=function(p){var h,f,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],g=Array.prototype.slice;if(p.event.fixHooks)for(var n=e.length;n;)p.event.fixHooks[e[--n]]=p.event.mouseHooks;var m=p.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;p.data(this,"mousewheel-line-height",m.getLineHeight(this)),p.data(this,"mousewheel-page-height",m.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;p.removeData(this,"mousewheel-line-height"),p.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=p(e),n=t["offsetParent"in p.fn?"offsetParent":"parent"]();return n.length||(n=p("body")),parseInt(n.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return p(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n,i,o,s=e||window.event,r=g.call(arguments,1),a=0,l=0,c=0,u=0,d=0;if((e=p.event.fix(s)).type="mousewheel","detail"in s&&(c=-1*s.detail),"wheelDelta"in s&&(c=s.wheelDelta),"wheelDeltaY"in s&&(c=s.wheelDeltaY),"wheelDeltaX"in s&&(l=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(l=-1*c,c=0),a=0===c?l:c,"deltaY"in s&&(a=c=-1*s.deltaY),"deltaX"in s&&(l=s.deltaX,0===c&&(a=-1*l)),0!==c||0!==l)return 1===s.deltaMode?(a*=n=p.data(this,"mousewheel-line-height"),c*=n,l*=n):2===s.deltaMode&&(a*=i=p.data(this,"mousewheel-page-height"),c*=i,l*=i),t=Math.max(Math.abs(c),Math.abs(l)),(!f||t<f)&&y(s,f=t)&&(f/=40),y(s,t)&&(a/=40,l/=40,c/=40),a=Math[1<=a?"floor":"ceil"](a/f),l=Math[1<=l?"floor":"ceil"](l/f),c=Math[1<=c?"floor":"ceil"](c/f),m.settings.normalizeOffset&&this.getBoundingClientRect&&(o=this.getBoundingClientRect(),u=e.clientX-o.left,d=e.clientY-o.top),e.deltaX=l,e.deltaY=c,e.deltaFactor=f,e.offsetX=u,e.offsetY=d,e.deltaMode=0,r.unshift(e,a,l,c),h&&clearTimeout(h),h=setTimeout(v,200),(p.event.dispatch||p.event.handle).apply(this,r)}function v(){f=null}function y(e,t){return m.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}p.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})},"function"==typeof e.define&&e.define.amd?e.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(t),e.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(o,e,s,t,r){var a;return null==o.fn.select2&&(a=["open","close","destroy"],o.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=o.extend(!0,{},t);new s(o(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=r.GetData(this,"select2");null==e&&window.console&&console.error&&console.error("The select2('"+t+"') method was called on an element that is not using Select2."),n=e[t].apply(e,i)}),-1<a.indexOf(t)?this:n}),null==o.fn.select2.defaults&&(o.fn.select2.defaults=t),s}),{define:e.define,require:e.require});function b(e,t){return a.call(e,t)}function d(e,t){var n,i,o,s,r,a,l,c,u,d,p,h=t&&t.split("/"),f=y.map,g=f&&f["*"]||{};if(e){for(r=(e=e.split("/")).length-1,y.nodeIdCompat&&w.test(e[r])&&(e[r]=e[r].replace(w,"")),"."===e[0].charAt(0)&&h&&(e=h.slice(0,h.length-1).concat(e)),u=0;u<e.length;u++)if("."===(p=e[u]))e.splice(u,1),--u;else if(".."===p){if(0===u||1===u&&".."===e[2]||".."===e[u-1])continue;0<u&&(e.splice(u-1,2),u-=2)}e=e.join("/")}if((h||g)&&f){for(u=(n=e.split("/")).length;0<u;--u){if(i=n.slice(0,u).join("/"),h)for(d=h.length;0<d;--d)if(o=(o=f[h.slice(0,d).join("/")])&&o[i]){s=o,a=u;break}if(s)break;!l&&g&&g[i]&&(l=g[i],c=u)}!s&&l&&(s=l,a=c),s&&(n.splice(0,a,s),e=n.join("/"))}return e}function x(t,n){return function(){var e=l.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),r.apply(h,e.concat([t,n]))}}function A(e){var t;if(b(v,e)&&(t=v[e],delete v[e],_[e]=!0,s.apply(h,t)),!b(m,e)&&!b(_,e))throw new Error("No "+e);return m[e]}function p(e){var t,n=e?e.indexOf("!"):-1;return-1<n&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function D(e){return e?p(e):[]}var S=u.require("jquery.select2");return t.fn.select2.amd=u,S});
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: gallery, galleries, image, images, responsive, lightbox, photo, photography, masonry, video, builder
5
- Requires at least: 4.0
6
  Tested up to: 5.6
7
- Stable tag: 2.3.0
8
  Requires PHP: 5.2.4
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
@@ -139,6 +139,9 @@ Responsive Lightbox and Gallery plugin comes with many styles and effects alread
139
 
140
  == Changelog ==
141
 
 
 
 
142
  = 2.3.0 =
143
  * New: WordPress 5.6 compatibility
144
  * New: Capabilities management
@@ -450,7 +453,5 @@ Initial release
450
 
451
  == Upgrade Notice ==
452
 
453
- = 2.3.0 =
454
- * New: WordPress 5.6 compatibility
455
- * New: Capabilities management
456
- * New: Admin bredcrumb navigation
2
  Contributors: dfactory
3
  Donate link: http://www.dfactory.eu/
4
  Tags: gallery, galleries, image, images, responsive, lightbox, photo, photography, masonry, video, builder
5
+ Requires at least: 5.0
6
  Tested up to: 5.6
7
+ Stable tag: 2.3.1
8
  Requires PHP: 5.2.4
9
  License: MIT License
10
  License URI: http://opensource.org/licenses/MIT
139
 
140
  == Changelog ==
141
 
142
+ = 2.3.1 =
143
+ * Fix: Plugin capabilities not granted properly
144
+
145
  = 2.3.0 =
146
  * New: WordPress 5.6 compatibility
147
  * New: Capabilities management
453
 
454
  == Upgrade Notice ==
455
 
456
+ = 2.3.1 =
457
+ * Fix: Plugin capabilities not granted properly
 
 
responsive-lightbox.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Responsive Lightbox & Gallery
4
  Description: Responsive Lightbox & Gallery allows users to create galleries and view larger versions of images, galleries and videos in a lightbox (overlay) effect optimized for mobile devices.
5
- Version: 2.3.0
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
@@ -43,7 +43,7 @@ include_once( RESPONSIVE_LIGHTBOX_PATH . 'includes' . DIRECTORY_SEPARATOR . 'fun
43
  * Responsive Lightbox class.
44
  *
45
  * @class Responsive_Lightbox
46
- * @version 2.3.0
47
  */
48
  class Responsive_Lightbox {
49
 
@@ -302,7 +302,7 @@ class Responsive_Lightbox {
302
  'origin_left' => true,
303
  'origin_top' => true
304
  ),
305
- 'version' => '2.3.0',
306
  'activation_date' => ''
307
  );
308
  public $options = array();
@@ -328,21 +328,6 @@ class Responsive_Lightbox {
328
  private $notices = array();
329
  private static $_instance;
330
 
331
- public function __clone() {}
332
- public function __wakeup() {}
333
-
334
- /**
335
- * Main Responsive Lightbox instance.
336
- *
337
- * @return object
338
- */
339
- public static function instance() {
340
- if ( self::$_instance === null )
341
- self::$_instance = new self();
342
-
343
- return self::$_instance;
344
- }
345
-
346
  /**
347
  * Constructor.
348
  *
@@ -390,6 +375,7 @@ class Responsive_Lightbox {
390
  $this->options['basicmasonry_gallery'] = array_merge( $this->defaults['basicmasonry_gallery'], ( ( $array = get_option( 'responsive_lightbox_basicmasonry_gallery', $this->defaults['basicmasonry_gallery'] ) ) == false ? array() : $array ) );
391
 
392
  // actions
 
393
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded_init' ) );
394
  add_action( 'in_admin_header', array( $this, 'display_breadcrumbs' ) );
395
  add_action( 'after_setup_theme', array( $this, 'init_remote_libraries' ), 11 );
@@ -409,6 +395,28 @@ class Responsive_Lightbox {
409
  add_filter( 'plugin_row_meta', array( $this, 'plugin_extend_links' ), 10, 2 );
410
  }
411
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  /**
413
  * Single site activation function.
414
  *
@@ -534,6 +542,31 @@ class Responsive_Lightbox {
534
  $this->deactivate_single();
535
  }
536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  /**
538
  * Grant new capabilities to user roles.
539
  *
@@ -542,15 +575,35 @@ class Responsive_Lightbox {
542
  public function grant_new_capabilities() {
543
  global $wp_roles;
544
 
 
 
545
  // add new capabilities to roles
546
  foreach ( $wp_roles->roles as $role_name => $label ) {
547
  // get user role
548
  $role = $wp_roles->get_role( $role_name );
549
 
 
 
 
 
 
 
 
 
 
 
 
 
 
550
  foreach ( $this->capabilities as $capability => $label ) {
551
  // role and capability exist?
552
- if ( array_key_exists( $role_name, $this->defaults['capabilities'] ) && in_array( $capability, $this->defaults['capabilities'][$role_name], true ) )
553
  $role->add_cap( $capability );
 
 
 
 
 
554
  }
555
  }
556
  }
@@ -572,32 +625,35 @@ class Responsive_Lightbox {
572
  'basicmasonry' => __( 'Basic Masonry', 'responsive-lightbox' )
573
  );
574
 
575
- // set capabilities with labels
576
- $this->capabilities = array(
577
- 'publish_galleries' => __( 'Publish Galleries', 'responsive-lightbox' ),
578
- 'edit_galleries' => __( 'Edit Galleries', 'responsive-lightbox' ),
579
- 'edit_published_galleries' => __( 'Edit Published Galleries', 'responsive-lightbox' ),
580
- 'edit_others_galleries' => __( 'Edit Others Galleries', 'responsive-lightbox' ),
581
- 'edit_private_galleries' => __( 'Edit Private Galleries', 'responsive-lightbox' ),
582
- 'delete_galleries' => __( 'Delete Galleries', 'responsive-lightbox' ),
583
- 'delete_published_galleries' => __( 'Delete Published Galleries', 'responsive-lightbox' ),
584
- 'delete_others_galleries' => __( 'Delete Others Galleries', 'responsive-lightbox' ),
585
- 'delete_private_galleries' => __( 'Delete Private Galleries', 'responsive-lightbox' ),
586
- 'read_private_galleries' => __( 'Read Private Galleries', 'responsive-lightbox' ),
587
- 'manage_gallery_categories' => __( 'Manage Gallery Categories', 'responsive-lightbox' ),
588
- 'manage_gallery_tags' => __( 'Manage Gallery Tags', 'responsive-lightbox' ),
589
- 'edit_lightbox_settings' => __( 'Manage Settings', 'responsive-lightbox' )
590
- );
 
 
591
 
592
- // 2.3.0 update
593
- if ( version_compare( $this->version, '2.3.0', '<' ) ) {
594
- // grant new capabilities
595
- $this->grant_new_capabilities();
596
- }
597
 
598
- // plugin version update
599
- if ( version_compare( $this->version, $this->defaults['version'], '<' ) )
600
- update_option( 'responsive_lightbox_version', $this->defaults['version'], false );
 
601
 
602
  include_once( RESPONSIVE_LIGHTBOX_PATH . 'includes' . DIRECTORY_SEPARATOR . 'class-multilang.php' );
603
  }
2
  /*
3
  Plugin Name: Responsive Lightbox & Gallery
4
  Description: Responsive Lightbox & Gallery allows users to create galleries and view larger versions of images, galleries and videos in a lightbox (overlay) effect optimized for mobile devices.
5
+ Version: 2.3.1
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/responsive-lightbox/
43
  * Responsive Lightbox class.
44
  *
45
  * @class Responsive_Lightbox
46
+ * @version 2.3.1
47
  */
48
  class Responsive_Lightbox {
49
 
302
  'origin_left' => true,
303
  'origin_top' => true
304
  ),
305
+ 'version' => '2.3.1',
306
  'activation_date' => ''
307
  );
308
  public $options = array();
328
  private $notices = array();
329
  private static $_instance;
330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  /**
332
  * Constructor.
333
  *
375
  $this->options['basicmasonry_gallery'] = array_merge( $this->defaults['basicmasonry_gallery'], ( ( $array = get_option( 'responsive_lightbox_basicmasonry_gallery', $this->defaults['basicmasonry_gallery'] ) ) == false ? array() : $array ) );
376
 
377
  // actions
378
+ add_action( 'upgrader_process_complete', array( $this, 'update_plugin' ), 10, 2 );
379
  add_action( 'plugins_loaded', array( $this, 'plugins_loaded_init' ) );
380
  add_action( 'in_admin_header', array( $this, 'display_breadcrumbs' ) );
381
  add_action( 'after_setup_theme', array( $this, 'init_remote_libraries' ), 11 );
395
  add_filter( 'plugin_row_meta', array( $this, 'plugin_extend_links' ), 10, 2 );
396
  }
397
 
398
+ /**
399
+ * Disable object cloning.
400
+ */
401
+ public function __clone() {}
402
+
403
+ /**
404
+ * Disable unserializing of the class.
405
+ */
406
+ public function __wakeup() {}
407
+
408
+ /**
409
+ * Main Responsive Lightbox instance.
410
+ *
411
+ * @return object
412
+ */
413
+ public static function instance() {
414
+ if ( self::$_instance === null )
415
+ self::$_instance = new self();
416
+
417
+ return self::$_instance;
418
+ }
419
+
420
  /**
421
  * Single site activation function.
422
  *
542
  $this->deactivate_single();
543
  }
544
 
545
+ /**
546
+ * Update plugin hook.
547
+ *
548
+ * @return void
549
+ */
550
+ public function update_plugin( $upgrader_object, $options ) {
551
+ // plugin update?
552
+ if ( $options['action'] === 'update' && $options['type'] === 'plugin' ) {
553
+ // get current plugin name
554
+ $current_plugin = plugin_basename( __FILE__ );
555
+
556
+ // search for a plugin
557
+ foreach ( $options['plugins'] as $plugin ) {
558
+ // found?
559
+ if ( $plugin === $current_plugin ) {
560
+ // 2.3.1
561
+ if ( version_compare( $this->version, '2.3.1', '<' ) ) {
562
+ // grant new capabilities just before the version update
563
+ $this->grant_new_capabilities();
564
+ }
565
+ }
566
+ }
567
+ }
568
+ }
569
+
570
  /**
571
  * Grant new capabilities to user roles.
572
  *
575
  public function grant_new_capabilities() {
576
  global $wp_roles;
577
 
578
+ $user = wp_get_current_user();
579
+
580
  // add new capabilities to roles
581
  foreach ( $wp_roles->roles as $role_name => $label ) {
582
  // get user role
583
  $role = $wp_roles->get_role( $role_name );
584
 
585
+ // treat such role as administrator
586
+ if ( $role->has_cap( 'install_plugins' ) ) {
587
+ // add every capability
588
+ foreach ( $this->capabilities as $capability => $label ) {
589
+ $role->add_cap( $capability );
590
+ }
591
+
592
+ // force capability on the current user
593
+ if ( is_a( $user, 'WP_User' ) && ! $user->has_cap( 'edit_lightbox_settings' ) )
594
+ $user->add_cap( 'edit_lightbox_settings' );
595
+ }
596
+
597
+ // add new capabilities to the current roles nevertheless
598
  foreach ( $this->capabilities as $capability => $label ) {
599
  // role and capability exist?
600
+ if ( array_key_exists( $role_name, $this->defaults['capabilities'] ) && in_array( $capability, $this->defaults['capabilities'][$role_name], true ) ) {
601
  $role->add_cap( $capability );
602
+
603
+ // force capability on the current user
604
+ if ( $capability === 'edit_lightbox_settings' && is_a( $user, 'WP_User' ) && ! $user->has_cap( 'edit_lightbox_settings' ) && in_array( $role_name, $user->roles, true ) )
605
+ $user->add_cap( 'edit_lightbox_settings' );
606
+ }
607
  }
608
  }
609
  }
625
  'basicmasonry' => __( 'Basic Masonry', 'responsive-lightbox' )
626
  );
627
 
628
+ // only for backend
629
+ if ( is_admin() ) {
630
+ // set capabilities with labels
631
+ $this->capabilities = array(
632
+ 'publish_galleries' => __( 'Publish Galleries', 'responsive-lightbox' ),
633
+ 'edit_galleries' => __( 'Edit Galleries', 'responsive-lightbox' ),
634
+ 'edit_published_galleries' => __( 'Edit Published Galleries', 'responsive-lightbox' ),
635
+ 'edit_others_galleries' => __( 'Edit Others Galleries', 'responsive-lightbox' ),
636
+ 'edit_private_galleries' => __( 'Edit Private Galleries', 'responsive-lightbox' ),
637
+ 'delete_galleries' => __( 'Delete Galleries', 'responsive-lightbox' ),
638
+ 'delete_published_galleries' => __( 'Delete Published Galleries', 'responsive-lightbox' ),
639
+ 'delete_others_galleries' => __( 'Delete Others Galleries', 'responsive-lightbox' ),
640
+ 'delete_private_galleries' => __( 'Delete Private Galleries', 'responsive-lightbox' ),
641
+ 'read_private_galleries' => __( 'Read Private Galleries', 'responsive-lightbox' ),
642
+ 'manage_gallery_categories' => __( 'Manage Gallery Categories', 'responsive-lightbox' ),
643
+ 'manage_gallery_tags' => __( 'Manage Gallery Tags', 'responsive-lightbox' ),
644
+ 'edit_lightbox_settings' => __( 'Manage Settings', 'responsive-lightbox' )
645
+ );
646
 
647
+ // 2.3.0 update
648
+ if ( version_compare( $this->version, '2.3.0', '<' ) ) {
649
+ // grant new capabilities just before the version update
650
+ $this->grant_new_capabilities();
651
+ }
652
 
653
+ // plugin version update
654
+ if ( version_compare( $this->version, $this->defaults['version'], '<' ) )
655
+ update_option( 'responsive_lightbox_version', $this->defaults['version'], false );
656
+ }
657
 
658
  include_once( RESPONSIVE_LIGHTBOX_PATH . 'includes' . DIRECTORY_SEPARATOR . 'class-multilang.php' );
659
  }