WP-Members Membership Plugin - Version 3.4.5

Version Description

  • 3.4.4 is not compatible with WP-Members Advanced Options when redirect to login is used. This version corrects that issue by rolling back the change to only load membership restriction functions when the membership products setting is enabled.
  • Adds wpmem_login_form_button_rows filter hook.
  • Adds wpmem_pwd_reset_email_link filter hook
  • Adds API functions wpmem_profile_url(), wpmem_pwd_reset_url(), wpmem_register_url(), wpmem_forgot_username_url().
  • Adds API functions wpmem_get_membership_name(), wpmem_get_membership_meta(), wpmem_get_membership_post_list(), wpmem_get_post_memberships(), wpmem_get_memberships().
  • Adds API functions wpmem_add_query_where(), wpmem_get_query_where(), wpmem_add_user_view_link(), wpmem_get_user_view_link(), wpmem_get_user_view_count().
  • Updates user views to use new API functions and adds capability to more easily customize user views.
  • Code improvement: update instances of deprecated function wpmem_gettext() to use wpmem_get_text().
  • Code improvement: update wpmem_user_has_role(), $current_user global no longer necessary.
  • Code improvement: update select2 library to version 4.1.0.
  • CSS update: defines columns widths for Settings > WP-Members > Fields table.
Download this release

Release Info

Developer cbutlerjr
Plugin Icon 128x128 WP-Members Membership Plugin
Version 3.4.5
Comparing to
See all releases

Code changes from version 3.4.4 to 3.4.5

Files changed (94) hide show
  1. assets/css/admin.css +11 -0
  2. assets/css/admin.min.css +1 -1
  3. includes/admin/api.php +110 -0
  4. includes/admin/class-wp-members-admin-api.php +1 -6
  5. includes/admin/class-wp-members-admin-users.php +7 -1
  6. includes/admin/class-wp-members-bulk-edit-users.php +0 -174
  7. includes/admin/class-wp-members-products-admin.php +41 -66
  8. includes/admin/tabs/class-wp-members-admin-tab-dropins.php +2 -2
  9. includes/api/api-products.php +77 -1
  10. includes/api/api-users.php +3 -7
  11. includes/api/api.php +26 -4
  12. includes/class-wp-members-forms.php +29 -13
  13. includes/class-wp-members-products.php +2 -2
  14. includes/class-wp-members-pwd-reset.php +11 -0
  15. includes/class-wp-members-shortcodes.php +162 -12
  16. includes/class-wp-members-widget.php +1 -1
  17. includes/class-wp-members.php +6 -16
  18. includes/install.php +1 -1
  19. includes/vendor/rocketgeek-tools/assets/css/index.php +1 -0
  20. includes/vendor/rocketgeek-tools/assets/index.php +1 -0
  21. includes/vendor/rocketgeek-tools/index.php +1 -0
  22. includes/vendor/rocketgeek-utilities/LICENSE +2 -2
  23. includes/vendor/rocketgeek-utilities/includes/utilities.php +265 -184
  24. includes/vendor/rocketgeek-utilities/loader.php +41 -41
  25. includes/vendor/select2/css/select2.css +131 -78
  26. includes/vendor/select2/css/select2.min.css +1 -1
  27. includes/vendor/select2/js/i18n/af.js +3 -0
  28. includes/vendor/select2/js/i18n/ar.js +3 -0
  29. includes/vendor/select2/js/i18n/az.js +3 -0
  30. includes/vendor/select2/js/i18n/bg.js +3 -0
  31. includes/vendor/select2/js/i18n/bn.js +3 -0
  32. includes/vendor/select2/js/i18n/bs.js +3 -0
  33. includes/vendor/select2/js/i18n/ca.js +3 -0
  34. includes/vendor/select2/js/i18n/cs.js +3 -0
  35. includes/vendor/select2/js/i18n/da.js +3 -0
  36. includes/vendor/select2/js/i18n/de.js +3 -0
  37. includes/vendor/select2/js/i18n/dsb.js +3 -0
  38. includes/vendor/select2/js/i18n/el.js +3 -0
  39. includes/vendor/select2/js/i18n/en.js +3 -0
  40. includes/vendor/select2/js/i18n/eo.js +3 -0
  41. includes/vendor/select2/js/i18n/es.js +3 -0
  42. includes/vendor/select2/js/i18n/et.js +3 -0
  43. includes/vendor/select2/js/i18n/eu.js +3 -0
  44. includes/vendor/select2/js/i18n/fa.js +3 -0
  45. includes/vendor/select2/js/i18n/fi.js +3 -0
  46. includes/vendor/select2/js/i18n/fr.js +3 -0
  47. includes/vendor/select2/js/i18n/gl.js +3 -0
  48. includes/vendor/select2/js/i18n/he.js +3 -0
  49. includes/vendor/select2/js/i18n/hi.js +3 -0
  50. includes/vendor/select2/js/i18n/hr.js +3 -0
  51. includes/vendor/select2/js/i18n/hsb.js +3 -0
  52. includes/vendor/select2/js/i18n/hu.js +3 -0
  53. includes/vendor/select2/js/i18n/hy.js +3 -0
  54. includes/vendor/select2/js/i18n/id.js +3 -0
  55. includes/vendor/select2/js/i18n/is.js +3 -0
  56. includes/vendor/select2/js/i18n/it.js +3 -0
  57. includes/vendor/select2/js/i18n/ja.js +3 -0
  58. includes/vendor/select2/js/i18n/ka.js +3 -0
  59. includes/vendor/select2/js/i18n/km.js +3 -0
  60. includes/vendor/select2/js/i18n/ko.js +3 -0
  61. includes/vendor/select2/js/i18n/lt.js +3 -0
  62. includes/vendor/select2/js/i18n/lv.js +3 -0
  63. includes/vendor/select2/js/i18n/mk.js +3 -0
  64. includes/vendor/select2/js/i18n/ms.js +3 -0
  65. includes/vendor/select2/js/i18n/nb.js +3 -0
  66. includes/vendor/select2/js/i18n/ne.js +3 -0
  67. includes/vendor/select2/js/i18n/nl.js +3 -0
  68. includes/vendor/select2/js/i18n/pa.js +3 -0
  69. includes/vendor/select2/js/i18n/pl.js +3 -0
  70. includes/vendor/select2/js/i18n/ps.js +3 -0
  71. includes/vendor/select2/js/i18n/pt-BR.js +3 -0
  72. includes/vendor/select2/js/i18n/pt.js +3 -0
  73. includes/vendor/select2/js/i18n/ro.js +3 -0
  74. includes/vendor/select2/js/i18n/ru.js +3 -0
  75. includes/vendor/select2/js/i18n/sk.js +3 -0
  76. includes/vendor/select2/js/i18n/sl.js +3 -0
  77. includes/vendor/select2/js/i18n/sq.js +3 -0
  78. includes/vendor/select2/js/i18n/sr-Cyrl.js +3 -0
  79. includes/vendor/select2/js/i18n/sr.js +3 -0
  80. includes/vendor/select2/js/i18n/sv.js +3 -0
  81. includes/vendor/select2/js/i18n/te.js +3 -0
  82. includes/vendor/select2/js/i18n/th.js +3 -0
  83. includes/vendor/select2/js/i18n/tk.js +3 -0
  84. includes/vendor/select2/js/i18n/tr.js +3 -0
  85. includes/vendor/select2/js/i18n/uk.js +3 -0
  86. includes/vendor/select2/js/i18n/vi.js +3 -0
  87. includes/vendor/select2/js/i18n/zh-CN.js +3 -0
  88. includes/vendor/select2/js/i18n/zh-TW.js +3 -0
  89. includes/vendor/select2/js/select2.full.js +6521 -0
  90. includes/vendor/select2/js/select2.full.min.js +2 -0
  91. includes/vendor/select2/js/select2.js +6209 -5746
  92. includes/vendor/select2/js/select2.min.js +2 -1
  93. readme.txt +16 -2
  94. wp-members.php +2 -2
assets/css/admin.css CHANGED
@@ -139,4 +139,15 @@ updatesettings a:hover {
139
 
140
  .wpmem-user-table-membership {
141
  border-bottom:1px solid #999;
 
 
 
 
 
 
 
 
 
 
 
142
  }
139
 
140
  .wpmem-user-table-membership {
141
  border-bottom:1px solid #999;
142
+ }
143
+
144
+ #wpmem-fields .column-display,
145
+ #wpmem-fields .column-req,
146
+ #wpmem-fields .column-userscrn,
147
+ #wpmem-fields .column-usearch {
148
+ width: 110px;
149
+ }
150
+ #wpmem-fields .column-edit,
151
+ #wpmem-fields .column-sort {
152
+ width: 70px;
153
  }
assets/css/admin.min.css CHANGED
@@ -1 +1 @@
1
- .wpmem_tbl_drag{background:#fffbcc;font-weight:700;border:1px solid #900}.column-wpmem_block{width:80px}#addfieldform li,#editfieldform li,#updatesettings li{padding:5px 0}#addfieldform label,#editfieldform label,#updatesettings label{float:left;width:166px;clear:both;display:block}#addfieldform .add-field-indent,#editfieldform .add-field-indent{margin-left:165px}#add_field_postbox,#fields_postbox{min-width:950px}.req{color:red}.settings_page_wpmem-settings #the-list{cursor:move}#edit,#sort{width:30px}#wpmem_block input{vertical-align:-webkit-baseline-middle;margin:0 0 8px 0}#wpmem_block label{margin:0 0 0 8px}#wpmem_ok_block_status{margin:5px 0 0 0}#wpmem_post_block_status{font-weight:600}#wpmem_post_icon_0{color:red}#wpmem_post_icon_1{color:green}#wpmem_post_icon_2{color:#000}#wpmem_product_enabled{color:green}#_wpmem_products,#s2id__wpmem_products,.select2-search-field{width:100%}#wpmem_user_profile_tabs{padding:0;background:0 0;border-width:0}#wpmem_user_profile_tabs .ui-tabs-nav{padding-left:0;background:0 0;border-width:0 0 1px 0;-moz-border-radius:0;-webkit-border-radius:0px;border-radius:0}#wpmem_user_profile_tabs .ui-tabs-panel{background:#fff;border-width:0 1px 1px 1px}#wpmem_user_profile_tabs .ui-state-active{border:1px solid #006799;background:#135e96}#wpmem_user_profile_tabs .ui-state-active a{color:#fff}#wpmem_product_fixed_period,#wpmem_product_fixed_period_select input,#wpmem_product_fixed_period_select label,#wpmem_product_no_gap{margin-top:10px;margin-left:24px}#updatesettings a{text-decoration:none}updatesettings a:hover{color:#000}#adduser .form-field input[type=checkbox],#createuser .form-field input[type=checkbox]{width:initial}.wpmem-user-table-membership{border-bottom:1px solid #999}
1
+ .wpmem_tbl_drag{background:#fffbcc;font-weight:700;border:1px solid #900}.column-wpmem_block{width:80px}#addfieldform li,#editfieldform li,#updatesettings li{padding:5px 0}#addfieldform label,#editfieldform label,#updatesettings label{float:left;width:166px;clear:both;display:block}#addfieldform .add-field-indent,#editfieldform .add-field-indent{margin-left:165px}#add_field_postbox,#fields_postbox{min-width:950px}.req{color:red}.settings_page_wpmem-settings #the-list{cursor:move}#edit,#sort{width:30px}#wpmem_block input{vertical-align:-webkit-baseline-middle;margin:0 0 8px 0}#wpmem_block label{margin:0 0 0 8px}#wpmem_ok_block_status{margin:5px 0 0 0}#wpmem_post_block_status{font-weight:600}#wpmem_post_icon_0{color:red}#wpmem_post_icon_1{color:green}#wpmem_post_icon_2{color:#000}#wpmem_product_enabled{color:green}#_wpmem_products,#s2id__wpmem_products,.select2-search-field{width:100%}#wpmem_user_profile_tabs{padding:0;background:0 0;border-width:0}#wpmem_user_profile_tabs .ui-tabs-nav{padding-left:0;background:0 0;border-width:0 0 1px 0;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}#wpmem_user_profile_tabs .ui-tabs-panel{background:#fff;border-width:0 1px 1px 1px}#wpmem_user_profile_tabs .ui-state-active{border:1px solid #006799;background:#135e96}#wpmem_user_profile_tabs .ui-state-active a{color:#fff}#wpmem_product_fixed_period,#wpmem_product_fixed_period_select input,#wpmem_product_fixed_period_select label,#wpmem_product_no_gap{margin-top:10px;margin-left:24px}#updatesettings a{text-decoration:none}updatesettings a:hover{color:#000}#adduser .form-field input[type=checkbox],#createuser .form-field input[type=checkbox]{width:initial}.wpmem-user-table-membership{border-bottom:1px solid #999}#wpmem-fields .column-display,#wpmem-fields .column-req,#wpmem-fields .column-usearch,#wpmem-fields .column-userscrn{width:110px}#wpmem-fields .column-edit,#wpmem-fields .column-sort{width:70px}
includes/admin/api.php CHANGED
@@ -116,4 +116,114 @@ function wpmem_update_option( $option, $key, $value ) {
116
  $settings[ $key ] = $value;
117
  }
118
  return update_option( $option, $settings );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
116
  $settings[ $key ] = $value;
117
  }
118
  return update_option( $option, $settings );
119
+ }
120
+
121
+ /**
122
+ * Returns a custom "query_where" if the current view is selected.
123
+ *
124
+ * @since 3.4.5
125
+ *
126
+ * @param string $query_where $query_where value from the filter (required)
127
+ * @param string $view Custom view slug
128
+ * @param string $meta_key Meta key the view is filtered by (needed for count)
129
+ * @param string $meta_value Value of the meta key for the view (needed for count)
130
+ * @param string $compare Comparison operator (optional, default "=")
131
+ */
132
+ function wpmem_add_query_where( $query_where, $view, $meta_key, $meta_value, $compare = '=' ) {
133
+ $show = sanitize_text_field( wpmem_get( 'show', false, 'get' ) );
134
+ if ( $view == $show ) {
135
+ $query_where = wpmem_get_query_where( $meta_key, $meta_value, $compare );
136
+ }
137
+ return $query_where;
138
+ }
139
+
140
+ /**
141
+ * Builds a "query_where" for custom user views in Users > All Users.
142
+ *
143
+ * @since 3.4.5
144
+ *
145
+ * @param string $meta_key Meta key the view is filtered by (needed for count)
146
+ * @param string $meta_value Value of the meta key for the view (needed for count)
147
+ * @param string $compare Comparison operator (optional, default "=")
148
+ */
149
+ function wpmem_get_query_where( $meta_key, $meta_value, $compare = '=' ) {
150
+ global $wpdb;
151
+ $query_where = 'WHERE 1=1 AND ' . $wpdb->users . '.ID IN (
152
+ SELECT ' . $wpdb->usermeta . '.user_id FROM ' . $wpdb->usermeta . '
153
+ WHERE ' . $wpdb->usermeta . '.meta_key = "' . esc_sql( $meta_key ) . '"
154
+ AND ' . $wpdb->usermeta . '.meta_value ' . $compare . ' "' . esc_sql( $meta_value ) . '" )';
155
+ return $query_where;
156
+ }
157
+
158
+ /**
159
+ * Adds a custom user view link for Users > All Users to the existing views array.
160
+ *
161
+ * @since 3.4.5
162
+ *
163
+ * @param array $views The $views value from the "wpmem_views_users" filter (required)
164
+ * @param string $name Text for the view link
165
+ * @param string $view Custom view slug
166
+ * @param string $meta_key Meta key the view is filtered by (needed for count)
167
+ * @param string $meta_value Value of the meta key for the view (needed for count)
168
+ * @param string $compare Comparison operator (optional, default "=")
169
+ * @param int $expires Expiration of the count transient in seconds (optional, default = 60)
170
+ */
171
+ function wpmem_add_user_view_link( $views, $link_text, $view_slug, $meta_key, $meta_value, $compare = "=", $expires = 60 ) {
172
+ $views[ $view_slug ] = wpmem_get_user_view_link( $link_text, $view_slug, $meta_key, $meta_value, $compare, $expires );
173
+ return $views;
174
+ }
175
+
176
+ /**
177
+ * Returns a custom user view link for Users > All Users.
178
+ *
179
+ * @since 3.4.5
180
+ *
181
+ * @param string $name Text for the view link
182
+ * @param string $view Custom view slug
183
+ * @param string $meta_key Meta key the view is filtered by (needed for count)
184
+ * @param string $meta_value Value of the meta key for the view (needed for count)
185
+ * @param string $compare Comparison operator (optional, default "=")
186
+ * @param int $expires Expiration of the count transient in seconds (optional, default = 60)
187
+ */
188
+ function wpmem_get_user_view_link( $name, $view, $meta_key, $meta_value, $compare = "=", $expires = 60 ) {
189
+ $show = sanitize_text_field( wpmem_get( 'show', '', 'get' ) );
190
+ $url = 'users.php?action=show&show=' . $view;
191
+ $class = ( $show == $view ) ? ' class="current"' : '';
192
+ $count = wpmem_get_user_view_count( $view, $meta_key, $meta_value, $compare, $expires );
193
+ return sprintf(
194
+ '<a href="%s" %s>%s <span class="count">(%d)</span></a>',
195
+ esc_url( $url ),
196
+ $class,
197
+ $name,
198
+ $count
199
+ );
200
+ }
201
+
202
+ /**
203
+ * Returns a count for custom user view for Users > All Users.
204
+ *
205
+ * @since 3.4.5
206
+ *
207
+ * @param string $view Custom view slug
208
+ * @param string $meta_key Meta key the view is filtered by (needed for count)
209
+ * @param string $meta_value Value of the meta key for the view (needed for count)
210
+ * @param string $compare Comparison operator (optional, default "=")
211
+ * @param int $expires Expiration of the count transient in seconds (optional, default = 60)
212
+ */
213
+ function wpmem_get_user_view_count( $view, $meta_key, $meta_value, $compare = '=', $expires = 60 ) {
214
+ global $wpdb;
215
+ // Count is stored in a transient (see "if" condition below).
216
+ $count = get_transient( 'wpmem_user_counts_' . $view );
217
+ // If the transient is not already set.
218
+ if ( false === $count ) {
219
+
220
+ // Get the count
221
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . $wpdb->usermeta . " WHERE meta_key=%s AND meta_value " . $compare . " \"%s\"", $meta_key, $meta_value ) );
222
+
223
+ // Save it in a transient
224
+ $transient_expires = $expires; // Value in seconds, 1 day: ( 60 * 60 * 24 );
225
+ set_transient( 'wpmem_user_counts_' . $view, $count, $transient_expires );
226
+ }
227
+ // Return the count, either new or transient.
228
+ return $count;
229
  }
includes/admin/class-wp-members-admin-api.php CHANGED
@@ -76,9 +76,7 @@ class WP_Members_Admin_API {
76
  $dialogs = $this->default_dialogs(); // Load default dialogs.
77
  }
78
 
79
- if ( 1 == $wpmem->enable_products ) {
80
- $wpmem->membership->admin = new WP_Members_Products_Admin();
81
- }
82
  }
83
 
84
  /**
@@ -116,9 +114,6 @@ class WP_Members_Admin_API {
116
  }
117
  include_once( $wpmem->path . 'includes/admin/tabs/class-wp-members-fields-table.php' );
118
  }
119
- if ( current_user_can( 'list_users' ) ) {
120
- // include_once( $wpmem->path . 'includes/admin/class-wp-members-bulk-edit-users.php' );
121
- }
122
  }
123
 
124
  /**
76
  $dialogs = $this->default_dialogs(); // Load default dialogs.
77
  }
78
 
79
+ $wpmem->membership->admin = new WP_Members_Products_Admin();
 
 
80
  }
81
 
82
  /**
114
  }
115
  include_once( $wpmem->path . 'includes/admin/tabs/class-wp-members-fields-table.php' );
116
  }
 
 
 
117
  }
118
 
119
  /**
includes/admin/class-wp-members-admin-users.php CHANGED
@@ -269,6 +269,8 @@ class WP_Members_Admin_Users {
269
  *
270
  * @since 2.8.2
271
  * @since 3.1.2 Added user view counts as transient.
 
 
272
  *
273
  * @global object $wpdb
274
  * @global object $wpmem
@@ -373,11 +375,13 @@ class WP_Members_Admin_Users {
373
  * Filters all views before returning to the WP 'views_users' filter.
374
  *
375
  * @since 3.3.0
 
376
  *
377
- * @param array $views {
378
  *
379
  * @type string The HTML for the view.
380
  * }
 
381
  */
382
  $views = apply_filters( 'wpmem_views_users', $views, $show );
383
 
@@ -516,6 +520,8 @@ class WP_Members_Admin_Users {
516
  * @todo Currently, not activated query returns users who are deactivated. This
517
  * may be confusing for admins, so work on a query that displays only
518
  * users who have never been activated.
 
 
519
  *
520
  * @param $user_search
521
  */
269
  *
270
  * @since 2.8.2
271
  * @since 3.1.2 Added user view counts as transient.
272
+ *
273
+ * @todo Could revise to use wpmem_add_user_view_link().
274
  *
275
  * @global object $wpdb
276
  * @global object $wpmem
375
  * Filters all views before returning to the WP 'views_users' filter.
376
  *
377
  * @since 3.3.0
378
+ * @since unknown Added $show
379
  *
380
+ * @param array $views {
381
  *
382
  * @type string The HTML for the view.
383
  * }
384
+ * @param string $show
385
  */
386
  $views = apply_filters( 'wpmem_views_users', $views, $show );
387
 
520
  * @todo Currently, not activated query returns users who are deactivated. This
521
  * may be confusing for admins, so work on a query that displays only
522
  * users who have never been activated.
523
+ *
524
+ * @todo Do theses using wpmem_add_query_where().
525
  *
526
  * @param $user_search
527
  */
includes/admin/class-wp-members-bulk-edit-users.php DELETED
@@ -1,174 +0,0 @@
1
- <?php
2
- /**
3
- * Set process to update user accordingly.
4
- *
5
- * This function will run for each user being updated in the main
6
- * framework script below. Breaking out the actual update process
7
- * makes the framework more modular so it can be adapted to multiple
8
- * use cases.
9
- *
10
- * For this use case, identify the actual meta keys used for the fields
11
- * imported with the membership slug and expiration date. The default
12
- * set up below is "membership" and "expires". The script will get
13
- * the meta values for those fields and run wpmem_set_user_product().
14
- * It will clean up for itself by deleting the meta values after it
15
- * is done.
16
- *
17
- * Because of the clean up process (deleting the meta keys it has
18
- * processed), if the script crashes from too many users, it can
19
- * be run again and will not overwrite existing processed users.
20
- */
21
- function my_update_selected_user( $user_id ) {
22
-
23
- // Set specific criteria.
24
- $membership_key = "membership";
25
- $expiration_key = "expires";
26
-
27
- // Get the user's membership product info.
28
- $membership = get_user_meta( $user_id, $membership_key, true );
29
- $expiration = get_user_meta( $user_id, $expiration_key, true );
30
-
31
- // Only process users who have not been processed already.
32
- if ( $membership ) {
33
-
34
- // Set expiration date - either "false" or MySQL timestamp.
35
- if ( $expiration ) {
36
- $date = ( 'none' == $expiration ) ? false : date( "Y-m-d H:i:s", strtotime( $expiration ) );
37
- } else {
38
- $date = false;
39
- }
40
-
41
- // Set user product access.
42
- wpmem_set_user_product( $membership, $user_id, $date );
43
-
44
- // Clean up after yourself.
45
- delete_user_meta( $user_id, $membership_key );
46
- delete_user_meta( $user_id, $expiration_key );
47
-
48
- }
49
- }
50
-
51
- /**
52
- * A drop-in code snippet to update all users' membership
53
- * access and any applicable expiration date.
54
- *
55
- * To Use:
56
- * 1. Save the code snippet to your theme's functions.php
57
- * 2. Go to Tools > Update All Users.
58
- * 3. Follow prompts on screen.
59
- * 4. Remove the code snippet when completed.
60
- */
61
-
62
- class WP_Members_Bulk_Edit_Users {
63
-
64
- public $settings = array(
65
- 'enable_products' => "Membership",
66
- 'mod_reg' => "Activation",
67
- 'act_link' => "Confirmation",
68
- );
69
-
70
- function __construct() {
71
- add_action( 'admin_menu', array( $this, 'admin_menu' ) );
72
- }
73
-
74
- function admin_menu() {
75
- global $wpmem;
76
- if ( 1 == $wpmem->act_link || 1 == $wpmem->mod_reg || 1 == $wpmem->enable_products ) {
77
- $hook = add_users_page( 'WP-Members Bulk Edit Users', 'Bulk Edits', 'edit_users', 'wpmem-bulk-user-update', array( $this, 'admin_page' ) );
78
- add_action( "load-$hook", array( $this, 'admin_page_load' ) );
79
- }
80
- }
81
-
82
- function admin_page_load() {
83
- global $update_all_complete;
84
- $update_all_complete = false;
85
-
86
- $utility_state = wpmem_get( 'wpmem_bulk_utility_state', false, 'request' );
87
-
88
- if ( isset( $_GET['page'] ) && 'wpmem-bulk-user-update' == $_GET['page'] ) {
89
-
90
- }
91
-
92
- if ( isset( $_GET['page'] ) && 'update-all-users' == $_GET['page'] && isset( $_POST['update-all-confirm'] ) && 1 == $_POST['update-all-confirm'] ) {
93
- $users = get_users( array( 'fields'=>'ID' ) );
94
- // This is where we loop through users and update them.
95
- foreach ( $users as $user_id ) {
96
-
97
- // This is the custom process.
98
- my_update_selected_user( $user_id );
99
-
100
- }
101
- $update_all_complete = true;
102
- }
103
- }
104
-
105
- function admin_page() {
106
- global $wpmem, $update_all_complete;
107
-
108
- $utility_state = wpmem_get( 'wpmem_bulk_utility_state', false, 'request' );
109
- $form_post = ( function_exists( 'wpmem_admin_form_post_url' ) ) ? wpmem_admin_form_post_url() : '';
110
-
111
- echo '<div class="wrap">';
112
- echo "<h2>" . __( 'WP-Members Bulk User Update', 'wp-members' ) . "</h2>";
113
- echo '<form name="wpmem-bulk-update-all-users" id="wpmem-bulk-update-all-users" method="post" action="' . $form_post . '">';
114
-
115
- switch ( $utility_state ) {
116
-
117
- case false:
118
-
119
- echo '<p>This utility allows you to run various bulk edits to all users.</p>';
120
- echo '<p>Select the utility to run:</p>';
121
- echo '<select name="wpmem_bulk_utility_state">
122
- <option value="">Select option</option>';
123
- foreach ( $this->settings as $setting => $label ) {
124
- if ( 1 == $wpmem->{$setting} ) {
125
- echo '<option value="start_' . strtolower( $label ) . '">' . $label . '</option>';
126
- }
127
- }
128
- echo '</select>
129
- <input type="submit" name="submit" value="Submit" />';
130
- break;
131
-
132
- case 'start_activation':
133
- case 'start_confirmation':
134
- echo '<p>';
135
- echo ( 'start_activation' == $utility_state ) ? 'This process will set ALL users as activated.' : 'This process will set ALL users as confirmed.';
136
- echo '</p>';
137
- echo '<p><input name="wpmem_bulk_utility_state" type="checkbox" value="activation_confirm" /> ';
138
- echo ( 'start_activation' == $utility_state ) ? 'Activate all users' : 'Confirm all users';
139
- echo '</p>';
140
- echo '<input type="submit" name="submit" value="Submit" />';
141
- break;
142
-
143
- case 'activation_confirm':
144
- case 'confirmation_confirm':
145
- echo '<p>';
146
- echo ( 'start_activation' == $utility_state ) ? 'All users have been set as activated.' : 'All users have been set as confirmed.';
147
- echo '</p>';
148
- break;
149
-
150
- case 'start_membership':
151
- echo '<p>';
152
- echo 'This will set all users to a valid membership based on imported values.';
153
- echo '<p>';
154
- break;
155
-
156
- case 'membership_confirm':
157
- echo '<p>';
158
- echo 'All user memberships have been set.';
159
- echo '</p>';
160
- break;
161
- }
162
-
163
- if ( $update_all_complete ) {
164
- echo '<p>All users were updated.<br />';
165
- echo 'You may now remove this code snippet if desired.</p>';
166
- } else {
167
-
168
- }
169
-
170
- echo '</form>';
171
- echo '</div>';
172
- }
173
- }
174
- // End of My_Update_All_Users_Class
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/admin/class-wp-members-products-admin.php CHANGED
@@ -23,33 +23,34 @@ class WP_Members_Products_Admin {
23
  */
24
  function __construct() {
25
  global $wpmem;
26
-
27
- add_filter( 'manage_wpmem_product_posts_columns', array( $this, 'columns_heading' ) );
28
- add_action( 'manage_wpmem_product_posts_custom_column', array( $this, 'columns_content' ), 10, 2 );
29
- add_action( 'add_meta_boxes', array( $this, 'meta_boxes' ) );
30
- add_action( 'page_attributes_misc_attributes', array( $this, 'membership_attributes' ) );
31
- add_action( 'save_post', array( $this, 'save_details' ) );
32
- add_action( 'wpmem_admin_after_block_meta', array( $this, 'add_product_to_post' ), 10, 2 );
33
- add_action( 'wpmem_admin_block_meta_save', array( $this, 'save_product_to_post' ), 10, 3 );
34
- add_action( 'admin_footer', array( $this, 'enqueue_select2' ) );
35
- add_filter( 'manage_users_columns', array( $this, 'user_columns' ) );
36
- add_filter( 'manage_users_custom_column', array( $this, 'user_columns_content' ), 10, 3 );
37
- add_action( 'admin_head', array( $this, 'post_columns_width' ) );
38
- add_filter( 'manage_posts_columns', array( $this, 'post_columns' ) );
39
- add_action( 'manage_posts_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
40
- add_filter( 'manage_pages_columns', array( $this, 'post_columns' ) );
41
- add_action( 'manage_pages_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
42
- foreach( $wpmem->post_types as $key => $val ) {
43
- add_filter( 'manage_' . $key . '_posts_columns', array( $this, 'post_columns' ) );
44
- add_action( 'manage_' . $key . '_posts_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
 
 
 
 
 
 
 
45
  }
46
 
47
- add_filter( 'wpmem_user_profile_tabs', array( $this, 'user_profile_tabs' ), 1 );
48
- add_action( 'wpmem_user_profile_tabs_content', array( $this, 'user_profile_tab_content' ), 10 );
49
-
50
- add_filter( 'wpmem_views_users', array( $this, 'user_views' ), 10, 2 );
51
- add_filter( 'wpmem_query_where', array( $this, 'query_where' ), 10, 2 );
52
-
53
  $this->default_products = $wpmem->membership->get_default_products();
54
  }
55
 
@@ -545,9 +546,9 @@ class WP_Members_Products_Admin {
545
  }
546
  foreach ( $wpmem->membership->products as $key => $value ) {
547
  if ( in_array( $key, $products ) ) {
548
- update_post_meta( $post->ID, $wpmem->membership->post_stem . $key, 1 );
549
  } else {
550
- delete_post_meta( $post->ID, $wpmem->membership->post_stem . $key );
551
  }
552
  }
553
  }
@@ -615,9 +616,7 @@ class WP_Members_Products_Admin {
615
  $post_products = $wpmem->membership->get_post_products( $post_id );
616
  if ( $post_products ) {
617
  foreach ( $post_products as $meta ) {
618
- if ( isset( $wpmem->membership->products[ $meta ]['title'] ) ) {
619
- $display[] = $wpmem->membership->products[ $meta ]['title'];
620
- }
621
  }
622
  echo implode( ", ", $display );
623
  }
@@ -675,10 +674,8 @@ class WP_Members_Products_Admin {
675
  $user_products = $wpmem->user->get_user_products( $user_id );
676
  if ( $user_products ) {
677
  foreach ( $user_products as $meta => $value ) {
678
- if ( isset( $wpmem->membership->products[ $meta ]['title'] ) ) {
679
- $expires = ( $user_products[ $meta ] > 1 ) ? '<br />' . __( 'expires:', 'wp-members' ) . ' ' . date_i18n( get_option( 'date_format' ), $user_products[ $meta ] ) : '';
680
- $display[] = $defaults['item_wrap_before'] . $wpmem->membership->products[ $meta ]['title'] . $expires . $defaults['item_wrap_after'];
681
- }
682
  }
683
  }
684
  /**
@@ -810,30 +807,14 @@ class WP_Members_Products_Admin {
810
  global $wpdb, $wpmem;
811
 
812
  // Add a view for each membership
813
- foreach ( $wpmem->membership->product_by_id as $product_slug ) {
814
-
815
- // Count is stored in a transient (see "if" condition below).
816
- $count = get_transient( 'wpmem_user_counts_' . $product_slug );
817
- // If the transient is not already set.
818
- if ( false === $count ) {
819
-
820
- // Get the count
821
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM " . $wpdb->usermeta . " WHERE meta_key=%s AND meta_value>0", "_wpmem_products_" . $product_slug ) );
822
-
823
- // Save it in a transient
824
- $transient_expires = 60; // Value in seconds, 1 day: ( 60 * 60 * 24 );
825
- set_transient( 'wpmem_user_counts_' . $product_slug, $count, $transient_expires );
826
- }
827
-
828
- // Build the link for the filter view
829
- $link = "users.php?action=show&amp;show=" . $product_slug;
830
- $current = ( $show == $product_slug ) ? ' class="current"' : '';
831
- $views[ $product_slug ] = sprintf(
832
- '<a href="%s" %s>%s <span class="count">(%d)</span></a>',
833
- esc_url( $link ),
834
- $current,
835
- $wpmem->membership->products[ $product_slug ]['title'],
836
- $count
837
  );
838
  }
839
 
@@ -855,15 +836,9 @@ class WP_Members_Products_Admin {
855
  global $wpdb, $wpmem;
856
 
857
  // Check for membership views.
858
- foreach ( $wpmem->membership->product_by_id as $product_slug ) {
859
  // Check if we are viewing ($show) a membership ($prduct_slug).
860
- if ( $product_slug == $show ) {
861
- // Set appropriate $query_where to filter the view.
862
- $query_where = "WHERE 1=1 AND {$wpdb->users}.ID IN (
863
- SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
864
- WHERE {$wpdb->usermeta}.meta_key = \"" . esc_sql( "_wpmem_products_" . $product_slug ) . "\"
865
- AND {$wpdb->usermeta}.meta_value > 0 )";
866
- }
867
  }
868
 
869
  return $query_where;
23
  */
24
  function __construct() {
25
  global $wpmem;
26
+ if ( 1 == $wpmem->enable_products ) {
27
+ add_filter( 'manage_wpmem_product_posts_columns', array( $this, 'columns_heading' ) );
28
+ add_action( 'manage_wpmem_product_posts_custom_column', array( $this, 'columns_content' ), 10, 2 );
29
+ add_action( 'add_meta_boxes', array( $this, 'meta_boxes' ) );
30
+ add_action( 'page_attributes_misc_attributes', array( $this, 'membership_attributes' ) );
31
+ add_action( 'save_post', array( $this, 'save_details' ) );
32
+ add_action( 'wpmem_admin_after_block_meta', array( $this, 'add_product_to_post' ), 10, 2 );
33
+ add_action( 'wpmem_admin_block_meta_save', array( $this, 'save_product_to_post' ), 10, 3 );
34
+ add_action( 'admin_footer', array( $this, 'enqueue_select2' ) );
35
+ add_filter( 'manage_users_columns', array( $this, 'user_columns' ) );
36
+ add_filter( 'manage_users_custom_column', array( $this, 'user_columns_content' ), 10, 3 );
37
+ add_action( 'admin_head', array( $this, 'post_columns_width' ) );
38
+ add_filter( 'manage_posts_columns', array( $this, 'post_columns' ) );
39
+ add_action( 'manage_posts_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
40
+ add_filter( 'manage_pages_columns', array( $this, 'post_columns' ) );
41
+ add_action( 'manage_pages_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
42
+ foreach( $wpmem->post_types as $key => $val ) {
43
+ add_filter( 'manage_' . $key . '_posts_columns', array( $this, 'post_columns' ) );
44
+ add_action( 'manage_' . $key . '_posts_custom_column', array( $this, 'post_columns_content' ), 10, 2 );
45
+ }
46
+
47
+ add_filter( 'wpmem_user_profile_tabs', array( $this, 'user_profile_tabs' ), 1 );
48
+ add_action( 'wpmem_user_profile_tabs_content', array( $this, 'user_profile_tab_content' ), 10 );
49
+
50
+ add_filter( 'wpmem_views_users', array( $this, 'user_views' ), 10, 2 );
51
+ add_filter( 'wpmem_query_where', array( $this, 'query_where' ), 10, 2 );
52
  }
53
 
 
 
 
 
 
 
54
  $this->default_products = $wpmem->membership->get_default_products();
55
  }
56
 
546
  }
547
  foreach ( $wpmem->membership->products as $key => $value ) {
548
  if ( in_array( $key, $products ) ) {
549
+ update_post_meta( $post->ID, wpmem_get_membership_meta( $key ), 1 );
550
  } else {
551
+ delete_post_meta( $post->ID, wpmem_get_membership_meta( $key ) );
552
  }
553
  }
554
  }
616
  $post_products = $wpmem->membership->get_post_products( $post_id );
617
  if ( $post_products ) {
618
  foreach ( $post_products as $meta ) {
619
+ $display[] = wpmem_get_membership_name( $meta );
 
 
620
  }
621
  echo implode( ", ", $display );
622
  }
674
  $user_products = $wpmem->user->get_user_products( $user_id );
675
  if ( $user_products ) {
676
  foreach ( $user_products as $meta => $value ) {
677
+ $expires = ( $user_products[ $meta ] > 1 ) ? '<br />' . __( 'expires:', 'wp-members' ) . ' ' . date_i18n( get_option( 'date_format' ), $user_products[ $meta ] ) : '';
678
+ $display[] = $defaults['item_wrap_before'] . wpmem_get_membership_name( $meta ) . $expires . $defaults['item_wrap_after'];
 
 
679
  }
680
  }
681
  /**
807
  global $wpdb, $wpmem;
808
 
809
  // Add a view for each membership
810
+ foreach ( $wpmem->membership->product_by_id as $membership_slug ) {
811
+ $views = wpmem_add_user_view_link(
812
+ $views,
813
+ wpmem_get_membership_name( $membership_slug ), // $wpmem->membership->products[ $product_slug ]['title'],
814
+ $membership_slug,
815
+ wpmem_get_membership_meta( $membership_slug ), // "_wpmem_products_" . $product_slug,
816
+ 0,
817
+ ">"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
818
  );
819
  }
820
 
836
  global $wpdb, $wpmem;
837
 
838
  // Check for membership views.
839
+ foreach ( $wpmem->membership->product_by_id as $membership_slug ) {
840
  // Check if we are viewing ($show) a membership ($prduct_slug).
841
+ $query_where = wpmem_add_query_where( $query_where, $membership_slug, wpmem_get_membership_meta( $membership_slug ), 0, $compare = '>' );
 
 
 
 
 
 
842
  }
843
 
844
  return $query_where;
includes/admin/tabs/class-wp-members-admin-tab-dropins.php CHANGED
@@ -58,7 +58,7 @@ class WP_Members_Admin_Tab_Dropins {
58
  if ( $post_vals ) {
59
  foreach ( $post_vals as $key => $val ) {
60
  // Check against default strings. Only save if different.
61
- if ( html_entity_decode( wpmem_gettext( $key ) ) != html_entity_decode( $val ) ) {
62
  $settings['text'][ $key ] = $val;
63
  } else {
64
  if ( ! empty( $old_settings['text'] ) && array_key_exists( $key, $old_settings['text'] ) ) {
@@ -68,7 +68,7 @@ class WP_Members_Admin_Tab_Dropins {
68
  }
69
  // Double check settings for defaults.
70
  foreach ( $settings['text'] as $k => $v ) {
71
- if ( wpmem_gettext( $k ) == $v ) {
72
  unset( $settings['text'][ $k ] );
73
  }
74
  }
58
  if ( $post_vals ) {
59
  foreach ( $post_vals as $key => $val ) {
60
  // Check against default strings. Only save if different.
61
+ if ( html_entity_decode( wpmem_get_text( $key ) ) != html_entity_decode( $val ) ) {
62
  $settings['text'][ $key ] = $val;
63
  } else {
64
  if ( ! empty( $old_settings['text'] ) && array_key_exists( $key, $old_settings['text'] ) ) {
68
  }
69
  // Double check settings for defaults.
70
  foreach ( $settings['text'] as $k => $v ) {
71
+ if ( wpmem_get_text( $k ) == $v ) {
72
  unset( $settings['text'][ $k ] );
73
  }
74
  }
includes/api/api-products.php CHANGED
@@ -17,26 +17,54 @@
17
  * Gets all posts by product key.
18
  *
19
  * @since Unknown
 
20
  *
21
  * @global stdClass $wpmem
22
  * @param string $product_key
23
  * @return array
24
  */
25
  function wpmem_get_product_post_list( $product_key ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  global $wpmem;
27
- return $wpmem->membership->get_all_posts( $product_key );
28
  }
29
 
30
  /**
31
  * Gets the membership products for a given post.
32
  *
33
  * @since 3.3.7
 
34
  *
35
  * @global stdClass $wpmem
36
  * @param integer $post_id
37
  * @return array
38
  */
39
  function wpmem_get_post_products( $post_id ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  global $wpmem;
41
  return $wpmem->membership->get_post_products( $post_id );
42
  }
@@ -55,16 +83,64 @@ function wpmem_get_access_message( $post_products ) {
55
  return $wpmem->membership->get_access_message( $post_products );
56
  }
57
 
 
 
 
 
 
 
 
 
58
  function wpmem_get_products() {
59
  return wpmem_get_memberships();
60
  }
61
 
 
 
 
 
 
 
 
62
  function wpmem_get_memberships() {
63
  global $wpmem;
64
  return ( ! empty( $wpmem->membership->products ) ) ? $wpmem->membership->products : false;
65
  }
66
 
 
 
 
 
 
 
 
67
  function wpmem_get_memberships_ids() {
68
  global $wpmem;
69
  return array_flip( $wpmem->membership->product_by_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  }
17
  * Gets all posts by product key.
18
  *
19
  * @since Unknown
20
+ * @since 3.4.5 Alias of wpmem_get_membership_post_list().
21
  *
22
  * @global stdClass $wpmem
23
  * @param string $product_key
24
  * @return array
25
  */
26
  function wpmem_get_product_post_list( $product_key ) {
27
+ return wpmem_get_membership_post_list( $product_key );
28
+ }
29
+
30
+ /**
31
+ * Gets all posts by product key.
32
+ *
33
+ * @since 3.4.5
34
+ *
35
+ * @global stdClass $wpmem
36
+ * @param string $membership_key
37
+ * @return array
38
+ */
39
+ function wpmem_get_membership_post_list( $membership_key ) {
40
  global $wpmem;
41
+ return $wpmem->membership->get_all_posts( $membership_key );
42
  }
43
 
44
  /**
45
  * Gets the membership products for a given post.
46
  *
47
  * @since 3.3.7
48
+ * @since 3.4.5 Alias of wpmem_get_post_memberships().
49
  *
50
  * @global stdClass $wpmem
51
  * @param integer $post_id
52
  * @return array
53
  */
54
  function wpmem_get_post_products( $post_id ) {
55
+ return wpmem_get_post_memberships( $post_id );
56
+ }
57
+
58
+ /**
59
+ * Gets the membership products for a given post.
60
+ *
61
+ * @since 3.4.5
62
+ *
63
+ * @global stdClass $wpmem
64
+ * @param integer $post_id
65
+ * @return array
66
+ */
67
+ function wpmem_get_post_memberships( $post_id ) {
68
  global $wpmem;
69
  return $wpmem->membership->get_post_products( $post_id );
70
  }
83
  return $wpmem->membership->get_access_message( $post_products );
84
  }
85
 
86
+ /**
87
+ * Gets all memberships for the site.
88
+ * Alias of wpmem_get_memberships().
89
+ *
90
+ * @since Unknown
91
+ *
92
+ * @return array
93
+ */
94
  function wpmem_get_products() {
95
  return wpmem_get_memberships();
96
  }
97
 
98
+ /**
99
+ * Gets all memberships for the site.
100
+ *
101
+ * @since Unknown
102
+ *
103
+ * @return array
104
+ */
105
  function wpmem_get_memberships() {
106
  global $wpmem;
107
  return ( ! empty( $wpmem->membership->products ) ) ? $wpmem->membership->products : false;
108
  }
109
 
110
+ /**
111
+ * Get array of memberships keyed by ID.
112
+ *
113
+ * @since Unknown
114
+ *
115
+ * return array
116
+ */
117
  function wpmem_get_memberships_ids() {
118
  global $wpmem;
119
  return array_flip( $wpmem->membership->product_by_id );
120
+ }
121
+
122
+ /**
123
+ * Get membership display title by slug.
124
+ *
125
+ * @since 3.4.5
126
+ *
127
+ * @param string $membership_slug
128
+ * @return string Value of $wpmem->membership->products[ $membership_slug ]['title'] if set, otherwise, $membership_slug.
129
+ */
130
+ function wpmem_get_membership_name( $membership_slug ) {
131
+ global $wpmem;
132
+ return ( isset( $wpmem->membership->products[ $membership_slug ]['title'] ) ) ? $wpmem->membership->products[ $membership_slug ]['title'] : $membership_slug;
133
+ }
134
+
135
+ /**
136
+ * Get meta key for membership (with stem).
137
+ *
138
+ * @since 3.4.5
139
+ *
140
+ * @param string $membership_slug
141
+ * @return string
142
+ */
143
+ function wpmem_get_membership_meta( $membership_slug ) {
144
+ global $wpmem;
145
+ return $wpmem->membership->post_stem . $membership_slug;
146
  }
includes/api/api-users.php CHANGED
@@ -59,8 +59,8 @@ function wpmem_get_user_role( $user_id = false, $all = false ) {
59
  * @since 3.1.6 Include accepting an array of roles to check.
60
  * @since 3.1.9 Return false if user is not logged in.
61
  * @since 3.2.0 Change return false to not logged in AND no user id.
 
62
  *
63
- * @global object $current_user Current user object.
64
  * @global object $wpmem WP_Members object.
65
  * @param string|array $role Slug or array of slugs of the role being checked.
66
  * @param int $user_id ID of the user being checked (optional).
@@ -70,13 +70,9 @@ function wpmem_user_has_role( $role, $user_id = false ) {
70
  if ( ! is_user_logged_in() && ! $user_id ) {
71
  return false;
72
  }
73
- global $current_user, $wpmem;
74
  $has_role = false;
75
- if ( $user_id ) {
76
- $user = get_userdata( $user_id );
77
- } else {
78
- $user = ( isset( $current_user ) ) ? $current_user : wp_get_current_user();
79
- }
80
  if ( is_array( $role ) ) {
81
  foreach ( $role as $r ) {
82
  if ( in_array( $r, $user->roles ) ) {
59
  * @since 3.1.6 Include accepting an array of roles to check.
60
  * @since 3.1.9 Return false if user is not logged in.
61
  * @since 3.2.0 Change return false to not logged in AND no user id.
62
+ * @since 3.4.5 $current_user no longer necessary.
63
  *
 
64
  * @global object $wpmem WP_Members object.
65
  * @param string|array $role Slug or array of slugs of the role being checked.
66
  * @param int $user_id ID of the user being checked (optional).
70
  if ( ! is_user_logged_in() && ! $user_id ) {
71
  return false;
72
  }
73
+ global $wpmem;
74
  $has_role = false;
75
+ $user = ( $user_id ) ? get_userdata( $user_id ) : wp_get_current_user();
 
 
 
 
76
  if ( is_array( $role ) ) {
77
  foreach ( $role as $r ) {
78
  if ( in_array( $r, $user->roles ) ) {
includes/api/api.php CHANGED
@@ -128,7 +128,29 @@ function wpmem_register_url() {
128
  */
129
  function wpmem_profile_url( $a = false ) {
130
  global $wpmem;
131
- return ( $a ) ? add_query_arg( 'a', $a, $wpmem->user_pages['profile'] ) : $wpmem->user_pages['profile'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  }
133
 
134
  /**
@@ -205,8 +227,8 @@ function wpmem_login_status( $echo = true, $tag = false ) {
205
  'wrapper_before' => '<p>',
206
  'wrapper_after' => '</p>',
207
  'user_login' => $user_login,
208
- 'welcome' => wpmem_gettext( 'status_welcome' ),
209
- 'logout_text' => wpmem_gettext( 'status_logout' ),
210
  'logout_link' => '<a href="' . esc_url( wpmem_logout_link() ) . '">%s</a>',
211
  'separator' => ' | ',
212
  );
@@ -311,7 +333,7 @@ function wpmem_loginout( $args = array(), $echo = false ) {
311
  }
312
 
313
  /**
314
- * Gets a logout link.
315
  *
316
  * @since 3.4.0
317
  *
128
  */
129
  function wpmem_profile_url( $a = false ) {
130
  global $wpmem;
131
+ return ( $a ) ? add_query_arg( 'a', $a, trailingslashit( $wpmem->user_pages['profile'] ) ) : $wpmem->user_pages['profile'];
132
+ }
133
+
134
+ /**
135
+ * Alias of wpmem_profile_url() to return the password reset URL.
136
+ *
137
+ * @since 3.4.5
138
+ *
139
+ * @return string The password reset url.
140
+ */
141
+ function wpmem_pwd_reset_url() {
142
+ return wpmem_profile_url( 'pwdreset' );
143
+ }
144
+
145
+ /**
146
+ * Alias of wpmem_profile_url() to return the forgot username URL.
147
+ *
148
+ * @since 3.4.5
149
+ *
150
+ * @return string The pforgot username url.
151
+ */
152
+ function wpmem_forgot_username_url() {
153
+ return wpmem_profile_url( 'getusername' );
154
  }
155
 
156
  /**
227
  'wrapper_before' => '<p>',
228
  'wrapper_after' => '</p>',
229
  'user_login' => $user_login,
230
+ 'welcome' => wpmem_get_text( 'status_welcome' ),
231
+ 'logout_text' => wpmem_get_text( 'status_logout' ),
232
  'logout_link' => '<a href="' . esc_url( wpmem_logout_link() ) . '">%s</a>',
233
  'separator' => ' | ',
234
  );
333
  }
334
 
335
  /**
336
+ * Returns a URL to log a user out.
337
  *
338
  * @since 3.4.0
339
  *
includes/class-wp-members-forms.php CHANGED
@@ -790,10 +790,26 @@ class WP_Members_Forms {
790
 
791
  // Build the buttons, filter, and add to the form.
792
  if ( $action == 'login' ) {
793
- $args['remember_check'] = ( $args['remember_check'] ) ? $args['t'] . wpmem_form_field( array( 'name' => 'rememberme', 'type' => 'checkbox', 'value' => 'forever' ) ) . '&nbsp;' . '<label for="rememberme">' . wpmem_get_text( 'remember_me' ) . '</label>&nbsp;&nbsp;' . $args['n'] : '';
794
- $buttons = $args['remember_check'] . $args['t'] . '<input type="submit" name="Submit" value="' . esc_attr( $arr['button_text'] ) . '" class="' . wpmem_sanitize_class( $args['button_class'] ) . '" />' . $args['n'];
795
  } else {
796
- $buttons = '<input type="submit" name="Submit" value="' . esc_attr( $arr['button_text'] ) . '" class="' . wpmem_sanitize_class( $args['button_class'] ) . '" />' . $args['n'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
797
  }
798
 
799
  /**
@@ -806,25 +822,25 @@ class WP_Members_Forms {
806
  * @param string $buttons The generated HTML of the form buttons.
807
  * @param string $action The action being performed by the form. login|pwdreset|pwdchange|getusername.
808
  */
809
- $form = $form . apply_filters( 'wpmem_login_form_buttons', $args['buttons_before'] . $args['n'] . $buttons . $args['buttons_after'] . $args['n'], $action );
810
 
811
  $links_array = array(
812
  'forgot' => array(
813
- 'tag' => 'forgot',
814
- 'link' => add_query_arg( 'a', 'pwdreset', $wpmem->user_pages['profile'] ),
815
- 'page' => 'profile',
816
  'action' => 'login',
817
  ),
818
  'register' => array(
819
- 'tag' => 'reg',
820
- 'link' => $wpmem->user_pages['register'],
821
- 'page' => 'register',
822
  'action' => 'login',
823
  ),
824
  'username' => array(
825
- 'tag' => 'username',
826
- 'link' => add_query_arg( 'a', 'getusername', $wpmem->user_pages['profile'] ),
827
- 'page' => 'profile',
828
  'action' => 'pwdreset',
829
  ),
830
  );
790
 
791
  // Build the buttons, filter, and add to the form.
792
  if ( $action == 'login' ) {
793
+ $buttons[] = ( $args['remember_check'] ) ? $args['t'] . wpmem_form_field( array( 'name' => 'rememberme', 'type' => 'checkbox', 'value' => 'forever' ) ) . '&nbsp;' . '<label for="rememberme">' . wpmem_get_text( 'remember_me' ) . '</label>&nbsp;&nbsp;' . $args['n'] : '';
794
+ $buttons[] = $args['t'] . '<input type="submit" name="Submit" value="' . esc_attr( $arr['button_text'] ) . '" class="' . wpmem_sanitize_class( $args['button_class'] ) . '" />' . $args['n'];
795
  } else {
796
+ $buttons[] = '<input type="submit" name="Submit" value="' . esc_attr( $arr['button_text'] ) . '" class="' . wpmem_sanitize_class( $args['button_class'] ) . '" />' . $args['n'];
797
+ }
798
+
799
+ /**
800
+ * Filter the button parts.
801
+ *
802
+ * @since 3.4.5
803
+ *
804
+ * @param array $rows
805
+ * @param string $action
806
+ */
807
+ $buttons = apply_filters( 'wpmem_login_form_button_rows', $buttons, $action );
808
+
809
+ // HTML assembly for buttons.
810
+ $button_html = '';
811
+ foreach ( $buttons as $button_row ) {
812
+ $button_html .= $button_row;
813
  }
814
 
815
  /**
822
  * @param string $buttons The generated HTML of the form buttons.
823
  * @param string $action The action being performed by the form. login|pwdreset|pwdchange|getusername.
824
  */
825
+ $form = $form . apply_filters( 'wpmem_login_form_buttons', $args['buttons_before'] . $args['n'] . $button_html . $args['buttons_after'] . $args['n'], $action );
826
 
827
  $links_array = array(
828
  'forgot' => array(
829
+ 'tag' => 'forgot',
830
+ 'link' => wpmem_pwd_reset_url(),
831
+ 'page' => 'profile',
832
  'action' => 'login',
833
  ),
834
  'register' => array(
835
+ 'tag' => 'reg',
836
+ 'link' => wpmem_register_url(),
837
+ 'page' => 'register',
838
  'action' => 'login',
839
  ),
840
  'username' => array(
841
+ 'tag' => 'username',
842
+ 'link' => wpmem_forgot_username_url(),
843
+ 'page' => 'profile',
844
  'action' => 'pwdreset',
845
  ),
846
  );
includes/class-wp-members-products.php CHANGED
@@ -275,11 +275,11 @@ class WP_Members_Products {
275
  // Singular message if post only has one membership, otherwise multiple.
276
  if ( 1 == count( $post_products ) ) {
277
  $message = wpmem_get_text( 'product_restricted_single' )
278
- . "<br />" . $this->products[ $post_products[0] ]['title'];
279
  } else {
280
  $message = wpmem_get_text( 'product_restricted_multiple' ) . "<br />";
281
  foreach ( $post_products as $post_product ) {
282
- $message .= $this->products[ $post_product ]['title'] . "<br />";
283
  }
284
  }
285
  /**
275
  // Singular message if post only has one membership, otherwise multiple.
276
  if ( 1 == count( $post_products ) ) {
277
  $message = wpmem_get_text( 'product_restricted_single' )
278
+ . "<br />" . wpmem_get_membership_name( $post_products[0] );
279
  } else {
280
  $message = wpmem_get_text( 'product_restricted_multiple' ) . "<br />";
281
  foreach ( $post_products as $post_product ) {
282
+ $message .= wpmem_get_membership_name( $post_product ) . "<br />";
283
  }
284
  }
285
  /**
includes/class-wp-members-pwd-reset.php CHANGED
@@ -178,6 +178,17 @@ class WP_Members_Pwd_Reset {
178
 
179
  // Generate reset link.
180
  $link = add_query_arg( $query_args, trailingslashit( wpmem_profile_url() ) );
 
 
 
 
 
 
 
 
 
 
 
181
 
182
  // Does email body have the [reset_link] shortcode?
183
  if ( strpos( $arr['body'], '[reset_link]' ) ) {
178
 
179
  // Generate reset link.
180
  $link = add_query_arg( $query_args, trailingslashit( wpmem_profile_url() ) );
181
+
182
+ /**
183
+ * Filter the password reset URL in the email.
184
+ *
185
+ * @since 3.4.5
186
+ *
187
+ * @param string $link
188
+ * @param array $query_args
189
+ * @param object $user
190
+ */
191
+ $link = apply_filters( 'wpmem_pwd_reset_email_link', $link, $query_args, $user );
192
 
193
  // Does email body have the [reset_link] shortcode?
194
  if ( strpos( $arr['body'], '[reset_link]' ) ) {
includes/class-wp-members-shortcodes.php CHANGED
@@ -281,7 +281,7 @@ class WP_Members_Shortcodes {
281
  // If there is a status attribute of "sub" and the user is logged in.
282
  if ( ( isset( $atts['status'] ) ) && $atts['status'] == 'sub' ) {
283
  if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
284
- if ( ! wpmem_chk_exp() ) {
285
  $do_return = true;
286
  } elseif ( $atts['msg'] == "true" ) {
287
  $do_return = true;
@@ -321,7 +321,7 @@ class WP_Members_Shortcodes {
321
  $do_return = true;
322
  $settings = array(
323
  'wrapper_before' => '<div class="product_restricted_msg">',
324
- 'msg' => sprintf( wpmem_get_text( 'product_restricted' ), $wpmem->membership->products[ $membership ]['title'] ),
325
  'wrapper_after' => '</div>',
326
  );
327
  /**
@@ -592,11 +592,17 @@ class WP_Members_Shortcodes {
592
  function fields( $atts, $content, $tag ) {
593
 
594
  // What field?
595
- $field = ( isset( $atts[0] ) ) ? $atts[0] : $atts['field'];
 
 
 
 
 
 
596
 
597
  // What user?
598
  if ( isset( $atts['id'] ) ) {
599
- $the_ID = ( $atts['id'] == 'get' ) ? filter_var( wpmem_get( 'uid', '', 'get' ), FILTER_SANITIZE_NUMBER_INT ) : $atts['id']; // Ultimately, the_ID will be checked to determine if it is numeric by WP_User::get_data_by().
600
  } else {
601
  $the_ID = get_current_user_id();
602
  }
@@ -618,23 +624,130 @@ class WP_Members_Shortcodes {
618
  // Select and radio groups have single selections.
619
  case 'select':
620
  case 'radio':
621
- case 'membership':
622
  $result = ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) ? $user_info_field : wpmem_select_field_display( $field, $user_info_field );
623
  break;
624
 
625
  // Multiple select and multiple checkbox have multiple selections.
626
  case 'multiselect':
627
  case 'multicheckbox':
 
628
  if ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) {
629
  $result = $user_info_field;
630
  } else {
631
  $saved_vals = explode( $fields[ $field ]['delimiter'], $user_info_field );
632
  $result = ''; $x = 1;
633
- foreach ( $saved_vals as $value ) {
634
- $result.= ( $x > 1 ) ? ', ' : ''; $x++;
635
- $result.= wpmem_select_field_display( $field, $value );;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
636
  }
637
- }
638
  break;
639
 
640
  case 'file':
@@ -653,7 +766,24 @@ class WP_Members_Shortcodes {
653
  } else {
654
  if ( 'file' == $field_type ) {
655
  $attachment_url = wp_get_attachment_url( $user_info_field );
656
- $result = ( $attachment_url ) ? '<a href="' . esc_url( $attachment_url ) . '">' . get_the_title( $user_info_field ) . '</a>' : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  } else {
658
  $size = 'thumbnail';
659
  if ( isset( $atts['size'] ) ) {
@@ -661,7 +791,25 @@ class WP_Members_Shortcodes {
661
  $size = ( ! in_array( $atts['size'], $sizes ) ) ? explode( ",", $atts['size'] ) : $atts['size'];
662
  }
663
  $image = wp_get_attachment_image_src( $user_info_field, $size );
664
- $result = ( $image ) ? '<img src="' . esc_url( $image[0] ) . '" width="' . esc_attr( $image[1] ) . '" height="' . esc_attr( $image[2] ) . '" />' : '';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
665
  }
666
  }
667
  break;
@@ -705,11 +853,13 @@ class WP_Members_Shortcodes {
705
  * Filters the field shortcode before returning value.
706
  *
707
  * @since 3.2.5
 
708
  *
709
  * @param string $content
710
  * @param array $atts
 
711
  */
712
- $content = apply_filters( 'wpmem_field_shortcode', $content, $atts );
713
 
714
  return do_shortcode( $content );
715
  }
281
  // If there is a status attribute of "sub" and the user is logged in.
282
  if ( ( isset( $atts['status'] ) ) && $atts['status'] == 'sub' ) {
283
  if ( defined( 'WPMEM_EXP_MODULE' ) && $wpmem->use_exp == 1 ) {
284
+ if ( ! wpmem_is_user_current() ) {
285
  $do_return = true;
286
  } elseif ( $atts['msg'] == "true" ) {
287
  $do_return = true;
321
  $do_return = true;
322
  $settings = array(
323
  'wrapper_before' => '<div class="product_restricted_msg">',
324
+ 'msg' => sprintf( wpmem_get_text( 'product_restricted' ), wpmem_get_membership_name( $membership ) ),
325
  'wrapper_after' => '</div>',
326
  );
327
  /**
592
  function fields( $atts, $content, $tag ) {
593
 
594
  // What field?
595
+ if ( isset( $atts[0] ) ) {
596
+ $field = $atts[0];
597
+ } elseif ( isset( $atts['field'] ) ) {
598
+ $field = $atts['field'];
599
+ } else {
600
+ return; // If the field is not directly set in the attributes array, or keyed as "field", then it's not used correctly so return void.
601
+ }
602
 
603
  // What user?
604
  if ( isset( $atts['id'] ) ) {
605
+ $the_ID = ( $atts['id'] == 'get' ) ? filter_var( wpmem_get( 'uid', '', 'get' ), FILTER_SANITIZE_NUMBER_INT ) : $atts['id']; // @todo Ultimately, the_ID will be checked to determine if it is numeric by WP_User::get_data_by().
606
  } else {
607
  $the_ID = get_current_user_id();
608
  }
624
  // Select and radio groups have single selections.
625
  case 'select':
626
  case 'radio':
 
627
  $result = ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) ? $user_info_field : wpmem_select_field_display( $field, $user_info_field );
628
  break;
629
 
630
  // Multiple select and multiple checkbox have multiple selections.
631
  case 'multiselect':
632
  case 'multicheckbox':
633
+ case 'membership':
634
  if ( isset( $atts['display'] ) && 'raw' == $atts['display'] ) {
635
  $result = $user_info_field;
636
  } else {
637
  $saved_vals = explode( $fields[ $field ]['delimiter'], $user_info_field );
638
  $result = ''; $x = 1;
639
+ if ( 'list' == $atts['display'] ) {
640
+ /**
641
+ * Filter list multi field list display HTML parts.
642
+ *
643
+ * @since 3.4.5
644
+ *
645
+ * @param array {
646
+ * The HTML parts (defaults as a bulleted list)
647
+ *
648
+ * @type string $wrapper_before
649
+ * @type string $item_before
650
+ * @type string $item_after
651
+ * @type string $wrapper_after
652
+ * }
653
+ * @param string $field
654
+ * /
655
+ $multi_args = apply_filters( 'wpmem_field_shortcode_multi_args', array(
656
+ 'wrapper_before' => '<ul id="wpmem_sc_field_' . $field . '">',
657
+ 'item_id' => 'wpmem-sc-multi-' . $field,
658
+ 'item_class' => 'wpmem-sc-multi',
659
+ 'item_before' => '<li id="%s" class="%s">',
660
+ 'item_after' => '</li>',
661
+ 'wrapper_after' => '</ul>',
662
+ ), $field );
663
+
664
+ foreach ( $saved_vals as $value ) {
665
+ $rows[ $value ] = array(
666
+ 'item_before' => $multi_args['item_before'],
667
+ 'id' => $multi_args['item_id'] . '-' . $value,
668
+ 'class' => $multi_args['item_class'],
669
+ 'value' => $value,
670
+ 'title' => $value,
671
+ 'item_after' => $multi_args['item_after'],
672
+ );
673
+ }
674
+ /**
675
+ * Filter the row parts
676
+ *
677
+ * @since 3.4.5
678
+ *
679
+ * @param array $rows
680
+ * @param string $field
681
+ * /
682
+ $rows = apply_filters( 'wpmem_field_shortcode_multi_rows', $rows, $field );
683
+ $row_items = '';
684
+ foreach ( $rows as $value => $row ) {
685
+ $row_items .= sprintf( $row['item_before'], esc_attr( $row['id'] . '-' . $row['value'] ), esc_attr( $row['class'] ) ) . esc_attr( $row['title'] ) . $row['item_after'];
686
+ }
687
+
688
+ $result = $multi_args['wrapper_before'] . $row_items . $multi_args['wrapper_after'];
689
+ */
690
+
691
+ $args = array(
692
+ 'wrapper' => array(
693
+ 'tag' => ( isset( $atts['wrapper_tag'] ) ) ? $atts['wrapper_tag'] : 'ul',
694
+ 'atts' => array(
695
+ 'id' => ( isset( $atts['wrapper_id'] ) ) ? $atts['wrapper_id'] : 'wpmem_field_' . $field,
696
+ 'class' => ( isset( $atts['wrapper_class'] ) ) ? $atts['wrapper_class'] : 'wpmem-field-multi-list',
697
+ ),
698
+ ),
699
+ );
700
+ foreach ( $saved_vals as $value ) {
701
+ $args['item'][ $value ] = array(
702
+ 'tag' => ( isset( $atts['item_tag'] ) ) ? $atts['item_tag'] : 'li',
703
+ 'atts' => array(
704
+ 'id' => 'wpmem_field_' . $field . '_' . $value,
705
+ 'class' => 'wpmem-field-' . $field . '-item-' . $value,
706
+ ),
707
+ 'content' => $value
708
+ );
709
+ }
710
+ /**
711
+ * Filter list multi field list display HTML parts.
712
+ *
713
+ * @since 3.4.5
714
+ *
715
+ * @param array {
716
+ * The HTML parts (defaults as a bulleted list)
717
+ *
718
+ * @type array $wrapper {
719
+ * The wrapper parts.
720
+ *
721
+ * @type string $tag The HTML tag (default: ul)
722
+ * @type array $atts The HTML tag attributes
723
+ * @type string $content The content wrapped by the tag (default: list items)
724
+ * }
725
+ * @type array $item {
726
+ * An item for each list item.
727
+ *
728
+ * @type string $tag The HTML tag (default: li)
729
+ * @type array $atts The HTML tag attributes
730
+ * @type string $content The list item value
731
+ * }
732
+ * }
733
+ * @param string $field
734
+ */
735
+ $multi_args = apply_filters( 'wpmem_field_sc_multi_html', $args, $field );
736
+
737
+ $list = '';
738
+ foreach ( $multi_args['item'] as $item ) {
739
+ $list .= rktgk_build_html_tag( $item );
740
+ }
741
+ $multi_args['wrapper']['content'] = $list;
742
+ $result = rktgk_build_html_tag( $multi_args['wrapper'] );
743
+
744
+ } else {
745
+ foreach ( $saved_vals as $value ) {
746
+ $result.= ( $x > 1 ) ? ', ' : ''; $x++;
747
+ $result.= wpmem_select_field_display( $field, $value );;
748
+ }
749
  }
750
+ }
751
  break;
752
 
753
  case 'file':
766
  } else {
767
  if ( 'file' == $field_type ) {
768
  $attachment_url = wp_get_attachment_url( $user_info_field );
769
+ /**
770
+ * Filter the file html tag parts.
771
+ *
772
+ * @since 3.4.5
773
+ *
774
+ * @param array $args
775
+ * @param string $field
776
+ */
777
+ $html_args = apply_filters( 'wpmem_field_sc_file_html', array(
778
+ 'tag' => 'a',
779
+ 'atts' => array(
780
+ 'href' => esc_url( $attachment_url ),
781
+ 'id' => ( isset( $atts['id'] ) ) ? esc_attr( $atts['id'] ) : esc_attr( 'wpmem_field_file_' . $field ),
782
+ 'class' => ( isset( $atts['class'] ) ) ? esc_attr( $atts['class'] ) : esc_attr( 'wpmem-field-file-' . $field ),
783
+ ),
784
+ 'content' => get_the_title( $user_info_field ),
785
+ ), $field );
786
+ $result = ( $attachment_url ) ? rktgk_build_html_tag( $html_args ) : '';
787
  } else {
788
  $size = 'thumbnail';
789
  if ( isset( $atts['size'] ) ) {
791
  $size = ( ! in_array( $atts['size'], $sizes ) ) ? explode( ",", $atts['size'] ) : $atts['size'];
792
  }
793
  $image = wp_get_attachment_image_src( $user_info_field, $size );
794
+ /**
795
+ * Filter the image html tag parts.
796
+ *
797
+ * @since 3.4.5
798
+ *
799
+ * @param array $args
800
+ * @param string $field
801
+ */
802
+ $html_args = apply_filters( 'wpmem_field_sc_image_html', array(
803
+ 'tag' => 'img',
804
+ 'atts' => array(
805
+ 'src' => esc_url( $image[0] ),
806
+ 'width' => esc_attr( $image[1] ),
807
+ 'height' => esc_attr( $image[2] ),
808
+ 'id' => ( isset( $atts['id'] ) ) ? esc_attr( $atts['id'] ) : esc_attr( 'wpmem_field_img_' . $field ),
809
+ 'class' => ( isset( $atts['class'] ) ) ? esc_attr( $atts['class'] ) : esc_attr( 'wpmem-field-img-' . $field )
810
+ ),
811
+ ), $field );
812
+ $result = ( $image ) ? rktgk_build_html_tag( $html_args ) : '';
813
  }
814
  }
815
  break;
853
  * Filters the field shortcode before returning value.
854
  *
855
  * @since 3.2.5
856
+ * @since 3.4.5 Added $field
857
  *
858
  * @param string $content
859
  * @param array $atts
860
+ * @param string $field
861
  */
862
+ $content = apply_filters( 'wpmem_field_shortcode', $content, $atts, $field );
863
 
864
  return do_shortcode( $content );
865
  }
includes/class-wp-members-widget.php CHANGED
@@ -305,7 +305,7 @@ class widget_wpmemwidget extends WP_Widget {
305
 
306
  if ( $wpmem->user_pages['profile'] != null ) {
307
  /** This filter is documented in wp-members/includes/class-wp-members-forms.php */
308
- $link = apply_filters( 'wpmem_forgot_link', add_query_arg( 'a', 'pwdreset', $wpmem->user_pages['profile'] ) );
309
  $link_html = ' <a href="' . $link . '">' . wpmem_get_text( 'widget_login_forgot' ) . '</a>&nbsp;';
310
  /**
311
  * Filter the sidebar forgot password.
305
 
306
  if ( $wpmem->user_pages['profile'] != null ) {
307
  /** This filter is documented in wp-members/includes/class-wp-members-forms.php */
308
+ $link = apply_filters( 'wpmem_forgot_link', wpmem_profile_url( 'pwdreset' ) );
309
  $link_html = ' <a href="' . $link . '">' . wpmem_get_text( 'widget_login_forgot' ) . '</a>&nbsp;';
310
  /**
311
  * Filter the sidebar forgot password.
includes/class-wp-members.php CHANGED
@@ -398,14 +398,11 @@ class WP_Members {
398
  $this->forms = new WP_Members_Forms; // Load forms.
399
  $this->api = new WP_Members_API; // Load api.
400
  $this->shortcodes = new WP_Members_Shortcodes(); // Load shortcodes.
 
401
  $this->email = new WP_Members_Email; // Load email functions
402
  $this->user = new WP_Members_User( $this ); // Load user functions.
403
  $this->menus = new WP_Members_Menus();
404
  $this->dialogs = new WP_Members_Dialogs();
405
-
406
- if ( 1 == $this->enable_products ) {
407
- $this->membership = new WP_Members_Products(); // Load membership plans
408
- }
409
  if ( $this->clone_menus ) {
410
  $this->menus_clone = new WP_Members_Clone_Menus(); // Load clone menus.
411
  }
@@ -469,6 +466,7 @@ class WP_Members {
469
  // Add actions.
470
 
471
  add_action( 'init', array( $this, 'load_textdomain' ) );
 
472
  add_action( 'widgets_init', array( $this, 'widget_init' ) ); // initializes the widget
473
  add_action( 'rest_api_init', array( $this, 'rest_init' ) );
474
  add_action( 'pre_get_posts', array( $this, 'do_hide_posts' ), 20 );
@@ -480,7 +478,7 @@ class WP_Members {
480
  add_action( 'wp_footer', array( $this, 'invisible_captcha' ) );
481
 
482
  if ( is_admin() ) {
483
- add_action( 'init', array( $this, 'load_admin' ) ); // @todo Check user role to load correct dashboard
484
  }
485
 
486
  if ( is_user_logged_in() ) {
@@ -527,11 +525,6 @@ class WP_Members {
527
  add_filter( 'get_next_post_where', array( $this, 'filter_get_adjacent_post_where' ) );
528
  add_filter( 'allow_password_reset', array( $this->user, 'no_reset' ) ); // no password reset for non-activated users
529
 
530
- // If memberships are enabled.
531
- if ( 1 == $this->enable_products ) {
532
- add_action( 'init', array( $this->membership, 'add_cpt' ), 0 ); // Adds membership plans custom post type.
533
- }
534
-
535
  // If registration is moderated, check for activation (blocks backend login by non-activated users).
536
  if ( 1 == $this->mod_reg ) {
537
  add_filter( 'authenticate', array( $this->user, 'check_activated' ), 99, 3 );
@@ -648,6 +641,7 @@ class WP_Members {
648
  require_once( $this->path . 'includes/class-wp-members-email.php' );
649
  require_once( $this->path . 'includes/class-wp-members-forms.php' );
650
  require_once( $this->path . 'includes/class-wp-members-menus.php' );
 
651
  require_once( $this->path . 'includes/class-wp-members-pwd-reset.php' );
652
  require_once( $this->path . 'includes/class-wp-members-shortcodes.php' );
653
  require_once( $this->path . 'includes/class-wp-members-user.php' );
@@ -657,14 +651,10 @@ class WP_Members {
657
  require_once( $this->path . 'includes/api/api.php' );
658
  require_once( $this->path . 'includes/api/api-email.php' );
659
  require_once( $this->path . 'includes/api/api-forms.php' );
 
660
  require_once( $this->path . 'includes/api/api-users.php' );
661
  require_once( $this->path . 'includes/api/api-utilities.php' );
662
 
663
- if ( 1 == $this->enable_products ) {
664
- require_once( $this->path . 'includes/class-wp-members-products.php' );
665
- require_once( $this->path . 'includes/api/api-products.php' );
666
- }
667
-
668
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
669
  require_once( $this->path . 'includes/cli/class-wp-members-cli.php' );
670
  require_once( $this->path . 'includes/cli/class-wp-members-cli-user.php' );
@@ -1243,7 +1233,7 @@ class WP_Members {
1243
  foreach ( $this->membership->products as $key => $value ) {
1244
  if ( isset( $this->user->access[ $key ] ) && ( true == $this->user->access[ $key ] || $this->user->is_current( $this->user->access[ $key ] ) ) ) {
1245
  foreach ( $hidden as $post_id ) {
1246
- if ( 1 == get_post_meta( $post_id, $this->membership->post_stem . $key, true ) ) {
1247
  $hidden_key = array_search( $post_id, $hidden );
1248
  unset( $hidden[ $hidden_key ] );
1249
  }
398
  $this->forms = new WP_Members_Forms; // Load forms.
399
  $this->api = new WP_Members_API; // Load api.
400
  $this->shortcodes = new WP_Members_Shortcodes(); // Load shortcodes.
401
+ $this->membership = new WP_Members_Products(); // Load membership plans
402
  $this->email = new WP_Members_Email; // Load email functions
403
  $this->user = new WP_Members_User( $this ); // Load user functions.
404
  $this->menus = new WP_Members_Menus();
405
  $this->dialogs = new WP_Members_Dialogs();
 
 
 
 
406
  if ( $this->clone_menus ) {
407
  $this->menus_clone = new WP_Members_Clone_Menus(); // Load clone menus.
408
  }
466
  // Add actions.
467
 
468
  add_action( 'init', array( $this, 'load_textdomain' ) );
469
+ add_action( 'init', array( $this->membership, 'add_cpt' ), 0 ); // Adds membership plans custom post type.
470
  add_action( 'widgets_init', array( $this, 'widget_init' ) ); // initializes the widget
471
  add_action( 'rest_api_init', array( $this, 'rest_init' ) );
472
  add_action( 'pre_get_posts', array( $this, 'do_hide_posts' ), 20 );
478
  add_action( 'wp_footer', array( $this, 'invisible_captcha' ) );
479
 
480
  if ( is_admin() ) {
481
+ add_action( 'init', array( $this, 'load_admin' ) ); // @todo Check user role to load correct dashboard
482
  }
483
 
484
  if ( is_user_logged_in() ) {
525
  add_filter( 'get_next_post_where', array( $this, 'filter_get_adjacent_post_where' ) );
526
  add_filter( 'allow_password_reset', array( $this->user, 'no_reset' ) ); // no password reset for non-activated users
527
 
 
 
 
 
 
528
  // If registration is moderated, check for activation (blocks backend login by non-activated users).
529
  if ( 1 == $this->mod_reg ) {
530
  add_filter( 'authenticate', array( $this->user, 'check_activated' ), 99, 3 );
641
  require_once( $this->path . 'includes/class-wp-members-email.php' );
642
  require_once( $this->path . 'includes/class-wp-members-forms.php' );
643
  require_once( $this->path . 'includes/class-wp-members-menus.php' );
644
+ require_once( $this->path . 'includes/class-wp-members-products.php' );
645
  require_once( $this->path . 'includes/class-wp-members-pwd-reset.php' );
646
  require_once( $this->path . 'includes/class-wp-members-shortcodes.php' );
647
  require_once( $this->path . 'includes/class-wp-members-user.php' );
651
  require_once( $this->path . 'includes/api/api.php' );
652
  require_once( $this->path . 'includes/api/api-email.php' );
653
  require_once( $this->path . 'includes/api/api-forms.php' );
654
+ require_once( $this->path . 'includes/api/api-products.php' );
655
  require_once( $this->path . 'includes/api/api-users.php' );
656
  require_once( $this->path . 'includes/api/api-utilities.php' );
657
 
 
 
 
 
 
658
  if ( defined( 'WP_CLI' ) && WP_CLI ) {
659
  require_once( $this->path . 'includes/cli/class-wp-members-cli.php' );
660
  require_once( $this->path . 'includes/cli/class-wp-members-cli-user.php' );
1233
  foreach ( $this->membership->products as $key => $value ) {
1234
  if ( isset( $this->user->access[ $key ] ) && ( true == $this->user->access[ $key ] || $this->user->is_current( $this->user->access[ $key ] ) ) ) {
1235
  foreach ( $hidden as $post_id ) {
1236
+ if ( 1 == get_post_meta( $post_id, wpmem_get_membership_meta( $key ), true ) ) {
1237
  $hidden_key = array_search( $post_id, $hidden );
1238
  unset( $hidden[ $hidden_key ] );
1239
  }
includes/install.php CHANGED
@@ -804,7 +804,7 @@ function wpmem_onboarding_init( $action ) {
804
  'notice_heading' => __( 'Thank you for updating WP-Members, the original WordPress membership plugin.', 'wp-members' ),
805
  'notice_button' => __( 'Complete the update', 'wp-members' ),
806
  'show_release_notes' => true,
807
- 'release_notes_link' => "https://rocketgeek.com/release-announcements/wp-members-3-4-4/",
808
  ),
809
  );
810
  $wpmem_onboarding = new RocketGeek_Onboarding_Beta( $settings );
804
  'notice_heading' => __( 'Thank you for updating WP-Members, the original WordPress membership plugin.', 'wp-members' ),
805
  'notice_button' => __( 'Complete the update', 'wp-members' ),
806
  'show_release_notes' => true,
807
+ 'release_notes_link' => "https://rocketgeek.com/release-announcements/wp-members-3-4-5/",
808
  ),
809
  );
810
  $wpmem_onboarding = new RocketGeek_Onboarding_Beta( $settings );
includes/vendor/rocketgeek-tools/assets/css/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // nothing to see here... ?>
includes/vendor/rocketgeek-tools/assets/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // nothing to see here... ?>
includes/vendor/rocketgeek-tools/index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // nothing to see here... ?>
includes/vendor/rocketgeek-utilities/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
  Apache License
2
  Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
 
5
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
 
@@ -192,7 +192,7 @@
192
  you may not use this file except in compliance with the License.
193
  You may obtain a copy of the License at
194
 
195
- http://www.apache.org/licenses/LICENSE-2.0
196
 
197
  Unless required by applicable law or agreed to in writing, software
198
  distributed under the License is distributed on an "AS IS" BASIS,
1
  Apache License
2
  Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
 
5
  TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
 
192
  you may not use this file except in compliance with the License.
193
  You may obtain a copy of the License at
194
 
195
+ https://www.apache.org/licenses/LICENSE-2.0
196
 
197
  Unless required by applicable law or agreed to in writing, software
198
  distributed under the License is distributed on an "AS IS" BASIS,
includes/vendor/rocketgeek-utilities/includes/utilities.php CHANGED
@@ -1,185 +1,266 @@
1
- <?php
2
- /**
3
- * This file is part of the RocketGeek Utility Functions library.
4
- *
5
- * This library is open source and Apache-2.0 licensed. I hope you find it
6
- * useful for your project(s). Attribution is appreciated ;-)
7
- *
8
- * @package RocketGeek_Utilities
9
- * @subpackage RocketGeek_Utilities_Utilities
10
- * @version 1.0.0
11
- *
12
- * @link https://github.com/rocketgeek/rocketgeek-utilities/
13
- * @author Chad Butler <https://butlerblog.com>
14
- * @author RocketGeek <https://rocketgeek.com>
15
- * @copyright Copyright (c) 2022 Chad Butler
16
- * @license Apache-2.0
17
- *
18
- * Copyright [2022] Chad Butler, RocketGeek
19
- *
20
- * Licensed under the Apache License, Version 2.0 (the "License");
21
- * you may not use this file except in compliance with the License.
22
- * You may obtain a copy of the License at
23
- *
24
- * https://www.apache.org/licenses/LICENSE-2.0
25
- *
26
- * Unless required by applicable law or agreed to in writing, software
27
- * distributed under the License is distributed on an "AS IS" BASIS,
28
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
- * See the License for the specific language governing permissions and
30
- * limitations under the License.
31
- */
32
-
33
- if ( ! function_exists( 'rktgk_force_ssl' ) ):
34
- /**
35
- * Forces a URL to be secure (ssl).
36
- *
37
- * @since 1.0.0
38
- *
39
- * @param string $url URL to be make secure.
40
- * @return string The secure URL.
41
- */
42
- function rktgk_force_ssl( $url ) {
43
- return ( is_ssl() ) ? preg_replace( "/^http:/i", "https:", $url ) : $url;
44
- }
45
- endif;
46
-
47
- if ( ! function_exists( 'rktgk_get_suffix' ) ):
48
- /**
49
- * Determines whether to use a .min suffix for a script/style file.
50
- *
51
- * @since 1.0.0
52
- *
53
- * @param boolean $echo
54
- */
55
- function rktgk_get_suffix( $echo = false ) {
56
- $suffix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min';
57
- if ( true === $echo ) {
58
- echo $suffix;
59
- return;
60
- } else {
61
- return $suffix;
62
- }
63
- }
64
- endif;
65
-
66
- if ( ! function_exists( 'rktgk_maybe_unserialize' ) ):
67
- /**
68
- * Better unserialization than WP's maybe_unserialize().
69
- *
70
- * Sanitizes array output before returning. If the unserialized result is an
71
- * array, then it runs the result through wpmem_sanitize_array(), which
72
- * sanitizes each individual array element.
73
- *
74
- * @since 1.0.0
75
- *
76
- * @param mixed $original
77
- * @return mixed $original
78
- */
79
- function rktgk_maybe_unserialize( $original ) {
80
- if ( is_serialized( $original ) ) { // don't attempt to unserialize data that wasn't serialized going in
81
- $original = unserialize( $original );
82
- }
83
- return ( is_array( $original ) ) ? wpmem_sanitize_array( $original ) : $original;
84
- }
85
- endif;
86
-
87
- if ( ! function_exists( 'rktgk_maybe_wpautop' ) ):
88
- /**
89
- * Run wpautop on content. Defaults to true.
90
- *
91
- * Useful for shortcodes that don't autop on their own.
92
- * Toggle boolean can be passed as a string without pre-filtering
93
- * since it runs rktgk_str_to_bool().
94
- *
95
- * @since 1.0.0
96
- *
97
- * @param string $content
98
- * @param mixed $do_autop
99
- * @return string $content either autop'ed or not.
100
- */
101
- function rktgk_maybe_wpautop( $content, $do_autop = true ) {
102
- return ( true === rktgk_str_to_bool( $do_autop ) ) ? wpautop( $content ) : $content;
103
- }
104
- endif;
105
-
106
- if ( ! function_exists( 'rktgk_do_shortcode' ) ):
107
- /**
108
- * Call a shortcode function by tag name.
109
- *
110
- * Use this function for directly calling a shortcode without using do_shortcode.
111
- * do_shortcode() runs an extensive regex that goes through every shortcode in
112
- * the WP global $shortcode_tags. That's a lot of processing wasted if all you
113
- * want to do is run a specific shortcode/function. Yes, you could run the callback
114
- * directly, but what if that callback is in a class instance method? This utlitiy
115
- * allows you to run a shortcode function directly, regardless of whether it is
116
- * a direct function or in a class. It comes from an article by J.D. Grimes on this
117
- * subject and I've provided a link to that article.
118
- *
119
- * @author J.D. Grimes
120
- * @link https://codesymphony.co/dont-do_shortcode/
121
- *
122
- * @since 1.0.0
123
- *
124
- * @param string $tag The shortcode whose function to call.
125
- * @param array $atts The attributes to pass to the shortcode function. Optional.
126
- * @param array $content The shortcode's content. Default is null (none).
127
- *
128
- * @return string|bool False on failure, the result of the shortcode on success.
129
- */
130
- function rktgk_do_shortcode( $tag, array $atts = array(), $content = null ) {
131
-
132
- global $shortcode_tags;
133
-
134
- if ( ! isset( $shortcode_tags[ $tag ] ) ) {
135
- return false;
136
- }
137
-
138
- return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
139
- }
140
- endif;
141
-
142
- if ( ! function_exists( 'rktgk_is_woo_active' ) ):
143
- /**
144
- * Checks if WooCommerce is active.
145
- *
146
- * @since 1.0.0
147
- *
148
- * @return boolean
149
- */
150
- function rktgk_is_woo_active() {
151
- return ( class_exists( 'woocommerce' ) ) ? true : false;
152
- }
153
- endif;
154
-
155
- if ( ! function_exists( 'rktgk_get_user_ip' ) ):
156
- /**
157
- * Get user IP address.
158
- *
159
- * From Pippin.
160
- * @link https://gist.github.com/pippinsplugins/9641841
161
- *
162
- * @since 1.0.0
163
- *
164
- * @return string $ip.
165
- */
166
- function rktgk_get_user_ip() {
167
- if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
168
- //check ip from share internet
169
- $ip = $_SERVER['HTTP_CLIENT_IP'];
170
- } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
171
- //to check ip is pass from proxy
172
- $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
173
- } else {
174
- $ip = $_SERVER['REMOTE_ADDR'];
175
- }
176
- /**
177
- * Filter the IP result.
178
- *
179
- * @since 1.0.0
180
- *
181
- * @param string $ip
182
- */
183
- return apply_filters( 'rktgk_get_user_ip', $ip );
184
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  endif;
1
+ <?php
2
+ /**
3
+ * This file is part of the RocketGeek Utility Functions library.
4
+ *
5
+ * This library is open source and Apache-2.0 licensed. I hope you find it
6
+ * useful for your project(s). Attribution is appreciated ;-)
7
+ *
8
+ * @package RocketGeek_Utilities
9
+ * @subpackage RocketGeek_Utilities_Utilities
10
+ * @version 1.0.2
11
+ *
12
+ * @link https://github.com/rocketgeek/rocketgeek-utilities/
13
+ * @author Chad Butler <https://butlerblog.com>
14
+ * @author RocketGeek <https://rocketgeek.com>
15
+ * @copyright Copyright (c) 2022 Chad Butler
16
+ * @license Apache-2.0
17
+ *
18
+ * Copyright [2022] Chad Butler, RocketGeek
19
+ *
20
+ * Licensed under the Apache License, Version 2.0 (the "License");
21
+ * you may not use this file except in compliance with the License.
22
+ * You may obtain a copy of the License at
23
+ *
24
+ * https://www.apache.org/licenses/LICENSE-2.0
25
+ *
26
+ * Unless required by applicable law or agreed to in writing, software
27
+ * distributed under the License is distributed on an "AS IS" BASIS,
28
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
+ * See the License for the specific language governing permissions and
30
+ * limitations under the License.
31
+ */
32
+
33
+ if ( ! function_exists( 'rktgk_force_ssl' ) ):
34
+ /**
35
+ * Forces a URL to be secure (ssl).
36
+ *
37
+ * @since 1.0.0
38
+ *
39
+ * @param string $url URL to be make secure.
40
+ * @return string The secure URL.
41
+ */
42
+ function rktgk_force_ssl( $url ) {
43
+ return ( is_ssl() ) ? preg_replace( "/^http:/i", "https:", $url ) : $url;
44
+ }
45
+ endif;
46
+
47
+ if ( ! function_exists( 'rktgk_get_suffix' ) ):
48
+ /**
49
+ * Determines whether to use a .min suffix for a script/style file.
50
+ *
51
+ * @since 1.0.0
52
+ *
53
+ * @param boolean $echo
54
+ */
55
+ function rktgk_get_suffix( $echo = false ) {
56
+ $suffix = ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG ) ? '' : '.min';
57
+ if ( true === $echo ) {
58
+ echo $suffix;
59
+ return;
60
+ } else {
61
+ return $suffix;
62
+ }
63
+ }
64
+ endif;
65
+
66
+ if ( ! function_exists( 'rktgk_maybe_unserialize' ) ):
67
+ /**
68
+ * Better unserialization than WP's maybe_unserialize().
69
+ *
70
+ * Sanitizes array output before returning. If the unserialized result is an
71
+ * array, then it runs the result through wpmem_sanitize_array(), which
72
+ * sanitizes each individual array element.
73
+ *
74
+ * @since 1.0.0
75
+ *
76
+ * @param mixed $original
77
+ * @return mixed $original
78
+ */
79
+ function rktgk_maybe_unserialize( $original ) {
80
+ if ( is_serialized( $original ) ) { // don't attempt to unserialize data that wasn't serialized going in
81
+ $original = unserialize( $original );
82
+ }
83
+ return ( is_array( $original ) ) ? wpmem_sanitize_array( $original ) : $original;
84
+ }
85
+ endif;
86
+
87
+ if ( ! function_exists( 'rktgk_maybe_wpautop' ) ):
88
+ /**
89
+ * Run wpautop on content. Defaults to true.
90
+ *
91
+ * Useful for shortcodes that don't autop on their own.
92
+ * Toggle boolean can be passed as a string without pre-filtering
93
+ * since it runs rktgk_str_to_bool().
94
+ *
95
+ * @since 1.0.0
96
+ *
97
+ * @param string $content
98
+ * @param mixed $do_autop
99
+ * @return string $content either autop'ed or not.
100
+ */
101
+ function rktgk_maybe_wpautop( $content, $do_autop = true ) {
102
+ return ( true === rktgk_str_to_bool( $do_autop ) ) ? wpautop( $content ) : $content;
103
+ }
104
+ endif;
105
+
106
+ if ( ! function_exists( 'rktgk_do_shortcode' ) ):
107
+ /**
108
+ * Call a shortcode function by tag name.
109
+ *
110
+ * Use this function for directly calling a shortcode without using do_shortcode.
111
+ * do_shortcode() runs an extensive regex that goes through every shortcode in
112
+ * the WP global $shortcode_tags. That's a lot of processing wasted if all you
113
+ * want to do is run a specific shortcode/function. Yes, you could run the callback
114
+ * directly, but what if that callback is in a class instance method? This utlitiy
115
+ * allows you to run a shortcode function directly, regardless of whether it is
116
+ * a direct function or in a class. It comes from an article by J.D. Grimes on this
117
+ * subject and I've provided a link to that article.
118
+ *
119
+ * @author J.D. Grimes
120
+ * @link https://codesymphony.co/dont-do_shortcode/
121
+ *
122
+ * @since 1.0.0
123
+ *
124
+ * @param string $tag The shortcode whose function to call.
125
+ * @param array $atts The attributes to pass to the shortcode function. Optional.
126
+ * @param array $content The shortcode's content. Default is null (none).
127
+ *
128
+ * @return string|bool False on failure, the result of the shortcode on success.
129
+ */
130
+ function rktgk_do_shortcode( $tag, array $atts = array(), $content = null ) {
131
+
132
+ global $shortcode_tags;
133
+
134
+ if ( ! isset( $shortcode_tags[ $tag ] ) ) {
135
+ return false;
136
+ }
137
+
138
+ return call_user_func( $shortcode_tags[ $tag ], $atts, $content, $tag );
139
+ }
140
+ endif;
141
+
142
+ if ( ! function_exists( 'rktgk_is_woo_active' ) ):
143
+ /**
144
+ * Checks if WooCommerce is active.
145
+ *
146
+ * @since 1.0.0
147
+ *
148
+ * @return boolean
149
+ */
150
+ function rktgk_is_woo_active() {
151
+ return ( class_exists( 'woocommerce' ) ) ? true : false;
152
+ }
153
+ endif;
154
+
155
+ if ( ! function_exists( 'rktgk_get_user_ip' ) ):
156
+ /**
157
+ * Get user IP address.
158
+ *
159
+ * From Pippin.
160
+ * @link https://gist.github.com/pippinsplugins/9641841
161
+ *
162
+ * @since 1.0.0
163
+ *
164
+ * @return string $ip.
165
+ */
166
+ function rktgk_get_user_ip() {
167
+ if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
168
+ //check ip from share internet
169
+ $ip = $_SERVER['HTTP_CLIENT_IP'];
170
+ } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
171
+ //to check ip is pass from proxy
172
+ $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
173
+ } else {
174
+ $ip = $_SERVER['REMOTE_ADDR'];
175
+ }
176
+ /**
177
+ * Filter the IP result.
178
+ *
179
+ * @since 1.0.0
180
+ *
181
+ * @param string $ip
182
+ */
183
+ return apply_filters( 'rktgk_get_user_ip', $ip );
184
+ }
185
+ endif;
186
+
187
+ if ( ! function_exists( 'rktgk_get_server_var' ) ) :
188
+ /**
189
+ * A getter for $_SERVER vars
190
+ *
191
+ * @since 1.0.2
192
+ *
193
+ * @param string $server_var
194
+ * @return string
195
+ */
196
+ function rktgk_get_server_var( $server_var ) {
197
+ return ( isset( $_SERVER[ $server_var ] ) ) ? $_SERVER[ $server_var ] : '';
198
+ }
199
+ endif;
200
+
201
+ if ( ! function_exists( 'rktgk_get_script_uri' ) ) :
202
+ function rktgk_get_script_uri( $var = false ) {
203
+ $url = rktgk_get_server_var( 'SCRIPT_URI' );
204
+ if ( '' != $url ) {
205
+ return $url;
206
+ } else {
207
+ $url = rktgk_get_server_var( 'REQUEST_URI' );
208
+ if ( '' != $url ) {
209
+ return $url;
210
+ } else {
211
+ return rktgk_get_server_var( 'SCRIPT_NAME' );
212
+ }
213
+ }
214
+ }
215
+ endif;
216
+
217
+ if ( ! function_exists( 'rktgk_build_html_tag' ) ) :
218
+ /**
219
+ * Builds an HTML tag from provided attributes.
220
+ *
221
+ * @since 1.0.2
222
+ *
223
+ * @param array $args {
224
+ * An array of attributes to build the html tag.
225
+ *
226
+ * @type string $tag HTML tag to build.
227
+ * @type array $attributes|$atts Array of attributes of the tag, keyed as the attribute name.
228
+ * @type string $content Content inside the wrapped tag (omit for self-closing tags).
229
+ * }
230
+ */
231
+ function rktgk_build_html_tag( $args ) {
232
+
233
+ // A list of self-closing tags (so $content is not used).
234
+ $self_closing_tags = array( 'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'link', 'meta', 'param', 'source', 'track', 'wbr' );
235
+
236
+ // Check for attributes and allow for shorthand "atts"
237
+ if ( isset( $args['attributes'] ) ) {
238
+ $attributes = $args['attributes'];
239
+ } elseif ( isset( $args['atts'] ) ) {
240
+ $attributes = $args['atts'];
241
+ } else {
242
+ $attributes = false;
243
+ }
244
+
245
+ // Assemble tag and attributes.
246
+ $tag = '<' . $args['tag'];
247
+ if ( false != $attributes ) {
248
+ foreach ( $attributes as $attribute => $value ) {
249
+ // Sanitize classes.
250
+ $value = ( 'class' == $attribute || 'id' == $attribute ) ? rktgk_sanitize_class( $value ) : $value;
251
+
252
+ $tag .= ' ' . $attribute . '="' . esc_attr( $value ) . '"';
253
+ }
254
+ }
255
+
256
+ // If tag is self closing.
257
+ if ( in_array( $args['tag'], $self_closing_tags ) ) {
258
+ $tag .= ' />';
259
+ } else {
260
+ // If tag is a wrapped tag.
261
+ $tag .= '>' . $args['content'] . '</' . $args['tag'] . '>';
262
+ }
263
+
264
+ return $tag;
265
+ }
266
  endif;
includes/vendor/rocketgeek-utilities/loader.php CHANGED
@@ -1,42 +1,42 @@
1
- <?php
2
- /**
3
- * This is a library of utility functions for use in building WordPress plugins
4
- * (and other applications). These are used in various RocketGeek WordPress
5
- * plugins, but useage is not limited to those plugins. They are useful in any
6
- * WordPress application.
7
- *
8
- * This library is open source and Apache-2.0 licensed. I hope you find it
9
- * useful for your project(s). Attribution is appreciated ;-)
10
- *
11
- * @package RocketGeek_Utilities
12
- * @version 1.0.1
13
- *
14
- * @link https://github.com/rocketgeek/rocketgeek-utilities/
15
- * @author Chad Butler <https://butlerblog.com>
16
- * @author RocketGeek <https://rocketgeek.com>
17
- * @copyright Copyright (c) 2022 Chad Butler
18
- * @license Apache-2.0
19
- *
20
- * Copyright [2022] Chad Butler, RocketGeek
21
- *
22
- * Licensed under the Apache License, Version 2.0 (the "License");
23
- * you may not use this file except in compliance with the License.
24
- * You may obtain a copy of the License at
25
- *
26
- * https://www.apache.org/licenses/LICENSE-2.0
27
- *
28
- * Unless required by applicable law or agreed to in writing, software
29
- * distributed under the License is distributed on an "AS IS" BASIS,
30
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
- * See the License for the specific language governing permissions and
32
- * limitations under the License.
33
- */
34
-
35
- require_once( 'includes/utilities.php' );
36
- require_once( 'includes/arrays.php' );
37
- require_once( 'includes/dates.php' );
38
- require_once( 'includes/forms.php' );
39
- require_once( 'includes/strings.php' );
40
-
41
- // @todo Change to load only if debug is set
42
  require_once( 'includes/debug.php' );
1
+ <?php
2
+ /**
3
+ * This is a library of utility functions for use in building WordPress plugins
4
+ * (and other applications). These are used in various RocketGeek WordPress
5
+ * plugins, but useage is not limited to those plugins. They are useful in any
6
+ * WordPress application.
7
+ *
8
+ * This library is open source and Apache-2.0 licensed. I hope you find it
9
+ * useful for your project(s). Attribution is appreciated ;-)
10
+ *
11
+ * @package RocketGeek_Utilities
12
+ * @version 1.0.2
13
+ *
14
+ * @link https://github.com/rocketgeek/rocketgeek-utilities/
15
+ * @author Chad Butler <https://butlerblog.com>
16
+ * @author RocketGeek <https://rocketgeek.com>
17
+ * @copyright Copyright (c) 2022 Chad Butler
18
+ * @license Apache-2.0
19
+ *
20
+ * Copyright [2022] Chad Butler, RocketGeek
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * https://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
34
+
35
+ require_once( 'includes/utilities.php' );
36
+ require_once( 'includes/arrays.php' );
37
+ require_once( 'includes/dates.php' );
38
+ require_once( 'includes/forms.php' );
39
+ require_once( 'includes/strings.php' );
40
+
41
+ // @todo Change to load only if debug is set
42
  require_once( 'includes/debug.php' );
includes/vendor/select2/css/select2.css CHANGED
@@ -19,7 +19,9 @@
19
  text-overflow: ellipsis;
20
  white-space: nowrap; }
21
  .select2-container .select2-selection--single .select2-selection__clear {
22
- position: relative; }
 
 
23
  .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
24
  padding-right: 8px;
25
  padding-left: 20px; }
@@ -31,21 +33,29 @@
31
  user-select: none;
32
  -webkit-user-select: none; }
33
  .select2-container .select2-selection--multiple .select2-selection__rendered {
34
- display: inline-block;
35
- overflow: hidden;
36
- padding-left: 8px;
37
- text-overflow: ellipsis;
38
- white-space: nowrap; }
39
- .select2-container .select2-search--inline {
40
- float: left; }
41
- .select2-container .select2-search--inline .select2-search__field {
42
- box-sizing: border-box;
43
- border: none;
44
- font-size: 100%;
45
- margin-top: 5px;
46
  padding: 0; }
47
- .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
48
- -webkit-appearance: none; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  .select2-dropdown {
51
  background-color: white;
@@ -70,8 +80,9 @@
70
  padding: 6px;
71
  user-select: none;
72
  -webkit-user-select: none; }
73
- .select2-results__option[aria-selected] {
74
- cursor: pointer; }
 
75
 
76
  .select2-container--open .select2-dropdown {
77
  left: 0; }
@@ -118,12 +129,14 @@
118
  .select2-hidden-accessible {
119
  border: 0 !important;
120
  clip: rect(0 0 0 0) !important;
 
 
121
  height: 1px !important;
122
- margin: -1px !important;
123
  overflow: hidden !important;
124
  padding: 0 !important;
125
  position: absolute !important;
126
- width: 1px !important; }
 
127
 
128
  .select2-container--default .select2-selection--single {
129
  background-color: #fff;
@@ -135,7 +148,10 @@
135
  .select2-container--default .select2-selection--single .select2-selection__clear {
136
  cursor: pointer;
137
  float: right;
138
- font-weight: bold; }
 
 
 
139
  .select2-container--default .select2-selection--single .select2-selection__placeholder {
140
  color: #999; }
141
  .select2-container--default .select2-selection--single .select2-selection__arrow {
@@ -177,52 +193,79 @@
177
  background-color: white;
178
  border: 1px solid #aaa;
179
  border-radius: 4px;
180
- cursor: text; }
181
- .select2-container--default .select2-selection--multiple .select2-selection__rendered {
182
- box-sizing: border-box;
183
- list-style: none;
184
- margin: 0;
185
- padding: 0 5px;
186
- width: 100%; }
187
- .select2-container--default .select2-selection--multiple .select2-selection__rendered li {
188
- list-style: none; }
189
- .select2-container--default .select2-selection--multiple .select2-selection__placeholder {
190
- color: #999;
191
- margin-top: 5px;
192
- float: left; }
193
  .select2-container--default .select2-selection--multiple .select2-selection__clear {
194
  cursor: pointer;
195
- float: right;
196
  font-weight: bold;
 
 
197
  margin-top: 5px;
198
- margin-right: 10px; }
 
 
199
  .select2-container--default .select2-selection--multiple .select2-selection__choice {
200
  background-color: #e4e4e4;
201
  border: 1px solid #aaa;
202
  border-radius: 4px;
203
- cursor: default;
204
- float: left;
205
- margin-right: 5px;
206
  margin-top: 5px;
207
- padding: 0 5px; }
 
 
 
 
 
 
 
 
 
 
 
208
  .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
 
 
 
 
 
209
  color: #999;
210
  cursor: pointer;
211
- display: inline-block;
212
  font-weight: bold;
213
- margin-right: 2px; }
214
- .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
215
- color: #333; }
216
-
217
- .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
218
- float: right; }
 
 
219
 
220
  .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
221
  margin-left: 5px;
222
  margin-right: auto; }
223
 
 
 
 
 
224
  .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
225
- margin-left: 2px;
 
 
 
 
 
 
 
 
 
226
  margin-right: auto; }
227
 
228
  .select2-container--default.select2-container--focus .select2-selection--multiple {
@@ -258,15 +301,6 @@
258
  max-height: 200px;
259
  overflow-y: auto; }
260
 
261
- .select2-container--default .select2-results__option[role=group] {
262
- padding: 0; }
263
-
264
- .select2-container--default .select2-results__option[aria-disabled=true] {
265
- color: #999; }
266
-
267
- .select2-container--default .select2-results__option[aria-selected=true] {
268
- background-color: #ddd; }
269
-
270
  .select2-container--default .select2-results__option .select2-results__option {
271
  padding-left: 1em; }
272
  .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
@@ -287,7 +321,16 @@
287
  margin-left: -5em;
288
  padding-left: 6em; }
289
 
290
- .select2-container--default .select2-results__option--highlighted[aria-selected] {
 
 
 
 
 
 
 
 
 
291
  background-color: #5897fb;
292
  color: white; }
293
 
@@ -315,7 +358,8 @@
315
  cursor: pointer;
316
  float: right;
317
  font-weight: bold;
318
- margin-right: 10px; }
 
319
  .select2-container--classic .select2-selection--single .select2-selection__placeholder {
320
  color: #999; }
321
  .select2-container--classic .select2-selection--single .select2-selection__arrow {
@@ -392,43 +436,52 @@
392
  border: 1px solid #aaa;
393
  border-radius: 4px;
394
  cursor: text;
395
- outline: 0; }
 
 
396
  .select2-container--classic .select2-selection--multiple:focus {
397
  border: 1px solid #5897fb; }
398
- .select2-container--classic .select2-selection--multiple .select2-selection__rendered {
399
- list-style: none;
400
- margin: 0;
401
- padding: 0 5px; }
402
  .select2-container--classic .select2-selection--multiple .select2-selection__clear {
403
  display: none; }
404
  .select2-container--classic .select2-selection--multiple .select2-selection__choice {
405
  background-color: #e4e4e4;
406
  border: 1px solid #aaa;
407
  border-radius: 4px;
408
- cursor: default;
409
- float: left;
410
- margin-right: 5px;
411
  margin-top: 5px;
412
- padding: 0 5px; }
 
 
 
 
413
  .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
 
 
 
 
414
  color: #888;
415
  cursor: pointer;
416
- display: inline-block;
417
  font-weight: bold;
418
- margin-right: 2px; }
419
  .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
420
- color: #555; }
421
-
422
- .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
423
- float: right; }
424
 
425
  .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
426
  margin-left: 5px;
427
  margin-right: auto; }
428
 
 
 
 
 
429
  .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
430
- margin-left: 2px;
431
- margin-right: auto; }
 
 
432
 
433
  .select2-container--classic.select2-container--open .select2-selection--multiple {
434
  border: 1px solid #5897fb; }
@@ -465,13 +518,13 @@
465
  max-height: 200px;
466
  overflow-y: auto; }
467
 
468
- .select2-container--classic .select2-results__option[role=group] {
469
  padding: 0; }
470
 
471
- .select2-container--classic .select2-results__option[aria-disabled=true] {
472
  color: grey; }
473
 
474
- .select2-container--classic .select2-results__option--highlighted[aria-selected] {
475
  background-color: #3875d7;
476
  color: white; }
477
 
19
  text-overflow: ellipsis;
20
  white-space: nowrap; }
21
  .select2-container .select2-selection--single .select2-selection__clear {
22
+ background-color: transparent;
23
+ border: none;
24
+ font-size: 1em; }
25
  .select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
26
  padding-right: 8px;
27
  padding-left: 20px; }
33
  user-select: none;
34
  -webkit-user-select: none; }
35
  .select2-container .select2-selection--multiple .select2-selection__rendered {
36
+ display: inline;
37
+ list-style: none;
 
 
 
 
 
 
 
 
 
 
38
  padding: 0; }
39
+ .select2-container .select2-selection--multiple .select2-selection__clear {
40
+ background-color: transparent;
41
+ border: none;
42
+ font-size: 1em; }
43
+ .select2-container .select2-search--inline .select2-search__field {
44
+ box-sizing: border-box;
45
+ border: none;
46
+ font-size: 100%;
47
+ margin-top: 5px;
48
+ margin-left: 5px;
49
+ padding: 0;
50
+ max-width: 100%;
51
+ resize: none;
52
+ height: 18px;
53
+ vertical-align: bottom;
54
+ font-family: sans-serif;
55
+ overflow: hidden;
56
+ word-break: keep-all; }
57
+ .select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
58
+ -webkit-appearance: none; }
59
 
60
  .select2-dropdown {
61
  background-color: white;
80
  padding: 6px;
81
  user-select: none;
82
  -webkit-user-select: none; }
83
+
84
+ .select2-results__option--selectable {
85
+ cursor: pointer; }
86
 
87
  .select2-container--open .select2-dropdown {
88
  left: 0; }
129
  .select2-hidden-accessible {
130
  border: 0 !important;
131
  clip: rect(0 0 0 0) !important;
132
+ -webkit-clip-path: inset(50%) !important;
133
+ clip-path: inset(50%) !important;
134
  height: 1px !important;
 
135
  overflow: hidden !important;
136
  padding: 0 !important;
137
  position: absolute !important;
138
+ width: 1px !important;
139
+ white-space: nowrap !important; }
140
 
141
  .select2-container--default .select2-selection--single {
142
  background-color: #fff;
148
  .select2-container--default .select2-selection--single .select2-selection__clear {
149
  cursor: pointer;
150
  float: right;
151
+ font-weight: bold;
152
+ height: 26px;
153
+ margin-right: 20px;
154
+ padding-right: 0px; }
155
  .select2-container--default .select2-selection--single .select2-selection__placeholder {
156
  color: #999; }
157
  .select2-container--default .select2-selection--single .select2-selection__arrow {
193
  background-color: white;
194
  border: 1px solid #aaa;
195
  border-radius: 4px;
196
+ cursor: text;
197
+ padding-bottom: 5px;
198
+ padding-right: 5px;
199
+ position: relative; }
200
+ .select2-container--default .select2-selection--multiple.select2-selection--clearable {
201
+ padding-right: 25px; }
 
 
 
 
 
 
 
202
  .select2-container--default .select2-selection--multiple .select2-selection__clear {
203
  cursor: pointer;
 
204
  font-weight: bold;
205
+ height: 20px;
206
+ margin-right: 10px;
207
  margin-top: 5px;
208
+ position: absolute;
209
+ right: 0;
210
+ padding: 1px; }
211
  .select2-container--default .select2-selection--multiple .select2-selection__choice {
212
  background-color: #e4e4e4;
213
  border: 1px solid #aaa;
214
  border-radius: 4px;
215
+ box-sizing: border-box;
216
+ display: inline-block;
217
+ margin-left: 5px;
218
  margin-top: 5px;
219
+ padding: 0;
220
+ padding-left: 20px;
221
+ position: relative;
222
+ max-width: 100%;
223
+ overflow: hidden;
224
+ text-overflow: ellipsis;
225
+ vertical-align: bottom;
226
+ white-space: nowrap; }
227
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__display {
228
+ cursor: default;
229
+ padding-left: 2px;
230
+ padding-right: 5px; }
231
  .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
232
+ background-color: transparent;
233
+ border: none;
234
+ border-right: 1px solid #aaa;
235
+ border-top-left-radius: 4px;
236
+ border-bottom-left-radius: 4px;
237
  color: #999;
238
  cursor: pointer;
239
+ font-size: 1em;
240
  font-weight: bold;
241
+ padding: 0 4px;
242
+ position: absolute;
243
+ left: 0;
244
+ top: 0; }
245
+ .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover, .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus {
246
+ background-color: #f1f1f1;
247
+ color: #333;
248
+ outline: none; }
249
 
250
  .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
251
  margin-left: 5px;
252
  margin-right: auto; }
253
 
254
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display {
255
+ padding-left: 5px;
256
+ padding-right: 2px; }
257
+
258
  .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
259
+ border-left: 1px solid #aaa;
260
+ border-right: none;
261
+ border-top-left-radius: 0;
262
+ border-bottom-left-radius: 0;
263
+ border-top-right-radius: 4px;
264
+ border-bottom-right-radius: 4px; }
265
+
266
+ .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__clear {
267
+ float: left;
268
+ margin-left: 10px;
269
  margin-right: auto; }
270
 
271
  .select2-container--default.select2-container--focus .select2-selection--multiple {
301
  max-height: 200px;
302
  overflow-y: auto; }
303
 
 
 
 
 
 
 
 
 
 
304
  .select2-container--default .select2-results__option .select2-results__option {
305
  padding-left: 1em; }
306
  .select2-container--default .select2-results__option .select2-results__option .select2-results__group {
321
  margin-left: -5em;
322
  padding-left: 6em; }
323
 
324
+ .select2-container--default .select2-results__option--group {
325
+ padding: 0; }
326
+
327
+ .select2-container--default .select2-results__option--disabled {
328
+ color: #999; }
329
+
330
+ .select2-container--default .select2-results__option--selected {
331
+ background-color: #ddd; }
332
+
333
+ .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
334
  background-color: #5897fb;
335
  color: white; }
336
 
358
  cursor: pointer;
359
  float: right;
360
  font-weight: bold;
361
+ height: 26px;
362
+ margin-right: 20px; }
363
  .select2-container--classic .select2-selection--single .select2-selection__placeholder {
364
  color: #999; }
365
  .select2-container--classic .select2-selection--single .select2-selection__arrow {
436
  border: 1px solid #aaa;
437
  border-radius: 4px;
438
  cursor: text;
439
+ outline: 0;
440
+ padding-bottom: 5px;
441
+ padding-right: 5px; }
442
  .select2-container--classic .select2-selection--multiple:focus {
443
  border: 1px solid #5897fb; }
 
 
 
 
444
  .select2-container--classic .select2-selection--multiple .select2-selection__clear {
445
  display: none; }
446
  .select2-container--classic .select2-selection--multiple .select2-selection__choice {
447
  background-color: #e4e4e4;
448
  border: 1px solid #aaa;
449
  border-radius: 4px;
450
+ display: inline-block;
451
+ margin-left: 5px;
 
452
  margin-top: 5px;
453
+ padding: 0; }
454
+ .select2-container--classic .select2-selection--multiple .select2-selection__choice__display {
455
+ cursor: default;
456
+ padding-left: 2px;
457
+ padding-right: 5px; }
458
  .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
459
+ background-color: transparent;
460
+ border: none;
461
+ border-top-left-radius: 4px;
462
+ border-bottom-left-radius: 4px;
463
  color: #888;
464
  cursor: pointer;
465
+ font-size: 1em;
466
  font-weight: bold;
467
+ padding: 0 4px; }
468
  .select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
469
+ color: #555;
470
+ outline: none; }
 
 
471
 
472
  .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
473
  margin-left: 5px;
474
  margin-right: auto; }
475
 
476
+ .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display {
477
+ padding-left: 5px;
478
+ padding-right: 2px; }
479
+
480
  .select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
481
+ border-top-left-radius: 0;
482
+ border-bottom-left-radius: 0;
483
+ border-top-right-radius: 4px;
484
+ border-bottom-right-radius: 4px; }
485
 
486
  .select2-container--classic.select2-container--open .select2-selection--multiple {
487
  border: 1px solid #5897fb; }
518
  max-height: 200px;
519
  overflow-y: auto; }
520
 
521
+ .select2-container--classic .select2-results__option--group {
522
  padding: 0; }
523
 
524
+ .select2-container--classic .select2-results__option--disabled {
525
  color: grey; }
526
 
527
+ .select2-container--classic .select2-results__option--highlighted.select2-results__option--selectable {
528
  background-color: #3875d7;
529
  color: white; }
530
 
includes/vendor/select2/css/select2.min.css CHANGED
@@ -1 +1 @@
1
- .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
1
+ .select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{background-color:transparent;border:none;font-size:1em}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline;list-style:none;padding:0}.select2-container .select2-selection--multiple .select2-selection__clear{background-color:transparent;border:none;font-size:1em}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;margin-left:5px;padding:0;max-width:100%;resize:none;height:18px;vertical-align:bottom;font-family:sans-serif;overflow:hidden;word-break:keep-all}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option--selectable{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;height:26px;margin-right:20px;padding-right:0px}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;padding-bottom:5px;padding-right:5px;position:relative}.select2-container--default .select2-selection--multiple.select2-selection--clearable{padding-right:25px}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;font-weight:bold;height:20px;margin-right:10px;margin-top:5px;position:absolute;right:0;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:inline-block;margin-left:5px;margin-top:5px;padding:0;padding-left:20px;position:relative;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom;white-space:nowrap}.select2-container--default .select2-selection--multiple .select2-selection__choice__display{cursor:default;padding-left:2px;padding-right:5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{background-color:transparent;border:none;border-right:1px solid #aaa;border-top-left-radius:4px;border-bottom-left-radius:4px;color:#999;cursor:pointer;font-size:1em;font-weight:bold;padding:0 4px;position:absolute;left:0;top:0}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus{background-color:#f1f1f1;color:#333;outline:none}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display{padding-left:5px;padding-right:2px}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{border-left:1px solid #aaa;border-right:none;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__clear{float:left;margin-left:10px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--group{padding:0}.select2-container--default .select2-results__option--disabled{color:#999}.select2-container--default .select2-results__option--selected{background-color:#ddd}.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;height:26px;margin-right:20px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;padding-bottom:5px;padding-right:5px}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;display:inline-block;margin-left:5px;margin-top:5px;padding:0}.select2-container--classic .select2-selection--multiple .select2-selection__choice__display{cursor:default;padding-left:2px;padding-right:5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{background-color:transparent;border:none;border-top-left-radius:4px;border-bottom-left-radius:4px;color:#888;cursor:pointer;font-size:1em;font-weight:bold;padding:0 4px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;outline:none}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display{padding-left:5px;padding-right:2px}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option--group{padding:0}.select2-container--classic .select2-results__option--disabled{color:grey}.select2-container--classic .select2-results__option--highlighted.select2-results__option--selectable{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
includes/vendor/select2/js/i18n/af.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/af",[],function(){return{errorLoading:function(){return"Die resultate kon nie gelaai word nie."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Verwyders asseblief "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Voer asseblief "+(e.minimum-e.input.length)+" of meer karakters"},loadingMore:function(){return"Meer resultate word gelaai…"},maximumSelected:function(e){var n="Kies asseblief net "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"Geen resultate gevind"},searching:function(){return"Besig…"},removeAllItems:function(){return"Verwyder alle items"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/ar.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(n){return"الرجاء حذف "+(n.input.length-n.maximum)+" عناصر"},inputTooShort:function(n){return"الرجاء إضافة "+(n.minimum-n.input.length)+" عناصر"},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(n){return"تستطيع إختيار "+n.maximum+" بنود فقط"},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"},removeAllItems:function(){return"قم بإزالة كل العناصر"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/az.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/az",[],function(){return{inputTooLong:function(n){return n.input.length-n.maximum+" simvol silin"},inputTooShort:function(n){return n.minimum-n.input.length+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(n){return"Sadəcə "+n.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"},removeAllItems:function(){return"Bütün elementləri sil"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/bg.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bg",[],function(){return{inputTooLong:function(n){var e=n.input.length-n.maximum,u="Моля въведете с "+e+" по-малко символ";return e>1&&(u+="a"),u},inputTooShort:function(n){var e=n.minimum-n.input.length,u="Моля въведете още "+e+" символ";return e>1&&(u+="a"),u},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(n){var e="Можете да направите до "+n.maximum+" ";return n.maximum>1?e+="избора":e+="избор",e},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"},removeAllItems:function(){return"Премахнете всички елементи"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/bn.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/bn",[],function(){return{errorLoading:function(){return"ফলাফলগুলি লোড করা যায়নি।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।";return 1!=e&&(u="অনুগ্রহ করে "+e+" টি অক্ষর মুছে দিন।"),u},inputTooShort:function(n){return n.minimum-n.input.length+" টি অক্ষর অথবা অধিক অক্ষর লিখুন।"},loadingMore:function(){return"আরো ফলাফল লোড হচ্ছে ..."},maximumSelected:function(n){var e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।";return 1!=n.maximum&&(e=n.maximum+" টি আইটেম নির্বাচন করতে পারবেন।"),e},noResults:function(){return"কোন ফলাফল পাওয়া যায়নি।"},searching:function(){return"অনুসন্ধান করা হচ্ছে ..."}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/bs.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/bs",[],function(){function e(e,n,r,t){return e%10==1&&e%100!=11?n:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspijelo."},inputTooLong:function(n){var r=n.input.length-n.maximum,t="Obrišite "+r+" simbol";return t+=e(r,"","a","a")},inputTooShort:function(n){var r=n.minimum-n.input.length,t="Ukucajte bar još "+r+" simbol";return t+=e(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(n){var r="Možete izabrati samo "+n.maximum+" stavk";return r+=e(n.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Uklonite sve stavke"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/ca.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Si us plau, elimina "+n+" car";return r+=1==n?"àcter":"àcters"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Si us plau, introdueix "+n+" car";return r+=1==n?"àcter":"àcters"},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var n="Només es pot seleccionar "+e.maximum+" element";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"},removeAllItems:function(){return"Treu tots els elements"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/cs.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/cs",[],function(){function e(e,n){switch(e){case 2:return n?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadejte o jeden znak méně.":t<=4?"Prosím, zadejte o "+e(t,!0)+" znaky méně.":"Prosím, zadejte o "+t+" znaků méně."},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadejte ještě jeden znak.":t<=4?"Prosím, zadejte ještě další "+e(t,!0)+" znaky.":"Prosím, zadejte ještě dalších "+t+" znaků."},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(n){var t=n.maximum;return 1==t?"Můžete zvolit jen jednu položku.":t<=4?"Můžete zvolit maximálně "+e(t,!1)+" položky.":"Můžete zvolit maximálně "+t+" položek."},noResults:function(){return"Nenalezeny žádné položky."},searching:function(){return"Vyhledávání…"},removeAllItems:function(){return"Odstraňte všechny položky"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/da.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){return"Angiv venligst "+(e.input.length-e.maximum)+" tegn mindre"},inputTooShort:function(e){return"Angiv venligst "+(e.minimum-e.input.length)+" tegn mere"},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var n="Du kan kun vælge "+e.maximum+" emne";return 1!=e.maximum&&(n+="r"),n},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/de.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/de",[],function(){return{errorLoading:function(){return"Die Ergebnisse konnten nicht geladen werden."},inputTooLong:function(e){return"Bitte "+(e.input.length-e.maximum)+" Zeichen weniger eingeben"},inputTooShort:function(e){return"Bitte "+(e.minimum-e.input.length)+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var n="Sie können nur "+e.maximum+" Element";return 1!=e.maximum&&(n+="e"),n+=" auswählen"},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"},removeAllItems:function(){return"Entferne alle Elemente"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/dsb.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/dsb",[],function(){var n=["znamuško","znamušce","znamuška","znamuškow"],e=["zapisk","zapiska","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njejsu se dali zacytaś."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Pšosym lašuj "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Pšosym zapódaj nanejmjenjej "+a+" "+u(a,n)},loadingMore:function(){return"Dalšne wuslědki se zacytaju…"},maximumSelected:function(n){return"Móžoš jano "+n.maximum+" "+u(n.maximum,e)+"wubraś."},noResults:function(){return"Žedne wuslědki namakane"},searching:function(){return"Pyta se…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/el.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(n){var e=n.input.length-n.maximum,u="Παρακαλώ διαγράψτε "+e+" χαρακτήρ";return 1==e&&(u+="α"),1!=e&&(u+="ες"),u},inputTooShort:function(n){return"Παρακαλώ συμπληρώστε "+(n.minimum-n.input.length)+" ή περισσότερους χαρακτήρες"},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(n){var e="Μπορείτε να επιλέξετε μόνο "+n.maximum+" επιλογ";return 1==n.maximum&&(e+="ή"),1!=n.maximum&&(e+="ές"),e},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"},removeAllItems:function(){return"Καταργήστε όλα τα στοιχεία"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/en.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Please delete "+n+" character";return 1!=n&&(r+="s"),r},inputTooShort:function(e){return"Please enter "+(e.minimum-e.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var n="You can only select "+e.maximum+" item";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No results found"},searching:function(){return"Searching…"},removeAllItems:function(){return"Remove all items"},removeItem:function(){return"Remove item"},search:function(){return"Search"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/eo.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/eo",[],function(){return{errorLoading:function(){return"La rezultoj ne povas esti ŝargitaj."},inputTooLong:function(n){var e=n.input.length-n.maximum,r="Bonvolu forigi "+e+" signo";return r+=1==e?"n":"jn"},inputTooShort:function(n){return"Bv. enigi "+(n.minimum-n.input.length)+" aŭ pli multajn signojn"},loadingMore:function(){return"Ŝargado de pliaj rezultoj…"},maximumSelected:function(n){var e="Vi povas elekti nur "+n.maximum+" ero";return 1==n.maximum?e+="n":e+="jn",e},noResults:function(){return"Neniuj rezultoj trovitaj"},searching:function(){return"Serĉado…"},removeAllItems:function(){return"Forigi ĉiujn erojn"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/es.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"No se pudieron cargar los resultados"},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Por favor, elimine "+n+" car";return r+=1==n?"ácter":"acteres"},inputTooShort:function(e){var n=e.minimum-e.input.length,r="Por favor, introduzca "+n+" car";return r+=1==n?"ácter":"acteres"},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var n="Sólo puede seleccionar "+e.maximum+" elemento";return 1!=e.maximum&&(n+="s"),n},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Eliminar todos los elementos"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/et.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var n=e.input.length-e.maximum,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" vähem"},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Sisesta "+n+" täht";return 1!=n&&(t+="e"),t+=" rohkem"},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var n="Saad vaid "+e.maximum+" tulemus";return 1==e.maximum?n+="e":n+="t",n+=" valida"},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"},removeAllItems:function(){return"Eemalda kõik esemed"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/eu.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gutxiago"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return n+=1==t?"karaktere bat":t+" karaktere",n+=" gehiago"},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return 1===e.maximum?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"},removeAllItems:function(){return"Kendu elementu guztiak"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/fa.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(n){return"لطفاً "+(n.input.length-n.maximum)+" کاراکتر را حذف نمایید"},inputTooShort:function(n){return"لطفاً تعداد "+(n.minimum-n.input.length)+" کاراکتر یا بیشتر وارد نمایید"},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(n){return"شما تنها می‌توانید "+n.maximum+" آیتم را انتخاب نمایید"},noResults:function(){return"هیچ نتیجه‌ای یافت نشد"},searching:function(){return"در حال جستجو..."},removeAllItems:function(){return"همه موارد را حذف کنید"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/fi.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/fi",[],function(){return{errorLoading:function(){return"Tuloksia ei saatu ladattua."},inputTooLong:function(n){return"Ole hyvä ja anna "+(n.input.length-n.maximum)+" merkkiä vähemmän"},inputTooShort:function(n){return"Ole hyvä ja anna "+(n.minimum-n.input.length)+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(n){return"Voit valita ainoastaan "+n.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){return"Haetaan…"},removeAllItems:function(){return"Poista kaikki kohteet"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/fr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var n=e.input.length-e.maximum;return"Supprimez "+n+" caractère"+(n>1?"s":"")},inputTooShort:function(e){var n=e.minimum-e.input.length;return"Saisissez au moins "+n+" caractère"+(n>1?"s":"")},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){return"Vous pouvez seulement sélectionner "+e.maximum+" élément"+(e.maximum>1?"s":"")},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"},removeAllItems:function(){return"Supprimer tous les éléments"},removeItem:function(){return"Supprimer l'élément"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/gl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/gl",[],function(){return{errorLoading:function(){return"Non foi posíbel cargar os resultados."},inputTooLong:function(e){var n=e.input.length-e.maximum;return 1===n?"Elimine un carácter":"Elimine "+n+" caracteres"},inputTooShort:function(e){var n=e.minimum-e.input.length;return 1===n?"Engada un carácter":"Engada "+n+" caracteres"},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){return 1===e.maximum?"Só pode seleccionar un elemento":"Só pode seleccionar "+e.maximum+" elementos"},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Elimina todos os elementos"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/he.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="נא למחוק ";return r+=1===e?"תו אחד":e+" תווים"},inputTooShort:function(n){var e=n.minimum-n.input.length,r="נא להכניס ";return r+=1===e?"תו אחד":e+" תווים",r+=" או יותר"},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(n){var e="באפשרותך לבחור עד ";return 1===n.maximum?e+="פריט אחד":e+=n.maximum+" פריטים",e},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"},removeAllItems:function(){return"הסר את כל הפריטים"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/hi.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(n){var e=n.input.length-n.maximum,r=e+" अक्षर को हटा दें";return e>1&&(r=e+" अक्षरों को हटा दें "),r},inputTooShort:function(n){return"कृपया "+(n.minimum-n.input.length)+" या अधिक अक्षर दर्ज करें"},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(n){return"आप केवल "+n.maximum+" आइटम का चयन कर सकते हैं"},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."},removeAllItems:function(){return"सभी वस्तुओं को हटा दें"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/hr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hr",[],function(){function n(n){var e=" "+n+" znak";return n%10<5&&n%10>0&&(n%100<5||n%100>19)?n%10>1&&(e+="a"):e+="ova",e}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(e){return"Unesite "+n(e.input.length-e.maximum)},inputTooShort:function(e){return"Unesite još "+n(e.minimum-e.input.length)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(n){return"Maksimalan broj odabranih stavki je "+n.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Ukloni sve stavke"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/hsb.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hsb",[],function(){var n=["znamješko","znamješce","znamješka","znamješkow"],e=["zapisk","zapiskaj","zapiski","zapiskow"],u=function(n,e){return 1===n?e[0]:2===n?e[1]:n>2&&n<=4?e[2]:n>=5?e[3]:void 0};return{errorLoading:function(){return"Wuslědki njedachu so začitać."},inputTooLong:function(e){var a=e.input.length-e.maximum;return"Prošu zhašej "+a+" "+u(a,n)},inputTooShort:function(e){var a=e.minimum-e.input.length;return"Prošu zapodaj znajmjeńša "+a+" "+u(a,n)},loadingMore:function(){return"Dalše wuslědki so začitaja…"},maximumSelected:function(n){return"Móžeš jenož "+n.maximum+" "+u(n.maximum,e)+"wubrać"},noResults:function(){return"Žane wuslědki namakane"},searching:function(){return"Pyta so…"},removeAllItems:function(){return"Remove all items"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/hu.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/hu",[],function(){return{errorLoading:function(){return"Az eredmények betöltése nem sikerült."},inputTooLong:function(e){return"Túl hosszú. "+(e.input.length-e.maximum)+" karakterrel több, mint kellene."},inputTooShort:function(e){return"Túl rövid. Még "+(e.minimum-e.input.length)+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"},removeAllItems:function(){return"Távolítson el minden elemet"},removeItem:function(){return"Elem eltávolítása"},search:function(){return"Keresés"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/hy.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/hy",[],function(){return{errorLoading:function(){return"Արդյունքները հնարավոր չէ բեռնել։"},inputTooLong:function(n){return"Խնդրում ենք հեռացնել "+(n.input.length-n.maximum)+" նշան"},inputTooShort:function(n){return"Խնդրում ենք մուտքագրել "+(n.minimum-n.input.length)+" կամ ավել նշաններ"},loadingMore:function(){return"Բեռնվում են նոր արդյունքներ․․․"},maximumSelected:function(n){return"Դուք կարող եք ընտրել առավելագույնը "+n.maximum+" կետ"},noResults:function(){return"Արդյունքներ չեն գտնվել"},searching:function(){return"Որոնում․․․"},removeAllItems:function(){return"Հեռացնել բոլոր տարրերը"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/id.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(n){return"Hapuskan "+(n.input.length-n.maximum)+" huruf"},inputTooShort:function(n){return"Masukkan "+(n.minimum-n.input.length)+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(n){return"Anda hanya dapat memilih "+n.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Hapus semua item"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/is.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/is",[],function(){return{inputTooLong:function(n){var t=n.input.length-n.maximum,e="Vinsamlegast styttið texta um "+t+" staf";return t<=1?e:e+"i"},inputTooShort:function(n){var t=n.minimum-n.input.length,e="Vinsamlegast skrifið "+t+" staf";return t>1&&(e+="i"),e+=" í viðbót"},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(n){return"Þú getur aðeins valið "+n.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"},removeAllItems:function(){return"Fjarlægðu öll atriði"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/it.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Per favore cancella "+n+" caratter";return t+=1!==n?"i":"e"},inputTooShort:function(e){return"Per favore inserisci "+(e.minimum-e.input.length)+" o più caratteri"},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var n="Puoi selezionare solo "+e.maximum+" element";return 1!==e.maximum?n+="i":n+="o",n},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"},removeAllItems:function(){return"Rimuovi tutti gli oggetti"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/ja.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(n){return n.input.length-n.maximum+" 文字を削除してください"},inputTooShort:function(n){return"少なくとも "+(n.minimum-n.input.length)+" 文字を入力してください"},loadingMore:function(){return"読み込み中…"},maximumSelected:function(n){return n.maximum+" 件しか選択できません"},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"},removeAllItems:function(){return"すべてのアイテムを削除"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/ka.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ka",[],function(){return{errorLoading:function(){return"მონაცემების ჩატვირთვა შეუძლებელია."},inputTooLong:function(n){return"გთხოვთ აკრიფეთ "+(n.input.length-n.maximum)+" სიმბოლოთი ნაკლები"},inputTooShort:function(n){return"გთხოვთ აკრიფეთ "+(n.minimum-n.input.length)+" სიმბოლო ან მეტი"},loadingMore:function(){return"მონაცემების ჩატვირთვა…"},maximumSelected:function(n){return"თქვენ შეგიძლიათ აირჩიოთ არაუმეტეს "+n.maximum+" ელემენტი"},noResults:function(){return"რეზულტატი არ მოიძებნა"},searching:function(){return"ძიება…"},removeAllItems:function(){return"ამოიღე ყველა ელემენტი"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/km.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(n){return"សូមលុបចេញ "+(n.input.length-n.maximum)+" អក្សរ"},inputTooShort:function(n){return"សូមបញ្ចូល"+(n.minimum-n.input.length)+" អក្សរ រឺ ច្រើនជាងនេះ"},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(n){return"អ្នកអាចជ្រើសរើសបានតែ "+n.maximum+" ជម្រើសប៉ុណ្ណោះ"},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."},removeAllItems:function(){return"លុបធាតុទាំងអស់"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/ko.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(n){return"너무 깁니다. "+(n.input.length-n.maximum)+" 글자 지워주세요."},inputTooShort:function(n){return"너무 짧습니다. "+(n.minimum-n.input.length)+" 글자 더 입력해주세요."},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(n){return"최대 "+n.maximum+"개까지만 선택 가능합니다."},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"},removeAllItems:function(){return"모든 항목 삭제"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/lt.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/lt",[],function(){function n(n,e,i,t){return n%10==1&&(n%100<11||n%100>19)?e:n%10>=2&&n%10<=9&&(n%100<11||n%100>19)?i:t}return{inputTooLong:function(e){var i=e.input.length-e.maximum,t="Pašalinkite "+i+" simbol";return t+=n(i,"į","ius","ių")},inputTooShort:function(e){var i=e.minimum-e.input.length,t="Įrašykite dar "+i+" simbol";return t+=n(i,"į","ius","ių")},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(e){var i="Jūs galite pasirinkti tik "+e.maximum+" element";return i+=n(e.maximum,"ą","us","ų")},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"},removeAllItems:function(){return"Pašalinti visus elementus"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/lv.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/lv",[],function(){function e(e,n,u,i){return 11===e?n:e%10==1?u:i}return{inputTooLong:function(n){var u=n.input.length-n.maximum,i="Lūdzu ievadiet par "+u;return(i+=" simbol"+e(u,"iem","u","iem"))+" mazāk"},inputTooShort:function(n){var u=n.minimum-n.input.length,i="Lūdzu ievadiet vēl "+u;return i+=" simbol"+e(u,"us","u","us")},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(n){var u="Jūs varat izvēlēties ne vairāk kā "+n.maximum;return u+=" element"+e(n.maximum,"us","u","us")},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"},removeAllItems:function(){return"Noņemt visus vienumus"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/mk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/mk",[],function(){return{inputTooLong:function(n){var e=(n.input.length,n.maximum,"Ве молиме внесете "+n.maximum+" помалку карактер");return 1!==n.maximum&&(e+="и"),e},inputTooShort:function(n){var e=(n.minimum,n.input.length,"Ве молиме внесете уште "+n.maximum+" карактер");return 1!==n.maximum&&(e+="и"),e},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(n){var e="Можете да изберете само "+n.maximum+" ставк";return 1===n.maximum?e+="а":e+="и",e},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"},removeAllItems:function(){return"Отстрани ги сите предмети"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/ms.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(n){return"Sila hapuskan "+(n.input.length-n.maximum)+" aksara"},inputTooShort:function(n){return"Sila masukkan "+(n.minimum-n.input.length)+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(n){return"Anda hanya boleh memilih "+n.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"},removeAllItems:function(){return"Keluarkan semua item"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/nb.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){return"Vennligst fjern "+(e.input.length-e.maximum)+" tegn"},inputTooShort:function(e){return"Vennligst skriv inn "+(e.minimum-e.input.length)+" tegn til"},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"},removeAllItems:function(){return"Fjern alle elementer"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/ne.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ne",[],function(){return{errorLoading:function(){return"नतिजाहरु देखाउन सकिएन।"},inputTooLong:function(n){var e=n.input.length-n.maximum,u="कृपया "+e+" अक्षर मेटाउनुहोस्।";return 1!=e&&(u+="कृपया "+e+" अक्षरहरु मेटाउनुहोस्।"),u},inputTooShort:function(n){return"कृपया बाँकी रहेका "+(n.minimum-n.input.length)+" वा अरु धेरै अक्षरहरु भर्नुहोस्।"},loadingMore:function(){return"अरु नतिजाहरु भरिँदैछन् …"},maximumSelected:function(n){var e="तँपाई "+n.maximum+" वस्तु मात्र छान्न पाउँनुहुन्छ।";return 1!=n.maximum&&(e="तँपाई "+n.maximum+" वस्तुहरु मात्र छान्न पाउँनुहुन्छ।"),e},noResults:function(){return"कुनै पनि नतिजा भेटिएन।"},searching:function(){return"खोजि हुँदैछ…"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/nl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){return"Gelieve "+(e.input.length-e.maximum)+" karakters te verwijderen"},inputTooShort:function(e){return"Gelieve "+(e.minimum-e.input.length)+" of meer karakters in te voeren"},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var n=1==e.maximum?"kan":"kunnen",r="Er "+n+" maar "+e.maximum+" item";return 1!=e.maximum&&(r+="s"),r+=" worden geselecteerd"},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"},removeAllItems:function(){return"Verwijder alle items"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/pa.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pa",[],function(){return{errorLoading:function(){return"ਨਤੀਜੇ ਲੋਡ ਨਹੀਂ ਕੀਤੇ ਜਾ ਸਕਦੇ ।"},inputTooLong:function(n){var e=n.input.length-n.maximum;return"ਕ੍ਰਿਪਾ ਕਰਕੇ "+e+(1!=e?" ਅੱਖਰਾਂ ਨੂੰ ":" ਅੱਖਰ ")+"ਮਿਟਾਓ ।"},inputTooShort:function(n){var e=n.minimum-n.input.length;return"ਕ੍ਰਿਪਾ ਕਰਕੇ "+e+" ਜਾਂ "+e+" ਤੋਂ ਵੱਧ"+(e>1?" ਅੱਖਰਾਂ ":" ਅੱਖਰ ")+"ਦੀ ਵਰਤੋਂ ਕਰੋ ।"},loadingMore:function(){return"ਹੋਰ ਨਤੀਜੇ ਲੋਡ ਹੋ ਰਹੇ ਹਨ ...।"},maximumSelected:function(n){var e="ਤੁਸੀਂ ਸਿਰਫ਼ "+n.maximum+" ਨਤੀਜਾ ਚੁਣ ਸਕਦੇ ਹੋ ।";return 1!=n.maximum&&(e="ਤੁਸੀਂ ਸਿਰਫ਼ "+n.maximum+" ਨਤੀਜੇ ਚੁਣ ਸਕਦੇ ਹੋ ।"),e},noResults:function(){return"ਨਤੀਜਾ ਨਹੀਂ ਮਿਲ ਰਿਹਾ ਹੈ ।"},searching:function(){return"ਖ਼ੋਜ ਕਰ ਰਹੇਂ ਹਾਂ ...।"},removeAllItems:function(){return"ਸਾਰੇ ਨਤੀਜੇ ਮਿਟਾਓ ।"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/pl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/pl",[],function(){var n=["znak","znaki","znaków"],e=["element","elementy","elementów"],r=function(n,e){return 1===n?e[0]:n>1&&n<=4?e[1]:n>=5?e[2]:void 0};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Usuń "+t+" "+r(t,n)},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Podaj przynajmniej "+t+" "+r(t,n)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(n){return"Możesz zaznaczyć tylko "+n.maximum+" "+r(n.maximum,e)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"},removeAllItems:function(){return"Usuń wszystkie przedmioty"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/ps.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ps",[],function(){return{errorLoading:function(){return"پايلي نه سي ترلاسه کېدای"},inputTooLong:function(n){var e=n.input.length-n.maximum,r="د مهربانۍ لمخي "+e+" توری ړنګ کړئ";return 1!=e&&(r=r.replace("توری","توري")),r},inputTooShort:function(n){return"لږ تر لږه "+(n.minimum-n.input.length)+" يا ډېر توري وليکئ"},loadingMore:function(){return"نوري پايلي ترلاسه کيږي..."},maximumSelected:function(n){var e="تاسو يوازي "+n.maximum+" قلم په نښه کولای سی";return 1!=n.maximum&&(e=e.replace("قلم","قلمونه")),e},noResults:function(){return"پايلي و نه موندل سوې"},searching:function(){return"لټول کيږي..."},removeAllItems:function(){return"ټول توکي لرې کړئ"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/pt-BR.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var n=e.input.length-e.maximum,r="Apague "+n+" caracter";return 1!=n&&(r+="es"),r},inputTooShort:function(e){return"Digite "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var n="Você só pode selecionar "+e.maximum+" ite";return 1==e.maximum?n+="m":n+="ns",n},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/pt.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var r=e.input.length-e.maximum,n="Por favor apague "+r+" ";return n+=1!=r?"caracteres":"caractere"},inputTooShort:function(e){return"Introduza "+(e.minimum-e.input.length)+" ou mais caracteres"},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var r="Apenas pode seleccionar "+e.maximum+" ";return r+=1!=e.maximum?"itens":"item"},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"},removeAllItems:function(){return"Remover todos os itens"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/ro.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return 1!==t&&(n+="e"),n},inputTooShort:function(e){return"Vă rugăm să introduceți "+(e.minimum-e.input.length)+" sau mai multe caractere"},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",1!==e.maximum&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"},removeAllItems:function(){return"Eliminați toate elementele"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/ru.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/ru",[],function(){function n(n,e,r,u){return n%10<5&&n%10>0&&n%100<5||n%100>20?n%10>1?r:e:u}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Пожалуйста, введите на "+r+" символ";return u+=n(r,"","a","ов"),u+=" меньше"},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Пожалуйста, введите ещё хотя бы "+r+" символ";return u+=n(r,"","a","ов")},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(e){var r="Вы можете выбрать не более "+e.maximum+" элемент";return r+=n(e.maximum,"","a","ов")},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"},removeAllItems:function(){return"Удалить все элементы"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/sk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{errorLoading:function(){return"Výsledky sa nepodarilo načítať."},inputTooLong:function(n){var t=n.input.length-n.maximum;return 1==t?"Prosím, zadajte o jeden znak menej":t>=2&&t<=4?"Prosím, zadajte o "+e[t](!0)+" znaky menej":"Prosím, zadajte o "+t+" znakov menej"},inputTooShort:function(n){var t=n.minimum-n.input.length;return 1==t?"Prosím, zadajte ešte jeden znak":t<=4?"Prosím, zadajte ešte ďalšie "+e[t](!0)+" znaky":"Prosím, zadajte ešte ďalších "+t+" znakov"},loadingMore:function(){return"Načítanie ďalších výsledkov…"},maximumSelected:function(n){return 1==n.maximum?"Môžete zvoliť len jednu položku":n.maximum>=2&&n.maximum<=4?"Môžete zvoliť najviac "+e[n.maximum](!1)+" položky":"Môžete zvoliť najviac "+n.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"},removeAllItems:function(){return"Odstráňte všetky položky"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/sl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sl",[],function(){return{errorLoading:function(){return"Zadetkov iskanja ni bilo mogoče naložiti."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Prosim zbrišite "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},inputTooShort:function(e){var n=e.minimum-e.input.length,t="Prosim vpišite še "+n+" znak";return 2==n?t+="a":1!=n&&(t+="e"),t},loadingMore:function(){return"Nalagam več zadetkov…"},maximumSelected:function(e){var n="Označite lahko največ "+e.maximum+" predmet";return 2==e.maximum?n+="a":1!=e.maximum&&(n+="e"),n},noResults:function(){return"Ni zadetkov."},searching:function(){return"Iščem…"},removeAllItems:function(){return"Odstranite vse elemente"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/sq.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/sq",[],function(){return{errorLoading:function(){return"Rezultatet nuk mund të ngarkoheshin."},inputTooLong:function(e){var n=e.input.length-e.maximum,t="Të lutem fshi "+n+" karakter";return 1!=n&&(t+="e"),t},inputTooShort:function(e){return"Të lutem shkruaj "+(e.minimum-e.input.length)+" ose më shumë karaktere"},loadingMore:function(){return"Duke ngarkuar më shumë rezultate…"},maximumSelected:function(e){var n="Mund të zgjedhësh vetëm "+e.maximum+" element";return 1!=e.maximum&&(n+="e"),n},noResults:function(){return"Nuk u gjet asnjë rezultat"},searching:function(){return"Duke kërkuar…"},removeAllItems:function(){return"Hiq të gjitha sendet"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/sr-Cyrl.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr-Cyrl",[],function(){function n(n,e,r,u){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:u}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(e){var r=e.input.length-e.maximum,u="Обришите "+r+" симбол";return u+=n(r,"","а","а")},inputTooShort:function(e){var r=e.minimum-e.input.length,u="Укуцајте бар још "+r+" симбол";return u+=n(r,"","а","а")},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(e){var r="Можете изабрати само "+e.maximum+" ставк";return r+=n(e.maximum,"у","е","и")},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/sr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sr",[],function(){function n(n,e,r,t){return n%10==1&&n%100!=11?e:n%10>=2&&n%10<=4&&(n%100<12||n%100>14)?r:t}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(e){var r=e.input.length-e.maximum,t="Obrišite "+r+" simbol";return t+=n(r,"","a","a")},inputTooShort:function(e){var r=e.minimum-e.input.length,t="Ukucajte bar još "+r+" simbol";return t+=n(r,"","a","a")},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(e){var r="Možete izabrati samo "+e.maximum+" stavk";return r+=n(e.maximum,"u","e","i")},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"},removeAllItems:function(){return"Уклоните све ставке"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/sv.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(n){return"Vänligen sudda ut "+(n.input.length-n.maximum)+" tecken"},inputTooShort:function(n){return"Vänligen skriv in "+(n.minimum-n.input.length)+" eller fler tecken"},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(n){return"Du kan max välja "+n.maximum+" element"},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"},removeAllItems:function(){return"Ta bort alla objekt"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/te.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/te",[],function(){return{errorLoading:function(){return"ఫలితాలు చూపించలేకపోతున్నాము"},inputTooLong:function(n){var e=n.input.length-n.maximum,r=e;return r+=1!=e?" అక్షరాలు తొలిగించండి":" అక్షరం తొలిగించండి"},inputTooShort:function(n){return n.minimum-n.input.length+" లేక మరిన్ని అక్షరాలను జోడించండి"},loadingMore:function(){return"మరిన్ని ఫలితాలు…"},maximumSelected:function(n){var e="మీరు "+n.maximum;return 1!=n.maximum?e+=" అంశాల్ని మాత్రమే ఎంచుకోగలరు":e+=" అంశాన్ని మాత్రమే ఎంచుకోగలరు",e},noResults:function(){return"ఫలితాలు లేవు"},searching:function(){return"శోధిస్తున్నాము…"},removeAllItems:function(){return"అన్ని అంశాల్ని తొలిగించండి"},removeItem:function(){return"తొలిగించు"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/th.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/th",[],function(){return{errorLoading:function(){return"ไม่สามารถค้นข้อมูลได้"},inputTooLong:function(n){return"โปรดลบออก "+(n.input.length-n.maximum)+" ตัวอักษร"},inputTooShort:function(n){return"โปรดพิมพ์เพิ่มอีก "+(n.minimum-n.input.length)+" ตัวอักษร"},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(n){return"คุณสามารถเลือกได้ไม่เกิน "+n.maximum+" รายการ"},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"},removeAllItems:function(){return"ลบรายการทั้งหมด"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/tk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){return e.input.length-e.maximum+" harp bozuň."},inputTooShort:function(e){return"Ýene-de iň az "+(e.minimum-e.input.length)+" harp ýazyň."},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){return"Diňe "+e.maximum+" sanysyny saýlaň."},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}();
includes/vendor/select2/js/i18n/tr.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/tr",[],function(){return{errorLoading:function(){return"Sonuç yüklenemedi"},inputTooLong:function(n){return n.input.length-n.maximum+" karakter daha girmelisiniz"},inputTooShort:function(n){return"En az "+(n.minimum-n.input.length)+" karakter daha girmelisiniz"},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(n){return"Sadece "+n.maximum+" seçim yapabilirsiniz"},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"},removeAllItems:function(){return"Tüm öğeleri kaldır"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/uk.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/uk",[],function(){function n(n,e,u,r){return n%100>10&&n%100<15?r:n%10==1?e:n%10>1&&n%10<5?u:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(e){return"Будь ласка, видаліть "+(e.input.length-e.maximum)+" "+n(e.maximum,"літеру","літери","літер")},inputTooShort:function(n){return"Будь ласка, введіть "+(n.minimum-n.input.length)+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(e){return"Ви можете вибрати лише "+e.maximum+" "+n(e.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"},removeAllItems:function(){return"Видалити всі елементи"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/vi.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/vi",[],function(){return{inputTooLong:function(n){return"Vui lòng xóa bớt "+(n.input.length-n.maximum)+" ký tự"},inputTooShort:function(n){return"Vui lòng nhập thêm từ "+(n.minimum-n.input.length)+" ký tự trở lên"},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(n){return"Chỉ có thể chọn được "+n.maximum+" lựa chọn"},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"},removeAllItems:function(){return"Xóa tất cả các mục"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/zh-CN.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(n){return"请删除"+(n.input.length-n.maximum)+"个字符"},inputTooShort:function(n){return"请再输入至少"+(n.minimum-n.input.length)+"个字符"},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(n){return"最多只能选择"+n.maximum+"个项目"},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"},removeAllItems:function(){return"删除所有项目"}}}),n.define,n.require}();
includes/vendor/select2/js/i18n/zh-TW.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
2
+
3
+ !function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var n=jQuery.fn.select2.amd;n.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(n){return"請刪掉"+(n.input.length-n.maximum)+"個字元"},inputTooShort:function(n){return"請再輸入"+(n.minimum-n.input.length)+"個字元"},loadingMore:function(){return"載入中…"},maximumSelected:function(n){return"你只能選擇最多"+n.maximum+"項"},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"},removeAllItems:function(){return"刪除所有項目"}}}),n.define,n.require}();
includes/vendor/select2/js/select2.full.js ADDED
@@ -0,0 +1,6521 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Select2 4.1.0-rc.0
3
+ * https://select2.github.io
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/select2/select2/blob/master/LICENSE.md
7
+ */
8
+ ;(function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if (typeof module === 'object' && module.exports) {
13
+ // Node/CommonJS
14
+ module.exports = function (root, jQuery) {
15
+ if (jQuery === undefined) {
16
+ // require('jQuery') returns a factory that requires window to
17
+ // build a jQuery instance, we normalize how we use modules
18
+ // that require this pattern but the window provided is a noop
19
+ // if it's defined (how jquery works)
20
+ if (typeof window !== 'undefined') {
21
+ jQuery = require('jquery');
22
+ }
23
+ else {
24
+ jQuery = require('jquery')(root);
25
+ }
26
+ }
27
+ factory(jQuery);
28
+ return jQuery;
29
+ };
30
+ } else {
31
+ // Browser globals
32
+ factory(jQuery);
33
+ }
34
+ } (function (jQuery) {
35
+ // This is needed so we can catch the AMD loader configuration and use it
36
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
37
+ // returns the AMD loader references.
38
+ var S2 =(function () {
39
+ // Restore the Select2 AMD loader so it can be used
40
+ // Needed mostly in the language files, where the loader is not inserted
41
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
42
+ var S2 = jQuery.fn.select2.amd;
43
+ }
44
+ var S2;(function () { if (!S2 || !S2.requirejs) {
45
+ if (!S2) { S2 = {}; } else { require = S2; }
46
+ /**
47
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
48
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
49
+ */
50
+ //Going sloppy to avoid 'use strict' string cost, but strict practices should
51
+ //be followed.
52
+ /*global setTimeout: false */
53
+
54
+ var requirejs, require, define;
55
+ (function (undef) {
56
+ var main, req, makeMap, handlers,
57
+ defined = {},
58
+ waiting = {},
59
+ config = {},
60
+ defining = {},
61
+ hasOwn = Object.prototype.hasOwnProperty,
62
+ aps = [].slice,
63
+ jsSuffixRegExp = /\.js$/;
64
+
65
+ function hasProp(obj, prop) {
66
+ return hasOwn.call(obj, prop);
67
+ }
68
+
69
+ /**
70
+ * Given a relative module name, like ./something, normalize it to
71
+ * a real name that can be mapped to a path.
72
+ * @param {String} name the relative name
73
+ * @param {String} baseName a real name that the name arg is relative
74
+ * to.
75
+ * @returns {String} normalized name
76
+ */
77
+ function normalize(name, baseName) {
78
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
79
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
80
+ baseParts = baseName && baseName.split("/"),
81
+ map = config.map,
82
+ starMap = (map && map['*']) || {};
83
+
84
+ //Adjust any relative paths.
85
+ if (name) {
86
+ name = name.split('/');
87
+ lastIndex = name.length - 1;
88
+
89
+ // If wanting node ID compatibility, strip .js from end
90
+ // of IDs. Have to do this here, and not in nameToUrl
91
+ // because node allows either .js or non .js to map
92
+ // to same file.
93
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
94
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
95
+ }
96
+
97
+ // Starts with a '.' so need the baseName
98
+ if (name[0].charAt(0) === '.' && baseParts) {
99
+ //Convert baseName to array, and lop off the last part,
100
+ //so that . matches that 'directory' and not name of the baseName's
101
+ //module. For instance, baseName of 'one/two/three', maps to
102
+ //'one/two/three.js', but we want the directory, 'one/two' for
103
+ //this normalization.
104
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
105
+ name = normalizedBaseParts.concat(name);
106
+ }
107
+
108
+ //start trimDots
109
+ for (i = 0; i < name.length; i++) {
110
+ part = name[i];
111
+ if (part === '.') {
112
+ name.splice(i, 1);
113
+ i -= 1;
114
+ } else if (part === '..') {
115
+ // If at the start, or previous value is still ..,
116
+ // keep them so that when converted to a path it may
117
+ // still work when converted to a path, even though
118
+ // as an ID it is less than ideal. In larger point
119
+ // releases, may be better to just kick out an error.
120
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
121
+ continue;
122
+ } else if (i > 0) {
123
+ name.splice(i - 1, 2);
124
+ i -= 2;
125
+ }
126
+ }
127
+ }
128
+ //end trimDots
129
+
130
+ name = name.join('/');
131
+ }
132
+
133
+ //Apply map config if available.
134
+ if ((baseParts || starMap) && map) {
135
+ nameParts = name.split('/');
136
+
137
+ for (i = nameParts.length; i > 0; i -= 1) {
138
+ nameSegment = nameParts.slice(0, i).join("/");
139
+
140
+ if (baseParts) {
141
+ //Find the longest baseName segment match in the config.
142
+ //So, do joins on the biggest to smallest lengths of baseParts.
143
+ for (j = baseParts.length; j > 0; j -= 1) {
144
+ mapValue = map[baseParts.slice(0, j).join('/')];
145
+
146
+ //baseName segment has config, find if it has one for
147
+ //this name.
148
+ if (mapValue) {
149
+ mapValue = mapValue[nameSegment];
150
+ if (mapValue) {
151
+ //Match, update name to the new value.
152
+ foundMap = mapValue;
153
+ foundI = i;
154
+ break;
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ if (foundMap) {
161
+ break;
162
+ }
163
+
164
+ //Check for a star map match, but just hold on to it,
165
+ //if there is a shorter segment match later in a matching
166
+ //config, then favor over this star map.
167
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
168
+ foundStarMap = starMap[nameSegment];
169
+ starI = i;
170
+ }
171
+ }
172
+
173
+ if (!foundMap && foundStarMap) {
174
+ foundMap = foundStarMap;
175
+ foundI = starI;
176
+ }
177
+
178
+ if (foundMap) {
179
+ nameParts.splice(0, foundI, foundMap);
180
+ name = nameParts.join('/');
181
+ }
182
+ }
183
+
184
+ return name;
185
+ }
186
+
187
+ function makeRequire(relName, forceSync) {
188
+ return function () {
189
+ //A version of a require function that passes a moduleName
190
+ //value for items that may need to
191
+ //look up paths relative to the moduleName
192
+ var args = aps.call(arguments, 0);
193
+
194
+ //If first arg is not require('string'), and there is only
195
+ //one arg, it is the array form without a callback. Insert
196
+ //a null so that the following concat is correct.
197
+ if (typeof args[0] !== 'string' && args.length === 1) {
198
+ args.push(null);
199
+ }
200
+ return req.apply(undef, args.concat([relName, forceSync]));
201
+ };
202
+ }
203
+
204
+ function makeNormalize(relName) {
205
+ return function (name) {
206
+ return normalize(name, relName);
207
+ };
208
+ }
209
+
210
+ function makeLoad(depName) {
211
+ return function (value) {
212
+ defined[depName] = value;
213
+ };
214
+ }
215
+
216
+ function callDep(name) {
217
+ if (hasProp(waiting, name)) {
218
+ var args = waiting[name];
219
+ delete waiting[name];
220
+ defining[name] = true;
221
+ main.apply(undef, args);
222
+ }
223
+
224
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
225
+ throw new Error('No ' + name);
226
+ }
227
+ return defined[name];
228
+ }
229
+
230
+ //Turns a plugin!resource to [plugin, resource]
231
+ //with the plugin being undefined if the name
232
+ //did not have a plugin prefix.
233
+ function splitPrefix(name) {
234
+ var prefix,
235
+ index = name ? name.indexOf('!') : -1;
236
+ if (index > -1) {
237
+ prefix = name.substring(0, index);
238
+ name = name.substring(index + 1, name.length);
239
+ }
240
+ return [prefix, name];
241
+ }
242
+
243
+ //Creates a parts array for a relName where first part is plugin ID,
244
+ //second part is resource ID. Assumes relName has already been normalized.
245
+ function makeRelParts(relName) {
246
+ return relName ? splitPrefix(relName) : [];
247
+ }
248
+
249
+ /**
250
+ * Makes a name map, normalizing the name, and using a plugin
251
+ * for normalization if necessary. Grabs a ref to plugin
252
+ * too, as an optimization.
253
+ */
254
+ makeMap = function (name, relParts) {
255
+ var plugin,
256
+ parts = splitPrefix(name),
257
+ prefix = parts[0],
258
+ relResourceName = relParts[1];
259
+
260
+ name = parts[1];
261
+
262
+ if (prefix) {
263
+ prefix = normalize(prefix, relResourceName);
264
+ plugin = callDep(prefix);
265
+ }
266
+
267
+ //Normalize according
268
+ if (prefix) {
269
+ if (plugin && plugin.normalize) {
270
+ name = plugin.normalize(name, makeNormalize(relResourceName));
271
+ } else {
272
+ name = normalize(name, relResourceName);
273
+ }
274
+ } else {
275
+ name = normalize(name, relResourceName);
276
+ parts = splitPrefix(name);
277
+ prefix = parts[0];
278
+ name = parts[1];
279
+ if (prefix) {
280
+ plugin = callDep(prefix);
281
+ }
282
+ }
283
+
284
+ //Using ridiculous property names for space reasons
285
+ return {
286
+ f: prefix ? prefix + '!' + name : name, //fullName
287
+ n: name,
288
+ pr: prefix,
289
+ p: plugin
290
+ };
291
+ };
292
+
293
+ function makeConfig(name) {
294
+ return function () {
295
+ return (config && config.config && config.config[name]) || {};
296
+ };
297
+ }
298
+
299
+ handlers = {
300
+ require: function (name) {
301
+ return makeRequire(name);
302
+ },
303
+ exports: function (name) {
304
+ var e = defined[name];
305
+ if (typeof e !== 'undefined') {
306
+ return e;
307
+ } else {
308
+ return (defined[name] = {});
309
+ }
310
+ },
311
+ module: function (name) {
312
+ return {
313
+ id: name,
314
+ uri: '',
315
+ exports: defined[name],
316
+ config: makeConfig(name)
317
+ };
318
+ }
319
+ };
320
+
321
+ main = function (name, deps, callback, relName) {
322
+ var cjsModule, depName, ret, map, i, relParts,
323
+ args = [],
324
+ callbackType = typeof callback,
325
+ usingExports;
326
+
327
+ //Use name if no relName
328
+ relName = relName || name;
329
+ relParts = makeRelParts(relName);
330
+
331
+ //Call the callback to define the module, if necessary.
332
+ if (callbackType === 'undefined' || callbackType === 'function') {
333
+ //Pull out the defined dependencies and pass the ordered
334
+ //values to the callback.
335
+ //Default to [require, exports, module] if no deps
336
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
337
+ for (i = 0; i < deps.length; i += 1) {
338
+ map = makeMap(deps[i], relParts);
339
+ depName = map.f;
340
+
341
+ //Fast path CommonJS standard dependencies.
342
+ if (depName === "require") {
343
+ args[i] = handlers.require(name);
344
+ } else if (depName === "exports") {
345
+ //CommonJS module spec 1.1
346
+ args[i] = handlers.exports(name);
347
+ usingExports = true;
348
+ } else if (depName === "module") {
349
+ //CommonJS module spec 1.1
350
+ cjsModule = args[i] = handlers.module(name);
351
+ } else if (hasProp(defined, depName) ||
352
+ hasProp(waiting, depName) ||
353
+ hasProp(defining, depName)) {
354
+ args[i] = callDep(depName);
355
+ } else if (map.p) {
356
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
357
+ args[i] = defined[depName];
358
+ } else {
359
+ throw new Error(name + ' missing ' + depName);
360
+ }
361
+ }
362
+
363
+ ret = callback ? callback.apply(defined[name], args) : undefined;
364
+
365
+ if (name) {
366
+ //If setting exports via "module" is in play,
367
+ //favor that over return value and exports. After that,
368
+ //favor a non-undefined return value over exports use.
369
+ if (cjsModule && cjsModule.exports !== undef &&
370
+ cjsModule.exports !== defined[name]) {
371
+ defined[name] = cjsModule.exports;
372
+ } else if (ret !== undef || !usingExports) {
373
+ //Use the return value from the function.
374
+ defined[name] = ret;
375
+ }
376
+ }
377
+ } else if (name) {
378
+ //May just be an object definition for the module. Only
379
+ //worry about defining if have a module name.
380
+ defined[name] = callback;
381
+ }
382
+ };
383
+
384
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
385
+ if (typeof deps === "string") {
386
+ if (handlers[deps]) {
387
+ //callback in this case is really relName
388
+ return handlers[deps](callback);
389
+ }
390
+ //Just return the module wanted. In this scenario, the
391
+ //deps arg is the module name, and second arg (if passed)
392
+ //is just the relName.
393
+ //Normalize module name, if it contains . or ..
394
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
395
+ } else if (!deps.splice) {
396
+ //deps is a config object, not an array.
397
+ config = deps;
398
+ if (config.deps) {
399
+ req(config.deps, config.callback);
400
+ }
401
+ if (!callback) {
402
+ return;
403
+ }
404
+
405
+ if (callback.splice) {
406
+ //callback is an array, which means it is a dependency list.
407
+ //Adjust args if there are dependencies
408
+ deps = callback;
409
+ callback = relName;
410
+ relName = null;
411
+ } else {
412
+ deps = undef;
413
+ }
414
+ }
415
+
416
+ //Support require(['a'])
417
+ callback = callback || function () {};
418
+
419
+ //If relName is a function, it is an errback handler,
420
+ //so remove it.
421
+ if (typeof relName === 'function') {
422
+ relName = forceSync;
423
+ forceSync = alt;
424
+ }
425
+
426
+ //Simulate async callback;
427
+ if (forceSync) {
428
+ main(undef, deps, callback, relName);
429
+ } else {
430
+ //Using a non-zero value because of concern for what old browsers
431
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
432
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
433
+ //If want a value immediately, use require('id') instead -- something
434
+ //that works in almond on the global level, but not guaranteed and
435
+ //unlikely to work in other AMD implementations.
436
+ setTimeout(function () {
437
+ main(undef, deps, callback, relName);
438
+ }, 4);
439
+ }
440
+
441
+ return req;
442
+ };
443
+
444
+ /**
445
+ * Just drops the config on the floor, but returns req in case
446
+ * the config return value is used.
447
+ */
448
+ req.config = function (cfg) {
449
+ return req(cfg);
450
+ };
451
+
452
+ /**
453
+ * Expose module registry for debugging and tooling
454
+ */
455
+ requirejs._defined = defined;
456
+
457
+ define = function (name, deps, callback) {
458
+ if (typeof name !== 'string') {
459
+ throw new Error('See almond README: incorrect module build, no module name');
460
+ }
461
+
462
+ //This module may not have dependencies
463
+ if (!deps.splice) {
464
+ //deps is not an array, so probably means
465
+ //an object literal or factory function for
466
+ //the value. Adjust args.
467
+ callback = deps;
468
+ deps = [];
469
+ }
470
+
471
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
472
+ waiting[name] = [name, deps, callback];
473
+ }
474
+ };
475
+
476
+ define.amd = {
477
+ jQuery: true
478
+ };
479
+ }());
480
+
481
+ S2.requirejs = requirejs;S2.require = require;S2.define = define;
482
+ }
483
+ }());
484
+ S2.define("almond", function(){});
485
+
486
+ /* global jQuery:false, $:false */
487
+ S2.define('jquery',[],function () {
488
+ var _$ = jQuery || $;
489
+
490
+ if (_$ == null && console && console.error) {
491
+ console.error(
492
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
493
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
494
+ 'web page.'
495
+ );
496
+ }
497
+
498
+ return _$;
499
+ });
500
+
501
+ S2.define('select2/utils',[
502
+ 'jquery'
503
+ ], function ($) {
504
+ var Utils = {};
505
+
506
+ Utils.Extend = function (ChildClass, SuperClass) {
507
+ var __hasProp = {}.hasOwnProperty;
508
+
509
+ function BaseConstructor () {
510
+ this.constructor = ChildClass;
511
+ }
512
+
513
+ for (var key in SuperClass) {
514
+ if (__hasProp.call(SuperClass, key)) {
515
+ ChildClass[key] = SuperClass[key];
516
+ }
517
+ }
518
+
519
+ BaseConstructor.prototype = SuperClass.prototype;
520
+ ChildClass.prototype = new BaseConstructor();
521
+ ChildClass.__super__ = SuperClass.prototype;
522
+
523
+ return ChildClass;
524
+ };
525
+
526
+ function getMethods (theClass) {
527
+ var proto = theClass.prototype;
528
+
529
+ var methods = [];
530
+
531
+ for (var methodName in proto) {
532
+ var m = proto[methodName];
533
+
534
+ if (typeof m !== 'function') {
535
+ continue;
536
+ }
537
+
538
+ if (methodName === 'constructor') {
539
+ continue;
540
+ }
541
+
542
+ methods.push(methodName);
543
+ }
544
+
545
+ return methods;
546
+ }
547
+
548
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
549
+ var decoratedMethods = getMethods(DecoratorClass);
550
+ var superMethods = getMethods(SuperClass);
551
+
552
+ function DecoratedClass () {
553
+ var unshift = Array.prototype.unshift;
554
+
555
+ var argCount = DecoratorClass.prototype.constructor.length;
556
+
557
+ var calledConstructor = SuperClass.prototype.constructor;
558
+
559
+ if (argCount > 0) {
560
+ unshift.call(arguments, SuperClass.prototype.constructor);
561
+
562
+ calledConstructor = DecoratorClass.prototype.constructor;
563
+ }
564
+
565
+ calledConstructor.apply(this, arguments);
566
+ }
567
+
568
+ DecoratorClass.displayName = SuperClass.displayName;
569
+
570
+ function ctr () {
571
+ this.constructor = DecoratedClass;
572
+ }
573
+
574
+ DecoratedClass.prototype = new ctr();
575
+
576
+ for (var m = 0; m < superMethods.length; m++) {
577
+ var superMethod = superMethods[m];
578
+
579
+ DecoratedClass.prototype[superMethod] =
580
+ SuperClass.prototype[superMethod];
581
+ }
582
+
583
+ var calledMethod = function (methodName) {
584
+ // Stub out the original method if it's not decorating an actual method
585
+ var originalMethod = function () {};
586
+
587
+ if (methodName in DecoratedClass.prototype) {
588
+ originalMethod = DecoratedClass.prototype[methodName];
589
+ }
590
+
591
+ var decoratedMethod = DecoratorClass.prototype[methodName];
592
+
593
+ return function () {
594
+ var unshift = Array.prototype.unshift;
595
+
596
+ unshift.call(arguments, originalMethod);
597
+
598
+ return decoratedMethod.apply(this, arguments);
599
+ };
600
+ };
601
+
602
+ for (var d = 0; d < decoratedMethods.length; d++) {
603
+ var decoratedMethod = decoratedMethods[d];
604
+
605
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
606
+ }
607
+
608
+ return DecoratedClass;
609
+ };
610
+
611
+ var Observable = function () {
612
+ this.listeners = {};
613
+ };
614
+
615
+ Observable.prototype.on = function (event, callback) {
616
+ this.listeners = this.listeners || {};
617
+
618
+ if (event in this.listeners) {
619
+ this.listeners[event].push(callback);
620
+ } else {
621
+ this.listeners[event] = [callback];
622
+ }
623
+ };
624
+
625
+ Observable.prototype.trigger = function (event) {
626
+ var slice = Array.prototype.slice;
627
+ var params = slice.call(arguments, 1);
628
+
629
+ this.listeners = this.listeners || {};
630
+
631
+ // Params should always come in as an array
632
+ if (params == null) {
633
+ params = [];
634
+ }
635
+
636
+ // If there are no arguments to the event, use a temporary object
637
+ if (params.length === 0) {
638
+ params.push({});
639
+ }
640
+
641
+ // Set the `_type` of the first object to the event
642
+ params[0]._type = event;
643
+
644
+ if (event in this.listeners) {
645
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
646
+ }
647
+
648
+ if ('*' in this.listeners) {
649
+ this.invoke(this.listeners['*'], arguments);
650
+ }
651
+ };
652
+
653
+ Observable.prototype.invoke = function (listeners, params) {
654
+ for (var i = 0, len = listeners.length; i < len; i++) {
655
+ listeners[i].apply(this, params);
656
+ }
657
+ };
658
+
659
+ Utils.Observable = Observable;
660
+
661
+ Utils.generateChars = function (length) {
662
+ var chars = '';
663
+
664
+ for (var i = 0; i < length; i++) {
665
+ var randomChar = Math.floor(Math.random() * 36);
666
+ chars += randomChar.toString(36);
667
+ }
668
+
669
+ return chars;
670
+ };
671
+
672
+ Utils.bind = function (func, context) {
673
+ return function () {
674
+ func.apply(context, arguments);
675
+ };
676
+ };
677
+
678
+ Utils._convertData = function (data) {
679
+ for (var originalKey in data) {
680
+ var keys = originalKey.split('-');
681
+
682
+ var dataLevel = data;
683
+
684
+ if (keys.length === 1) {
685
+ continue;
686
+ }
687
+
688
+ for (var k = 0; k < keys.length; k++) {
689
+ var key = keys[k];
690
+
691
+ // Lowercase the first letter
692
+ // By default, dash-separated becomes camelCase
693
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
694
+
695
+ if (!(key in dataLevel)) {
696
+ dataLevel[key] = {};
697
+ }
698
+
699
+ if (k == keys.length - 1) {
700
+ dataLevel[key] = data[originalKey];
701
+ }
702
+
703
+ dataLevel = dataLevel[key];
704
+ }
705
+
706
+ delete data[originalKey];
707
+ }
708
+
709
+ return data;
710
+ };
711
+
712
+ Utils.hasScroll = function (index, el) {
713
+ // Adapted from the function created by @ShadowScripter
714
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
715
+ // The original code can be found at
716
+ // http://codereview.stackexchange.com/q/13338
717
+ // and was designed to be used with the Sizzle selector engine.
718
+
719
+ var $el = $(el);
720
+ var overflowX = el.style.overflowX;
721
+ var overflowY = el.style.overflowY;
722
+
723
+ //Check both x and y declarations
724
+ if (overflowX === overflowY &&
725
+ (overflowY === 'hidden' || overflowY === 'visible')) {
726
+ return false;
727
+ }
728
+
729
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
730
+ return true;
731
+ }
732
+
733
+ return ($el.innerHeight() < el.scrollHeight ||
734
+ $el.innerWidth() < el.scrollWidth);
735
+ };
736
+
737
+ Utils.escapeMarkup = function (markup) {
738
+ var replaceMap = {
739
+ '\\': '&#92;',
740
+ '&': '&amp;',
741
+ '<': '&lt;',
742
+ '>': '&gt;',
743
+ '"': '&quot;',
744
+ '\'': '&#39;',
745
+ '/': '&#47;'
746
+ };
747
+
748
+ // Do not try to escape the markup if it's not a string
749
+ if (typeof markup !== 'string') {
750
+ return markup;
751
+ }
752
+
753
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
754
+ return replaceMap[match];
755
+ });
756
+ };
757
+
758
+ // Cache objects in Utils.__cache instead of $.data (see #4346)
759
+ Utils.__cache = {};
760
+
761
+ var id = 0;
762
+ Utils.GetUniqueElementId = function (element) {
763
+ // Get a unique element Id. If element has no id,
764
+ // creates a new unique number, stores it in the id
765
+ // attribute and returns the new id with a prefix.
766
+ // If an id already exists, it simply returns it with a prefix.
767
+
768
+ var select2Id = element.getAttribute('data-select2-id');
769
+
770
+ if (select2Id != null) {
771
+ return select2Id;
772
+ }
773
+
774
+ // If element has id, use it.
775
+ if (element.id) {
776
+ select2Id = 'select2-data-' + element.id;
777
+ } else {
778
+ select2Id = 'select2-data-' + (++id).toString() +
779
+ '-' + Utils.generateChars(4);
780
+ }
781
+
782
+ element.setAttribute('data-select2-id', select2Id);
783
+
784
+ return select2Id;
785
+ };
786
+
787
+ Utils.StoreData = function (element, name, value) {
788
+ // Stores an item in the cache for a specified element.
789
+ // name is the cache key.
790
+ var id = Utils.GetUniqueElementId(element);
791
+ if (!Utils.__cache[id]) {
792
+ Utils.__cache[id] = {};
793
+ }
794
+
795
+ Utils.__cache[id][name] = value;
796
+ };
797
+
798
+ Utils.GetData = function (element, name) {
799
+ // Retrieves a value from the cache by its key (name)
800
+ // name is optional. If no name specified, return
801
+ // all cache items for the specified element.
802
+ // and for a specified element.
803
+ var id = Utils.GetUniqueElementId(element);
804
+ if (name) {
805
+ if (Utils.__cache[id]) {
806
+ if (Utils.__cache[id][name] != null) {
807
+ return Utils.__cache[id][name];
808
+ }
809
+ return $(element).data(name); // Fallback to HTML5 data attribs.
810
+ }
811
+ return $(element).data(name); // Fallback to HTML5 data attribs.
812
+ } else {
813
+ return Utils.__cache[id];
814
+ }
815
+ };
816
+
817
+ Utils.RemoveData = function (element) {
818
+ // Removes all cached items for a specified element.
819
+ var id = Utils.GetUniqueElementId(element);
820
+ if (Utils.__cache[id] != null) {
821
+ delete Utils.__cache[id];
822
+ }
823
+
824
+ element.removeAttribute('data-select2-id');
825
+ };
826
+
827
+ Utils.copyNonInternalCssClasses = function (dest, src) {
828
+ var classes;
829
+
830
+ var destinationClasses = dest.getAttribute('class').trim().split(/\s+/);
831
+
832
+ destinationClasses = destinationClasses.filter(function (clazz) {
833
+ // Save all Select2 classes
834
+ return clazz.indexOf('select2-') === 0;
835
+ });
836
+
837
+ var sourceClasses = src.getAttribute('class').trim().split(/\s+/);
838
+
839
+ sourceClasses = sourceClasses.filter(function (clazz) {
840
+ // Only copy non-Select2 classes
841
+ return clazz.indexOf('select2-') !== 0;
842
+ });
843
+
844
+ var replacements = destinationClasses.concat(sourceClasses);
845
+
846
+ dest.setAttribute('class', replacements.join(' '));
847
+ };
848
+
849
+ return Utils;
850
+ });
851
+
852
+ S2.define('select2/results',[
853
+ 'jquery',
854
+ './utils'
855
+ ], function ($, Utils) {
856
+ function Results ($element, options, dataAdapter) {
857
+ this.$element = $element;
858
+ this.data = dataAdapter;
859
+ this.options = options;
860
+
861
+ Results.__super__.constructor.call(this);
862
+ }
863
+
864
+ Utils.Extend(Results, Utils.Observable);
865
+
866
+ Results.prototype.render = function () {
867
+ var $results = $(
868
+ '<ul class="select2-results__options" role="listbox"></ul>'
869
+ );
870
+
871
+ if (this.options.get('multiple')) {
872
+ $results.attr('aria-multiselectable', 'true');
873
+ }
874
+
875
+ this.$results = $results;
876
+
877
+ return $results;
878
+ };
879
+
880
+ Results.prototype.clear = function () {
881
+ this.$results.empty();
882
+ };
883
+
884
+ Results.prototype.displayMessage = function (params) {
885
+ var escapeMarkup = this.options.get('escapeMarkup');
886
+
887
+ this.clear();
888
+ this.hideLoading();
889
+
890
+ var $message = $(
891
+ '<li role="alert" aria-live="assertive"' +
892
+ ' class="select2-results__option"></li>'
893
+ );
894
+
895
+ var message = this.options.get('translations').get(params.message);
896
+
897
+ $message.append(
898
+ escapeMarkup(
899
+ message(params.args)
900
+ )
901
+ );
902
+
903
+ $message[0].className += ' select2-results__message';
904
+
905
+ this.$results.append($message);
906
+ };
907
+
908
+ Results.prototype.hideMessages = function () {
909
+ this.$results.find('.select2-results__message').remove();
910
+ };
911
+
912
+ Results.prototype.append = function (data) {
913
+ this.hideLoading();
914
+
915
+ var $options = [];
916
+
917
+ if (data.results == null || data.results.length === 0) {
918
+ if (this.$results.children().length === 0) {
919
+ this.trigger('results:message', {
920
+ message: 'noResults'
921
+ });
922
+ }
923
+
924
+ return;
925
+ }
926
+
927
+ data.results = this.sort(data.results);
928
+
929
+ for (var d = 0; d < data.results.length; d++) {
930
+ var item = data.results[d];
931
+
932
+ var $option = this.option(item);
933
+
934
+ $options.push($option);
935
+ }
936
+
937
+ this.$results.append($options);
938
+ };
939
+
940
+ Results.prototype.position = function ($results, $dropdown) {
941
+ var $resultsContainer = $dropdown.find('.select2-results');
942
+ $resultsContainer.append($results);
943
+ };
944
+
945
+ Results.prototype.sort = function (data) {
946
+ var sorter = this.options.get('sorter');
947
+
948
+ return sorter(data);
949
+ };
950
+
951
+ Results.prototype.highlightFirstItem = function () {
952
+ var $options = this.$results
953
+ .find('.select2-results__option--selectable');
954
+
955
+ var $selected = $options.filter('.select2-results__option--selected');
956
+
957
+ // Check if there are any selected options
958
+ if ($selected.length > 0) {
959
+ // If there are selected options, highlight the first
960
+ $selected.first().trigger('mouseenter');
961
+ } else {
962
+ // If there are no selected options, highlight the first option
963
+ // in the dropdown
964
+ $options.first().trigger('mouseenter');
965
+ }
966
+
967
+ this.ensureHighlightVisible();
968
+ };
969
+
970
+ Results.prototype.setClasses = function () {
971
+ var self = this;
972
+
973
+ this.data.current(function (selected) {
974
+ var selectedIds = selected.map(function (s) {
975
+ return s.id.toString();
976
+ });
977
+
978
+ var $options = self.$results
979
+ .find('.select2-results__option--selectable');
980
+
981
+ $options.each(function () {
982
+ var $option = $(this);
983
+
984
+ var item = Utils.GetData(this, 'data');
985
+
986
+ // id needs to be converted to a string when comparing
987
+ var id = '' + item.id;
988
+
989
+ if ((item.element != null && item.element.selected) ||
990
+ (item.element == null && selectedIds.indexOf(id) > -1)) {
991
+ this.classList.add('select2-results__option--selected');
992
+ $option.attr('aria-selected', 'true');
993
+ } else {
994
+ this.classList.remove('select2-results__option--selected');
995
+ $option.attr('aria-selected', 'false');
996
+ }
997
+ });
998
+
999
+ });
1000
+ };
1001
+
1002
+ Results.prototype.showLoading = function (params) {
1003
+ this.hideLoading();
1004
+
1005
+ var loadingMore = this.options.get('translations').get('searching');
1006
+
1007
+ var loading = {
1008
+ disabled: true,
1009
+ loading: true,
1010
+ text: loadingMore(params)
1011
+ };
1012
+ var $loading = this.option(loading);
1013
+ $loading.className += ' loading-results';
1014
+
1015
+ this.$results.prepend($loading);
1016
+ };
1017
+
1018
+ Results.prototype.hideLoading = function () {
1019
+ this.$results.find('.loading-results').remove();
1020
+ };
1021
+
1022
+ Results.prototype.option = function (data) {
1023
+ var option = document.createElement('li');
1024
+ option.classList.add('select2-results__option');
1025
+ option.classList.add('select2-results__option--selectable');
1026
+
1027
+ var attrs = {
1028
+ 'role': 'option'
1029
+ };
1030
+
1031
+ var matches = window.Element.prototype.matches ||
1032
+ window.Element.prototype.msMatchesSelector ||
1033
+ window.Element.prototype.webkitMatchesSelector;
1034
+
1035
+ if ((data.element != null && matches.call(data.element, ':disabled')) ||
1036
+ (data.element == null && data.disabled)) {
1037
+ attrs['aria-disabled'] = 'true';
1038
+
1039
+ option.classList.remove('select2-results__option--selectable');
1040
+ option.classList.add('select2-results__option--disabled');
1041
+ }
1042
+
1043
+ if (data.id == null) {
1044
+ option.classList.remove('select2-results__option--selectable');
1045
+ }
1046
+
1047
+ if (data._resultId != null) {
1048
+ option.id = data._resultId;
1049
+ }
1050
+
1051
+ if (data.title) {
1052
+ option.title = data.title;
1053
+ }
1054
+
1055
+ if (data.children) {
1056
+ attrs.role = 'group';
1057
+ attrs['aria-label'] = data.text;
1058
+
1059
+ option.classList.remove('select2-results__option--selectable');
1060
+ option.classList.add('select2-results__option--group');
1061
+ }
1062
+
1063
+ for (var attr in attrs) {
1064
+ var val = attrs[attr];
1065
+
1066
+ option.setAttribute(attr, val);
1067
+ }
1068
+
1069
+ if (data.children) {
1070
+ var $option = $(option);
1071
+
1072
+ var label = document.createElement('strong');
1073
+ label.className = 'select2-results__group';
1074
+
1075
+ this.template(data, label);
1076
+
1077
+ var $children = [];
1078
+
1079
+ for (var c = 0; c < data.children.length; c++) {
1080
+ var child = data.children[c];
1081
+
1082
+ var $child = this.option(child);
1083
+
1084
+ $children.push($child);
1085
+ }
1086
+
1087
+ var $childrenContainer = $('<ul></ul>', {
1088
+ 'class': 'select2-results__options select2-results__options--nested',
1089
+ 'role': 'none'
1090
+ });
1091
+
1092
+ $childrenContainer.append($children);
1093
+
1094
+ $option.append(label);
1095
+ $option.append($childrenContainer);
1096
+ } else {
1097
+ this.template(data, option);
1098
+ }
1099
+
1100
+ Utils.StoreData(option, 'data', data);
1101
+
1102
+ return option;
1103
+ };
1104
+
1105
+ Results.prototype.bind = function (container, $container) {
1106
+ var self = this;
1107
+
1108
+ var id = container.id + '-results';
1109
+
1110
+ this.$results.attr('id', id);
1111
+
1112
+ container.on('results:all', function (params) {
1113
+ self.clear();
1114
+ self.append(params.data);
1115
+
1116
+ if (container.isOpen()) {
1117
+ self.setClasses();
1118
+ self.highlightFirstItem();
1119
+ }
1120
+ });
1121
+
1122
+ container.on('results:append', function (params) {
1123
+ self.append(params.data);
1124
+
1125
+ if (container.isOpen()) {
1126
+ self.setClasses();
1127
+ }
1128
+ });
1129
+
1130
+ container.on('query', function (params) {
1131
+ self.hideMessages();
1132
+ self.showLoading(params);
1133
+ });
1134
+
1135
+ container.on('select', function () {
1136
+ if (!container.isOpen()) {
1137
+ return;
1138
+ }
1139
+
1140
+ self.setClasses();
1141
+
1142
+ if (self.options.get('scrollAfterSelect')) {
1143
+ self.highlightFirstItem();
1144
+ }
1145
+ });
1146
+
1147
+ container.on('unselect', function () {
1148
+ if (!container.isOpen()) {
1149
+ return;
1150
+ }
1151
+
1152
+ self.setClasses();
1153
+
1154
+ if (self.options.get('scrollAfterSelect')) {
1155
+ self.highlightFirstItem();
1156
+ }
1157
+ });
1158
+
1159
+ container.on('open', function () {
1160
+ // When the dropdown is open, aria-expended="true"
1161
+ self.$results.attr('aria-expanded', 'true');
1162
+ self.$results.attr('aria-hidden', 'false');
1163
+
1164
+ self.setClasses();
1165
+ self.ensureHighlightVisible();
1166
+ });
1167
+
1168
+ container.on('close', function () {
1169
+ // When the dropdown is closed, aria-expended="false"
1170
+ self.$results.attr('aria-expanded', 'false');
1171
+ self.$results.attr('aria-hidden', 'true');
1172
+ self.$results.removeAttr('aria-activedescendant');
1173
+ });
1174
+
1175
+ container.on('results:toggle', function () {
1176
+ var $highlighted = self.getHighlightedResults();
1177
+
1178
+ if ($highlighted.length === 0) {
1179
+ return;
1180
+ }
1181
+
1182
+ $highlighted.trigger('mouseup');
1183
+ });
1184
+
1185
+ container.on('results:select', function () {
1186
+ var $highlighted = self.getHighlightedResults();
1187
+
1188
+ if ($highlighted.length === 0) {
1189
+ return;
1190
+ }
1191
+
1192
+ var data = Utils.GetData($highlighted[0], 'data');
1193
+
1194
+ if ($highlighted.hasClass('select2-results__option--selected')) {
1195
+ self.trigger('close', {});
1196
+ } else {
1197
+ self.trigger('select', {
1198
+ data: data
1199
+ });
1200
+ }
1201
+ });
1202
+
1203
+ container.on('results:previous', function () {
1204
+ var $highlighted = self.getHighlightedResults();
1205
+
1206
+ var $options = self.$results.find('.select2-results__option--selectable');
1207
+
1208
+ var currentIndex = $options.index($highlighted);
1209
+
1210
+ // If we are already at the top, don't move further
1211
+ // If no options, currentIndex will be -1
1212
+ if (currentIndex <= 0) {
1213
+ return;
1214
+ }
1215
+
1216
+ var nextIndex = currentIndex - 1;
1217
+
1218
+ // If none are highlighted, highlight the first
1219
+ if ($highlighted.length === 0) {
1220
+ nextIndex = 0;
1221
+ }
1222
+
1223
+ var $next = $options.eq(nextIndex);
1224
+
1225
+ $next.trigger('mouseenter');
1226
+
1227
+ var currentOffset = self.$results.offset().top;
1228
+ var nextTop = $next.offset().top;
1229
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1230
+
1231
+ if (nextIndex === 0) {
1232
+ self.$results.scrollTop(0);
1233
+ } else if (nextTop - currentOffset < 0) {
1234
+ self.$results.scrollTop(nextOffset);
1235
+ }
1236
+ });
1237
+
1238
+ container.on('results:next', function () {
1239
+ var $highlighted = self.getHighlightedResults();
1240
+
1241
+ var $options = self.$results.find('.select2-results__option--selectable');
1242
+
1243
+ var currentIndex = $options.index($highlighted);
1244
+
1245
+ var nextIndex = currentIndex + 1;
1246
+
1247
+ // If we are at the last option, stay there
1248
+ if (nextIndex >= $options.length) {
1249
+ return;
1250
+ }
1251
+
1252
+ var $next = $options.eq(nextIndex);
1253
+
1254
+ $next.trigger('mouseenter');
1255
+
1256
+ var currentOffset = self.$results.offset().top +
1257
+ self.$results.outerHeight(false);
1258
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1259
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1260
+
1261
+ if (nextIndex === 0) {
1262
+ self.$results.scrollTop(0);
1263
+ } else if (nextBottom > currentOffset) {
1264
+ self.$results.scrollTop(nextOffset);
1265
+ }
1266
+ });
1267
+
1268
+ container.on('results:focus', function (params) {
1269
+ params.element[0].classList.add('select2-results__option--highlighted');
1270
+ params.element[0].setAttribute('aria-selected', 'true');
1271
+ });
1272
+
1273
+ container.on('results:message', function (params) {
1274
+ self.displayMessage(params);
1275
+ });
1276
+
1277
+ if ($.fn.mousewheel) {
1278
+ this.$results.on('mousewheel', function (e) {
1279
+ var top = self.$results.scrollTop();
1280
+
1281
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1282
+
1283
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1284
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1285
+
1286
+ if (isAtTop) {
1287
+ self.$results.scrollTop(0);
1288
+
1289
+ e.preventDefault();
1290
+ e.stopPropagation();
1291
+ } else if (isAtBottom) {
1292
+ self.$results.scrollTop(
1293
+ self.$results.get(0).scrollHeight - self.$results.height()
1294
+ );
1295
+
1296
+ e.preventDefault();
1297
+ e.stopPropagation();
1298
+ }
1299
+ });
1300
+ }
1301
+
1302
+ this.$results.on('mouseup', '.select2-results__option--selectable',
1303
+ function (evt) {
1304
+ var $this = $(this);
1305
+
1306
+ var data = Utils.GetData(this, 'data');
1307
+
1308
+ if ($this.hasClass('select2-results__option--selected')) {
1309
+ if (self.options.get('multiple')) {
1310
+ self.trigger('unselect', {
1311
+ originalEvent: evt,
1312
+ data: data
1313
+ });
1314
+ } else {
1315
+ self.trigger('close', {});
1316
+ }
1317
+
1318
+ return;
1319
+ }
1320
+
1321
+ self.trigger('select', {
1322
+ originalEvent: evt,
1323
+ data: data
1324
+ });
1325
+ });
1326
+
1327
+ this.$results.on('mouseenter', '.select2-results__option--selectable',
1328
+ function (evt) {
1329
+ var data = Utils.GetData(this, 'data');
1330
+
1331
+ self.getHighlightedResults()
1332
+ .removeClass('select2-results__option--highlighted')
1333
+ .attr('aria-selected', 'false');
1334
+
1335
+ self.trigger('results:focus', {
1336
+ data: data,
1337
+ element: $(this)
1338
+ });
1339
+ });
1340
+ };
1341
+
1342
+ Results.prototype.getHighlightedResults = function () {
1343
+ var $highlighted = this.$results
1344
+ .find('.select2-results__option--highlighted');
1345
+
1346
+ return $highlighted;
1347
+ };
1348
+
1349
+ Results.prototype.destroy = function () {
1350
+ this.$results.remove();
1351
+ };
1352
+
1353
+ Results.prototype.ensureHighlightVisible = function () {
1354
+ var $highlighted = this.getHighlightedResults();
1355
+
1356
+ if ($highlighted.length === 0) {
1357
+ return;
1358
+ }
1359
+
1360
+ var $options = this.$results.find('.select2-results__option--selectable');
1361
+
1362
+ var currentIndex = $options.index($highlighted);
1363
+
1364
+ var currentOffset = this.$results.offset().top;
1365
+ var nextTop = $highlighted.offset().top;
1366
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1367
+
1368
+ var offsetDelta = nextTop - currentOffset;
1369
+ nextOffset -= $highlighted.outerHeight(false) * 2;
1370
+
1371
+ if (currentIndex <= 2) {
1372
+ this.$results.scrollTop(0);
1373
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1374
+ this.$results.scrollTop(nextOffset);
1375
+ }
1376
+ };
1377
+
1378
+ Results.prototype.template = function (result, container) {
1379
+ var template = this.options.get('templateResult');
1380
+ var escapeMarkup = this.options.get('escapeMarkup');
1381
+
1382
+ var content = template(result, container);
1383
+
1384
+ if (content == null) {
1385
+ container.style.display = 'none';
1386
+ } else if (typeof content === 'string') {
1387
+ container.innerHTML = escapeMarkup(content);
1388
+ } else {
1389
+ $(container).append(content);
1390
+ }
1391
+ };
1392
+
1393
+ return Results;
1394
+ });
1395
+
1396
+ S2.define('select2/keys',[
1397
+
1398
+ ], function () {
1399
+ var KEYS = {
1400
+ BACKSPACE: 8,
1401
+ TAB: 9,
1402
+ ENTER: 13,
1403
+ SHIFT: 16,
1404
+ CTRL: 17,
1405
+ ALT: 18,
1406
+ ESC: 27,
1407
+ SPACE: 32,
1408
+ PAGE_UP: 33,
1409
+ PAGE_DOWN: 34,
1410
+ END: 35,
1411
+ HOME: 36,
1412
+ LEFT: 37,
1413
+ UP: 38,
1414
+ RIGHT: 39,
1415
+ DOWN: 40,
1416
+ DELETE: 46
1417
+ };
1418
+
1419
+ return KEYS;
1420
+ });
1421
+
1422
+ S2.define('select2/selection/base',[
1423
+ 'jquery',
1424
+ '../utils',
1425
+ '../keys'
1426
+ ], function ($, Utils, KEYS) {
1427
+ function BaseSelection ($element, options) {
1428
+ this.$element = $element;
1429
+ this.options = options;
1430
+
1431
+ BaseSelection.__super__.constructor.call(this);
1432
+ }
1433
+
1434
+ Utils.Extend(BaseSelection, Utils.Observable);
1435
+
1436
+ BaseSelection.prototype.render = function () {
1437
+ var $selection = $(
1438
+ '<span class="select2-selection" role="combobox" ' +
1439
+ ' aria-haspopup="true" aria-expanded="false">' +
1440
+ '</span>'
1441
+ );
1442
+
1443
+ this._tabindex = 0;
1444
+
1445
+ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
1446
+ this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
1447
+ } else if (this.$element.attr('tabindex') != null) {
1448
+ this._tabindex = this.$element.attr('tabindex');
1449
+ }
1450
+
1451
+ $selection.attr('title', this.$element.attr('title'));
1452
+ $selection.attr('tabindex', this._tabindex);
1453
+ $selection.attr('aria-disabled', 'false');
1454
+
1455
+ this.$selection = $selection;
1456
+
1457
+ return $selection;
1458
+ };
1459
+
1460
+ BaseSelection.prototype.bind = function (container, $container) {
1461
+ var self = this;
1462
+
1463
+ var resultsId = container.id + '-results';
1464
+
1465
+ this.container = container;
1466
+
1467
+ this.$selection.on('focus', function (evt) {
1468
+ self.trigger('focus', evt);
1469
+ });
1470
+
1471
+ this.$selection.on('blur', function (evt) {
1472
+ self._handleBlur(evt);
1473
+ });
1474
+
1475
+ this.$selection.on('keydown', function (evt) {
1476
+ self.trigger('keypress', evt);
1477
+
1478
+ if (evt.which === KEYS.SPACE) {
1479
+ evt.preventDefault();
1480
+ }
1481
+ });
1482
+
1483
+ container.on('results:focus', function (params) {
1484
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1485
+ });
1486
+
1487
+ container.on('selection:update', function (params) {
1488
+ self.update(params.data);
1489
+ });
1490
+
1491
+ container.on('open', function () {
1492
+ // When the dropdown is open, aria-expanded="true"
1493
+ self.$selection.attr('aria-expanded', 'true');
1494
+ self.$selection.attr('aria-owns', resultsId);
1495
+
1496
+ self._attachCloseHandler(container);
1497
+ });
1498
+
1499
+ container.on('close', function () {
1500
+ // When the dropdown is closed, aria-expanded="false"
1501
+ self.$selection.attr('aria-expanded', 'false');
1502
+ self.$selection.removeAttr('aria-activedescendant');
1503
+ self.$selection.removeAttr('aria-owns');
1504
+
1505
+ self.$selection.trigger('focus');
1506
+
1507
+ self._detachCloseHandler(container);
1508
+ });
1509
+
1510
+ container.on('enable', function () {
1511
+ self.$selection.attr('tabindex', self._tabindex);
1512
+ self.$selection.attr('aria-disabled', 'false');
1513
+ });
1514
+
1515
+ container.on('disable', function () {
1516
+ self.$selection.attr('tabindex', '-1');
1517
+ self.$selection.attr('aria-disabled', 'true');
1518
+ });
1519
+ };
1520
+
1521
+ BaseSelection.prototype._handleBlur = function (evt) {
1522
+ var self = this;
1523
+
1524
+ // This needs to be delayed as the active element is the body when the tab
1525
+ // key is pressed, possibly along with others.
1526
+ window.setTimeout(function () {
1527
+ // Don't trigger `blur` if the focus is still in the selection
1528
+ if (
1529
+ (document.activeElement == self.$selection[0]) ||
1530
+ ($.contains(self.$selection[0], document.activeElement))
1531
+ ) {
1532
+ return;
1533
+ }
1534
+
1535
+ self.trigger('blur', evt);
1536
+ }, 1);
1537
+ };
1538
+
1539
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1540
+
1541
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1542
+ var $target = $(e.target);
1543
+
1544
+ var $select = $target.closest('.select2');
1545
+
1546
+ var $all = $('.select2.select2-container--open');
1547
+
1548
+ $all.each(function () {
1549
+ if (this == $select[0]) {
1550
+ return;
1551
+ }
1552
+
1553
+ var $element = Utils.GetData(this, 'element');
1554
+
1555
+ $element.select2('close');
1556
+ });
1557
+ });
1558
+ };
1559
+
1560
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1561
+ $(document.body).off('mousedown.select2.' + container.id);
1562
+ };
1563
+
1564
+ BaseSelection.prototype.position = function ($selection, $container) {
1565
+ var $selectionContainer = $container.find('.selection');
1566
+ $selectionContainer.append($selection);
1567
+ };
1568
+
1569
+ BaseSelection.prototype.destroy = function () {
1570
+ this._detachCloseHandler(this.container);
1571
+ };
1572
+
1573
+ BaseSelection.prototype.update = function (data) {
1574
+ throw new Error('The `update` method must be defined in child classes.');
1575
+ };
1576
+
1577
+ /**
1578
+ * Helper method to abstract the "enabled" (not "disabled") state of this
1579
+ * object.
1580
+ *
1581
+ * @return {true} if the instance is not disabled.
1582
+ * @return {false} if the instance is disabled.
1583
+ */
1584
+ BaseSelection.prototype.isEnabled = function () {
1585
+ return !this.isDisabled();
1586
+ };
1587
+
1588
+ /**
1589
+ * Helper method to abstract the "disabled" state of this object.
1590
+ *
1591
+ * @return {true} if the disabled option is true.
1592
+ * @return {false} if the disabled option is false.
1593
+ */
1594
+ BaseSelection.prototype.isDisabled = function () {
1595
+ return this.options.get('disabled');
1596
+ };
1597
+
1598
+ return BaseSelection;
1599
+ });
1600
+
1601
+ S2.define('select2/selection/single',[
1602
+ 'jquery',
1603
+ './base',
1604
+ '../utils',
1605
+ '../keys'
1606
+ ], function ($, BaseSelection, Utils, KEYS) {
1607
+ function SingleSelection () {
1608
+ SingleSelection.__super__.constructor.apply(this, arguments);
1609
+ }
1610
+
1611
+ Utils.Extend(SingleSelection, BaseSelection);
1612
+
1613
+ SingleSelection.prototype.render = function () {
1614
+ var $selection = SingleSelection.__super__.render.call(this);
1615
+
1616
+ $selection[0].classList.add('select2-selection--single');
1617
+
1618
+ $selection.html(
1619
+ '<span class="select2-selection__rendered"></span>' +
1620
+ '<span class="select2-selection__arrow" role="presentation">' +
1621
+ '<b role="presentation"></b>' +
1622
+ '</span>'
1623
+ );
1624
+
1625
+ return $selection;
1626
+ };
1627
+
1628
+ SingleSelection.prototype.bind = function (container, $container) {
1629
+ var self = this;
1630
+
1631
+ SingleSelection.__super__.bind.apply(this, arguments);
1632
+
1633
+ var id = container.id + '-container';
1634
+
1635
+ this.$selection.find('.select2-selection__rendered')
1636
+ .attr('id', id)
1637
+ .attr('role', 'textbox')
1638
+ .attr('aria-readonly', 'true');
1639
+ this.$selection.attr('aria-labelledby', id);
1640
+ this.$selection.attr('aria-controls', id);
1641
+
1642
+ this.$selection.on('mousedown', function (evt) {
1643
+ // Only respond to left clicks
1644
+ if (evt.which !== 1) {
1645
+ return;
1646
+ }
1647
+
1648
+ self.trigger('toggle', {
1649
+ originalEvent: evt
1650
+ });
1651
+ });
1652
+
1653
+ this.$selection.on('focus', function (evt) {
1654
+ // User focuses on the container
1655
+ });
1656
+
1657
+ this.$selection.on('blur', function (evt) {
1658
+ // User exits the container
1659
+ });
1660
+
1661
+ container.on('focus', function (evt) {
1662
+ if (!container.isOpen()) {
1663
+ self.$selection.trigger('focus');
1664
+ }
1665
+ });
1666
+ };
1667
+
1668
+ SingleSelection.prototype.clear = function () {
1669
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1670
+ $rendered.empty();
1671
+ $rendered.removeAttr('title'); // clear tooltip on empty
1672
+ };
1673
+
1674
+ SingleSelection.prototype.display = function (data, container) {
1675
+ var template = this.options.get('templateSelection');
1676
+ var escapeMarkup = this.options.get('escapeMarkup');
1677
+
1678
+ return escapeMarkup(template(data, container));
1679
+ };
1680
+
1681
+ SingleSelection.prototype.selectionContainer = function () {
1682
+ return $('<span></span>');
1683
+ };
1684
+
1685
+ SingleSelection.prototype.update = function (data) {
1686
+ if (data.length === 0) {
1687
+ this.clear();
1688
+ return;
1689
+ }
1690
+
1691
+ var selection = data[0];
1692
+
1693
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1694
+ var formatted = this.display(selection, $rendered);
1695
+
1696
+ $rendered.empty().append(formatted);
1697
+
1698
+ var title = selection.title || selection.text;
1699
+
1700
+ if (title) {
1701
+ $rendered.attr('title', title);
1702
+ } else {
1703
+ $rendered.removeAttr('title');
1704
+ }
1705
+ };
1706
+
1707
+ return SingleSelection;
1708
+ });
1709
+
1710
+ S2.define('select2/selection/multiple',[
1711
+ 'jquery',
1712
+ './base',
1713
+ '../utils'
1714
+ ], function ($, BaseSelection, Utils) {
1715
+ function MultipleSelection ($element, options) {
1716
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1717
+ }
1718
+
1719
+ Utils.Extend(MultipleSelection, BaseSelection);
1720
+
1721
+ MultipleSelection.prototype.render = function () {
1722
+ var $selection = MultipleSelection.__super__.render.call(this);
1723
+
1724
+ $selection[0].classList.add('select2-selection--multiple');
1725
+
1726
+ $selection.html(
1727
+ '<ul class="select2-selection__rendered"></ul>'
1728
+ );
1729
+
1730
+ return $selection;
1731
+ };
1732
+
1733
+ MultipleSelection.prototype.bind = function (container, $container) {
1734
+ var self = this;
1735
+
1736
+ MultipleSelection.__super__.bind.apply(this, arguments);
1737
+
1738
+ var id = container.id + '-container';
1739
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
1740
+
1741
+ this.$selection.on('click', function (evt) {
1742
+ self.trigger('toggle', {
1743
+ originalEvent: evt
1744
+ });
1745
+ });
1746
+
1747
+ this.$selection.on(
1748
+ 'click',
1749
+ '.select2-selection__choice__remove',
1750
+ function (evt) {
1751
+ // Ignore the event if it is disabled
1752
+ if (self.isDisabled()) {
1753
+ return;
1754
+ }
1755
+
1756
+ var $remove = $(this);
1757
+ var $selection = $remove.parent();
1758
+
1759
+ var data = Utils.GetData($selection[0], 'data');
1760
+
1761
+ self.trigger('unselect', {
1762
+ originalEvent: evt,
1763
+ data: data
1764
+ });
1765
+ }
1766
+ );
1767
+
1768
+ this.$selection.on(
1769
+ 'keydown',
1770
+ '.select2-selection__choice__remove',
1771
+ function (evt) {
1772
+ // Ignore the event if it is disabled
1773
+ if (self.isDisabled()) {
1774
+ return;
1775
+ }
1776
+
1777
+ evt.stopPropagation();
1778
+ }
1779
+ );
1780
+ };
1781
+
1782
+ MultipleSelection.prototype.clear = function () {
1783
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1784
+ $rendered.empty();
1785
+ $rendered.removeAttr('title');
1786
+ };
1787
+
1788
+ MultipleSelection.prototype.display = function (data, container) {
1789
+ var template = this.options.get('templateSelection');
1790
+ var escapeMarkup = this.options.get('escapeMarkup');
1791
+
1792
+ return escapeMarkup(template(data, container));
1793
+ };
1794
+
1795
+ MultipleSelection.prototype.selectionContainer = function () {
1796
+ var $container = $(
1797
+ '<li class="select2-selection__choice">' +
1798
+ '<button type="button" class="select2-selection__choice__remove" ' +
1799
+ 'tabindex="-1">' +
1800
+ '<span aria-hidden="true">&times;</span>' +
1801
+ '</button>' +
1802
+ '<span class="select2-selection__choice__display"></span>' +
1803
+ '</li>'
1804
+ );
1805
+
1806
+ return $container;
1807
+ };
1808
+
1809
+ MultipleSelection.prototype.update = function (data) {
1810
+ this.clear();
1811
+
1812
+ if (data.length === 0) {
1813
+ return;
1814
+ }
1815
+
1816
+ var $selections = [];
1817
+
1818
+ var selectionIdPrefix = this.$selection.find('.select2-selection__rendered')
1819
+ .attr('id') + '-choice-';
1820
+
1821
+ for (var d = 0; d < data.length; d++) {
1822
+ var selection = data[d];
1823
+
1824
+ var $selection = this.selectionContainer();
1825
+ var formatted = this.display(selection, $selection);
1826
+
1827
+ var selectionId = selectionIdPrefix + Utils.generateChars(4) + '-';
1828
+
1829
+ if (selection.id) {
1830
+ selectionId += selection.id;
1831
+ } else {
1832
+ selectionId += Utils.generateChars(4);
1833
+ }
1834
+
1835
+ $selection.find('.select2-selection__choice__display')
1836
+ .append(formatted)
1837
+ .attr('id', selectionId);
1838
+
1839
+ var title = selection.title || selection.text;
1840
+
1841
+ if (title) {
1842
+ $selection.attr('title', title);
1843
+ }
1844
+
1845
+ var removeItem = this.options.get('translations').get('removeItem');
1846
+
1847
+ var $remove = $selection.find('.select2-selection__choice__remove');
1848
+
1849
+ $remove.attr('title', removeItem());
1850
+ $remove.attr('aria-label', removeItem());
1851
+ $remove.attr('aria-describedby', selectionId);
1852
+
1853
+ Utils.StoreData($selection[0], 'data', selection);
1854
+
1855
+ $selections.push($selection);
1856
+ }
1857
+
1858
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1859
+
1860
+ $rendered.append($selections);
1861
+ };
1862
+
1863
+ return MultipleSelection;
1864
+ });
1865
+
1866
+ S2.define('select2/selection/placeholder',[
1867
+
1868
+ ], function () {
1869
+ function Placeholder (decorated, $element, options) {
1870
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1871
+
1872
+ decorated.call(this, $element, options);
1873
+ }
1874
+
1875
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1876
+ if (typeof placeholder === 'string') {
1877
+ placeholder = {
1878
+ id: '',
1879
+ text: placeholder
1880
+ };
1881
+ }
1882
+
1883
+ return placeholder;
1884
+ };
1885
+
1886
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1887
+ var $placeholder = this.selectionContainer();
1888
+
1889
+ $placeholder.html(this.display(placeholder));
1890
+ $placeholder[0].classList.add('select2-selection__placeholder');
1891
+ $placeholder[0].classList.remove('select2-selection__choice');
1892
+
1893
+ var placeholderTitle = placeholder.title ||
1894
+ placeholder.text ||
1895
+ $placeholder.text();
1896
+
1897
+ this.$selection.find('.select2-selection__rendered').attr(
1898
+ 'title',
1899
+ placeholderTitle
1900
+ );
1901
+
1902
+ return $placeholder;
1903
+ };
1904
+
1905
+ Placeholder.prototype.update = function (decorated, data) {
1906
+ var singlePlaceholder = (
1907
+ data.length == 1 && data[0].id != this.placeholder.id
1908
+ );
1909
+ var multipleSelections = data.length > 1;
1910
+
1911
+ if (multipleSelections || singlePlaceholder) {
1912
+ return decorated.call(this, data);
1913
+ }
1914
+
1915
+ this.clear();
1916
+
1917
+ var $placeholder = this.createPlaceholder(this.placeholder);
1918
+
1919
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1920
+ };
1921
+
1922
+ return Placeholder;
1923
+ });
1924
+
1925
+ S2.define('select2/selection/allowClear',[
1926
+ 'jquery',
1927
+ '../keys',
1928
+ '../utils'
1929
+ ], function ($, KEYS, Utils) {
1930
+ function AllowClear () { }
1931
+
1932
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1933
+ var self = this;
1934
+
1935
+ decorated.call(this, container, $container);
1936
+
1937
+ if (this.placeholder == null) {
1938
+ if (this.options.get('debug') && window.console && console.error) {
1939
+ console.error(
1940
+ 'Select2: The `allowClear` option should be used in combination ' +
1941
+ 'with the `placeholder` option.'
1942
+ );
1943
+ }
1944
+ }
1945
+
1946
+ this.$selection.on('mousedown', '.select2-selection__clear',
1947
+ function (evt) {
1948
+ self._handleClear(evt);
1949
+ });
1950
+
1951
+ container.on('keypress', function (evt) {
1952
+ self._handleKeyboardClear(evt, container);
1953
+ });
1954
+ };
1955
+
1956
+ AllowClear.prototype._handleClear = function (_, evt) {
1957
+ // Ignore the event if it is disabled
1958
+ if (this.isDisabled()) {
1959
+ return;
1960
+ }
1961
+
1962
+ var $clear = this.$selection.find('.select2-selection__clear');
1963
+
1964
+ // Ignore the event if nothing has been selected
1965
+ if ($clear.length === 0) {
1966
+ return;
1967
+ }
1968
+
1969
+ evt.stopPropagation();
1970
+
1971
+ var data = Utils.GetData($clear[0], 'data');
1972
+
1973
+ var previousVal = this.$element.val();
1974
+ this.$element.val(this.placeholder.id);
1975
+
1976
+ var unselectData = {
1977
+ data: data
1978
+ };
1979
+ this.trigger('clear', unselectData);
1980
+ if (unselectData.prevented) {
1981
+ this.$element.val(previousVal);
1982
+ return;
1983
+ }
1984
+
1985
+ for (var d = 0; d < data.length; d++) {
1986
+ unselectData = {
1987
+ data: data[d]
1988
+ };
1989
+
1990
+ // Trigger the `unselect` event, so people can prevent it from being
1991
+ // cleared.
1992
+ this.trigger('unselect', unselectData);
1993
+
1994
+ // If the event was prevented, don't clear it out.
1995
+ if (unselectData.prevented) {
1996
+ this.$element.val(previousVal);
1997
+ return;
1998
+ }
1999
+ }
2000
+
2001
+ this.$element.trigger('input').trigger('change');
2002
+
2003
+ this.trigger('toggle', {});
2004
+ };
2005
+
2006
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
2007
+ if (container.isOpen()) {
2008
+ return;
2009
+ }
2010
+
2011
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
2012
+ this._handleClear(evt);
2013
+ }
2014
+ };
2015
+
2016
+ AllowClear.prototype.update = function (decorated, data) {
2017
+ decorated.call(this, data);
2018
+
2019
+ this.$selection.find('.select2-selection__clear').remove();
2020
+ this.$selection[0].classList.remove('select2-selection--clearable');
2021
+
2022
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
2023
+ data.length === 0) {
2024
+ return;
2025
+ }
2026
+
2027
+ var selectionId = this.$selection.find('.select2-selection__rendered')
2028
+ .attr('id');
2029
+
2030
+ var removeAll = this.options.get('translations').get('removeAllItems');
2031
+
2032
+ var $remove = $(
2033
+ '<button type="button" class="select2-selection__clear" tabindex="-1">' +
2034
+ '<span aria-hidden="true">&times;</span>' +
2035
+ '</button>'
2036
+ );
2037
+ $remove.attr('title', removeAll());
2038
+ $remove.attr('aria-label', removeAll());
2039
+ $remove.attr('aria-describedby', selectionId);
2040
+ Utils.StoreData($remove[0], 'data', data);
2041
+
2042
+ this.$selection.prepend($remove);
2043
+ this.$selection[0].classList.add('select2-selection--clearable');
2044
+ };
2045
+
2046
+ return AllowClear;
2047
+ });
2048
+
2049
+ S2.define('select2/selection/search',[
2050
+ 'jquery',
2051
+ '../utils',
2052
+ '../keys'
2053
+ ], function ($, Utils, KEYS) {
2054
+ function Search (decorated, $element, options) {
2055
+ decorated.call(this, $element, options);
2056
+ }
2057
+
2058
+ Search.prototype.render = function (decorated) {
2059
+ var searchLabel = this.options.get('translations').get('search');
2060
+ var $search = $(
2061
+ '<span class="select2-search select2-search--inline">' +
2062
+ '<textarea class="select2-search__field"'+
2063
+ ' type="search" tabindex="-1"' +
2064
+ ' autocorrect="off" autocapitalize="none"' +
2065
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" >' +
2066
+ '</textarea>' +
2067
+ '</span>'
2068
+ );
2069
+
2070
+ this.$searchContainer = $search;
2071
+ this.$search = $search.find('textarea');
2072
+
2073
+ this.$search.prop('autocomplete', this.options.get('autocomplete'));
2074
+ this.$search.attr('aria-label', searchLabel());
2075
+
2076
+ var $rendered = decorated.call(this);
2077
+
2078
+ this._transferTabIndex();
2079
+ $rendered.append(this.$searchContainer);
2080
+
2081
+ return $rendered;
2082
+ };
2083
+
2084
+ Search.prototype.bind = function (decorated, container, $container) {
2085
+ var self = this;
2086
+
2087
+ var resultsId = container.id + '-results';
2088
+ var selectionId = container.id + '-container';
2089
+
2090
+ decorated.call(this, container, $container);
2091
+
2092
+ self.$search.attr('aria-describedby', selectionId);
2093
+
2094
+ container.on('open', function () {
2095
+ self.$search.attr('aria-controls', resultsId);
2096
+ self.$search.trigger('focus');
2097
+ });
2098
+
2099
+ container.on('close', function () {
2100
+ self.$search.val('');
2101
+ self.resizeSearch();
2102
+ self.$search.removeAttr('aria-controls');
2103
+ self.$search.removeAttr('aria-activedescendant');
2104
+ self.$search.trigger('focus');
2105
+ });
2106
+
2107
+ container.on('enable', function () {
2108
+ self.$search.prop('disabled', false);
2109
+
2110
+ self._transferTabIndex();
2111
+ });
2112
+
2113
+ container.on('disable', function () {
2114
+ self.$search.prop('disabled', true);
2115
+ });
2116
+
2117
+ container.on('focus', function (evt) {
2118
+ self.$search.trigger('focus');
2119
+ });
2120
+
2121
+ container.on('results:focus', function (params) {
2122
+ if (params.data._resultId) {
2123
+ self.$search.attr('aria-activedescendant', params.data._resultId);
2124
+ } else {
2125
+ self.$search.removeAttr('aria-activedescendant');
2126
+ }
2127
+ });
2128
+
2129
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
2130
+ self.trigger('focus', evt);
2131
+ });
2132
+
2133
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
2134
+ self._handleBlur(evt);
2135
+ });
2136
+
2137
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
2138
+ evt.stopPropagation();
2139
+
2140
+ self.trigger('keypress', evt);
2141
+
2142
+ self._keyUpPrevented = evt.isDefaultPrevented();
2143
+
2144
+ var key = evt.which;
2145
+
2146
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
2147
+ var $previousChoice = self.$selection
2148
+ .find('.select2-selection__choice').last();
2149
+
2150
+ if ($previousChoice.length > 0) {
2151
+ var item = Utils.GetData($previousChoice[0], 'data');
2152
+
2153
+ self.searchRemoveChoice(item);
2154
+
2155
+ evt.preventDefault();
2156
+ }
2157
+ }
2158
+ });
2159
+
2160
+ this.$selection.on('click', '.select2-search--inline', function (evt) {
2161
+ if (self.$search.val()) {
2162
+ evt.stopPropagation();
2163
+ }
2164
+ });
2165
+
2166
+ // Try to detect the IE version should the `documentMode` property that
2167
+ // is stored on the document. This is only implemented in IE and is
2168
+ // slightly cleaner than doing a user agent check.
2169
+ // This property is not available in Edge, but Edge also doesn't have
2170
+ // this bug.
2171
+ var msie = document.documentMode;
2172
+ var disableInputEvents = msie && msie <= 11;
2173
+
2174
+ // Workaround for browsers which do not support the `input` event
2175
+ // This will prevent double-triggering of events for browsers which support
2176
+ // both the `keyup` and `input` events.
2177
+ this.$selection.on(
2178
+ 'input.searchcheck',
2179
+ '.select2-search--inline',
2180
+ function (evt) {
2181
+ // IE will trigger the `input` event when a placeholder is used on a
2182
+ // search box. To get around this issue, we are forced to ignore all
2183
+ // `input` events in IE and keep using `keyup`.
2184
+ if (disableInputEvents) {
2185
+ self.$selection.off('input.search input.searchcheck');
2186
+ return;
2187
+ }
2188
+
2189
+ // Unbind the duplicated `keyup` event
2190
+ self.$selection.off('keyup.search');
2191
+ }
2192
+ );
2193
+
2194
+ this.$selection.on(
2195
+ 'keyup.search input.search',
2196
+ '.select2-search--inline',
2197
+ function (evt) {
2198
+ // IE will trigger the `input` event when a placeholder is used on a
2199
+ // search box. To get around this issue, we are forced to ignore all
2200
+ // `input` events in IE and keep using `keyup`.
2201
+ if (disableInputEvents && evt.type === 'input') {
2202
+ self.$selection.off('input.search input.searchcheck');
2203
+ return;
2204
+ }
2205
+
2206
+ var key = evt.which;
2207
+
2208
+ // We can freely ignore events from modifier keys
2209
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
2210
+ return;
2211
+ }
2212
+
2213
+ // Tabbing will be handled during the `keydown` phase
2214
+ if (key == KEYS.TAB) {
2215
+ return;
2216
+ }
2217
+
2218
+ self.handleSearch(evt);
2219
+ }
2220
+ );
2221
+ };
2222
+
2223
+ /**
2224
+ * This method will transfer the tabindex attribute from the rendered
2225
+ * selection to the search box. This allows for the search box to be used as
2226
+ * the primary focus instead of the selection container.
2227
+ *
2228
+ * @private
2229
+ */
2230
+ Search.prototype._transferTabIndex = function (decorated) {
2231
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2232
+ this.$selection.attr('tabindex', '-1');
2233
+ };
2234
+
2235
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2236
+ this.$search.attr('placeholder', placeholder.text);
2237
+ };
2238
+
2239
+ Search.prototype.update = function (decorated, data) {
2240
+ var searchHadFocus = this.$search[0] == document.activeElement;
2241
+
2242
+ this.$search.attr('placeholder', '');
2243
+
2244
+ decorated.call(this, data);
2245
+
2246
+ this.resizeSearch();
2247
+ if (searchHadFocus) {
2248
+ this.$search.trigger('focus');
2249
+ }
2250
+ };
2251
+
2252
+ Search.prototype.handleSearch = function () {
2253
+ this.resizeSearch();
2254
+
2255
+ if (!this._keyUpPrevented) {
2256
+ var input = this.$search.val();
2257
+
2258
+ this.trigger('query', {
2259
+ term: input
2260
+ });
2261
+ }
2262
+
2263
+ this._keyUpPrevented = false;
2264
+ };
2265
+
2266
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2267
+ this.trigger('unselect', {
2268
+ data: item
2269
+ });
2270
+
2271
+ this.$search.val(item.text);
2272
+ this.handleSearch();
2273
+ };
2274
+
2275
+ Search.prototype.resizeSearch = function () {
2276
+ this.$search.css('width', '25px');
2277
+
2278
+ var width = '100%';
2279
+
2280
+ if (this.$search.attr('placeholder') === '') {
2281
+ var minimumWidth = this.$search.val().length + 1;
2282
+
2283
+ width = (minimumWidth * 0.75) + 'em';
2284
+ }
2285
+
2286
+ this.$search.css('width', width);
2287
+ };
2288
+
2289
+ return Search;
2290
+ });
2291
+
2292
+ S2.define('select2/selection/selectionCss',[
2293
+ '../utils'
2294
+ ], function (Utils) {
2295
+ function SelectionCSS () { }
2296
+
2297
+ SelectionCSS.prototype.render = function (decorated) {
2298
+ var $selection = decorated.call(this);
2299
+
2300
+ var selectionCssClass = this.options.get('selectionCssClass') || '';
2301
+
2302
+ if (selectionCssClass.indexOf(':all:') !== -1) {
2303
+ selectionCssClass = selectionCssClass.replace(':all:', '');
2304
+
2305
+ Utils.copyNonInternalCssClasses($selection[0], this.$element[0]);
2306
+ }
2307
+
2308
+ $selection.addClass(selectionCssClass);
2309
+
2310
+ return $selection;
2311
+ };
2312
+
2313
+ return SelectionCSS;
2314
+ });
2315
+
2316
+ S2.define('select2/selection/eventRelay',[
2317
+ 'jquery'
2318
+ ], function ($) {
2319
+ function EventRelay () { }
2320
+
2321
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2322
+ var self = this;
2323
+ var relayEvents = [
2324
+ 'open', 'opening',
2325
+ 'close', 'closing',
2326
+ 'select', 'selecting',
2327
+ 'unselect', 'unselecting',
2328
+ 'clear', 'clearing'
2329
+ ];
2330
+
2331
+ var preventableEvents = [
2332
+ 'opening', 'closing', 'selecting', 'unselecting', 'clearing'
2333
+ ];
2334
+
2335
+ decorated.call(this, container, $container);
2336
+
2337
+ container.on('*', function (name, params) {
2338
+ // Ignore events that should not be relayed
2339
+ if (relayEvents.indexOf(name) === -1) {
2340
+ return;
2341
+ }
2342
+
2343
+ // The parameters should always be an object
2344
+ params = params || {};
2345
+
2346
+ // Generate the jQuery event for the Select2 event
2347
+ var evt = $.Event('select2:' + name, {
2348
+ params: params
2349
+ });
2350
+
2351
+ self.$element.trigger(evt);
2352
+
2353
+ // Only handle preventable events if it was one
2354
+ if (preventableEvents.indexOf(name) === -1) {
2355
+ return;
2356
+ }
2357
+
2358
+ params.prevented = evt.isDefaultPrevented();
2359
+ });
2360
+ };
2361
+
2362
+ return EventRelay;
2363
+ });
2364
+
2365
+ S2.define('select2/translation',[
2366
+ 'jquery',
2367
+ 'require'
2368
+ ], function ($, require) {
2369
+ function Translation (dict) {
2370
+ this.dict = dict || {};
2371
+ }
2372
+
2373
+ Translation.prototype.all = function () {
2374
+ return this.dict;
2375
+ };
2376
+
2377
+ Translation.prototype.get = function (key) {
2378
+ return this.dict[key];
2379
+ };
2380
+
2381
+ Translation.prototype.extend = function (translation) {
2382
+ this.dict = $.extend({}, translation.all(), this.dict);
2383
+ };
2384
+
2385
+ // Static functions
2386
+
2387
+ Translation._cache = {};
2388
+
2389
+ Translation.loadPath = function (path) {
2390
+ if (!(path in Translation._cache)) {
2391
+ var translations = require(path);
2392
+
2393
+ Translation._cache[path] = translations;
2394
+ }
2395
+
2396
+ return new Translation(Translation._cache[path]);
2397
+ };
2398
+
2399
+ return Translation;
2400
+ });
2401
+
2402
+ S2.define('select2/diacritics',[
2403
+
2404
+ ], function () {
2405
+ var diacritics = {
2406
+ '\u24B6': 'A',
2407
+ '\uFF21': 'A',
2408
+ '\u00C0': 'A',
2409
+ '\u00C1': 'A',
2410
+ '\u00C2': 'A',
2411
+ '\u1EA6': 'A',
2412
+ '\u1EA4': 'A',
2413
+ '\u1EAA': 'A',
2414
+ '\u1EA8': 'A',
2415
+ '\u00C3': 'A',
2416
+ '\u0100': 'A',
2417
+ '\u0102': 'A',
2418
+ '\u1EB0': 'A',
2419
+ '\u1EAE': 'A',
2420
+ '\u1EB4': 'A',
2421
+ '\u1EB2': 'A',
2422
+ '\u0226': 'A',
2423
+ '\u01E0': 'A',
2424
+ '\u00C4': 'A',
2425
+ '\u01DE': 'A',
2426
+ '\u1EA2': 'A',
2427
+ '\u00C5': 'A',
2428
+ '\u01FA': 'A',
2429
+ '\u01CD': 'A',
2430
+ '\u0200': 'A',
2431
+ '\u0202': 'A',
2432
+ '\u1EA0': 'A',
2433
+ '\u1EAC': 'A',
2434
+ '\u1EB6': 'A',
2435
+ '\u1E00': 'A',
2436
+ '\u0104': 'A',
2437
+ '\u023A': 'A',
2438
+ '\u2C6F': 'A',
2439
+ '\uA732': 'AA',
2440
+ '\u00C6': 'AE',
2441
+ '\u01FC': 'AE',
2442
+ '\u01E2': 'AE',
2443
+ '\uA734': 'AO',
2444
+ '\uA736': 'AU',
2445
+ '\uA738': 'AV',
2446
+ '\uA73A': 'AV',
2447
+ '\uA73C': 'AY',
2448
+ '\u24B7': 'B',
2449
+ '\uFF22': 'B',
2450
+ '\u1E02': 'B',
2451
+ '\u1E04': 'B',
2452
+ '\u1E06': 'B',
2453
+ '\u0243': 'B',
2454
+ '\u0182': 'B',
2455
+ '\u0181': 'B',
2456
+ '\u24B8': 'C',
2457
+ '\uFF23': 'C',
2458
+ '\u0106': 'C',
2459
+ '\u0108': 'C',
2460
+ '\u010A': 'C',
2461
+ '\u010C': 'C',
2462
+ '\u00C7': 'C',
2463
+ '\u1E08': 'C',
2464
+ '\u0187': 'C',
2465
+ '\u023B': 'C',
2466
+ '\uA73E': 'C',
2467
+ '\u24B9': 'D',
2468
+ '\uFF24': 'D',
2469
+ '\u1E0A': 'D',
2470
+ '\u010E': 'D',
2471
+ '\u1E0C': 'D',
2472
+ '\u1E10': 'D',
2473
+ '\u1E12': 'D',
2474
+ '\u1E0E': 'D',
2475
+ '\u0110': 'D',
2476
+ '\u018B': 'D',
2477
+ '\u018A': 'D',
2478
+ '\u0189': 'D',
2479
+ '\uA779': 'D',
2480
+ '\u01F1': 'DZ',
2481
+ '\u01C4': 'DZ',
2482
+ '\u01F2': 'Dz',
2483
+ '\u01C5': 'Dz',
2484
+ '\u24BA': 'E',
2485
+ '\uFF25': 'E',
2486
+ '\u00C8': 'E',
2487
+ '\u00C9': 'E',
2488
+ '\u00CA': 'E',
2489
+ '\u1EC0': 'E',
2490
+ '\u1EBE': 'E',
2491
+ '\u1EC4': 'E',
2492
+ '\u1EC2': 'E',
2493
+ '\u1EBC': 'E',
2494
+ '\u0112': 'E',
2495
+ '\u1E14': 'E',
2496
+ '\u1E16': 'E',
2497
+ '\u0114': 'E',
2498
+ '\u0116': 'E',
2499
+ '\u00CB': 'E',
2500
+ '\u1EBA': 'E',
2501
+ '\u011A': 'E',
2502
+ '\u0204': 'E',
2503
+ '\u0206': 'E',
2504
+ '\u1EB8': 'E',
2505
+ '\u1EC6': 'E',
2506
+ '\u0228': 'E',
2507
+ '\u1E1C': 'E',
2508
+ '\u0118': 'E',
2509
+ '\u1E18': 'E',
2510
+ '\u1E1A': 'E',
2511
+ '\u0190': 'E',
2512
+ '\u018E': 'E',
2513
+ '\u24BB': 'F',
2514
+ '\uFF26': 'F',
2515
+ '\u1E1E': 'F',
2516
+ '\u0191': 'F',
2517
+ '\uA77B': 'F',
2518
+ '\u24BC': 'G',
2519
+ '\uFF27': 'G',
2520
+ '\u01F4': 'G',
2521
+ '\u011C': 'G',
2522
+ '\u1E20': 'G',
2523
+ '\u011E': 'G',
2524
+ '\u0120': 'G',
2525
+ '\u01E6': 'G',
2526
+ '\u0122': 'G',
2527
+ '\u01E4': 'G',
2528
+ '\u0193': 'G',
2529
+ '\uA7A0': 'G',
2530
+ '\uA77D': 'G',
2531
+ '\uA77E': 'G',
2532
+ '\u24BD': 'H',
2533
+ '\uFF28': 'H',
2534
+ '\u0124': 'H',
2535
+ '\u1E22': 'H',
2536
+ '\u1E26': 'H',
2537
+ '\u021E': 'H',
2538
+ '\u1E24': 'H',
2539
+ '\u1E28': 'H',
2540
+ '\u1E2A': 'H',
2541
+ '\u0126': 'H',
2542
+ '\u2C67': 'H',
2543
+ '\u2C75': 'H',
2544
+ '\uA78D': 'H',
2545
+ '\u24BE': 'I',
2546
+ '\uFF29': 'I',
2547
+ '\u00CC': 'I',
2548
+ '\u00CD': 'I',
2549
+ '\u00CE': 'I',
2550
+ '\u0128': 'I',
2551
+ '\u012A': 'I',
2552
+ '\u012C': 'I',
2553
+ '\u0130': 'I',
2554
+ '\u00CF': 'I',
2555
+ '\u1E2E': 'I',
2556
+ '\u1EC8': 'I',
2557
+ '\u01CF': 'I',
2558
+ '\u0208': 'I',
2559
+ '\u020A': 'I',
2560
+ '\u1ECA': 'I',
2561
+ '\u012E': 'I',
2562
+ '\u1E2C': 'I',
2563
+ '\u0197': 'I',
2564
+ '\u24BF': 'J',
2565
+ '\uFF2A': 'J',
2566
+ '\u0134': 'J',
2567
+ '\u0248': 'J',
2568
+ '\u24C0': 'K',
2569
+ '\uFF2B': 'K',
2570
+ '\u1E30': 'K',
2571
+ '\u01E8': 'K',
2572
+ '\u1E32': 'K',
2573
+ '\u0136': 'K',
2574
+ '\u1E34': 'K',
2575
+ '\u0198': 'K',
2576
+ '\u2C69': 'K',
2577
+ '\uA740': 'K',
2578
+ '\uA742': 'K',
2579
+ '\uA744': 'K',
2580
+ '\uA7A2': 'K',
2581
+ '\u24C1': 'L',
2582
+ '\uFF2C': 'L',
2583
+ '\u013F': 'L',
2584
+ '\u0139': 'L',
2585
+ '\u013D': 'L',
2586
+ '\u1E36': 'L',
2587
+ '\u1E38': 'L',
2588
+ '\u013B': 'L',
2589
+ '\u1E3C': 'L',
2590
+ '\u1E3A': 'L',
2591
+ '\u0141': 'L',
2592
+ '\u023D': 'L',
2593
+ '\u2C62': 'L',
2594
+ '\u2C60': 'L',
2595
+ '\uA748': 'L',
2596
+ '\uA746': 'L',
2597
+ '\uA780': 'L',
2598
+ '\u01C7': 'LJ',
2599
+ '\u01C8': 'Lj',
2600
+ '\u24C2': 'M',
2601
+ '\uFF2D': 'M',
2602
+ '\u1E3E': 'M',
2603
+ '\u1E40': 'M',
2604
+ '\u1E42': 'M',
2605
+ '\u2C6E': 'M',
2606
+ '\u019C': 'M',
2607
+ '\u24C3': 'N',
2608
+ '\uFF2E': 'N',
2609
+ '\u01F8': 'N',
2610
+ '\u0143': 'N',
2611
+ '\u00D1': 'N',
2612
+ '\u1E44': 'N',
2613
+ '\u0147': 'N',
2614
+ '\u1E46': 'N',
2615
+ '\u0145': 'N',
2616
+ '\u1E4A': 'N',
2617
+ '\u1E48': 'N',
2618
+ '\u0220': 'N',
2619
+ '\u019D': 'N',
2620
+ '\uA790': 'N',
2621
+ '\uA7A4': 'N',
2622
+ '\u01CA': 'NJ',
2623
+ '\u01CB': 'Nj',
2624
+ '\u24C4': 'O',
2625
+ '\uFF2F': 'O',
2626
+ '\u00D2': 'O',
2627
+ '\u00D3': 'O',
2628
+ '\u00D4': 'O',
2629
+ '\u1ED2': 'O',
2630
+ '\u1ED0': 'O',
2631
+ '\u1ED6': 'O',
2632
+ '\u1ED4': 'O',
2633
+ '\u00D5': 'O',
2634
+ '\u1E4C': 'O',
2635
+ '\u022C': 'O',
2636
+ '\u1E4E': 'O',
2637
+ '\u014C': 'O',
2638
+ '\u1E50': 'O',
2639
+ '\u1E52': 'O',
2640
+ '\u014E': 'O',
2641
+ '\u022E': 'O',
2642
+ '\u0230': 'O',
2643
+ '\u00D6': 'O',
2644
+ '\u022A': 'O',
2645
+ '\u1ECE': 'O',
2646
+ '\u0150': 'O',
2647
+ '\u01D1': 'O',
2648
+ '\u020C': 'O',
2649
+ '\u020E': 'O',
2650
+ '\u01A0': 'O',
2651
+ '\u1EDC': 'O',
2652
+ '\u1EDA': 'O',
2653
+ '\u1EE0': 'O',
2654
+ '\u1EDE': 'O',
2655
+ '\u1EE2': 'O',
2656
+ '\u1ECC': 'O',
2657
+ '\u1ED8': 'O',
2658
+ '\u01EA': 'O',
2659
+ '\u01EC': 'O',
2660
+ '\u00D8': 'O',
2661
+ '\u01FE': 'O',
2662
+ '\u0186': 'O',
2663
+ '\u019F': 'O',
2664
+ '\uA74A': 'O',
2665
+ '\uA74C': 'O',
2666
+ '\u0152': 'OE',
2667
+ '\u01A2': 'OI',
2668
+ '\uA74E': 'OO',
2669
+ '\u0222': 'OU',
2670
+ '\u24C5': 'P',
2671
+ '\uFF30': 'P',
2672
+ '\u1E54': 'P',
2673
+ '\u1E56': 'P',
2674
+ '\u01A4': 'P',
2675
+ '\u2C63': 'P',
2676
+ '\uA750': 'P',
2677
+ '\uA752': 'P',
2678
+ '\uA754': 'P',
2679
+ '\u24C6': 'Q',
2680
+ '\uFF31': 'Q',
2681
+ '\uA756': 'Q',
2682
+ '\uA758': 'Q',
2683
+ '\u024A': 'Q',
2684
+ '\u24C7': 'R',
2685
+ '\uFF32': 'R',
2686
+ '\u0154': 'R',
2687
+ '\u1E58': 'R',
2688
+ '\u0158': 'R',
2689
+ '\u0210': 'R',
2690
+ '\u0212': 'R',
2691
+ '\u1E5A': 'R',
2692
+ '\u1E5C': 'R',
2693
+ '\u0156': 'R',
2694
+ '\u1E5E': 'R',
2695
+ '\u024C': 'R',
2696
+ '\u2C64': 'R',
2697
+ '\uA75A': 'R',
2698
+ '\uA7A6': 'R',
2699
+ '\uA782': 'R',
2700
+ '\u24C8': 'S',
2701
+ '\uFF33': 'S',
2702
+ '\u1E9E': 'S',
2703
+ '\u015A': 'S',
2704
+ '\u1E64': 'S',
2705
+ '\u015C': 'S',
2706
+ '\u1E60': 'S',
2707
+ '\u0160': 'S',
2708
+ '\u1E66': 'S',
2709
+ '\u1E62': 'S',
2710
+ '\u1E68': 'S',
2711
+ '\u0218': 'S',
2712
+ '\u015E': 'S',
2713
+ '\u2C7E': 'S',
2714
+ '\uA7A8': 'S',
2715
+ '\uA784': 'S',
2716
+ '\u24C9': 'T',
2717
+ '\uFF34': 'T',
2718
+ '\u1E6A': 'T',
2719
+ '\u0164': 'T',
2720
+ '\u1E6C': 'T',
2721
+ '\u021A': 'T',
2722
+ '\u0162': 'T',
2723
+ '\u1E70': 'T',
2724
+ '\u1E6E': 'T',
2725
+ '\u0166': 'T',
2726
+ '\u01AC': 'T',
2727
+ '\u01AE': 'T',
2728
+ '\u023E': 'T',
2729
+ '\uA786': 'T',
2730
+ '\uA728': 'TZ',
2731
+ '\u24CA': 'U',
2732
+ '\uFF35': 'U',
2733
+ '\u00D9': 'U',
2734
+ '\u00DA': 'U',
2735
+ '\u00DB': 'U',
2736
+ '\u0168': 'U',
2737
+ '\u1E78': 'U',
2738
+ '\u016A': 'U',
2739
+ '\u1E7A': 'U',
2740
+ '\u016C': 'U',
2741
+ '\u00DC': 'U',
2742
+ '\u01DB': 'U',
2743
+ '\u01D7': 'U',
2744
+ '\u01D5': 'U',
2745
+ '\u01D9': 'U',
2746
+ '\u1EE6': 'U',
2747
+ '\u016E': 'U',
2748
+ '\u0170': 'U',
2749
+ '\u01D3': 'U',
2750
+ '\u0214': 'U',
2751
+ '\u0216': 'U',
2752
+ '\u01AF': 'U',
2753
+ '\u1EEA': 'U',
2754
+ '\u1EE8': 'U',
2755
+ '\u1EEE': 'U',
2756
+ '\u1EEC': 'U',
2757
+ '\u1EF0': 'U',
2758
+ '\u1EE4': 'U',
2759
+ '\u1E72': 'U',
2760
+ '\u0172': 'U',
2761
+ '\u1E76': 'U',
2762
+ '\u1E74': 'U',
2763
+ '\u0244': 'U',
2764
+ '\u24CB': 'V',
2765
+ '\uFF36': 'V',
2766
+ '\u1E7C': 'V',
2767
+ '\u1E7E': 'V',
2768
+ '\u01B2': 'V',
2769
+ '\uA75E': 'V',
2770
+ '\u0245': 'V',
2771
+ '\uA760': 'VY',
2772
+ '\u24CC': 'W',
2773
+ '\uFF37': 'W',
2774
+ '\u1E80': 'W',
2775
+ '\u1E82': 'W',
2776
+ '\u0174': 'W',
2777
+ '\u1E86': 'W',
2778
+ '\u1E84': 'W',
2779
+ '\u1E88': 'W',
2780
+ '\u2C72': 'W',
2781
+ '\u24CD': 'X',
2782
+ '\uFF38': 'X',
2783
+ '\u1E8A': 'X',
2784
+ '\u1E8C': 'X',
2785
+ '\u24CE': 'Y',
2786
+ '\uFF39': 'Y',
2787
+ '\u1EF2': 'Y',
2788
+ '\u00DD': 'Y',
2789
+ '\u0176': 'Y',
2790
+ '\u1EF8': 'Y',
2791
+ '\u0232': 'Y',
2792
+ '\u1E8E': 'Y',
2793
+ '\u0178': 'Y',
2794
+ '\u1EF6': 'Y',
2795
+ '\u1EF4': 'Y',
2796
+ '\u01B3': 'Y',
2797
+ '\u024E': 'Y',
2798
+ '\u1EFE': 'Y',
2799
+ '\u24CF': 'Z',
2800
+ '\uFF3A': 'Z',
2801
+ '\u0179': 'Z',
2802
+ '\u1E90': 'Z',
2803
+ '\u017B': 'Z',
2804
+ '\u017D': 'Z',
2805
+ '\u1E92': 'Z',
2806
+ '\u1E94': 'Z',
2807
+ '\u01B5': 'Z',
2808
+ '\u0224': 'Z',
2809
+ '\u2C7F': 'Z',
2810
+ '\u2C6B': 'Z',
2811
+ '\uA762': 'Z',
2812
+ '\u24D0': 'a',
2813
+ '\uFF41': 'a',
2814
+ '\u1E9A': 'a',
2815
+ '\u00E0': 'a',
2816
+ '\u00E1': 'a',
2817
+ '\u00E2': 'a',
2818
+ '\u1EA7': 'a',
2819
+ '\u1EA5': 'a',
2820
+ '\u1EAB': 'a',
2821
+ '\u1EA9': 'a',
2822
+ '\u00E3': 'a',
2823
+ '\u0101': 'a',
2824
+ '\u0103': 'a',
2825
+ '\u1EB1': 'a',
2826
+ '\u1EAF': 'a',
2827
+ '\u1EB5': 'a',
2828
+ '\u1EB3': 'a',
2829
+ '\u0227': 'a',
2830
+ '\u01E1': 'a',
2831
+ '\u00E4': 'a',
2832
+ '\u01DF': 'a',
2833
+ '\u1EA3': 'a',
2834
+ '\u00E5': 'a',
2835
+ '\u01FB': 'a',
2836
+ '\u01CE': 'a',
2837
+ '\u0201': 'a',
2838
+ '\u0203': 'a',
2839
+ '\u1EA1': 'a',
2840
+ '\u1EAD': 'a',
2841
+ '\u1EB7': 'a',
2842
+ '\u1E01': 'a',
2843
+ '\u0105': 'a',
2844
+ '\u2C65': 'a',
2845
+ '\u0250': 'a',
2846
+ '\uA733': 'aa',
2847
+ '\u00E6': 'ae',
2848
+ '\u01FD': 'ae',
2849
+ '\u01E3': 'ae',
2850
+ '\uA735': 'ao',
2851
+ '\uA737': 'au',
2852
+ '\uA739': 'av',
2853
+ '\uA73B': 'av',
2854
+ '\uA73D': 'ay',
2855
+ '\u24D1': 'b',
2856
+ '\uFF42': 'b',
2857
+ '\u1E03': 'b',
2858
+ '\u1E05': 'b',
2859
+ '\u1E07': 'b',
2860
+ '\u0180': 'b',
2861
+ '\u0183': 'b',
2862
+ '\u0253': 'b',
2863
+ '\u24D2': 'c',
2864
+ '\uFF43': 'c',
2865
+ '\u0107': 'c',
2866
+ '\u0109': 'c',
2867
+ '\u010B': 'c',
2868
+ '\u010D': 'c',
2869
+ '\u00E7': 'c',
2870
+ '\u1E09': 'c',
2871
+ '\u0188': 'c',
2872
+ '\u023C': 'c',
2873
+ '\uA73F': 'c',
2874
+ '\u2184': 'c',
2875
+ '\u24D3': 'd',
2876
+ '\uFF44': 'd',
2877
+ '\u1E0B': 'd',
2878
+ '\u010F': 'd',
2879
+ '\u1E0D': 'd',
2880
+ '\u1E11': 'd',
2881
+ '\u1E13': 'd',
2882
+ '\u1E0F': 'd',
2883
+ '\u0111': 'd',
2884
+ '\u018C': 'd',
2885
+ '\u0256': 'd',
2886
+ '\u0257': 'd',
2887
+ '\uA77A': 'd',
2888
+ '\u01F3': 'dz',
2889
+ '\u01C6': 'dz',
2890
+ '\u24D4': 'e',
2891
+ '\uFF45': 'e',
2892
+ '\u00E8': 'e',
2893
+ '\u00E9': 'e',
2894
+ '\u00EA': 'e',
2895
+ '\u1EC1': 'e',
2896
+ '\u1EBF': 'e',
2897
+ '\u1EC5': 'e',
2898
+ '\u1EC3': 'e',
2899
+ '\u1EBD': 'e',
2900
+ '\u0113': 'e',
2901
+ '\u1E15': 'e',
2902
+ '\u1E17': 'e',
2903
+ '\u0115': 'e',
2904
+ '\u0117': 'e',
2905
+ '\u00EB': 'e',
2906
+ '\u1EBB': 'e',
2907
+ '\u011B': 'e',
2908
+ '\u0205': 'e',
2909
+ '\u0207': 'e',
2910
+ '\u1EB9': 'e',
2911
+ '\u1EC7': 'e',
2912
+ '\u0229': 'e',
2913
+ '\u1E1D': 'e',
2914
+ '\u0119': 'e',
2915
+ '\u1E19': 'e',
2916
+ '\u1E1B': 'e',
2917
+ '\u0247': 'e',
2918
+ '\u025B': 'e',
2919
+ '\u01DD': 'e',
2920
+ '\u24D5': 'f',
2921
+ '\uFF46': 'f',
2922
+ '\u1E1F': 'f',
2923
+ '\u0192': 'f',
2924
+ '\uA77C': 'f',
2925
+ '\u24D6': 'g',
2926
+ '\uFF47': 'g',
2927
+ '\u01F5': 'g',
2928
+ '\u011D': 'g',
2929
+ '\u1E21': 'g',
2930
+ '\u011F': 'g',
2931
+ '\u0121': 'g',
2932
+ '\u01E7': 'g',
2933
+ '\u0123': 'g',
2934
+ '\u01E5': 'g',
2935
+ '\u0260': 'g',
2936
+ '\uA7A1': 'g',
2937
+ '\u1D79': 'g',
2938
+ '\uA77F': 'g',
2939
+ '\u24D7': 'h',
2940
+ '\uFF48': 'h',
2941
+ '\u0125': 'h',
2942
+ '\u1E23': 'h',
2943
+ '\u1E27': 'h',
2944
+ '\u021F': 'h',
2945
+ '\u1E25': 'h',
2946
+ '\u1E29': 'h',
2947
+ '\u1E2B': 'h',
2948
+ '\u1E96': 'h',
2949
+ '\u0127': 'h',
2950
+ '\u2C68': 'h',
2951
+ '\u2C76': 'h',
2952
+ '\u0265': 'h',
2953
+ '\u0195': 'hv',
2954
+ '\u24D8': 'i',
2955
+ '\uFF49': 'i',
2956
+ '\u00EC': 'i',
2957
+ '\u00ED': 'i',
2958
+ '\u00EE': 'i',
2959
+ '\u0129': 'i',
2960
+ '\u012B': 'i',
2961
+ '\u012D': 'i',
2962
+ '\u00EF': 'i',
2963
+ '\u1E2F': 'i',
2964
+ '\u1EC9': 'i',
2965
+ '\u01D0': 'i',
2966
+ '\u0209': 'i',
2967
+ '\u020B': 'i',
2968
+ '\u1ECB': 'i',
2969
+ '\u012F': 'i',
2970
+ '\u1E2D': 'i',
2971
+ '\u0268': 'i',
2972
+ '\u0131': 'i',
2973
+ '\u24D9': 'j',
2974
+ '\uFF4A': 'j',
2975
+ '\u0135': 'j',
2976
+ '\u01F0': 'j',
2977
+ '\u0249': 'j',
2978
+ '\u24DA': 'k',
2979
+ '\uFF4B': 'k',
2980
+ '\u1E31': 'k',
2981
+ '\u01E9': 'k',
2982
+ '\u1E33': 'k',
2983
+ '\u0137': 'k',
2984
+ '\u1E35': 'k',
2985
+ '\u0199': 'k',
2986
+ '\u2C6A': 'k',
2987
+ '\uA741': 'k',
2988
+ '\uA743': 'k',
2989
+ '\uA745': 'k',
2990
+ '\uA7A3': 'k',
2991
+ '\u24DB': 'l',
2992
+ '\uFF4C': 'l',
2993
+ '\u0140': 'l',
2994
+ '\u013A': 'l',
2995
+ '\u013E': 'l',
2996
+ '\u1E37': 'l',
2997
+ '\u1E39': 'l',
2998
+ '\u013C': 'l',
2999
+ '\u1E3D': 'l',
3000
+ '\u1E3B': 'l',
3001
+ '\u017F': 'l',
3002
+ '\u0142': 'l',
3003
+ '\u019A': 'l',
3004
+ '\u026B': 'l',
3005
+ '\u2C61': 'l',
3006
+ '\uA749': 'l',
3007
+ '\uA781': 'l',
3008
+ '\uA747': 'l',
3009
+ '\u01C9': 'lj',
3010
+ '\u24DC': 'm',
3011
+ '\uFF4D': 'm',
3012
+ '\u1E3F': 'm',
3013
+ '\u1E41': 'm',
3014
+ '\u1E43': 'm',
3015
+ '\u0271': 'm',
3016
+ '\u026F': 'm',
3017
+ '\u24DD': 'n',
3018
+ '\uFF4E': 'n',
3019
+ '\u01F9': 'n',
3020
+ '\u0144': 'n',
3021
+ '\u00F1': 'n',
3022
+ '\u1E45': 'n',
3023
+ '\u0148': 'n',
3024
+ '\u1E47': 'n',
3025
+ '\u0146': 'n',
3026
+ '\u1E4B': 'n',
3027
+ '\u1E49': 'n',
3028
+ '\u019E': 'n',
3029
+ '\u0272': 'n',
3030
+ '\u0149': 'n',
3031
+ '\uA791': 'n',
3032
+ '\uA7A5': 'n',
3033
+ '\u01CC': 'nj',
3034
+ '\u24DE': 'o',
3035
+ '\uFF4F': 'o',
3036
+ '\u00F2': 'o',
3037
+ '\u00F3': 'o',
3038
+ '\u00F4': 'o',
3039
+ '\u1ED3': 'o',
3040
+ '\u1ED1': 'o',
3041
+ '\u1ED7': 'o',
3042
+ '\u1ED5': 'o',
3043
+ '\u00F5': 'o',
3044
+ '\u1E4D': 'o',
3045
+ '\u022D': 'o',
3046
+ '\u1E4F': 'o',
3047
+ '\u014D': 'o',
3048
+ '\u1E51': 'o',
3049
+ '\u1E53': 'o',
3050
+ '\u014F': 'o',
3051
+ '\u022F': 'o',
3052
+ '\u0231': 'o',
3053
+ '\u00F6': 'o',
3054
+ '\u022B': 'o',
3055
+ '\u1ECF': 'o',
3056
+ '\u0151': 'o',
3057
+ '\u01D2': 'o',
3058
+ '\u020D': 'o',
3059
+ '\u020F': 'o',
3060
+ '\u01A1': 'o',
3061
+ '\u1EDD': 'o',
3062
+ '\u1EDB': 'o',
3063
+ '\u1EE1': 'o',
3064
+ '\u1EDF': 'o',
3065
+ '\u1EE3': 'o',
3066
+ '\u1ECD': 'o',
3067
+ '\u1ED9': 'o',
3068
+ '\u01EB': 'o',
3069
+ '\u01ED': 'o',
3070
+ '\u00F8': 'o',
3071
+ '\u01FF': 'o',
3072
+ '\u0254': 'o',
3073
+ '\uA74B': 'o',
3074
+ '\uA74D': 'o',
3075
+ '\u0275': 'o',
3076
+ '\u0153': 'oe',
3077
+ '\u01A3': 'oi',
3078
+ '\u0223': 'ou',
3079
+ '\uA74F': 'oo',
3080
+ '\u24DF': 'p',
3081
+ '\uFF50': 'p',
3082
+ '\u1E55': 'p',
3083
+ '\u1E57': 'p',
3084
+ '\u01A5': 'p',
3085
+ '\u1D7D': 'p',
3086
+ '\uA751': 'p',
3087
+ '\uA753': 'p',
3088
+ '\uA755': 'p',
3089
+ '\u24E0': 'q',
3090
+ '\uFF51': 'q',
3091
+ '\u024B': 'q',
3092
+ '\uA757': 'q',
3093
+ '\uA759': 'q',
3094
+ '\u24E1': 'r',
3095
+ '\uFF52': 'r',
3096
+ '\u0155': 'r',
3097
+ '\u1E59': 'r',
3098
+ '\u0159': 'r',
3099
+ '\u0211': 'r',
3100
+ '\u0213': 'r',
3101
+ '\u1E5B': 'r',
3102
+ '\u1E5D': 'r',
3103
+ '\u0157': 'r',
3104
+ '\u1E5F': 'r',
3105
+ '\u024D': 'r',
3106
+ '\u027D': 'r',
3107
+ '\uA75B': 'r',
3108
+ '\uA7A7': 'r',
3109
+ '\uA783': 'r',
3110
+ '\u24E2': 's',
3111
+ '\uFF53': 's',
3112
+ '\u00DF': 's',
3113
+ '\u015B': 's',
3114
+ '\u1E65': 's',
3115
+ '\u015D': 's',
3116
+ '\u1E61': 's',
3117
+ '\u0161': 's',
3118
+ '\u1E67': 's',
3119
+ '\u1E63': 's',
3120
+ '\u1E69': 's',
3121
+ '\u0219': 's',
3122
+ '\u015F': 's',
3123
+ '\u023F': 's',
3124
+ '\uA7A9': 's',
3125
+ '\uA785': 's',
3126
+ '\u1E9B': 's',
3127
+ '\u24E3': 't',
3128
+ '\uFF54': 't',
3129
+ '\u1E6B': 't',
3130
+ '\u1E97': 't',
3131
+ '\u0165': 't',
3132
+ '\u1E6D': 't',
3133
+ '\u021B': 't',
3134
+ '\u0163': 't',
3135
+ '\u1E71': 't',
3136
+ '\u1E6F': 't',
3137
+ '\u0167': 't',
3138
+ '\u01AD': 't',
3139
+ '\u0288': 't',
3140
+ '\u2C66': 't',
3141
+ '\uA787': 't',
3142
+ '\uA729': 'tz',
3143
+ '\u24E4': 'u',
3144
+ '\uFF55': 'u',
3145
+ '\u00F9': 'u',
3146
+ '\u00FA': 'u',
3147
+ '\u00FB': 'u',
3148
+ '\u0169': 'u',
3149
+ '\u1E79': 'u',
3150
+ '\u016B': 'u',
3151
+ '\u1E7B': 'u',
3152
+ '\u016D': 'u',
3153
+ '\u00FC': 'u',
3154
+ '\u01DC': 'u',
3155
+ '\u01D8': 'u',
3156
+ '\u01D6': 'u',
3157
+ '\u01DA': 'u',
3158
+ '\u1EE7': 'u',
3159
+ '\u016F': 'u',
3160
+ '\u0171': 'u',
3161
+ '\u01D4': 'u',
3162
+ '\u0215': 'u',
3163
+ '\u0217': 'u',
3164
+ '\u01B0': 'u',
3165
+ '\u1EEB': 'u',
3166
+ '\u1EE9': 'u',
3167
+ '\u1EEF': 'u',
3168
+ '\u1EED': 'u',
3169
+ '\u1EF1': 'u',
3170
+ '\u1EE5': 'u',
3171
+ '\u1E73': 'u',
3172
+ '\u0173': 'u',
3173
+ '\u1E77': 'u',
3174
+ '\u1E75': 'u',
3175
+ '\u0289': 'u',
3176
+ '\u24E5': 'v',
3177
+ '\uFF56': 'v',
3178
+ '\u1E7D': 'v',
3179
+ '\u1E7F': 'v',
3180
+ '\u028B': 'v',
3181
+ '\uA75F': 'v',
3182
+ '\u028C': 'v',
3183
+ '\uA761': 'vy',
3184
+ '\u24E6': 'w',
3185
+ '\uFF57': 'w',
3186
+ '\u1E81': 'w',
3187
+ '\u1E83': 'w',
3188
+ '\u0175': 'w',
3189
+ '\u1E87': 'w',
3190
+ '\u1E85': 'w',
3191
+ '\u1E98': 'w',
3192
+ '\u1E89': 'w',
3193
+ '\u2C73': 'w',
3194
+ '\u24E7': 'x',
3195
+ '\uFF58': 'x',
3196
+ '\u1E8B': 'x',
3197
+ '\u1E8D': 'x',
3198
+ '\u24E8': 'y',
3199
+ '\uFF59': 'y',
3200
+ '\u1EF3': 'y',
3201
+ '\u00FD': 'y',
3202
+ '\u0177': 'y',
3203
+ '\u1EF9': 'y',
3204
+ '\u0233': 'y',
3205
+ '\u1E8F': 'y',
3206
+ '\u00FF': 'y',
3207
+ '\u1EF7': 'y',
3208
+ '\u1E99': 'y',
3209
+ '\u1EF5': 'y',
3210
+ '\u01B4': 'y',
3211
+ '\u024F': 'y',
3212
+ '\u1EFF': 'y',
3213
+ '\u24E9': 'z',
3214
+ '\uFF5A': 'z',
3215
+ '\u017A': 'z',
3216
+ '\u1E91': 'z',
3217
+ '\u017C': 'z',
3218
+ '\u017E': 'z',
3219
+ '\u1E93': 'z',
3220
+ '\u1E95': 'z',
3221
+ '\u01B6': 'z',
3222
+ '\u0225': 'z',
3223
+ '\u0240': 'z',
3224
+ '\u2C6C': 'z',
3225
+ '\uA763': 'z',
3226
+ '\u0386': '\u0391',
3227
+ '\u0388': '\u0395',
3228
+ '\u0389': '\u0397',
3229
+ '\u038A': '\u0399',
3230
+ '\u03AA': '\u0399',
3231
+ '\u038C': '\u039F',
3232
+ '\u038E': '\u03A5',
3233
+ '\u03AB': '\u03A5',
3234
+ '\u038F': '\u03A9',
3235
+ '\u03AC': '\u03B1',
3236
+ '\u03AD': '\u03B5',
3237
+ '\u03AE': '\u03B7',
3238
+ '\u03AF': '\u03B9',
3239
+ '\u03CA': '\u03B9',
3240
+ '\u0390': '\u03B9',
3241
+ '\u03CC': '\u03BF',
3242
+ '\u03CD': '\u03C5',
3243
+ '\u03CB': '\u03C5',
3244
+ '\u03B0': '\u03C5',
3245
+ '\u03CE': '\u03C9',
3246
+ '\u03C2': '\u03C3',
3247
+ '\u2019': '\''
3248
+ };
3249
+
3250
+ return diacritics;
3251
+ });
3252
+
3253
+ S2.define('select2/data/base',[
3254
+ '../utils'
3255
+ ], function (Utils) {
3256
+ function BaseAdapter ($element, options) {
3257
+ BaseAdapter.__super__.constructor.call(this);
3258
+ }
3259
+
3260
+ Utils.Extend(BaseAdapter, Utils.Observable);
3261
+
3262
+ BaseAdapter.prototype.current = function (callback) {
3263
+ throw new Error('The `current` method must be defined in child classes.');
3264
+ };
3265
+
3266
+ BaseAdapter.prototype.query = function (params, callback) {
3267
+ throw new Error('The `query` method must be defined in child classes.');
3268
+ };
3269
+
3270
+ BaseAdapter.prototype.bind = function (container, $container) {
3271
+ // Can be implemented in subclasses
3272
+ };
3273
+
3274
+ BaseAdapter.prototype.destroy = function () {
3275
+ // Can be implemented in subclasses
3276
+ };
3277
+
3278
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3279
+ var id = container.id + '-result-';
3280
+
3281
+ id += Utils.generateChars(4);
3282
+
3283
+ if (data.id != null) {
3284
+ id += '-' + data.id.toString();
3285
+ } else {
3286
+ id += '-' + Utils.generateChars(4);
3287
+ }
3288
+ return id;
3289
+ };
3290
+
3291
+ return BaseAdapter;
3292
+ });
3293
+
3294
+ S2.define('select2/data/select',[
3295
+ './base',
3296
+ '../utils',
3297
+ 'jquery'
3298
+ ], function (BaseAdapter, Utils, $) {
3299
+ function SelectAdapter ($element, options) {
3300
+ this.$element = $element;
3301
+ this.options = options;
3302
+
3303
+ SelectAdapter.__super__.constructor.call(this);
3304
+ }
3305
+
3306
+ Utils.Extend(SelectAdapter, BaseAdapter);
3307
+
3308
+ SelectAdapter.prototype.current = function (callback) {
3309
+ var self = this;
3310
+
3311
+ var data = Array.prototype.map.call(
3312
+ this.$element[0].querySelectorAll(':checked'),
3313
+ function (selectedElement) {
3314
+ return self.item($(selectedElement));
3315
+ }
3316
+ );
3317
+
3318
+ callback(data);
3319
+ };
3320
+
3321
+ SelectAdapter.prototype.select = function (data) {
3322
+ var self = this;
3323
+
3324
+ data.selected = true;
3325
+
3326
+ // If data.element is a DOM node, use it instead
3327
+ if (
3328
+ data.element != null && data.element.tagName.toLowerCase() === 'option'
3329
+ ) {
3330
+ data.element.selected = true;
3331
+
3332
+ this.$element.trigger('input').trigger('change');
3333
+
3334
+ return;
3335
+ }
3336
+
3337
+ if (this.$element.prop('multiple')) {
3338
+ this.current(function (currentData) {
3339
+ var val = [];
3340
+
3341
+ data = [data];
3342
+ data.push.apply(data, currentData);
3343
+
3344
+ for (var d = 0; d < data.length; d++) {
3345
+ var id = data[d].id;
3346
+
3347
+ if (val.indexOf(id) === -1) {
3348
+ val.push(id);
3349
+ }
3350
+ }
3351
+
3352
+ self.$element.val(val);
3353
+ self.$element.trigger('input').trigger('change');
3354
+ });
3355
+ } else {
3356
+ var val = data.id;
3357
+
3358
+ this.$element.val(val);
3359
+ this.$element.trigger('input').trigger('change');
3360
+ }
3361
+ };
3362
+
3363
+ SelectAdapter.prototype.unselect = function (data) {
3364
+ var self = this;
3365
+
3366
+ if (!this.$element.prop('multiple')) {
3367
+ return;
3368
+ }
3369
+
3370
+ data.selected = false;
3371
+
3372
+ if (
3373
+ data.element != null &&
3374
+ data.element.tagName.toLowerCase() === 'option'
3375
+ ) {
3376
+ data.element.selected = false;
3377
+
3378
+ this.$element.trigger('input').trigger('change');
3379
+
3380
+ return;
3381
+ }
3382
+
3383
+ this.current(function (currentData) {
3384
+ var val = [];
3385
+
3386
+ for (var d = 0; d < currentData.length; d++) {
3387
+ var id = currentData[d].id;
3388
+
3389
+ if (id !== data.id && val.indexOf(id) === -1) {
3390
+ val.push(id);
3391
+ }
3392
+ }
3393
+
3394
+ self.$element.val(val);
3395
+
3396
+ self.$element.trigger('input').trigger('change');
3397
+ });
3398
+ };
3399
+
3400
+ SelectAdapter.prototype.bind = function (container, $container) {
3401
+ var self = this;
3402
+
3403
+ this.container = container;
3404
+
3405
+ container.on('select', function (params) {
3406
+ self.select(params.data);
3407
+ });
3408
+
3409
+ container.on('unselect', function (params) {
3410
+ self.unselect(params.data);
3411
+ });
3412
+ };
3413
+
3414
+ SelectAdapter.prototype.destroy = function () {
3415
+ // Remove anything added to child elements
3416
+ this.$element.find('*').each(function () {
3417
+ // Remove any custom data set by Select2
3418
+ Utils.RemoveData(this);
3419
+ });
3420
+ };
3421
+
3422
+ SelectAdapter.prototype.query = function (params, callback) {
3423
+ var data = [];
3424
+ var self = this;
3425
+
3426
+ var $options = this.$element.children();
3427
+
3428
+ $options.each(function () {
3429
+ if (
3430
+ this.tagName.toLowerCase() !== 'option' &&
3431
+ this.tagName.toLowerCase() !== 'optgroup'
3432
+ ) {
3433
+ return;
3434
+ }
3435
+
3436
+ var $option = $(this);
3437
+
3438
+ var option = self.item($option);
3439
+
3440
+ var matches = self.matches(params, option);
3441
+
3442
+ if (matches !== null) {
3443
+ data.push(matches);
3444
+ }
3445
+ });
3446
+
3447
+ callback({
3448
+ results: data
3449
+ });
3450
+ };
3451
+
3452
+ SelectAdapter.prototype.addOptions = function ($options) {
3453
+ this.$element.append($options);
3454
+ };
3455
+
3456
+ SelectAdapter.prototype.option = function (data) {
3457
+ var option;
3458
+
3459
+ if (data.children) {
3460
+ option = document.createElement('optgroup');
3461
+ option.label = data.text;
3462
+ } else {
3463
+ option = document.createElement('option');
3464
+
3465
+ if (option.textContent !== undefined) {
3466
+ option.textContent = data.text;
3467
+ } else {
3468
+ option.innerText = data.text;
3469
+ }
3470
+ }
3471
+
3472
+ if (data.id !== undefined) {
3473
+ option.value = data.id;
3474
+ }
3475
+
3476
+ if (data.disabled) {
3477
+ option.disabled = true;
3478
+ }
3479
+
3480
+ if (data.selected) {
3481
+ option.selected = true;
3482
+ }
3483
+
3484
+ if (data.title) {
3485
+ option.title = data.title;
3486
+ }
3487
+
3488
+ var normalizedData = this._normalizeItem(data);
3489
+ normalizedData.element = option;
3490
+
3491
+ // Override the option's data with the combined data
3492
+ Utils.StoreData(option, 'data', normalizedData);
3493
+
3494
+ return $(option);
3495
+ };
3496
+
3497
+ SelectAdapter.prototype.item = function ($option) {
3498
+ var data = {};
3499
+
3500
+ data = Utils.GetData($option[0], 'data');
3501
+
3502
+ if (data != null) {
3503
+ return data;
3504
+ }
3505
+
3506
+ var option = $option[0];
3507
+
3508
+ if (option.tagName.toLowerCase() === 'option') {
3509
+ data = {
3510
+ id: $option.val(),
3511
+ text: $option.text(),
3512
+ disabled: $option.prop('disabled'),
3513
+ selected: $option.prop('selected'),
3514
+ title: $option.prop('title')
3515
+ };
3516
+ } else if (option.tagName.toLowerCase() === 'optgroup') {
3517
+ data = {
3518
+ text: $option.prop('label'),
3519
+ children: [],
3520
+ title: $option.prop('title')
3521
+ };
3522
+
3523
+ var $children = $option.children('option');
3524
+ var children = [];
3525
+
3526
+ for (var c = 0; c < $children.length; c++) {
3527
+ var $child = $($children[c]);
3528
+
3529
+ var child = this.item($child);
3530
+
3531
+ children.push(child);
3532
+ }
3533
+
3534
+ data.children = children;
3535
+ }
3536
+
3537
+ data = this._normalizeItem(data);
3538
+ data.element = $option[0];
3539
+
3540
+ Utils.StoreData($option[0], 'data', data);
3541
+
3542
+ return data;
3543
+ };
3544
+
3545
+ SelectAdapter.prototype._normalizeItem = function (item) {
3546
+ if (item !== Object(item)) {
3547
+ item = {
3548
+ id: item,
3549
+ text: item
3550
+ };
3551
+ }
3552
+
3553
+ item = $.extend({}, {
3554
+ text: ''
3555
+ }, item);
3556
+
3557
+ var defaults = {
3558
+ selected: false,
3559
+ disabled: false
3560
+ };
3561
+
3562
+ if (item.id != null) {
3563
+ item.id = item.id.toString();
3564
+ }
3565
+
3566
+ if (item.text != null) {
3567
+ item.text = item.text.toString();
3568
+ }
3569
+
3570
+ if (item._resultId == null && item.id && this.container != null) {
3571
+ item._resultId = this.generateResultId(this.container, item);
3572
+ }
3573
+
3574
+ return $.extend({}, defaults, item);
3575
+ };
3576
+
3577
+ SelectAdapter.prototype.matches = function (params, data) {
3578
+ var matcher = this.options.get('matcher');
3579
+
3580
+ return matcher(params, data);
3581
+ };
3582
+
3583
+ return SelectAdapter;
3584
+ });
3585
+
3586
+ S2.define('select2/data/array',[
3587
+ './select',
3588
+ '../utils',
3589
+ 'jquery'
3590
+ ], function (SelectAdapter, Utils, $) {
3591
+ function ArrayAdapter ($element, options) {
3592
+ this._dataToConvert = options.get('data') || [];
3593
+
3594
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
3595
+ }
3596
+
3597
+ Utils.Extend(ArrayAdapter, SelectAdapter);
3598
+
3599
+ ArrayAdapter.prototype.bind = function (container, $container) {
3600
+ ArrayAdapter.__super__.bind.call(this, container, $container);
3601
+
3602
+ this.addOptions(this.convertToOptions(this._dataToConvert));
3603
+ };
3604
+
3605
+ ArrayAdapter.prototype.select = function (data) {
3606
+ var $option = this.$element.find('option').filter(function (i, elm) {
3607
+ return elm.value == data.id.toString();
3608
+ });
3609
+
3610
+ if ($option.length === 0) {
3611
+ $option = this.option(data);
3612
+
3613
+ this.addOptions($option);
3614
+ }
3615
+
3616
+ ArrayAdapter.__super__.select.call(this, data);
3617
+ };
3618
+
3619
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3620
+ var self = this;
3621
+
3622
+ var $existing = this.$element.find('option');
3623
+ var existingIds = $existing.map(function () {
3624
+ return self.item($(this)).id;
3625
+ }).get();
3626
+
3627
+ var $options = [];
3628
+
3629
+ // Filter out all items except for the one passed in the argument
3630
+ function onlyItem (item) {
3631
+ return function () {
3632
+ return $(this).val() == item.id;
3633
+ };
3634
+ }
3635
+
3636
+ for (var d = 0; d < data.length; d++) {
3637
+ var item = this._normalizeItem(data[d]);
3638
+
3639
+ // Skip items which were pre-loaded, only merge the data
3640
+ if (existingIds.indexOf(item.id) >= 0) {
3641
+ var $existingOption = $existing.filter(onlyItem(item));
3642
+
3643
+ var existingData = this.item($existingOption);
3644
+ var newData = $.extend(true, {}, item, existingData);
3645
+
3646
+ var $newOption = this.option(newData);
3647
+
3648
+ $existingOption.replaceWith($newOption);
3649
+
3650
+ continue;
3651
+ }
3652
+
3653
+ var $option = this.option(item);
3654
+
3655
+ if (item.children) {
3656
+ var $children = this.convertToOptions(item.children);
3657
+
3658
+ $option.append($children);
3659
+ }
3660
+
3661
+ $options.push($option);
3662
+ }
3663
+
3664
+ return $options;
3665
+ };
3666
+
3667
+ return ArrayAdapter;
3668
+ });
3669
+
3670
+ S2.define('select2/data/ajax',[
3671
+ './array',
3672
+ '../utils',
3673
+ 'jquery'
3674
+ ], function (ArrayAdapter, Utils, $) {
3675
+ function AjaxAdapter ($element, options) {
3676
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3677
+
3678
+ if (this.ajaxOptions.processResults != null) {
3679
+ this.processResults = this.ajaxOptions.processResults;
3680
+ }
3681
+
3682
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3683
+ }
3684
+
3685
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3686
+
3687
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3688
+ var defaults = {
3689
+ data: function (params) {
3690
+ return $.extend({}, params, {
3691
+ q: params.term
3692
+ });
3693
+ },
3694
+ transport: function (params, success, failure) {
3695
+ var $request = $.ajax(params);
3696
+
3697
+ $request.then(success);
3698
+ $request.fail(failure);
3699
+
3700
+ return $request;
3701
+ }
3702
+ };
3703
+
3704
+ return $.extend({}, defaults, options, true);
3705
+ };
3706
+
3707
+ AjaxAdapter.prototype.processResults = function (results) {
3708
+ return results;
3709
+ };
3710
+
3711
+ AjaxAdapter.prototype.query = function (params, callback) {
3712
+ var matches = [];
3713
+ var self = this;
3714
+
3715
+ if (this._request != null) {
3716
+ // JSONP requests cannot always be aborted
3717
+ if (typeof this._request.abort === 'function') {
3718
+ this._request.abort();
3719
+ }
3720
+
3721
+ this._request = null;
3722
+ }
3723
+
3724
+ var options = $.extend({
3725
+ type: 'GET'
3726
+ }, this.ajaxOptions);
3727
+
3728
+ if (typeof options.url === 'function') {
3729
+ options.url = options.url.call(this.$element, params);
3730
+ }
3731
+
3732
+ if (typeof options.data === 'function') {
3733
+ options.data = options.data.call(this.$element, params);
3734
+ }
3735
+
3736
+ function request () {
3737
+ var $request = options.transport(options, function (data) {
3738
+ var results = self.processResults(data, params);
3739
+
3740
+ if (self.options.get('debug') && window.console && console.error) {
3741
+ // Check to make sure that the response included a `results` key.
3742
+ if (!results || !results.results || !Array.isArray(results.results)) {
3743
+ console.error(
3744
+ 'Select2: The AJAX results did not return an array in the ' +
3745
+ '`results` key of the response.'
3746
+ );
3747
+ }
3748
+ }
3749
+
3750
+ callback(results);
3751
+ }, function () {
3752
+ // Attempt to detect if a request was aborted
3753
+ // Only works if the transport exposes a status property
3754
+ if ('status' in $request &&
3755
+ ($request.status === 0 || $request.status === '0')) {
3756
+ return;
3757
+ }
3758
+
3759
+ self.trigger('results:message', {
3760
+ message: 'errorLoading'
3761
+ });
3762
+ });
3763
+
3764
+ self._request = $request;
3765
+ }
3766
+
3767
+ if (this.ajaxOptions.delay && params.term != null) {
3768
+ if (this._queryTimeout) {
3769
+ window.clearTimeout(this._queryTimeout);
3770
+ }
3771
+
3772
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3773
+ } else {
3774
+ request();
3775
+ }
3776
+ };
3777
+
3778
+ return AjaxAdapter;
3779
+ });
3780
+
3781
+ S2.define('select2/data/tags',[
3782
+ 'jquery'
3783
+ ], function ($) {
3784
+ function Tags (decorated, $element, options) {
3785
+ var tags = options.get('tags');
3786
+
3787
+ var createTag = options.get('createTag');
3788
+
3789
+ if (createTag !== undefined) {
3790
+ this.createTag = createTag;
3791
+ }
3792
+
3793
+ var insertTag = options.get('insertTag');
3794
+
3795
+ if (insertTag !== undefined) {
3796
+ this.insertTag = insertTag;
3797
+ }
3798
+
3799
+ decorated.call(this, $element, options);
3800
+
3801
+ if (Array.isArray(tags)) {
3802
+ for (var t = 0; t < tags.length; t++) {
3803
+ var tag = tags[t];
3804
+ var item = this._normalizeItem(tag);
3805
+
3806
+ var $option = this.option(item);
3807
+
3808
+ this.$element.append($option);
3809
+ }
3810
+ }
3811
+ }
3812
+
3813
+ Tags.prototype.query = function (decorated, params, callback) {
3814
+ var self = this;
3815
+
3816
+ this._removeOldTags();
3817
+
3818
+ if (params.term == null || params.page != null) {
3819
+ decorated.call(this, params, callback);
3820
+ return;
3821
+ }
3822
+
3823
+ function wrapper (obj, child) {
3824
+ var data = obj.results;
3825
+
3826
+ for (var i = 0; i < data.length; i++) {
3827
+ var option = data[i];
3828
+
3829
+ var checkChildren = (
3830
+ option.children != null &&
3831
+ !wrapper({
3832
+ results: option.children
3833
+ }, true)
3834
+ );
3835
+
3836
+ var optionText = (option.text || '').toUpperCase();
3837
+ var paramsTerm = (params.term || '').toUpperCase();
3838
+
3839
+ var checkText = optionText === paramsTerm;
3840
+
3841
+ if (checkText || checkChildren) {
3842
+ if (child) {
3843
+ return false;
3844
+ }
3845
+
3846
+ obj.data = data;
3847
+ callback(obj);
3848
+
3849
+ return;
3850
+ }
3851
+ }
3852
+
3853
+ if (child) {
3854
+ return true;
3855
+ }
3856
+
3857
+ var tag = self.createTag(params);
3858
+
3859
+ if (tag != null) {
3860
+ var $option = self.option(tag);
3861
+ $option.attr('data-select2-tag', 'true');
3862
+
3863
+ self.addOptions([$option]);
3864
+
3865
+ self.insertTag(data, tag);
3866
+ }
3867
+
3868
+ obj.results = data;
3869
+
3870
+ callback(obj);
3871
+ }
3872
+
3873
+ decorated.call(this, params, wrapper);
3874
+ };
3875
+
3876
+ Tags.prototype.createTag = function (decorated, params) {
3877
+ if (params.term == null) {
3878
+ return null;
3879
+ }
3880
+
3881
+ var term = params.term.trim();
3882
+
3883
+ if (term === '') {
3884
+ return null;
3885
+ }
3886
+
3887
+ return {
3888
+ id: term,
3889
+ text: term
3890
+ };
3891
+ };
3892
+
3893
+ Tags.prototype.insertTag = function (_, data, tag) {
3894
+ data.unshift(tag);
3895
+ };
3896
+
3897
+ Tags.prototype._removeOldTags = function (_) {
3898
+ var $options = this.$element.find('option[data-select2-tag]');
3899
+
3900
+ $options.each(function () {
3901
+ if (this.selected) {
3902
+ return;
3903
+ }
3904
+
3905
+ $(this).remove();
3906
+ });
3907
+ };
3908
+
3909
+ return Tags;
3910
+ });
3911
+
3912
+ S2.define('select2/data/tokenizer',[
3913
+ 'jquery'
3914
+ ], function ($) {
3915
+ function Tokenizer (decorated, $element, options) {
3916
+ var tokenizer = options.get('tokenizer');
3917
+
3918
+ if (tokenizer !== undefined) {
3919
+ this.tokenizer = tokenizer;
3920
+ }
3921
+
3922
+ decorated.call(this, $element, options);
3923
+ }
3924
+
3925
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3926
+ decorated.call(this, container, $container);
3927
+
3928
+ this.$search = container.dropdown.$search || container.selection.$search ||
3929
+ $container.find('.select2-search__field');
3930
+ };
3931
+
3932
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3933
+ var self = this;
3934
+
3935
+ function createAndSelect (data) {
3936
+ // Normalize the data object so we can use it for checks
3937
+ var item = self._normalizeItem(data);
3938
+
3939
+ // Check if the data object already exists as a tag
3940
+ // Select it if it doesn't
3941
+ var $existingOptions = self.$element.find('option').filter(function () {
3942
+ return $(this).val() === item.id;
3943
+ });
3944
+
3945
+ // If an existing option wasn't found for it, create the option
3946
+ if (!$existingOptions.length) {
3947
+ var $option = self.option(item);
3948
+ $option.attr('data-select2-tag', true);
3949
+
3950
+ self._removeOldTags();
3951
+ self.addOptions([$option]);
3952
+ }
3953
+
3954
+ // Select the item, now that we know there is an option for it
3955
+ select(item);
3956
+ }
3957
+
3958
+ function select (data) {
3959
+ self.trigger('select', {
3960
+ data: data
3961
+ });
3962
+ }
3963
+
3964
+ params.term = params.term || '';
3965
+
3966
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
3967
+
3968
+ if (tokenData.term !== params.term) {
3969
+ // Replace the search term if we have the search box
3970
+ if (this.$search.length) {
3971
+ this.$search.val(tokenData.term);
3972
+ this.$search.trigger('focus');
3973
+ }
3974
+
3975
+ params.term = tokenData.term;
3976
+ }
3977
+
3978
+ decorated.call(this, params, callback);
3979
+ };
3980
+
3981
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3982
+ var separators = options.get('tokenSeparators') || [];
3983
+ var term = params.term;
3984
+ var i = 0;
3985
+
3986
+ var createTag = this.createTag || function (params) {
3987
+ return {
3988
+ id: params.term,
3989
+ text: params.term
3990
+ };
3991
+ };
3992
+
3993
+ while (i < term.length) {
3994
+ var termChar = term[i];
3995
+
3996
+ if (separators.indexOf(termChar) === -1) {
3997
+ i++;
3998
+
3999
+ continue;
4000
+ }
4001
+
4002
+ var part = term.substr(0, i);
4003
+ var partParams = $.extend({}, params, {
4004
+ term: part
4005
+ });
4006
+
4007
+ var data = createTag(partParams);
4008
+
4009
+ if (data == null) {
4010
+ i++;
4011
+ continue;
4012
+ }
4013
+
4014
+ callback(data);
4015
+
4016
+ // Reset the term to not include the tokenized portion
4017
+ term = term.substr(i + 1) || '';
4018
+ i = 0;
4019
+ }
4020
+
4021
+ return {
4022
+ term: term
4023
+ };
4024
+ };
4025
+
4026
+ return Tokenizer;
4027
+ });
4028
+
4029
+ S2.define('select2/data/minimumInputLength',[
4030
+
4031
+ ], function () {
4032
+ function MinimumInputLength (decorated, $e, options) {
4033
+ this.minimumInputLength = options.get('minimumInputLength');
4034
+
4035
+ decorated.call(this, $e, options);
4036
+ }
4037
+
4038
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
4039
+ params.term = params.term || '';
4040
+
4041
+ if (params.term.length < this.minimumInputLength) {
4042
+ this.trigger('results:message', {
4043
+ message: 'inputTooShort',
4044
+ args: {
4045
+ minimum: this.minimumInputLength,
4046
+ input: params.term,
4047
+ params: params
4048
+ }
4049
+ });
4050
+
4051
+ return;
4052
+ }
4053
+
4054
+ decorated.call(this, params, callback);
4055
+ };
4056
+
4057
+ return MinimumInputLength;
4058
+ });
4059
+
4060
+ S2.define('select2/data/maximumInputLength',[
4061
+
4062
+ ], function () {
4063
+ function MaximumInputLength (decorated, $e, options) {
4064
+ this.maximumInputLength = options.get('maximumInputLength');
4065
+
4066
+ decorated.call(this, $e, options);
4067
+ }
4068
+
4069
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
4070
+ params.term = params.term || '';
4071
+
4072
+ if (this.maximumInputLength > 0 &&
4073
+ params.term.length > this.maximumInputLength) {
4074
+ this.trigger('results:message', {
4075
+ message: 'inputTooLong',
4076
+ args: {
4077
+ maximum: this.maximumInputLength,
4078
+ input: params.term,
4079
+ params: params
4080
+ }
4081
+ });
4082
+
4083
+ return;
4084
+ }
4085
+
4086
+ decorated.call(this, params, callback);
4087
+ };
4088
+
4089
+ return MaximumInputLength;
4090
+ });
4091
+
4092
+ S2.define('select2/data/maximumSelectionLength',[
4093
+
4094
+ ], function (){
4095
+ function MaximumSelectionLength (decorated, $e, options) {
4096
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
4097
+
4098
+ decorated.call(this, $e, options);
4099
+ }
4100
+
4101
+ MaximumSelectionLength.prototype.bind =
4102
+ function (decorated, container, $container) {
4103
+ var self = this;
4104
+
4105
+ decorated.call(this, container, $container);
4106
+
4107
+ container.on('select', function () {
4108
+ self._checkIfMaximumSelected();
4109
+ });
4110
+ };
4111
+
4112
+ MaximumSelectionLength.prototype.query =
4113
+ function (decorated, params, callback) {
4114
+ var self = this;
4115
+
4116
+ this._checkIfMaximumSelected(function () {
4117
+ decorated.call(self, params, callback);
4118
+ });
4119
+ };
4120
+
4121
+ MaximumSelectionLength.prototype._checkIfMaximumSelected =
4122
+ function (_, successCallback) {
4123
+ var self = this;
4124
+
4125
+ this.current(function (currentData) {
4126
+ var count = currentData != null ? currentData.length : 0;
4127
+ if (self.maximumSelectionLength > 0 &&
4128
+ count >= self.maximumSelectionLength) {
4129
+ self.trigger('results:message', {
4130
+ message: 'maximumSelected',
4131
+ args: {
4132
+ maximum: self.maximumSelectionLength
4133
+ }
4134
+ });
4135
+ return;
4136
+ }
4137
+
4138
+ if (successCallback) {
4139
+ successCallback();
4140
+ }
4141
+ });
4142
+ };
4143
+
4144
+ return MaximumSelectionLength;
4145
+ });
4146
+
4147
+ S2.define('select2/dropdown',[
4148
+ 'jquery',
4149
+ './utils'
4150
+ ], function ($, Utils) {
4151
+ function Dropdown ($element, options) {
4152
+ this.$element = $element;
4153
+ this.options = options;
4154
+
4155
+ Dropdown.__super__.constructor.call(this);
4156
+ }
4157
+
4158
+ Utils.Extend(Dropdown, Utils.Observable);
4159
+
4160
+ Dropdown.prototype.render = function () {
4161
+ var $dropdown = $(
4162
+ '<span class="select2-dropdown">' +
4163
+ '<span class="select2-results"></span>' +
4164
+ '</span>'
4165
+ );
4166
+
4167
+ $dropdown.attr('dir', this.options.get('dir'));
4168
+
4169
+ this.$dropdown = $dropdown;
4170
+
4171
+ return $dropdown;
4172
+ };
4173
+
4174
+ Dropdown.prototype.bind = function () {
4175
+ // Should be implemented in subclasses
4176
+ };
4177
+
4178
+ Dropdown.prototype.position = function ($dropdown, $container) {
4179
+ // Should be implemented in subclasses
4180
+ };
4181
+
4182
+ Dropdown.prototype.destroy = function () {
4183
+ // Remove the dropdown from the DOM
4184
+ this.$dropdown.remove();
4185
+ };
4186
+
4187
+ return Dropdown;
4188
+ });
4189
+
4190
+ S2.define('select2/dropdown/search',[
4191
+ 'jquery'
4192
+ ], function ($) {
4193
+ function Search () { }
4194
+
4195
+ Search.prototype.render = function (decorated) {
4196
+ var $rendered = decorated.call(this);
4197
+ var searchLabel = this.options.get('translations').get('search');
4198
+
4199
+ var $search = $(
4200
+ '<span class="select2-search select2-search--dropdown">' +
4201
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
4202
+ ' autocorrect="off" autocapitalize="none"' +
4203
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
4204
+ '</span>'
4205
+ );
4206
+
4207
+ this.$searchContainer = $search;
4208
+ this.$search = $search.find('input');
4209
+
4210
+ this.$search.prop('autocomplete', this.options.get('autocomplete'));
4211
+ this.$search.attr('aria-label', searchLabel());
4212
+
4213
+ $rendered.prepend($search);
4214
+
4215
+ return $rendered;
4216
+ };
4217
+
4218
+ Search.prototype.bind = function (decorated, container, $container) {
4219
+ var self = this;
4220
+
4221
+ var resultsId = container.id + '-results';
4222
+
4223
+ decorated.call(this, container, $container);
4224
+
4225
+ this.$search.on('keydown', function (evt) {
4226
+ self.trigger('keypress', evt);
4227
+
4228
+ self._keyUpPrevented = evt.isDefaultPrevented();
4229
+ });
4230
+
4231
+ // Workaround for browsers which do not support the `input` event
4232
+ // This will prevent double-triggering of events for browsers which support
4233
+ // both the `keyup` and `input` events.
4234
+ this.$search.on('input', function (evt) {
4235
+ // Unbind the duplicated `keyup` event
4236
+ $(this).off('keyup');
4237
+ });
4238
+
4239
+ this.$search.on('keyup input', function (evt) {
4240
+ self.handleSearch(evt);
4241
+ });
4242
+
4243
+ container.on('open', function () {
4244
+ self.$search.attr('tabindex', 0);
4245
+ self.$search.attr('aria-controls', resultsId);
4246
+
4247
+ self.$search.trigger('focus');
4248
+
4249
+ window.setTimeout(function () {
4250
+ self.$search.trigger('focus');
4251
+ }, 0);
4252
+ });
4253
+
4254
+ container.on('close', function () {
4255
+ self.$search.attr('tabindex', -1);
4256
+ self.$search.removeAttr('aria-controls');
4257
+ self.$search.removeAttr('aria-activedescendant');
4258
+
4259
+ self.$search.val('');
4260
+ self.$search.trigger('blur');
4261
+ });
4262
+
4263
+ container.on('focus', function () {
4264
+ if (!container.isOpen()) {
4265
+ self.$search.trigger('focus');
4266
+ }
4267
+ });
4268
+
4269
+ container.on('results:all', function (params) {
4270
+ if (params.query.term == null || params.query.term === '') {
4271
+ var showSearch = self.showSearch(params);
4272
+
4273
+ if (showSearch) {
4274
+ self.$searchContainer[0].classList.remove('select2-search--hide');
4275
+ } else {
4276
+ self.$searchContainer[0].classList.add('select2-search--hide');
4277
+ }
4278
+ }
4279
+ });
4280
+
4281
+ container.on('results:focus', function (params) {
4282
+ if (params.data._resultId) {
4283
+ self.$search.attr('aria-activedescendant', params.data._resultId);
4284
+ } else {
4285
+ self.$search.removeAttr('aria-activedescendant');
4286
+ }
4287
+ });
4288
+ };
4289
+
4290
+ Search.prototype.handleSearch = function (evt) {
4291
+ if (!this._keyUpPrevented) {
4292
+ var input = this.$search.val();
4293
+
4294
+ this.trigger('query', {
4295
+ term: input
4296
+ });
4297
+ }
4298
+
4299
+ this._keyUpPrevented = false;
4300
+ };
4301
+
4302
+ Search.prototype.showSearch = function (_, params) {
4303
+ return true;
4304
+ };
4305
+
4306
+ return Search;
4307
+ });
4308
+
4309
+ S2.define('select2/dropdown/hidePlaceholder',[
4310
+
4311
+ ], function () {
4312
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4313
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4314
+
4315
+ decorated.call(this, $element, options, dataAdapter);
4316
+ }
4317
+
4318
+ HidePlaceholder.prototype.append = function (decorated, data) {
4319
+ data.results = this.removePlaceholder(data.results);
4320
+
4321
+ decorated.call(this, data);
4322
+ };
4323
+
4324
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4325
+ if (typeof placeholder === 'string') {
4326
+ placeholder = {
4327
+ id: '',
4328
+ text: placeholder
4329
+ };
4330
+ }
4331
+
4332
+ return placeholder;
4333
+ };
4334
+
4335
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4336
+ var modifiedData = data.slice(0);
4337
+
4338
+ for (var d = data.length - 1; d >= 0; d--) {
4339
+ var item = data[d];
4340
+
4341
+ if (this.placeholder.id === item.id) {
4342
+ modifiedData.splice(d, 1);
4343
+ }
4344
+ }
4345
+
4346
+ return modifiedData;
4347
+ };
4348
+
4349
+ return HidePlaceholder;
4350
+ });
4351
+
4352
+ S2.define('select2/dropdown/infiniteScroll',[
4353
+ 'jquery'
4354
+ ], function ($) {
4355
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4356
+ this.lastParams = {};
4357
+
4358
+ decorated.call(this, $element, options, dataAdapter);
4359
+
4360
+ this.$loadingMore = this.createLoadingMore();
4361
+ this.loading = false;
4362
+ }
4363
+
4364
+ InfiniteScroll.prototype.append = function (decorated, data) {
4365
+ this.$loadingMore.remove();
4366
+ this.loading = false;
4367
+
4368
+ decorated.call(this, data);
4369
+
4370
+ if (this.showLoadingMore(data)) {
4371
+ this.$results.append(this.$loadingMore);
4372
+ this.loadMoreIfNeeded();
4373
+ }
4374
+ };
4375
+
4376
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4377
+ var self = this;
4378
+
4379
+ decorated.call(this, container, $container);
4380
+
4381
+ container.on('query', function (params) {
4382
+ self.lastParams = params;
4383
+ self.loading = true;
4384
+ });
4385
+
4386
+ container.on('query:append', function (params) {
4387
+ self.lastParams = params;
4388
+ self.loading = true;
4389
+ });
4390
+
4391
+ this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));
4392
+ };
4393
+
4394
+ InfiniteScroll.prototype.loadMoreIfNeeded = function () {
4395
+ var isLoadMoreVisible = $.contains(
4396
+ document.documentElement,
4397
+ this.$loadingMore[0]
4398
+ );
4399
+
4400
+ if (this.loading || !isLoadMoreVisible) {
4401
+ return;
4402
+ }
4403
+
4404
+ var currentOffset = this.$results.offset().top +
4405
+ this.$results.outerHeight(false);
4406
+ var loadingMoreOffset = this.$loadingMore.offset().top +
4407
+ this.$loadingMore.outerHeight(false);
4408
+
4409
+ if (currentOffset + 50 >= loadingMoreOffset) {
4410
+ this.loadMore();
4411
+ }
4412
+ };
4413
+
4414
+ InfiniteScroll.prototype.loadMore = function () {
4415
+ this.loading = true;
4416
+
4417
+ var params = $.extend({}, {page: 1}, this.lastParams);
4418
+
4419
+ params.page++;
4420
+
4421
+ this.trigger('query:append', params);
4422
+ };
4423
+
4424
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4425
+ return data.pagination && data.pagination.more;
4426
+ };
4427
+
4428
+ InfiniteScroll.prototype.createLoadingMore = function () {
4429
+ var $option = $(
4430
+ '<li ' +
4431
+ 'class="select2-results__option select2-results__option--load-more"' +
4432
+ 'role="option" aria-disabled="true"></li>'
4433
+ );
4434
+
4435
+ var message = this.options.get('translations').get('loadingMore');
4436
+
4437
+ $option.html(message(this.lastParams));
4438
+
4439
+ return $option;
4440
+ };
4441
+
4442
+ return InfiniteScroll;
4443
+ });
4444
+
4445
+ S2.define('select2/dropdown/attachBody',[
4446
+ 'jquery',
4447
+ '../utils'
4448
+ ], function ($, Utils) {
4449
+ function AttachBody (decorated, $element, options) {
4450
+ this.$dropdownParent = $(options.get('dropdownParent') || document.body);
4451
+
4452
+ decorated.call(this, $element, options);
4453
+ }
4454
+
4455
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4456
+ var self = this;
4457
+
4458
+ decorated.call(this, container, $container);
4459
+
4460
+ container.on('open', function () {
4461
+ self._showDropdown();
4462
+ self._attachPositioningHandler(container);
4463
+
4464
+ // Must bind after the results handlers to ensure correct sizing
4465
+ self._bindContainerResultHandlers(container);
4466
+ });
4467
+
4468
+ container.on('close', function () {
4469
+ self._hideDropdown();
4470
+ self._detachPositioningHandler(container);
4471
+ });
4472
+
4473
+ this.$dropdownContainer.on('mousedown', function (evt) {
4474
+ evt.stopPropagation();
4475
+ });
4476
+ };
4477
+
4478
+ AttachBody.prototype.destroy = function (decorated) {
4479
+ decorated.call(this);
4480
+
4481
+ this.$dropdownContainer.remove();
4482
+ };
4483
+
4484
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4485
+ // Clone all of the container classes
4486
+ $dropdown.attr('class', $container.attr('class'));
4487
+
4488
+ $dropdown[0].classList.remove('select2');
4489
+ $dropdown[0].classList.add('select2-container--open');
4490
+
4491
+ $dropdown.css({
4492
+ position: 'absolute',
4493
+ top: -999999
4494
+ });
4495
+
4496
+ this.$container = $container;
4497
+ };
4498
+
4499
+ AttachBody.prototype.render = function (decorated) {
4500
+ var $container = $('<span></span>');
4501
+
4502
+ var $dropdown = decorated.call(this);
4503
+ $container.append($dropdown);
4504
+
4505
+ this.$dropdownContainer = $container;
4506
+
4507
+ return $container;
4508
+ };
4509
+
4510
+ AttachBody.prototype._hideDropdown = function (decorated) {
4511
+ this.$dropdownContainer.detach();
4512
+ };
4513
+
4514
+ AttachBody.prototype._bindContainerResultHandlers =
4515
+ function (decorated, container) {
4516
+
4517
+ // These should only be bound once
4518
+ if (this._containerResultsHandlersBound) {
4519
+ return;
4520
+ }
4521
+
4522
+ var self = this;
4523
+
4524
+ container.on('results:all', function () {
4525
+ self._positionDropdown();
4526
+ self._resizeDropdown();
4527
+ });
4528
+
4529
+ container.on('results:append', function () {
4530
+ self._positionDropdown();
4531
+ self._resizeDropdown();
4532
+ });
4533
+
4534
+ container.on('results:message', function () {
4535
+ self._positionDropdown();
4536
+ self._resizeDropdown();
4537
+ });
4538
+
4539
+ container.on('select', function () {
4540
+ self._positionDropdown();
4541
+ self._resizeDropdown();
4542
+ });
4543
+
4544
+ container.on('unselect', function () {
4545
+ self._positionDropdown();
4546
+ self._resizeDropdown();
4547
+ });
4548
+
4549
+ this._containerResultsHandlersBound = true;
4550
+ };
4551
+
4552
+ AttachBody.prototype._attachPositioningHandler =
4553
+ function (decorated, container) {
4554
+ var self = this;
4555
+
4556
+ var scrollEvent = 'scroll.select2.' + container.id;
4557
+ var resizeEvent = 'resize.select2.' + container.id;
4558
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4559
+
4560
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4561
+ $watchers.each(function () {
4562
+ Utils.StoreData(this, 'select2-scroll-position', {
4563
+ x: $(this).scrollLeft(),
4564
+ y: $(this).scrollTop()
4565
+ });
4566
+ });
4567
+
4568
+ $watchers.on(scrollEvent, function (ev) {
4569
+ var position = Utils.GetData(this, 'select2-scroll-position');
4570
+ $(this).scrollTop(position.y);
4571
+ });
4572
+
4573
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4574
+ function (e) {
4575
+ self._positionDropdown();
4576
+ self._resizeDropdown();
4577
+ });
4578
+ };
4579
+
4580
+ AttachBody.prototype._detachPositioningHandler =
4581
+ function (decorated, container) {
4582
+ var scrollEvent = 'scroll.select2.' + container.id;
4583
+ var resizeEvent = 'resize.select2.' + container.id;
4584
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4585
+
4586
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4587
+ $watchers.off(scrollEvent);
4588
+
4589
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4590
+ };
4591
+
4592
+ AttachBody.prototype._positionDropdown = function () {
4593
+ var $window = $(window);
4594
+
4595
+ var isCurrentlyAbove = this.$dropdown[0].classList
4596
+ .contains('select2-dropdown--above');
4597
+ var isCurrentlyBelow = this.$dropdown[0].classList
4598
+ .contains('select2-dropdown--below');
4599
+
4600
+ var newDirection = null;
4601
+
4602
+ var offset = this.$container.offset();
4603
+
4604
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4605
+
4606
+ var container = {
4607
+ height: this.$container.outerHeight(false)
4608
+ };
4609
+
4610
+ container.top = offset.top;
4611
+ container.bottom = offset.top + container.height;
4612
+
4613
+ var dropdown = {
4614
+ height: this.$dropdown.outerHeight(false)
4615
+ };
4616
+
4617
+ var viewport = {
4618
+ top: $window.scrollTop(),
4619
+ bottom: $window.scrollTop() + $window.height()
4620
+ };
4621
+
4622
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4623
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4624
+
4625
+ var css = {
4626
+ left: offset.left,
4627
+ top: container.bottom
4628
+ };
4629
+
4630
+ // Determine what the parent element is to use for calculating the offset
4631
+ var $offsetParent = this.$dropdownParent;
4632
+
4633
+ // For statically positioned elements, we need to get the element
4634
+ // that is determining the offset
4635
+ if ($offsetParent.css('position') === 'static') {
4636
+ $offsetParent = $offsetParent.offsetParent();
4637
+ }
4638
+
4639
+ var parentOffset = {
4640
+ top: 0,
4641
+ left: 0
4642
+ };
4643
+
4644
+ if (
4645
+ $.contains(document.body, $offsetParent[0]) ||
4646
+ $offsetParent[0].isConnected
4647
+ ) {
4648
+ parentOffset = $offsetParent.offset();
4649
+ }
4650
+
4651
+ css.top -= parentOffset.top;
4652
+ css.left -= parentOffset.left;
4653
+
4654
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4655
+ newDirection = 'below';
4656
+ }
4657
+
4658
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4659
+ newDirection = 'above';
4660
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4661
+ newDirection = 'below';
4662
+ }
4663
+
4664
+ if (newDirection == 'above' ||
4665
+ (isCurrentlyAbove && newDirection !== 'below')) {
4666
+ css.top = container.top - parentOffset.top - dropdown.height;
4667
+ }
4668
+
4669
+ if (newDirection != null) {
4670
+ this.$dropdown[0].classList.remove('select2-dropdown--below');
4671
+ this.$dropdown[0].classList.remove('select2-dropdown--above');
4672
+ this.$dropdown[0].classList.add('select2-dropdown--' + newDirection);
4673
+
4674
+ this.$container[0].classList.remove('select2-container--below');
4675
+ this.$container[0].classList.remove('select2-container--above');
4676
+ this.$container[0].classList.add('select2-container--' + newDirection);
4677
+ }
4678
+
4679
+ this.$dropdownContainer.css(css);
4680
+ };
4681
+
4682
+ AttachBody.prototype._resizeDropdown = function () {
4683
+ var css = {
4684
+ width: this.$container.outerWidth(false) + 'px'
4685
+ };
4686
+
4687
+ if (this.options.get('dropdownAutoWidth')) {
4688
+ css.minWidth = css.width;
4689
+ css.position = 'relative';
4690
+ css.width = 'auto';
4691
+ }
4692
+
4693
+ this.$dropdown.css(css);
4694
+ };
4695
+
4696
+ AttachBody.prototype._showDropdown = function (decorated) {
4697
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4698
+
4699
+ this._positionDropdown();
4700
+ this._resizeDropdown();
4701
+ };
4702
+
4703
+ return AttachBody;
4704
+ });
4705
+
4706
+ S2.define('select2/dropdown/minimumResultsForSearch',[
4707
+
4708
+ ], function () {
4709
+ function countResults (data) {
4710
+ var count = 0;
4711
+
4712
+ for (var d = 0; d < data.length; d++) {
4713
+ var item = data[d];
4714
+
4715
+ if (item.children) {
4716
+ count += countResults(item.children);
4717
+ } else {
4718
+ count++;
4719
+ }
4720
+ }
4721
+
4722
+ return count;
4723
+ }
4724
+
4725
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4726
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4727
+
4728
+ if (this.minimumResultsForSearch < 0) {
4729
+ this.minimumResultsForSearch = Infinity;
4730
+ }
4731
+
4732
+ decorated.call(this, $element, options, dataAdapter);
4733
+ }
4734
+
4735
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4736
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4737
+ return false;
4738
+ }
4739
+
4740
+ return decorated.call(this, params);
4741
+ };
4742
+
4743
+ return MinimumResultsForSearch;
4744
+ });
4745
+
4746
+ S2.define('select2/dropdown/selectOnClose',[
4747
+ '../utils'
4748
+ ], function (Utils) {
4749
+ function SelectOnClose () { }
4750
+
4751
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4752
+ var self = this;
4753
+
4754
+ decorated.call(this, container, $container);
4755
+
4756
+ container.on('close', function (params) {
4757
+ self._handleSelectOnClose(params);
4758
+ });
4759
+ };
4760
+
4761
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4762
+ if (params && params.originalSelect2Event != null) {
4763
+ var event = params.originalSelect2Event;
4764
+
4765
+ // Don't select an item if the close event was triggered from a select or
4766
+ // unselect event
4767
+ if (event._type === 'select' || event._type === 'unselect') {
4768
+ return;
4769
+ }
4770
+ }
4771
+
4772
+ var $highlightedResults = this.getHighlightedResults();
4773
+
4774
+ // Only select highlighted results
4775
+ if ($highlightedResults.length < 1) {
4776
+ return;
4777
+ }
4778
+
4779
+ var data = Utils.GetData($highlightedResults[0], 'data');
4780
+
4781
+ // Don't re-select already selected resulte
4782
+ if (
4783
+ (data.element != null && data.element.selected) ||
4784
+ (data.element == null && data.selected)
4785
+ ) {
4786
+ return;
4787
+ }
4788
+
4789
+ this.trigger('select', {
4790
+ data: data
4791
+ });
4792
+ };
4793
+
4794
+ return SelectOnClose;
4795
+ });
4796
+
4797
+ S2.define('select2/dropdown/closeOnSelect',[
4798
+
4799
+ ], function () {
4800
+ function CloseOnSelect () { }
4801
+
4802
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4803
+ var self = this;
4804
+
4805
+ decorated.call(this, container, $container);
4806
+
4807
+ container.on('select', function (evt) {
4808
+ self._selectTriggered(evt);
4809
+ });
4810
+
4811
+ container.on('unselect', function (evt) {
4812
+ self._selectTriggered(evt);
4813
+ });
4814
+ };
4815
+
4816
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4817
+ var originalEvent = evt.originalEvent;
4818
+
4819
+ // Don't close if the control key is being held
4820
+ if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
4821
+ return;
4822
+ }
4823
+
4824
+ this.trigger('close', {
4825
+ originalEvent: originalEvent,
4826
+ originalSelect2Event: evt
4827
+ });
4828
+ };
4829
+
4830
+ return CloseOnSelect;
4831
+ });
4832
+
4833
+ S2.define('select2/dropdown/dropdownCss',[
4834
+ '../utils'
4835
+ ], function (Utils) {
4836
+ function DropdownCSS () { }
4837
+
4838
+ DropdownCSS.prototype.render = function (decorated) {
4839
+ var $dropdown = decorated.call(this);
4840
+
4841
+ var dropdownCssClass = this.options.get('dropdownCssClass') || '';
4842
+
4843
+ if (dropdownCssClass.indexOf(':all:') !== -1) {
4844
+ dropdownCssClass = dropdownCssClass.replace(':all:', '');
4845
+
4846
+ Utils.copyNonInternalCssClasses($dropdown[0], this.$element[0]);
4847
+ }
4848
+
4849
+ $dropdown.addClass(dropdownCssClass);
4850
+
4851
+ return $dropdown;
4852
+ };
4853
+
4854
+ return DropdownCSS;
4855
+ });
4856
+
4857
+ S2.define('select2/dropdown/tagsSearchHighlight',[
4858
+ '../utils'
4859
+ ], function (Utils) {
4860
+ function TagsSearchHighlight () { }
4861
+
4862
+ TagsSearchHighlight.prototype.highlightFirstItem = function (decorated) {
4863
+ var $options = this.$results
4864
+ .find(
4865
+ '.select2-results__option--selectable' +
4866
+ ':not(.select2-results__option--selected)'
4867
+ );
4868
+
4869
+ if ($options.length > 0) {
4870
+ var $firstOption = $options.first();
4871
+ var data = Utils.GetData($firstOption[0], 'data');
4872
+ var firstElement = data.element;
4873
+
4874
+ if (firstElement && firstElement.getAttribute) {
4875
+ if (firstElement.getAttribute('data-select2-tag') === 'true') {
4876
+ $firstOption.trigger('mouseenter');
4877
+
4878
+ return;
4879
+ }
4880
+ }
4881
+ }
4882
+
4883
+ decorated.call(this);
4884
+ };
4885
+
4886
+ return TagsSearchHighlight;
4887
+ });
4888
+
4889
+ S2.define('select2/i18n/en',[],function () {
4890
+ // English
4891
+ return {
4892
+ errorLoading: function () {
4893
+ return 'The results could not be loaded.';
4894
+ },
4895
+ inputTooLong: function (args) {
4896
+ var overChars = args.input.length - args.maximum;
4897
+
4898
+ var message = 'Please delete ' + overChars + ' character';
4899
+
4900
+ if (overChars != 1) {
4901
+ message += 's';
4902
+ }
4903
+
4904
+ return message;
4905
+ },
4906
+ inputTooShort: function (args) {
4907
+ var remainingChars = args.minimum - args.input.length;
4908
+
4909
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4910
+
4911
+ return message;
4912
+ },
4913
+ loadingMore: function () {
4914
+ return 'Loading more results…';
4915
+ },
4916
+ maximumSelected: function (args) {
4917
+ var message = 'You can only select ' + args.maximum + ' item';
4918
+
4919
+ if (args.maximum != 1) {
4920
+ message += 's';
4921
+ }
4922
+
4923
+ return message;
4924
+ },
4925
+ noResults: function () {
4926
+ return 'No results found';
4927
+ },
4928
+ searching: function () {
4929
+ return 'Searching…';
4930
+ },
4931
+ removeAllItems: function () {
4932
+ return 'Remove all items';
4933
+ },
4934
+ removeItem: function () {
4935
+ return 'Remove item';
4936
+ },
4937
+ search: function() {
4938
+ return 'Search';
4939
+ }
4940
+ };
4941
+ });
4942
+
4943
+ S2.define('select2/defaults',[
4944
+ 'jquery',
4945
+
4946
+ './results',
4947
+
4948
+ './selection/single',
4949
+ './selection/multiple',
4950
+ './selection/placeholder',
4951
+ './selection/allowClear',
4952
+ './selection/search',
4953
+ './selection/selectionCss',
4954
+ './selection/eventRelay',
4955
+
4956
+ './utils',
4957
+ './translation',
4958
+ './diacritics',
4959
+
4960
+ './data/select',
4961
+ './data/array',
4962
+ './data/ajax',
4963
+ './data/tags',
4964
+ './data/tokenizer',
4965
+ './data/minimumInputLength',
4966
+ './data/maximumInputLength',
4967
+ './data/maximumSelectionLength',
4968
+
4969
+ './dropdown',
4970
+ './dropdown/search',
4971
+ './dropdown/hidePlaceholder',
4972
+ './dropdown/infiniteScroll',
4973
+ './dropdown/attachBody',
4974
+ './dropdown/minimumResultsForSearch',
4975
+ './dropdown/selectOnClose',
4976
+ './dropdown/closeOnSelect',
4977
+ './dropdown/dropdownCss',
4978
+ './dropdown/tagsSearchHighlight',
4979
+
4980
+ './i18n/en'
4981
+ ], function ($,
4982
+
4983
+ ResultsList,
4984
+
4985
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4986
+ SelectionSearch, SelectionCSS, EventRelay,
4987
+
4988
+ Utils, Translation, DIACRITICS,
4989
+
4990
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4991
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4992
+
4993
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4994
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4995
+ DropdownCSS, TagsSearchHighlight,
4996
+
4997
+ EnglishTranslation) {
4998
+ function Defaults () {
4999
+ this.reset();
5000
+ }
5001
+
5002
+ Defaults.prototype.apply = function (options) {
5003
+ options = $.extend(true, {}, this.defaults, options);
5004
+
5005
+ if (options.dataAdapter == null) {
5006
+ if (options.ajax != null) {
5007
+ options.dataAdapter = AjaxData;
5008
+ } else if (options.data != null) {
5009
+ options.dataAdapter = ArrayData;
5010
+ } else {
5011
+ options.dataAdapter = SelectData;
5012
+ }
5013
+
5014
+ if (options.minimumInputLength > 0) {
5015
+ options.dataAdapter = Utils.Decorate(
5016
+ options.dataAdapter,
5017
+ MinimumInputLength
5018
+ );
5019
+ }
5020
+
5021
+ if (options.maximumInputLength > 0) {
5022
+ options.dataAdapter = Utils.Decorate(
5023
+ options.dataAdapter,
5024
+ MaximumInputLength
5025
+ );
5026
+ }
5027
+
5028
+ if (options.maximumSelectionLength > 0) {
5029
+ options.dataAdapter = Utils.Decorate(
5030
+ options.dataAdapter,
5031
+ MaximumSelectionLength
5032
+ );
5033
+ }
5034
+
5035
+ if (options.tags) {
5036
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
5037
+ }
5038
+
5039
+ if (options.tokenSeparators != null || options.tokenizer != null) {
5040
+ options.dataAdapter = Utils.Decorate(
5041
+ options.dataAdapter,
5042
+ Tokenizer
5043
+ );
5044
+ }
5045
+ }
5046
+
5047
+ if (options.resultsAdapter == null) {
5048
+ options.resultsAdapter = ResultsList;
5049
+
5050
+ if (options.ajax != null) {
5051
+ options.resultsAdapter = Utils.Decorate(
5052
+ options.resultsAdapter,
5053
+ InfiniteScroll
5054
+ );
5055
+ }
5056
+
5057
+ if (options.placeholder != null) {
5058
+ options.resultsAdapter = Utils.Decorate(
5059
+ options.resultsAdapter,
5060
+ HidePlaceholder
5061
+ );
5062
+ }
5063
+
5064
+ if (options.selectOnClose) {
5065
+ options.resultsAdapter = Utils.Decorate(
5066
+ options.resultsAdapter,
5067
+ SelectOnClose
5068
+ );
5069
+ }
5070
+
5071
+ if (options.tags) {
5072
+ options.resultsAdapter = Utils.Decorate(
5073
+ options.resultsAdapter,
5074
+ TagsSearchHighlight
5075
+ );
5076
+ }
5077
+ }
5078
+
5079
+ if (options.dropdownAdapter == null) {
5080
+ if (options.multiple) {
5081
+ options.dropdownAdapter = Dropdown;
5082
+ } else {
5083
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
5084
+
5085
+ options.dropdownAdapter = SearchableDropdown;
5086
+ }
5087
+
5088
+ if (options.minimumResultsForSearch !== 0) {
5089
+ options.dropdownAdapter = Utils.Decorate(
5090
+ options.dropdownAdapter,
5091
+ MinimumResultsForSearch
5092
+ );
5093
+ }
5094
+
5095
+ if (options.closeOnSelect) {
5096
+ options.dropdownAdapter = Utils.Decorate(
5097
+ options.dropdownAdapter,
5098
+ CloseOnSelect
5099
+ );
5100
+ }
5101
+
5102
+ if (options.dropdownCssClass != null) {
5103
+ options.dropdownAdapter = Utils.Decorate(
5104
+ options.dropdownAdapter,
5105
+ DropdownCSS
5106
+ );
5107
+ }
5108
+
5109
+ options.dropdownAdapter = Utils.Decorate(
5110
+ options.dropdownAdapter,
5111
+ AttachBody
5112
+ );
5113
+ }
5114
+
5115
+ if (options.selectionAdapter == null) {
5116
+ if (options.multiple) {
5117
+ options.selectionAdapter = MultipleSelection;
5118
+ } else {
5119
+ options.selectionAdapter = SingleSelection;
5120
+ }
5121
+
5122
+ // Add the placeholder mixin if a placeholder was specified
5123
+ if (options.placeholder != null) {
5124
+ options.selectionAdapter = Utils.Decorate(
5125
+ options.selectionAdapter,
5126
+ Placeholder
5127
+ );
5128
+ }
5129
+
5130
+ if (options.allowClear) {
5131
+ options.selectionAdapter = Utils.Decorate(
5132
+ options.selectionAdapter,
5133
+ AllowClear
5134
+ );
5135
+ }
5136
+
5137
+ if (options.multiple) {
5138
+ options.selectionAdapter = Utils.Decorate(
5139
+ options.selectionAdapter,
5140
+ SelectionSearch
5141
+ );
5142
+ }
5143
+
5144
+ if (options.selectionCssClass != null) {
5145
+ options.selectionAdapter = Utils.Decorate(
5146
+ options.selectionAdapter,
5147
+ SelectionCSS
5148
+ );
5149
+ }
5150
+
5151
+ options.selectionAdapter = Utils.Decorate(
5152
+ options.selectionAdapter,
5153
+ EventRelay
5154
+ );
5155
+ }
5156
+
5157
+ // If the defaults were not previously applied from an element, it is
5158
+ // possible for the language option to have not been resolved
5159
+ options.language = this._resolveLanguage(options.language);
5160
+
5161
+ // Always fall back to English since it will always be complete
5162
+ options.language.push('en');
5163
+
5164
+ var uniqueLanguages = [];
5165
+
5166
+ for (var l = 0; l < options.language.length; l++) {
5167
+ var language = options.language[l];
5168
+
5169
+ if (uniqueLanguages.indexOf(language) === -1) {
5170
+ uniqueLanguages.push(language);
5171
+ }
5172
+ }
5173
+
5174
+ options.language = uniqueLanguages;
5175
+
5176
+ options.translations = this._processTranslations(
5177
+ options.language,
5178
+ options.debug
5179
+ );
5180
+
5181
+ return options;
5182
+ };
5183
+
5184
+ Defaults.prototype.reset = function () {
5185
+ function stripDiacritics (text) {
5186
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
5187
+ function match(a) {
5188
+ return DIACRITICS[a] || a;
5189
+ }
5190
+
5191
+ return text.replace(/[^\u0000-\u007E]/g, match);
5192
+ }
5193
+
5194
+ function matcher (params, data) {
5195
+ // Always return the object if there is nothing to compare
5196
+ if (params.term == null || params.term.trim() === '') {
5197
+ return data;
5198
+ }
5199
+
5200
+ // Do a recursive check for options with children
5201
+ if (data.children && data.children.length > 0) {
5202
+ // Clone the data object if there are children
5203
+ // This is required as we modify the object to remove any non-matches
5204
+ var match = $.extend(true, {}, data);
5205
+
5206
+ // Check each child of the option
5207
+ for (var c = data.children.length - 1; c >= 0; c--) {
5208
+ var child = data.children[c];
5209
+
5210
+ var matches = matcher(params, child);
5211
+
5212
+ // If there wasn't a match, remove the object in the array
5213
+ if (matches == null) {
5214
+ match.children.splice(c, 1);
5215
+ }
5216
+ }
5217
+
5218
+ // If any children matched, return the new object
5219
+ if (match.children.length > 0) {
5220
+ return match;
5221
+ }
5222
+
5223
+ // If there were no matching children, check just the plain object
5224
+ return matcher(params, match);
5225
+ }
5226
+
5227
+ var original = stripDiacritics(data.text).toUpperCase();
5228
+ var term = stripDiacritics(params.term).toUpperCase();
5229
+
5230
+ // Check if the text contains the term
5231
+ if (original.indexOf(term) > -1) {
5232
+ return data;
5233
+ }
5234
+
5235
+ // If it doesn't contain the term, don't return anything
5236
+ return null;
5237
+ }
5238
+
5239
+ this.defaults = {
5240
+ amdLanguageBase: './i18n/',
5241
+ autocomplete: 'off',
5242
+ closeOnSelect: true,
5243
+ debug: false,
5244
+ dropdownAutoWidth: false,
5245
+ escapeMarkup: Utils.escapeMarkup,
5246
+ language: {},
5247
+ matcher: matcher,
5248
+ minimumInputLength: 0,
5249
+ maximumInputLength: 0,
5250
+ maximumSelectionLength: 0,
5251
+ minimumResultsForSearch: 0,
5252
+ selectOnClose: false,
5253
+ scrollAfterSelect: false,
5254
+ sorter: function (data) {
5255
+ return data;
5256
+ },
5257
+ templateResult: function (result) {
5258
+ return result.text;
5259
+ },
5260
+ templateSelection: function (selection) {
5261
+ return selection.text;
5262
+ },
5263
+ theme: 'default',
5264
+ width: 'resolve'
5265
+ };
5266
+ };
5267
+
5268
+ Defaults.prototype.applyFromElement = function (options, $element) {
5269
+ var optionLanguage = options.language;
5270
+ var defaultLanguage = this.defaults.language;
5271
+ var elementLanguage = $element.prop('lang');
5272
+ var parentLanguage = $element.closest('[lang]').prop('lang');
5273
+
5274
+ var languages = Array.prototype.concat.call(
5275
+ this._resolveLanguage(elementLanguage),
5276
+ this._resolveLanguage(optionLanguage),
5277
+ this._resolveLanguage(defaultLanguage),
5278
+ this._resolveLanguage(parentLanguage)
5279
+ );
5280
+
5281
+ options.language = languages;
5282
+
5283
+ return options;
5284
+ };
5285
+
5286
+ Defaults.prototype._resolveLanguage = function (language) {
5287
+ if (!language) {
5288
+ return [];
5289
+ }
5290
+
5291
+ if ($.isEmptyObject(language)) {
5292
+ return [];
5293
+ }
5294
+
5295
+ if ($.isPlainObject(language)) {
5296
+ return [language];
5297
+ }
5298
+
5299
+ var languages;
5300
+
5301
+ if (!Array.isArray(language)) {
5302
+ languages = [language];
5303
+ } else {
5304
+ languages = language;
5305
+ }
5306
+
5307
+ var resolvedLanguages = [];
5308
+
5309
+ for (var l = 0; l < languages.length; l++) {
5310
+ resolvedLanguages.push(languages[l]);
5311
+
5312
+ if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {
5313
+ // Extract the region information if it is included
5314
+ var languageParts = languages[l].split('-');
5315
+ var baseLanguage = languageParts[0];
5316
+
5317
+ resolvedLanguages.push(baseLanguage);
5318
+ }
5319
+ }
5320
+
5321
+ return resolvedLanguages;
5322
+ };
5323
+
5324
+ Defaults.prototype._processTranslations = function (languages, debug) {
5325
+ var translations = new Translation();
5326
+
5327
+ for (var l = 0; l < languages.length; l++) {
5328
+ var languageData = new Translation();
5329
+
5330
+ var language = languages[l];
5331
+
5332
+ if (typeof language === 'string') {
5333
+ try {
5334
+ // Try to load it with the original name
5335
+ languageData = Translation.loadPath(language);
5336
+ } catch (e) {
5337
+ try {
5338
+ // If we couldn't load it, check if it wasn't the full path
5339
+ language = this.defaults.amdLanguageBase + language;
5340
+ languageData = Translation.loadPath(language);
5341
+ } catch (ex) {
5342
+ // The translation could not be loaded at all. Sometimes this is
5343
+ // because of a configuration problem, other times this can be
5344
+ // because of how Select2 helps load all possible translation files
5345
+ if (debug && window.console && console.warn) {
5346
+ console.warn(
5347
+ 'Select2: The language file for "' + language + '" could ' +
5348
+ 'not be automatically loaded. A fallback will be used instead.'
5349
+ );
5350
+ }
5351
+ }
5352
+ }
5353
+ } else if ($.isPlainObject(language)) {
5354
+ languageData = new Translation(language);
5355
+ } else {
5356
+ languageData = language;
5357
+ }
5358
+
5359
+ translations.extend(languageData);
5360
+ }
5361
+
5362
+ return translations;
5363
+ };
5364
+
5365
+ Defaults.prototype.set = function (key, value) {
5366
+ var camelKey = $.camelCase(key);
5367
+
5368
+ var data = {};
5369
+ data[camelKey] = value;
5370
+
5371
+ var convertedData = Utils._convertData(data);
5372
+
5373
+ $.extend(true, this.defaults, convertedData);
5374
+ };
5375
+
5376
+ var defaults = new Defaults();
5377
+
5378
+ return defaults;
5379
+ });
5380
+
5381
+ S2.define('select2/options',[
5382
+ 'jquery',
5383
+ './defaults',
5384
+ './utils'
5385
+ ], function ($, Defaults, Utils) {
5386
+ function Options (options, $element) {
5387
+ this.options = options;
5388
+
5389
+ if ($element != null) {
5390
+ this.fromElement($element);
5391
+ }
5392
+
5393
+ if ($element != null) {
5394
+ this.options = Defaults.applyFromElement(this.options, $element);
5395
+ }
5396
+
5397
+ this.options = Defaults.apply(this.options);
5398
+ }
5399
+
5400
+ Options.prototype.fromElement = function ($e) {
5401
+ var excludedData = ['select2'];
5402
+
5403
+ if (this.options.multiple == null) {
5404
+ this.options.multiple = $e.prop('multiple');
5405
+ }
5406
+
5407
+ if (this.options.disabled == null) {
5408
+ this.options.disabled = $e.prop('disabled');
5409
+ }
5410
+
5411
+ if (this.options.autocomplete == null && $e.prop('autocomplete')) {
5412
+ this.options.autocomplete = $e.prop('autocomplete');
5413
+ }
5414
+
5415
+ if (this.options.dir == null) {
5416
+ if ($e.prop('dir')) {
5417
+ this.options.dir = $e.prop('dir');
5418
+ } else if ($e.closest('[dir]').prop('dir')) {
5419
+ this.options.dir = $e.closest('[dir]').prop('dir');
5420
+ } else {
5421
+ this.options.dir = 'ltr';
5422
+ }
5423
+ }
5424
+
5425
+ $e.prop('disabled', this.options.disabled);
5426
+ $e.prop('multiple', this.options.multiple);
5427
+
5428
+ if (Utils.GetData($e[0], 'select2Tags')) {
5429
+ if (this.options.debug && window.console && console.warn) {
5430
+ console.warn(
5431
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
5432
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
5433
+ 'removed in future versions of Select2.'
5434
+ );
5435
+ }
5436
+
5437
+ Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
5438
+ Utils.StoreData($e[0], 'tags', true);
5439
+ }
5440
+
5441
+ if (Utils.GetData($e[0], 'ajaxUrl')) {
5442
+ if (this.options.debug && window.console && console.warn) {
5443
+ console.warn(
5444
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5445
+ '`data-ajax--url` and support for the old attribute will be removed' +
5446
+ ' in future versions of Select2.'
5447
+ );
5448
+ }
5449
+
5450
+ $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
5451
+ Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
5452
+ }
5453
+
5454
+ var dataset = {};
5455
+
5456
+ function upperCaseLetter(_, letter) {
5457
+ return letter.toUpperCase();
5458
+ }
5459
+
5460
+ // Pre-load all of the attributes which are prefixed with `data-`
5461
+ for (var attr = 0; attr < $e[0].attributes.length; attr++) {
5462
+ var attributeName = $e[0].attributes[attr].name;
5463
+ var prefix = 'data-';
5464
+
5465
+ if (attributeName.substr(0, prefix.length) == prefix) {
5466
+ // Get the contents of the attribute after `data-`
5467
+ var dataName = attributeName.substring(prefix.length);
5468
+
5469
+ // Get the data contents from the consistent source
5470
+ // This is more than likely the jQuery data helper
5471
+ var dataValue = Utils.GetData($e[0], dataName);
5472
+
5473
+ // camelCase the attribute name to match the spec
5474
+ var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);
5475
+
5476
+ // Store the data attribute contents into the dataset since
5477
+ dataset[camelDataName] = dataValue;
5478
+ }
5479
+ }
5480
+
5481
+ // Prefer the element's `dataset` attribute if it exists
5482
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5483
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5484
+ dataset = $.extend(true, {}, $e[0].dataset, dataset);
5485
+ }
5486
+
5487
+ // Prefer our internal data cache if it exists
5488
+ var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);
5489
+
5490
+ data = Utils._convertData(data);
5491
+
5492
+ for (var key in data) {
5493
+ if (excludedData.indexOf(key) > -1) {
5494
+ continue;
5495
+ }
5496
+
5497
+ if ($.isPlainObject(this.options[key])) {
5498
+ $.extend(this.options[key], data[key]);
5499
+ } else {
5500
+ this.options[key] = data[key];
5501
+ }
5502
+ }
5503
+
5504
+ return this;
5505
+ };
5506
+
5507
+ Options.prototype.get = function (key) {
5508
+ return this.options[key];
5509
+ };
5510
+
5511
+ Options.prototype.set = function (key, val) {
5512
+ this.options[key] = val;
5513
+ };
5514
+
5515
+ return Options;
5516
+ });
5517
+
5518
+ S2.define('select2/core',[
5519
+ 'jquery',
5520
+ './options',
5521
+ './utils',
5522
+ './keys'
5523
+ ], function ($, Options, Utils, KEYS) {
5524
+ var Select2 = function ($element, options) {
5525
+ if (Utils.GetData($element[0], 'select2') != null) {
5526
+ Utils.GetData($element[0], 'select2').destroy();
5527
+ }
5528
+
5529
+ this.$element = $element;
5530
+
5531
+ this.id = this._generateId($element);
5532
+
5533
+ options = options || {};
5534
+
5535
+ this.options = new Options(options, $element);
5536
+
5537
+ Select2.__super__.constructor.call(this);
5538
+
5539
+ // Set up the tabindex
5540
+
5541
+ var tabindex = $element.attr('tabindex') || 0;
5542
+ Utils.StoreData($element[0], 'old-tabindex', tabindex);
5543
+ $element.attr('tabindex', '-1');
5544
+
5545
+ // Set up containers and adapters
5546
+
5547
+ var DataAdapter = this.options.get('dataAdapter');
5548
+ this.dataAdapter = new DataAdapter($element, this.options);
5549
+
5550
+ var $container = this.render();
5551
+
5552
+ this._placeContainer($container);
5553
+
5554
+ var SelectionAdapter = this.options.get('selectionAdapter');
5555
+ this.selection = new SelectionAdapter($element, this.options);
5556
+ this.$selection = this.selection.render();
5557
+
5558
+ this.selection.position(this.$selection, $container);
5559
+
5560
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5561
+ this.dropdown = new DropdownAdapter($element, this.options);
5562
+ this.$dropdown = this.dropdown.render();
5563
+
5564
+ this.dropdown.position(this.$dropdown, $container);
5565
+
5566
+ var ResultsAdapter = this.options.get('resultsAdapter');
5567
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5568
+ this.$results = this.results.render();
5569
+
5570
+ this.results.position(this.$results, this.$dropdown);
5571
+
5572
+ // Bind events
5573
+
5574
+ var self = this;
5575
+
5576
+ // Bind the container to all of the adapters
5577
+ this._bindAdapters();
5578
+
5579
+ // Register any DOM event handlers
5580
+ this._registerDomEvents();
5581
+
5582
+ // Register any internal event handlers
5583
+ this._registerDataEvents();
5584
+ this._registerSelectionEvents();
5585
+ this._registerDropdownEvents();
5586
+ this._registerResultsEvents();
5587
+ this._registerEvents();
5588
+
5589
+ // Set the initial state
5590
+ this.dataAdapter.current(function (initialData) {
5591
+ self.trigger('selection:update', {
5592
+ data: initialData
5593
+ });
5594
+ });
5595
+
5596
+ // Hide the original select
5597
+ $element[0].classList.add('select2-hidden-accessible');
5598
+ $element.attr('aria-hidden', 'true');
5599
+
5600
+ // Synchronize any monitored attributes
5601
+ this._syncAttributes();
5602
+
5603
+ Utils.StoreData($element[0], 'select2', this);
5604
+
5605
+ // Ensure backwards compatibility with $element.data('select2').
5606
+ $element.data('select2', this);
5607
+ };
5608
+
5609
+ Utils.Extend(Select2, Utils.Observable);
5610
+
5611
+ Select2.prototype._generateId = function ($element) {
5612
+ var id = '';
5613
+
5614
+ if ($element.attr('id') != null) {
5615
+ id = $element.attr('id');
5616
+ } else if ($element.attr('name') != null) {
5617
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5618
+ } else {
5619
+ id = Utils.generateChars(4);
5620
+ }
5621
+
5622
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5623
+ id = 'select2-' + id;
5624
+
5625
+ return id;
5626
+ };
5627
+
5628
+ Select2.prototype._placeContainer = function ($container) {
5629
+ $container.insertAfter(this.$element);
5630
+
5631
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5632
+
5633
+ if (width != null) {
5634
+ $container.css('width', width);
5635
+ }
5636
+ };
5637
+
5638
+ Select2.prototype._resolveWidth = function ($element, method) {
5639
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5640
+
5641
+ if (method == 'resolve') {
5642
+ var styleWidth = this._resolveWidth($element, 'style');
5643
+
5644
+ if (styleWidth != null) {
5645
+ return styleWidth;
5646
+ }
5647
+
5648
+ return this._resolveWidth($element, 'element');
5649
+ }
5650
+
5651
+ if (method == 'element') {
5652
+ var elementWidth = $element.outerWidth(false);
5653
+
5654
+ if (elementWidth <= 0) {
5655
+ return 'auto';
5656
+ }
5657
+
5658
+ return elementWidth + 'px';
5659
+ }
5660
+
5661
+ if (method == 'style') {
5662
+ var style = $element.attr('style');
5663
+
5664
+ if (typeof(style) !== 'string') {
5665
+ return null;
5666
+ }
5667
+
5668
+ var attrs = style.split(';');
5669
+
5670
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5671
+ var attr = attrs[i].replace(/\s/g, '');
5672
+ var matches = attr.match(WIDTH);
5673
+
5674
+ if (matches !== null && matches.length >= 1) {
5675
+ return matches[1];
5676
+ }
5677
+ }
5678
+
5679
+ return null;
5680
+ }
5681
+
5682
+ if (method == 'computedstyle') {
5683
+ var computedStyle = window.getComputedStyle($element[0]);
5684
+
5685
+ return computedStyle.width;
5686
+ }
5687
+
5688
+ return method;
5689
+ };
5690
+
5691
+ Select2.prototype._bindAdapters = function () {
5692
+ this.dataAdapter.bind(this, this.$container);
5693
+ this.selection.bind(this, this.$container);
5694
+
5695
+ this.dropdown.bind(this, this.$container);
5696
+ this.results.bind(this, this.$container);
5697
+ };
5698
+
5699
+ Select2.prototype._registerDomEvents = function () {
5700
+ var self = this;
5701
+
5702
+ this.$element.on('change.select2', function () {
5703
+ self.dataAdapter.current(function (data) {
5704
+ self.trigger('selection:update', {
5705
+ data: data
5706
+ });
5707
+ });
5708
+ });
5709
+
5710
+ this.$element.on('focus.select2', function (evt) {
5711
+ self.trigger('focus', evt);
5712
+ });
5713
+
5714
+ this._syncA = Utils.bind(this._syncAttributes, this);
5715
+ this._syncS = Utils.bind(this._syncSubtree, this);
5716
+
5717
+ this._observer = new window.MutationObserver(function (mutations) {
5718
+ self._syncA();
5719
+ self._syncS(mutations);
5720
+ });
5721
+ this._observer.observe(this.$element[0], {
5722
+ attributes: true,
5723
+ childList: true,
5724
+ subtree: false
5725
+ });
5726
+ };
5727
+
5728
+ Select2.prototype._registerDataEvents = function () {
5729
+ var self = this;
5730
+
5731
+ this.dataAdapter.on('*', function (name, params) {
5732
+ self.trigger(name, params);
5733
+ });
5734
+ };
5735
+
5736
+ Select2.prototype._registerSelectionEvents = function () {
5737
+ var self = this;
5738
+ var nonRelayEvents = ['toggle', 'focus'];
5739
+
5740
+ this.selection.on('toggle', function () {
5741
+ self.toggleDropdown();
5742
+ });
5743
+
5744
+ this.selection.on('focus', function (params) {
5745
+ self.focus(params);
5746
+ });
5747
+
5748
+ this.selection.on('*', function (name, params) {
5749
+ if (nonRelayEvents.indexOf(name) !== -1) {
5750
+ return;
5751
+ }
5752
+
5753
+ self.trigger(name, params);
5754
+ });
5755
+ };
5756
+
5757
+ Select2.prototype._registerDropdownEvents = function () {
5758
+ var self = this;
5759
+
5760
+ this.dropdown.on('*', function (name, params) {
5761
+ self.trigger(name, params);
5762
+ });
5763
+ };
5764
+
5765
+ Select2.prototype._registerResultsEvents = function () {
5766
+ var self = this;
5767
+
5768
+ this.results.on('*', function (name, params) {
5769
+ self.trigger(name, params);
5770
+ });
5771
+ };
5772
+
5773
+ Select2.prototype._registerEvents = function () {
5774
+ var self = this;
5775
+
5776
+ this.on('open', function () {
5777
+ self.$container[0].classList.add('select2-container--open');
5778
+ });
5779
+
5780
+ this.on('close', function () {
5781
+ self.$container[0].classList.remove('select2-container--open');
5782
+ });
5783
+
5784
+ this.on('enable', function () {
5785
+ self.$container[0].classList.remove('select2-container--disabled');
5786
+ });
5787
+
5788
+ this.on('disable', function () {
5789
+ self.$container[0].classList.add('select2-container--disabled');
5790
+ });
5791
+
5792
+ this.on('blur', function () {
5793
+ self.$container[0].classList.remove('select2-container--focus');
5794
+ });
5795
+
5796
+ this.on('query', function (params) {
5797
+ if (!self.isOpen()) {
5798
+ self.trigger('open', {});
5799
+ }
5800
+
5801
+ this.dataAdapter.query(params, function (data) {
5802
+ self.trigger('results:all', {
5803
+ data: data,
5804
+ query: params
5805
+ });
5806
+ });
5807
+ });
5808
+
5809
+ this.on('query:append', function (params) {
5810
+ this.dataAdapter.query(params, function (data) {
5811
+ self.trigger('results:append', {
5812
+ data: data,
5813
+ query: params
5814
+ });
5815
+ });
5816
+ });
5817
+
5818
+ this.on('keypress', function (evt) {
5819
+ var key = evt.which;
5820
+
5821
+ if (self.isOpen()) {
5822
+ if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {
5823
+ self.close(evt);
5824
+
5825
+ evt.preventDefault();
5826
+ } else if (key === KEYS.ENTER || key === KEYS.TAB) {
5827
+ self.trigger('results:select', {});
5828
+
5829
+ evt.preventDefault();
5830
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5831
+ self.trigger('results:toggle', {});
5832
+
5833
+ evt.preventDefault();
5834
+ } else if (key === KEYS.UP) {
5835
+ self.trigger('results:previous', {});
5836
+
5837
+ evt.preventDefault();
5838
+ } else if (key === KEYS.DOWN) {
5839
+ self.trigger('results:next', {});
5840
+
5841
+ evt.preventDefault();
5842
+ }
5843
+ } else {
5844
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5845
+ (key === KEYS.DOWN && evt.altKey)) {
5846
+ self.open();
5847
+
5848
+ evt.preventDefault();
5849
+ }
5850
+ }
5851
+ });
5852
+ };
5853
+
5854
+ Select2.prototype._syncAttributes = function () {
5855
+ this.options.set('disabled', this.$element.prop('disabled'));
5856
+
5857
+ if (this.isDisabled()) {
5858
+ if (this.isOpen()) {
5859
+ this.close();
5860
+ }
5861
+
5862
+ this.trigger('disable', {});
5863
+ } else {
5864
+ this.trigger('enable', {});
5865
+ }
5866
+ };
5867
+
5868
+ Select2.prototype._isChangeMutation = function (mutations) {
5869
+ var self = this;
5870
+
5871
+ if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5872
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5873
+ var node = mutations.addedNodes[n];
5874
+
5875
+ if (node.selected) {
5876
+ return true;
5877
+ }
5878
+ }
5879
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5880
+ return true;
5881
+ } else if (Array.isArray(mutations)) {
5882
+ return mutations.some(function (mutation) {
5883
+ return self._isChangeMutation(mutation);
5884
+ });
5885
+ }
5886
+
5887
+ return false;
5888
+ };
5889
+
5890
+ Select2.prototype._syncSubtree = function (mutations) {
5891
+ var changed = this._isChangeMutation(mutations);
5892
+ var self = this;
5893
+
5894
+ // Only re-pull the data if we think there is a change
5895
+ if (changed) {
5896
+ this.dataAdapter.current(function (currentData) {
5897
+ self.trigger('selection:update', {
5898
+ data: currentData
5899
+ });
5900
+ });
5901
+ }
5902
+ };
5903
+
5904
+ /**
5905
+ * Override the trigger method to automatically trigger pre-events when
5906
+ * there are events that can be prevented.
5907
+ */
5908
+ Select2.prototype.trigger = function (name, args) {
5909
+ var actualTrigger = Select2.__super__.trigger;
5910
+ var preTriggerMap = {
5911
+ 'open': 'opening',
5912
+ 'close': 'closing',
5913
+ 'select': 'selecting',
5914
+ 'unselect': 'unselecting',
5915
+ 'clear': 'clearing'
5916
+ };
5917
+
5918
+ if (args === undefined) {
5919
+ args = {};
5920
+ }
5921
+
5922
+ if (name in preTriggerMap) {
5923
+ var preTriggerName = preTriggerMap[name];
5924
+ var preTriggerArgs = {
5925
+ prevented: false,
5926
+ name: name,
5927
+ args: args
5928
+ };
5929
+
5930
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
5931
+
5932
+ if (preTriggerArgs.prevented) {
5933
+ args.prevented = true;
5934
+
5935
+ return;
5936
+ }
5937
+ }
5938
+
5939
+ actualTrigger.call(this, name, args);
5940
+ };
5941
+
5942
+ Select2.prototype.toggleDropdown = function () {
5943
+ if (this.isDisabled()) {
5944
+ return;
5945
+ }
5946
+
5947
+ if (this.isOpen()) {
5948
+ this.close();
5949
+ } else {
5950
+ this.open();
5951
+ }
5952
+ };
5953
+
5954
+ Select2.prototype.open = function () {
5955
+ if (this.isOpen()) {
5956
+ return;
5957
+ }
5958
+
5959
+ if (this.isDisabled()) {
5960
+ return;
5961
+ }
5962
+
5963
+ this.trigger('query', {});
5964
+ };
5965
+
5966
+ Select2.prototype.close = function (evt) {
5967
+ if (!this.isOpen()) {
5968
+ return;
5969
+ }
5970
+
5971
+ this.trigger('close', { originalEvent : evt });
5972
+ };
5973
+
5974
+ /**
5975
+ * Helper method to abstract the "enabled" (not "disabled") state of this
5976
+ * object.
5977
+ *
5978
+ * @return {true} if the instance is not disabled.
5979
+ * @return {false} if the instance is disabled.
5980
+ */
5981
+ Select2.prototype.isEnabled = function () {
5982
+ return !this.isDisabled();
5983
+ };
5984
+
5985
+ /**
5986
+ * Helper method to abstract the "disabled" state of this object.
5987
+ *
5988
+ * @return {true} if the disabled option is true.
5989
+ * @return {false} if the disabled option is false.
5990
+ */
5991
+ Select2.prototype.isDisabled = function () {
5992
+ return this.options.get('disabled');
5993
+ };
5994
+
5995
+ Select2.prototype.isOpen = function () {
5996
+ return this.$container[0].classList.contains('select2-container--open');
5997
+ };
5998
+
5999
+ Select2.prototype.hasFocus = function () {
6000
+ return this.$container[0].classList.contains('select2-container--focus');
6001
+ };
6002
+
6003
+ Select2.prototype.focus = function (data) {
6004
+ // No need to re-trigger focus events if we are already focused
6005
+ if (this.hasFocus()) {
6006
+ return;
6007
+ }
6008
+
6009
+ this.$container[0].classList.add('select2-container--focus');
6010
+ this.trigger('focus', {});
6011
+ };
6012
+
6013
+ Select2.prototype.enable = function (args) {
6014
+ if (this.options.get('debug') && window.console && console.warn) {
6015
+ console.warn(
6016
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
6017
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
6018
+ ' instead.'
6019
+ );
6020
+ }
6021
+
6022
+ if (args == null || args.length === 0) {
6023
+ args = [true];
6024
+ }
6025
+
6026
+ var disabled = !args[0];
6027
+
6028
+ this.$element.prop('disabled', disabled);
6029
+ };
6030
+
6031
+ Select2.prototype.data = function () {
6032
+ if (this.options.get('debug') &&
6033
+ arguments.length > 0 && window.console && console.warn) {
6034
+ console.warn(
6035
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
6036
+ 'should consider setting the value instead using `$element.val()`.'
6037
+ );
6038
+ }
6039
+
6040
+ var data = [];
6041
+
6042
+ this.dataAdapter.current(function (currentData) {
6043
+ data = currentData;
6044
+ });
6045
+
6046
+ return data;
6047
+ };
6048
+
6049
+ Select2.prototype.val = function (args) {
6050
+ if (this.options.get('debug') && window.console && console.warn) {
6051
+ console.warn(
6052
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
6053
+ ' removed in later Select2 versions. Use $element.val() instead.'
6054
+ );
6055
+ }
6056
+
6057
+ if (args == null || args.length === 0) {
6058
+ return this.$element.val();
6059
+ }
6060
+
6061
+ var newVal = args[0];
6062
+
6063
+ if (Array.isArray(newVal)) {
6064
+ newVal = newVal.map(function (obj) {
6065
+ return obj.toString();
6066
+ });
6067
+ }
6068
+
6069
+ this.$element.val(newVal).trigger('input').trigger('change');
6070
+ };
6071
+
6072
+ Select2.prototype.destroy = function () {
6073
+ Utils.RemoveData(this.$container[0]);
6074
+ this.$container.remove();
6075
+
6076
+ this._observer.disconnect();
6077
+ this._observer = null;
6078
+
6079
+ this._syncA = null;
6080
+ this._syncS = null;
6081
+
6082
+ this.$element.off('.select2');
6083
+ this.$element.attr('tabindex',
6084
+ Utils.GetData(this.$element[0], 'old-tabindex'));
6085
+
6086
+ this.$element[0].classList.remove('select2-hidden-accessible');
6087
+ this.$element.attr('aria-hidden', 'false');
6088
+ Utils.RemoveData(this.$element[0]);
6089
+ this.$element.removeData('select2');
6090
+
6091
+ this.dataAdapter.destroy();
6092
+ this.selection.destroy();
6093
+ this.dropdown.destroy();
6094
+ this.results.destroy();
6095
+
6096
+ this.dataAdapter = null;
6097
+ this.selection = null;
6098
+ this.dropdown = null;
6099
+ this.results = null;
6100
+ };
6101
+
6102
+ Select2.prototype.render = function () {
6103
+ var $container = $(
6104
+ '<span class="select2 select2-container">' +
6105
+ '<span class="selection"></span>' +
6106
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
6107
+ '</span>'
6108
+ );
6109
+
6110
+ $container.attr('dir', this.options.get('dir'));
6111
+
6112
+ this.$container = $container;
6113
+
6114
+ this.$container[0].classList
6115
+ .add('select2-container--' + this.options.get('theme'));
6116
+
6117
+ Utils.StoreData($container[0], 'element', this.$element);
6118
+
6119
+ return $container;
6120
+ };
6121
+
6122
+ return Select2;
6123
+ });
6124
+
6125
+ S2.define('select2/dropdown/attachContainer',[
6126
+
6127
+ ], function () {
6128
+ function AttachContainer (decorated, $element, options) {
6129
+ decorated.call(this, $element, options);
6130
+ }
6131
+
6132
+ AttachContainer.prototype.position =
6133
+ function (decorated, $dropdown, $container) {
6134
+ var $dropdownContainer = $container.find('.dropdown-wrapper');
6135
+ $dropdownContainer.append($dropdown);
6136
+
6137
+ $dropdown[0].classList.add('select2-dropdown--below');
6138
+ $container[0].classList.add('select2-container--below');
6139
+ };
6140
+
6141
+ return AttachContainer;
6142
+ });
6143
+
6144
+ S2.define('select2/dropdown/stopPropagation',[
6145
+
6146
+ ], function () {
6147
+ function StopPropagation () { }
6148
+
6149
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
6150
+ decorated.call(this, container, $container);
6151
+
6152
+ var stoppedEvents = [
6153
+ 'blur',
6154
+ 'change',
6155
+ 'click',
6156
+ 'dblclick',
6157
+ 'focus',
6158
+ 'focusin',
6159
+ 'focusout',
6160
+ 'input',
6161
+ 'keydown',
6162
+ 'keyup',
6163
+ 'keypress',
6164
+ 'mousedown',
6165
+ 'mouseenter',
6166
+ 'mouseleave',
6167
+ 'mousemove',
6168
+ 'mouseover',
6169
+ 'mouseup',
6170
+ 'search',
6171
+ 'touchend',
6172
+ 'touchstart'
6173
+ ];
6174
+
6175
+ this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
6176
+ evt.stopPropagation();
6177
+ });
6178
+ };
6179
+
6180
+ return StopPropagation;
6181
+ });
6182
+
6183
+ S2.define('select2/selection/stopPropagation',[
6184
+
6185
+ ], function () {
6186
+ function StopPropagation () { }
6187
+
6188
+ StopPropagation.prototype.bind = function (decorated, container, $container) {
6189
+ decorated.call(this, container, $container);
6190
+
6191
+ var stoppedEvents = [
6192
+ 'blur',
6193
+ 'change',
6194
+ 'click',
6195
+ 'dblclick',
6196
+ 'focus',
6197
+ 'focusin',
6198
+ 'focusout',
6199
+ 'input',
6200
+ 'keydown',
6201
+ 'keyup',
6202
+ 'keypress',
6203
+ 'mousedown',
6204
+ 'mouseenter',
6205
+ 'mouseleave',
6206
+ 'mousemove',
6207
+ 'mouseover',
6208
+ 'mouseup',
6209
+ 'search',
6210
+ 'touchend',
6211
+ 'touchstart'
6212
+ ];
6213
+
6214
+ this.$selection.on(stoppedEvents.join(' '), function (evt) {
6215
+ evt.stopPropagation();
6216
+ });
6217
+ };
6218
+
6219
+ return StopPropagation;
6220
+ });
6221
+
6222
+ /*!
6223
+ * jQuery Mousewheel 3.1.13
6224
+ *
6225
+ * Copyright jQuery Foundation and other contributors
6226
+ * Released under the MIT license
6227
+ * http://jquery.org/license
6228
+ */
6229
+
6230
+ (function (factory) {
6231
+ if ( typeof S2.define === 'function' && S2.define.amd ) {
6232
+ // AMD. Register as an anonymous module.
6233
+ S2.define('jquery-mousewheel',['jquery'], factory);
6234
+ } else if (typeof exports === 'object') {
6235
+ // Node/CommonJS style for Browserify
6236
+ module.exports = factory;
6237
+ } else {
6238
+ // Browser globals
6239
+ factory(jQuery);
6240
+ }
6241
+ }(function ($) {
6242
+
6243
+ var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
6244
+ toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
6245
+ ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
6246
+ slice = Array.prototype.slice,
6247
+ nullLowestDeltaTimeout, lowestDelta;
6248
+
6249
+ if ( $.event.fixHooks ) {
6250
+ for ( var i = toFix.length; i; ) {
6251
+ $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
6252
+ }
6253
+ }
6254
+
6255
+ var special = $.event.special.mousewheel = {
6256
+ version: '3.1.12',
6257
+
6258
+ setup: function() {
6259
+ if ( this.addEventListener ) {
6260
+ for ( var i = toBind.length; i; ) {
6261
+ this.addEventListener( toBind[--i], handler, false );
6262
+ }
6263
+ } else {
6264
+ this.onmousewheel = handler;
6265
+ }
6266
+ // Store the line height and page height for this particular element
6267
+ $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
6268
+ $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
6269
+ },
6270
+
6271
+ teardown: function() {
6272
+ if ( this.removeEventListener ) {
6273
+ for ( var i = toBind.length; i; ) {
6274
+ this.removeEventListener( toBind[--i], handler, false );
6275
+ }
6276
+ } else {
6277
+ this.onmousewheel = null;
6278
+ }
6279
+ // Clean up the data we added to the element
6280
+ $.removeData(this, 'mousewheel-line-height');
6281
+ $.removeData(this, 'mousewheel-page-height');
6282
+ },
6283
+
6284
+ getLineHeight: function(elem) {
6285
+ var $elem = $(elem),
6286
+ $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
6287
+ if (!$parent.length) {
6288
+ $parent = $('body');
6289
+ }
6290
+ return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
6291
+ },
6292
+
6293
+ getPageHeight: function(elem) {
6294
+ return $(elem).height();
6295
+ },
6296
+
6297
+ settings: {
6298
+ adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
6299
+ normalizeOffset: true // calls getBoundingClientRect for each event
6300
+ }
6301
+ };
6302
+
6303
+ $.fn.extend({
6304
+ mousewheel: function(fn) {
6305
+ return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
6306
+ },
6307
+
6308
+ unmousewheel: function(fn) {
6309
+ return this.unbind('mousewheel', fn);
6310
+ }
6311
+ });
6312
+
6313
+
6314
+ function handler(event) {
6315
+ var orgEvent = event || window.event,
6316
+ args = slice.call(arguments, 1),
6317
+ delta = 0,
6318
+ deltaX = 0,
6319
+ deltaY = 0,
6320
+ absDelta = 0,
6321
+ offsetX = 0,
6322
+ offsetY = 0;
6323
+ event = $.event.fix(orgEvent);
6324
+ event.type = 'mousewheel';
6325
+
6326
+ // Old school scrollwheel delta
6327
+ if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
6328
+ if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
6329
+ if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
6330
+ if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
6331
+
6332
+ // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
6333
+ if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
6334
+ deltaX = deltaY * -1;
6335
+ deltaY = 0;
6336
+ }
6337
+
6338
+ // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
6339
+ delta = deltaY === 0 ? deltaX : deltaY;
6340
+
6341
+ // New school wheel delta (wheel event)
6342
+ if ( 'deltaY' in orgEvent ) {
6343
+ deltaY = orgEvent.deltaY * -1;
6344
+ delta = deltaY;
6345
+ }
6346
+ if ( 'deltaX' in orgEvent ) {
6347
+ deltaX = orgEvent.deltaX;
6348
+ if ( deltaY === 0 ) { delta = deltaX * -1; }
6349
+ }
6350
+
6351
+ // No change actually happened, no reason to go any further
6352
+ if ( deltaY === 0 && deltaX === 0 ) { return; }
6353
+
6354
+ // Need to convert lines and pages to pixels if we aren't already in pixels
6355
+ // There are three delta modes:
6356
+ // * deltaMode 0 is by pixels, nothing to do
6357
+ // * deltaMode 1 is by lines
6358
+ // * deltaMode 2 is by pages
6359
+ if ( orgEvent.deltaMode === 1 ) {
6360
+ var lineHeight = $.data(this, 'mousewheel-line-height');
6361
+ delta *= lineHeight;
6362
+ deltaY *= lineHeight;
6363
+ deltaX *= lineHeight;
6364
+ } else if ( orgEvent.deltaMode === 2 ) {
6365
+ var pageHeight = $.data(this, 'mousewheel-page-height');
6366
+ delta *= pageHeight;
6367
+ deltaY *= pageHeight;
6368
+ deltaX *= pageHeight;
6369
+ }
6370
+
6371
+ // Store lowest absolute delta to normalize the delta values
6372
+ absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
6373
+
6374
+ if ( !lowestDelta || absDelta < lowestDelta ) {
6375
+ lowestDelta = absDelta;
6376
+
6377
+ // Adjust older deltas if necessary
6378
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6379
+ lowestDelta /= 40;
6380
+ }
6381
+ }
6382
+
6383
+ // Adjust older deltas if necessary
6384
+ if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
6385
+ // Divide all the things by 40!
6386
+ delta /= 40;
6387
+ deltaX /= 40;
6388
+ deltaY /= 40;
6389
+ }
6390
+
6391
+ // Get a whole, normalized value for the deltas
6392
+ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
6393
+ deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
6394
+ deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
6395
+
6396
+ // Normalise offsetX and offsetY properties
6397
+ if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
6398
+ var boundingRect = this.getBoundingClientRect();
6399
+ offsetX = event.clientX - boundingRect.left;
6400
+ offsetY = event.clientY - boundingRect.top;
6401
+ }
6402
+
6403
+ // Add information to the event object
6404
+ event.deltaX = deltaX;
6405
+ event.deltaY = deltaY;
6406
+ event.deltaFactor = lowestDelta;
6407
+ event.offsetX = offsetX;
6408
+ event.offsetY = offsetY;
6409
+ // Go ahead and set deltaMode to 0 since we converted to pixels
6410
+ // Although this is a little odd since we overwrite the deltaX/Y
6411
+ // properties with normalized deltas.
6412
+ event.deltaMode = 0;
6413
+
6414
+ // Add event and delta to the front of the arguments
6415
+ args.unshift(event, delta, deltaX, deltaY);
6416
+
6417
+ // Clearout lowestDelta after sometime to better
6418
+ // handle multiple device types that give different
6419
+ // a different lowestDelta
6420
+ // Ex: trackpad = 3 and mouse wheel = 120
6421
+ if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
6422
+ nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
6423
+
6424
+ return ($.event.dispatch || $.event.handle).apply(this, args);
6425
+ }
6426
+
6427
+ function nullLowestDelta() {
6428
+ lowestDelta = null;
6429
+ }
6430
+
6431
+ function shouldAdjustOldDeltas(orgEvent, absDelta) {
6432
+ // If this is an older event and the delta is divisible by 120,
6433
+ // then we are assuming that the browser is treating this as an
6434
+ // older mouse wheel event and that we should divide the deltas
6435
+ // by 40 to try and get a more usable deltaFactor.
6436
+ // Side note, this actually impacts the reported scroll distance
6437
+ // in older browsers and can cause scrolling to be slower than native.
6438
+ // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
6439
+ return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
6440
+ }
6441
+
6442
+ }));
6443
+
6444
+ S2.define('jquery.select2',[
6445
+ 'jquery',
6446
+ 'jquery-mousewheel',
6447
+
6448
+ './select2/core',
6449
+ './select2/defaults',
6450
+ './select2/utils'
6451
+ ], function ($, _, Select2, Defaults, Utils) {
6452
+ if ($.fn.select2 == null) {
6453
+ // All methods that should return the element
6454
+ var thisMethods = ['open', 'close', 'destroy'];
6455
+
6456
+ $.fn.select2 = function (options) {
6457
+ options = options || {};
6458
+
6459
+ if (typeof options === 'object') {
6460
+ this.each(function () {
6461
+ var instanceOptions = $.extend(true, {}, options);
6462
+
6463
+ var instance = new Select2($(this), instanceOptions);
6464
+ });
6465
+
6466
+ return this;
6467
+ } else if (typeof options === 'string') {
6468
+ var ret;
6469
+ var args = Array.prototype.slice.call(arguments, 1);
6470
+
6471
+ this.each(function () {
6472
+ var instance = Utils.GetData(this, 'select2');
6473
+
6474
+ if (instance == null && window.console && console.error) {
6475
+ console.error(
6476
+ 'The select2(\'' + options + '\') method was called on an ' +
6477
+ 'element that is not using Select2.'
6478
+ );
6479
+ }
6480
+
6481
+ ret = instance[options].apply(instance, args);
6482
+ });
6483
+
6484
+ // Check if we should be returning `this`
6485
+ if (thisMethods.indexOf(options) > -1) {
6486
+ return this;
6487
+ }
6488
+
6489
+ return ret;
6490
+ } else {
6491
+ throw new Error('Invalid arguments for Select2: ' + options);
6492
+ }
6493
+ };
6494
+ }
6495
+
6496
+ if ($.fn.select2.defaults == null) {
6497
+ $.fn.select2.defaults = Defaults;
6498
+ }
6499
+
6500
+ return Select2;
6501
+ });
6502
+
6503
+ // Return the AMD loader configuration so it can be used outside of this file
6504
+ return {
6505
+ define: S2.define,
6506
+ require: S2.require
6507
+ };
6508
+ }());
6509
+
6510
+ // Autoload the jQuery bindings
6511
+ // We know that all of the modules exist above this, so we're safe
6512
+ var select2 = S2.require('jquery.select2');
6513
+
6514
+ // Hold the AMD module references on the jQuery function that was just loaded
6515
+ // This allows Select2 to use the internal loader outside of this file, such
6516
+ // as in the language files.
6517
+ jQuery.fn.select2.amd = S2;
6518
+
6519
+ // Return the Select2 instance for anyone who is importing it.
6520
+ return select2;
6521
+ }));
includes/vendor/select2/js/select2.full.min.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ /*! Select2 4.1.0-rc.0 | 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(t){var e,n,p,o,r,h,f,g,m,v,y,s,i,_,a,a=(t&&t.fn&&t.fn.select2&&t.fn.select2.amd&&(u=t.fn.select2.amd),u&&u.requirejs||(u?n=u:u={},g={},m={},v={},y={},s=Object.prototype.hasOwnProperty,i=[].slice,_=/\.js$/,h=function(e,t){var n,s,i=c(e),o=i[0],t=t[1];return e=i[1],o&&(n=x(o=l(o,t))),o?e=n&&n.normalize?n.normalize(e,(s=t,function(e){return l(e,s)})):l(e,t):(o=(i=c(e=l(e,t)))[0],e=i[1],o&&(n=x(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},f={require:function(e){return w(e)},exports:function(e){var t=g[e];return void 0!==t?t:g[e]={}},module:function(e){return{id:e,uri:"",exports:g[e],config:(t=e,function(){return v&&v.config&&v.config[t]||{}})};var t}},o=function(e,t,n,s){var i,o,r,a,l,c=[],u=typeof n,d=A(s=s||e);if("undefined"==u||"function"==u){for(t=!t.length&&n.length?["require","exports","module"]:t,a=0;a<t.length;a+=1)if("require"===(o=(r=h(t[a],d)).f))c[a]=f.require(e);else if("exports"===o)c[a]=f.exports(e),l=!0;else if("module"===o)i=c[a]=f.module(e);else if(b(g,o)||b(m,o)||b(y,o))c[a]=x(o);else{if(!r.p)throw new Error(e+" missing "+o);r.p.load(r.n,w(s,!0),function(t){return function(e){g[t]=e}}(o),{}),c[a]=g[o]}u=n?n.apply(g[e],c):void 0,e&&(i&&i.exports!==p&&i.exports!==g[e]?g[e]=i.exports:u===p&&l||(g[e]=u))}else e&&(g[e]=n)},e=n=r=function(e,t,n,s,i){if("string"==typeof e)return f[e]?f[e](t):x(h(e,A(t)).f);if(!e.splice){if((v=e).deps&&r(v.deps,v.callback),!t)return;t.splice?(e=t,t=n,n=null):e=p}return t=t||function(){},"function"==typeof n&&(n=s,s=i),s?o(p,e,t,n):setTimeout(function(){o(p,e,t,n)},4),r},r.config=function(e){return r(e)},e._defined=g,(a=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(g,e)||b(m,e)||(m[e]=[e,t,n])}).amd={jQuery:!0},u.requirejs=e,u.require=n,u.define=a),u.define("almond",function(){}),u.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}),u.define("select2/utils",["jquery"],function(o){var s={};function c(e){var t,n=e.prototype,s=[];for(t in n)"function"==typeof n[t]&&"constructor"!==t&&s.push(t);return s}s.Extend=function(e,t){var n,s={}.hasOwnProperty;function i(){this.constructor=e}for(n in t)s.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},s.Decorate=function(s,i){var e=c(i),t=c(s);function o(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=s.prototype.constructor;0<t&&(e.call(arguments,s.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=s.displayName,o.prototype=new function(){this.constructor=o};for(var n=0;n<t.length;n++){var r=t[n];o.prototype[r]=s.prototype[r]}for(var a=0;a<e.length;a++){var l=e[a];o.prototype[l]=function(e){var t=function(){};e in o.prototype&&(t=o.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}(l)}return o};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,s=e.length;n<s;n++)e[n].apply(this,t)},s.Observable=e,s.generateChars=function(e){for(var t="",n=0;n<e;n++)t+=Math.floor(36*Math.random()).toString(36);return t},s.bind=function(e,t){return function(){e.apply(t,arguments)}},s._convertData=function(e){for(var t in e){var n=t.split("-"),s=e;if(1!==n.length){for(var i=0;i<n.length;i++){var o=n[i];(o=o.substring(0,1).toLowerCase()+o.substring(1))in s||(s[o]={}),i==n.length-1&&(s[o]=e[t]),s=s[o]}delete e[t]}}return e},s.hasScroll=function(e,t){var n=o(t),s=t.style.overflowX,i=t.style.overflowY;return(s!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===s||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},s.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]})},s.__cache={};var n=0;return s.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null!=t||(t=e.id?"select2-data-"+e.id:"select2-data-"+(++n).toString()+"-"+s.generateChars(4),e.setAttribute("data-select2-id",t)),t},s.StoreData=function(e,t,n){e=s.GetUniqueElementId(e);s.__cache[e]||(s.__cache[e]={}),s.__cache[e][t]=n},s.GetData=function(e,t){var n=s.GetUniqueElementId(e);return t?s.__cache[n]&&null!=s.__cache[n][t]?s.__cache[n][t]:o(e).data(t):s.__cache[n]},s.RemoveData=function(e){var t=s.GetUniqueElementId(e);null!=s.__cache[t]&&delete s.__cache[t],e.removeAttribute("data-select2-id")},s.copyNonInternalCssClasses=function(e,t){var n=(n=e.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0===e.indexOf("select2-")}),t=(t=t.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0!==e.indexOf("select2-")}),t=n.concat(t);e.setAttribute("class",t.join(" "))},s}),u.define("select2/results",["jquery","./utils"],function(d,p){function s(e,t,n){this.$element=e,this.data=n,this.options=t,s.__super__.constructor.call(this)}return p.Extend(s,p.Observable),s.prototype.render=function(){var e=d('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},s.prototype.clear=function(){this.$results.empty()},s.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=d('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),s=this.options.get("translations").get(e.message);n.append(t(s(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},s.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},s.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 s=e.results[n],s=this.option(s);t.push(s)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},s.prototype.position=function(e,t){t.find(".select2-results").append(e)},s.prototype.sort=function(e){return this.options.get("sorter")(e)},s.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");(0<t.length?t:e).first().trigger("mouseenter"),this.ensureHighlightVisible()},s.prototype.setClasses=function(){var t=this;this.data.current(function(e){var s=e.map(function(e){return e.id.toString()});t.$results.find(".select2-results__option--selectable").each(function(){var e=d(this),t=p.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<s.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"))})})},s.prototype.showLoading=function(e){this.hideLoading();e={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},e=this.option(e);e.className+=" loading-results",this.$results.prepend(e)},s.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},s.prototype.option=function(e){var t=document.createElement("li");t.classList.add("select2-results__option"),t.classList.add("select2-results__option--selectable");var n,s={role:"option"},i=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(n in(null!=e.element&&i.call(e.element,":disabled")||null==e.element&&e.disabled)&&(s["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&&(s.role="group",s["aria-label"]=e.text,t.classList.remove("select2-results__option--selectable"),t.classList.add("select2-results__option--group")),s){var o=s[n];t.setAttribute(n,o)}if(e.children){var r=d(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],u=this.option(u);l.push(u)}i=d("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"none"});i.append(l),r.append(a),r.append(i)}else this.template(e,t);return p.StoreData(t,"data",e),t},s.prototype.bind=function(t,e){var i=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){i.clear(),i.append(e.data),t.isOpen()&&(i.setClasses(),i.highlightFirstItem())}),t.on("results:append",function(e){i.append(e.data),t.isOpen()&&i.setClasses()}),t.on("query",function(e){i.hideMessages(),i.showLoading(e)}),t.on("select",function(){t.isOpen()&&(i.setClasses(),i.options.get("scrollAfterSelect")&&i.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(i.setClasses(),i.options.get("scrollAfterSelect")&&i.highlightFirstItem())}),t.on("open",function(){i.$results.attr("aria-expanded","true"),i.$results.attr("aria-hidden","false"),i.setClasses(),i.ensureHighlightVisible()}),t.on("close",function(){i.$results.attr("aria-expanded","false"),i.$results.attr("aria-hidden","true"),i.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=i.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e,t=i.getHighlightedResults();0!==t.length&&(e=p.GetData(t[0],"data"),t.hasClass("select2-results__option--selected")?i.trigger("close",{}):i.trigger("select",{data:e}))}),t.on("results:previous",function(){var e,t=i.getHighlightedResults(),n=i.$results.find(".select2-results__option--selectable"),s=n.index(t);s<=0||(e=s-1,0===t.length&&(e=0),(s=n.eq(e)).trigger("mouseenter"),t=i.$results.offset().top,n=s.offset().top,s=i.$results.scrollTop()+(n-t),0===e?i.$results.scrollTop(0):n-t<0&&i.$results.scrollTop(s))}),t.on("results:next",function(){var e,t=i.getHighlightedResults(),n=i.$results.find(".select2-results__option--selectable"),s=n.index(t)+1;s>=n.length||((e=n.eq(s)).trigger("mouseenter"),t=i.$results.offset().top+i.$results.outerHeight(!1),n=e.offset().top+e.outerHeight(!1),e=i.$results.scrollTop()+n-t,0===s?i.$results.scrollTop(0):t<n&&i.$results.scrollTop(e))}),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){i.displayMessage(e)}),d.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=i.$results.scrollTop(),n=i.$results.get(0).scrollHeight-t+e.deltaY,t=0<e.deltaY&&t-e.deltaY<=0,n=e.deltaY<0&&n<=i.$results.height();t?(i.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):n&&(i.$results.scrollTop(i.$results.get(0).scrollHeight-i.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option--selectable",function(e){var t=d(this),n=p.GetData(this,"data");t.hasClass("select2-results__option--selected")?i.options.get("multiple")?i.trigger("unselect",{originalEvent:e,data:n}):i.trigger("close",{}):i.trigger("select",{originalEvent:e,data:n})}),this.$results.on("mouseenter",".select2-results__option--selectable",function(e){var t=p.GetData(this,"data");i.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),i.trigger("results:focus",{data:t,element:d(this)})})},s.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},s.prototype.destroy=function(){this.$results.remove()},s.prototype.ensureHighlightVisible=function(){var e,t,n,s,i=this.getHighlightedResults();0!==i.length&&(e=this.$results.find(".select2-results__option--selectable").index(i),s=this.$results.offset().top,t=i.offset().top,n=this.$results.scrollTop()+(t-s),s=t-s,n-=2*i.outerHeight(!1),e<=2?this.$results.scrollTop(0):(s>this.$results.outerHeight()||s<0)&&this.$results.scrollTop(n))},s.prototype.template=function(e,t){var n=this.options.get("templateResult"),s=this.options.get("escapeMarkup"),e=n(e,t);null==e?t.style.display="none":"string"==typeof e?t.innerHTML=s(e):d(t).append(e)},s}),u.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}}),u.define("select2/selection/base",["jquery","../utils","../keys"],function(n,s,i){function o(e,t){this.$element=e,this.options=t,o.__super__.constructor.call(this)}return s.Extend(o,s.Observable),o.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=s.GetData(this.$element[0],"old-tabindex")?this._tabindex=s.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},o.prototype.bind=function(e,t){var n=this,s=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===i.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",s),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")})},o.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)},o.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]&&s.GetData(this,"element").select2("close")})})},o.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},o.prototype.position=function(e,t){t.find(".selection").append(e)},o.prototype.destroy=function(){this._detachCloseHandler(this.container)},o.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o}),u.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,s){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__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},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var s=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",s).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",s),this.$selection.attr("aria-controls",s),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")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){var t,n;0!==e.length?(n=e[0],t=this.$selection.find(".select2-selection__rendered"),e=this.display(n,t),t.empty().append(e),(n=n.title||n.text)?t.attr("title",n):t.removeAttr("title")):this.clear()},i}),u.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,c){function o(e,t){o.__super__.constructor.apply(this,arguments)}return c.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},o.prototype.bind=function(e,t){var n=this;o.__super__.bind.apply(this,arguments);var s=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",s),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){var t;n.isDisabled()||(t=i(this).parent(),t=c.GetData(t[0],"data"),n.trigger("unselect",{originalEvent:e,data:t}))}),this.$selection.on("keydown",".select2-selection__choice__remove",function(e){n.isDisabled()||e.stopPropagation()})},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 i('<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>')},o.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",s=0;s<e.length;s++){var i=e[s],o=this.selectionContainer(),r=this.display(i,o),a=n+c.generateChars(4)+"-";i.id?a+=i.id:a+=c.generateChars(4),o.find(".select2-selection__choice__display").append(r).attr("id",a);var l=i.title||i.text;l&&o.attr("title",l);r=this.options.get("translations").get("removeItem"),l=o.find(".select2-selection__choice__remove");l.attr("title",r()),l.attr("aria-label",r()),l.attr("aria-describedby",a),c.StoreData(o[0],"data",i),t.push(o)}this.$selection.find(".select2-selection__rendered").append(t)}},o}),u.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();n.html(this.display(t)),n[0].classList.add("select2-selection__placeholder"),n[0].classList.remove("select2-selection__choice");t=t.title||t.text||n.text();return this.$selection.find(".select2-selection__rendered").attr("title",t),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();t=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(t)},e}),u.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,s,a){function e(){}return e.prototype.bind=function(e,t,n){var s=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){s._handleClear(e)}),t.on("keypress",function(e){s._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 s=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var o={data:s};if(this.trigger("clear",o),o.prevented)this.$element.val(i);else{for(var r=0;r<s.length;r++)if(o={data:s[r]},this.trigger("unselect",o),o.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=s.DELETE&&t.which!=s.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){var n,s;e.call(this,t),this.$selection.find(".select2-selection__clear").remove(),this.$selection[0].classList.remove("select2-selection--clearable"),0<this.$selection.find(".select2-selection__placeholder").length||0===t.length||(n=this.$selection.find(".select2-selection__rendered").attr("id"),s=this.options.get("translations").get("removeAllItems"),(e=i('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>')).attr("title",s()),e.attr("aria-label",s()),e.attr("aria-describedby",n),a.StoreData(e[0],"data",t),this.$selection.prepend(e),this.$selection[0].classList.add("select2-selection--clearable"))},e}),u.define("select2/selection/search",["jquery","../utils","../keys"],function(s,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=this.options.get("translations").get("search"),n=s('<span class="select2-search select2-search--inline"><textarea class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" ></textarea></span>');this.$searchContainer=n,this.$search=n.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",t());e=e.call(this);return this._transferTabIndex(),e.append(this.$searchContainer),e},e.prototype.bind=function(e,t,n){var s=this,i=t.id+"-results",o=t.id+"-container";e.call(this,t,n),s.$search.attr("aria-describedby",o),t.on("open",function(){s.$search.attr("aria-controls",i),s.$search.trigger("focus")}),t.on("close",function(){s.$search.val(""),s.resizeSearch(),s.$search.removeAttr("aria-controls"),s.$search.removeAttr("aria-activedescendant"),s.$search.trigger("focus")}),t.on("enable",function(){s.$search.prop("disabled",!1),s._transferTabIndex()}),t.on("disable",function(){s.$search.prop("disabled",!0)}),t.on("focus",function(e){s.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){s.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){s._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){var t;e.stopPropagation(),s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented(),e.which!==l.BACKSPACE||""!==s.$search.val()||0<(t=s.$selection.find(".select2-selection__choice").last()).length&&(t=a.GetData(t[0],"data"),s.searchRemoveChoice(t),e.preventDefault())}),this.$selection.on("click",".select2-search--inline",function(e){s.$search.val()&&e.stopPropagation()});var t=document.documentMode,r=t&&t<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){r?s.$selection.off("input.search input.searchcheck"):s.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){var t;r&&"input"===e.type?s.$selection.off("input.search input.searchcheck"):(t=e.which)!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&s.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}),u.define("select2/selection/selectionCss",["../utils"],function(n){function e(){}return e.prototype.render=function(e){var t=e.call(this),e=this.options.get("selectionCssClass")||"";return-1!==e.indexOf(":all:")&&(e=e.replace(":all:",""),n.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(e),t},e}),u.define("select2/selection/eventRelay",["jquery"],function(r){function e(){}return e.prototype.bind=function(e,t,n){var s=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],o=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){var n;-1!==i.indexOf(e)&&(t=t||{},n=r.Event("select2:"+e,{params:t}),s.$element.trigger(n),-1!==o.indexOf(e)&&(t.prevented=n.isDefaultPrevented()))})},e}),u.define("select2/translation",["jquery","require"],function(t,n){function s(e){this.dict=e||{}}return s.prototype.all=function(){return this.dict},s.prototype.get=function(e){return this.dict[e]},s.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},s._cache={},s.loadPath=function(e){var t;return e in s._cache||(t=n(e),s._cache[e]=t),new s(s._cache[e])},s}),u.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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),u.define("select2/data/base",["../utils"],function(n){function s(e,t){s.__super__.constructor.call(this)}return n.Extend(s,n.Observable),s.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},s.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},s.prototype.bind=function(e,t){},s.prototype.destroy=function(){},s.prototype.generateResultId=function(e,t){e=e.id+"-result-";return e+=n.generateChars(4),null!=t.id?e+="-"+t.id.toString():e+="-"+n.generateChars(4),e},s}),u.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.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(l(e))}))},n.prototype.select=function(i){var e,o=this;if(i.selected=!0,null!=i.element&&"option"===i.element.tagName.toLowerCase())return i.element.selected=!0,void this.$element.trigger("input").trigger("change");this.$element.prop("multiple")?this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var s=i[n].id;-1===t.indexOf(s)&&t.push(s)}o.$element.val(t),o.$element.trigger("input").trigger("change")}):(e=i.id,this.$element.val(e),this.$element.trigger("input").trigger("change"))},n.prototype.unselect=function(i){var o=this;if(this.$element.prop("multiple")){if(i.selected=!1,null!=i.element&&"option"===i.element.tagName.toLowerCase())return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var s=e[n].id;s!==i.id&&-1===t.indexOf(s)&&t.push(s)}o.$element.val(t),o.$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(){a.RemoveData(this)})},n.prototype.query=function(t,e){var n=[],s=this;this.$element.children().each(function(){var e;"option"!==this.tagName.toLowerCase()&&"optgroup"!==this.tagName.toLowerCase()||(e=l(this),e=s.item(e),null!==(e=s.matches(t,e))&&n.push(e))}),e({results:n})},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);e=this._normalizeItem(e);return e.element=t,a.StoreData(t,"data",e),l(t)},n.prototype.item=function(e){var t={};if(null!=(t=a.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 s=e.children("option"),i=[],o=0;o<s.length;o++){var r=l(s[o]),r=this.item(r);i.push(r)}t.children=i}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.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)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),u.define("select2/data/array",["./select","../utils","jquery"],function(e,t,c){function s(e,t){this._dataToConvert=t.get("data")||[],s.__super__.constructor.call(this,e,t)}return t.Extend(s,e),s.prototype.bind=function(e,t){s.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},s.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)),s.__super__.select.call(this,n)},s.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),s=n.map(function(){return t.item(c(this)).id}).get(),i=[];for(var o=0;o<e.length;o++){var r,a,l=this._normalizeItem(e[o]);0<=s.indexOf(l.id)?(r=n.filter(function(e){return function(){return c(this).val()==e.id}}(l)),a=this.item(r),a=c.extend(!0,{},l,a),a=this.option(a),r.replaceWith(a)):(a=this.option(l),l.children&&(l=this.convertToOptions(l.children),a.append(l)),i.push(a))}return i},s}),u.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,o){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 o.extend({},e,{q:e.term})},transport:function(e,t,n){e=o.ajax(e);return e.then(t),e.fail(n),e}};return o.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(t,n){var s=this;null!=this._request&&("function"==typeof this._request.abort&&this._request.abort(),this._request=null);var i=o.extend({type:"GET"},this.ajaxOptions);function e(){var e=i.transport(i,function(e){e=s.processResults(e,t);s.options.get("debug")&&window.console&&console.error&&(e&&e.results&&Array.isArray(e.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),n(e)},function(){"status"in e&&(0===e.status||"0"===e.status)||s.trigger("results:message",{message:"errorLoading"})});s._request=e}"function"==typeof i.url&&(i.url=i.url.call(this.$element,t)),"function"==typeof i.data&&(i.data=i.data.call(this.$element,t)),this.ajaxOptions.delay&&null!=t.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),u.define("select2/data/tags",["jquery"],function(t){function e(e,t,n){var s=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);i=n.get("insertTag");if(void 0!==i&&(this.insertTag=i),e.call(this,t,n),Array.isArray(s))for(var o=0;o<s.length;o++){var r=s[o],r=this._normalizeItem(r),r=this.option(r);this.$element.append(r)}}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 s=t.results,i=0;i<s.length;i++){var o=s[i],r=null!=o.children&&!e({results:o.children},!0);if((o.text||"").toUpperCase()===(c.term||"").toUpperCase()||r)return!n&&(t.data=s,void u(t))}if(n)return!0;var a,l=d.createTag(c);null!=l&&((a=d.option(l)).attr("data-select2-tag","true"),d.addOptions([a]),d.insertTag(s,l)),t.results=s,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){if(null==t.term)return null;t=t.term.trim();return""===t?null:{id:t,text:t}},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}),u.define("select2/data/tokenizer",["jquery"],function(c){function e(e,t,n){var s=n.get("tokenizer");void 0!==s&&(this.tokenizer=s),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 s=this;t.term=t.term||"";var i=this.tokenizer(t,this.options,function(e){var t,n=s._normalizeItem(e);s.$element.find("option").filter(function(){return c(this).val()===n.id}).length||((t=s.option(n)).attr("data-select2-tag",!0),s._removeOldTags(),s.addOptions([t])),t=n,s.trigger("select",{data:t})});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,s){for(var i=n.get("tokenSeparators")||[],o=t.term,r=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};r<o.length;){var l=o[r];-1!==i.indexOf(l)?(l=o.substr(0,r),null!=(l=a(c.extend({},t,{term:l})))?(s(l),o=o.substr(r+1)||"",r=0):r++):r++}return{term:o}},e}),u.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}),u.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}),u.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 s=this;e.call(this,t,n),t.on("select",function(){s._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var s=this;this._checkIfMaximumSelected(function(){e.call(s,t,n)})},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current(function(e){e=null!=e?e.length:0;0<n.maximumSelectionLength&&e>=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):t&&t()})},e}),u.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}),u.define("select2/dropdown/search",["jquery"],function(o){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("translations").get("search"),e=o('<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=e,this.$search=e.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",n()),t.prepend(e),t},e.prototype.bind=function(e,t,n){var s=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){s.handleSearch(e)}),t.on("open",function(){s.$search.attr("tabindex",0),s.$search.attr("aria-controls",i),s.$search.trigger("focus"),window.setTimeout(function(){s.$search.trigger("focus")},0)}),t.on("close",function(){s.$search.attr("tabindex",-1),s.$search.removeAttr("aria-controls"),s.$search.removeAttr("aria-activedescendant"),s.$search.val(""),s.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||s.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(s.showSearch(e)?s.$searchContainer[0].classList.remove("select2-search--hide"):s.$searchContainer[0].classList.add("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$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}),u.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,s){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,s)}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),s=t.length-1;0<=s;s--){var i=t[s];this.placeholder.id===i.id&&n.splice(s,1)}return n},e}),u.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,s){this.lastParams={},e.call(this,t,n,s),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 s=this;e.call(this,t,n),t.on("query",function(e){s.lastParams=e,s.loading=!0}),t.on("query:append",function(e){s.lastParams=e,s.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&e&&(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}),u.define("select2/dropdown/attachBody",["jquery","../utils"],function(u,r){function e(e,t,n){this.$dropdownParent=u(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("open",function(){s._showDropdown(),s._attachPositioningHandler(t),s._bindContainerResultHandlers(t)}),t.on("close",function(){s._hideDropdown(),s._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=u("<span></span>"),e=e.call(this);return t.append(e),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,s="scroll.select2."+t.id,i="resize.select2."+t.id,o="orientationchange.select2."+t.id,t=this.$container.parents().filter(r.hasScroll);t.each(function(){r.StoreData(this,"select2-scroll-position",{x:u(this).scrollLeft(),y:u(this).scrollTop()})}),t.on(s,function(e){var t=r.GetData(this,"select2-scroll-position");u(this).scrollTop(t.y)}),u(window).on(s+" "+i+" "+o,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,s="resize.select2."+t.id,t="orientationchange.select2."+t.id;this.$container.parents().filter(r.hasScroll).off(n),u(window).off(n+" "+s+" "+t)},e.prototype._positionDropdown=function(){var e=u(window),t=this.$dropdown[0].classList.contains("select2-dropdown--above"),n=this.$dropdown[0].classList.contains("select2-dropdown--below"),s=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var o={height:this.$container.outerHeight(!1)};o.top=i.top,o.bottom=i.top+o.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-r,e=l>i.bottom+r,a={left:i.left,top:o.bottom},l=this.$dropdownParent;"static"===l.css("position")&&(l=l.offsetParent());i={top:0,left:0};(u.contains(document.body,l[0])||l[0].isConnected)&&(i=l.offset()),a.top-=i.top,a.left-=i.left,t||n||(s="below"),e||!c||t?!c&&e&&t&&(s="below"):s="above",("above"==s||t&&"below"!==s)&&(a.top=o.top-i.top-r),null!=s&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+s),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+s)),this.$dropdownContainer.css(a)},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}),u.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,s){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,s)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,s=0;s<t.length;s++){var i=t[s];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),u.define("select2/dropdown/selectOnClose",["../utils"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("close",function(e){s._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}n=this.getHighlightedResults();n.length<1||(null!=(n=s.GetData(n[0],"data")).element&&n.element.selected||null==n.element&&n.selected||this.trigger("select",{data:n}))},e}),u.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("select",function(e){s._selectTriggered(e)}),t.on("unselect",function(e){s._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}),u.define("select2/dropdown/dropdownCss",["../utils"],function(n){function e(){}return e.prototype.render=function(e){var t=e.call(this),e=this.options.get("dropdownCssClass")||"";return-1!==e.indexOf(":all:")&&(e=e.replace(":all:",""),n.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(e),t},e}),u.define("select2/dropdown/tagsSearchHighlight",["../utils"],function(s){function e(){}return e.prototype.highlightFirstItem=function(e){var t=this.$results.find(".select2-results__option--selectable:not(.select2-results__option--selected)");if(0<t.length){var n=t.first(),t=s.GetData(n[0],"data").element;if(t&&t.getAttribute&&"true"===t.getAttribute("data-select2-tag"))return void n.trigger("mouseenter")}e.call(this)},e}),u.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,e="Please delete "+t+" character";return 1!=t&&(e+="s"),e},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"},search:function(){return"Search"}}}),u.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","./dropdown/tagsSearchHighlight","./i18n/en"],function(l,o,r,a,c,u,d,p,h,f,g,t,m,v,y,_,b,w,$,x,A,D,S,O,L,E,C,T,q,I,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,w)),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,b))),null==e.resultsAdapter&&(e.resultsAdapter=o,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)),e.tags&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,I))),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,E)),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,L)),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=[],s=0;s<e.language.length;s++){var i=e.language[s];-1===n.indexOf(i)&&n.push(i)}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 s=l.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&s.children.splice(i,1);return 0<s.children.length?s:e(t,s)}var o=a(n.text).toUpperCase(),r=a(t.term).toUpperCase();return-1<o.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,s=this.defaults.language,i=t.prop("lang"),t=t.closest("[lang]").prop("lang"),t=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(s),this._resolveLanguage(t));return e.language=t,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],s=[],i=0;i<n.length;i++)s.push(n[i]),"string"==typeof n[i]&&0<n[i].indexOf("-")&&(t=n[i].split("-")[0],s.push(t));return s},n.prototype._processTranslations=function(e,t){for(var n=new g,s=0;s<e.length;s++){var i=new g,o=e[s];if("string"==typeof o)try{i=g.loadPath(o)}catch(e){try{o=this.defaults.amdLanguageBase+o,i=g.loadPath(o)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+o+'" could not be automatically loaded. A fallback will be used instead.')}}else i=l.isPlainObject(o)?new g(o):o;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[l.camelCase(e)]=t;n=f._convertData(n);l.extend(!0,this.defaults,n)},new n}),u.define("select2/options",["jquery","./defaults","./utils"],function(c,n,u){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),u.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.'),u.StoreData(e[0],"data",u.GetData(e[0],"select2Tags")),u.StoreData(e[0],"tags",!0)),u.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",u.GetData(e[0],"ajaxUrl")),u.StoreData(e[0],"ajax-Url",u.GetData(e[0],"ajaxUrl")));var n={};function s(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var o=e[0].attributes[i].name,r="data-";o.substr(0,r.length)==r&&(o=o.substring(r.length),r=u.GetData(e[0],o),n[o.replace(/-([a-z])/g,s)]=r)}c.fn.jquery&&"1."==c.fn.jquery.substr(0,2)&&e[0].dataset&&(n=c.extend(!0,{},e[0].dataset,n));var a,l=c.extend(!0,{},u.GetData(e[0]),n);for(a in l=u._convertData(l))-1<t.indexOf(a)||(c.isPlainObject(this.options[a])?c.extend(this.options[a],l[a]):this.options[a]=l[a]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),u.define("select2/core",["jquery","./options","./utils","./keys"],function(t,i,o,s){var r=function(e,t){null!=o.GetData(e[0],"select2")&&o.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new i(t,e),r.__super__.constructor.call(this);var n=e.attr("tabindex")||0;o.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");t=this.options.get("dataAdapter");this.dataAdapter=new t(e,this.options);n=this.render();this._placeContainer(n);t=this.options.get("selectionAdapter");this.selection=new t(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,n);t=this.options.get("dropdownAdapter");this.dropdown=new t(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,n);n=this.options.get("resultsAdapter");this.results=new n(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var s=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){s.trigger("selection:update",{data:e})}),e[0].classList.add("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),o.StoreData(e[0],"select2",this),e.data("select2",this)};return o.Extend(r,o.Observable),r.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+o.generateChars(2):o.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},r.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},r.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 s=this._resolveWidth(e,"style");return null!=s?s:this._resolveWidth(e,"element")}if("element"==t){s=e.outerWidth(!1);return s<=0?"auto":s+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;e=e.attr("style");if("string"!=typeof e)return null;for(var i=e.split(";"),o=0,r=i.length;o<r;o+=1){var a=i[o].replace(/\s/g,"").match(n);if(null!==a&&1<=a.length)return a[1]}return null},r.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)},r.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=o.bind(this._syncAttributes,this),this._syncS=o.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})},r.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},r.prototype._registerSelectionEvents=function(){var n=this,s=["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===s.indexOf(e)&&n.trigger(e,t)})},r.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},r.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},r.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===s.ESC||t===s.UP&&e.altKey?(n.close(e),e.preventDefault()):t===s.ENTER||t===s.TAB?(n.trigger("results:select",{}),e.preventDefault()):t===s.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===s.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===s.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===s.ENTER||t===s.SPACE||t===s.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},r.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},r.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},r.prototype._syncSubtree=function(e){var e=this._isChangeMutation(e),t=this;e&&this.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})},r.prototype.trigger=function(e,t){var n=r.__super__.trigger,s={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in s){var i=s[e],s={prevented:!1,name:e,args:t};if(n.call(this,i,s),s.prevented)return void(t.prevented=!0)}n.call(this,e,t)},r.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},r.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},r.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},r.prototype.isEnabled=function(){return!this.isDisabled()},r.prototype.isDisabled=function(){return this.options.get("disabled")},r.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},r.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},r.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},r.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]);e=!e[0];this.$element.prop("disabled",e)},r.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},r.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();e=e[0];Array.isArray(e)&&(e=e.map(function(e){return e.toString()})),this.$element.val(e).trigger("input").trigger("change")},r.prototype.destroy=function(){o.RemoveData(this.$container[0]),this.$container.remove(),this._observer.disconnect(),this._observer=null,this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",o.GetData(this.$element[0],"old-tabindex")),this.$element[0].classList.remove("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),o.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},r.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")),o.StoreData(e[0],"element",this.$element),e},r}),u.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}),u.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}),u.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}),a=function(u){var d,p,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],h=Array.prototype.slice;if(u.event.fixHooks)for(var n=e.length;n;)u.event.fixHooks[e[--n]]=u.event.mouseHooks;var f=u.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],s,!1);else this.onmousewheel=s;u.data(this,"mousewheel-line-height",f.getLineHeight(this)),u.data(this,"mousewheel-page-height",f.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],s,!1);else this.onmousewheel=null;u.removeData(this,"mousewheel-line-height"),u.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var t=u(e),e=t["offsetParent"in u.fn?"offsetParent":"parent"]();return e.length||(e=u("body")),parseInt(e.css("fontSize"),10)||parseInt(t.css("fontSize"),10)||16},getPageHeight:function(e){return u(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function s(e){var t,n=e||window.event,s=h.call(arguments,1),i=0,o=0,r=0,a=0,l=0,c=0;if(e=u.event.fix(n),e.type="mousewheel","detail"in n&&(r=-1*n.detail),"wheelDelta"in n&&(r=n.wheelDelta),"wheelDeltaY"in n&&(r=n.wheelDeltaY),"wheelDeltaX"in n&&(o=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(o=-1*r,r=0),i=0===r?o:r,"deltaY"in n&&(i=r=-1*n.deltaY),"deltaX"in n&&(o=n.deltaX,0===r&&(i=-1*o)),0!==r||0!==o)return 1===n.deltaMode?(i*=t=u.data(this,"mousewheel-line-height"),r*=t,o*=t):2===n.deltaMode&&(i*=t=u.data(this,"mousewheel-page-height"),r*=t,o*=t),a=Math.max(Math.abs(r),Math.abs(o)),(!p||a<p)&&m(n,p=a)&&(p/=40),m(n,a)&&(i/=40,o/=40,r/=40),i=Math[1<=i?"floor":"ceil"](i/p),o=Math[1<=o?"floor":"ceil"](o/p),r=Math[1<=r?"floor":"ceil"](r/p),f.settings.normalizeOffset&&this.getBoundingClientRect&&(a=this.getBoundingClientRect(),l=e.clientX-a.left,c=e.clientY-a.top),e.deltaX=o,e.deltaY=r,e.deltaFactor=p,e.offsetX=l,e.offsetY=c,e.deltaMode=0,s.unshift(e,i,o,r),d&&clearTimeout(d),d=setTimeout(g,200),(u.event.dispatch||u.event.handle).apply(this,s)}function g(){p=null}function m(e,t){return f.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120==0}u.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})},"function"==typeof u.define&&u.define.amd?u.define("jquery-mousewheel",["jquery"],a):"object"==typeof exports?module.exports=a:a(t),u.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,o,t,r){var a;return null==i.fn.select2&&(a=["open","close","destroy"],i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new o(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,s=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,s)}),-1<a.indexOf(t)?this:n}),null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),o}),{define:u.define,require:u.require});function b(e,t){return s.call(e,t)}function l(e,t){var n,s,i,o,r,a,l,c,u,d,p=t&&t.split("/"),h=v.map,f=h&&h["*"]||{};if(e){for(t=(e=e.split("/")).length-1,v.nodeIdCompat&&_.test(e[t])&&(e[t]=e[t].replace(_,"")),"."===e[0].charAt(0)&&p&&(e=p.slice(0,p.length-1).concat(e)),c=0;c<e.length;c++)"."===(d=e[c])?(e.splice(c,1),--c):".."===d&&(0===c||1===c&&".."===e[2]||".."===e[c-1]||0<c&&(e.splice(c-1,2),c-=2));e=e.join("/")}if((p||f)&&h){for(c=(n=e.split("/")).length;0<c;--c){if(s=n.slice(0,c).join("/"),p)for(u=p.length;0<u;--u)if(i=h[p.slice(0,u).join("/")],i=i&&i[s]){o=i,r=c;break}if(o)break;!a&&f&&f[s]&&(a=f[s],l=c)}!o&&a&&(o=a,r=l),o&&(n.splice(0,r,o),e=n.join("/"))}return e}function w(t,n){return function(){var e=i.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),r.apply(p,e.concat([t,n]))}}function x(e){var t;if(b(m,e)&&(t=m[e],delete m[e],y[e]=!0,o.apply(p,t)),!b(g,e)&&!b(y,e))throw new Error("No "+e);return g[e]}function c(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 A(e){return e?c(e):[]}var u=a.require("jquery.select2");return t.fn.select2.amd=a,u});
includes/vendor/select2/js/select2.js CHANGED
@@ -1,5746 +1,6209 @@
1
- /*!
2
- * Select2 4.0.5
3
- * https://select2.github.io
4
- *
5
- * Released under the MIT license
6
- * https://github.com/select2/select2/blob/master/LICENSE.md
7
- */
8
- (function (factory) {
9
- if (typeof define === 'function' && define.amd) {
10
- // AMD. Register as an anonymous module.
11
- define(['jquery'], factory);
12
- } else if (typeof module === 'object' && module.exports) {
13
- // Node/CommonJS
14
- module.exports = function (root, jQuery) {
15
- if (jQuery === undefined) {
16
- // require('jQuery') returns a factory that requires window to
17
- // build a jQuery instance, we normalize how we use modules
18
- // that require this pattern but the window provided is a noop
19
- // if it's defined (how jquery works)
20
- if (typeof window !== 'undefined') {
21
- jQuery = require('jquery');
22
- }
23
- else {
24
- jQuery = require('jquery')(root);
25
- }
26
- }
27
- factory(jQuery);
28
- return jQuery;
29
- };
30
- } else {
31
- // Browser globals
32
- factory(jQuery);
33
- }
34
- } (function (jQuery) {
35
- // This is needed so we can catch the AMD loader configuration and use it
36
- // The inner file should be wrapped (by `banner.start.js`) in a function that
37
- // returns the AMD loader references.
38
- var S2 =(function () {
39
- // Restore the Select2 AMD loader so it can be used
40
- // Needed mostly in the language files, where the loader is not inserted
41
- if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
42
- var S2 = jQuery.fn.select2.amd;
43
- }
44
- var S2;(function () { if (!S2 || !S2.requirejs) {
45
- if (!S2) { S2 = {}; } else { require = S2; }
46
- /**
47
- * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
48
- * Released under MIT license, http://github.com/requirejs/almond/LICENSE
49
- */
50
- //Going sloppy to avoid 'use strict' string cost, but strict practices should
51
- //be followed.
52
- /*global setTimeout: false */
53
-
54
- var requirejs, require, define;
55
- (function (undef) {
56
- var main, req, makeMap, handlers,
57
- defined = {},
58
- waiting = {},
59
- config = {},
60
- defining = {},
61
- hasOwn = Object.prototype.hasOwnProperty,
62
- aps = [].slice,
63
- jsSuffixRegExp = /\.js$/;
64
-
65
- function hasProp(obj, prop) {
66
- return hasOwn.call(obj, prop);
67
- }
68
-
69
- /**
70
- * Given a relative module name, like ./something, normalize it to
71
- * a real name that can be mapped to a path.
72
- * @param {String} name the relative name
73
- * @param {String} baseName a real name that the name arg is relative
74
- * to.
75
- * @returns {String} normalized name
76
- */
77
- function normalize(name, baseName) {
78
- var nameParts, nameSegment, mapValue, foundMap, lastIndex,
79
- foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
80
- baseParts = baseName && baseName.split("/"),
81
- map = config.map,
82
- starMap = (map && map['*']) || {};
83
-
84
- //Adjust any relative paths.
85
- if (name) {
86
- name = name.split('/');
87
- lastIndex = name.length - 1;
88
-
89
- // If wanting node ID compatibility, strip .js from end
90
- // of IDs. Have to do this here, and not in nameToUrl
91
- // because node allows either .js or non .js to map
92
- // to same file.
93
- if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
94
- name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
95
- }
96
-
97
- // Starts with a '.' so need the baseName
98
- if (name[0].charAt(0) === '.' && baseParts) {
99
- //Convert baseName to array, and lop off the last part,
100
- //so that . matches that 'directory' and not name of the baseName's
101
- //module. For instance, baseName of 'one/two/three', maps to
102
- //'one/two/three.js', but we want the directory, 'one/two' for
103
- //this normalization.
104
- normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
105
- name = normalizedBaseParts.concat(name);
106
- }
107
-
108
- //start trimDots
109
- for (i = 0; i < name.length; i++) {
110
- part = name[i];
111
- if (part === '.') {
112
- name.splice(i, 1);
113
- i -= 1;
114
- } else if (part === '..') {
115
- // If at the start, or previous value is still ..,
116
- // keep them so that when converted to a path it may
117
- // still work when converted to a path, even though
118
- // as an ID it is less than ideal. In larger point
119
- // releases, may be better to just kick out an error.
120
- if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
121
- continue;
122
- } else if (i > 0) {
123
- name.splice(i - 1, 2);
124
- i -= 2;
125
- }
126
- }
127
- }
128
- //end trimDots
129
-
130
- name = name.join('/');
131
- }
132
-
133
- //Apply map config if available.
134
- if ((baseParts || starMap) && map) {
135
- nameParts = name.split('/');
136
-
137
- for (i = nameParts.length; i > 0; i -= 1) {
138
- nameSegment = nameParts.slice(0, i).join("/");
139
-
140
- if (baseParts) {
141
- //Find the longest baseName segment match in the config.
142
- //So, do joins on the biggest to smallest lengths of baseParts.
143
- for (j = baseParts.length; j > 0; j -= 1) {
144
- mapValue = map[baseParts.slice(0, j).join('/')];
145
-
146
- //baseName segment has config, find if it has one for
147
- //this name.
148
- if (mapValue) {
149
- mapValue = mapValue[nameSegment];
150
- if (mapValue) {
151
- //Match, update name to the new value.
152
- foundMap = mapValue;
153
- foundI = i;
154
- break;
155
- }
156
- }
157
- }
158
- }
159
-
160
- if (foundMap) {
161
- break;
162
- }
163
-
164
- //Check for a star map match, but just hold on to it,
165
- //if there is a shorter segment match later in a matching
166
- //config, then favor over this star map.
167
- if (!foundStarMap && starMap && starMap[nameSegment]) {
168
- foundStarMap = starMap[nameSegment];
169
- starI = i;
170
- }
171
- }
172
-
173
- if (!foundMap && foundStarMap) {
174
- foundMap = foundStarMap;
175
- foundI = starI;
176
- }
177
-
178
- if (foundMap) {
179
- nameParts.splice(0, foundI, foundMap);
180
- name = nameParts.join('/');
181
- }
182
- }
183
-
184
- return name;
185
- }
186
-
187
- function makeRequire(relName, forceSync) {
188
- return function () {
189
- //A version of a require function that passes a moduleName
190
- //value for items that may need to
191
- //look up paths relative to the moduleName
192
- var args = aps.call(arguments, 0);
193
-
194
- //If first arg is not require('string'), and there is only
195
- //one arg, it is the array form without a callback. Insert
196
- //a null so that the following concat is correct.
197
- if (typeof args[0] !== 'string' && args.length === 1) {
198
- args.push(null);
199
- }
200
- return req.apply(undef, args.concat([relName, forceSync]));
201
- };
202
- }
203
-
204
- function makeNormalize(relName) {
205
- return function (name) {
206
- return normalize(name, relName);
207
- };
208
- }
209
-
210
- function makeLoad(depName) {
211
- return function (value) {
212
- defined[depName] = value;
213
- };
214
- }
215
-
216
- function callDep(name) {
217
- if (hasProp(waiting, name)) {
218
- var args = waiting[name];
219
- delete waiting[name];
220
- defining[name] = true;
221
- main.apply(undef, args);
222
- }
223
-
224
- if (!hasProp(defined, name) && !hasProp(defining, name)) {
225
- throw new Error('No ' + name);
226
- }
227
- return defined[name];
228
- }
229
-
230
- //Turns a plugin!resource to [plugin, resource]
231
- //with the plugin being undefined if the name
232
- //did not have a plugin prefix.
233
- function splitPrefix(name) {
234
- var prefix,
235
- index = name ? name.indexOf('!') : -1;
236
- if (index > -1) {
237
- prefix = name.substring(0, index);
238
- name = name.substring(index + 1, name.length);
239
- }
240
- return [prefix, name];
241
- }
242
-
243
- //Creates a parts array for a relName where first part is plugin ID,
244
- //second part is resource ID. Assumes relName has already been normalized.
245
- function makeRelParts(relName) {
246
- return relName ? splitPrefix(relName) : [];
247
- }
248
-
249
- /**
250
- * Makes a name map, normalizing the name, and using a plugin
251
- * for normalization if necessary. Grabs a ref to plugin
252
- * too, as an optimization.
253
- */
254
- makeMap = function (name, relParts) {
255
- var plugin,
256
- parts = splitPrefix(name),
257
- prefix = parts[0],
258
- relResourceName = relParts[1];
259
-
260
- name = parts[1];
261
-
262
- if (prefix) {
263
- prefix = normalize(prefix, relResourceName);
264
- plugin = callDep(prefix);
265
- }
266
-
267
- //Normalize according
268
- if (prefix) {
269
- if (plugin && plugin.normalize) {
270
- name = plugin.normalize(name, makeNormalize(relResourceName));
271
- } else {
272
- name = normalize(name, relResourceName);
273
- }
274
- } else {
275
- name = normalize(name, relResourceName);
276
- parts = splitPrefix(name);
277
- prefix = parts[0];
278
- name = parts[1];
279
- if (prefix) {
280
- plugin = callDep(prefix);
281
- }
282
- }
283
-
284
- //Using ridiculous property names for space reasons
285
- return {
286
- f: prefix ? prefix + '!' + name : name, //fullName
287
- n: name,
288
- pr: prefix,
289
- p: plugin
290
- };
291
- };
292
-
293
- function makeConfig(name) {
294
- return function () {
295
- return (config && config.config && config.config[name]) || {};
296
- };
297
- }
298
-
299
- handlers = {
300
- require: function (name) {
301
- return makeRequire(name);
302
- },
303
- exports: function (name) {
304
- var e = defined[name];
305
- if (typeof e !== 'undefined') {
306
- return e;
307
- } else {
308
- return (defined[name] = {});
309
- }
310
- },
311
- module: function (name) {
312
- return {
313
- id: name,
314
- uri: '',
315
- exports: defined[name],
316
- config: makeConfig(name)
317
- };
318
- }
319
- };
320
-
321
- main = function (name, deps, callback, relName) {
322
- var cjsModule, depName, ret, map, i, relParts,
323
- args = [],
324
- callbackType = typeof callback,
325
- usingExports;
326
-
327
- //Use name if no relName
328
- relName = relName || name;
329
- relParts = makeRelParts(relName);
330
-
331
- //Call the callback to define the module, if necessary.
332
- if (callbackType === 'undefined' || callbackType === 'function') {
333
- //Pull out the defined dependencies and pass the ordered
334
- //values to the callback.
335
- //Default to [require, exports, module] if no deps
336
- deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
337
- for (i = 0; i < deps.length; i += 1) {
338
- map = makeMap(deps[i], relParts);
339
- depName = map.f;
340
-
341
- //Fast path CommonJS standard dependencies.
342
- if (depName === "require") {
343
- args[i] = handlers.require(name);
344
- } else if (depName === "exports") {
345
- //CommonJS module spec 1.1
346
- args[i] = handlers.exports(name);
347
- usingExports = true;
348
- } else if (depName === "module") {
349
- //CommonJS module spec 1.1
350
- cjsModule = args[i] = handlers.module(name);
351
- } else if (hasProp(defined, depName) ||
352
- hasProp(waiting, depName) ||
353
- hasProp(defining, depName)) {
354
- args[i] = callDep(depName);
355
- } else if (map.p) {
356
- map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
357
- args[i] = defined[depName];
358
- } else {
359
- throw new Error(name + ' missing ' + depName);
360
- }
361
- }
362
-
363
- ret = callback ? callback.apply(defined[name], args) : undefined;
364
-
365
- if (name) {
366
- //If setting exports via "module" is in play,
367
- //favor that over return value and exports. After that,
368
- //favor a non-undefined return value over exports use.
369
- if (cjsModule && cjsModule.exports !== undef &&
370
- cjsModule.exports !== defined[name]) {
371
- defined[name] = cjsModule.exports;
372
- } else if (ret !== undef || !usingExports) {
373
- //Use the return value from the function.
374
- defined[name] = ret;
375
- }
376
- }
377
- } else if (name) {
378
- //May just be an object definition for the module. Only
379
- //worry about defining if have a module name.
380
- defined[name] = callback;
381
- }
382
- };
383
-
384
- requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
385
- if (typeof deps === "string") {
386
- if (handlers[deps]) {
387
- //callback in this case is really relName
388
- return handlers[deps](callback);
389
- }
390
- //Just return the module wanted. In this scenario, the
391
- //deps arg is the module name, and second arg (if passed)
392
- //is just the relName.
393
- //Normalize module name, if it contains . or ..
394
- return callDep(makeMap(deps, makeRelParts(callback)).f);
395
- } else if (!deps.splice) {
396
- //deps is a config object, not an array.
397
- config = deps;
398
- if (config.deps) {
399
- req(config.deps, config.callback);
400
- }
401
- if (!callback) {
402
- return;
403
- }
404
-
405
- if (callback.splice) {
406
- //callback is an array, which means it is a dependency list.
407
- //Adjust args if there are dependencies
408
- deps = callback;
409
- callback = relName;
410
- relName = null;
411
- } else {
412
- deps = undef;
413
- }
414
- }
415
-
416
- //Support require(['a'])
417
- callback = callback || function () {};
418
-
419
- //If relName is a function, it is an errback handler,
420
- //so remove it.
421
- if (typeof relName === 'function') {
422
- relName = forceSync;
423
- forceSync = alt;
424
- }
425
-
426
- //Simulate async callback;
427
- if (forceSync) {
428
- main(undef, deps, callback, relName);
429
- } else {
430
- //Using a non-zero value because of concern for what old browsers
431
- //do, and latest browsers "upgrade" to 4 if lower value is used:
432
- //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
433
- //If want a value immediately, use require('id') instead -- something
434
- //that works in almond on the global level, but not guaranteed and
435
- //unlikely to work in other AMD implementations.
436
- setTimeout(function () {
437
- main(undef, deps, callback, relName);
438
- }, 4);
439
- }
440
-
441
- return req;
442
- };
443
-
444
- /**
445
- * Just drops the config on the floor, but returns req in case
446
- * the config return value is used.
447
- */
448
- req.config = function (cfg) {
449
- return req(cfg);
450
- };
451
-
452
- /**
453
- * Expose module registry for debugging and tooling
454
- */
455
- requirejs._defined = defined;
456
-
457
- define = function (name, deps, callback) {
458
- if (typeof name !== 'string') {
459
- throw new Error('See almond README: incorrect module build, no module name');
460
- }
461
-
462
- //This module may not have dependencies
463
- if (!deps.splice) {
464
- //deps is not an array, so probably means
465
- //an object literal or factory function for
466
- //the value. Adjust args.
467
- callback = deps;
468
- deps = [];
469
- }
470
-
471
- if (!hasProp(defined, name) && !hasProp(waiting, name)) {
472
- waiting[name] = [name, deps, callback];
473
- }
474
- };
475
-
476
- define.amd = {
477
- jQuery: true
478
- };
479
- }());
480
-
481
- S2.requirejs = requirejs;S2.require = require;S2.define = define;
482
- }
483
- }());
484
- S2.define("almond", function(){});
485
-
486
- /* global jQuery:false, $:false */
487
- S2.define('jquery',[],function () {
488
- var _$ = jQuery || $;
489
-
490
- if (_$ == null && console && console.error) {
491
- console.error(
492
- 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
493
- 'found. Make sure that you are including jQuery before Select2 on your ' +
494
- 'web page.'
495
- );
496
- }
497
-
498
- return _$;
499
- });
500
-
501
- S2.define('select2/utils',[
502
- 'jquery'
503
- ], function ($) {
504
- var Utils = {};
505
-
506
- Utils.Extend = function (ChildClass, SuperClass) {
507
- var __hasProp = {}.hasOwnProperty;
508
-
509
- function BaseConstructor () {
510
- this.constructor = ChildClass;
511
- }
512
-
513
- for (var key in SuperClass) {
514
- if (__hasProp.call(SuperClass, key)) {
515
- ChildClass[key] = SuperClass[key];
516
- }
517
- }
518
-
519
- BaseConstructor.prototype = SuperClass.prototype;
520
- ChildClass.prototype = new BaseConstructor();
521
- ChildClass.__super__ = SuperClass.prototype;
522
-
523
- return ChildClass;
524
- };
525
-
526
- function getMethods (theClass) {
527
- var proto = theClass.prototype;
528
-
529
- var methods = [];
530
-
531
- for (var methodName in proto) {
532
- var m = proto[methodName];
533
-
534
- if (typeof m !== 'function') {
535
- continue;
536
- }
537
-
538
- if (methodName === 'constructor') {
539
- continue;
540
- }
541
-
542
- methods.push(methodName);
543
- }
544
-
545
- return methods;
546
- }
547
-
548
- Utils.Decorate = function (SuperClass, DecoratorClass) {
549
- var decoratedMethods = getMethods(DecoratorClass);
550
- var superMethods = getMethods(SuperClass);
551
-
552
- function DecoratedClass () {
553
- var unshift = Array.prototype.unshift;
554
-
555
- var argCount = DecoratorClass.prototype.constructor.length;
556
-
557
- var calledConstructor = SuperClass.prototype.constructor;
558
-
559
- if (argCount > 0) {
560
- unshift.call(arguments, SuperClass.prototype.constructor);
561
-
562
- calledConstructor = DecoratorClass.prototype.constructor;
563
- }
564
-
565
- calledConstructor.apply(this, arguments);
566
- }
567
-
568
- DecoratorClass.displayName = SuperClass.displayName;
569
-
570
- function ctr () {
571
- this.constructor = DecoratedClass;
572
- }
573
-
574
- DecoratedClass.prototype = new ctr();
575
-
576
- for (var m = 0; m < superMethods.length; m++) {
577
- var superMethod = superMethods[m];
578
-
579
- DecoratedClass.prototype[superMethod] =
580
- SuperClass.prototype[superMethod];
581
- }
582
-
583
- var calledMethod = function (methodName) {
584
- // Stub out the original method if it's not decorating an actual method
585
- var originalMethod = function () {};
586
-
587
- if (methodName in DecoratedClass.prototype) {
588
- originalMethod = DecoratedClass.prototype[methodName];
589
- }
590
-
591
- var decoratedMethod = DecoratorClass.prototype[methodName];
592
-
593
- return function () {
594
- var unshift = Array.prototype.unshift;
595
-
596
- unshift.call(arguments, originalMethod);
597
-
598
- return decoratedMethod.apply(this, arguments);
599
- };
600
- };
601
-
602
- for (var d = 0; d < decoratedMethods.length; d++) {
603
- var decoratedMethod = decoratedMethods[d];
604
-
605
- DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
606
- }
607
-
608
- return DecoratedClass;
609
- };
610
-
611
- var Observable = function () {
612
- this.listeners = {};
613
- };
614
-
615
- Observable.prototype.on = function (event, callback) {
616
- this.listeners = this.listeners || {};
617
-
618
- if (event in this.listeners) {
619
- this.listeners[event].push(callback);
620
- } else {
621
- this.listeners[event] = [callback];
622
- }
623
- };
624
-
625
- Observable.prototype.trigger = function (event) {
626
- var slice = Array.prototype.slice;
627
- var params = slice.call(arguments, 1);
628
-
629
- this.listeners = this.listeners || {};
630
-
631
- // Params should always come in as an array
632
- if (params == null) {
633
- params = [];
634
- }
635
-
636
- // If there are no arguments to the event, use a temporary object
637
- if (params.length === 0) {
638
- params.push({});
639
- }
640
-
641
- // Set the `_type` of the first object to the event
642
- params[0]._type = event;
643
-
644
- if (event in this.listeners) {
645
- this.invoke(this.listeners[event], slice.call(arguments, 1));
646
- }
647
-
648
- if ('*' in this.listeners) {
649
- this.invoke(this.listeners['*'], arguments);
650
- }
651
- };
652
-
653
- Observable.prototype.invoke = function (listeners, params) {
654
- for (var i = 0, len = listeners.length; i < len; i++) {
655
- listeners[i].apply(this, params);
656
- }
657
- };
658
-
659
- Utils.Observable = Observable;
660
-
661
- Utils.generateChars = function (length) {
662
- var chars = '';
663
-
664
- for (var i = 0; i < length; i++) {
665
- var randomChar = Math.floor(Math.random() * 36);
666
- chars += randomChar.toString(36);
667
- }
668
-
669
- return chars;
670
- };
671
-
672
- Utils.bind = function (func, context) {
673
- return function () {
674
- func.apply(context, arguments);
675
- };
676
- };
677
-
678
- Utils._convertData = function (data) {
679
- for (var originalKey in data) {
680
- var keys = originalKey.split('-');
681
-
682
- var dataLevel = data;
683
-
684
- if (keys.length === 1) {
685
- continue;
686
- }
687
-
688
- for (var k = 0; k < keys.length; k++) {
689
- var key = keys[k];
690
-
691
- // Lowercase the first letter
692
- // By default, dash-separated becomes camelCase
693
- key = key.substring(0, 1).toLowerCase() + key.substring(1);
694
-
695
- if (!(key in dataLevel)) {
696
- dataLevel[key] = {};
697
- }
698
-
699
- if (k == keys.length - 1) {
700
- dataLevel[key] = data[originalKey];
701
- }
702
-
703
- dataLevel = dataLevel[key];
704
- }
705
-
706
- delete data[originalKey];
707
- }
708
-
709
- return data;
710
- };
711
-
712
- Utils.hasScroll = function (index, el) {
713
- // Adapted from the function created by @ShadowScripter
714
- // and adapted by @BillBarry on the Stack Exchange Code Review website.
715
- // The original code can be found at
716
- // http://codereview.stackexchange.com/q/13338
717
- // and was designed to be used with the Sizzle selector engine.
718
-
719
- var $el = $(el);
720
- var overflowX = el.style.overflowX;
721
- var overflowY = el.style.overflowY;
722
-
723
- //Check both x and y declarations
724
- if (overflowX === overflowY &&
725
- (overflowY === 'hidden' || overflowY === 'visible')) {
726
- return false;
727
- }
728
-
729
- if (overflowX === 'scroll' || overflowY === 'scroll') {
730
- return true;
731
- }
732
-
733
- return ($el.innerHeight() < el.scrollHeight ||
734
- $el.innerWidth() < el.scrollWidth);
735
- };
736
-
737
- Utils.escapeMarkup = function (markup) {
738
- var replaceMap = {
739
- '\\': '&#92;',
740
- '&': '&amp;',
741
- '<': '&lt;',
742
- '>': '&gt;',
743
- '"': '&quot;',
744
- '\'': '&#39;',
745
- '/': '&#47;'
746
- };
747
-
748
- // Do not try to escape the markup if it's not a string
749
- if (typeof markup !== 'string') {
750
- return markup;
751
- }
752
-
753
- return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
754
- return replaceMap[match];
755
- });
756
- };
757
-
758
- // Append an array of jQuery nodes to a given element.
759
- Utils.appendMany = function ($element, $nodes) {
760
- // jQuery 1.7.x does not support $.fn.append() with an array
761
- // Fall back to a jQuery object collection using $.fn.add()
762
- if ($.fn.jquery.substr(0, 3) === '1.7') {
763
- var $jqNodes = $();
764
-
765
- $.map($nodes, function (node) {
766
- $jqNodes = $jqNodes.add(node);
767
- });
768
-
769
- $nodes = $jqNodes;
770
- }
771
-
772
- $element.append($nodes);
773
- };
774
-
775
- return Utils;
776
- });
777
-
778
- S2.define('select2/results',[
779
- 'jquery',
780
- './utils'
781
- ], function ($, Utils) {
782
- function Results ($element, options, dataAdapter) {
783
- this.$element = $element;
784
- this.data = dataAdapter;
785
- this.options = options;
786
-
787
- Results.__super__.constructor.call(this);
788
- }
789
-
790
- Utils.Extend(Results, Utils.Observable);
791
-
792
- Results.prototype.render = function () {
793
- var $results = $(
794
- '<ul class="select2-results__options" role="tree"></ul>'
795
- );
796
-
797
- if (this.options.get('multiple')) {
798
- $results.attr('aria-multiselectable', 'true');
799
- }
800
-
801
- this.$results = $results;
802
-
803
- return $results;
804
- };
805
-
806
- Results.prototype.clear = function () {
807
- this.$results.empty();
808
- };
809
-
810
- Results.prototype.displayMessage = function (params) {
811
- var escapeMarkup = this.options.get('escapeMarkup');
812
-
813
- this.clear();
814
- this.hideLoading();
815
-
816
- var $message = $(
817
- '<li role="treeitem" aria-live="assertive"' +
818
- ' class="select2-results__option"></li>'
819
- );
820
-
821
- var message = this.options.get('translations').get(params.message);
822
-
823
- $message.append(
824
- escapeMarkup(
825
- message(params.args)
826
- )
827
- );
828
-
829
- $message[0].className += ' select2-results__message';
830
-
831
- this.$results.append($message);
832
- };
833
-
834
- Results.prototype.hideMessages = function () {
835
- this.$results.find('.select2-results__message').remove();
836
- };
837
-
838
- Results.prototype.append = function (data) {
839
- this.hideLoading();
840
-
841
- var $options = [];
842
-
843
- if (data.results == null || data.results.length === 0) {
844
- if (this.$results.children().length === 0) {
845
- this.trigger('results:message', {
846
- message: 'noResults'
847
- });
848
- }
849
-
850
- return;
851
- }
852
-
853
- data.results = this.sort(data.results);
854
-
855
- for (var d = 0; d < data.results.length; d++) {
856
- var item = data.results[d];
857
-
858
- var $option = this.option(item);
859
-
860
- $options.push($option);
861
- }
862
-
863
- this.$results.append($options);
864
- };
865
-
866
- Results.prototype.position = function ($results, $dropdown) {
867
- var $resultsContainer = $dropdown.find('.select2-results');
868
- $resultsContainer.append($results);
869
- };
870
-
871
- Results.prototype.sort = function (data) {
872
- var sorter = this.options.get('sorter');
873
-
874
- return sorter(data);
875
- };
876
-
877
- Results.prototype.highlightFirstItem = function () {
878
- var $options = this.$results
879
- .find('.select2-results__option[aria-selected]');
880
-
881
- var $selected = $options.filter('[aria-selected=true]');
882
-
883
- // Check if there are any selected options
884
- if ($selected.length > 0) {
885
- // If there are selected options, highlight the first
886
- $selected.first().trigger('mouseenter');
887
- } else {
888
- // If there are no selected options, highlight the first option
889
- // in the dropdown
890
- $options.first().trigger('mouseenter');
891
- }
892
-
893
- this.ensureHighlightVisible();
894
- };
895
-
896
- Results.prototype.setClasses = function () {
897
- var self = this;
898
-
899
- this.data.current(function (selected) {
900
- var selectedIds = $.map(selected, function (s) {
901
- return s.id.toString();
902
- });
903
-
904
- var $options = self.$results
905
- .find('.select2-results__option[aria-selected]');
906
-
907
- $options.each(function () {
908
- var $option = $(this);
909
-
910
- var item = $.data(this, 'data');
911
-
912
- // id needs to be converted to a string when comparing
913
- var id = '' + item.id;
914
-
915
- if ((item.element != null && item.element.selected) ||
916
- (item.element == null && $.inArray(id, selectedIds) > -1)) {
917
- $option.attr('aria-selected', 'true');
918
- } else {
919
- $option.attr('aria-selected', 'false');
920
- }
921
- });
922
-
923
- });
924
- };
925
-
926
- Results.prototype.showLoading = function (params) {
927
- this.hideLoading();
928
-
929
- var loadingMore = this.options.get('translations').get('searching');
930
-
931
- var loading = {
932
- disabled: true,
933
- loading: true,
934
- text: loadingMore(params)
935
- };
936
- var $loading = this.option(loading);
937
- $loading.className += ' loading-results';
938
-
939
- this.$results.prepend($loading);
940
- };
941
-
942
- Results.prototype.hideLoading = function () {
943
- this.$results.find('.loading-results').remove();
944
- };
945
-
946
- Results.prototype.option = function (data) {
947
- var option = document.createElement('li');
948
- option.className = 'select2-results__option';
949
-
950
- var attrs = {
951
- 'role': 'treeitem',
952
- 'aria-selected': 'false'
953
- };
954
-
955
- if (data.disabled) {
956
- delete attrs['aria-selected'];
957
- attrs['aria-disabled'] = 'true';
958
- }
959
-
960
- if (data.id == null) {
961
- delete attrs['aria-selected'];
962
- }
963
-
964
- if (data._resultId != null) {
965
- option.id = data._resultId;
966
- }
967
-
968
- if (data.title) {
969
- option.title = data.title;
970
- }
971
-
972
- if (data.children) {
973
- attrs.role = 'group';
974
- attrs['aria-label'] = data.text;
975
- delete attrs['aria-selected'];
976
- }
977
-
978
- for (var attr in attrs) {
979
- var val = attrs[attr];
980
-
981
- option.setAttribute(attr, val);
982
- }
983
-
984
- if (data.children) {
985
- var $option = $(option);
986
-
987
- var label = document.createElement('strong');
988
- label.className = 'select2-results__group';
989
-
990
- var $label = $(label);
991
- this.template(data, label);
992
-
993
- var $children = [];
994
-
995
- for (var c = 0; c < data.children.length; c++) {
996
- var child = data.children[c];
997
-
998
- var $child = this.option(child);
999
-
1000
- $children.push($child);
1001
- }
1002
-
1003
- var $childrenContainer = $('<ul></ul>', {
1004
- 'class': 'select2-results__options select2-results__options--nested'
1005
- });
1006
-
1007
- $childrenContainer.append($children);
1008
-
1009
- $option.append(label);
1010
- $option.append($childrenContainer);
1011
- } else {
1012
- this.template(data, option);
1013
- }
1014
-
1015
- $.data(option, 'data', data);
1016
-
1017
- return option;
1018
- };
1019
-
1020
- Results.prototype.bind = function (container, $container) {
1021
- var self = this;
1022
-
1023
- var id = container.id + '-results';
1024
-
1025
- this.$results.attr('id', id);
1026
-
1027
- container.on('results:all', function (params) {
1028
- self.clear();
1029
- self.append(params.data);
1030
-
1031
- if (container.isOpen()) {
1032
- self.setClasses();
1033
- self.highlightFirstItem();
1034
- }
1035
- });
1036
-
1037
- container.on('results:append', function (params) {
1038
- self.append(params.data);
1039
-
1040
- if (container.isOpen()) {
1041
- self.setClasses();
1042
- }
1043
- });
1044
-
1045
- container.on('query', function (params) {
1046
- self.hideMessages();
1047
- self.showLoading(params);
1048
- });
1049
-
1050
- container.on('select', function () {
1051
- if (!container.isOpen()) {
1052
- return;
1053
- }
1054
-
1055
- self.setClasses();
1056
- self.highlightFirstItem();
1057
- });
1058
-
1059
- container.on('unselect', function () {
1060
- if (!container.isOpen()) {
1061
- return;
1062
- }
1063
-
1064
- self.setClasses();
1065
- self.highlightFirstItem();
1066
- });
1067
-
1068
- container.on('open', function () {
1069
- // When the dropdown is open, aria-expended="true"
1070
- self.$results.attr('aria-expanded', 'true');
1071
- self.$results.attr('aria-hidden', 'false');
1072
-
1073
- self.setClasses();
1074
- self.ensureHighlightVisible();
1075
- });
1076
-
1077
- container.on('close', function () {
1078
- // When the dropdown is closed, aria-expended="false"
1079
- self.$results.attr('aria-expanded', 'false');
1080
- self.$results.attr('aria-hidden', 'true');
1081
- self.$results.removeAttr('aria-activedescendant');
1082
- });
1083
-
1084
- container.on('results:toggle', function () {
1085
- var $highlighted = self.getHighlightedResults();
1086
-
1087
- if ($highlighted.length === 0) {
1088
- return;
1089
- }
1090
-
1091
- $highlighted.trigger('mouseup');
1092
- });
1093
-
1094
- container.on('results:select', function () {
1095
- var $highlighted = self.getHighlightedResults();
1096
-
1097
- if ($highlighted.length === 0) {
1098
- return;
1099
- }
1100
-
1101
- var data = $highlighted.data('data');
1102
-
1103
- if ($highlighted.attr('aria-selected') == 'true') {
1104
- self.trigger('close', {});
1105
- } else {
1106
- self.trigger('select', {
1107
- data: data
1108
- });
1109
- }
1110
- });
1111
-
1112
- container.on('results:previous', function () {
1113
- var $highlighted = self.getHighlightedResults();
1114
-
1115
- var $options = self.$results.find('[aria-selected]');
1116
-
1117
- var currentIndex = $options.index($highlighted);
1118
-
1119
- // If we are already at te top, don't move further
1120
- if (currentIndex === 0) {
1121
- return;
1122
- }
1123
-
1124
- var nextIndex = currentIndex - 1;
1125
-
1126
- // If none are highlighted, highlight the first
1127
- if ($highlighted.length === 0) {
1128
- nextIndex = 0;
1129
- }
1130
-
1131
- var $next = $options.eq(nextIndex);
1132
-
1133
- $next.trigger('mouseenter');
1134
-
1135
- var currentOffset = self.$results.offset().top;
1136
- var nextTop = $next.offset().top;
1137
- var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1138
-
1139
- if (nextIndex === 0) {
1140
- self.$results.scrollTop(0);
1141
- } else if (nextTop - currentOffset < 0) {
1142
- self.$results.scrollTop(nextOffset);
1143
- }
1144
- });
1145
-
1146
- container.on('results:next', function () {
1147
- var $highlighted = self.getHighlightedResults();
1148
-
1149
- var $options = self.$results.find('[aria-selected]');
1150
-
1151
- var currentIndex = $options.index($highlighted);
1152
-
1153
- var nextIndex = currentIndex + 1;
1154
-
1155
- // If we are at the last option, stay there
1156
- if (nextIndex >= $options.length) {
1157
- return;
1158
- }
1159
-
1160
- var $next = $options.eq(nextIndex);
1161
-
1162
- $next.trigger('mouseenter');
1163
-
1164
- var currentOffset = self.$results.offset().top +
1165
- self.$results.outerHeight(false);
1166
- var nextBottom = $next.offset().top + $next.outerHeight(false);
1167
- var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1168
-
1169
- if (nextIndex === 0) {
1170
- self.$results.scrollTop(0);
1171
- } else if (nextBottom > currentOffset) {
1172
- self.$results.scrollTop(nextOffset);
1173
- }
1174
- });
1175
-
1176
- container.on('results:focus', function (params) {
1177
- params.element.addClass('select2-results__option--highlighted');
1178
- });
1179
-
1180
- container.on('results:message', function (params) {
1181
- self.displayMessage(params);
1182
- });
1183
-
1184
- if ($.fn.mousewheel) {
1185
- this.$results.on('mousewheel', function (e) {
1186
- var top = self.$results.scrollTop();
1187
-
1188
- var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1189
-
1190
- var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1191
- var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1192
-
1193
- if (isAtTop) {
1194
- self.$results.scrollTop(0);
1195
-
1196
- e.preventDefault();
1197
- e.stopPropagation();
1198
- } else if (isAtBottom) {
1199
- self.$results.scrollTop(
1200
- self.$results.get(0).scrollHeight - self.$results.height()
1201
- );
1202
-
1203
- e.preventDefault();
1204
- e.stopPropagation();
1205
- }
1206
- });
1207
- }
1208
-
1209
- this.$results.on('mouseup', '.select2-results__option[aria-selected]',
1210
- function (evt) {
1211
- var $this = $(this);
1212
-
1213
- var data = $this.data('data');
1214
-
1215
- if ($this.attr('aria-selected') === 'true') {
1216
- if (self.options.get('multiple')) {
1217
- self.trigger('unselect', {
1218
- originalEvent: evt,
1219
- data: data
1220
- });
1221
- } else {
1222
- self.trigger('close', {});
1223
- }
1224
-
1225
- return;
1226
- }
1227
-
1228
- self.trigger('select', {
1229
- originalEvent: evt,
1230
- data: data
1231
- });
1232
- });
1233
-
1234
- this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
1235
- function (evt) {
1236
- var data = $(this).data('data');
1237
-
1238
- self.getHighlightedResults()
1239
- .removeClass('select2-results__option--highlighted');
1240
-
1241
- self.trigger('results:focus', {
1242
- data: data,
1243
- element: $(this)
1244
- });
1245
- });
1246
- };
1247
-
1248
- Results.prototype.getHighlightedResults = function () {
1249
- var $highlighted = this.$results
1250
- .find('.select2-results__option--highlighted');
1251
-
1252
- return $highlighted;
1253
- };
1254
-
1255
- Results.prototype.destroy = function () {
1256
- this.$results.remove();
1257
- };
1258
-
1259
- Results.prototype.ensureHighlightVisible = function () {
1260
- var $highlighted = this.getHighlightedResults();
1261
-
1262
- if ($highlighted.length === 0) {
1263
- return;
1264
- }
1265
-
1266
- var $options = this.$results.find('[aria-selected]');
1267
-
1268
- var currentIndex = $options.index($highlighted);
1269
-
1270
- var currentOffset = this.$results.offset().top;
1271
- var nextTop = $highlighted.offset().top;
1272
- var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1273
-
1274
- var offsetDelta = nextTop - currentOffset;
1275
- nextOffset -= $highlighted.outerHeight(false) * 2;
1276
-
1277
- if (currentIndex <= 2) {
1278
- this.$results.scrollTop(0);
1279
- } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1280
- this.$results.scrollTop(nextOffset);
1281
- }
1282
- };
1283
-
1284
- Results.prototype.template = function (result, container) {
1285
- var template = this.options.get('templateResult');
1286
- var escapeMarkup = this.options.get('escapeMarkup');
1287
-
1288
- var content = template(result, container);
1289
-
1290
- if (content == null) {
1291
- container.style.display = 'none';
1292
- } else if (typeof content === 'string') {
1293
- container.innerHTML = escapeMarkup(content);
1294
- } else {
1295
- $(container).append(content);
1296
- }
1297
- };
1298
-
1299
- return Results;
1300
- });
1301
-
1302
- S2.define('select2/keys',[
1303
-
1304
- ], function () {
1305
- var KEYS = {
1306
- BACKSPACE: 8,
1307
- TAB: 9,
1308
- ENTER: 13,
1309
- SHIFT: 16,
1310
- CTRL: 17,
1311
- ALT: 18,
1312
- ESC: 27,
1313
- SPACE: 32,
1314
- PAGE_UP: 33,
1315
- PAGE_DOWN: 34,
1316
- END: 35,
1317
- HOME: 36,
1318
- LEFT: 37,
1319
- UP: 38,
1320
- RIGHT: 39,
1321
- DOWN: 40,
1322
- DELETE: 46
1323
- };
1324
-
1325
- return KEYS;
1326
- });
1327
-
1328
- S2.define('select2/selection/base',[
1329
- 'jquery',
1330
- '../utils',
1331
- '../keys'
1332
- ], function ($, Utils, KEYS) {
1333
- function BaseSelection ($element, options) {
1334
- this.$element = $element;
1335
- this.options = options;
1336
-
1337
- BaseSelection.__super__.constructor.call(this);
1338
- }
1339
-
1340
- Utils.Extend(BaseSelection, Utils.Observable);
1341
-
1342
- BaseSelection.prototype.render = function () {
1343
- var $selection = $(
1344
- '<span class="select2-selection" role="combobox" ' +
1345
- ' aria-haspopup="true" aria-expanded="false">' +
1346
- '</span>'
1347
- );
1348
-
1349
- this._tabindex = 0;
1350
-
1351
- if (this.$element.data('old-tabindex') != null) {
1352
- this._tabindex = this.$element.data('old-tabindex');
1353
- } else if (this.$element.attr('tabindex') != null) {
1354
- this._tabindex = this.$element.attr('tabindex');
1355
- }
1356
-
1357
- $selection.attr('title', this.$element.attr('title'));
1358
- $selection.attr('tabindex', this._tabindex);
1359
-
1360
- this.$selection = $selection;
1361
-
1362
- return $selection;
1363
- };
1364
-
1365
- BaseSelection.prototype.bind = function (container, $container) {
1366
- var self = this;
1367
-
1368
- var id = container.id + '-container';
1369
- var resultsId = container.id + '-results';
1370
-
1371
- this.container = container;
1372
-
1373
- this.$selection.on('focus', function (evt) {
1374
- self.trigger('focus', evt);
1375
- });
1376
-
1377
- this.$selection.on('blur', function (evt) {
1378
- self._handleBlur(evt);
1379
- });
1380
-
1381
- this.$selection.on('keydown', function (evt) {
1382
- self.trigger('keypress', evt);
1383
-
1384
- if (evt.which === KEYS.SPACE) {
1385
- evt.preventDefault();
1386
- }
1387
- });
1388
-
1389
- container.on('results:focus', function (params) {
1390
- self.$selection.attr('aria-activedescendant', params.data._resultId);
1391
- });
1392
-
1393
- container.on('selection:update', function (params) {
1394
- self.update(params.data);
1395
- });
1396
-
1397
- container.on('open', function () {
1398
- // When the dropdown is open, aria-expanded="true"
1399
- self.$selection.attr('aria-expanded', 'true');
1400
- self.$selection.attr('aria-owns', resultsId);
1401
-
1402
- self._attachCloseHandler(container);
1403
- });
1404
-
1405
- container.on('close', function () {
1406
- // When the dropdown is closed, aria-expanded="false"
1407
- self.$selection.attr('aria-expanded', 'false');
1408
- self.$selection.removeAttr('aria-activedescendant');
1409
- self.$selection.removeAttr('aria-owns');
1410
-
1411
- self.$selection.focus();
1412
-
1413
- self._detachCloseHandler(container);
1414
- });
1415
-
1416
- container.on('enable', function () {
1417
- self.$selection.attr('tabindex', self._tabindex);
1418
- });
1419
-
1420
- container.on('disable', function () {
1421
- self.$selection.attr('tabindex', '-1');
1422
- });
1423
- };
1424
-
1425
- BaseSelection.prototype._handleBlur = function (evt) {
1426
- var self = this;
1427
-
1428
- // This needs to be delayed as the active element is the body when the tab
1429
- // key is pressed, possibly along with others.
1430
- window.setTimeout(function () {
1431
- // Don't trigger `blur` if the focus is still in the selection
1432
- if (
1433
- (document.activeElement == self.$selection[0]) ||
1434
- ($.contains(self.$selection[0], document.activeElement))
1435
- ) {
1436
- return;
1437
- }
1438
-
1439
- self.trigger('blur', evt);
1440
- }, 1);
1441
- };
1442
-
1443
- BaseSelection.prototype._attachCloseHandler = function (container) {
1444
- var self = this;
1445
-
1446
- $(document.body).on('mousedown.select2.' + container.id, function (e) {
1447
- var $target = $(e.target);
1448
-
1449
- var $select = $target.closest('.select2');
1450
-
1451
- var $all = $('.select2.select2-container--open');
1452
-
1453
- $all.each(function () {
1454
- var $this = $(this);
1455
-
1456
- if (this == $select[0]) {
1457
- return;
1458
- }
1459
-
1460
- var $element = $this.data('element');
1461
-
1462
- $element.select2('close');
1463
- });
1464
- });
1465
- };
1466
-
1467
- BaseSelection.prototype._detachCloseHandler = function (container) {
1468
- $(document.body).off('mousedown.select2.' + container.id);
1469
- };
1470
-
1471
- BaseSelection.prototype.position = function ($selection, $container) {
1472
- var $selectionContainer = $container.find('.selection');
1473
- $selectionContainer.append($selection);
1474
- };
1475
-
1476
- BaseSelection.prototype.destroy = function () {
1477
- this._detachCloseHandler(this.container);
1478
- };
1479
-
1480
- BaseSelection.prototype.update = function (data) {
1481
- throw new Error('The `update` method must be defined in child classes.');
1482
- };
1483
-
1484
- return BaseSelection;
1485
- });
1486
-
1487
- S2.define('select2/selection/single',[
1488
- 'jquery',
1489
- './base',
1490
- '../utils',
1491
- '../keys'
1492
- ], function ($, BaseSelection, Utils, KEYS) {
1493
- function SingleSelection () {
1494
- SingleSelection.__super__.constructor.apply(this, arguments);
1495
- }
1496
-
1497
- Utils.Extend(SingleSelection, BaseSelection);
1498
-
1499
- SingleSelection.prototype.render = function () {
1500
- var $selection = SingleSelection.__super__.render.call(this);
1501
-
1502
- $selection.addClass('select2-selection--single');
1503
-
1504
- $selection.html(
1505
- '<span class="select2-selection__rendered"></span>' +
1506
- '<span class="select2-selection__arrow" role="presentation">' +
1507
- '<b role="presentation"></b>' +
1508
- '</span>'
1509
- );
1510
-
1511
- return $selection;
1512
- };
1513
-
1514
- SingleSelection.prototype.bind = function (container, $container) {
1515
- var self = this;
1516
-
1517
- SingleSelection.__super__.bind.apply(this, arguments);
1518
-
1519
- var id = container.id + '-container';
1520
-
1521
- this.$selection.find('.select2-selection__rendered').attr('id', id);
1522
- this.$selection.attr('aria-labelledby', id);
1523
-
1524
- this.$selection.on('mousedown', function (evt) {
1525
- // Only respond to left clicks
1526
- if (evt.which !== 1) {
1527
- return;
1528
- }
1529
-
1530
- self.trigger('toggle', {
1531
- originalEvent: evt
1532
- });
1533
- });
1534
-
1535
- this.$selection.on('focus', function (evt) {
1536
- // User focuses on the container
1537
- });
1538
-
1539
- this.$selection.on('blur', function (evt) {
1540
- // User exits the container
1541
- });
1542
-
1543
- container.on('focus', function (evt) {
1544
- if (!container.isOpen()) {
1545
- self.$selection.focus();
1546
- }
1547
- });
1548
-
1549
- container.on('selection:update', function (params) {
1550
- self.update(params.data);
1551
- });
1552
- };
1553
-
1554
- SingleSelection.prototype.clear = function () {
1555
- this.$selection.find('.select2-selection__rendered').empty();
1556
- };
1557
-
1558
- SingleSelection.prototype.display = function (data, container) {
1559
- var template = this.options.get('templateSelection');
1560
- var escapeMarkup = this.options.get('escapeMarkup');
1561
-
1562
- return escapeMarkup(template(data, container));
1563
- };
1564
-
1565
- SingleSelection.prototype.selectionContainer = function () {
1566
- return $('<span></span>');
1567
- };
1568
-
1569
- SingleSelection.prototype.update = function (data) {
1570
- if (data.length === 0) {
1571
- this.clear();
1572
- return;
1573
- }
1574
-
1575
- var selection = data[0];
1576
-
1577
- var $rendered = this.$selection.find('.select2-selection__rendered');
1578
- var formatted = this.display(selection, $rendered);
1579
-
1580
- $rendered.empty().append(formatted);
1581
- $rendered.prop('title', selection.title || selection.text);
1582
- };
1583
-
1584
- return SingleSelection;
1585
- });
1586
-
1587
- S2.define('select2/selection/multiple',[
1588
- 'jquery',
1589
- './base',
1590
- '../utils'
1591
- ], function ($, BaseSelection, Utils) {
1592
- function MultipleSelection ($element, options) {
1593
- MultipleSelection.__super__.constructor.apply(this, arguments);
1594
- }
1595
-
1596
- Utils.Extend(MultipleSelection, BaseSelection);
1597
-
1598
- MultipleSelection.prototype.render = function () {
1599
- var $selection = MultipleSelection.__super__.render.call(this);
1600
-
1601
- $selection.addClass('select2-selection--multiple');
1602
-
1603
- $selection.html(
1604
- '<ul class="select2-selection__rendered"></ul>'
1605
- );
1606
-
1607
- return $selection;
1608
- };
1609
-
1610
- MultipleSelection.prototype.bind = function (container, $container) {
1611
- var self = this;
1612
-
1613
- MultipleSelection.__super__.bind.apply(this, arguments);
1614
-
1615
- this.$selection.on('click', function (evt) {
1616
- self.trigger('toggle', {
1617
- originalEvent: evt
1618
- });
1619
- });
1620
-
1621
- this.$selection.on(
1622
- 'click',
1623
- '.select2-selection__choice__remove',
1624
- function (evt) {
1625
- // Ignore the event if it is disabled
1626
- if (self.options.get('disabled')) {
1627
- return;
1628
- }
1629
-
1630
- var $remove = $(this);
1631
- var $selection = $remove.parent();
1632
-
1633
- var data = $selection.data('data');
1634
-
1635
- self.trigger('unselect', {
1636
- originalEvent: evt,
1637
- data: data
1638
- });
1639
- }
1640
- );
1641
- };
1642
-
1643
- MultipleSelection.prototype.clear = function () {
1644
- this.$selection.find('.select2-selection__rendered').empty();
1645
- };
1646
-
1647
- MultipleSelection.prototype.display = function (data, container) {
1648
- var template = this.options.get('templateSelection');
1649
- var escapeMarkup = this.options.get('escapeMarkup');
1650
-
1651
- return escapeMarkup(template(data, container));
1652
- };
1653
-
1654
- MultipleSelection.prototype.selectionContainer = function () {
1655
- var $container = $(
1656
- '<li class="select2-selection__choice">' +
1657
- '<span class="select2-selection__choice__remove" role="presentation">' +
1658
- '&times;' +
1659
- '</span>' +
1660
- '</li>'
1661
- );
1662
-
1663
- return $container;
1664
- };
1665
-
1666
- MultipleSelection.prototype.update = function (data) {
1667
- this.clear();
1668
-
1669
- if (data.length === 0) {
1670
- return;
1671
- }
1672
-
1673
- var $selections = [];
1674
-
1675
- for (var d = 0; d < data.length; d++) {
1676
- var selection = data[d];
1677
-
1678
- var $selection = this.selectionContainer();
1679
- var formatted = this.display(selection, $selection);
1680
-
1681
- $selection.append(formatted);
1682
- $selection.prop('title', selection.title || selection.text);
1683
-
1684
- $selection.data('data', selection);
1685
-
1686
- $selections.push($selection);
1687
- }
1688
-
1689
- var $rendered = this.$selection.find('.select2-selection__rendered');
1690
-
1691
- Utils.appendMany($rendered, $selections);
1692
- };
1693
-
1694
- return MultipleSelection;
1695
- });
1696
-
1697
- S2.define('select2/selection/placeholder',[
1698
- '../utils'
1699
- ], function (Utils) {
1700
- function Placeholder (decorated, $element, options) {
1701
- this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1702
-
1703
- decorated.call(this, $element, options);
1704
- }
1705
-
1706
- Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1707
- if (typeof placeholder === 'string') {
1708
- placeholder = {
1709
- id: '',
1710
- text: placeholder
1711
- };
1712
- }
1713
-
1714
- return placeholder;
1715
- };
1716
-
1717
- Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1718
- var $placeholder = this.selectionContainer();
1719
-
1720
- $placeholder.html(this.display(placeholder));
1721
- $placeholder.addClass('select2-selection__placeholder')
1722
- .removeClass('select2-selection__choice');
1723
-
1724
- return $placeholder;
1725
- };
1726
-
1727
- Placeholder.prototype.update = function (decorated, data) {
1728
- var singlePlaceholder = (
1729
- data.length == 1 && data[0].id != this.placeholder.id
1730
- );
1731
- var multipleSelections = data.length > 1;
1732
-
1733
- if (multipleSelections || singlePlaceholder) {
1734
- return decorated.call(this, data);
1735
- }
1736
-
1737
- this.clear();
1738
-
1739
- var $placeholder = this.createPlaceholder(this.placeholder);
1740
-
1741
- this.$selection.find('.select2-selection__rendered').append($placeholder);
1742
- };
1743
-
1744
- return Placeholder;
1745
- });
1746
-
1747
- S2.define('select2/selection/allowClear',[
1748
- 'jquery',
1749
- '../keys'
1750
- ], function ($, KEYS) {
1751
- function AllowClear () { }
1752
-
1753
- AllowClear.prototype.bind = function (decorated, container, $container) {
1754
- var self = this;
1755
-
1756
- decorated.call(this, container, $container);
1757
-
1758
- if (this.placeholder == null) {
1759
- if (this.options.get('debug') && window.console && console.error) {
1760
- console.error(
1761
- 'Select2: The `allowClear` option should be used in combination ' +
1762
- 'with the `placeholder` option.'
1763
- );
1764
- }
1765
- }
1766
-
1767
- this.$selection.on('mousedown', '.select2-selection__clear',
1768
- function (evt) {
1769
- self._handleClear(evt);
1770
- });
1771
-
1772
- container.on('keypress', function (evt) {
1773
- self._handleKeyboardClear(evt, container);
1774
- });
1775
- };
1776
-
1777
- AllowClear.prototype._handleClear = function (_, evt) {
1778
- // Ignore the event if it is disabled
1779
- if (this.options.get('disabled')) {
1780
- return;
1781
- }
1782
-
1783
- var $clear = this.$selection.find('.select2-selection__clear');
1784
-
1785
- // Ignore the event if nothing has been selected
1786
- if ($clear.length === 0) {
1787
- return;
1788
- }
1789
-
1790
- evt.stopPropagation();
1791
-
1792
- var data = $clear.data('data');
1793
-
1794
- for (var d = 0; d < data.length; d++) {
1795
- var unselectData = {
1796
- data: data[d]
1797
- };
1798
-
1799
- // Trigger the `unselect` event, so people can prevent it from being
1800
- // cleared.
1801
- this.trigger('unselect', unselectData);
1802
-
1803
- // If the event was prevented, don't clear it out.
1804
- if (unselectData.prevented) {
1805
- return;
1806
- }
1807
- }
1808
-
1809
- this.$element.val(this.placeholder.id).trigger('change');
1810
-
1811
- this.trigger('toggle', {});
1812
- };
1813
-
1814
- AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
1815
- if (container.isOpen()) {
1816
- return;
1817
- }
1818
-
1819
- if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
1820
- this._handleClear(evt);
1821
- }
1822
- };
1823
-
1824
- AllowClear.prototype.update = function (decorated, data) {
1825
- decorated.call(this, data);
1826
-
1827
- if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
1828
- data.length === 0) {
1829
- return;
1830
- }
1831
-
1832
- var $remove = $(
1833
- '<span class="select2-selection__clear">' +
1834
- '&times;' +
1835
- '</span>'
1836
- );
1837
- $remove.data('data', data);
1838
-
1839
- this.$selection.find('.select2-selection__rendered').prepend($remove);
1840
- };
1841
-
1842
- return AllowClear;
1843
- });
1844
-
1845
- S2.define('select2/selection/search',[
1846
- 'jquery',
1847
- '../utils',
1848
- '../keys'
1849
- ], function ($, Utils, KEYS) {
1850
- function Search (decorated, $element, options) {
1851
- decorated.call(this, $element, options);
1852
- }
1853
-
1854
- Search.prototype.render = function (decorated) {
1855
- var $search = $(
1856
- '<li class="select2-search select2-search--inline">' +
1857
- '<input class="select2-search__field" type="search" tabindex="-1"' +
1858
- ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
1859
- ' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
1860
- '</li>'
1861
- );
1862
-
1863
- this.$searchContainer = $search;
1864
- this.$search = $search.find('input');
1865
-
1866
- var $rendered = decorated.call(this);
1867
-
1868
- this._transferTabIndex();
1869
-
1870
- return $rendered;
1871
- };
1872
-
1873
- Search.prototype.bind = function (decorated, container, $container) {
1874
- var self = this;
1875
-
1876
- decorated.call(this, container, $container);
1877
-
1878
- container.on('open', function () {
1879
- self.$search.trigger('focus');
1880
- });
1881
-
1882
- container.on('close', function () {
1883
- self.$search.val('');
1884
- self.$search.removeAttr('aria-activedescendant');
1885
- self.$search.trigger('focus');
1886
- });
1887
-
1888
- container.on('enable', function () {
1889
- self.$search.prop('disabled', false);
1890
-
1891
- self._transferTabIndex();
1892
- });
1893
-
1894
- container.on('disable', function () {
1895
- self.$search.prop('disabled', true);
1896
- });
1897
-
1898
- container.on('focus', function (evt) {
1899
- self.$search.trigger('focus');
1900
- });
1901
-
1902
- container.on('results:focus', function (params) {
1903
- self.$search.attr('aria-activedescendant', params.id);
1904
- });
1905
-
1906
- this.$selection.on('focusin', '.select2-search--inline', function (evt) {
1907
- self.trigger('focus', evt);
1908
- });
1909
-
1910
- this.$selection.on('focusout', '.select2-search--inline', function (evt) {
1911
- self._handleBlur(evt);
1912
- });
1913
-
1914
- this.$selection.on('keydown', '.select2-search--inline', function (evt) {
1915
- evt.stopPropagation();
1916
-
1917
- self.trigger('keypress', evt);
1918
-
1919
- self._keyUpPrevented = evt.isDefaultPrevented();
1920
-
1921
- var key = evt.which;
1922
-
1923
- if (key === KEYS.BACKSPACE && self.$search.val() === '') {
1924
- var $previousChoice = self.$searchContainer
1925
- .prev('.select2-selection__choice');
1926
-
1927
- if ($previousChoice.length > 0) {
1928
- var item = $previousChoice.data('data');
1929
-
1930
- self.searchRemoveChoice(item);
1931
-
1932
- evt.preventDefault();
1933
- }
1934
- }
1935
- });
1936
-
1937
- // Try to detect the IE version should the `documentMode` property that
1938
- // is stored on the document. This is only implemented in IE and is
1939
- // slightly cleaner than doing a user agent check.
1940
- // This property is not available in Edge, but Edge also doesn't have
1941
- // this bug.
1942
- var msie = document.documentMode;
1943
- var disableInputEvents = msie && msie <= 11;
1944
-
1945
- // Workaround for browsers which do not support the `input` event
1946
- // This will prevent double-triggering of events for browsers which support
1947
- // both the `keyup` and `input` events.
1948
- this.$selection.on(
1949
- 'input.searchcheck',
1950
- '.select2-search--inline',
1951
- function (evt) {
1952
- // IE will trigger the `input` event when a placeholder is used on a
1953
- // search box. To get around this issue, we are forced to ignore all
1954
- // `input` events in IE and keep using `keyup`.
1955
- if (disableInputEvents) {
1956
- self.$selection.off('input.search input.searchcheck');
1957
- return;
1958
- }
1959
-
1960
- // Unbind the duplicated `keyup` event
1961
- self.$selection.off('keyup.search');
1962
- }
1963
- );
1964
-
1965
- this.$selection.on(
1966
- 'keyup.search input.search',
1967
- '.select2-search--inline',
1968
- function (evt) {
1969
- // IE will trigger the `input` event when a placeholder is used on a
1970
- // search box. To get around this issue, we are forced to ignore all
1971
- // `input` events in IE and keep using `keyup`.
1972
- if (disableInputEvents && evt.type === 'input') {
1973
- self.$selection.off('input.search input.searchcheck');
1974
- return;
1975
- }
1976
-
1977
- var key = evt.which;
1978
-
1979
- // We can freely ignore events from modifier keys
1980
- if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
1981
- return;
1982
- }
1983
-
1984
- // Tabbing will be handled during the `keydown` phase
1985
- if (key == KEYS.TAB) {
1986
- return;
1987
- }
1988
-
1989
- self.handleSearch(evt);
1990
- }
1991
- );
1992
- };
1993
-
1994
- /**
1995
- * This method will transfer the tabindex attribute from the rendered
1996
- * selection to the search box. This allows for the search box to be used as
1997
- * the primary focus instead of the selection container.
1998
- *
1999
- * @private
2000
- */
2001
- Search.prototype._transferTabIndex = function (decorated) {
2002
- this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2003
- this.$selection.attr('tabindex', '-1');
2004
- };
2005
-
2006
- Search.prototype.createPlaceholder = function (decorated, placeholder) {
2007
- this.$search.attr('placeholder', placeholder.text);
2008
- };
2009
-
2010
- Search.prototype.update = function (decorated, data) {
2011
- var searchHadFocus = this.$search[0] == document.activeElement;
2012
-
2013
- this.$search.attr('placeholder', '');
2014
-
2015
- decorated.call(this, data);
2016
-
2017
- this.$selection.find('.select2-selection__rendered')
2018
- .append(this.$searchContainer);
2019
-
2020
- this.resizeSearch();
2021
- if (searchHadFocus) {
2022
- this.$search.focus();
2023
- }
2024
- };
2025
-
2026
- Search.prototype.handleSearch = function () {
2027
- this.resizeSearch();
2028
-
2029
- if (!this._keyUpPrevented) {
2030
- var input = this.$search.val();
2031
-
2032
- this.trigger('query', {
2033
- term: input
2034
- });
2035
- }
2036
-
2037
- this._keyUpPrevented = false;
2038
- };
2039
-
2040
- Search.prototype.searchRemoveChoice = function (decorated, item) {
2041
- this.trigger('unselect', {
2042
- data: item
2043
- });
2044
-
2045
- this.$search.val(item.text);
2046
- this.handleSearch();
2047
- };
2048
-
2049
- Search.prototype.resizeSearch = function () {
2050
- this.$search.css('width', '25px');
2051
-
2052
- var width = '';
2053
-
2054
- if (this.$search.attr('placeholder') !== '') {
2055
- width = this.$selection.find('.select2-selection__rendered').innerWidth();
2056
- } else {
2057
- var minimumWidth = this.$search.val().length + 1;
2058
-
2059
- width = (minimumWidth * 0.75) + 'em';
2060
- }
2061
-
2062
- this.$search.css('width', width);
2063
- };
2064
-
2065
- return Search;
2066
- });
2067
-
2068
- S2.define('select2/selection/eventRelay',[
2069
- 'jquery'
2070
- ], function ($) {
2071
- function EventRelay () { }
2072
-
2073
- EventRelay.prototype.bind = function (decorated, container, $container) {
2074
- var self = this;
2075
- var relayEvents = [
2076
- 'open', 'opening',
2077
- 'close', 'closing',
2078
- 'select', 'selecting',
2079
- 'unselect', 'unselecting'
2080
- ];
2081
-
2082
- var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
2083
-
2084
- decorated.call(this, container, $container);
2085
-
2086
- container.on('*', function (name, params) {
2087
- // Ignore events that should not be relayed
2088
- if ($.inArray(name, relayEvents) === -1) {
2089
- return;
2090
- }
2091
-
2092
- // The parameters should always be an object
2093
- params = params || {};
2094
-
2095
- // Generate the jQuery event for the Select2 event
2096
- var evt = $.Event('select2:' + name, {
2097
- params: params
2098
- });
2099
-
2100
- self.$element.trigger(evt);
2101
-
2102
- // Only handle preventable events if it was one
2103
- if ($.inArray(name, preventableEvents) === -1) {
2104
- return;
2105
- }
2106
-
2107
- params.prevented = evt.isDefaultPrevented();
2108
- });
2109
- };
2110
-
2111
- return EventRelay;
2112
- });
2113
-
2114
- S2.define('select2/translation',[
2115
- 'jquery',
2116
- 'require'
2117
- ], function ($, require) {
2118
- function Translation (dict) {
2119
- this.dict = dict || {};
2120
- }
2121
-
2122
- Translation.prototype.all = function () {
2123
- return this.dict;
2124
- };
2125
-
2126
- Translation.prototype.get = function (key) {
2127
- return this.dict[key];
2128
- };
2129
-
2130
- Translation.prototype.extend = function (translation) {
2131
- this.dict = $.extend({}, translation.all(), this.dict);
2132
- };
2133
-
2134
- // Static functions
2135
-
2136
- Translation._cache = {};
2137
-
2138
- Translation.loadPath = function (path) {
2139
- if (!(path in Translation._cache)) {
2140
- var translations = require(path);
2141
-
2142
- Translation._cache[path] = translations;
2143
- }
2144
-
2145
- return new Translation(Translation._cache[path]);
2146
- };
2147
-
2148
- return Translation;
2149
- });
2150
-
2151
- S2.define('select2/diacritics',[
2152
-
2153
- ], function () {
2154
- var diacritics = {
2155
- '\u24B6': 'A',
2156
- '\uFF21': 'A',
2157
- '\u00C0': 'A',
2158
- '\u00C1': 'A',
2159
- '\u00C2': 'A',
2160
- '\u1EA6': 'A',
2161
- '\u1EA4': 'A',
2162
- '\u1EAA': 'A',
2163
- '\u1EA8': 'A',
2164
- '\u00C3': 'A',
2165
- '\u0100': 'A',
2166
- '\u0102': 'A',
2167
- '\u1EB0': 'A',
2168
- '\u1EAE': 'A',
2169
- '\u1EB4': 'A',
2170
- '\u1EB2': 'A',
2171
- '\u0226': 'A',
2172
- '\u01E0': 'A',
2173
- '\u00C4': 'A',
2174
- '\u01DE': 'A',
2175
- '\u1EA2': 'A',
2176
- '\u00C5': 'A',
2177
- '\u01FA': 'A',
2178
- '\u01CD': 'A',
2179
- '\u0200': 'A',
2180
- '\u0202': 'A',
2181
- '\u1EA0': 'A',
2182
- '\u1EAC': 'A',
2183
- '\u1EB6': 'A',
2184
- '\u1E00': 'A',
2185
- '\u0104': 'A',
2186
- '\u023A': 'A',
2187
- '\u2C6F': 'A',
2188
- '\uA732': 'AA',
2189
- '\u00C6': 'AE',
2190
- '\u01FC': 'AE',
2191
- '\u01E2': 'AE',
2192
- '\uA734': 'AO',
2193
- '\uA736': 'AU',
2194
- '\uA738': 'AV',
2195
- '\uA73A': 'AV',
2196
- '\uA73C': 'AY',
2197
- '\u24B7': 'B',
2198
- '\uFF22': 'B',
2199
- '\u1E02': 'B',
2200
- '\u1E04': 'B',
2201
- '\u1E06': 'B',
2202
- '\u0243': 'B',
2203
- '\u0182': 'B',
2204
- '\u0181': 'B',
2205
- '\u24B8': 'C',
2206
- '\uFF23': 'C',
2207
- '\u0106': 'C',
2208
- '\u0108': 'C',
2209
- '\u010A': 'C',
2210
- '\u010C': 'C',
2211
- '\u00C7': 'C',
2212
- '\u1E08': 'C',
2213
- '\u0187': 'C',
2214
- '\u023B': 'C',
2215
- '\uA73E': 'C',
2216
- '\u24B9': 'D',
2217
- '\uFF24': 'D',
2218
- '\u1E0A': 'D',
2219
- '\u010E': 'D',
2220
- '\u1E0C': 'D',
2221
- '\u1E10': 'D',
2222
- '\u1E12': 'D',
2223
- '\u1E0E': 'D',
2224
- '\u0110': 'D',
2225
- '\u018B': 'D',
2226
- '\u018A': 'D',
2227
- '\u0189': 'D',
2228
- '\uA779': 'D',
2229
- '\u01F1': 'DZ',
2230
- '\u01C4': 'DZ',
2231
- '\u01F2': 'Dz',
2232
- '\u01C5': 'Dz',
2233
- '\u24BA': 'E',
2234
- '\uFF25': 'E',
2235
- '\u00C8': 'E',
2236
- '\u00C9': 'E',
2237
- '\u00CA': 'E',
2238
- '\u1EC0': 'E',
2239
- '\u1EBE': 'E',
2240
- '\u1EC4': 'E',
2241
- '\u1EC2': 'E',
2242
- '\u1EBC': 'E',
2243
- '\u0112': 'E',
2244
- '\u1E14': 'E',
2245
- '\u1E16': 'E',
2246
- '\u0114': 'E',
2247
- '\u0116': 'E',
2248
- '\u00CB': 'E',
2249
- '\u1EBA': 'E',
2250
- '\u011A': 'E',
2251
- '\u0204': 'E',
2252
- '\u0206': 'E',
2253
- '\u1EB8': 'E',
2254
- '\u1EC6': 'E',
2255
- '\u0228': 'E',
2256
- '\u1E1C': 'E',
2257
- '\u0118': 'E',
2258
- '\u1E18': 'E',
2259
- '\u1E1A': 'E',
2260
- '\u0190': 'E',
2261
- '\u018E': 'E',
2262
- '\u24BB': 'F',
2263
- '\uFF26': 'F',
2264
- '\u1E1E': 'F',
2265
- '\u0191': 'F',
2266
- '\uA77B': 'F',
2267
- '\u24BC': 'G',
2268
- '\uFF27': 'G',
2269
- '\u01F4': 'G',
2270
- '\u011C': 'G',
2271
- '\u1E20': 'G',
2272
- '\u011E': 'G',
2273
- '\u0120': 'G',
2274
- '\u01E6': 'G',
2275
- '\u0122': 'G',
2276
- '\u01E4': 'G',
2277
- '\u0193': 'G',
2278
- '\uA7A0': 'G',
2279
- '\uA77D': 'G',
2280
- '\uA77E': 'G',
2281
- '\u24BD': 'H',
2282
- '\uFF28': 'H',
2283
- '\u0124': 'H',
2284
- '\u1E22': 'H',
2285
- '\u1E26': 'H',
2286
- '\u021E': 'H',
2287
- '\u1E24': 'H',
2288
- '\u1E28': 'H',
2289
- '\u1E2A': 'H',
2290
- '\u0126': 'H',
2291
- '\u2C67': 'H',
2292
- '\u2C75': 'H',
2293
- '\uA78D': 'H',
2294
- '\u24BE': 'I',
2295
- '\uFF29': 'I',
2296
- '\u00CC': 'I',
2297
- '\u00CD': 'I',
2298
- '\u00CE': 'I',
2299
- '\u0128': 'I',
2300
- '\u012A': 'I',
2301
- '\u012C': 'I',
2302
- '\u0130': 'I',
2303
- '\u00CF': 'I',
2304
- '\u1E2E': 'I',
2305
- '\u1EC8': 'I',
2306
- '\u01CF': 'I',
2307
- '\u0208': 'I',
2308
- '\u020A': 'I',
2309
- '\u1ECA': 'I',
2310
- '\u012E': 'I',
2311
- '\u1E2C': 'I',
2312
- '\u0197': 'I',
2313
- '\u24BF': 'J',
2314
- '\uFF2A': 'J',
2315
- '\u0134': 'J',
2316
- '\u0248': 'J',
2317
- '\u24C0': 'K',
2318
- '\uFF2B': 'K',
2319
- '\u1E30': 'K',
2320
- '\u01E8': 'K',
2321
- '\u1E32': 'K',
2322
- '\u0136': 'K',
2323
- '\u1E34': 'K',
2324
- '\u0198': 'K',
2325
- '\u2C69': 'K',
2326
- '\uA740': 'K',
2327
- '\uA742': 'K',
2328
- '\uA744': 'K',
2329
- '\uA7A2': 'K',
2330
- '\u24C1': 'L',
2331
- '\uFF2C': 'L',
2332
- '\u013F': 'L',
2333
- '\u0139': 'L',
2334
- '\u013D': 'L',
2335
- '\u1E36': 'L',
2336
- '\u1E38': 'L',
2337
- '\u013B': 'L',
2338
- '\u1E3C': 'L',
2339
- '\u1E3A': 'L',
2340
- '\u0141': 'L',
2341
- '\u023D': 'L',
2342
- '\u2C62': 'L',
2343
- '\u2C60': 'L',
2344
- '\uA748': 'L',
2345
- '\uA746': 'L',
2346
- '\uA780': 'L',
2347
- '\u01C7': 'LJ',
2348
- '\u01C8': 'Lj',
2349
- '\u24C2': 'M',
2350
- '\uFF2D': 'M',
2351
- '\u1E3E': 'M',
2352
- '\u1E40': 'M',
2353
- '\u1E42': 'M',
2354
- '\u2C6E': 'M',
2355
- '\u019C': 'M',
2356
- '\u24C3': 'N',
2357
- '\uFF2E': 'N',
2358
- '\u01F8': 'N',
2359
- '\u0143': 'N',
2360
- '\u00D1': 'N',
2361
- '\u1E44': 'N',
2362
- '\u0147': 'N',
2363
- '\u1E46': 'N',
2364
- '\u0145': 'N',
2365
- '\u1E4A': 'N',
2366
- '\u1E48': 'N',
2367
- '\u0220': 'N',
2368
- '\u019D': 'N',
2369
- '\uA790': 'N',
2370
- '\uA7A4': 'N',
2371
- '\u01CA': 'NJ',
2372
- '\u01CB': 'Nj',
2373
- '\u24C4': 'O',
2374
- '\uFF2F': 'O',
2375
- '\u00D2': 'O',
2376
- '\u00D3': 'O',
2377
- '\u00D4': 'O',
2378
- '\u1ED2': 'O',
2379
- '\u1ED0': 'O',
2380
- '\u1ED6': 'O',
2381
- '\u1ED4': 'O',
2382
- '\u00D5': 'O',
2383
- '\u1E4C': 'O',
2384
- '\u022C': 'O',
2385
- '\u1E4E': 'O',
2386
- '\u014C': 'O',
2387
- '\u1E50': 'O',
2388
- '\u1E52': 'O',
2389
- '\u014E': 'O',
2390
- '\u022E': 'O',
2391
- '\u0230': 'O',
2392
- '\u00D6': 'O',
2393
- '\u022A': 'O',
2394
- '\u1ECE': 'O',
2395
- '\u0150': 'O',
2396
- '\u01D1': 'O',
2397
- '\u020C': 'O',
2398
- '\u020E': 'O',
2399
- '\u01A0': 'O',
2400
- '\u1EDC': 'O',
2401
- '\u1EDA': 'O',
2402
- '\u1EE0': 'O',
2403
- '\u1EDE': 'O',
2404
- '\u1EE2': 'O',
2405
- '\u1ECC': 'O',
2406
- '\u1ED8': 'O',
2407
- '\u01EA': 'O',
2408
- '\u01EC': 'O',
2409
- '\u00D8': 'O',
2410
- '\u01FE': 'O',
2411
- '\u0186': 'O',
2412
- '\u019F': 'O',
2413
- '\uA74A': 'O',
2414
- '\uA74C': 'O',
2415
- '\u01A2': 'OI',
2416
- '\uA74E': 'OO',
2417
- '\u0222': 'OU',
2418
- '\u24C5': 'P',
2419
- '\uFF30': 'P',
2420
- '\u1E54': 'P',
2421
- '\u1E56': 'P',
2422
- '\u01A4': 'P',
2423
- '\u2C63': 'P',
2424
- '\uA750': 'P',
2425
- '\uA752': 'P',
2426
- '\uA754': 'P',
2427
- '\u24C6': 'Q',
2428
- '\uFF31': 'Q',
2429
- '\uA756': 'Q',
2430
- '\uA758': 'Q',
2431
- '\u024A': 'Q',
2432
- '\u24C7': 'R',
2433
- '\uFF32': 'R',
2434
- '\u0154': 'R',
2435
- '\u1E58': 'R',
2436
- '\u0158': 'R',
2437
- '\u0210': 'R',
2438
- '\u0212': 'R',
2439
- '\u1E5A': 'R',
2440
- '\u1E5C': 'R',
2441
- '\u0156': 'R',
2442
- '\u1E5E': 'R',
2443
- '\u024C': 'R',
2444
- '\u2C64': 'R',
2445
- '\uA75A': 'R',
2446
- '\uA7A6': 'R',
2447
- '\uA782': 'R',
2448
- '\u24C8': 'S',
2449
- '\uFF33': 'S',
2450
- '\u1E9E': 'S',
2451
- '\u015A': 'S',
2452
- '\u1E64': 'S',
2453
- '\u015C': 'S',
2454
- '\u1E60': 'S',
2455
- '\u0160': 'S',
2456
- '\u1E66': 'S',
2457
- '\u1E62': 'S',
2458
- '\u1E68': 'S',
2459
- '\u0218': 'S',
2460
- '\u015E': 'S',
2461
- '\u2C7E': 'S',
2462
- '\uA7A8': 'S',
2463
- '\uA784': 'S',
2464
- '\u24C9': 'T',
2465
- '\uFF34': 'T',
2466
- '\u1E6A': 'T',
2467
- '\u0164': 'T',
2468
- '\u1E6C': 'T',
2469
- '\u021A': 'T',
2470
- '\u0162': 'T',
2471
- '\u1E70': 'T',
2472
- '\u1E6E': 'T',
2473
- '\u0166': 'T',
2474
- '\u01AC': 'T',
2475
- '\u01AE': 'T',
2476
- '\u023E': 'T',
2477
- '\uA786': 'T',
2478
- '\uA728': 'TZ',
2479
- '\u24CA': 'U',
2480
- '\uFF35': 'U',
2481
- '\u00D9': 'U',
2482
- '\u00DA': 'U',
2483
- '\u00DB': 'U',
2484
- '\u0168': 'U',
2485
- '\u1E78': 'U',
2486
- '\u016A': 'U',
2487
- '\u1E7A': 'U',
2488
- '\u016C': 'U',
2489
- '\u00DC': 'U',
2490
- '\u01DB': 'U',
2491
- '\u01D7': 'U',
2492
- '\u01D5': 'U',
2493
- '\u01D9': 'U',
2494
- '\u1EE6': 'U',
2495
- '\u016E': 'U',
2496
- '\u0170': 'U',
2497
- '\u01D3': 'U',
2498
- '\u0214': 'U',
2499
- '\u0216': 'U',
2500
- '\u01AF': 'U',
2501
- '\u1EEA': 'U',
2502
- '\u1EE8': 'U',
2503
- '\u1EEE': 'U',
2504
- '\u1EEC': 'U',
2505
- '\u1EF0': 'U',
2506
- '\u1EE4': 'U',
2507
- '\u1E72': 'U',
2508
- '\u0172': 'U',
2509
- '\u1E76': 'U',
2510
- '\u1E74': 'U',
2511
- '\u0244': 'U',
2512
- '\u24CB': 'V',
2513
- '\uFF36': 'V',
2514
- '\u1E7C': 'V',
2515
- '\u1E7E': 'V',
2516
- '\u01B2': 'V',
2517
- '\uA75E': 'V',
2518
- '\u0245': 'V',
2519
- '\uA760': 'VY',
2520
- '\u24CC': 'W',
2521
- '\uFF37': 'W',
2522
- '\u1E80': 'W',
2523
- '\u1E82': 'W',
2524
- '\u0174': 'W',
2525
- '\u1E86': 'W',
2526
- '\u1E84': 'W',
2527
- '\u1E88': 'W',
2528
- '\u2C72': 'W',
2529
- '\u24CD': 'X',
2530
- '\uFF38': 'X',
2531
- '\u1E8A': 'X',
2532
- '\u1E8C': 'X',
2533
- '\u24CE': 'Y',
2534
- '\uFF39': 'Y',
2535
- '\u1EF2': 'Y',
2536
- '\u00DD': 'Y',
2537
- '\u0176': 'Y',
2538
- '\u1EF8': 'Y',
2539
- '\u0232': 'Y',
2540
- '\u1E8E': 'Y',
2541
- '\u0178': 'Y',
2542
- '\u1EF6': 'Y',
2543
- '\u1EF4': 'Y',
2544
- '\u01B3': 'Y',
2545
- '\u024E': 'Y',
2546
- '\u1EFE': 'Y',
2547
- '\u24CF': 'Z',
2548
- '\uFF3A': 'Z',
2549
- '\u0179': 'Z',
2550
- '\u1E90': 'Z',
2551
- '\u017B': 'Z',
2552
- '\u017D': 'Z',
2553
- '\u1E92': 'Z',
2554
- '\u1E94': 'Z',
2555
- '\u01B5': 'Z',
2556
- '\u0224': 'Z',
2557
- '\u2C7F': 'Z',
2558
- '\u2C6B': 'Z',
2559
- '\uA762': 'Z',
2560
- '\u24D0': 'a',
2561
- '\uFF41': 'a',
2562
- '\u1E9A': 'a',
2563
- '\u00E0': 'a',
2564
- '\u00E1': 'a',
2565
- '\u00E2': 'a',
2566
- '\u1EA7': 'a',
2567
- '\u1EA5': 'a',
2568
- '\u1EAB': 'a',
2569
- '\u1EA9': 'a',
2570
- '\u00E3': 'a',
2571
- '\u0101': 'a',
2572
- '\u0103': 'a',
2573
- '\u1EB1': 'a',
2574
- '\u1EAF': 'a',
2575
- '\u1EB5': 'a',
2576
- '\u1EB3': 'a',
2577
- '\u0227': 'a',
2578
- '\u01E1': 'a',
2579
- '\u00E4': 'a',
2580
- '\u01DF': 'a',
2581
- '\u1EA3': 'a',
2582
- '\u00E5': 'a',
2583
- '\u01FB': 'a',
2584
- '\u01CE': 'a',
2585
- '\u0201': 'a',
2586
- '\u0203': 'a',
2587
- '\u1EA1': 'a',
2588
- '\u1EAD': 'a',
2589
- '\u1EB7': 'a',
2590
- '\u1E01': 'a',
2591
- '\u0105': 'a',
2592
- '\u2C65': 'a',
2593
- '\u0250': 'a',
2594
- '\uA733': 'aa',
2595
- '\u00E6': 'ae',
2596
- '\u01FD': 'ae',
2597
- '\u01E3': 'ae',
2598
- '\uA735': 'ao',
2599
- '\uA737': 'au',
2600
- '\uA739': 'av',
2601
- '\uA73B': 'av',
2602
- '\uA73D': 'ay',
2603
- '\u24D1': 'b',
2604
- '\uFF42': 'b',
2605
- '\u1E03': 'b',
2606
- '\u1E05': 'b',
2607
- '\u1E07': 'b',
2608
- '\u0180': 'b',
2609
- '\u0183': 'b',
2610
- '\u0253': 'b',
2611
- '\u24D2': 'c',
2612
- '\uFF43': 'c',
2613
- '\u0107': 'c',
2614
- '\u0109': 'c',
2615
- '\u010B': 'c',
2616
- '\u010D': 'c',
2617
- '\u00E7': 'c',
2618
- '\u1E09': 'c',
2619
- '\u0188': 'c',
2620
- '\u023C': 'c',
2621
- '\uA73F': 'c',
2622
- '\u2184': 'c',
2623
- '\u24D3': 'd',
2624
- '\uFF44': 'd',
2625
- '\u1E0B': 'd',
2626
- '\u010F': 'd',
2627
- '\u1E0D': 'd',
2628
- '\u1E11': 'd',
2629
- '\u1E13': 'd',
2630
- '\u1E0F': 'd',
2631
- '\u0111': 'd',
2632
- '\u018C': 'd',
2633
- '\u0256': 'd',
2634
- '\u0257': 'd',
2635
- '\uA77A': 'd',
2636
- '\u01F3': 'dz',
2637
- '\u01C6': 'dz',
2638
- '\u24D4': 'e',
2639
- '\uFF45': 'e',
2640
- '\u00E8': 'e',
2641
- '\u00E9': 'e',
2642
- '\u00EA': 'e',
2643
- '\u1EC1': 'e',
2644
- '\u1EBF': 'e',
2645
- '\u1EC5': 'e',
2646
- '\u1EC3': 'e',
2647
- '\u1EBD': 'e',
2648
- '\u0113': 'e',
2649
- '\u1E15': 'e',
2650
- '\u1E17': 'e',
2651
- '\u0115': 'e',
2652
- '\u0117': 'e',
2653
- '\u00EB': 'e',
2654
- '\u1EBB': 'e',
2655
- '\u011B': 'e',
2656
- '\u0205': 'e',
2657
- '\u0207': 'e',
2658
- '\u1EB9': 'e',
2659
- '\u1EC7': 'e',
2660
- '\u0229': 'e',
2661
- '\u1E1D': 'e',
2662
- '\u0119': 'e',
2663
- '\u1E19': 'e',
2664
- '\u1E1B': 'e',
2665
- '\u0247': 'e',
2666
- '\u025B': 'e',
2667
- '\u01DD': 'e',
2668
- '\u24D5': 'f',
2669
- '\uFF46': 'f',
2670
- '\u1E1F': 'f',
2671
- '\u0192': 'f',
2672
- '\uA77C': 'f',
2673
- '\u24D6': 'g',
2674
- '\uFF47': 'g',
2675
- '\u01F5': 'g',
2676
- '\u011D': 'g',
2677
- '\u1E21': 'g',
2678
- '\u011F': 'g',
2679
- '\u0121': 'g',
2680
- '\u01E7': 'g',
2681
- '\u0123': 'g',
2682
- '\u01E5': 'g',
2683
- '\u0260': 'g',
2684
- '\uA7A1': 'g',
2685
- '\u1D79': 'g',
2686
- '\uA77F': 'g',
2687
- '\u24D7': 'h',
2688
- '\uFF48': 'h',
2689
- '\u0125': 'h',
2690
- '\u1E23': 'h',
2691
- '\u1E27': 'h',
2692
- '\u021F': 'h',
2693
- '\u1E25': 'h',
2694
- '\u1E29': 'h',
2695
- '\u1E2B': 'h',
2696
- '\u1E96': 'h',
2697
- '\u0127': 'h',
2698
- '\u2C68': 'h',
2699
- '\u2C76': 'h',
2700
- '\u0265': 'h',
2701
- '\u0195': 'hv',
2702
- '\u24D8': 'i',
2703
- '\uFF49': 'i',
2704
- '\u00EC': 'i',
2705
- '\u00ED': 'i',
2706
- '\u00EE': 'i',
2707
- '\u0129': 'i',
2708
- '\u012B': 'i',
2709
- '\u012D': 'i',
2710
- '\u00EF': 'i',
2711
- '\u1E2F': 'i',
2712
- '\u1EC9': 'i',
2713
- '\u01D0': 'i',
2714
- '\u0209': 'i',
2715
- '\u020B': 'i',
2716
- '\u1ECB': 'i',
2717
- '\u012F': 'i',
2718
- '\u1E2D': 'i',
2719
- '\u0268': 'i',
2720
- '\u0131': 'i',
2721
- '\u24D9': 'j',
2722
- '\uFF4A': 'j',
2723
- '\u0135': 'j',
2724
- '\u01F0': 'j',
2725
- '\u0249': 'j',
2726
- '\u24DA': 'k',
2727
- '\uFF4B': 'k',
2728
- '\u1E31': 'k',
2729
- '\u01E9': 'k',
2730
- '\u1E33': 'k',
2731
- '\u0137': 'k',
2732
- '\u1E35': 'k',
2733
- '\u0199': 'k',
2734
- '\u2C6A': 'k',
2735
- '\uA741': 'k',
2736
- '\uA743': 'k',
2737
- '\uA745': 'k',
2738
- '\uA7A3': 'k',
2739
- '\u24DB': 'l',
2740
- '\uFF4C': 'l',
2741
- '\u0140': 'l',
2742
- '\u013A': 'l',
2743
- '\u013E': 'l',
2744
- '\u1E37': 'l',
2745
- '\u1E39': 'l',
2746
- '\u013C': 'l',
2747
- '\u1E3D': 'l',
2748
- '\u1E3B': 'l',
2749
- '\u017F': 'l',
2750
- '\u0142': 'l',
2751
- '\u019A': 'l',
2752
- '\u026B': 'l',
2753
- '\u2C61': 'l',
2754
- '\uA749': 'l',
2755
- '\uA781': 'l',
2756
- '\uA747': 'l',
2757
- '\u01C9': 'lj',
2758
- '\u24DC': 'm',
2759
- '\uFF4D': 'm',
2760
- '\u1E3F': 'm',
2761
- '\u1E41': 'm',
2762
- '\u1E43': 'm',
2763
- '\u0271': 'm',
2764
- '\u026F': 'm',
2765
- '\u24DD': 'n',
2766
- '\uFF4E': 'n',
2767
- '\u01F9': 'n',
2768
- '\u0144': 'n',
2769
- '\u00F1': 'n',
2770
- '\u1E45': 'n',
2771
- '\u0148': 'n',
2772
- '\u1E47': 'n',
2773
- '\u0146': 'n',
2774
- '\u1E4B': 'n',
2775
- '\u1E49': 'n',
2776
- '\u019E': 'n',
2777
- '\u0272': 'n',
2778
- '\u0149': 'n',
2779
- '\uA791': 'n',
2780
- '\uA7A5': 'n',
2781
- '\u01CC': 'nj',
2782
- '\u24DE': 'o',
2783
- '\uFF4F': 'o',
2784
- '\u00F2': 'o',
2785
- '\u00F3': 'o',
2786
- '\u00F4': 'o',
2787
- '\u1ED3': 'o',
2788
- '\u1ED1': 'o',
2789
- '\u1ED7': 'o',
2790
- '\u1ED5': 'o',
2791
- '\u00F5': 'o',
2792
- '\u1E4D': 'o',
2793
- '\u022D': 'o',
2794
- '\u1E4F': 'o',
2795
- '\u014D': 'o',
2796
- '\u1E51': 'o',
2797
- '\u1E53': 'o',
2798
- '\u014F': 'o',
2799
- '\u022F': 'o',
2800
- '\u0231': 'o',
2801
- '\u00F6': 'o',
2802
- '\u022B': 'o',
2803
- '\u1ECF': 'o',
2804
- '\u0151': 'o',
2805
- '\u01D2': 'o',
2806
- '\u020D': 'o',
2807
- '\u020F': 'o',
2808
- '\u01A1': 'o',
2809
- '\u1EDD': 'o',
2810
- '\u1EDB': 'o',
2811
- '\u1EE1': 'o',
2812
- '\u1EDF': 'o',
2813
- '\u1EE3': 'o',
2814
- '\u1ECD': 'o',
2815
- '\u1ED9': 'o',
2816
- '\u01EB': 'o',
2817
- '\u01ED': 'o',
2818
- '\u00F8': 'o',
2819
- '\u01FF': 'o',
2820
- '\u0254': 'o',
2821
- '\uA74B': 'o',
2822
- '\uA74D': 'o',
2823
- '\u0275': 'o',
2824
- '\u01A3': 'oi',
2825
- '\u0223': 'ou',
2826
- '\uA74F': 'oo',
2827
- '\u24DF': 'p',
2828
- '\uFF50': 'p',
2829
- '\u1E55': 'p',
2830
- '\u1E57': 'p',
2831
- '\u01A5': 'p',
2832
- '\u1D7D': 'p',
2833
- '\uA751': 'p',
2834
- '\uA753': 'p',
2835
- '\uA755': 'p',
2836
- '\u24E0': 'q',
2837
- '\uFF51': 'q',
2838
- '\u024B': 'q',
2839
- '\uA757': 'q',
2840
- '\uA759': 'q',
2841
- '\u24E1': 'r',
2842
- '\uFF52': 'r',
2843
- '\u0155': 'r',
2844
- '\u1E59': 'r',
2845
- '\u0159': 'r',
2846
- '\u0211': 'r',
2847
- '\u0213': 'r',
2848
- '\u1E5B': 'r',
2849
- '\u1E5D': 'r',
2850
- '\u0157': 'r',
2851
- '\u1E5F': 'r',
2852
- '\u024D': 'r',
2853
- '\u027D': 'r',
2854
- '\uA75B': 'r',
2855
- '\uA7A7': 'r',
2856
- '\uA783': 'r',
2857
- '\u24E2': 's',
2858
- '\uFF53': 's',
2859
- '\u00DF': 's',
2860
- '\u015B': 's',
2861
- '\u1E65': 's',
2862
- '\u015D': 's',
2863
- '\u1E61': 's',
2864
- '\u0161': 's',
2865
- '\u1E67': 's',
2866
- '\u1E63': 's',
2867
- '\u1E69': 's',
2868
- '\u0219': 's',
2869
- '\u015F': 's',
2870
- '\u023F': 's',
2871
- '\uA7A9': 's',
2872
- '\uA785': 's',
2873
- '\u1E9B': 's',
2874
- '\u24E3': 't',
2875
- '\uFF54': 't',
2876
- '\u1E6B': 't',
2877
- '\u1E97': 't',
2878
- '\u0165': 't',
2879
- '\u1E6D': 't',
2880
- '\u021B': 't',
2881
- '\u0163': 't',
2882
- '\u1E71': 't',
2883
- '\u1E6F': 't',
2884
- '\u0167': 't',
2885
- '\u01AD': 't',
2886
- '\u0288': 't',
2887
- '\u2C66': 't',
2888
- '\uA787': 't',
2889
- '\uA729': 'tz',
2890
- '\u24E4': 'u',
2891
- '\uFF55': 'u',
2892
- '\u00F9': 'u',
2893
- '\u00FA': 'u',
2894
- '\u00FB': 'u',
2895
- '\u0169': 'u',
2896
- '\u1E79': 'u',
2897
- '\u016B': 'u',
2898
- '\u1E7B': 'u',
2899
- '\u016D': 'u',
2900
- '\u00FC': 'u',
2901
- '\u01DC': 'u',
2902
- '\u01D8': 'u',
2903
- '\u01D6': 'u',
2904
- '\u01DA': 'u',
2905
- '\u1EE7': 'u',
2906
- '\u016F': 'u',
2907
- '\u0171': 'u',
2908
- '\u01D4': 'u',
2909
- '\u0215': 'u',
2910
- '\u0217': 'u',
2911
- '\u01B0': 'u',
2912
- '\u1EEB': 'u',
2913
- '\u1EE9': 'u',
2914
- '\u1EEF': 'u',
2915
- '\u1EED': 'u',
2916
- '\u1EF1': 'u',
2917
- '\u1EE5': 'u',
2918
- '\u1E73': 'u',
2919
- '\u0173': 'u',
2920
- '\u1E77': 'u',
2921
- '\u1E75': 'u',
2922
- '\u0289': 'u',
2923
- '\u24E5': 'v',
2924
- '\uFF56': 'v',
2925
- '\u1E7D': 'v',
2926
- '\u1E7F': 'v',
2927
- '\u028B': 'v',
2928
- '\uA75F': 'v',
2929
- '\u028C': 'v',
2930
- '\uA761': 'vy',
2931
- '\u24E6': 'w',
2932
- '\uFF57': 'w',
2933
- '\u1E81': 'w',
2934
- '\u1E83': 'w',
2935
- '\u0175': 'w',
2936
- '\u1E87': 'w',
2937
- '\u1E85': 'w',
2938
- '\u1E98': 'w',
2939
- '\u1E89': 'w',
2940
- '\u2C73': 'w',
2941
- '\u24E7': 'x',
2942
- '\uFF58': 'x',
2943
- '\u1E8B': 'x',
2944
- '\u1E8D': 'x',
2945
- '\u24E8': 'y',
2946
- '\uFF59': 'y',
2947
- '\u1EF3': 'y',
2948
- '\u00FD': 'y',
2949
- '\u0177': 'y',
2950
- '\u1EF9': 'y',
2951
- '\u0233': 'y',
2952
- '\u1E8F': 'y',
2953
- '\u00FF': 'y',
2954
- '\u1EF7': 'y',
2955
- '\u1E99': 'y',
2956
- '\u1EF5': 'y',
2957
- '\u01B4': 'y',
2958
- '\u024F': 'y',
2959
- '\u1EFF': 'y',
2960
- '\u24E9': 'z',
2961
- '\uFF5A': 'z',
2962
- '\u017A': 'z',
2963
- '\u1E91': 'z',
2964
- '\u017C': 'z',
2965
- '\u017E': 'z',
2966
- '\u1E93': 'z',
2967
- '\u1E95': 'z',
2968
- '\u01B6': 'z',
2969
- '\u0225': 'z',
2970
- '\u0240': 'z',
2971
- '\u2C6C': 'z',
2972
- '\uA763': 'z',
2973
- '\u0386': '\u0391',
2974
- '\u0388': '\u0395',
2975
- '\u0389': '\u0397',
2976
- '\u038A': '\u0399',
2977
- '\u03AA': '\u0399',
2978
- '\u038C': '\u039F',
2979
- '\u038E': '\u03A5',
2980
- '\u03AB': '\u03A5',
2981
- '\u038F': '\u03A9',
2982
- '\u03AC': '\u03B1',
2983
- '\u03AD': '\u03B5',
2984
- '\u03AE': '\u03B7',
2985
- '\u03AF': '\u03B9',
2986
- '\u03CA': '\u03B9',
2987
- '\u0390': '\u03B9',
2988
- '\u03CC': '\u03BF',
2989
- '\u03CD': '\u03C5',
2990
- '\u03CB': '\u03C5',
2991
- '\u03B0': '\u03C5',
2992
- '\u03C9': '\u03C9',
2993
- '\u03C2': '\u03C3'
2994
- };
2995
-
2996
- return diacritics;
2997
- });
2998
-
2999
- S2.define('select2/data/base',[
3000
- '../utils'
3001
- ], function (Utils) {
3002
- function BaseAdapter ($element, options) {
3003
- BaseAdapter.__super__.constructor.call(this);
3004
- }
3005
-
3006
- Utils.Extend(BaseAdapter, Utils.Observable);
3007
-
3008
- BaseAdapter.prototype.current = function (callback) {
3009
- throw new Error('The `current` method must be defined in child classes.');
3010
- };
3011
-
3012
- BaseAdapter.prototype.query = function (params, callback) {
3013
- throw new Error('The `query` method must be defined in child classes.');
3014
- };
3015
-
3016
- BaseAdapter.prototype.bind = function (container, $container) {
3017
- // Can be implemented in subclasses
3018
- };
3019
-
3020
- BaseAdapter.prototype.destroy = function () {
3021
- // Can be implemented in subclasses
3022
- };
3023
-
3024
- BaseAdapter.prototype.generateResultId = function (container, data) {
3025
- var id = container.id + '-result-';
3026
-
3027
- id += Utils.generateChars(4);
3028
-
3029
- if (data.id != null) {
3030
- id += '-' + data.id.toString();
3031
- } else {
3032
- id += '-' + Utils.generateChars(4);
3033
- }
3034
- return id;
3035
- };
3036
-
3037
- return BaseAdapter;
3038
- });
3039
-
3040
- S2.define('select2/data/select',[
3041
- './base',
3042
- '../utils',
3043
- 'jquery'
3044
- ], function (BaseAdapter, Utils, $) {
3045
- function SelectAdapter ($element, options) {
3046
- this.$element = $element;
3047
- this.options = options;
3048
-
3049
- SelectAdapter.__super__.constructor.call(this);
3050
- }
3051
-
3052
- Utils.Extend(SelectAdapter, BaseAdapter);
3053
-
3054
- SelectAdapter.prototype.current = function (callback) {
3055
- var data = [];
3056
- var self = this;
3057
-
3058
- this.$element.find(':selected').each(function () {
3059
- var $option = $(this);
3060
-
3061
- var option = self.item($option);
3062
-
3063
- data.push(option);
3064
- });
3065
-
3066
- callback(data);
3067
- };
3068
-
3069
- SelectAdapter.prototype.select = function (data) {
3070
- var self = this;
3071
-
3072
- data.selected = true;
3073
-
3074
- // If data.element is a DOM node, use it instead
3075
- if ($(data.element).is('option')) {
3076
- data.element.selected = true;
3077
-
3078
- this.$element.trigger('change');
3079
-
3080
- return;
3081
- }
3082
-
3083
- if (this.$element.prop('multiple')) {
3084
- this.current(function (currentData) {
3085
- var val = [];
3086
-
3087
- data = [data];
3088
- data.push.apply(data, currentData);
3089
-
3090
- for (var d = 0; d < data.length; d++) {
3091
- var id = data[d].id;
3092
-
3093
- if ($.inArray(id, val) === -1) {
3094
- val.push(id);
3095
- }
3096
- }
3097
-
3098
- self.$element.val(val);
3099
- self.$element.trigger('change');
3100
- });
3101
- } else {
3102
- var val = data.id;
3103
-
3104
- this.$element.val(val);
3105
- this.$element.trigger('change');
3106
- }
3107
- };
3108
-
3109
- SelectAdapter.prototype.unselect = function (data) {
3110
- var self = this;
3111
-
3112
- if (!this.$element.prop('multiple')) {
3113
- return;
3114
- }
3115
-
3116
- data.selected = false;
3117
-
3118
- if ($(data.element).is('option')) {
3119
- data.element.selected = false;
3120
-
3121
- this.$element.trigger('change');
3122
-
3123
- return;
3124
- }
3125
-
3126
- this.current(function (currentData) {
3127
- var val = [];
3128
-
3129
- for (var d = 0; d < currentData.length; d++) {
3130
- var id = currentData[d].id;
3131
-
3132
- if (id !== data.id && $.inArray(id, val) === -1) {
3133
- val.push(id);
3134
- }
3135
- }
3136
-
3137
- self.$element.val(val);
3138
-
3139
- self.$element.trigger('change');
3140
- });
3141
- };
3142
-
3143
- SelectAdapter.prototype.bind = function (container, $container) {
3144
- var self = this;
3145
-
3146
- this.container = container;
3147
-
3148
- container.on('select', function (params) {
3149
- self.select(params.data);
3150
- });
3151
-
3152
- container.on('unselect', function (params) {
3153
- self.unselect(params.data);
3154
- });
3155
- };
3156
-
3157
- SelectAdapter.prototype.destroy = function () {
3158
- // Remove anything added to child elements
3159
- this.$element.find('*').each(function () {
3160
- // Remove any custom data set by Select2
3161
- $.removeData(this, 'data');
3162
- });
3163
- };
3164
-
3165
- SelectAdapter.prototype.query = function (params, callback) {
3166
- var data = [];
3167
- var self = this;
3168
-
3169
- var $options = this.$element.children();
3170
-
3171
- $options.each(function () {
3172
- var $option = $(this);
3173
-
3174
- if (!$option.is('option') && !$option.is('optgroup')) {
3175
- return;
3176
- }
3177
-
3178
- var option = self.item($option);
3179
-
3180
- var matches = self.matches(params, option);
3181
-
3182
- if (matches !== null) {
3183
- data.push(matches);
3184
- }
3185
- });
3186
-
3187
- callback({
3188
- results: data
3189
- });
3190
- };
3191
-
3192
- SelectAdapter.prototype.addOptions = function ($options) {
3193
- Utils.appendMany(this.$element, $options);
3194
- };
3195
-
3196
- SelectAdapter.prototype.option = function (data) {
3197
- var option;
3198
-
3199
- if (data.children) {
3200
- option = document.createElement('optgroup');
3201
- option.label = data.text;
3202
- } else {
3203
- option = document.createElement('option');
3204
-
3205
- if (option.textContent !== undefined) {
3206
- option.textContent = data.text;
3207
- } else {
3208
- option.innerText = data.text;
3209
- }
3210
- }
3211
-
3212
- if (data.id !== undefined) {
3213
- option.value = data.id;
3214
- }
3215
-
3216
- if (data.disabled) {
3217
- option.disabled = true;
3218
- }
3219
-
3220
- if (data.selected) {
3221
- option.selected = true;
3222
- }
3223
-
3224
- if (data.title) {
3225
- option.title = data.title;
3226
- }
3227
-
3228
- var $option = $(option);
3229
-
3230
- var normalizedData = this._normalizeItem(data);
3231
- normalizedData.element = option;
3232
-
3233
- // Override the option's data with the combined data
3234
- $.data(option, 'data', normalizedData);
3235
-
3236
- return $option;
3237
- };
3238
-
3239
- SelectAdapter.prototype.item = function ($option) {
3240
- var data = {};
3241
-
3242
- data = $.data($option[0], 'data');
3243
-
3244
- if (data != null) {
3245
- return data;
3246
- }
3247
-
3248
- if ($option.is('option')) {
3249
- data = {
3250
- id: $option.val(),
3251
- text: $option.text(),
3252
- disabled: $option.prop('disabled'),
3253
- selected: $option.prop('selected'),
3254
- title: $option.prop('title')
3255
- };
3256
- } else if ($option.is('optgroup')) {
3257
- data = {
3258
- text: $option.prop('label'),
3259
- children: [],
3260
- title: $option.prop('title')
3261
- };
3262
-
3263
- var $children = $option.children('option');
3264
- var children = [];
3265
-
3266
- for (var c = 0; c < $children.length; c++) {
3267
- var $child = $($children[c]);
3268
-
3269
- var child = this.item($child);
3270
-
3271
- children.push(child);
3272
- }
3273
-
3274
- data.children = children;
3275
- }
3276
-
3277
- data = this._normalizeItem(data);
3278
- data.element = $option[0];
3279
-
3280
- $.data($option[0], 'data', data);
3281
-
3282
- return data;
3283
- };
3284
-
3285
- SelectAdapter.prototype._normalizeItem = function (item) {
3286
- if (!$.isPlainObject(item)) {
3287
- item = {
3288
- id: item,
3289
- text: item
3290
- };
3291
- }
3292
-
3293
- item = $.extend({}, {
3294
- text: ''
3295
- }, item);
3296
-
3297
- var defaults = {
3298
- selected: false,
3299
- disabled: false
3300
- };
3301
-
3302
- if (item.id != null) {
3303
- item.id = item.id.toString();
3304
- }
3305
-
3306
- if (item.text != null) {
3307
- item.text = item.text.toString();
3308
- }
3309
-
3310
- if (item._resultId == null && item.id && this.container != null) {
3311
- item._resultId = this.generateResultId(this.container, item);
3312
- }
3313
-
3314
- return $.extend({}, defaults, item);
3315
- };
3316
-
3317
- SelectAdapter.prototype.matches = function (params, data) {
3318
- var matcher = this.options.get('matcher');
3319
-
3320
- return matcher(params, data);
3321
- };
3322
-
3323
- return SelectAdapter;
3324
- });
3325
-
3326
- S2.define('select2/data/array',[
3327
- './select',
3328
- '../utils',
3329
- 'jquery'
3330
- ], function (SelectAdapter, Utils, $) {
3331
- function ArrayAdapter ($element, options) {
3332
- var data = options.get('data') || [];
3333
-
3334
- ArrayAdapter.__super__.constructor.call(this, $element, options);
3335
-
3336
- this.addOptions(this.convertToOptions(data));
3337
- }
3338
-
3339
- Utils.Extend(ArrayAdapter, SelectAdapter);
3340
-
3341
- ArrayAdapter.prototype.select = function (data) {
3342
- var $option = this.$element.find('option').filter(function (i, elm) {
3343
- return elm.value == data.id.toString();
3344
- });
3345
-
3346
- if ($option.length === 0) {
3347
- $option = this.option(data);
3348
-
3349
- this.addOptions($option);
3350
- }
3351
-
3352
- ArrayAdapter.__super__.select.call(this, data);
3353
- };
3354
-
3355
- ArrayAdapter.prototype.convertToOptions = function (data) {
3356
- var self = this;
3357
-
3358
- var $existing = this.$element.find('option');
3359
- var existingIds = $existing.map(function () {
3360
- return self.item($(this)).id;
3361
- }).get();
3362
-
3363
- var $options = [];
3364
-
3365
- // Filter out all items except for the one passed in the argument
3366
- function onlyItem (item) {
3367
- return function () {
3368
- return $(this).val() == item.id;
3369
- };
3370
- }
3371
-
3372
- for (var d = 0; d < data.length; d++) {
3373
- var item = this._normalizeItem(data[d]);
3374
-
3375
- // Skip items which were pre-loaded, only merge the data
3376
- if ($.inArray(item.id, existingIds) >= 0) {
3377
- var $existingOption = $existing.filter(onlyItem(item));
3378
-
3379
- var existingData = this.item($existingOption);
3380
- var newData = $.extend(true, {}, item, existingData);
3381
-
3382
- var $newOption = this.option(newData);
3383
-
3384
- $existingOption.replaceWith($newOption);
3385
-
3386
- continue;
3387
- }
3388
-
3389
- var $option = this.option(item);
3390
-
3391
- if (item.children) {
3392
- var $children = this.convertToOptions(item.children);
3393
-
3394
- Utils.appendMany($option, $children);
3395
- }
3396
-
3397
- $options.push($option);
3398
- }
3399
-
3400
- return $options;
3401
- };
3402
-
3403
- return ArrayAdapter;
3404
- });
3405
-
3406
- S2.define('select2/data/ajax',[
3407
- './array',
3408
- '../utils',
3409
- 'jquery'
3410
- ], function (ArrayAdapter, Utils, $) {
3411
- function AjaxAdapter ($element, options) {
3412
- this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3413
-
3414
- if (this.ajaxOptions.processResults != null) {
3415
- this.processResults = this.ajaxOptions.processResults;
3416
- }
3417
-
3418
- AjaxAdapter.__super__.constructor.call(this, $element, options);
3419
- }
3420
-
3421
- Utils.Extend(AjaxAdapter, ArrayAdapter);
3422
-
3423
- AjaxAdapter.prototype._applyDefaults = function (options) {
3424
- var defaults = {
3425
- data: function (params) {
3426
- return $.extend({}, params, {
3427
- q: params.term
3428
- });
3429
- },
3430
- transport: function (params, success, failure) {
3431
- var $request = $.ajax(params);
3432
-
3433
- $request.then(success);
3434
- $request.fail(failure);
3435
-
3436
- return $request;
3437
- }
3438
- };
3439
-
3440
- return $.extend({}, defaults, options, true);
3441
- };
3442
-
3443
- AjaxAdapter.prototype.processResults = function (results) {
3444
- return results;
3445
- };
3446
-
3447
- AjaxAdapter.prototype.query = function (params, callback) {
3448
- var matches = [];
3449
- var self = this;
3450
-
3451
- if (this._request != null) {
3452
- // JSONP requests cannot always be aborted
3453
- if ($.isFunction(this._request.abort)) {
3454
- this._request.abort();
3455
- }
3456
-
3457
- this._request = null;
3458
- }
3459
-
3460
- var options = $.extend({
3461
- type: 'GET'
3462
- }, this.ajaxOptions);
3463
-
3464
- if (typeof options.url === 'function') {
3465
- options.url = options.url.call(this.$element, params);
3466
- }
3467
-
3468
- if (typeof options.data === 'function') {
3469
- options.data = options.data.call(this.$element, params);
3470
- }
3471
-
3472
- function request () {
3473
- var $request = options.transport(options, function (data) {
3474
- var results = self.processResults(data, params);
3475
-
3476
- if (self.options.get('debug') && window.console && console.error) {
3477
- // Check to make sure that the response included a `results` key.
3478
- if (!results || !results.results || !$.isArray(results.results)) {
3479
- console.error(
3480
- 'Select2: The AJAX results did not return an array in the ' +
3481
- '`results` key of the response.'
3482
- );
3483
- }
3484
- }
3485
-
3486
- callback(results);
3487
- }, function () {
3488
- // Attempt to detect if a request was aborted
3489
- // Only works if the transport exposes a status property
3490
- if ($request.status && $request.status === '0') {
3491
- return;
3492
- }
3493
-
3494
- self.trigger('results:message', {
3495
- message: 'errorLoading'
3496
- });
3497
- });
3498
-
3499
- self._request = $request;
3500
- }
3501
-
3502
- if (this.ajaxOptions.delay && params.term != null) {
3503
- if (this._queryTimeout) {
3504
- window.clearTimeout(this._queryTimeout);
3505
- }
3506
-
3507
- this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3508
- } else {
3509
- request();
3510
- }
3511
- };
3512
-
3513
- return AjaxAdapter;
3514
- });
3515
-
3516
- S2.define('select2/data/tags',[
3517
- 'jquery'
3518
- ], function ($) {
3519
- function Tags (decorated, $element, options) {
3520
- var tags = options.get('tags');
3521
-
3522
- var createTag = options.get('createTag');
3523
-
3524
- if (createTag !== undefined) {
3525
- this.createTag = createTag;
3526
- }
3527
-
3528
- var insertTag = options.get('insertTag');
3529
-
3530
- if (insertTag !== undefined) {
3531
- this.insertTag = insertTag;
3532
- }
3533
-
3534
- decorated.call(this, $element, options);
3535
-
3536
- if ($.isArray(tags)) {
3537
- for (var t = 0; t < tags.length; t++) {
3538
- var tag = tags[t];
3539
- var item = this._normalizeItem(tag);
3540
-
3541
- var $option = this.option(item);
3542
-
3543
- this.$element.append($option);
3544
- }
3545
- }
3546
- }
3547
-
3548
- Tags.prototype.query = function (decorated, params, callback) {
3549
- var self = this;
3550
-
3551
- this._removeOldTags();
3552
-
3553
- if (params.term == null || params.page != null) {
3554
- decorated.call(this, params, callback);
3555
- return;
3556
- }
3557
-
3558
- function wrapper (obj, child) {
3559
- var data = obj.results;
3560
-
3561
- for (var i = 0; i < data.length; i++) {
3562
- var option = data[i];
3563
-
3564
- var checkChildren = (
3565
- option.children != null &&
3566
- !wrapper({
3567
- results: option.children
3568
- }, true)
3569
- );
3570
-
3571
- var optionText = (option.text || '').toUpperCase();
3572
- var paramsTerm = (params.term || '').toUpperCase();
3573
-
3574
- var checkText = optionText === paramsTerm;
3575
-
3576
- if (checkText || checkChildren) {
3577
- if (child) {
3578
- return false;
3579
- }
3580
-
3581
- obj.data = data;
3582
- callback(obj);
3583
-
3584
- return;
3585
- }
3586
- }
3587
-
3588
- if (child) {
3589
- return true;
3590
- }
3591
-
3592
- var tag = self.createTag(params);
3593
-
3594
- if (tag != null) {
3595
- var $option = self.option(tag);
3596
- $option.attr('data-select2-tag', true);
3597
-
3598
- self.addOptions([$option]);
3599
-
3600
- self.insertTag(data, tag);
3601
- }
3602
-
3603
- obj.results = data;
3604
-
3605
- callback(obj);
3606
- }
3607
-
3608
- decorated.call(this, params, wrapper);
3609
- };
3610
-
3611
- Tags.prototype.createTag = function (decorated, params) {
3612
- var term = $.trim(params.term);
3613
-
3614
- if (term === '') {
3615
- return null;
3616
- }
3617
-
3618
- return {
3619
- id: term,
3620
- text: term
3621
- };
3622
- };
3623
-
3624
- Tags.prototype.insertTag = function (_, data, tag) {
3625
- data.unshift(tag);
3626
- };
3627
-
3628
- Tags.prototype._removeOldTags = function (_) {
3629
- var tag = this._lastTag;
3630
-
3631
- var $options = this.$element.find('option[data-select2-tag]');
3632
-
3633
- $options.each(function () {
3634
- if (this.selected) {
3635
- return;
3636
- }
3637
-
3638
- $(this).remove();
3639
- });
3640
- };
3641
-
3642
- return Tags;
3643
- });
3644
-
3645
- S2.define('select2/data/tokenizer',[
3646
- 'jquery'
3647
- ], function ($) {
3648
- function Tokenizer (decorated, $element, options) {
3649
- var tokenizer = options.get('tokenizer');
3650
-
3651
- if (tokenizer !== undefined) {
3652
- this.tokenizer = tokenizer;
3653
- }
3654
-
3655
- decorated.call(this, $element, options);
3656
- }
3657
-
3658
- Tokenizer.prototype.bind = function (decorated, container, $container) {
3659
- decorated.call(this, container, $container);
3660
-
3661
- this.$search = container.dropdown.$search || container.selection.$search ||
3662
- $container.find('.select2-search__field');
3663
- };
3664
-
3665
- Tokenizer.prototype.query = function (decorated, params, callback) {
3666
- var self = this;
3667
-
3668
- function createAndSelect (data) {
3669
- // Normalize the data object so we can use it for checks
3670
- var item = self._normalizeItem(data);
3671
-
3672
- // Check if the data object already exists as a tag
3673
- // Select it if it doesn't
3674
- var $existingOptions = self.$element.find('option').filter(function () {
3675
- return $(this).val() === item.id;
3676
- });
3677
-
3678
- // If an existing option wasn't found for it, create the option
3679
- if (!$existingOptions.length) {
3680
- var $option = self.option(item);
3681
- $option.attr('data-select2-tag', true);
3682
-
3683
- self._removeOldTags();
3684
- self.addOptions([$option]);
3685
- }
3686
-
3687
- // Select the item, now that we know there is an option for it
3688
- select(item);
3689
- }
3690
-
3691
- function select (data) {
3692
- self.trigger('select', {
3693
- data: data
3694
- });
3695
- }
3696
-
3697
- params.term = params.term || '';
3698
-
3699
- var tokenData = this.tokenizer(params, this.options, createAndSelect);
3700
-
3701
- if (tokenData.term !== params.term) {
3702
- // Replace the search term if we have the search box
3703
- if (this.$search.length) {
3704
- this.$search.val(tokenData.term);
3705
- this.$search.focus();
3706
- }
3707
-
3708
- params.term = tokenData.term;
3709
- }
3710
-
3711
- decorated.call(this, params, callback);
3712
- };
3713
-
3714
- Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3715
- var separators = options.get('tokenSeparators') || [];
3716
- var term = params.term;
3717
- var i = 0;
3718
-
3719
- var createTag = this.createTag || function (params) {
3720
- return {
3721
- id: params.term,
3722
- text: params.term
3723
- };
3724
- };
3725
-
3726
- while (i < term.length) {
3727
- var termChar = term[i];
3728
-
3729
- if ($.inArray(termChar, separators) === -1) {
3730
- i++;
3731
-
3732
- continue;
3733
- }
3734
-
3735
- var part = term.substr(0, i);
3736
- var partParams = $.extend({}, params, {
3737
- term: part
3738
- });
3739
-
3740
- var data = createTag(partParams);
3741
-
3742
- if (data == null) {
3743
- i++;
3744
- continue;
3745
- }
3746
-
3747
- callback(data);
3748
-
3749
- // Reset the term to not include the tokenized portion
3750
- term = term.substr(i + 1) || '';
3751
- i = 0;
3752
- }
3753
-
3754
- return {
3755
- term: term
3756
- };
3757
- };
3758
-
3759
- return Tokenizer;
3760
- });
3761
-
3762
- S2.define('select2/data/minimumInputLength',[
3763
-
3764
- ], function () {
3765
- function MinimumInputLength (decorated, $e, options) {
3766
- this.minimumInputLength = options.get('minimumInputLength');
3767
-
3768
- decorated.call(this, $e, options);
3769
- }
3770
-
3771
- MinimumInputLength.prototype.query = function (decorated, params, callback) {
3772
- params.term = params.term || '';
3773
-
3774
- if (params.term.length < this.minimumInputLength) {
3775
- this.trigger('results:message', {
3776
- message: 'inputTooShort',
3777
- args: {
3778
- minimum: this.minimumInputLength,
3779
- input: params.term,
3780
- params: params
3781
- }
3782
- });
3783
-
3784
- return;
3785
- }
3786
-
3787
- decorated.call(this, params, callback);
3788
- };
3789
-
3790
- return MinimumInputLength;
3791
- });
3792
-
3793
- S2.define('select2/data/maximumInputLength',[
3794
-
3795
- ], function () {
3796
- function MaximumInputLength (decorated, $e, options) {
3797
- this.maximumInputLength = options.get('maximumInputLength');
3798
-
3799
- decorated.call(this, $e, options);
3800
- }
3801
-
3802
- MaximumInputLength.prototype.query = function (decorated, params, callback) {
3803
- params.term = params.term || '';
3804
-
3805
- if (this.maximumInputLength > 0 &&
3806
- params.term.length > this.maximumInputLength) {
3807
- this.trigger('results:message', {
3808
- message: 'inputTooLong',
3809
- args: {
3810
- maximum: this.maximumInputLength,
3811
- input: params.term,
3812
- params: params
3813
- }
3814
- });
3815
-
3816
- return;
3817
- }
3818
-
3819
- decorated.call(this, params, callback);
3820
- };
3821
-
3822
- return MaximumInputLength;
3823
- });
3824
-
3825
- S2.define('select2/data/maximumSelectionLength',[
3826
-
3827
- ], function (){
3828
- function MaximumSelectionLength (decorated, $e, options) {
3829
- this.maximumSelectionLength = options.get('maximumSelectionLength');
3830
-
3831
- decorated.call(this, $e, options);
3832
- }
3833
-
3834
- MaximumSelectionLength.prototype.query =
3835
- function (decorated, params, callback) {
3836
- var self = this;
3837
-
3838
- this.current(function (currentData) {
3839
- var count = currentData != null ? currentData.length : 0;
3840
- if (self.maximumSelectionLength > 0 &&
3841
- count >= self.maximumSelectionLength) {
3842
- self.trigger('results:message', {
3843
- message: 'maximumSelected',
3844
- args: {
3845
- maximum: self.maximumSelectionLength
3846
- }
3847
- });
3848
- return;
3849
- }
3850
- decorated.call(self, params, callback);
3851
- });
3852
- };
3853
-
3854
- return MaximumSelectionLength;
3855
- });
3856
-
3857
- S2.define('select2/dropdown',[
3858
- 'jquery',
3859
- './utils'
3860
- ], function ($, Utils) {
3861
- function Dropdown ($element, options) {
3862
- this.$element = $element;
3863
- this.options = options;
3864
-
3865
- Dropdown.__super__.constructor.call(this);
3866
- }
3867
-
3868
- Utils.Extend(Dropdown, Utils.Observable);
3869
-
3870
- Dropdown.prototype.render = function () {
3871
- var $dropdown = $(
3872
- '<span class="select2-dropdown">' +
3873
- '<span class="select2-results"></span>' +
3874
- '</span>'
3875
- );
3876
-
3877
- $dropdown.attr('dir', this.options.get('dir'));
3878
-
3879
- this.$dropdown = $dropdown;
3880
-
3881
- return $dropdown;
3882
- };
3883
-
3884
- Dropdown.prototype.bind = function () {
3885
- // Should be implemented in subclasses
3886
- };
3887
-
3888
- Dropdown.prototype.position = function ($dropdown, $container) {
3889
- // Should be implmented in subclasses
3890
- };
3891
-
3892
- Dropdown.prototype.destroy = function () {
3893
- // Remove the dropdown from the DOM
3894
- this.$dropdown.remove();
3895
- };
3896
-
3897
- return Dropdown;
3898
- });
3899
-
3900
- S2.define('select2/dropdown/search',[
3901
- 'jquery',
3902
- '../utils'
3903
- ], function ($, Utils) {
3904
- function Search () { }
3905
-
3906
- Search.prototype.render = function (decorated) {
3907
- var $rendered = decorated.call(this);
3908
-
3909
- var $search = $(
3910
- '<span class="select2-search select2-search--dropdown">' +
3911
- '<input class="select2-search__field" type="search" tabindex="-1"' +
3912
- ' autocomplete="off" autocorrect="off" autocapitalize="none"' +
3913
- ' spellcheck="false" role="textbox" />' +
3914
- '</span>'
3915
- );
3916
-
3917
- this.$searchContainer = $search;
3918
- this.$search = $search.find('input');
3919
-
3920
- $rendered.prepend($search);
3921
-
3922
- return $rendered;
3923
- };
3924
-
3925
- Search.prototype.bind = function (decorated, container, $container) {
3926
- var self = this;
3927
-
3928
- decorated.call(this, container, $container);
3929
-
3930
- this.$search.on('keydown', function (evt) {
3931
- self.trigger('keypress', evt);
3932
-
3933
- self._keyUpPrevented = evt.isDefaultPrevented();
3934
- });
3935
-
3936
- // Workaround for browsers which do not support the `input` event
3937
- // This will prevent double-triggering of events for browsers which support
3938
- // both the `keyup` and `input` events.
3939
- this.$search.on('input', function (evt) {
3940
- // Unbind the duplicated `keyup` event
3941
- $(this).off('keyup');
3942
- });
3943
-
3944
- this.$search.on('keyup input', function (evt) {
3945
- self.handleSearch(evt);
3946
- });
3947
-
3948
- container.on('open', function () {
3949
- self.$search.attr('tabindex', 0);
3950
-
3951
- self.$search.focus();
3952
-
3953
- window.setTimeout(function () {
3954
- self.$search.focus();
3955
- }, 0);
3956
- });
3957
-
3958
- container.on('close', function () {
3959
- self.$search.attr('tabindex', -1);
3960
-
3961
- self.$search.val('');
3962
- });
3963
-
3964
- container.on('focus', function () {
3965
- if (!container.isOpen()) {
3966
- self.$search.focus();
3967
- }
3968
- });
3969
-
3970
- container.on('results:all', function (params) {
3971
- if (params.query.term == null || params.query.term === '') {
3972
- var showSearch = self.showSearch(params);
3973
-
3974
- if (showSearch) {
3975
- self.$searchContainer.removeClass('select2-search--hide');
3976
- } else {
3977
- self.$searchContainer.addClass('select2-search--hide');
3978
- }
3979
- }
3980
- });
3981
- };
3982
-
3983
- Search.prototype.handleSearch = function (evt) {
3984
- if (!this._keyUpPrevented) {
3985
- var input = this.$search.val();
3986
-
3987
- this.trigger('query', {
3988
- term: input
3989
- });
3990
- }
3991
-
3992
- this._keyUpPrevented = false;
3993
- };
3994
-
3995
- Search.prototype.showSearch = function (_, params) {
3996
- return true;
3997
- };
3998
-
3999
- return Search;
4000
- });
4001
-
4002
- S2.define('select2/dropdown/hidePlaceholder',[
4003
-
4004
- ], function () {
4005
- function HidePlaceholder (decorated, $element, options, dataAdapter) {
4006
- this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4007
-
4008
- decorated.call(this, $element, options, dataAdapter);
4009
- }
4010
-
4011
- HidePlaceholder.prototype.append = function (decorated, data) {
4012
- data.results = this.removePlaceholder(data.results);
4013
-
4014
- decorated.call(this, data);
4015
- };
4016
-
4017
- HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4018
- if (typeof placeholder === 'string') {
4019
- placeholder = {
4020
- id: '',
4021
- text: placeholder
4022
- };
4023
- }
4024
-
4025
- return placeholder;
4026
- };
4027
-
4028
- HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4029
- var modifiedData = data.slice(0);
4030
-
4031
- for (var d = data.length - 1; d >= 0; d--) {
4032
- var item = data[d];
4033
-
4034
- if (this.placeholder.id === item.id) {
4035
- modifiedData.splice(d, 1);
4036
- }
4037
- }
4038
-
4039
- return modifiedData;
4040
- };
4041
-
4042
- return HidePlaceholder;
4043
- });
4044
-
4045
- S2.define('select2/dropdown/infiniteScroll',[
4046
- 'jquery'
4047
- ], function ($) {
4048
- function InfiniteScroll (decorated, $element, options, dataAdapter) {
4049
- this.lastParams = {};
4050
-
4051
- decorated.call(this, $element, options, dataAdapter);
4052
-
4053
- this.$loadingMore = this.createLoadingMore();
4054
- this.loading = false;
4055
- }
4056
-
4057
- InfiniteScroll.prototype.append = function (decorated, data) {
4058
- this.$loadingMore.remove();
4059
- this.loading = false;
4060
-
4061
- decorated.call(this, data);
4062
-
4063
- if (this.showLoadingMore(data)) {
4064
- this.$results.append(this.$loadingMore);
4065
- }
4066
- };
4067
-
4068
- InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4069
- var self = this;
4070
-
4071
- decorated.call(this, container, $container);
4072
-
4073
- container.on('query', function (params) {
4074
- self.lastParams = params;
4075
- self.loading = true;
4076
- });
4077
-
4078
- container.on('query:append', function (params) {
4079
- self.lastParams = params;
4080
- self.loading = true;
4081
- });
4082
-
4083
- this.$results.on('scroll', function () {
4084
- var isLoadMoreVisible = $.contains(
4085
- document.documentElement,
4086
- self.$loadingMore[0]
4087
- );
4088
-
4089
- if (self.loading || !isLoadMoreVisible) {
4090
- return;
4091
- }
4092
-
4093
- var currentOffset = self.$results.offset().top +
4094
- self.$results.outerHeight(false);
4095
- var loadingMoreOffset = self.$loadingMore.offset().top +
4096
- self.$loadingMore.outerHeight(false);
4097
-
4098
- if (currentOffset + 50 >= loadingMoreOffset) {
4099
- self.loadMore();
4100
- }
4101
- });
4102
- };
4103
-
4104
- InfiniteScroll.prototype.loadMore = function () {
4105
- this.loading = true;
4106
-
4107
- var params = $.extend({}, {page: 1}, this.lastParams);
4108
-
4109
- params.page++;
4110
-
4111
- this.trigger('query:append', params);
4112
- };
4113
-
4114
- InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4115
- return data.pagination && data.pagination.more;
4116
- };
4117
-
4118
- InfiniteScroll.prototype.createLoadingMore = function () {
4119
- var $option = $(
4120
- '<li ' +
4121
- 'class="select2-results__option select2-results__option--load-more"' +
4122
- 'role="treeitem" aria-disabled="true"></li>'
4123
- );
4124
-
4125
- var message = this.options.get('translations').get('loadingMore');
4126
-
4127
- $option.html(message(this.lastParams));
4128
-
4129
- return $option;
4130
- };
4131
-
4132
- return InfiniteScroll;
4133
- });
4134
-
4135
- S2.define('select2/dropdown/attachBody',[
4136
- 'jquery',
4137
- '../utils'
4138
- ], function ($, Utils) {
4139
- function AttachBody (decorated, $element, options) {
4140
- this.$dropdownParent = options.get('dropdownParent') || $(document.body);
4141
-
4142
- decorated.call(this, $element, options);
4143
- }
4144
-
4145
- AttachBody.prototype.bind = function (decorated, container, $container) {
4146
- var self = this;
4147
-
4148
- var setupResultsEvents = false;
4149
-
4150
- decorated.call(this, container, $container);
4151
-
4152
- container.on('open', function () {
4153
- self._showDropdown();
4154
- self._attachPositioningHandler(container);
4155
-
4156
- if (!setupResultsEvents) {
4157
- setupResultsEvents = true;
4158
-
4159
- container.on('results:all', function () {
4160
- self._positionDropdown();
4161
- self._resizeDropdown();
4162
- });
4163
-
4164
- container.on('results:append', function () {
4165
- self._positionDropdown();
4166
- self._resizeDropdown();
4167
- });
4168
- }
4169
- });
4170
-
4171
- container.on('close', function () {
4172
- self._hideDropdown();
4173
- self._detachPositioningHandler(container);
4174
- });
4175
-
4176
- this.$dropdownContainer.on('mousedown', function (evt) {
4177
- evt.stopPropagation();
4178
- });
4179
- };
4180
-
4181
- AttachBody.prototype.destroy = function (decorated) {
4182
- decorated.call(this);
4183
-
4184
- this.$dropdownContainer.remove();
4185
- };
4186
-
4187
- AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4188
- // Clone all of the container classes
4189
- $dropdown.attr('class', $container.attr('class'));
4190
-
4191
- $dropdown.removeClass('select2');
4192
- $dropdown.addClass('select2-container--open');
4193
-
4194
- $dropdown.css({
4195
- position: 'absolute',
4196
- top: -999999
4197
- });
4198
-
4199
- this.$container = $container;
4200
- };
4201
-
4202
- AttachBody.prototype.render = function (decorated) {
4203
- var $container = $('<span></span>');
4204
-
4205
- var $dropdown = decorated.call(this);
4206
- $container.append($dropdown);
4207
-
4208
- this.$dropdownContainer = $container;
4209
-
4210
- return $container;
4211
- };
4212
-
4213
- AttachBody.prototype._hideDropdown = function (decorated) {
4214
- this.$dropdownContainer.detach();
4215
- };
4216
-
4217
- AttachBody.prototype._attachPositioningHandler =
4218
- function (decorated, container) {
4219
- var self = this;
4220
-
4221
- var scrollEvent = 'scroll.select2.' + container.id;
4222
- var resizeEvent = 'resize.select2.' + container.id;
4223
- var orientationEvent = 'orientationchange.select2.' + container.id;
4224
-
4225
- var $watchers = this.$container.parents().filter(Utils.hasScroll);
4226
- $watchers.each(function () {
4227
- $(this).data('select2-scroll-position', {
4228
- x: $(this).scrollLeft(),
4229
- y: $(this).scrollTop()
4230
- });
4231
- });
4232
-
4233
- $watchers.on(scrollEvent, function (ev) {
4234
- var position = $(this).data('select2-scroll-position');
4235
- $(this).scrollTop(position.y);
4236
- });
4237
-
4238
- $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4239
- function (e) {
4240
- self._positionDropdown();
4241
- self._resizeDropdown();
4242
- });
4243
- };
4244
-
4245
- AttachBody.prototype._detachPositioningHandler =
4246
- function (decorated, container) {
4247
- var scrollEvent = 'scroll.select2.' + container.id;
4248
- var resizeEvent = 'resize.select2.' + container.id;
4249
- var orientationEvent = 'orientationchange.select2.' + container.id;
4250
-
4251
- var $watchers = this.$container.parents().filter(Utils.hasScroll);
4252
- $watchers.off(scrollEvent);
4253
-
4254
- $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4255
- };
4256
-
4257
- AttachBody.prototype._positionDropdown = function () {
4258
- var $window = $(window);
4259
-
4260
- var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
4261
- var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
4262
-
4263
- var newDirection = null;
4264
-
4265
- var offset = this.$container.offset();
4266
-
4267
- offset.bottom = offset.top + this.$container.outerHeight(false);
4268
-
4269
- var container = {
4270
- height: this.$container.outerHeight(false)
4271
- };
4272
-
4273
- container.top = offset.top;
4274
- container.bottom = offset.top + container.height;
4275
-
4276
- var dropdown = {
4277
- height: this.$dropdown.outerHeight(false)
4278
- };
4279
-
4280
- var viewport = {
4281
- top: $window.scrollTop(),
4282
- bottom: $window.scrollTop() + $window.height()
4283
- };
4284
-
4285
- var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4286
- var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4287
-
4288
- var css = {
4289
- left: offset.left,
4290
- top: container.bottom
4291
- };
4292
-
4293
- // Determine what the parent element is to use for calciulating the offset
4294
- var $offsetParent = this.$dropdownParent;
4295
-
4296
- // For statically positoned elements, we need to get the element
4297
- // that is determining the offset
4298
- if ($offsetParent.css('position') === 'static') {
4299
- $offsetParent = $offsetParent.offsetParent();
4300
- }
4301
-
4302
- var parentOffset = $offsetParent.offset();
4303
-
4304
- css.top -= parentOffset.top;
4305
- css.left -= parentOffset.left;
4306
-
4307
- if (!isCurrentlyAbove && !isCurrentlyBelow) {
4308
- newDirection = 'below';
4309
- }
4310
-
4311
- if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4312
- newDirection = 'above';
4313
- } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4314
- newDirection = 'below';
4315
- }
4316
-
4317
- if (newDirection == 'above' ||
4318
- (isCurrentlyAbove && newDirection !== 'below')) {
4319
- css.top = container.top - parentOffset.top - dropdown.height;
4320
- }
4321
-
4322
- if (newDirection != null) {
4323
- this.$dropdown
4324
- .removeClass('select2-dropdown--below select2-dropdown--above')
4325
- .addClass('select2-dropdown--' + newDirection);
4326
- this.$container
4327
- .removeClass('select2-container--below select2-container--above')
4328
- .addClass('select2-container--' + newDirection);
4329
- }
4330
-
4331
- this.$dropdownContainer.css(css);
4332
- };
4333
-
4334
- AttachBody.prototype._resizeDropdown = function () {
4335
- var css = {
4336
- width: this.$container.outerWidth(false) + 'px'
4337
- };
4338
-
4339
- if (this.options.get('dropdownAutoWidth')) {
4340
- css.minWidth = css.width;
4341
- css.position = 'relative';
4342
- css.width = 'auto';
4343
- }
4344
-
4345
- this.$dropdown.css(css);
4346
- };
4347
-
4348
- AttachBody.prototype._showDropdown = function (decorated) {
4349
- this.$dropdownContainer.appendTo(this.$dropdownParent);
4350
-
4351
- this._positionDropdown();
4352
- this._resizeDropdown();
4353
- };
4354
-
4355
- return AttachBody;
4356
- });
4357
-
4358
- S2.define('select2/dropdown/minimumResultsForSearch',[
4359
-
4360
- ], function () {
4361
- function countResults (data) {
4362
- var count = 0;
4363
-
4364
- for (var d = 0; d < data.length; d++) {
4365
- var item = data[d];
4366
-
4367
- if (item.children) {
4368
- count += countResults(item.children);
4369
- } else {
4370
- count++;
4371
- }
4372
- }
4373
-
4374
- return count;
4375
- }
4376
-
4377
- function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4378
- this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4379
-
4380
- if (this.minimumResultsForSearch < 0) {
4381
- this.minimumResultsForSearch = Infinity;
4382
- }
4383
-
4384
- decorated.call(this, $element, options, dataAdapter);
4385
- }
4386
-
4387
- MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4388
- if (countResults(params.data.results) < this.minimumResultsForSearch) {
4389
- return false;
4390
- }
4391
-
4392
- return decorated.call(this, params);
4393
- };
4394
-
4395
- return MinimumResultsForSearch;
4396
- });
4397
-
4398
- S2.define('select2/dropdown/selectOnClose',[
4399
-
4400
- ], function () {
4401
- function SelectOnClose () { }
4402
-
4403
- SelectOnClose.prototype.bind = function (decorated, container, $container) {
4404
- var self = this;
4405
-
4406
- decorated.call(this, container, $container);
4407
-
4408
- container.on('close', function (params) {
4409
- self._handleSelectOnClose(params);
4410
- });
4411
- };
4412
-
4413
- SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4414
- if (params && params.originalSelect2Event != null) {
4415
- var event = params.originalSelect2Event;
4416
-
4417
- // Don't select an item if the close event was triggered from a select or
4418
- // unselect event
4419
- if (event._type === 'select' || event._type === 'unselect') {
4420
- return;
4421
- }
4422
- }
4423
-
4424
- var $highlightedResults = this.getHighlightedResults();
4425
-
4426
- // Only select highlighted results
4427
- if ($highlightedResults.length < 1) {
4428
- return;
4429
- }
4430
-
4431
- var data = $highlightedResults.data('data');
4432
-
4433
- // Don't re-select already selected resulte
4434
- if (
4435
- (data.element != null && data.element.selected) ||
4436
- (data.element == null && data.selected)
4437
- ) {
4438
- return;
4439
- }
4440
-
4441
- this.trigger('select', {
4442
- data: data
4443
- });
4444
- };
4445
-
4446
- return SelectOnClose;
4447
- });
4448
-
4449
- S2.define('select2/dropdown/closeOnSelect',[
4450
-
4451
- ], function () {
4452
- function CloseOnSelect () { }
4453
-
4454
- CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4455
- var self = this;
4456
-
4457
- decorated.call(this, container, $container);
4458
-
4459
- container.on('select', function (evt) {
4460
- self._selectTriggered(evt);
4461
- });
4462
-
4463
- container.on('unselect', function (evt) {
4464
- self._selectTriggered(evt);
4465
- });
4466
- };
4467
-
4468
- CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4469
- var originalEvent = evt.originalEvent;
4470
-
4471
- // Don't close if the control key is being held
4472
- if (originalEvent && originalEvent.ctrlKey) {
4473
- return;
4474
- }
4475
-
4476
- this.trigger('close', {
4477
- originalEvent: originalEvent,
4478
- originalSelect2Event: evt
4479
- });
4480
- };
4481
-
4482
- return CloseOnSelect;
4483
- });
4484
-
4485
- S2.define('select2/i18n/en',[],function () {
4486
- // English
4487
- return {
4488
- errorLoading: function () {
4489
- return 'The results could not be loaded.';
4490
- },
4491
- inputTooLong: function (args) {
4492
- var overChars = args.input.length - args.maximum;
4493
-
4494
- var message = 'Please delete ' + overChars + ' character';
4495
-
4496
- if (overChars != 1) {
4497
- message += 's';
4498
- }
4499
-
4500
- return message;
4501
- },
4502
- inputTooShort: function (args) {
4503
- var remainingChars = args.minimum - args.input.length;
4504
-
4505
- var message = 'Please enter ' + remainingChars + ' or more characters';
4506
-
4507
- return message;
4508
- },
4509
- loadingMore: function () {
4510
- return 'Loading more results…';
4511
- },
4512
- maximumSelected: function (args) {
4513
- var message = 'You can only select ' + args.maximum + ' item';
4514
-
4515
- if (args.maximum != 1) {
4516
- message += 's';
4517
- }
4518
-
4519
- return message;
4520
- },
4521
- noResults: function () {
4522
- return 'No results found';
4523
- },
4524
- searching: function () {
4525
- return 'Searching…';
4526
- }
4527
- };
4528
- });
4529
-
4530
- S2.define('select2/defaults',[
4531
- 'jquery',
4532
- 'require',
4533
-
4534
- './results',
4535
-
4536
- './selection/single',
4537
- './selection/multiple',
4538
- './selection/placeholder',
4539
- './selection/allowClear',
4540
- './selection/search',
4541
- './selection/eventRelay',
4542
-
4543
- './utils',
4544
- './translation',
4545
- './diacritics',
4546
-
4547
- './data/select',
4548
- './data/array',
4549
- './data/ajax',
4550
- './data/tags',
4551
- './data/tokenizer',
4552
- './data/minimumInputLength',
4553
- './data/maximumInputLength',
4554
- './data/maximumSelectionLength',
4555
-
4556
- './dropdown',
4557
- './dropdown/search',
4558
- './dropdown/hidePlaceholder',
4559
- './dropdown/infiniteScroll',
4560
- './dropdown/attachBody',
4561
- './dropdown/minimumResultsForSearch',
4562
- './dropdown/selectOnClose',
4563
- './dropdown/closeOnSelect',
4564
-
4565
- './i18n/en'
4566
- ], function ($, require,
4567
-
4568
- ResultsList,
4569
-
4570
- SingleSelection, MultipleSelection, Placeholder, AllowClear,
4571
- SelectionSearch, EventRelay,
4572
-
4573
- Utils, Translation, DIACRITICS,
4574
-
4575
- SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4576
- MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4577
-
4578
- Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4579
- AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4580
-
4581
- EnglishTranslation) {
4582
- function Defaults () {
4583
- this.reset();
4584
- }
4585
-
4586
- Defaults.prototype.apply = function (options) {
4587
- options = $.extend(true, {}, this.defaults, options);
4588
-
4589
- if (options.dataAdapter == null) {
4590
- if (options.ajax != null) {
4591
- options.dataAdapter = AjaxData;
4592
- } else if (options.data != null) {
4593
- options.dataAdapter = ArrayData;
4594
- } else {
4595
- options.dataAdapter = SelectData;
4596
- }
4597
-
4598
- if (options.minimumInputLength > 0) {
4599
- options.dataAdapter = Utils.Decorate(
4600
- options.dataAdapter,
4601
- MinimumInputLength
4602
- );
4603
- }
4604
-
4605
- if (options.maximumInputLength > 0) {
4606
- options.dataAdapter = Utils.Decorate(
4607
- options.dataAdapter,
4608
- MaximumInputLength
4609
- );
4610
- }
4611
-
4612
- if (options.maximumSelectionLength > 0) {
4613
- options.dataAdapter = Utils.Decorate(
4614
- options.dataAdapter,
4615
- MaximumSelectionLength
4616
- );
4617
- }
4618
-
4619
- if (options.tags) {
4620
- options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
4621
- }
4622
-
4623
- if (options.tokenSeparators != null || options.tokenizer != null) {
4624
- options.dataAdapter = Utils.Decorate(
4625
- options.dataAdapter,
4626
- Tokenizer
4627
- );
4628
- }
4629
-
4630
- if (options.query != null) {
4631
- var Query = require(options.amdBase + 'compat/query');
4632
-
4633
- options.dataAdapter = Utils.Decorate(
4634
- options.dataAdapter,
4635
- Query
4636
- );
4637
- }
4638
-
4639
- if (options.initSelection != null) {
4640
- var InitSelection = require(options.amdBase + 'compat/initSelection');
4641
-
4642
- options.dataAdapter = Utils.Decorate(
4643
- options.dataAdapter,
4644
- InitSelection
4645
- );
4646
- }
4647
- }
4648
-
4649
- if (options.resultsAdapter == null) {
4650
- options.resultsAdapter = ResultsList;
4651
-
4652
- if (options.ajax != null) {
4653
- options.resultsAdapter = Utils.Decorate(
4654
- options.resultsAdapter,
4655
- InfiniteScroll
4656
- );
4657
- }
4658
-
4659
- if (options.placeholder != null) {
4660
- options.resultsAdapter = Utils.Decorate(
4661
- options.resultsAdapter,
4662
- HidePlaceholder
4663
- );
4664
- }
4665
-
4666
- if (options.selectOnClose) {
4667
- options.resultsAdapter = Utils.Decorate(
4668
- options.resultsAdapter,
4669
- SelectOnClose
4670
- );
4671
- }
4672
- }
4673
-
4674
- if (options.dropdownAdapter == null) {
4675
- if (options.multiple) {
4676
- options.dropdownAdapter = Dropdown;
4677
- } else {
4678
- var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
4679
-
4680
- options.dropdownAdapter = SearchableDropdown;
4681
- }
4682
-
4683
- if (options.minimumResultsForSearch !== 0) {
4684
- options.dropdownAdapter = Utils.Decorate(
4685
- options.dropdownAdapter,
4686
- MinimumResultsForSearch
4687
- );
4688
- }
4689
-
4690
- if (options.closeOnSelect) {
4691
- options.dropdownAdapter = Utils.Decorate(
4692
- options.dropdownAdapter,
4693
- CloseOnSelect
4694
- );
4695
- }
4696
-
4697
- if (
4698
- options.dropdownCssClass != null ||
4699
- options.dropdownCss != null ||
4700
- options.adaptDropdownCssClass != null
4701
- ) {
4702
- var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
4703
-
4704
- options.dropdownAdapter = Utils.Decorate(
4705
- options.dropdownAdapter,
4706
- DropdownCSS
4707
- );
4708
- }
4709
-
4710
- options.dropdownAdapter = Utils.Decorate(
4711
- options.dropdownAdapter,
4712
- AttachBody
4713
- );
4714
- }
4715
-
4716
- if (options.selectionAdapter == null) {
4717
- if (options.multiple) {
4718
- options.selectionAdapter = MultipleSelection;
4719
- } else {
4720
- options.selectionAdapter = SingleSelection;
4721
- }
4722
-
4723
- // Add the placeholder mixin if a placeholder was specified
4724
- if (options.placeholder != null) {
4725
- options.selectionAdapter = Utils.Decorate(
4726
- options.selectionAdapter,
4727
- Placeholder
4728
- );
4729
- }
4730
-
4731
- if (options.allowClear) {
4732
- options.selectionAdapter = Utils.Decorate(
4733
- options.selectionAdapter,
4734
- AllowClear
4735
- );
4736
- }
4737
-
4738
- if (options.multiple) {
4739
- options.selectionAdapter = Utils.Decorate(
4740
- options.selectionAdapter,
4741
- SelectionSearch
4742
- );
4743
- }
4744
-
4745
- if (
4746
- options.containerCssClass != null ||
4747
- options.containerCss != null ||
4748
- options.adaptContainerCssClass != null
4749
- ) {
4750
- var ContainerCSS = require(options.amdBase + 'compat/containerCss');
4751
-
4752
- options.selectionAdapter = Utils.Decorate(
4753
- options.selectionAdapter,
4754
- ContainerCSS
4755
- );
4756
- }
4757
-
4758
- options.selectionAdapter = Utils.Decorate(
4759
- options.selectionAdapter,
4760
- EventRelay
4761
- );
4762
- }
4763
-
4764
- if (typeof options.language === 'string') {
4765
- // Check if the language is specified with a region
4766
- if (options.language.indexOf('-') > 0) {
4767
- // Extract the region information if it is included
4768
- var languageParts = options.language.split('-');
4769
- var baseLanguage = languageParts[0];
4770
-
4771
- options.language = [options.language, baseLanguage];
4772
- } else {
4773
- options.language = [options.language];
4774
- }
4775
- }
4776
-
4777
- if ($.isArray(options.language)) {
4778
- var languages = new Translation();
4779
- options.language.push('en');
4780
-
4781
- var languageNames = options.language;
4782
-
4783
- for (var l = 0; l < languageNames.length; l++) {
4784
- var name = languageNames[l];
4785
- var language = {};
4786
-
4787
- try {
4788
- // Try to load it with the original name
4789
- language = Translation.loadPath(name);
4790
- } catch (e) {
4791
- try {
4792
- // If we couldn't load it, check if it wasn't the full path
4793
- name = this.defaults.amdLanguageBase + name;
4794
- language = Translation.loadPath(name);
4795
- } catch (ex) {
4796
- // The translation could not be loaded at all. Sometimes this is
4797
- // because of a configuration problem, other times this can be
4798
- // because of how Select2 helps load all possible translation files.
4799
- if (options.debug && window.console && console.warn) {
4800
- console.warn(
4801
- 'Select2: The language file for "' + name + '" could not be ' +
4802
- 'automatically loaded. A fallback will be used instead.'
4803
- );
4804
- }
4805
-
4806
- continue;
4807
- }
4808
- }
4809
-
4810
- languages.extend(language);
4811
- }
4812
-
4813
- options.translations = languages;
4814
- } else {
4815
- var baseTranslation = Translation.loadPath(
4816
- this.defaults.amdLanguageBase + 'en'
4817
- );
4818
- var customTranslation = new Translation(options.language);
4819
-
4820
- customTranslation.extend(baseTranslation);
4821
-
4822
- options.translations = customTranslation;
4823
- }
4824
-
4825
- return options;
4826
- };
4827
-
4828
- Defaults.prototype.reset = function () {
4829
- function stripDiacritics (text) {
4830
- // Used 'uni range + named function' from http://jsperf.com/diacritics/18
4831
- function match(a) {
4832
- return DIACRITICS[a] || a;
4833
- }
4834
-
4835
- return text.replace(/[^\u0000-\u007E]/g, match);
4836
- }
4837
-
4838
- function matcher (params, data) {
4839
- // Always return the object if there is nothing to compare
4840
- if ($.trim(params.term) === '') {
4841
- return data;
4842
- }
4843
-
4844
- // Do a recursive check for options with children
4845
- if (data.children && data.children.length > 0) {
4846
- // Clone the data object if there are children
4847
- // This is required as we modify the object to remove any non-matches
4848
- var match = $.extend(true, {}, data);
4849
-
4850
- // Check each child of the option
4851
- for (var c = data.children.length - 1; c >= 0; c--) {
4852
- var child = data.children[c];
4853
-
4854
- var matches = matcher(params, child);
4855
-
4856
- // If there wasn't a match, remove the object in the array
4857
- if (matches == null) {
4858
- match.children.splice(c, 1);
4859
- }
4860
- }
4861
-
4862
- // If any children matched, return the new object
4863
- if (match.children.length > 0) {
4864
- return match;
4865
- }
4866
-
4867
- // If there were no matching children, check just the plain object
4868
- return matcher(params, match);
4869
- }
4870
-
4871
- var original = stripDiacritics(data.text).toUpperCase();
4872
- var term = stripDiacritics(params.term).toUpperCase();
4873
-
4874
- // Check if the text contains the term
4875
- if (original.indexOf(term) > -1) {
4876
- return data;
4877
- }
4878
-
4879
- // If it doesn't contain the term, don't return anything
4880
- return null;
4881
- }
4882
-
4883
- this.defaults = {
4884
- amdBase: './',
4885
- amdLanguageBase: './i18n/',
4886
- closeOnSelect: true,
4887
- debug: false,
4888
- dropdownAutoWidth: false,
4889
- escapeMarkup: Utils.escapeMarkup,
4890
- language: EnglishTranslation,
4891
- matcher: matcher,
4892
- minimumInputLength: 0,
4893
- maximumInputLength: 0,
4894
- maximumSelectionLength: 0,
4895
- minimumResultsForSearch: 0,
4896
- selectOnClose: false,
4897
- sorter: function (data) {
4898
- return data;
4899
- },
4900
- templateResult: function (result) {
4901
- return result.text;
4902
- },
4903
- templateSelection: function (selection) {
4904
- return selection.text;
4905
- },
4906
- theme: 'default',
4907
- width: 'resolve'
4908
- };
4909
- };
4910
-
4911
- Defaults.prototype.set = function (key, value) {
4912
- var camelKey = $.camelCase(key);
4913
-
4914
- var data = {};
4915
- data[camelKey] = value;
4916
-
4917
- var convertedData = Utils._convertData(data);
4918
-
4919
- $.extend(this.defaults, convertedData);
4920
- };
4921
-
4922
- var defaults = new Defaults();
4923
-
4924
- return defaults;
4925
- });
4926
-
4927
- S2.define('select2/options',[
4928
- 'require',
4929
- 'jquery',
4930
- './defaults',
4931
- './utils'
4932
- ], function (require, $, Defaults, Utils) {
4933
- function Options (options, $element) {
4934
- this.options = options;
4935
-
4936
- if ($element != null) {
4937
- this.fromElement($element);
4938
- }
4939
-
4940
- this.options = Defaults.apply(this.options);
4941
-
4942
- if ($element && $element.is('input')) {
4943
- var InputCompat = require(this.get('amdBase') + 'compat/inputData');
4944
-
4945
- this.options.dataAdapter = Utils.Decorate(
4946
- this.options.dataAdapter,
4947
- InputCompat
4948
- );
4949
- }
4950
- }
4951
-
4952
- Options.prototype.fromElement = function ($e) {
4953
- var excludedData = ['select2'];
4954
-
4955
- if (this.options.multiple == null) {
4956
- this.options.multiple = $e.prop('multiple');
4957
- }
4958
-
4959
- if (this.options.disabled == null) {
4960
- this.options.disabled = $e.prop('disabled');
4961
- }
4962
-
4963
- if (this.options.language == null) {
4964
- if ($e.prop('lang')) {
4965
- this.options.language = $e.prop('lang').toLowerCase();
4966
- } else if ($e.closest('[lang]').prop('lang')) {
4967
- this.options.language = $e.closest('[lang]').prop('lang');
4968
- }
4969
- }
4970
-
4971
- if (this.options.dir == null) {
4972
- if ($e.prop('dir')) {
4973
- this.options.dir = $e.prop('dir');
4974
- } else if ($e.closest('[dir]').prop('dir')) {
4975
- this.options.dir = $e.closest('[dir]').prop('dir');
4976
- } else {
4977
- this.options.dir = 'ltr';
4978
- }
4979
- }
4980
-
4981
- $e.prop('disabled', this.options.disabled);
4982
- $e.prop('multiple', this.options.multiple);
4983
-
4984
- if ($e.data('select2Tags')) {
4985
- if (this.options.debug && window.console && console.warn) {
4986
- console.warn(
4987
- 'Select2: The `data-select2-tags` attribute has been changed to ' +
4988
- 'use the `data-data` and `data-tags="true"` attributes and will be ' +
4989
- 'removed in future versions of Select2.'
4990
- );
4991
- }
4992
-
4993
- $e.data('data', $e.data('select2Tags'));
4994
- $e.data('tags', true);
4995
- }
4996
-
4997
- if ($e.data('ajaxUrl')) {
4998
- if (this.options.debug && window.console && console.warn) {
4999
- console.warn(
5000
- 'Select2: The `data-ajax-url` attribute has been changed to ' +
5001
- '`data-ajax--url` and support for the old attribute will be removed' +
5002
- ' in future versions of Select2.'
5003
- );
5004
- }
5005
-
5006
- $e.attr('ajax--url', $e.data('ajaxUrl'));
5007
- $e.data('ajax--url', $e.data('ajaxUrl'));
5008
- }
5009
-
5010
- var dataset = {};
5011
-
5012
- // Prefer the element's `dataset` attribute if it exists
5013
- // jQuery 1.x does not correctly handle data attributes with multiple dashes
5014
- if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5015
- dataset = $.extend(true, {}, $e[0].dataset, $e.data());
5016
- } else {
5017
- dataset = $e.data();
5018
- }
5019
-
5020
- var data = $.extend(true, {}, dataset);
5021
-
5022
- data = Utils._convertData(data);
5023
-
5024
- for (var key in data) {
5025
- if ($.inArray(key, excludedData) > -1) {
5026
- continue;
5027
- }
5028
-
5029
- if ($.isPlainObject(this.options[key])) {
5030
- $.extend(this.options[key], data[key]);
5031
- } else {
5032
- this.options[key] = data[key];
5033
- }
5034
- }
5035
-
5036
- return this;
5037
- };
5038
-
5039
- Options.prototype.get = function (key) {
5040
- return this.options[key];
5041
- };
5042
-
5043
- Options.prototype.set = function (key, val) {
5044
- this.options[key] = val;
5045
- };
5046
-
5047
- return Options;
5048
- });
5049
-
5050
- S2.define('select2/core',[
5051
- 'jquery',
5052
- './options',
5053
- './utils',
5054
- './keys'
5055
- ], function ($, Options, Utils, KEYS) {
5056
- var Select2 = function ($element, options) {
5057
- if ($element.data('select2') != null) {
5058
- $element.data('select2').destroy();
5059
- }
5060
-
5061
- this.$element = $element;
5062
-
5063
- this.id = this._generateId($element);
5064
-
5065
- options = options || {};
5066
-
5067
- this.options = new Options(options, $element);
5068
-
5069
- Select2.__super__.constructor.call(this);
5070
-
5071
- // Set up the tabindex
5072
-
5073
- var tabindex = $element.attr('tabindex') || 0;
5074
- $element.data('old-tabindex', tabindex);
5075
- $element.attr('tabindex', '-1');
5076
-
5077
- // Set up containers and adapters
5078
-
5079
- var DataAdapter = this.options.get('dataAdapter');
5080
- this.dataAdapter = new DataAdapter($element, this.options);
5081
-
5082
- var $container = this.render();
5083
-
5084
- this._placeContainer($container);
5085
-
5086
- var SelectionAdapter = this.options.get('selectionAdapter');
5087
- this.selection = new SelectionAdapter($element, this.options);
5088
- this.$selection = this.selection.render();
5089
-
5090
- this.selection.position(this.$selection, $container);
5091
-
5092
- var DropdownAdapter = this.options.get('dropdownAdapter');
5093
- this.dropdown = new DropdownAdapter($element, this.options);
5094
- this.$dropdown = this.dropdown.render();
5095
-
5096
- this.dropdown.position(this.$dropdown, $container);
5097
-
5098
- var ResultsAdapter = this.options.get('resultsAdapter');
5099
- this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5100
- this.$results = this.results.render();
5101
-
5102
- this.results.position(this.$results, this.$dropdown);
5103
-
5104
- // Bind events
5105
-
5106
- var self = this;
5107
-
5108
- // Bind the container to all of the adapters
5109
- this._bindAdapters();
5110
-
5111
- // Register any DOM event handlers
5112
- this._registerDomEvents();
5113
-
5114
- // Register any internal event handlers
5115
- this._registerDataEvents();
5116
- this._registerSelectionEvents();
5117
- this._registerDropdownEvents();
5118
- this._registerResultsEvents();
5119
- this._registerEvents();
5120
-
5121
- // Set the initial state
5122
- this.dataAdapter.current(function (initialData) {
5123
- self.trigger('selection:update', {
5124
- data: initialData
5125
- });
5126
- });
5127
-
5128
- // Hide the original select
5129
- $element.addClass('select2-hidden-accessible');
5130
- $element.attr('aria-hidden', 'true');
5131
-
5132
- // Synchronize any monitored attributes
5133
- this._syncAttributes();
5134
-
5135
- $element.data('select2', this);
5136
- };
5137
-
5138
- Utils.Extend(Select2, Utils.Observable);
5139
-
5140
- Select2.prototype._generateId = function ($element) {
5141
- var id = '';
5142
-
5143
- if ($element.attr('id') != null) {
5144
- id = $element.attr('id');
5145
- } else if ($element.attr('name') != null) {
5146
- id = $element.attr('name') + '-' + Utils.generateChars(2);
5147
- } else {
5148
- id = Utils.generateChars(4);
5149
- }
5150
-
5151
- id = id.replace(/(:|\.|\[|\]|,)/g, '');
5152
- id = 'select2-' + id;
5153
-
5154
- return id;
5155
- };
5156
-
5157
- Select2.prototype._placeContainer = function ($container) {
5158
- $container.insertAfter(this.$element);
5159
-
5160
- var width = this._resolveWidth(this.$element, this.options.get('width'));
5161
-
5162
- if (width != null) {
5163
- $container.css('width', width);
5164
- }
5165
- };
5166
-
5167
- Select2.prototype._resolveWidth = function ($element, method) {
5168
- var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5169
-
5170
- if (method == 'resolve') {
5171
- var styleWidth = this._resolveWidth($element, 'style');
5172
-
5173
- if (styleWidth != null) {
5174
- return styleWidth;
5175
- }
5176
-
5177
- return this._resolveWidth($element, 'element');
5178
- }
5179
-
5180
- if (method == 'element') {
5181
- var elementWidth = $element.outerWidth(false);
5182
-
5183
- if (elementWidth <= 0) {
5184
- return 'auto';
5185
- }
5186
-
5187
- return elementWidth + 'px';
5188
- }
5189
-
5190
- if (method == 'style') {
5191
- var style = $element.attr('style');
5192
-
5193
- if (typeof(style) !== 'string') {
5194
- return null;
5195
- }
5196
-
5197
- var attrs = style.split(';');
5198
-
5199
- for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5200
- var attr = attrs[i].replace(/\s/g, '');
5201
- var matches = attr.match(WIDTH);
5202
-
5203
- if (matches !== null && matches.length >= 1) {
5204
- return matches[1];
5205
- }
5206
- }
5207
-
5208
- return null;
5209
- }
5210
-
5211
- return method;
5212
- };
5213
-
5214
- Select2.prototype._bindAdapters = function () {
5215
- this.dataAdapter.bind(this, this.$container);
5216
- this.selection.bind(this, this.$container);
5217
-
5218
- this.dropdown.bind(this, this.$container);
5219
- this.results.bind(this, this.$container);
5220
- };
5221
-
5222
- Select2.prototype._registerDomEvents = function () {
5223
- var self = this;
5224
-
5225
- this.$element.on('change.select2', function () {
5226
- self.dataAdapter.current(function (data) {
5227
- self.trigger('selection:update', {
5228
- data: data
5229
- });
5230
- });
5231
- });
5232
-
5233
- this.$element.on('focus.select2', function (evt) {
5234
- self.trigger('focus', evt);
5235
- });
5236
-
5237
- this._syncA = Utils.bind(this._syncAttributes, this);
5238
- this._syncS = Utils.bind(this._syncSubtree, this);
5239
-
5240
- if (this.$element[0].attachEvent) {
5241
- this.$element[0].attachEvent('onpropertychange', this._syncA);
5242
- }
5243
-
5244
- var observer = window.MutationObserver ||
5245
- window.WebKitMutationObserver ||
5246
- window.MozMutationObserver
5247
- ;
5248
-
5249
- if (observer != null) {
5250
- this._observer = new observer(function (mutations) {
5251
- $.each(mutations, self._syncA);
5252
- $.each(mutations, self._syncS);
5253
- });
5254
- this._observer.observe(this.$element[0], {
5255
- attributes: true,
5256
- childList: true,
5257
- subtree: false
5258
- });
5259
- } else if (this.$element[0].addEventListener) {
5260
- this.$element[0].addEventListener(
5261
- 'DOMAttrModified',
5262
- self._syncA,
5263
- false
5264
- );
5265
- this.$element[0].addEventListener(
5266
- 'DOMNodeInserted',
5267
- self._syncS,
5268
- false
5269
- );
5270
- this.$element[0].addEventListener(
5271
- 'DOMNodeRemoved',
5272
- self._syncS,
5273
- false
5274
- );
5275
- }
5276
- };
5277
-
5278
- Select2.prototype._registerDataEvents = function () {
5279
- var self = this;
5280
-
5281
- this.dataAdapter.on('*', function (name, params) {
5282
- self.trigger(name, params);
5283
- });
5284
- };
5285
-
5286
- Select2.prototype._registerSelectionEvents = function () {
5287
- var self = this;
5288
- var nonRelayEvents = ['toggle', 'focus'];
5289
-
5290
- this.selection.on('toggle', function () {
5291
- self.toggleDropdown();
5292
- });
5293
-
5294
- this.selection.on('focus', function (params) {
5295
- self.focus(params);
5296
- });
5297
-
5298
- this.selection.on('*', function (name, params) {
5299
- if ($.inArray(name, nonRelayEvents) !== -1) {
5300
- return;
5301
- }
5302
-
5303
- self.trigger(name, params);
5304
- });
5305
- };
5306
-
5307
- Select2.prototype._registerDropdownEvents = function () {
5308
- var self = this;
5309
-
5310
- this.dropdown.on('*', function (name, params) {
5311
- self.trigger(name, params);
5312
- });
5313
- };
5314
-
5315
- Select2.prototype._registerResultsEvents = function () {
5316
- var self = this;
5317
-
5318
- this.results.on('*', function (name, params) {
5319
- self.trigger(name, params);
5320
- });
5321
- };
5322
-
5323
- Select2.prototype._registerEvents = function () {
5324
- var self = this;
5325
-
5326
- this.on('open', function () {
5327
- self.$container.addClass('select2-container--open');
5328
- });
5329
-
5330
- this.on('close', function () {
5331
- self.$container.removeClass('select2-container--open');
5332
- });
5333
-
5334
- this.on('enable', function () {
5335
- self.$container.removeClass('select2-container--disabled');
5336
- });
5337
-
5338
- this.on('disable', function () {
5339
- self.$container.addClass('select2-container--disabled');
5340
- });
5341
-
5342
- this.on('blur', function () {
5343
- self.$container.removeClass('select2-container--focus');
5344
- });
5345
-
5346
- this.on('query', function (params) {
5347
- if (!self.isOpen()) {
5348
- self.trigger('open', {});
5349
- }
5350
-
5351
- this.dataAdapter.query(params, function (data) {
5352
- self.trigger('results:all', {
5353
- data: data,
5354
- query: params
5355
- });
5356
- });
5357
- });
5358
-
5359
- this.on('query:append', function (params) {
5360
- this.dataAdapter.query(params, function (data) {
5361
- self.trigger('results:append', {
5362
- data: data,
5363
- query: params
5364
- });
5365
- });
5366
- });
5367
-
5368
- this.on('keypress', function (evt) {
5369
- var key = evt.which;
5370
-
5371
- if (self.isOpen()) {
5372
- if (key === KEYS.ESC || key === KEYS.TAB ||
5373
- (key === KEYS.UP && evt.altKey)) {
5374
- self.close();
5375
-
5376
- evt.preventDefault();
5377
- } else if (key === KEYS.ENTER) {
5378
- self.trigger('results:select', {});
5379
-
5380
- evt.preventDefault();
5381
- } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5382
- self.trigger('results:toggle', {});
5383
-
5384
- evt.preventDefault();
5385
- } else if (key === KEYS.UP) {
5386
- self.trigger('results:previous', {});
5387
-
5388
- evt.preventDefault();
5389
- } else if (key === KEYS.DOWN) {
5390
- self.trigger('results:next', {});
5391
-
5392
- evt.preventDefault();
5393
- }
5394
- } else {
5395
- if (key === KEYS.ENTER || key === KEYS.SPACE ||
5396
- (key === KEYS.DOWN && evt.altKey)) {
5397
- self.open();
5398
-
5399
- evt.preventDefault();
5400
- }
5401
- }
5402
- });
5403
- };
5404
-
5405
- Select2.prototype._syncAttributes = function () {
5406
- this.options.set('disabled', this.$element.prop('disabled'));
5407
-
5408
- if (this.options.get('disabled')) {
5409
- if (this.isOpen()) {
5410
- this.close();
5411
- }
5412
-
5413
- this.trigger('disable', {});
5414
- } else {
5415
- this.trigger('enable', {});
5416
- }
5417
- };
5418
-
5419
- Select2.prototype._syncSubtree = function (evt, mutations) {
5420
- var changed = false;
5421
- var self = this;
5422
-
5423
- // Ignore any mutation events raised for elements that aren't options or
5424
- // optgroups. This handles the case when the select element is destroyed
5425
- if (
5426
- evt && evt.target && (
5427
- evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
5428
- )
5429
- ) {
5430
- return;
5431
- }
5432
-
5433
- if (!mutations) {
5434
- // If mutation events aren't supported, then we can only assume that the
5435
- // change affected the selections
5436
- changed = true;
5437
- } else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5438
- for (var n = 0; n < mutations.addedNodes.length; n++) {
5439
- var node = mutations.addedNodes[n];
5440
-
5441
- if (node.selected) {
5442
- changed = true;
5443
- }
5444
- }
5445
- } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5446
- changed = true;
5447
- }
5448
-
5449
- // Only re-pull the data if we think there is a change
5450
- if (changed) {
5451
- this.dataAdapter.current(function (currentData) {
5452
- self.trigger('selection:update', {
5453
- data: currentData
5454
- });
5455
- });
5456
- }
5457
- };
5458
-
5459
- /**
5460
- * Override the trigger method to automatically trigger pre-events when
5461
- * there are events that can be prevented.
5462
- */
5463
- Select2.prototype.trigger = function (name, args) {
5464
- var actualTrigger = Select2.__super__.trigger;
5465
- var preTriggerMap = {
5466
- 'open': 'opening',
5467
- 'close': 'closing',
5468
- 'select': 'selecting',
5469
- 'unselect': 'unselecting'
5470
- };
5471
-
5472
- if (args === undefined) {
5473
- args = {};
5474
- }
5475
-
5476
- if (name in preTriggerMap) {
5477
- var preTriggerName = preTriggerMap[name];
5478
- var preTriggerArgs = {
5479
- prevented: false,
5480
- name: name,
5481
- args: args
5482
- };
5483
-
5484
- actualTrigger.call(this, preTriggerName, preTriggerArgs);
5485
-
5486
- if (preTriggerArgs.prevented) {
5487
- args.prevented = true;
5488
-
5489
- return;
5490
- }
5491
- }
5492
-
5493
- actualTrigger.call(this, name, args);
5494
- };
5495
-
5496
- Select2.prototype.toggleDropdown = function () {
5497
- if (this.options.get('disabled')) {
5498
- return;
5499
- }
5500
-
5501
- if (this.isOpen()) {
5502
- this.close();
5503
- } else {
5504
- this.open();
5505
- }
5506
- };
5507
-
5508
- Select2.prototype.open = function () {
5509
- if (this.isOpen()) {
5510
- return;
5511
- }
5512
-
5513
- this.trigger('query', {});
5514
- };
5515
-
5516
- Select2.prototype.close = function () {
5517
- if (!this.isOpen()) {
5518
- return;
5519
- }
5520
-
5521
- this.trigger('close', {});
5522
- };
5523
-
5524
- Select2.prototype.isOpen = function () {
5525
- return this.$container.hasClass('select2-container--open');
5526
- };
5527
-
5528
- Select2.prototype.hasFocus = function () {
5529
- return this.$container.hasClass('select2-container--focus');
5530
- };
5531
-
5532
- Select2.prototype.focus = function (data) {
5533
- // No need to re-trigger focus events if we are already focused
5534
- if (this.hasFocus()) {
5535
- return;
5536
- }
5537
-
5538
- this.$container.addClass('select2-container--focus');
5539
- this.trigger('focus', {});
5540
- };
5541
-
5542
- Select2.prototype.enable = function (args) {
5543
- if (this.options.get('debug') && window.console && console.warn) {
5544
- console.warn(
5545
- 'Select2: The `select2("enable")` method has been deprecated and will' +
5546
- ' be removed in later Select2 versions. Use $element.prop("disabled")' +
5547
- ' instead.'
5548
- );
5549
- }
5550
-
5551
- if (args == null || args.length === 0) {
5552
- args = [true];
5553
- }
5554
-
5555
- var disabled = !args[0];
5556
-
5557
- this.$element.prop('disabled', disabled);
5558
- };
5559
-
5560
- Select2.prototype.data = function () {
5561
- if (this.options.get('debug') &&
5562
- arguments.length > 0 && window.console && console.warn) {
5563
- console.warn(
5564
- 'Select2: Data can no longer be set using `select2("data")`. You ' +
5565
- 'should consider setting the value instead using `$element.val()`.'
5566
- );
5567
- }
5568
-
5569
- var data = [];
5570
-
5571
- this.dataAdapter.current(function (currentData) {
5572
- data = currentData;
5573
- });
5574
-
5575
- return data;
5576
- };
5577
-
5578
- Select2.prototype.val = function (args) {
5579
- if (this.options.get('debug') && window.console && console.warn) {
5580
- console.warn(
5581
- 'Select2: The `select2("val")` method has been deprecated and will be' +
5582
- ' removed in later Select2 versions. Use $element.val() instead.'
5583
- );
5584
- }
5585
-
5586
- if (args == null || args.length === 0) {
5587
- return this.$element.val();
5588
- }
5589
-
5590
- var newVal = args[0];
5591
-
5592
- if ($.isArray(newVal)) {
5593
- newVal = $.map(newVal, function (obj) {
5594
- return obj.toString();
5595
- });
5596
- }
5597
-
5598
- this.$element.val(newVal).trigger('change');
5599
- };
5600
-
5601
- Select2.prototype.destroy = function () {
5602
- this.$container.remove();
5603
-
5604
- if (this.$element[0].detachEvent) {
5605
- this.$element[0].detachEvent('onpropertychange', this._syncA);
5606
- }
5607
-
5608
- if (this._observer != null) {
5609
- this._observer.disconnect();
5610
- this._observer = null;
5611
- } else if (this.$element[0].removeEventListener) {
5612
- this.$element[0]
5613
- .removeEventListener('DOMAttrModified', this._syncA, false);
5614
- this.$element[0]
5615
- .removeEventListener('DOMNodeInserted', this._syncS, false);
5616
- this.$element[0]
5617
- .removeEventListener('DOMNodeRemoved', this._syncS, false);
5618
- }
5619
-
5620
- this._syncA = null;
5621
- this._syncS = null;
5622
-
5623
- this.$element.off('.select2');
5624
- this.$element.attr('tabindex', this.$element.data('old-tabindex'));
5625
-
5626
- this.$element.removeClass('select2-hidden-accessible');
5627
- this.$element.attr('aria-hidden', 'false');
5628
- this.$element.removeData('select2');
5629
-
5630
- this.dataAdapter.destroy();
5631
- this.selection.destroy();
5632
- this.dropdown.destroy();
5633
- this.results.destroy();
5634
-
5635
- this.dataAdapter = null;
5636
- this.selection = null;
5637
- this.dropdown = null;
5638
- this.results = null;
5639
- };
5640
-
5641
- Select2.prototype.render = function () {
5642
- var $container = $(
5643
- '<span class="select2 select2-container">' +
5644
- '<span class="selection"></span>' +
5645
- '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
5646
- '</span>'
5647
- );
5648
-
5649
- $container.attr('dir', this.options.get('dir'));
5650
-
5651
- this.$container = $container;
5652
-
5653
- this.$container.addClass('select2-container--' + this.options.get('theme'));
5654
-
5655
- $container.data('element', this.$element);
5656
-
5657
- return $container;
5658
- };
5659
-
5660
- return Select2;
5661
- });
5662
-
5663
- S2.define('jquery-mousewheel',[
5664
- 'jquery'
5665
- ], function ($) {
5666
- // Used to shim jQuery.mousewheel for non-full builds.
5667
- return $;
5668
- });
5669
-
5670
- S2.define('jquery.select2',[
5671
- 'jquery',
5672
- 'jquery-mousewheel',
5673
-
5674
- './select2/core',
5675
- './select2/defaults'
5676
- ], function ($, _, Select2, Defaults) {
5677
- if ($.fn.select2 == null) {
5678
- // All methods that should return the element
5679
- var thisMethods = ['open', 'close', 'destroy'];
5680
-
5681
- $.fn.select2 = function (options) {
5682
- options = options || {};
5683
-
5684
- if (typeof options === 'object') {
5685
- this.each(function () {
5686
- var instanceOptions = $.extend(true, {}, options);
5687
-
5688
- var instance = new Select2($(this), instanceOptions);
5689
- });
5690
-
5691
- return this;
5692
- } else if (typeof options === 'string') {
5693
- var ret;
5694
- var args = Array.prototype.slice.call(arguments, 1);
5695
-
5696
- this.each(function () {
5697
- var instance = $(this).data('select2');
5698
-
5699
- if (instance == null && window.console && console.error) {
5700
- console.error(
5701
- 'The select2(\'' + options + '\') method was called on an ' +
5702
- 'element that is not using Select2.'
5703
- );
5704
- }
5705
-
5706
- ret = instance[options].apply(instance, args);
5707
- });
5708
-
5709
- // Check if we should be returning `this`
5710
- if ($.inArray(options, thisMethods) > -1) {
5711
- return this;
5712
- }
5713
-
5714
- return ret;
5715
- } else {
5716
- throw new Error('Invalid arguments for Select2: ' + options);
5717
- }
5718
- };
5719
- }
5720
-
5721
- if ($.fn.select2.defaults == null) {
5722
- $.fn.select2.defaults = Defaults;
5723
- }
5724
-
5725
- return Select2;
5726
- });
5727
-
5728
- // Return the AMD loader configuration so it can be used outside of this file
5729
- return {
5730
- define: S2.define,
5731
- require: S2.require
5732
- };
5733
- }());
5734
-
5735
- // Autoload the jQuery bindings
5736
- // We know that all of the modules exist above this, so we're safe
5737
- var select2 = S2.require('jquery.select2');
5738
-
5739
- // Hold the AMD module references on the jQuery function that was just loaded
5740
- // This allows Select2 to use the internal loader outside of this file, such
5741
- // as in the language files.
5742
- jQuery.fn.select2.amd = S2;
5743
-
5744
- // Return the Select2 instance for anyone who is importing it.
5745
- return select2;
5746
- }));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*!
2
+ * Select2 4.1.0-rc.0
3
+ * https://select2.github.io
4
+ *
5
+ * Released under the MIT license
6
+ * https://github.com/select2/select2/blob/master/LICENSE.md
7
+ */
8
+ ;(function (factory) {
9
+ if (typeof define === 'function' && define.amd) {
10
+ // AMD. Register as an anonymous module.
11
+ define(['jquery'], factory);
12
+ } else if (typeof module === 'object' && module.exports) {
13
+ // Node/CommonJS
14
+ module.exports = function (root, jQuery) {
15
+ if (jQuery === undefined) {
16
+ // require('jQuery') returns a factory that requires window to
17
+ // build a jQuery instance, we normalize how we use modules
18
+ // that require this pattern but the window provided is a noop
19
+ // if it's defined (how jquery works)
20
+ if (typeof window !== 'undefined') {
21
+ jQuery = require('jquery');
22
+ }
23
+ else {
24
+ jQuery = require('jquery')(root);
25
+ }
26
+ }
27
+ factory(jQuery);
28
+ return jQuery;
29
+ };
30
+ } else {
31
+ // Browser globals
32
+ factory(jQuery);
33
+ }
34
+ } (function (jQuery) {
35
+ // This is needed so we can catch the AMD loader configuration and use it
36
+ // The inner file should be wrapped (by `banner.start.js`) in a function that
37
+ // returns the AMD loader references.
38
+ var S2 =(function () {
39
+ // Restore the Select2 AMD loader so it can be used
40
+ // Needed mostly in the language files, where the loader is not inserted
41
+ if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
42
+ var S2 = jQuery.fn.select2.amd;
43
+ }
44
+ var S2;(function () { if (!S2 || !S2.requirejs) {
45
+ if (!S2) { S2 = {}; } else { require = S2; }
46
+ /**
47
+ * @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
48
+ * Released under MIT license, http://github.com/requirejs/almond/LICENSE
49
+ */
50
+ //Going sloppy to avoid 'use strict' string cost, but strict practices should
51
+ //be followed.
52
+ /*global setTimeout: false */
53
+
54
+ var requirejs, require, define;
55
+ (function (undef) {
56
+ var main, req, makeMap, handlers,
57
+ defined = {},
58
+ waiting = {},
59
+ config = {},
60
+ defining = {},
61
+ hasOwn = Object.prototype.hasOwnProperty,
62
+ aps = [].slice,
63
+ jsSuffixRegExp = /\.js$/;
64
+
65
+ function hasProp(obj, prop) {
66
+ return hasOwn.call(obj, prop);
67
+ }
68
+
69
+ /**
70
+ * Given a relative module name, like ./something, normalize it to
71
+ * a real name that can be mapped to a path.
72
+ * @param {String} name the relative name
73
+ * @param {String} baseName a real name that the name arg is relative
74
+ * to.
75
+ * @returns {String} normalized name
76
+ */
77
+ function normalize(name, baseName) {
78
+ var nameParts, nameSegment, mapValue, foundMap, lastIndex,
79
+ foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
80
+ baseParts = baseName && baseName.split("/"),
81
+ map = config.map,
82
+ starMap = (map && map['*']) || {};
83
+
84
+ //Adjust any relative paths.
85
+ if (name) {
86
+ name = name.split('/');
87
+ lastIndex = name.length - 1;
88
+
89
+ // If wanting node ID compatibility, strip .js from end
90
+ // of IDs. Have to do this here, and not in nameToUrl
91
+ // because node allows either .js or non .js to map
92
+ // to same file.
93
+ if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
94
+ name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
95
+ }
96
+
97
+ // Starts with a '.' so need the baseName
98
+ if (name[0].charAt(0) === '.' && baseParts) {
99
+ //Convert baseName to array, and lop off the last part,
100
+ //so that . matches that 'directory' and not name of the baseName's
101
+ //module. For instance, baseName of 'one/two/three', maps to
102
+ //'one/two/three.js', but we want the directory, 'one/two' for
103
+ //this normalization.
104
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
105
+ name = normalizedBaseParts.concat(name);
106
+ }
107
+
108
+ //start trimDots
109
+ for (i = 0; i < name.length; i++) {
110
+ part = name[i];
111
+ if (part === '.') {
112
+ name.splice(i, 1);
113
+ i -= 1;
114
+ } else if (part === '..') {
115
+ // If at the start, or previous value is still ..,
116
+ // keep them so that when converted to a path it may
117
+ // still work when converted to a path, even though
118
+ // as an ID it is less than ideal. In larger point
119
+ // releases, may be better to just kick out an error.
120
+ if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
121
+ continue;
122
+ } else if (i > 0) {
123
+ name.splice(i - 1, 2);
124
+ i -= 2;
125
+ }
126
+ }
127
+ }
128
+ //end trimDots
129
+
130
+ name = name.join('/');
131
+ }
132
+
133
+ //Apply map config if available.
134
+ if ((baseParts || starMap) && map) {
135
+ nameParts = name.split('/');
136
+
137
+ for (i = nameParts.length; i > 0; i -= 1) {
138
+ nameSegment = nameParts.slice(0, i).join("/");
139
+
140
+ if (baseParts) {
141
+ //Find the longest baseName segment match in the config.
142
+ //So, do joins on the biggest to smallest lengths of baseParts.
143
+ for (j = baseParts.length; j > 0; j -= 1) {
144
+ mapValue = map[baseParts.slice(0, j).join('/')];
145
+
146
+ //baseName segment has config, find if it has one for
147
+ //this name.
148
+ if (mapValue) {
149
+ mapValue = mapValue[nameSegment];
150
+ if (mapValue) {
151
+ //Match, update name to the new value.
152
+ foundMap = mapValue;
153
+ foundI = i;
154
+ break;
155
+ }
156
+ }
157
+ }
158
+ }
159
+
160
+ if (foundMap) {
161
+ break;
162
+ }
163
+
164
+ //Check for a star map match, but just hold on to it,
165
+ //if there is a shorter segment match later in a matching
166
+ //config, then favor over this star map.
167
+ if (!foundStarMap && starMap && starMap[nameSegment]) {
168
+ foundStarMap = starMap[nameSegment];
169
+ starI = i;
170
+ }
171
+ }
172
+
173
+ if (!foundMap && foundStarMap) {
174
+ foundMap = foundStarMap;
175
+ foundI = starI;
176
+ }
177
+
178
+ if (foundMap) {
179
+ nameParts.splice(0, foundI, foundMap);
180
+ name = nameParts.join('/');
181
+ }
182
+ }
183
+
184
+ return name;
185
+ }
186
+
187
+ function makeRequire(relName, forceSync) {
188
+ return function () {
189
+ //A version of a require function that passes a moduleName
190
+ //value for items that may need to
191
+ //look up paths relative to the moduleName
192
+ var args = aps.call(arguments, 0);
193
+
194
+ //If first arg is not require('string'), and there is only
195
+ //one arg, it is the array form without a callback. Insert
196
+ //a null so that the following concat is correct.
197
+ if (typeof args[0] !== 'string' && args.length === 1) {
198
+ args.push(null);
199
+ }
200
+ return req.apply(undef, args.concat([relName, forceSync]));
201
+ };
202
+ }
203
+
204
+ function makeNormalize(relName) {
205
+ return function (name) {
206
+ return normalize(name, relName);
207
+ };
208
+ }
209
+
210
+ function makeLoad(depName) {
211
+ return function (value) {
212
+ defined[depName] = value;
213
+ };
214
+ }
215
+
216
+ function callDep(name) {
217
+ if (hasProp(waiting, name)) {
218
+ var args = waiting[name];
219
+ delete waiting[name];
220
+ defining[name] = true;
221
+ main.apply(undef, args);
222
+ }
223
+
224
+ if (!hasProp(defined, name) && !hasProp(defining, name)) {
225
+ throw new Error('No ' + name);
226
+ }
227
+ return defined[name];
228
+ }
229
+
230
+ //Turns a plugin!resource to [plugin, resource]
231
+ //with the plugin being undefined if the name
232
+ //did not have a plugin prefix.
233
+ function splitPrefix(name) {
234
+ var prefix,
235
+ index = name ? name.indexOf('!') : -1;
236
+ if (index > -1) {
237
+ prefix = name.substring(0, index);
238
+ name = name.substring(index + 1, name.length);
239
+ }
240
+ return [prefix, name];
241
+ }
242
+
243
+ //Creates a parts array for a relName where first part is plugin ID,
244
+ //second part is resource ID. Assumes relName has already been normalized.
245
+ function makeRelParts(relName) {
246
+ return relName ? splitPrefix(relName) : [];
247
+ }
248
+
249
+ /**
250
+ * Makes a name map, normalizing the name, and using a plugin
251
+ * for normalization if necessary. Grabs a ref to plugin
252
+ * too, as an optimization.
253
+ */
254
+ makeMap = function (name, relParts) {
255
+ var plugin,
256
+ parts = splitPrefix(name),
257
+ prefix = parts[0],
258
+ relResourceName = relParts[1];
259
+
260
+ name = parts[1];
261
+
262
+ if (prefix) {
263
+ prefix = normalize(prefix, relResourceName);
264
+ plugin = callDep(prefix);
265
+ }
266
+
267
+ //Normalize according
268
+ if (prefix) {
269
+ if (plugin && plugin.normalize) {
270
+ name = plugin.normalize(name, makeNormalize(relResourceName));
271
+ } else {
272
+ name = normalize(name, relResourceName);
273
+ }
274
+ } else {
275
+ name = normalize(name, relResourceName);
276
+ parts = splitPrefix(name);
277
+ prefix = parts[0];
278
+ name = parts[1];
279
+ if (prefix) {
280
+ plugin = callDep(prefix);
281
+ }
282
+ }
283
+
284
+ //Using ridiculous property names for space reasons
285
+ return {
286
+ f: prefix ? prefix + '!' + name : name, //fullName
287
+ n: name,
288
+ pr: prefix,
289
+ p: plugin
290
+ };
291
+ };
292
+
293
+ function makeConfig(name) {
294
+ return function () {
295
+ return (config && config.config && config.config[name]) || {};
296
+ };
297
+ }
298
+
299
+ handlers = {
300
+ require: function (name) {
301
+ return makeRequire(name);
302
+ },
303
+ exports: function (name) {
304
+ var e = defined[name];
305
+ if (typeof e !== 'undefined') {
306
+ return e;
307
+ } else {
308
+ return (defined[name] = {});
309
+ }
310
+ },
311
+ module: function (name) {
312
+ return {
313
+ id: name,
314
+ uri: '',
315
+ exports: defined[name],
316
+ config: makeConfig(name)
317
+ };
318
+ }
319
+ };
320
+
321
+ main = function (name, deps, callback, relName) {
322
+ var cjsModule, depName, ret, map, i, relParts,
323
+ args = [],
324
+ callbackType = typeof callback,
325
+ usingExports;
326
+
327
+ //Use name if no relName
328
+ relName = relName || name;
329
+ relParts = makeRelParts(relName);
330
+
331
+ //Call the callback to define the module, if necessary.
332
+ if (callbackType === 'undefined' || callbackType === 'function') {
333
+ //Pull out the defined dependencies and pass the ordered
334
+ //values to the callback.
335
+ //Default to [require, exports, module] if no deps
336
+ deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
337
+ for (i = 0; i < deps.length; i += 1) {
338
+ map = makeMap(deps[i], relParts);
339
+ depName = map.f;
340
+
341
+ //Fast path CommonJS standard dependencies.
342
+ if (depName === "require") {
343
+ args[i] = handlers.require(name);
344
+ } else if (depName === "exports") {
345
+ //CommonJS module spec 1.1
346
+ args[i] = handlers.exports(name);
347
+ usingExports = true;
348
+ } else if (depName === "module") {
349
+ //CommonJS module spec 1.1
350
+ cjsModule = args[i] = handlers.module(name);
351
+ } else if (hasProp(defined, depName) ||
352
+ hasProp(waiting, depName) ||
353
+ hasProp(defining, depName)) {
354
+ args[i] = callDep(depName);
355
+ } else if (map.p) {
356
+ map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
357
+ args[i] = defined[depName];
358
+ } else {
359
+ throw new Error(name + ' missing ' + depName);
360
+ }
361
+ }
362
+
363
+ ret = callback ? callback.apply(defined[name], args) : undefined;
364
+
365
+ if (name) {
366
+ //If setting exports via "module" is in play,
367
+ //favor that over return value and exports. After that,
368
+ //favor a non-undefined return value over exports use.
369
+ if (cjsModule && cjsModule.exports !== undef &&
370
+ cjsModule.exports !== defined[name]) {
371
+ defined[name] = cjsModule.exports;
372
+ } else if (ret !== undef || !usingExports) {
373
+ //Use the return value from the function.
374
+ defined[name] = ret;
375
+ }
376
+ }
377
+ } else if (name) {
378
+ //May just be an object definition for the module. Only
379
+ //worry about defining if have a module name.
380
+ defined[name] = callback;
381
+ }
382
+ };
383
+
384
+ requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
385
+ if (typeof deps === "string") {
386
+ if (handlers[deps]) {
387
+ //callback in this case is really relName
388
+ return handlers[deps](callback);
389
+ }
390
+ //Just return the module wanted. In this scenario, the
391
+ //deps arg is the module name, and second arg (if passed)
392
+ //is just the relName.
393
+ //Normalize module name, if it contains . or ..
394
+ return callDep(makeMap(deps, makeRelParts(callback)).f);
395
+ } else if (!deps.splice) {
396
+ //deps is a config object, not an array.
397
+ config = deps;
398
+ if (config.deps) {
399
+ req(config.deps, config.callback);
400
+ }
401
+ if (!callback) {
402
+ return;
403
+ }
404
+
405
+ if (callback.splice) {
406
+ //callback is an array, which means it is a dependency list.
407
+ //Adjust args if there are dependencies
408
+ deps = callback;
409
+ callback = relName;
410
+ relName = null;
411
+ } else {
412
+ deps = undef;
413
+ }
414
+ }
415
+
416
+ //Support require(['a'])
417
+ callback = callback || function () {};
418
+
419
+ //If relName is a function, it is an errback handler,
420
+ //so remove it.
421
+ if (typeof relName === 'function') {
422
+ relName = forceSync;
423
+ forceSync = alt;
424
+ }
425
+
426
+ //Simulate async callback;
427
+ if (forceSync) {
428
+ main(undef, deps, callback, relName);
429
+ } else {
430
+ //Using a non-zero value because of concern for what old browsers
431
+ //do, and latest browsers "upgrade" to 4 if lower value is used:
432
+ //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
433
+ //If want a value immediately, use require('id') instead -- something
434
+ //that works in almond on the global level, but not guaranteed and
435
+ //unlikely to work in other AMD implementations.
436
+ setTimeout(function () {
437
+ main(undef, deps, callback, relName);
438
+ }, 4);
439
+ }
440
+
441
+ return req;
442
+ };
443
+
444
+ /**
445
+ * Just drops the config on the floor, but returns req in case
446
+ * the config return value is used.
447
+ */
448
+ req.config = function (cfg) {
449
+ return req(cfg);
450
+ };
451
+
452
+ /**
453
+ * Expose module registry for debugging and tooling
454
+ */
455
+ requirejs._defined = defined;
456
+
457
+ define = function (name, deps, callback) {
458
+ if (typeof name !== 'string') {
459
+ throw new Error('See almond README: incorrect module build, no module name');
460
+ }
461
+
462
+ //This module may not have dependencies
463
+ if (!deps.splice) {
464
+ //deps is not an array, so probably means
465
+ //an object literal or factory function for
466
+ //the value. Adjust args.
467
+ callback = deps;
468
+ deps = [];
469
+ }
470
+
471
+ if (!hasProp(defined, name) && !hasProp(waiting, name)) {
472
+ waiting[name] = [name, deps, callback];
473
+ }
474
+ };
475
+
476
+ define.amd = {
477
+ jQuery: true
478
+ };
479
+ }());
480
+
481
+ S2.requirejs = requirejs;S2.require = require;S2.define = define;
482
+ }
483
+ }());
484
+ S2.define("almond", function(){});
485
+
486
+ /* global jQuery:false, $:false */
487
+ S2.define('jquery',[],function () {
488
+ var _$ = jQuery || $;
489
+
490
+ if (_$ == null && console && console.error) {
491
+ console.error(
492
+ 'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
493
+ 'found. Make sure that you are including jQuery before Select2 on your ' +
494
+ 'web page.'
495
+ );
496
+ }
497
+
498
+ return _$;
499
+ });
500
+
501
+ S2.define('select2/utils',[
502
+ 'jquery'
503
+ ], function ($) {
504
+ var Utils = {};
505
+
506
+ Utils.Extend = function (ChildClass, SuperClass) {
507
+ var __hasProp = {}.hasOwnProperty;
508
+
509
+ function BaseConstructor () {
510
+ this.constructor = ChildClass;
511
+ }
512
+
513
+ for (var key in SuperClass) {
514
+ if (__hasProp.call(SuperClass, key)) {
515
+ ChildClass[key] = SuperClass[key];
516
+ }
517
+ }
518
+
519
+ BaseConstructor.prototype = SuperClass.prototype;
520
+ ChildClass.prototype = new BaseConstructor();
521
+ ChildClass.__super__ = SuperClass.prototype;
522
+
523
+ return ChildClass;
524
+ };
525
+
526
+ function getMethods (theClass) {
527
+ var proto = theClass.prototype;
528
+
529
+ var methods = [];
530
+
531
+ for (var methodName in proto) {
532
+ var m = proto[methodName];
533
+
534
+ if (typeof m !== 'function') {
535
+ continue;
536
+ }
537
+
538
+ if (methodName === 'constructor') {
539
+ continue;
540
+ }
541
+
542
+ methods.push(methodName);
543
+ }
544
+
545
+ return methods;
546
+ }
547
+
548
+ Utils.Decorate = function (SuperClass, DecoratorClass) {
549
+ var decoratedMethods = getMethods(DecoratorClass);
550
+ var superMethods = getMethods(SuperClass);
551
+
552
+ function DecoratedClass () {
553
+ var unshift = Array.prototype.unshift;
554
+
555
+ var argCount = DecoratorClass.prototype.constructor.length;
556
+
557
+ var calledConstructor = SuperClass.prototype.constructor;
558
+
559
+ if (argCount > 0) {
560
+ unshift.call(arguments, SuperClass.prototype.constructor);
561
+
562
+ calledConstructor = DecoratorClass.prototype.constructor;
563
+ }
564
+
565
+ calledConstructor.apply(this, arguments);
566
+ }
567
+
568
+ DecoratorClass.displayName = SuperClass.displayName;
569
+
570
+ function ctr () {
571
+ this.constructor = DecoratedClass;
572
+ }
573
+
574
+ DecoratedClass.prototype = new ctr();
575
+
576
+ for (var m = 0; m < superMethods.length; m++) {
577
+ var superMethod = superMethods[m];
578
+
579
+ DecoratedClass.prototype[superMethod] =
580
+ SuperClass.prototype[superMethod];
581
+ }
582
+
583
+ var calledMethod = function (methodName) {
584
+ // Stub out the original method if it's not decorating an actual method
585
+ var originalMethod = function () {};
586
+
587
+ if (methodName in DecoratedClass.prototype) {
588
+ originalMethod = DecoratedClass.prototype[methodName];
589
+ }
590
+
591
+ var decoratedMethod = DecoratorClass.prototype[methodName];
592
+
593
+ return function () {
594
+ var unshift = Array.prototype.unshift;
595
+
596
+ unshift.call(arguments, originalMethod);
597
+
598
+ return decoratedMethod.apply(this, arguments);
599
+ };
600
+ };
601
+
602
+ for (var d = 0; d < decoratedMethods.length; d++) {
603
+ var decoratedMethod = decoratedMethods[d];
604
+
605
+ DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
606
+ }
607
+
608
+ return DecoratedClass;
609
+ };
610
+
611
+ var Observable = function () {
612
+ this.listeners = {};
613
+ };
614
+
615
+ Observable.prototype.on = function (event, callback) {
616
+ this.listeners = this.listeners || {};
617
+
618
+ if (event in this.listeners) {
619
+ this.listeners[event].push(callback);
620
+ } else {
621
+ this.listeners[event] = [callback];
622
+ }
623
+ };
624
+
625
+ Observable.prototype.trigger = function (event) {
626
+ var slice = Array.prototype.slice;
627
+ var params = slice.call(arguments, 1);
628
+
629
+ this.listeners = this.listeners || {};
630
+
631
+ // Params should always come in as an array
632
+ if (params == null) {
633
+ params = [];
634
+ }
635
+
636
+ // If there are no arguments to the event, use a temporary object
637
+ if (params.length === 0) {
638
+ params.push({});
639
+ }
640
+
641
+ // Set the `_type` of the first object to the event
642
+ params[0]._type = event;
643
+
644
+ if (event in this.listeners) {
645
+ this.invoke(this.listeners[event], slice.call(arguments, 1));
646
+ }
647
+
648
+ if ('*' in this.listeners) {
649
+ this.invoke(this.listeners['*'], arguments);
650
+ }
651
+ };
652
+
653
+ Observable.prototype.invoke = function (listeners, params) {
654
+ for (var i = 0, len = listeners.length; i < len; i++) {
655
+ listeners[i].apply(this, params);
656
+ }
657
+ };
658
+
659
+ Utils.Observable = Observable;
660
+
661
+ Utils.generateChars = function (length) {
662
+ var chars = '';
663
+
664
+ for (var i = 0; i < length; i++) {
665
+ var randomChar = Math.floor(Math.random() * 36);
666
+ chars += randomChar.toString(36);
667
+ }
668
+
669
+ return chars;
670
+ };
671
+
672
+ Utils.bind = function (func, context) {
673
+ return function () {
674
+ func.apply(context, arguments);
675
+ };
676
+ };
677
+
678
+ Utils._convertData = function (data) {
679
+ for (var originalKey in data) {
680
+ var keys = originalKey.split('-');
681
+
682
+ var dataLevel = data;
683
+
684
+ if (keys.length === 1) {
685
+ continue;
686
+ }
687
+
688
+ for (var k = 0; k < keys.length; k++) {
689
+ var key = keys[k];
690
+
691
+ // Lowercase the first letter
692
+ // By default, dash-separated becomes camelCase
693
+ key = key.substring(0, 1).toLowerCase() + key.substring(1);
694
+
695
+ if (!(key in dataLevel)) {
696
+ dataLevel[key] = {};
697
+ }
698
+
699
+ if (k == keys.length - 1) {
700
+ dataLevel[key] = data[originalKey];
701
+ }
702
+
703
+ dataLevel = dataLevel[key];
704
+ }
705
+
706
+ delete data[originalKey];
707
+ }
708
+
709
+ return data;
710
+ };
711
+
712
+ Utils.hasScroll = function (index, el) {
713
+ // Adapted from the function created by @ShadowScripter
714
+ // and adapted by @BillBarry on the Stack Exchange Code Review website.
715
+ // The original code can be found at
716
+ // http://codereview.stackexchange.com/q/13338
717
+ // and was designed to be used with the Sizzle selector engine.
718
+
719
+ var $el = $(el);
720
+ var overflowX = el.style.overflowX;
721
+ var overflowY = el.style.overflowY;
722
+
723
+ //Check both x and y declarations
724
+ if (overflowX === overflowY &&
725
+ (overflowY === 'hidden' || overflowY === 'visible')) {
726
+ return false;
727
+ }
728
+
729
+ if (overflowX === 'scroll' || overflowY === 'scroll') {
730
+ return true;
731
+ }
732
+
733
+ return ($el.innerHeight() < el.scrollHeight ||
734
+ $el.innerWidth() < el.scrollWidth);
735
+ };
736
+
737
+ Utils.escapeMarkup = function (markup) {
738
+ var replaceMap = {
739
+ '\\': '&#92;',
740
+ '&': '&amp;',
741
+ '<': '&lt;',
742
+ '>': '&gt;',
743
+ '"': '&quot;',
744
+ '\'': '&#39;',
745
+ '/': '&#47;'
746
+ };
747
+
748
+ // Do not try to escape the markup if it's not a string
749
+ if (typeof markup !== 'string') {
750
+ return markup;
751
+ }
752
+
753
+ return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
754
+ return replaceMap[match];
755
+ });
756
+ };
757
+
758
+ // Cache objects in Utils.__cache instead of $.data (see #4346)
759
+ Utils.__cache = {};
760
+
761
+ var id = 0;
762
+ Utils.GetUniqueElementId = function (element) {
763
+ // Get a unique element Id. If element has no id,
764
+ // creates a new unique number, stores it in the id
765
+ // attribute and returns the new id with a prefix.
766
+ // If an id already exists, it simply returns it with a prefix.
767
+
768
+ var select2Id = element.getAttribute('data-select2-id');
769
+
770
+ if (select2Id != null) {
771
+ return select2Id;
772
+ }
773
+
774
+ // If element has id, use it.
775
+ if (element.id) {
776
+ select2Id = 'select2-data-' + element.id;
777
+ } else {
778
+ select2Id = 'select2-data-' + (++id).toString() +
779
+ '-' + Utils.generateChars(4);
780
+ }
781
+
782
+ element.setAttribute('data-select2-id', select2Id);
783
+
784
+ return select2Id;
785
+ };
786
+
787
+ Utils.StoreData = function (element, name, value) {
788
+ // Stores an item in the cache for a specified element.
789
+ // name is the cache key.
790
+ var id = Utils.GetUniqueElementId(element);
791
+ if (!Utils.__cache[id]) {
792
+ Utils.__cache[id] = {};
793
+ }
794
+
795
+ Utils.__cache[id][name] = value;
796
+ };
797
+
798
+ Utils.GetData = function (element, name) {
799
+ // Retrieves a value from the cache by its key (name)
800
+ // name is optional. If no name specified, return
801
+ // all cache items for the specified element.
802
+ // and for a specified element.
803
+ var id = Utils.GetUniqueElementId(element);
804
+ if (name) {
805
+ if (Utils.__cache[id]) {
806
+ if (Utils.__cache[id][name] != null) {
807
+ return Utils.__cache[id][name];
808
+ }
809
+ return $(element).data(name); // Fallback to HTML5 data attribs.
810
+ }
811
+ return $(element).data(name); // Fallback to HTML5 data attribs.
812
+ } else {
813
+ return Utils.__cache[id];
814
+ }
815
+ };
816
+
817
+ Utils.RemoveData = function (element) {
818
+ // Removes all cached items for a specified element.
819
+ var id = Utils.GetUniqueElementId(element);
820
+ if (Utils.__cache[id] != null) {
821
+ delete Utils.__cache[id];
822
+ }
823
+
824
+ element.removeAttribute('data-select2-id');
825
+ };
826
+
827
+ Utils.copyNonInternalCssClasses = function (dest, src) {
828
+ var classes;
829
+
830
+ var destinationClasses = dest.getAttribute('class').trim().split(/\s+/);
831
+
832
+ destinationClasses = destinationClasses.filter(function (clazz) {
833
+ // Save all Select2 classes
834
+ return clazz.indexOf('select2-') === 0;
835
+ });
836
+
837
+ var sourceClasses = src.getAttribute('class').trim().split(/\s+/);
838
+
839
+ sourceClasses = sourceClasses.filter(function (clazz) {
840
+ // Only copy non-Select2 classes
841
+ return clazz.indexOf('select2-') !== 0;
842
+ });
843
+
844
+ var replacements = destinationClasses.concat(sourceClasses);
845
+
846
+ dest.setAttribute('class', replacements.join(' '));
847
+ };
848
+
849
+ return Utils;
850
+ });
851
+
852
+ S2.define('select2/results',[
853
+ 'jquery',
854
+ './utils'
855
+ ], function ($, Utils) {
856
+ function Results ($element, options, dataAdapter) {
857
+ this.$element = $element;
858
+ this.data = dataAdapter;
859
+ this.options = options;
860
+
861
+ Results.__super__.constructor.call(this);
862
+ }
863
+
864
+ Utils.Extend(Results, Utils.Observable);
865
+
866
+ Results.prototype.render = function () {
867
+ var $results = $(
868
+ '<ul class="select2-results__options" role="listbox"></ul>'
869
+ );
870
+
871
+ if (this.options.get('multiple')) {
872
+ $results.attr('aria-multiselectable', 'true');
873
+ }
874
+
875
+ this.$results = $results;
876
+
877
+ return $results;
878
+ };
879
+
880
+ Results.prototype.clear = function () {
881
+ this.$results.empty();
882
+ };
883
+
884
+ Results.prototype.displayMessage = function (params) {
885
+ var escapeMarkup = this.options.get('escapeMarkup');
886
+
887
+ this.clear();
888
+ this.hideLoading();
889
+
890
+ var $message = $(
891
+ '<li role="alert" aria-live="assertive"' +
892
+ ' class="select2-results__option"></li>'
893
+ );
894
+
895
+ var message = this.options.get('translations').get(params.message);
896
+
897
+ $message.append(
898
+ escapeMarkup(
899
+ message(params.args)
900
+ )
901
+ );
902
+
903
+ $message[0].className += ' select2-results__message';
904
+
905
+ this.$results.append($message);
906
+ };
907
+
908
+ Results.prototype.hideMessages = function () {
909
+ this.$results.find('.select2-results__message').remove();
910
+ };
911
+
912
+ Results.prototype.append = function (data) {
913
+ this.hideLoading();
914
+
915
+ var $options = [];
916
+
917
+ if (data.results == null || data.results.length === 0) {
918
+ if (this.$results.children().length === 0) {
919
+ this.trigger('results:message', {
920
+ message: 'noResults'
921
+ });
922
+ }
923
+
924
+ return;
925
+ }
926
+
927
+ data.results = this.sort(data.results);
928
+
929
+ for (var d = 0; d < data.results.length; d++) {
930
+ var item = data.results[d];
931
+
932
+ var $option = this.option(item);
933
+
934
+ $options.push($option);
935
+ }
936
+
937
+ this.$results.append($options);
938
+ };
939
+
940
+ Results.prototype.position = function ($results, $dropdown) {
941
+ var $resultsContainer = $dropdown.find('.select2-results');
942
+ $resultsContainer.append($results);
943
+ };
944
+
945
+ Results.prototype.sort = function (data) {
946
+ var sorter = this.options.get('sorter');
947
+
948
+ return sorter(data);
949
+ };
950
+
951
+ Results.prototype.highlightFirstItem = function () {
952
+ var $options = this.$results
953
+ .find('.select2-results__option--selectable');
954
+
955
+ var $selected = $options.filter('.select2-results__option--selected');
956
+
957
+ // Check if there are any selected options
958
+ if ($selected.length > 0) {
959
+ // If there are selected options, highlight the first
960
+ $selected.first().trigger('mouseenter');
961
+ } else {
962
+ // If there are no selected options, highlight the first option
963
+ // in the dropdown
964
+ $options.first().trigger('mouseenter');
965
+ }
966
+
967
+ this.ensureHighlightVisible();
968
+ };
969
+
970
+ Results.prototype.setClasses = function () {
971
+ var self = this;
972
+
973
+ this.data.current(function (selected) {
974
+ var selectedIds = selected.map(function (s) {
975
+ return s.id.toString();
976
+ });
977
+
978
+ var $options = self.$results
979
+ .find('.select2-results__option--selectable');
980
+
981
+ $options.each(function () {
982
+ var $option = $(this);
983
+
984
+ var item = Utils.GetData(this, 'data');
985
+
986
+ // id needs to be converted to a string when comparing
987
+ var id = '' + item.id;
988
+
989
+ if ((item.element != null && item.element.selected) ||
990
+ (item.element == null && selectedIds.indexOf(id) > -1)) {
991
+ this.classList.add('select2-results__option--selected');
992
+ $option.attr('aria-selected', 'true');
993
+ } else {
994
+ this.classList.remove('select2-results__option--selected');
995
+ $option.attr('aria-selected', 'false');
996
+ }
997
+ });
998
+
999
+ });
1000
+ };
1001
+
1002
+ Results.prototype.showLoading = function (params) {
1003
+ this.hideLoading();
1004
+
1005
+ var loadingMore = this.options.get('translations').get('searching');
1006
+
1007
+ var loading = {
1008
+ disabled: true,
1009
+ loading: true,
1010
+ text: loadingMore(params)
1011
+ };
1012
+ var $loading = this.option(loading);
1013
+ $loading.className += ' loading-results';
1014
+
1015
+ this.$results.prepend($loading);
1016
+ };
1017
+
1018
+ Results.prototype.hideLoading = function () {
1019
+ this.$results.find('.loading-results').remove();
1020
+ };
1021
+
1022
+ Results.prototype.option = function (data) {
1023
+ var option = document.createElement('li');
1024
+ option.classList.add('select2-results__option');
1025
+ option.classList.add('select2-results__option--selectable');
1026
+
1027
+ var attrs = {
1028
+ 'role': 'option'
1029
+ };
1030
+
1031
+ var matches = window.Element.prototype.matches ||
1032
+ window.Element.prototype.msMatchesSelector ||
1033
+ window.Element.prototype.webkitMatchesSelector;
1034
+
1035
+ if ((data.element != null && matches.call(data.element, ':disabled')) ||
1036
+ (data.element == null && data.disabled)) {
1037
+ attrs['aria-disabled'] = 'true';
1038
+
1039
+ option.classList.remove('select2-results__option--selectable');
1040
+ option.classList.add('select2-results__option--disabled');
1041
+ }
1042
+
1043
+ if (data.id == null) {
1044
+ option.classList.remove('select2-results__option--selectable');
1045
+ }
1046
+
1047
+ if (data._resultId != null) {
1048
+ option.id = data._resultId;
1049
+ }
1050
+
1051
+ if (data.title) {
1052
+ option.title = data.title;
1053
+ }
1054
+
1055
+ if (data.children) {
1056
+ attrs.role = 'group';
1057
+ attrs['aria-label'] = data.text;
1058
+
1059
+ option.classList.remove('select2-results__option--selectable');
1060
+ option.classList.add('select2-results__option--group');
1061
+ }
1062
+
1063
+ for (var attr in attrs) {
1064
+ var val = attrs[attr];
1065
+
1066
+ option.setAttribute(attr, val);
1067
+ }
1068
+
1069
+ if (data.children) {
1070
+ var $option = $(option);
1071
+
1072
+ var label = document.createElement('strong');
1073
+ label.className = 'select2-results__group';
1074
+
1075
+ this.template(data, label);
1076
+
1077
+ var $children = [];
1078
+
1079
+ for (var c = 0; c < data.children.length; c++) {
1080
+ var child = data.children[c];
1081
+
1082
+ var $child = this.option(child);
1083
+
1084
+ $children.push($child);
1085
+ }
1086
+
1087
+ var $childrenContainer = $('<ul></ul>', {
1088
+ 'class': 'select2-results__options select2-results__options--nested',
1089
+ 'role': 'none'
1090
+ });
1091
+
1092
+ $childrenContainer.append($children);
1093
+
1094
+ $option.append(label);
1095
+ $option.append($childrenContainer);
1096
+ } else {
1097
+ this.template(data, option);
1098
+ }
1099
+
1100
+ Utils.StoreData(option, 'data', data);
1101
+
1102
+ return option;
1103
+ };
1104
+
1105
+ Results.prototype.bind = function (container, $container) {
1106
+ var self = this;
1107
+
1108
+ var id = container.id + '-results';
1109
+
1110
+ this.$results.attr('id', id);
1111
+
1112
+ container.on('results:all', function (params) {
1113
+ self.clear();
1114
+ self.append(params.data);
1115
+
1116
+ if (container.isOpen()) {
1117
+ self.setClasses();
1118
+ self.highlightFirstItem();
1119
+ }
1120
+ });
1121
+
1122
+ container.on('results:append', function (params) {
1123
+ self.append(params.data);
1124
+
1125
+ if (container.isOpen()) {
1126
+ self.setClasses();
1127
+ }
1128
+ });
1129
+
1130
+ container.on('query', function (params) {
1131
+ self.hideMessages();
1132
+ self.showLoading(params);
1133
+ });
1134
+
1135
+ container.on('select', function () {
1136
+ if (!container.isOpen()) {
1137
+ return;
1138
+ }
1139
+
1140
+ self.setClasses();
1141
+
1142
+ if (self.options.get('scrollAfterSelect')) {
1143
+ self.highlightFirstItem();
1144
+ }
1145
+ });
1146
+
1147
+ container.on('unselect', function () {
1148
+ if (!container.isOpen()) {
1149
+ return;
1150
+ }
1151
+
1152
+ self.setClasses();
1153
+
1154
+ if (self.options.get('scrollAfterSelect')) {
1155
+ self.highlightFirstItem();
1156
+ }
1157
+ });
1158
+
1159
+ container.on('open', function () {
1160
+ // When the dropdown is open, aria-expended="true"
1161
+ self.$results.attr('aria-expanded', 'true');
1162
+ self.$results.attr('aria-hidden', 'false');
1163
+
1164
+ self.setClasses();
1165
+ self.ensureHighlightVisible();
1166
+ });
1167
+
1168
+ container.on('close', function () {
1169
+ // When the dropdown is closed, aria-expended="false"
1170
+ self.$results.attr('aria-expanded', 'false');
1171
+ self.$results.attr('aria-hidden', 'true');
1172
+ self.$results.removeAttr('aria-activedescendant');
1173
+ });
1174
+
1175
+ container.on('results:toggle', function () {
1176
+ var $highlighted = self.getHighlightedResults();
1177
+
1178
+ if ($highlighted.length === 0) {
1179
+ return;
1180
+ }
1181
+
1182
+ $highlighted.trigger('mouseup');
1183
+ });
1184
+
1185
+ container.on('results:select', function () {
1186
+ var $highlighted = self.getHighlightedResults();
1187
+
1188
+ if ($highlighted.length === 0) {
1189
+ return;
1190
+ }
1191
+
1192
+ var data = Utils.GetData($highlighted[0], 'data');
1193
+
1194
+ if ($highlighted.hasClass('select2-results__option--selected')) {
1195
+ self.trigger('close', {});
1196
+ } else {
1197
+ self.trigger('select', {
1198
+ data: data
1199
+ });
1200
+ }
1201
+ });
1202
+
1203
+ container.on('results:previous', function () {
1204
+ var $highlighted = self.getHighlightedResults();
1205
+
1206
+ var $options = self.$results.find('.select2-results__option--selectable');
1207
+
1208
+ var currentIndex = $options.index($highlighted);
1209
+
1210
+ // If we are already at the top, don't move further
1211
+ // If no options, currentIndex will be -1
1212
+ if (currentIndex <= 0) {
1213
+ return;
1214
+ }
1215
+
1216
+ var nextIndex = currentIndex - 1;
1217
+
1218
+ // If none are highlighted, highlight the first
1219
+ if ($highlighted.length === 0) {
1220
+ nextIndex = 0;
1221
+ }
1222
+
1223
+ var $next = $options.eq(nextIndex);
1224
+
1225
+ $next.trigger('mouseenter');
1226
+
1227
+ var currentOffset = self.$results.offset().top;
1228
+ var nextTop = $next.offset().top;
1229
+ var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
1230
+
1231
+ if (nextIndex === 0) {
1232
+ self.$results.scrollTop(0);
1233
+ } else if (nextTop - currentOffset < 0) {
1234
+ self.$results.scrollTop(nextOffset);
1235
+ }
1236
+ });
1237
+
1238
+ container.on('results:next', function () {
1239
+ var $highlighted = self.getHighlightedResults();
1240
+
1241
+ var $options = self.$results.find('.select2-results__option--selectable');
1242
+
1243
+ var currentIndex = $options.index($highlighted);
1244
+
1245
+ var nextIndex = currentIndex + 1;
1246
+
1247
+ // If we are at the last option, stay there
1248
+ if (nextIndex >= $options.length) {
1249
+ return;
1250
+ }
1251
+
1252
+ var $next = $options.eq(nextIndex);
1253
+
1254
+ $next.trigger('mouseenter');
1255
+
1256
+ var currentOffset = self.$results.offset().top +
1257
+ self.$results.outerHeight(false);
1258
+ var nextBottom = $next.offset().top + $next.outerHeight(false);
1259
+ var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
1260
+
1261
+ if (nextIndex === 0) {
1262
+ self.$results.scrollTop(0);
1263
+ } else if (nextBottom > currentOffset) {
1264
+ self.$results.scrollTop(nextOffset);
1265
+ }
1266
+ });
1267
+
1268
+ container.on('results:focus', function (params) {
1269
+ params.element[0].classList.add('select2-results__option--highlighted');
1270
+ params.element[0].setAttribute('aria-selected', 'true');
1271
+ });
1272
+
1273
+ container.on('results:message', function (params) {
1274
+ self.displayMessage(params);
1275
+ });
1276
+
1277
+ if ($.fn.mousewheel) {
1278
+ this.$results.on('mousewheel', function (e) {
1279
+ var top = self.$results.scrollTop();
1280
+
1281
+ var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
1282
+
1283
+ var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
1284
+ var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
1285
+
1286
+ if (isAtTop) {
1287
+ self.$results.scrollTop(0);
1288
+
1289
+ e.preventDefault();
1290
+ e.stopPropagation();
1291
+ } else if (isAtBottom) {
1292
+ self.$results.scrollTop(
1293
+ self.$results.get(0).scrollHeight - self.$results.height()
1294
+ );
1295
+
1296
+ e.preventDefault();
1297
+ e.stopPropagation();
1298
+ }
1299
+ });
1300
+ }
1301
+
1302
+ this.$results.on('mouseup', '.select2-results__option--selectable',
1303
+ function (evt) {
1304
+ var $this = $(this);
1305
+
1306
+ var data = Utils.GetData(this, 'data');
1307
+
1308
+ if ($this.hasClass('select2-results__option--selected')) {
1309
+ if (self.options.get('multiple')) {
1310
+ self.trigger('unselect', {
1311
+ originalEvent: evt,
1312
+ data: data
1313
+ });
1314
+ } else {
1315
+ self.trigger('close', {});
1316
+ }
1317
+
1318
+ return;
1319
+ }
1320
+
1321
+ self.trigger('select', {
1322
+ originalEvent: evt,
1323
+ data: data
1324
+ });
1325
+ });
1326
+
1327
+ this.$results.on('mouseenter', '.select2-results__option--selectable',
1328
+ function (evt) {
1329
+ var data = Utils.GetData(this, 'data');
1330
+
1331
+ self.getHighlightedResults()
1332
+ .removeClass('select2-results__option--highlighted')
1333
+ .attr('aria-selected', 'false');
1334
+
1335
+ self.trigger('results:focus', {
1336
+ data: data,
1337
+ element: $(this)
1338
+ });
1339
+ });
1340
+ };
1341
+
1342
+ Results.prototype.getHighlightedResults = function () {
1343
+ var $highlighted = this.$results
1344
+ .find('.select2-results__option--highlighted');
1345
+
1346
+ return $highlighted;
1347
+ };
1348
+
1349
+ Results.prototype.destroy = function () {
1350
+ this.$results.remove();
1351
+ };
1352
+
1353
+ Results.prototype.ensureHighlightVisible = function () {
1354
+ var $highlighted = this.getHighlightedResults();
1355
+
1356
+ if ($highlighted.length === 0) {
1357
+ return;
1358
+ }
1359
+
1360
+ var $options = this.$results.find('.select2-results__option--selectable');
1361
+
1362
+ var currentIndex = $options.index($highlighted);
1363
+
1364
+ var currentOffset = this.$results.offset().top;
1365
+ var nextTop = $highlighted.offset().top;
1366
+ var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
1367
+
1368
+ var offsetDelta = nextTop - currentOffset;
1369
+ nextOffset -= $highlighted.outerHeight(false) * 2;
1370
+
1371
+ if (currentIndex <= 2) {
1372
+ this.$results.scrollTop(0);
1373
+ } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
1374
+ this.$results.scrollTop(nextOffset);
1375
+ }
1376
+ };
1377
+
1378
+ Results.prototype.template = function (result, container) {
1379
+ var template = this.options.get('templateResult');
1380
+ var escapeMarkup = this.options.get('escapeMarkup');
1381
+
1382
+ var content = template(result, container);
1383
+
1384
+ if (content == null) {
1385
+ container.style.display = 'none';
1386
+ } else if (typeof content === 'string') {
1387
+ container.innerHTML = escapeMarkup(content);
1388
+ } else {
1389
+ $(container).append(content);
1390
+ }
1391
+ };
1392
+
1393
+ return Results;
1394
+ });
1395
+
1396
+ S2.define('select2/keys',[
1397
+
1398
+ ], function () {
1399
+ var KEYS = {
1400
+ BACKSPACE: 8,
1401
+ TAB: 9,
1402
+ ENTER: 13,
1403
+ SHIFT: 16,
1404
+ CTRL: 17,
1405
+ ALT: 18,
1406
+ ESC: 27,
1407
+ SPACE: 32,
1408
+ PAGE_UP: 33,
1409
+ PAGE_DOWN: 34,
1410
+ END: 35,
1411
+ HOME: 36,
1412
+ LEFT: 37,
1413
+ UP: 38,
1414
+ RIGHT: 39,
1415
+ DOWN: 40,
1416
+ DELETE: 46
1417
+ };
1418
+
1419
+ return KEYS;
1420
+ });
1421
+
1422
+ S2.define('select2/selection/base',[
1423
+ 'jquery',
1424
+ '../utils',
1425
+ '../keys'
1426
+ ], function ($, Utils, KEYS) {
1427
+ function BaseSelection ($element, options) {
1428
+ this.$element = $element;
1429
+ this.options = options;
1430
+
1431
+ BaseSelection.__super__.constructor.call(this);
1432
+ }
1433
+
1434
+ Utils.Extend(BaseSelection, Utils.Observable);
1435
+
1436
+ BaseSelection.prototype.render = function () {
1437
+ var $selection = $(
1438
+ '<span class="select2-selection" role="combobox" ' +
1439
+ ' aria-haspopup="true" aria-expanded="false">' +
1440
+ '</span>'
1441
+ );
1442
+
1443
+ this._tabindex = 0;
1444
+
1445
+ if (Utils.GetData(this.$element[0], 'old-tabindex') != null) {
1446
+ this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex');
1447
+ } else if (this.$element.attr('tabindex') != null) {
1448
+ this._tabindex = this.$element.attr('tabindex');
1449
+ }
1450
+
1451
+ $selection.attr('title', this.$element.attr('title'));
1452
+ $selection.attr('tabindex', this._tabindex);
1453
+ $selection.attr('aria-disabled', 'false');
1454
+
1455
+ this.$selection = $selection;
1456
+
1457
+ return $selection;
1458
+ };
1459
+
1460
+ BaseSelection.prototype.bind = function (container, $container) {
1461
+ var self = this;
1462
+
1463
+ var resultsId = container.id + '-results';
1464
+
1465
+ this.container = container;
1466
+
1467
+ this.$selection.on('focus', function (evt) {
1468
+ self.trigger('focus', evt);
1469
+ });
1470
+
1471
+ this.$selection.on('blur', function (evt) {
1472
+ self._handleBlur(evt);
1473
+ });
1474
+
1475
+ this.$selection.on('keydown', function (evt) {
1476
+ self.trigger('keypress', evt);
1477
+
1478
+ if (evt.which === KEYS.SPACE) {
1479
+ evt.preventDefault();
1480
+ }
1481
+ });
1482
+
1483
+ container.on('results:focus', function (params) {
1484
+ self.$selection.attr('aria-activedescendant', params.data._resultId);
1485
+ });
1486
+
1487
+ container.on('selection:update', function (params) {
1488
+ self.update(params.data);
1489
+ });
1490
+
1491
+ container.on('open', function () {
1492
+ // When the dropdown is open, aria-expanded="true"
1493
+ self.$selection.attr('aria-expanded', 'true');
1494
+ self.$selection.attr('aria-owns', resultsId);
1495
+
1496
+ self._attachCloseHandler(container);
1497
+ });
1498
+
1499
+ container.on('close', function () {
1500
+ // When the dropdown is closed, aria-expanded="false"
1501
+ self.$selection.attr('aria-expanded', 'false');
1502
+ self.$selection.removeAttr('aria-activedescendant');
1503
+ self.$selection.removeAttr('aria-owns');
1504
+
1505
+ self.$selection.trigger('focus');
1506
+
1507
+ self._detachCloseHandler(container);
1508
+ });
1509
+
1510
+ container.on('enable', function () {
1511
+ self.$selection.attr('tabindex', self._tabindex);
1512
+ self.$selection.attr('aria-disabled', 'false');
1513
+ });
1514
+
1515
+ container.on('disable', function () {
1516
+ self.$selection.attr('tabindex', '-1');
1517
+ self.$selection.attr('aria-disabled', 'true');
1518
+ });
1519
+ };
1520
+
1521
+ BaseSelection.prototype._handleBlur = function (evt) {
1522
+ var self = this;
1523
+
1524
+ // This needs to be delayed as the active element is the body when the tab
1525
+ // key is pressed, possibly along with others.
1526
+ window.setTimeout(function () {
1527
+ // Don't trigger `blur` if the focus is still in the selection
1528
+ if (
1529
+ (document.activeElement == self.$selection[0]) ||
1530
+ ($.contains(self.$selection[0], document.activeElement))
1531
+ ) {
1532
+ return;
1533
+ }
1534
+
1535
+ self.trigger('blur', evt);
1536
+ }, 1);
1537
+ };
1538
+
1539
+ BaseSelection.prototype._attachCloseHandler = function (container) {
1540
+
1541
+ $(document.body).on('mousedown.select2.' + container.id, function (e) {
1542
+ var $target = $(e.target);
1543
+
1544
+ var $select = $target.closest('.select2');
1545
+
1546
+ var $all = $('.select2.select2-container--open');
1547
+
1548
+ $all.each(function () {
1549
+ if (this == $select[0]) {
1550
+ return;
1551
+ }
1552
+
1553
+ var $element = Utils.GetData(this, 'element');
1554
+
1555
+ $element.select2('close');
1556
+ });
1557
+ });
1558
+ };
1559
+
1560
+ BaseSelection.prototype._detachCloseHandler = function (container) {
1561
+ $(document.body).off('mousedown.select2.' + container.id);
1562
+ };
1563
+
1564
+ BaseSelection.prototype.position = function ($selection, $container) {
1565
+ var $selectionContainer = $container.find('.selection');
1566
+ $selectionContainer.append($selection);
1567
+ };
1568
+
1569
+ BaseSelection.prototype.destroy = function () {
1570
+ this._detachCloseHandler(this.container);
1571
+ };
1572
+
1573
+ BaseSelection.prototype.update = function (data) {
1574
+ throw new Error('The `update` method must be defined in child classes.');
1575
+ };
1576
+
1577
+ /**
1578
+ * Helper method to abstract the "enabled" (not "disabled") state of this
1579
+ * object.
1580
+ *
1581
+ * @return {true} if the instance is not disabled.
1582
+ * @return {false} if the instance is disabled.
1583
+ */
1584
+ BaseSelection.prototype.isEnabled = function () {
1585
+ return !this.isDisabled();
1586
+ };
1587
+
1588
+ /**
1589
+ * Helper method to abstract the "disabled" state of this object.
1590
+ *
1591
+ * @return {true} if the disabled option is true.
1592
+ * @return {false} if the disabled option is false.
1593
+ */
1594
+ BaseSelection.prototype.isDisabled = function () {
1595
+ return this.options.get('disabled');
1596
+ };
1597
+
1598
+ return BaseSelection;
1599
+ });
1600
+
1601
+ S2.define('select2/selection/single',[
1602
+ 'jquery',
1603
+ './base',
1604
+ '../utils',
1605
+ '../keys'
1606
+ ], function ($, BaseSelection, Utils, KEYS) {
1607
+ function SingleSelection () {
1608
+ SingleSelection.__super__.constructor.apply(this, arguments);
1609
+ }
1610
+
1611
+ Utils.Extend(SingleSelection, BaseSelection);
1612
+
1613
+ SingleSelection.prototype.render = function () {
1614
+ var $selection = SingleSelection.__super__.render.call(this);
1615
+
1616
+ $selection[0].classList.add('select2-selection--single');
1617
+
1618
+ $selection.html(
1619
+ '<span class="select2-selection__rendered"></span>' +
1620
+ '<span class="select2-selection__arrow" role="presentation">' +
1621
+ '<b role="presentation"></b>' +
1622
+ '</span>'
1623
+ );
1624
+
1625
+ return $selection;
1626
+ };
1627
+
1628
+ SingleSelection.prototype.bind = function (container, $container) {
1629
+ var self = this;
1630
+
1631
+ SingleSelection.__super__.bind.apply(this, arguments);
1632
+
1633
+ var id = container.id + '-container';
1634
+
1635
+ this.$selection.find('.select2-selection__rendered')
1636
+ .attr('id', id)
1637
+ .attr('role', 'textbox')
1638
+ .attr('aria-readonly', 'true');
1639
+ this.$selection.attr('aria-labelledby', id);
1640
+ this.$selection.attr('aria-controls', id);
1641
+
1642
+ this.$selection.on('mousedown', function (evt) {
1643
+ // Only respond to left clicks
1644
+ if (evt.which !== 1) {
1645
+ return;
1646
+ }
1647
+
1648
+ self.trigger('toggle', {
1649
+ originalEvent: evt
1650
+ });
1651
+ });
1652
+
1653
+ this.$selection.on('focus', function (evt) {
1654
+ // User focuses on the container
1655
+ });
1656
+
1657
+ this.$selection.on('blur', function (evt) {
1658
+ // User exits the container
1659
+ });
1660
+
1661
+ container.on('focus', function (evt) {
1662
+ if (!container.isOpen()) {
1663
+ self.$selection.trigger('focus');
1664
+ }
1665
+ });
1666
+ };
1667
+
1668
+ SingleSelection.prototype.clear = function () {
1669
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1670
+ $rendered.empty();
1671
+ $rendered.removeAttr('title'); // clear tooltip on empty
1672
+ };
1673
+
1674
+ SingleSelection.prototype.display = function (data, container) {
1675
+ var template = this.options.get('templateSelection');
1676
+ var escapeMarkup = this.options.get('escapeMarkup');
1677
+
1678
+ return escapeMarkup(template(data, container));
1679
+ };
1680
+
1681
+ SingleSelection.prototype.selectionContainer = function () {
1682
+ return $('<span></span>');
1683
+ };
1684
+
1685
+ SingleSelection.prototype.update = function (data) {
1686
+ if (data.length === 0) {
1687
+ this.clear();
1688
+ return;
1689
+ }
1690
+
1691
+ var selection = data[0];
1692
+
1693
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1694
+ var formatted = this.display(selection, $rendered);
1695
+
1696
+ $rendered.empty().append(formatted);
1697
+
1698
+ var title = selection.title || selection.text;
1699
+
1700
+ if (title) {
1701
+ $rendered.attr('title', title);
1702
+ } else {
1703
+ $rendered.removeAttr('title');
1704
+ }
1705
+ };
1706
+
1707
+ return SingleSelection;
1708
+ });
1709
+
1710
+ S2.define('select2/selection/multiple',[
1711
+ 'jquery',
1712
+ './base',
1713
+ '../utils'
1714
+ ], function ($, BaseSelection, Utils) {
1715
+ function MultipleSelection ($element, options) {
1716
+ MultipleSelection.__super__.constructor.apply(this, arguments);
1717
+ }
1718
+
1719
+ Utils.Extend(MultipleSelection, BaseSelection);
1720
+
1721
+ MultipleSelection.prototype.render = function () {
1722
+ var $selection = MultipleSelection.__super__.render.call(this);
1723
+
1724
+ $selection[0].classList.add('select2-selection--multiple');
1725
+
1726
+ $selection.html(
1727
+ '<ul class="select2-selection__rendered"></ul>'
1728
+ );
1729
+
1730
+ return $selection;
1731
+ };
1732
+
1733
+ MultipleSelection.prototype.bind = function (container, $container) {
1734
+ var self = this;
1735
+
1736
+ MultipleSelection.__super__.bind.apply(this, arguments);
1737
+
1738
+ var id = container.id + '-container';
1739
+ this.$selection.find('.select2-selection__rendered').attr('id', id);
1740
+
1741
+ this.$selection.on('click', function (evt) {
1742
+ self.trigger('toggle', {
1743
+ originalEvent: evt
1744
+ });
1745
+ });
1746
+
1747
+ this.$selection.on(
1748
+ 'click',
1749
+ '.select2-selection__choice__remove',
1750
+ function (evt) {
1751
+ // Ignore the event if it is disabled
1752
+ if (self.isDisabled()) {
1753
+ return;
1754
+ }
1755
+
1756
+ var $remove = $(this);
1757
+ var $selection = $remove.parent();
1758
+
1759
+ var data = Utils.GetData($selection[0], 'data');
1760
+
1761
+ self.trigger('unselect', {
1762
+ originalEvent: evt,
1763
+ data: data
1764
+ });
1765
+ }
1766
+ );
1767
+
1768
+ this.$selection.on(
1769
+ 'keydown',
1770
+ '.select2-selection__choice__remove',
1771
+ function (evt) {
1772
+ // Ignore the event if it is disabled
1773
+ if (self.isDisabled()) {
1774
+ return;
1775
+ }
1776
+
1777
+ evt.stopPropagation();
1778
+ }
1779
+ );
1780
+ };
1781
+
1782
+ MultipleSelection.prototype.clear = function () {
1783
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1784
+ $rendered.empty();
1785
+ $rendered.removeAttr('title');
1786
+ };
1787
+
1788
+ MultipleSelection.prototype.display = function (data, container) {
1789
+ var template = this.options.get('templateSelection');
1790
+ var escapeMarkup = this.options.get('escapeMarkup');
1791
+
1792
+ return escapeMarkup(template(data, container));
1793
+ };
1794
+
1795
+ MultipleSelection.prototype.selectionContainer = function () {
1796
+ var $container = $(
1797
+ '<li class="select2-selection__choice">' +
1798
+ '<button type="button" class="select2-selection__choice__remove" ' +
1799
+ 'tabindex="-1">' +
1800
+ '<span aria-hidden="true">&times;</span>' +
1801
+ '</button>' +
1802
+ '<span class="select2-selection__choice__display"></span>' +
1803
+ '</li>'
1804
+ );
1805
+
1806
+ return $container;
1807
+ };
1808
+
1809
+ MultipleSelection.prototype.update = function (data) {
1810
+ this.clear();
1811
+
1812
+ if (data.length === 0) {
1813
+ return;
1814
+ }
1815
+
1816
+ var $selections = [];
1817
+
1818
+ var selectionIdPrefix = this.$selection.find('.select2-selection__rendered')
1819
+ .attr('id') + '-choice-';
1820
+
1821
+ for (var d = 0; d < data.length; d++) {
1822
+ var selection = data[d];
1823
+
1824
+ var $selection = this.selectionContainer();
1825
+ var formatted = this.display(selection, $selection);
1826
+
1827
+ var selectionId = selectionIdPrefix + Utils.generateChars(4) + '-';
1828
+
1829
+ if (selection.id) {
1830
+ selectionId += selection.id;
1831
+ } else {
1832
+ selectionId += Utils.generateChars(4);
1833
+ }
1834
+
1835
+ $selection.find('.select2-selection__choice__display')
1836
+ .append(formatted)
1837
+ .attr('id', selectionId);
1838
+
1839
+ var title = selection.title || selection.text;
1840
+
1841
+ if (title) {
1842
+ $selection.attr('title', title);
1843
+ }
1844
+
1845
+ var removeItem = this.options.get('translations').get('removeItem');
1846
+
1847
+ var $remove = $selection.find('.select2-selection__choice__remove');
1848
+
1849
+ $remove.attr('title', removeItem());
1850
+ $remove.attr('aria-label', removeItem());
1851
+ $remove.attr('aria-describedby', selectionId);
1852
+
1853
+ Utils.StoreData($selection[0], 'data', selection);
1854
+
1855
+ $selections.push($selection);
1856
+ }
1857
+
1858
+ var $rendered = this.$selection.find('.select2-selection__rendered');
1859
+
1860
+ $rendered.append($selections);
1861
+ };
1862
+
1863
+ return MultipleSelection;
1864
+ });
1865
+
1866
+ S2.define('select2/selection/placeholder',[
1867
+
1868
+ ], function () {
1869
+ function Placeholder (decorated, $element, options) {
1870
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
1871
+
1872
+ decorated.call(this, $element, options);
1873
+ }
1874
+
1875
+ Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
1876
+ if (typeof placeholder === 'string') {
1877
+ placeholder = {
1878
+ id: '',
1879
+ text: placeholder
1880
+ };
1881
+ }
1882
+
1883
+ return placeholder;
1884
+ };
1885
+
1886
+ Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
1887
+ var $placeholder = this.selectionContainer();
1888
+
1889
+ $placeholder.html(this.display(placeholder));
1890
+ $placeholder[0].classList.add('select2-selection__placeholder');
1891
+ $placeholder[0].classList.remove('select2-selection__choice');
1892
+
1893
+ var placeholderTitle = placeholder.title ||
1894
+ placeholder.text ||
1895
+ $placeholder.text();
1896
+
1897
+ this.$selection.find('.select2-selection__rendered').attr(
1898
+ 'title',
1899
+ placeholderTitle
1900
+ );
1901
+
1902
+ return $placeholder;
1903
+ };
1904
+
1905
+ Placeholder.prototype.update = function (decorated, data) {
1906
+ var singlePlaceholder = (
1907
+ data.length == 1 && data[0].id != this.placeholder.id
1908
+ );
1909
+ var multipleSelections = data.length > 1;
1910
+
1911
+ if (multipleSelections || singlePlaceholder) {
1912
+ return decorated.call(this, data);
1913
+ }
1914
+
1915
+ this.clear();
1916
+
1917
+ var $placeholder = this.createPlaceholder(this.placeholder);
1918
+
1919
+ this.$selection.find('.select2-selection__rendered').append($placeholder);
1920
+ };
1921
+
1922
+ return Placeholder;
1923
+ });
1924
+
1925
+ S2.define('select2/selection/allowClear',[
1926
+ 'jquery',
1927
+ '../keys',
1928
+ '../utils'
1929
+ ], function ($, KEYS, Utils) {
1930
+ function AllowClear () { }
1931
+
1932
+ AllowClear.prototype.bind = function (decorated, container, $container) {
1933
+ var self = this;
1934
+
1935
+ decorated.call(this, container, $container);
1936
+
1937
+ if (this.placeholder == null) {
1938
+ if (this.options.get('debug') && window.console && console.error) {
1939
+ console.error(
1940
+ 'Select2: The `allowClear` option should be used in combination ' +
1941
+ 'with the `placeholder` option.'
1942
+ );
1943
+ }
1944
+ }
1945
+
1946
+ this.$selection.on('mousedown', '.select2-selection__clear',
1947
+ function (evt) {
1948
+ self._handleClear(evt);
1949
+ });
1950
+
1951
+ container.on('keypress', function (evt) {
1952
+ self._handleKeyboardClear(evt, container);
1953
+ });
1954
+ };
1955
+
1956
+ AllowClear.prototype._handleClear = function (_, evt) {
1957
+ // Ignore the event if it is disabled
1958
+ if (this.isDisabled()) {
1959
+ return;
1960
+ }
1961
+
1962
+ var $clear = this.$selection.find('.select2-selection__clear');
1963
+
1964
+ // Ignore the event if nothing has been selected
1965
+ if ($clear.length === 0) {
1966
+ return;
1967
+ }
1968
+
1969
+ evt.stopPropagation();
1970
+
1971
+ var data = Utils.GetData($clear[0], 'data');
1972
+
1973
+ var previousVal = this.$element.val();
1974
+ this.$element.val(this.placeholder.id);
1975
+
1976
+ var unselectData = {
1977
+ data: data
1978
+ };
1979
+ this.trigger('clear', unselectData);
1980
+ if (unselectData.prevented) {
1981
+ this.$element.val(previousVal);
1982
+ return;
1983
+ }
1984
+
1985
+ for (var d = 0; d < data.length; d++) {
1986
+ unselectData = {
1987
+ data: data[d]
1988
+ };
1989
+
1990
+ // Trigger the `unselect` event, so people can prevent it from being
1991
+ // cleared.
1992
+ this.trigger('unselect', unselectData);
1993
+
1994
+ // If the event was prevented, don't clear it out.
1995
+ if (unselectData.prevented) {
1996
+ this.$element.val(previousVal);
1997
+ return;
1998
+ }
1999
+ }
2000
+
2001
+ this.$element.trigger('input').trigger('change');
2002
+
2003
+ this.trigger('toggle', {});
2004
+ };
2005
+
2006
+ AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
2007
+ if (container.isOpen()) {
2008
+ return;
2009
+ }
2010
+
2011
+ if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
2012
+ this._handleClear(evt);
2013
+ }
2014
+ };
2015
+
2016
+ AllowClear.prototype.update = function (decorated, data) {
2017
+ decorated.call(this, data);
2018
+
2019
+ this.$selection.find('.select2-selection__clear').remove();
2020
+ this.$selection[0].classList.remove('select2-selection--clearable');
2021
+
2022
+ if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
2023
+ data.length === 0) {
2024
+ return;
2025
+ }
2026
+
2027
+ var selectionId = this.$selection.find('.select2-selection__rendered')
2028
+ .attr('id');
2029
+
2030
+ var removeAll = this.options.get('translations').get('removeAllItems');
2031
+
2032
+ var $remove = $(
2033
+ '<button type="button" class="select2-selection__clear" tabindex="-1">' +
2034
+ '<span aria-hidden="true">&times;</span>' +
2035
+ '</button>'
2036
+ );
2037
+ $remove.attr('title', removeAll());
2038
+ $remove.attr('aria-label', removeAll());
2039
+ $remove.attr('aria-describedby', selectionId);
2040
+ Utils.StoreData($remove[0], 'data', data);
2041
+
2042
+ this.$selection.prepend($remove);
2043
+ this.$selection[0].classList.add('select2-selection--clearable');
2044
+ };
2045
+
2046
+ return AllowClear;
2047
+ });
2048
+
2049
+ S2.define('select2/selection/search',[
2050
+ 'jquery',
2051
+ '../utils',
2052
+ '../keys'
2053
+ ], function ($, Utils, KEYS) {
2054
+ function Search (decorated, $element, options) {
2055
+ decorated.call(this, $element, options);
2056
+ }
2057
+
2058
+ Search.prototype.render = function (decorated) {
2059
+ var searchLabel = this.options.get('translations').get('search');
2060
+ var $search = $(
2061
+ '<span class="select2-search select2-search--inline">' +
2062
+ '<textarea class="select2-search__field"'+
2063
+ ' type="search" tabindex="-1"' +
2064
+ ' autocorrect="off" autocapitalize="none"' +
2065
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" >' +
2066
+ '</textarea>' +
2067
+ '</span>'
2068
+ );
2069
+
2070
+ this.$searchContainer = $search;
2071
+ this.$search = $search.find('textarea');
2072
+
2073
+ this.$search.prop('autocomplete', this.options.get('autocomplete'));
2074
+ this.$search.attr('aria-label', searchLabel());
2075
+
2076
+ var $rendered = decorated.call(this);
2077
+
2078
+ this._transferTabIndex();
2079
+ $rendered.append(this.$searchContainer);
2080
+
2081
+ return $rendered;
2082
+ };
2083
+
2084
+ Search.prototype.bind = function (decorated, container, $container) {
2085
+ var self = this;
2086
+
2087
+ var resultsId = container.id + '-results';
2088
+ var selectionId = container.id + '-container';
2089
+
2090
+ decorated.call(this, container, $container);
2091
+
2092
+ self.$search.attr('aria-describedby', selectionId);
2093
+
2094
+ container.on('open', function () {
2095
+ self.$search.attr('aria-controls', resultsId);
2096
+ self.$search.trigger('focus');
2097
+ });
2098
+
2099
+ container.on('close', function () {
2100
+ self.$search.val('');
2101
+ self.resizeSearch();
2102
+ self.$search.removeAttr('aria-controls');
2103
+ self.$search.removeAttr('aria-activedescendant');
2104
+ self.$search.trigger('focus');
2105
+ });
2106
+
2107
+ container.on('enable', function () {
2108
+ self.$search.prop('disabled', false);
2109
+
2110
+ self._transferTabIndex();
2111
+ });
2112
+
2113
+ container.on('disable', function () {
2114
+ self.$search.prop('disabled', true);
2115
+ });
2116
+
2117
+ container.on('focus', function (evt) {
2118
+ self.$search.trigger('focus');
2119
+ });
2120
+
2121
+ container.on('results:focus', function (params) {
2122
+ if (params.data._resultId) {
2123
+ self.$search.attr('aria-activedescendant', params.data._resultId);
2124
+ } else {
2125
+ self.$search.removeAttr('aria-activedescendant');
2126
+ }
2127
+ });
2128
+
2129
+ this.$selection.on('focusin', '.select2-search--inline', function (evt) {
2130
+ self.trigger('focus', evt);
2131
+ });
2132
+
2133
+ this.$selection.on('focusout', '.select2-search--inline', function (evt) {
2134
+ self._handleBlur(evt);
2135
+ });
2136
+
2137
+ this.$selection.on('keydown', '.select2-search--inline', function (evt) {
2138
+ evt.stopPropagation();
2139
+
2140
+ self.trigger('keypress', evt);
2141
+
2142
+ self._keyUpPrevented = evt.isDefaultPrevented();
2143
+
2144
+ var key = evt.which;
2145
+
2146
+ if (key === KEYS.BACKSPACE && self.$search.val() === '') {
2147
+ var $previousChoice = self.$selection
2148
+ .find('.select2-selection__choice').last();
2149
+
2150
+ if ($previousChoice.length > 0) {
2151
+ var item = Utils.GetData($previousChoice[0], 'data');
2152
+
2153
+ self.searchRemoveChoice(item);
2154
+
2155
+ evt.preventDefault();
2156
+ }
2157
+ }
2158
+ });
2159
+
2160
+ this.$selection.on('click', '.select2-search--inline', function (evt) {
2161
+ if (self.$search.val()) {
2162
+ evt.stopPropagation();
2163
+ }
2164
+ });
2165
+
2166
+ // Try to detect the IE version should the `documentMode` property that
2167
+ // is stored on the document. This is only implemented in IE and is
2168
+ // slightly cleaner than doing a user agent check.
2169
+ // This property is not available in Edge, but Edge also doesn't have
2170
+ // this bug.
2171
+ var msie = document.documentMode;
2172
+ var disableInputEvents = msie && msie <= 11;
2173
+
2174
+ // Workaround for browsers which do not support the `input` event
2175
+ // This will prevent double-triggering of events for browsers which support
2176
+ // both the `keyup` and `input` events.
2177
+ this.$selection.on(
2178
+ 'input.searchcheck',
2179
+ '.select2-search--inline',
2180
+ function (evt) {
2181
+ // IE will trigger the `input` event when a placeholder is used on a
2182
+ // search box. To get around this issue, we are forced to ignore all
2183
+ // `input` events in IE and keep using `keyup`.
2184
+ if (disableInputEvents) {
2185
+ self.$selection.off('input.search input.searchcheck');
2186
+ return;
2187
+ }
2188
+
2189
+ // Unbind the duplicated `keyup` event
2190
+ self.$selection.off('keyup.search');
2191
+ }
2192
+ );
2193
+
2194
+ this.$selection.on(
2195
+ 'keyup.search input.search',
2196
+ '.select2-search--inline',
2197
+ function (evt) {
2198
+ // IE will trigger the `input` event when a placeholder is used on a
2199
+ // search box. To get around this issue, we are forced to ignore all
2200
+ // `input` events in IE and keep using `keyup`.
2201
+ if (disableInputEvents && evt.type === 'input') {
2202
+ self.$selection.off('input.search input.searchcheck');
2203
+ return;
2204
+ }
2205
+
2206
+ var key = evt.which;
2207
+
2208
+ // We can freely ignore events from modifier keys
2209
+ if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
2210
+ return;
2211
+ }
2212
+
2213
+ // Tabbing will be handled during the `keydown` phase
2214
+ if (key == KEYS.TAB) {
2215
+ return;
2216
+ }
2217
+
2218
+ self.handleSearch(evt);
2219
+ }
2220
+ );
2221
+ };
2222
+
2223
+ /**
2224
+ * This method will transfer the tabindex attribute from the rendered
2225
+ * selection to the search box. This allows for the search box to be used as
2226
+ * the primary focus instead of the selection container.
2227
+ *
2228
+ * @private
2229
+ */
2230
+ Search.prototype._transferTabIndex = function (decorated) {
2231
+ this.$search.attr('tabindex', this.$selection.attr('tabindex'));
2232
+ this.$selection.attr('tabindex', '-1');
2233
+ };
2234
+
2235
+ Search.prototype.createPlaceholder = function (decorated, placeholder) {
2236
+ this.$search.attr('placeholder', placeholder.text);
2237
+ };
2238
+
2239
+ Search.prototype.update = function (decorated, data) {
2240
+ var searchHadFocus = this.$search[0] == document.activeElement;
2241
+
2242
+ this.$search.attr('placeholder', '');
2243
+
2244
+ decorated.call(this, data);
2245
+
2246
+ this.resizeSearch();
2247
+ if (searchHadFocus) {
2248
+ this.$search.trigger('focus');
2249
+ }
2250
+ };
2251
+
2252
+ Search.prototype.handleSearch = function () {
2253
+ this.resizeSearch();
2254
+
2255
+ if (!this._keyUpPrevented) {
2256
+ var input = this.$search.val();
2257
+
2258
+ this.trigger('query', {
2259
+ term: input
2260
+ });
2261
+ }
2262
+
2263
+ this._keyUpPrevented = false;
2264
+ };
2265
+
2266
+ Search.prototype.searchRemoveChoice = function (decorated, item) {
2267
+ this.trigger('unselect', {
2268
+ data: item
2269
+ });
2270
+
2271
+ this.$search.val(item.text);
2272
+ this.handleSearch();
2273
+ };
2274
+
2275
+ Search.prototype.resizeSearch = function () {
2276
+ this.$search.css('width', '25px');
2277
+
2278
+ var width = '100%';
2279
+
2280
+ if (this.$search.attr('placeholder') === '') {
2281
+ var minimumWidth = this.$search.val().length + 1;
2282
+
2283
+ width = (minimumWidth * 0.75) + 'em';
2284
+ }
2285
+
2286
+ this.$search.css('width', width);
2287
+ };
2288
+
2289
+ return Search;
2290
+ });
2291
+
2292
+ S2.define('select2/selection/selectionCss',[
2293
+ '../utils'
2294
+ ], function (Utils) {
2295
+ function SelectionCSS () { }
2296
+
2297
+ SelectionCSS.prototype.render = function (decorated) {
2298
+ var $selection = decorated.call(this);
2299
+
2300
+ var selectionCssClass = this.options.get('selectionCssClass') || '';
2301
+
2302
+ if (selectionCssClass.indexOf(':all:') !== -1) {
2303
+ selectionCssClass = selectionCssClass.replace(':all:', '');
2304
+
2305
+ Utils.copyNonInternalCssClasses($selection[0], this.$element[0]);
2306
+ }
2307
+
2308
+ $selection.addClass(selectionCssClass);
2309
+
2310
+ return $selection;
2311
+ };
2312
+
2313
+ return SelectionCSS;
2314
+ });
2315
+
2316
+ S2.define('select2/selection/eventRelay',[
2317
+ 'jquery'
2318
+ ], function ($) {
2319
+ function EventRelay () { }
2320
+
2321
+ EventRelay.prototype.bind = function (decorated, container, $container) {
2322
+ var self = this;
2323
+ var relayEvents = [
2324
+ 'open', 'opening',
2325
+ 'close', 'closing',
2326
+ 'select', 'selecting',
2327
+ 'unselect', 'unselecting',
2328
+ 'clear', 'clearing'
2329
+ ];
2330
+
2331
+ var preventableEvents = [
2332
+ 'opening', 'closing', 'selecting', 'unselecting', 'clearing'
2333
+ ];
2334
+
2335
+ decorated.call(this, container, $container);
2336
+
2337
+ container.on('*', function (name, params) {
2338
+ // Ignore events that should not be relayed
2339
+ if (relayEvents.indexOf(name) === -1) {
2340
+ return;
2341
+ }
2342
+
2343
+ // The parameters should always be an object
2344
+ params = params || {};
2345
+
2346
+ // Generate the jQuery event for the Select2 event
2347
+ var evt = $.Event('select2:' + name, {
2348
+ params: params
2349
+ });
2350
+
2351
+ self.$element.trigger(evt);
2352
+
2353
+ // Only handle preventable events if it was one
2354
+ if (preventableEvents.indexOf(name) === -1) {
2355
+ return;
2356
+ }
2357
+
2358
+ params.prevented = evt.isDefaultPrevented();
2359
+ });
2360
+ };
2361
+
2362
+ return EventRelay;
2363
+ });
2364
+
2365
+ S2.define('select2/translation',[
2366
+ 'jquery',
2367
+ 'require'
2368
+ ], function ($, require) {
2369
+ function Translation (dict) {
2370
+ this.dict = dict || {};
2371
+ }
2372
+
2373
+ Translation.prototype.all = function () {
2374
+ return this.dict;
2375
+ };
2376
+
2377
+ Translation.prototype.get = function (key) {
2378
+ return this.dict[key];
2379
+ };
2380
+
2381
+ Translation.prototype.extend = function (translation) {
2382
+ this.dict = $.extend({}, translation.all(), this.dict);
2383
+ };
2384
+
2385
+ // Static functions
2386
+
2387
+ Translation._cache = {};
2388
+
2389
+ Translation.loadPath = function (path) {
2390
+ if (!(path in Translation._cache)) {
2391
+ var translations = require(path);
2392
+
2393
+ Translation._cache[path] = translations;
2394
+ }
2395
+
2396
+ return new Translation(Translation._cache[path]);
2397
+ };
2398
+
2399
+ return Translation;
2400
+ });
2401
+
2402
+ S2.define('select2/diacritics',[
2403
+
2404
+ ], function () {
2405
+ var diacritics = {
2406
+ '\u24B6': 'A',
2407
+ '\uFF21': 'A',
2408
+ '\u00C0': 'A',
2409
+ '\u00C1': 'A',
2410
+ '\u00C2': 'A',
2411
+ '\u1EA6': 'A',
2412
+ '\u1EA4': 'A',
2413
+ '\u1EAA': 'A',
2414
+ '\u1EA8': 'A',
2415
+ '\u00C3': 'A',
2416
+ '\u0100': 'A',
2417
+ '\u0102': 'A',
2418
+ '\u1EB0': 'A',
2419
+ '\u1EAE': 'A',
2420
+ '\u1EB4': 'A',
2421
+ '\u1EB2': 'A',
2422
+ '\u0226': 'A',
2423
+ '\u01E0': 'A',
2424
+ '\u00C4': 'A',
2425
+ '\u01DE': 'A',
2426
+ '\u1EA2': 'A',
2427
+ '\u00C5': 'A',
2428
+ '\u01FA': 'A',
2429
+ '\u01CD': 'A',
2430
+ '\u0200': 'A',
2431
+ '\u0202': 'A',
2432
+ '\u1EA0': 'A',
2433
+ '\u1EAC': 'A',
2434
+ '\u1EB6': 'A',
2435
+ '\u1E00': 'A',
2436
+ '\u0104': 'A',
2437
+ '\u023A': 'A',
2438
+ '\u2C6F': 'A',
2439
+ '\uA732': 'AA',
2440
+ '\u00C6': 'AE',
2441
+ '\u01FC': 'AE',
2442
+ '\u01E2': 'AE',
2443
+ '\uA734': 'AO',
2444
+ '\uA736': 'AU',
2445
+ '\uA738': 'AV',
2446
+ '\uA73A': 'AV',
2447
+ '\uA73C': 'AY',
2448
+ '\u24B7': 'B',
2449
+ '\uFF22': 'B',
2450
+ '\u1E02': 'B',
2451
+ '\u1E04': 'B',
2452
+ '\u1E06': 'B',
2453
+ '\u0243': 'B',
2454
+ '\u0182': 'B',
2455
+ '\u0181': 'B',
2456
+ '\u24B8': 'C',
2457
+ '\uFF23': 'C',
2458
+ '\u0106': 'C',
2459
+ '\u0108': 'C',
2460
+ '\u010A': 'C',
2461
+ '\u010C': 'C',
2462
+ '\u00C7': 'C',
2463
+ '\u1E08': 'C',
2464
+ '\u0187': 'C',
2465
+ '\u023B': 'C',
2466
+ '\uA73E': 'C',
2467
+ '\u24B9': 'D',
2468
+ '\uFF24': 'D',
2469
+ '\u1E0A': 'D',
2470
+ '\u010E': 'D',
2471
+ '\u1E0C': 'D',
2472
+ '\u1E10': 'D',
2473
+ '\u1E12': 'D',
2474
+ '\u1E0E': 'D',
2475
+ '\u0110': 'D',
2476
+ '\u018B': 'D',
2477
+ '\u018A': 'D',
2478
+ '\u0189': 'D',
2479
+ '\uA779': 'D',
2480
+ '\u01F1': 'DZ',
2481
+ '\u01C4': 'DZ',
2482
+ '\u01F2': 'Dz',
2483
+ '\u01C5': 'Dz',
2484
+ '\u24BA': 'E',
2485
+ '\uFF25': 'E',
2486
+ '\u00C8': 'E',
2487
+ '\u00C9': 'E',
2488
+ '\u00CA': 'E',
2489
+ '\u1EC0': 'E',
2490
+ '\u1EBE': 'E',
2491
+ '\u1EC4': 'E',
2492
+ '\u1EC2': 'E',
2493
+ '\u1EBC': 'E',
2494
+ '\u0112': 'E',
2495
+ '\u1E14': 'E',
2496
+ '\u1E16': 'E',
2497
+ '\u0114': 'E',
2498
+ '\u0116': 'E',
2499
+ '\u00CB': 'E',
2500
+ '\u1EBA': 'E',
2501
+ '\u011A': 'E',
2502
+ '\u0204': 'E',
2503
+ '\u0206': 'E',
2504
+ '\u1EB8': 'E',
2505
+ '\u1EC6': 'E',
2506
+ '\u0228': 'E',
2507
+ '\u1E1C': 'E',
2508
+ '\u0118': 'E',
2509
+ '\u1E18': 'E',
2510
+ '\u1E1A': 'E',
2511
+ '\u0190': 'E',
2512
+ '\u018E': 'E',
2513
+ '\u24BB': 'F',
2514
+ '\uFF26': 'F',
2515
+ '\u1E1E': 'F',
2516
+ '\u0191': 'F',
2517
+ '\uA77B': 'F',
2518
+ '\u24BC': 'G',
2519
+ '\uFF27': 'G',
2520
+ '\u01F4': 'G',
2521
+ '\u011C': 'G',
2522
+ '\u1E20': 'G',
2523
+ '\u011E': 'G',
2524
+ '\u0120': 'G',
2525
+ '\u01E6': 'G',
2526
+ '\u0122': 'G',
2527
+ '\u01E4': 'G',
2528
+ '\u0193': 'G',
2529
+ '\uA7A0': 'G',
2530
+ '\uA77D': 'G',
2531
+ '\uA77E': 'G',
2532
+ '\u24BD': 'H',
2533
+ '\uFF28': 'H',
2534
+ '\u0124': 'H',
2535
+ '\u1E22': 'H',
2536
+ '\u1E26': 'H',
2537
+ '\u021E': 'H',
2538
+ '\u1E24': 'H',
2539
+ '\u1E28': 'H',
2540
+ '\u1E2A': 'H',
2541
+ '\u0126': 'H',
2542
+ '\u2C67': 'H',
2543
+ '\u2C75': 'H',
2544
+ '\uA78D': 'H',
2545
+ '\u24BE': 'I',
2546
+ '\uFF29': 'I',
2547
+ '\u00CC': 'I',
2548
+ '\u00CD': 'I',
2549
+ '\u00CE': 'I',
2550
+ '\u0128': 'I',
2551
+ '\u012A': 'I',
2552
+ '\u012C': 'I',
2553
+ '\u0130': 'I',
2554
+ '\u00CF': 'I',
2555
+ '\u1E2E': 'I',
2556
+ '\u1EC8': 'I',
2557
+ '\u01CF': 'I',
2558
+ '\u0208': 'I',
2559
+ '\u020A': 'I',
2560
+ '\u1ECA': 'I',
2561
+ '\u012E': 'I',
2562
+ '\u1E2C': 'I',
2563
+ '\u0197': 'I',
2564
+ '\u24BF': 'J',
2565
+ '\uFF2A': 'J',
2566
+ '\u0134': 'J',
2567
+ '\u0248': 'J',
2568
+ '\u24C0': 'K',
2569
+ '\uFF2B': 'K',
2570
+ '\u1E30': 'K',
2571
+ '\u01E8': 'K',
2572
+ '\u1E32': 'K',
2573
+ '\u0136': 'K',
2574
+ '\u1E34': 'K',
2575
+ '\u0198': 'K',
2576
+ '\u2C69': 'K',
2577
+ '\uA740': 'K',
2578
+ '\uA742': 'K',
2579
+ '\uA744': 'K',
2580
+ '\uA7A2': 'K',
2581
+ '\u24C1': 'L',
2582
+ '\uFF2C': 'L',
2583
+ '\u013F': 'L',
2584
+ '\u0139': 'L',
2585
+ '\u013D': 'L',
2586
+ '\u1E36': 'L',
2587
+ '\u1E38': 'L',
2588
+ '\u013B': 'L',
2589
+ '\u1E3C': 'L',
2590
+ '\u1E3A': 'L',
2591
+ '\u0141': 'L',
2592
+ '\u023D': 'L',
2593
+ '\u2C62': 'L',
2594
+ '\u2C60': 'L',
2595
+ '\uA748': 'L',
2596
+ '\uA746': 'L',
2597
+ '\uA780': 'L',
2598
+ '\u01C7': 'LJ',
2599
+ '\u01C8': 'Lj',
2600
+ '\u24C2': 'M',
2601
+ '\uFF2D': 'M',
2602
+ '\u1E3E': 'M',
2603
+ '\u1E40': 'M',
2604
+ '\u1E42': 'M',
2605
+ '\u2C6E': 'M',
2606
+ '\u019C': 'M',
2607
+ '\u24C3': 'N',
2608
+ '\uFF2E': 'N',
2609
+ '\u01F8': 'N',
2610
+ '\u0143': 'N',
2611
+ '\u00D1': 'N',
2612
+ '\u1E44': 'N',
2613
+ '\u0147': 'N',
2614
+ '\u1E46': 'N',
2615
+ '\u0145': 'N',
2616
+ '\u1E4A': 'N',
2617
+ '\u1E48': 'N',
2618
+ '\u0220': 'N',
2619
+ '\u019D': 'N',
2620
+ '\uA790': 'N',
2621
+ '\uA7A4': 'N',
2622
+ '\u01CA': 'NJ',
2623
+ '\u01CB': 'Nj',
2624
+ '\u24C4': 'O',
2625
+ '\uFF2F': 'O',
2626
+ '\u00D2': 'O',
2627
+ '\u00D3': 'O',
2628
+ '\u00D4': 'O',
2629
+ '\u1ED2': 'O',
2630
+ '\u1ED0': 'O',
2631
+ '\u1ED6': 'O',
2632
+ '\u1ED4': 'O',
2633
+ '\u00D5': 'O',
2634
+ '\u1E4C': 'O',
2635
+ '\u022C': 'O',
2636
+ '\u1E4E': 'O',
2637
+ '\u014C': 'O',
2638
+ '\u1E50': 'O',
2639
+ '\u1E52': 'O',
2640
+ '\u014E': 'O',
2641
+ '\u022E': 'O',
2642
+ '\u0230': 'O',
2643
+ '\u00D6': 'O',
2644
+ '\u022A': 'O',
2645
+ '\u1ECE': 'O',
2646
+ '\u0150': 'O',
2647
+ '\u01D1': 'O',
2648
+ '\u020C': 'O',
2649
+ '\u020E': 'O',
2650
+ '\u01A0': 'O',
2651
+ '\u1EDC': 'O',
2652
+ '\u1EDA': 'O',
2653
+ '\u1EE0': 'O',
2654
+ '\u1EDE': 'O',
2655
+ '\u1EE2': 'O',
2656
+ '\u1ECC': 'O',
2657
+ '\u1ED8': 'O',
2658
+ '\u01EA': 'O',
2659
+ '\u01EC': 'O',
2660
+ '\u00D8': 'O',
2661
+ '\u01FE': 'O',
2662
+ '\u0186': 'O',
2663
+ '\u019F': 'O',
2664
+ '\uA74A': 'O',
2665
+ '\uA74C': 'O',
2666
+ '\u0152': 'OE',
2667
+ '\u01A2': 'OI',
2668
+ '\uA74E': 'OO',
2669
+ '\u0222': 'OU',
2670
+ '\u24C5': 'P',
2671
+ '\uFF30': 'P',
2672
+ '\u1E54': 'P',
2673
+ '\u1E56': 'P',
2674
+ '\u01A4': 'P',
2675
+ '\u2C63': 'P',
2676
+ '\uA750': 'P',
2677
+ '\uA752': 'P',
2678
+ '\uA754': 'P',
2679
+ '\u24C6': 'Q',
2680
+ '\uFF31': 'Q',
2681
+ '\uA756': 'Q',
2682
+ '\uA758': 'Q',
2683
+ '\u024A': 'Q',
2684
+ '\u24C7': 'R',
2685
+ '\uFF32': 'R',
2686
+ '\u0154': 'R',
2687
+ '\u1E58': 'R',
2688
+ '\u0158': 'R',
2689
+ '\u0210': 'R',
2690
+ '\u0212': 'R',
2691
+ '\u1E5A': 'R',
2692
+ '\u1E5C': 'R',
2693
+ '\u0156': 'R',
2694
+ '\u1E5E': 'R',
2695
+ '\u024C': 'R',
2696
+ '\u2C64': 'R',
2697
+ '\uA75A': 'R',
2698
+ '\uA7A6': 'R',
2699
+ '\uA782': 'R',
2700
+ '\u24C8': 'S',
2701
+ '\uFF33': 'S',
2702
+ '\u1E9E': 'S',
2703
+ '\u015A': 'S',
2704
+ '\u1E64': 'S',
2705
+ '\u015C': 'S',
2706
+ '\u1E60': 'S',
2707
+ '\u0160': 'S',
2708
+ '\u1E66': 'S',
2709
+ '\u1E62': 'S',
2710
+ '\u1E68': 'S',
2711
+ '\u0218': 'S',
2712
+ '\u015E': 'S',
2713
+ '\u2C7E': 'S',
2714
+ '\uA7A8': 'S',
2715
+ '\uA784': 'S',
2716
+ '\u24C9': 'T',
2717
+ '\uFF34': 'T',
2718
+ '\u1E6A': 'T',
2719
+ '\u0164': 'T',
2720
+ '\u1E6C': 'T',
2721
+ '\u021A': 'T',
2722
+ '\u0162': 'T',
2723
+ '\u1E70': 'T',
2724
+ '\u1E6E': 'T',
2725
+ '\u0166': 'T',
2726
+ '\u01AC': 'T',
2727
+ '\u01AE': 'T',
2728
+ '\u023E': 'T',
2729
+ '\uA786': 'T',
2730
+ '\uA728': 'TZ',
2731
+ '\u24CA': 'U',
2732
+ '\uFF35': 'U',
2733
+ '\u00D9': 'U',
2734
+ '\u00DA': 'U',
2735
+ '\u00DB': 'U',
2736
+ '\u0168': 'U',
2737
+ '\u1E78': 'U',
2738
+ '\u016A': 'U',
2739
+ '\u1E7A': 'U',
2740
+ '\u016C': 'U',
2741
+ '\u00DC': 'U',
2742
+ '\u01DB': 'U',
2743
+ '\u01D7': 'U',
2744
+ '\u01D5': 'U',
2745
+ '\u01D9': 'U',
2746
+ '\u1EE6': 'U',
2747
+ '\u016E': 'U',
2748
+ '\u0170': 'U',
2749
+ '\u01D3': 'U',
2750
+ '\u0214': 'U',
2751
+ '\u0216': 'U',
2752
+ '\u01AF': 'U',
2753
+ '\u1EEA': 'U',
2754
+ '\u1EE8': 'U',
2755
+ '\u1EEE': 'U',
2756
+ '\u1EEC': 'U',
2757
+ '\u1EF0': 'U',
2758
+ '\u1EE4': 'U',
2759
+ '\u1E72': 'U',
2760
+ '\u0172': 'U',
2761
+ '\u1E76': 'U',
2762
+ '\u1E74': 'U',
2763
+ '\u0244': 'U',
2764
+ '\u24CB': 'V',
2765
+ '\uFF36': 'V',
2766
+ '\u1E7C': 'V',
2767
+ '\u1E7E': 'V',
2768
+ '\u01B2': 'V',
2769
+ '\uA75E': 'V',
2770
+ '\u0245': 'V',
2771
+ '\uA760': 'VY',
2772
+ '\u24CC': 'W',
2773
+ '\uFF37': 'W',
2774
+ '\u1E80': 'W',
2775
+ '\u1E82': 'W',
2776
+ '\u0174': 'W',
2777
+ '\u1E86': 'W',
2778
+ '\u1E84': 'W',
2779
+ '\u1E88': 'W',
2780
+ '\u2C72': 'W',
2781
+ '\u24CD': 'X',
2782
+ '\uFF38': 'X',
2783
+ '\u1E8A': 'X',
2784
+ '\u1E8C': 'X',
2785
+ '\u24CE': 'Y',
2786
+ '\uFF39': 'Y',
2787
+ '\u1EF2': 'Y',
2788
+ '\u00DD': 'Y',
2789
+ '\u0176': 'Y',
2790
+ '\u1EF8': 'Y',
2791
+ '\u0232': 'Y',
2792
+ '\u1E8E': 'Y',
2793
+ '\u0178': 'Y',
2794
+ '\u1EF6': 'Y',
2795
+ '\u1EF4': 'Y',
2796
+ '\u01B3': 'Y',
2797
+ '\u024E': 'Y',
2798
+ '\u1EFE': 'Y',
2799
+ '\u24CF': 'Z',
2800
+ '\uFF3A': 'Z',
2801
+ '\u0179': 'Z',
2802
+ '\u1E90': 'Z',
2803
+ '\u017B': 'Z',
2804
+ '\u017D': 'Z',
2805
+ '\u1E92': 'Z',
2806
+ '\u1E94': 'Z',
2807
+ '\u01B5': 'Z',
2808
+ '\u0224': 'Z',
2809
+ '\u2C7F': 'Z',
2810
+ '\u2C6B': 'Z',
2811
+ '\uA762': 'Z',
2812
+ '\u24D0': 'a',
2813
+ '\uFF41': 'a',
2814
+ '\u1E9A': 'a',
2815
+ '\u00E0': 'a',
2816
+ '\u00E1': 'a',
2817
+ '\u00E2': 'a',
2818
+ '\u1EA7': 'a',
2819
+ '\u1EA5': 'a',
2820
+ '\u1EAB': 'a',
2821
+ '\u1EA9': 'a',
2822
+ '\u00E3': 'a',
2823
+ '\u0101': 'a',
2824
+ '\u0103': 'a',
2825
+ '\u1EB1': 'a',
2826
+ '\u1EAF': 'a',
2827
+ '\u1EB5': 'a',
2828
+ '\u1EB3': 'a',
2829
+ '\u0227': 'a',
2830
+ '\u01E1': 'a',
2831
+ '\u00E4': 'a',
2832
+ '\u01DF': 'a',
2833
+ '\u1EA3': 'a',
2834
+ '\u00E5': 'a',
2835
+ '\u01FB': 'a',
2836
+ '\u01CE': 'a',
2837
+ '\u0201': 'a',
2838
+ '\u0203': 'a',
2839
+ '\u1EA1': 'a',
2840
+ '\u1EAD': 'a',
2841
+ '\u1EB7': 'a',
2842
+ '\u1E01': 'a',
2843
+ '\u0105': 'a',
2844
+ '\u2C65': 'a',
2845
+ '\u0250': 'a',
2846
+ '\uA733': 'aa',
2847
+ '\u00E6': 'ae',
2848
+ '\u01FD': 'ae',
2849
+ '\u01E3': 'ae',
2850
+ '\uA735': 'ao',
2851
+ '\uA737': 'au',
2852
+ '\uA739': 'av',
2853
+ '\uA73B': 'av',
2854
+ '\uA73D': 'ay',
2855
+ '\u24D1': 'b',
2856
+ '\uFF42': 'b',
2857
+ '\u1E03': 'b',
2858
+ '\u1E05': 'b',
2859
+ '\u1E07': 'b',
2860
+ '\u0180': 'b',
2861
+ '\u0183': 'b',
2862
+ '\u0253': 'b',
2863
+ '\u24D2': 'c',
2864
+ '\uFF43': 'c',
2865
+ '\u0107': 'c',
2866
+ '\u0109': 'c',
2867
+ '\u010B': 'c',
2868
+ '\u010D': 'c',
2869
+ '\u00E7': 'c',
2870
+ '\u1E09': 'c',
2871
+ '\u0188': 'c',
2872
+ '\u023C': 'c',
2873
+ '\uA73F': 'c',
2874
+ '\u2184': 'c',
2875
+ '\u24D3': 'd',
2876
+ '\uFF44': 'd',
2877
+ '\u1E0B': 'd',
2878
+ '\u010F': 'd',
2879
+ '\u1E0D': 'd',
2880
+ '\u1E11': 'd',
2881
+ '\u1E13': 'd',
2882
+ '\u1E0F': 'd',
2883
+ '\u0111': 'd',
2884
+ '\u018C': 'd',
2885
+ '\u0256': 'd',
2886
+ '\u0257': 'd',
2887
+ '\uA77A': 'd',
2888
+ '\u01F3': 'dz',
2889
+ '\u01C6': 'dz',
2890
+ '\u24D4': 'e',
2891
+ '\uFF45': 'e',
2892
+ '\u00E8': 'e',
2893
+ '\u00E9': 'e',
2894
+ '\u00EA': 'e',
2895
+ '\u1EC1': 'e',
2896
+ '\u1EBF': 'e',
2897
+ '\u1EC5': 'e',
2898
+ '\u1EC3': 'e',
2899
+ '\u1EBD': 'e',
2900
+ '\u0113': 'e',
2901
+ '\u1E15': 'e',
2902
+ '\u1E17': 'e',
2903
+ '\u0115': 'e',
2904
+ '\u0117': 'e',
2905
+ '\u00EB': 'e',
2906
+ '\u1EBB': 'e',
2907
+ '\u011B': 'e',
2908
+ '\u0205': 'e',
2909
+ '\u0207': 'e',
2910
+ '\u1EB9': 'e',
2911
+ '\u1EC7': 'e',
2912
+ '\u0229': 'e',
2913
+ '\u1E1D': 'e',
2914
+ '\u0119': 'e',
2915
+ '\u1E19': 'e',
2916
+ '\u1E1B': 'e',
2917
+ '\u0247': 'e',
2918
+ '\u025B': 'e',
2919
+ '\u01DD': 'e',
2920
+ '\u24D5': 'f',
2921
+ '\uFF46': 'f',
2922
+ '\u1E1F': 'f',
2923
+ '\u0192': 'f',
2924
+ '\uA77C': 'f',
2925
+ '\u24D6': 'g',
2926
+ '\uFF47': 'g',
2927
+ '\u01F5': 'g',
2928
+ '\u011D': 'g',
2929
+ '\u1E21': 'g',
2930
+ '\u011F': 'g',
2931
+ '\u0121': 'g',
2932
+ '\u01E7': 'g',
2933
+ '\u0123': 'g',
2934
+ '\u01E5': 'g',
2935
+ '\u0260': 'g',
2936
+ '\uA7A1': 'g',
2937
+ '\u1D79': 'g',
2938
+ '\uA77F': 'g',
2939
+ '\u24D7': 'h',
2940
+ '\uFF48': 'h',
2941
+ '\u0125': 'h',
2942
+ '\u1E23': 'h',
2943
+ '\u1E27': 'h',
2944
+ '\u021F': 'h',
2945
+ '\u1E25': 'h',
2946
+ '\u1E29': 'h',
2947
+ '\u1E2B': 'h',
2948
+ '\u1E96': 'h',
2949
+ '\u0127': 'h',
2950
+ '\u2C68': 'h',
2951
+ '\u2C76': 'h',
2952
+ '\u0265': 'h',
2953
+ '\u0195': 'hv',
2954
+ '\u24D8': 'i',
2955
+ '\uFF49': 'i',
2956
+ '\u00EC': 'i',
2957
+ '\u00ED': 'i',
2958
+ '\u00EE': 'i',
2959
+ '\u0129': 'i',
2960
+ '\u012B': 'i',
2961
+ '\u012D': 'i',
2962
+ '\u00EF': 'i',
2963
+ '\u1E2F': 'i',
2964
+ '\u1EC9': 'i',
2965
+ '\u01D0': 'i',
2966
+ '\u0209': 'i',
2967
+ '\u020B': 'i',
2968
+ '\u1ECB': 'i',
2969
+ '\u012F': 'i',
2970
+ '\u1E2D': 'i',
2971
+ '\u0268': 'i',
2972
+ '\u0131': 'i',
2973
+ '\u24D9': 'j',
2974
+ '\uFF4A': 'j',
2975
+ '\u0135': 'j',
2976
+ '\u01F0': 'j',
2977
+ '\u0249': 'j',
2978
+ '\u24DA': 'k',
2979
+ '\uFF4B': 'k',
2980
+ '\u1E31': 'k',
2981
+ '\u01E9': 'k',
2982
+ '\u1E33': 'k',
2983
+ '\u0137': 'k',
2984
+ '\u1E35': 'k',
2985
+ '\u0199': 'k',
2986
+ '\u2C6A': 'k',
2987
+ '\uA741': 'k',
2988
+ '\uA743': 'k',
2989
+ '\uA745': 'k',
2990
+ '\uA7A3': 'k',
2991
+ '\u24DB': 'l',
2992
+ '\uFF4C': 'l',
2993
+ '\u0140': 'l',
2994
+ '\u013A': 'l',
2995
+ '\u013E': 'l',
2996
+ '\u1E37': 'l',
2997
+ '\u1E39': 'l',
2998
+ '\u013C': 'l',
2999
+ '\u1E3D': 'l',
3000
+ '\u1E3B': 'l',
3001
+ '\u017F': 'l',
3002
+ '\u0142': 'l',
3003
+ '\u019A': 'l',
3004
+ '\u026B': 'l',
3005
+ '\u2C61': 'l',
3006
+ '\uA749': 'l',
3007
+ '\uA781': 'l',
3008
+ '\uA747': 'l',
3009
+ '\u01C9': 'lj',
3010
+ '\u24DC': 'm',
3011
+ '\uFF4D': 'm',
3012
+ '\u1E3F': 'm',
3013
+ '\u1E41': 'm',
3014
+ '\u1E43': 'm',
3015
+ '\u0271': 'm',
3016
+ '\u026F': 'm',
3017
+ '\u24DD': 'n',
3018
+ '\uFF4E': 'n',
3019
+ '\u01F9': 'n',
3020
+ '\u0144': 'n',
3021
+ '\u00F1': 'n',
3022
+ '\u1E45': 'n',
3023
+ '\u0148': 'n',
3024
+ '\u1E47': 'n',
3025
+ '\u0146': 'n',
3026
+ '\u1E4B': 'n',
3027
+ '\u1E49': 'n',
3028
+ '\u019E': 'n',
3029
+ '\u0272': 'n',
3030
+ '\u0149': 'n',
3031
+ '\uA791': 'n',
3032
+ '\uA7A5': 'n',
3033
+ '\u01CC': 'nj',
3034
+ '\u24DE': 'o',
3035
+ '\uFF4F': 'o',
3036
+ '\u00F2': 'o',
3037
+ '\u00F3': 'o',
3038
+ '\u00F4': 'o',
3039
+ '\u1ED3': 'o',
3040
+ '\u1ED1': 'o',
3041
+ '\u1ED7': 'o',
3042
+ '\u1ED5': 'o',
3043
+ '\u00F5': 'o',
3044
+ '\u1E4D': 'o',
3045
+ '\u022D': 'o',
3046
+ '\u1E4F': 'o',
3047
+ '\u014D': 'o',
3048
+ '\u1E51': 'o',
3049
+ '\u1E53': 'o',
3050
+ '\u014F': 'o',
3051
+ '\u022F': 'o',
3052
+ '\u0231': 'o',
3053
+ '\u00F6': 'o',
3054
+ '\u022B': 'o',
3055
+ '\u1ECF': 'o',
3056
+ '\u0151': 'o',
3057
+ '\u01D2': 'o',
3058
+ '\u020D': 'o',
3059
+ '\u020F': 'o',
3060
+ '\u01A1': 'o',
3061
+ '\u1EDD': 'o',
3062
+ '\u1EDB': 'o',
3063
+ '\u1EE1': 'o',
3064
+ '\u1EDF': 'o',
3065
+ '\u1EE3': 'o',
3066
+ '\u1ECD': 'o',
3067
+ '\u1ED9': 'o',
3068
+ '\u01EB': 'o',
3069
+ '\u01ED': 'o',
3070
+ '\u00F8': 'o',
3071
+ '\u01FF': 'o',
3072
+ '\u0254': 'o',
3073
+ '\uA74B': 'o',
3074
+ '\uA74D': 'o',
3075
+ '\u0275': 'o',
3076
+ '\u0153': 'oe',
3077
+ '\u01A3': 'oi',
3078
+ '\u0223': 'ou',
3079
+ '\uA74F': 'oo',
3080
+ '\u24DF': 'p',
3081
+ '\uFF50': 'p',
3082
+ '\u1E55': 'p',
3083
+ '\u1E57': 'p',
3084
+ '\u01A5': 'p',
3085
+ '\u1D7D': 'p',
3086
+ '\uA751': 'p',
3087
+ '\uA753': 'p',
3088
+ '\uA755': 'p',
3089
+ '\u24E0': 'q',
3090
+ '\uFF51': 'q',
3091
+ '\u024B': 'q',
3092
+ '\uA757': 'q',
3093
+ '\uA759': 'q',
3094
+ '\u24E1': 'r',
3095
+ '\uFF52': 'r',
3096
+ '\u0155': 'r',
3097
+ '\u1E59': 'r',
3098
+ '\u0159': 'r',
3099
+ '\u0211': 'r',
3100
+ '\u0213': 'r',
3101
+ '\u1E5B': 'r',
3102
+ '\u1E5D': 'r',
3103
+ '\u0157': 'r',
3104
+ '\u1E5F': 'r',
3105
+ '\u024D': 'r',
3106
+ '\u027D': 'r',
3107
+ '\uA75B': 'r',
3108
+ '\uA7A7': 'r',
3109
+ '\uA783': 'r',
3110
+ '\u24E2': 's',
3111
+ '\uFF53': 's',
3112
+ '\u00DF': 's',
3113
+ '\u015B': 's',
3114
+ '\u1E65': 's',
3115
+ '\u015D': 's',
3116
+ '\u1E61': 's',
3117
+ '\u0161': 's',
3118
+ '\u1E67': 's',
3119
+ '\u1E63': 's',
3120
+ '\u1E69': 's',
3121
+ '\u0219': 's',
3122
+ '\u015F': 's',
3123
+ '\u023F': 's',
3124
+ '\uA7A9': 's',
3125
+ '\uA785': 's',
3126
+ '\u1E9B': 's',
3127
+ '\u24E3': 't',
3128
+ '\uFF54': 't',
3129
+ '\u1E6B': 't',
3130
+ '\u1E97': 't',
3131
+ '\u0165': 't',
3132
+ '\u1E6D': 't',
3133
+ '\u021B': 't',
3134
+ '\u0163': 't',
3135
+ '\u1E71': 't',
3136
+ '\u1E6F': 't',
3137
+ '\u0167': 't',
3138
+ '\u01AD': 't',
3139
+ '\u0288': 't',
3140
+ '\u2C66': 't',
3141
+ '\uA787': 't',
3142
+ '\uA729': 'tz',
3143
+ '\u24E4': 'u',
3144
+ '\uFF55': 'u',
3145
+ '\u00F9': 'u',
3146
+ '\u00FA': 'u',
3147
+ '\u00FB': 'u',
3148
+ '\u0169': 'u',
3149
+ '\u1E79': 'u',
3150
+ '\u016B': 'u',
3151
+ '\u1E7B': 'u',
3152
+ '\u016D': 'u',
3153
+ '\u00FC': 'u',
3154
+ '\u01DC': 'u',
3155
+ '\u01D8': 'u',
3156
+ '\u01D6': 'u',
3157
+ '\u01DA': 'u',
3158
+ '\u1EE7': 'u',
3159
+ '\u016F': 'u',
3160
+ '\u0171': 'u',
3161
+ '\u01D4': 'u',
3162
+ '\u0215': 'u',
3163
+ '\u0217': 'u',
3164
+ '\u01B0': 'u',
3165
+ '\u1EEB': 'u',
3166
+ '\u1EE9': 'u',
3167
+ '\u1EEF': 'u',
3168
+ '\u1EED': 'u',
3169
+ '\u1EF1': 'u',
3170
+ '\u1EE5': 'u',
3171
+ '\u1E73': 'u',
3172
+ '\u0173': 'u',
3173
+ '\u1E77': 'u',
3174
+ '\u1E75': 'u',
3175
+ '\u0289': 'u',
3176
+ '\u24E5': 'v',
3177
+ '\uFF56': 'v',
3178
+ '\u1E7D': 'v',
3179
+ '\u1E7F': 'v',
3180
+ '\u028B': 'v',
3181
+ '\uA75F': 'v',
3182
+ '\u028C': 'v',
3183
+ '\uA761': 'vy',
3184
+ '\u24E6': 'w',
3185
+ '\uFF57': 'w',
3186
+ '\u1E81': 'w',
3187
+ '\u1E83': 'w',
3188
+ '\u0175': 'w',
3189
+ '\u1E87': 'w',
3190
+ '\u1E85': 'w',
3191
+ '\u1E98': 'w',
3192
+ '\u1E89': 'w',
3193
+ '\u2C73': 'w',
3194
+ '\u24E7': 'x',
3195
+ '\uFF58': 'x',
3196
+ '\u1E8B': 'x',
3197
+ '\u1E8D': 'x',
3198
+ '\u24E8': 'y',
3199
+ '\uFF59': 'y',
3200
+ '\u1EF3': 'y',
3201
+ '\u00FD': 'y',
3202
+ '\u0177': 'y',
3203
+ '\u1EF9': 'y',
3204
+ '\u0233': 'y',
3205
+ '\u1E8F': 'y',
3206
+ '\u00FF': 'y',
3207
+ '\u1EF7': 'y',
3208
+ '\u1E99': 'y',
3209
+ '\u1EF5': 'y',
3210
+ '\u01B4': 'y',
3211
+ '\u024F': 'y',
3212
+ '\u1EFF': 'y',
3213
+ '\u24E9': 'z',
3214
+ '\uFF5A': 'z',
3215
+ '\u017A': 'z',
3216
+ '\u1E91': 'z',
3217
+ '\u017C': 'z',
3218
+ '\u017E': 'z',
3219
+ '\u1E93': 'z',
3220
+ '\u1E95': 'z',
3221
+ '\u01B6': 'z',
3222
+ '\u0225': 'z',
3223
+ '\u0240': 'z',
3224
+ '\u2C6C': 'z',
3225
+ '\uA763': 'z',
3226
+ '\u0386': '\u0391',
3227
+ '\u0388': '\u0395',
3228
+ '\u0389': '\u0397',
3229
+ '\u038A': '\u0399',
3230
+ '\u03AA': '\u0399',
3231
+ '\u038C': '\u039F',
3232
+ '\u038E': '\u03A5',
3233
+ '\u03AB': '\u03A5',
3234
+ '\u038F': '\u03A9',
3235
+ '\u03AC': '\u03B1',
3236
+ '\u03AD': '\u03B5',
3237
+ '\u03AE': '\u03B7',
3238
+ '\u03AF': '\u03B9',
3239
+ '\u03CA': '\u03B9',
3240
+ '\u0390': '\u03B9',
3241
+ '\u03CC': '\u03BF',
3242
+ '\u03CD': '\u03C5',
3243
+ '\u03CB': '\u03C5',
3244
+ '\u03B0': '\u03C5',
3245
+ '\u03CE': '\u03C9',
3246
+ '\u03C2': '\u03C3',
3247
+ '\u2019': '\''
3248
+ };
3249
+
3250
+ return diacritics;
3251
+ });
3252
+
3253
+ S2.define('select2/data/base',[
3254
+ '../utils'
3255
+ ], function (Utils) {
3256
+ function BaseAdapter ($element, options) {
3257
+ BaseAdapter.__super__.constructor.call(this);
3258
+ }
3259
+
3260
+ Utils.Extend(BaseAdapter, Utils.Observable);
3261
+
3262
+ BaseAdapter.prototype.current = function (callback) {
3263
+ throw new Error('The `current` method must be defined in child classes.');
3264
+ };
3265
+
3266
+ BaseAdapter.prototype.query = function (params, callback) {
3267
+ throw new Error('The `query` method must be defined in child classes.');
3268
+ };
3269
+
3270
+ BaseAdapter.prototype.bind = function (container, $container) {
3271
+ // Can be implemented in subclasses
3272
+ };
3273
+
3274
+ BaseAdapter.prototype.destroy = function () {
3275
+ // Can be implemented in subclasses
3276
+ };
3277
+
3278
+ BaseAdapter.prototype.generateResultId = function (container, data) {
3279
+ var id = container.id + '-result-';
3280
+
3281
+ id += Utils.generateChars(4);
3282
+
3283
+ if (data.id != null) {
3284
+ id += '-' + data.id.toString();
3285
+ } else {
3286
+ id += '-' + Utils.generateChars(4);
3287
+ }
3288
+ return id;
3289
+ };
3290
+
3291
+ return BaseAdapter;
3292
+ });
3293
+
3294
+ S2.define('select2/data/select',[
3295
+ './base',
3296
+ '../utils',
3297
+ 'jquery'
3298
+ ], function (BaseAdapter, Utils, $) {
3299
+ function SelectAdapter ($element, options) {
3300
+ this.$element = $element;
3301
+ this.options = options;
3302
+
3303
+ SelectAdapter.__super__.constructor.call(this);
3304
+ }
3305
+
3306
+ Utils.Extend(SelectAdapter, BaseAdapter);
3307
+
3308
+ SelectAdapter.prototype.current = function (callback) {
3309
+ var self = this;
3310
+
3311
+ var data = Array.prototype.map.call(
3312
+ this.$element[0].querySelectorAll(':checked'),
3313
+ function (selectedElement) {
3314
+ return self.item($(selectedElement));
3315
+ }
3316
+ );
3317
+
3318
+ callback(data);
3319
+ };
3320
+
3321
+ SelectAdapter.prototype.select = function (data) {
3322
+ var self = this;
3323
+
3324
+ data.selected = true;
3325
+
3326
+ // If data.element is a DOM node, use it instead
3327
+ if (
3328
+ data.element != null && data.element.tagName.toLowerCase() === 'option'
3329
+ ) {
3330
+ data.element.selected = true;
3331
+
3332
+ this.$element.trigger('input').trigger('change');
3333
+
3334
+ return;
3335
+ }
3336
+
3337
+ if (this.$element.prop('multiple')) {
3338
+ this.current(function (currentData) {
3339
+ var val = [];
3340
+
3341
+ data = [data];
3342
+ data.push.apply(data, currentData);
3343
+
3344
+ for (var d = 0; d < data.length; d++) {
3345
+ var id = data[d].id;
3346
+
3347
+ if (val.indexOf(id) === -1) {
3348
+ val.push(id);
3349
+ }
3350
+ }
3351
+
3352
+ self.$element.val(val);
3353
+ self.$element.trigger('input').trigger('change');
3354
+ });
3355
+ } else {
3356
+ var val = data.id;
3357
+
3358
+ this.$element.val(val);
3359
+ this.$element.trigger('input').trigger('change');
3360
+ }
3361
+ };
3362
+
3363
+ SelectAdapter.prototype.unselect = function (data) {
3364
+ var self = this;
3365
+
3366
+ if (!this.$element.prop('multiple')) {
3367
+ return;
3368
+ }
3369
+
3370
+ data.selected = false;
3371
+
3372
+ if (
3373
+ data.element != null &&
3374
+ data.element.tagName.toLowerCase() === 'option'
3375
+ ) {
3376
+ data.element.selected = false;
3377
+
3378
+ this.$element.trigger('input').trigger('change');
3379
+
3380
+ return;
3381
+ }
3382
+
3383
+ this.current(function (currentData) {
3384
+ var val = [];
3385
+
3386
+ for (var d = 0; d < currentData.length; d++) {
3387
+ var id = currentData[d].id;
3388
+
3389
+ if (id !== data.id && val.indexOf(id) === -1) {
3390
+ val.push(id);
3391
+ }
3392
+ }
3393
+
3394
+ self.$element.val(val);
3395
+
3396
+ self.$element.trigger('input').trigger('change');
3397
+ });
3398
+ };
3399
+
3400
+ SelectAdapter.prototype.bind = function (container, $container) {
3401
+ var self = this;
3402
+
3403
+ this.container = container;
3404
+
3405
+ container.on('select', function (params) {
3406
+ self.select(params.data);
3407
+ });
3408
+
3409
+ container.on('unselect', function (params) {
3410
+ self.unselect(params.data);
3411
+ });
3412
+ };
3413
+
3414
+ SelectAdapter.prototype.destroy = function () {
3415
+ // Remove anything added to child elements
3416
+ this.$element.find('*').each(function () {
3417
+ // Remove any custom data set by Select2
3418
+ Utils.RemoveData(this);
3419
+ });
3420
+ };
3421
+
3422
+ SelectAdapter.prototype.query = function (params, callback) {
3423
+ var data = [];
3424
+ var self = this;
3425
+
3426
+ var $options = this.$element.children();
3427
+
3428
+ $options.each(function () {
3429
+ if (
3430
+ this.tagName.toLowerCase() !== 'option' &&
3431
+ this.tagName.toLowerCase() !== 'optgroup'
3432
+ ) {
3433
+ return;
3434
+ }
3435
+
3436
+ var $option = $(this);
3437
+
3438
+ var option = self.item($option);
3439
+
3440
+ var matches = self.matches(params, option);
3441
+
3442
+ if (matches !== null) {
3443
+ data.push(matches);
3444
+ }
3445
+ });
3446
+
3447
+ callback({
3448
+ results: data
3449
+ });
3450
+ };
3451
+
3452
+ SelectAdapter.prototype.addOptions = function ($options) {
3453
+ this.$element.append($options);
3454
+ };
3455
+
3456
+ SelectAdapter.prototype.option = function (data) {
3457
+ var option;
3458
+
3459
+ if (data.children) {
3460
+ option = document.createElement('optgroup');
3461
+ option.label = data.text;
3462
+ } else {
3463
+ option = document.createElement('option');
3464
+
3465
+ if (option.textContent !== undefined) {
3466
+ option.textContent = data.text;
3467
+ } else {
3468
+ option.innerText = data.text;
3469
+ }
3470
+ }
3471
+
3472
+ if (data.id !== undefined) {
3473
+ option.value = data.id;
3474
+ }
3475
+
3476
+ if (data.disabled) {
3477
+ option.disabled = true;
3478
+ }
3479
+
3480
+ if (data.selected) {
3481
+ option.selected = true;
3482
+ }
3483
+
3484
+ if (data.title) {
3485
+ option.title = data.title;
3486
+ }
3487
+
3488
+ var normalizedData = this._normalizeItem(data);
3489
+ normalizedData.element = option;
3490
+
3491
+ // Override the option's data with the combined data
3492
+ Utils.StoreData(option, 'data', normalizedData);
3493
+
3494
+ return $(option);
3495
+ };
3496
+
3497
+ SelectAdapter.prototype.item = function ($option) {
3498
+ var data = {};
3499
+
3500
+ data = Utils.GetData($option[0], 'data');
3501
+
3502
+ if (data != null) {
3503
+ return data;
3504
+ }
3505
+
3506
+ var option = $option[0];
3507
+
3508
+ if (option.tagName.toLowerCase() === 'option') {
3509
+ data = {
3510
+ id: $option.val(),
3511
+ text: $option.text(),
3512
+ disabled: $option.prop('disabled'),
3513
+ selected: $option.prop('selected'),
3514
+ title: $option.prop('title')
3515
+ };
3516
+ } else if (option.tagName.toLowerCase() === 'optgroup') {
3517
+ data = {
3518
+ text: $option.prop('label'),
3519
+ children: [],
3520
+ title: $option.prop('title')
3521
+ };
3522
+
3523
+ var $children = $option.children('option');
3524
+ var children = [];
3525
+
3526
+ for (var c = 0; c < $children.length; c++) {
3527
+ var $child = $($children[c]);
3528
+
3529
+ var child = this.item($child);
3530
+
3531
+ children.push(child);
3532
+ }
3533
+
3534
+ data.children = children;
3535
+ }
3536
+
3537
+ data = this._normalizeItem(data);
3538
+ data.element = $option[0];
3539
+
3540
+ Utils.StoreData($option[0], 'data', data);
3541
+
3542
+ return data;
3543
+ };
3544
+
3545
+ SelectAdapter.prototype._normalizeItem = function (item) {
3546
+ if (item !== Object(item)) {
3547
+ item = {
3548
+ id: item,
3549
+ text: item
3550
+ };
3551
+ }
3552
+
3553
+ item = $.extend({}, {
3554
+ text: ''
3555
+ }, item);
3556
+
3557
+ var defaults = {
3558
+ selected: false,
3559
+ disabled: false
3560
+ };
3561
+
3562
+ if (item.id != null) {
3563
+ item.id = item.id.toString();
3564
+ }
3565
+
3566
+ if (item.text != null) {
3567
+ item.text = item.text.toString();
3568
+ }
3569
+
3570
+ if (item._resultId == null && item.id && this.container != null) {
3571
+ item._resultId = this.generateResultId(this.container, item);
3572
+ }
3573
+
3574
+ return $.extend({}, defaults, item);
3575
+ };
3576
+
3577
+ SelectAdapter.prototype.matches = function (params, data) {
3578
+ var matcher = this.options.get('matcher');
3579
+
3580
+ return matcher(params, data);
3581
+ };
3582
+
3583
+ return SelectAdapter;
3584
+ });
3585
+
3586
+ S2.define('select2/data/array',[
3587
+ './select',
3588
+ '../utils',
3589
+ 'jquery'
3590
+ ], function (SelectAdapter, Utils, $) {
3591
+ function ArrayAdapter ($element, options) {
3592
+ this._dataToConvert = options.get('data') || [];
3593
+
3594
+ ArrayAdapter.__super__.constructor.call(this, $element, options);
3595
+ }
3596
+
3597
+ Utils.Extend(ArrayAdapter, SelectAdapter);
3598
+
3599
+ ArrayAdapter.prototype.bind = function (container, $container) {
3600
+ ArrayAdapter.__super__.bind.call(this, container, $container);
3601
+
3602
+ this.addOptions(this.convertToOptions(this._dataToConvert));
3603
+ };
3604
+
3605
+ ArrayAdapter.prototype.select = function (data) {
3606
+ var $option = this.$element.find('option').filter(function (i, elm) {
3607
+ return elm.value == data.id.toString();
3608
+ });
3609
+
3610
+ if ($option.length === 0) {
3611
+ $option = this.option(data);
3612
+
3613
+ this.addOptions($option);
3614
+ }
3615
+
3616
+ ArrayAdapter.__super__.select.call(this, data);
3617
+ };
3618
+
3619
+ ArrayAdapter.prototype.convertToOptions = function (data) {
3620
+ var self = this;
3621
+
3622
+ var $existing = this.$element.find('option');
3623
+ var existingIds = $existing.map(function () {
3624
+ return self.item($(this)).id;
3625
+ }).get();
3626
+
3627
+ var $options = [];
3628
+
3629
+ // Filter out all items except for the one passed in the argument
3630
+ function onlyItem (item) {
3631
+ return function () {
3632
+ return $(this).val() == item.id;
3633
+ };
3634
+ }
3635
+
3636
+ for (var d = 0; d < data.length; d++) {
3637
+ var item = this._normalizeItem(data[d]);
3638
+
3639
+ // Skip items which were pre-loaded, only merge the data
3640
+ if (existingIds.indexOf(item.id) >= 0) {
3641
+ var $existingOption = $existing.filter(onlyItem(item));
3642
+
3643
+ var existingData = this.item($existingOption);
3644
+ var newData = $.extend(true, {}, item, existingData);
3645
+
3646
+ var $newOption = this.option(newData);
3647
+
3648
+ $existingOption.replaceWith($newOption);
3649
+
3650
+ continue;
3651
+ }
3652
+
3653
+ var $option = this.option(item);
3654
+
3655
+ if (item.children) {
3656
+ var $children = this.convertToOptions(item.children);
3657
+
3658
+ $option.append($children);
3659
+ }
3660
+
3661
+ $options.push($option);
3662
+ }
3663
+
3664
+ return $options;
3665
+ };
3666
+
3667
+ return ArrayAdapter;
3668
+ });
3669
+
3670
+ S2.define('select2/data/ajax',[
3671
+ './array',
3672
+ '../utils',
3673
+ 'jquery'
3674
+ ], function (ArrayAdapter, Utils, $) {
3675
+ function AjaxAdapter ($element, options) {
3676
+ this.ajaxOptions = this._applyDefaults(options.get('ajax'));
3677
+
3678
+ if (this.ajaxOptions.processResults != null) {
3679
+ this.processResults = this.ajaxOptions.processResults;
3680
+ }
3681
+
3682
+ AjaxAdapter.__super__.constructor.call(this, $element, options);
3683
+ }
3684
+
3685
+ Utils.Extend(AjaxAdapter, ArrayAdapter);
3686
+
3687
+ AjaxAdapter.prototype._applyDefaults = function (options) {
3688
+ var defaults = {
3689
+ data: function (params) {
3690
+ return $.extend({}, params, {
3691
+ q: params.term
3692
+ });
3693
+ },
3694
+ transport: function (params, success, failure) {
3695
+ var $request = $.ajax(params);
3696
+
3697
+ $request.then(success);
3698
+ $request.fail(failure);
3699
+
3700
+ return $request;
3701
+ }
3702
+ };
3703
+
3704
+ return $.extend({}, defaults, options, true);
3705
+ };
3706
+
3707
+ AjaxAdapter.prototype.processResults = function (results) {
3708
+ return results;
3709
+ };
3710
+
3711
+ AjaxAdapter.prototype.query = function (params, callback) {
3712
+ var matches = [];
3713
+ var self = this;
3714
+
3715
+ if (this._request != null) {
3716
+ // JSONP requests cannot always be aborted
3717
+ if (typeof this._request.abort === 'function') {
3718
+ this._request.abort();
3719
+ }
3720
+
3721
+ this._request = null;
3722
+ }
3723
+
3724
+ var options = $.extend({
3725
+ type: 'GET'
3726
+ }, this.ajaxOptions);
3727
+
3728
+ if (typeof options.url === 'function') {
3729
+ options.url = options.url.call(this.$element, params);
3730
+ }
3731
+
3732
+ if (typeof options.data === 'function') {
3733
+ options.data = options.data.call(this.$element, params);
3734
+ }
3735
+
3736
+ function request () {
3737
+ var $request = options.transport(options, function (data) {
3738
+ var results = self.processResults(data, params);
3739
+
3740
+ if (self.options.get('debug') && window.console && console.error) {
3741
+ // Check to make sure that the response included a `results` key.
3742
+ if (!results || !results.results || !Array.isArray(results.results)) {
3743
+ console.error(
3744
+ 'Select2: The AJAX results did not return an array in the ' +
3745
+ '`results` key of the response.'
3746
+ );
3747
+ }
3748
+ }
3749
+
3750
+ callback(results);
3751
+ }, function () {
3752
+ // Attempt to detect if a request was aborted
3753
+ // Only works if the transport exposes a status property
3754
+ if ('status' in $request &&
3755
+ ($request.status === 0 || $request.status === '0')) {
3756
+ return;
3757
+ }
3758
+
3759
+ self.trigger('results:message', {
3760
+ message: 'errorLoading'
3761
+ });
3762
+ });
3763
+
3764
+ self._request = $request;
3765
+ }
3766
+
3767
+ if (this.ajaxOptions.delay && params.term != null) {
3768
+ if (this._queryTimeout) {
3769
+ window.clearTimeout(this._queryTimeout);
3770
+ }
3771
+
3772
+ this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
3773
+ } else {
3774
+ request();
3775
+ }
3776
+ };
3777
+
3778
+ return AjaxAdapter;
3779
+ });
3780
+
3781
+ S2.define('select2/data/tags',[
3782
+ 'jquery'
3783
+ ], function ($) {
3784
+ function Tags (decorated, $element, options) {
3785
+ var tags = options.get('tags');
3786
+
3787
+ var createTag = options.get('createTag');
3788
+
3789
+ if (createTag !== undefined) {
3790
+ this.createTag = createTag;
3791
+ }
3792
+
3793
+ var insertTag = options.get('insertTag');
3794
+
3795
+ if (insertTag !== undefined) {
3796
+ this.insertTag = insertTag;
3797
+ }
3798
+
3799
+ decorated.call(this, $element, options);
3800
+
3801
+ if (Array.isArray(tags)) {
3802
+ for (var t = 0; t < tags.length; t++) {
3803
+ var tag = tags[t];
3804
+ var item = this._normalizeItem(tag);
3805
+
3806
+ var $option = this.option(item);
3807
+
3808
+ this.$element.append($option);
3809
+ }
3810
+ }
3811
+ }
3812
+
3813
+ Tags.prototype.query = function (decorated, params, callback) {
3814
+ var self = this;
3815
+
3816
+ this._removeOldTags();
3817
+
3818
+ if (params.term == null || params.page != null) {
3819
+ decorated.call(this, params, callback);
3820
+ return;
3821
+ }
3822
+
3823
+ function wrapper (obj, child) {
3824
+ var data = obj.results;
3825
+
3826
+ for (var i = 0; i < data.length; i++) {
3827
+ var option = data[i];
3828
+
3829
+ var checkChildren = (
3830
+ option.children != null &&
3831
+ !wrapper({
3832
+ results: option.children
3833
+ }, true)
3834
+ );
3835
+
3836
+ var optionText = (option.text || '').toUpperCase();
3837
+ var paramsTerm = (params.term || '').toUpperCase();
3838
+
3839
+ var checkText = optionText === paramsTerm;
3840
+
3841
+ if (checkText || checkChildren) {
3842
+ if (child) {
3843
+ return false;
3844
+ }
3845
+
3846
+ obj.data = data;
3847
+ callback(obj);
3848
+
3849
+ return;
3850
+ }
3851
+ }
3852
+
3853
+ if (child) {
3854
+ return true;
3855
+ }
3856
+
3857
+ var tag = self.createTag(params);
3858
+
3859
+ if (tag != null) {
3860
+ var $option = self.option(tag);
3861
+ $option.attr('data-select2-tag', 'true');
3862
+
3863
+ self.addOptions([$option]);
3864
+
3865
+ self.insertTag(data, tag);
3866
+ }
3867
+
3868
+ obj.results = data;
3869
+
3870
+ callback(obj);
3871
+ }
3872
+
3873
+ decorated.call(this, params, wrapper);
3874
+ };
3875
+
3876
+ Tags.prototype.createTag = function (decorated, params) {
3877
+ if (params.term == null) {
3878
+ return null;
3879
+ }
3880
+
3881
+ var term = params.term.trim();
3882
+
3883
+ if (term === '') {
3884
+ return null;
3885
+ }
3886
+
3887
+ return {
3888
+ id: term,
3889
+ text: term
3890
+ };
3891
+ };
3892
+
3893
+ Tags.prototype.insertTag = function (_, data, tag) {
3894
+ data.unshift(tag);
3895
+ };
3896
+
3897
+ Tags.prototype._removeOldTags = function (_) {
3898
+ var $options = this.$element.find('option[data-select2-tag]');
3899
+
3900
+ $options.each(function () {
3901
+ if (this.selected) {
3902
+ return;
3903
+ }
3904
+
3905
+ $(this).remove();
3906
+ });
3907
+ };
3908
+
3909
+ return Tags;
3910
+ });
3911
+
3912
+ S2.define('select2/data/tokenizer',[
3913
+ 'jquery'
3914
+ ], function ($) {
3915
+ function Tokenizer (decorated, $element, options) {
3916
+ var tokenizer = options.get('tokenizer');
3917
+
3918
+ if (tokenizer !== undefined) {
3919
+ this.tokenizer = tokenizer;
3920
+ }
3921
+
3922
+ decorated.call(this, $element, options);
3923
+ }
3924
+
3925
+ Tokenizer.prototype.bind = function (decorated, container, $container) {
3926
+ decorated.call(this, container, $container);
3927
+
3928
+ this.$search = container.dropdown.$search || container.selection.$search ||
3929
+ $container.find('.select2-search__field');
3930
+ };
3931
+
3932
+ Tokenizer.prototype.query = function (decorated, params, callback) {
3933
+ var self = this;
3934
+
3935
+ function createAndSelect (data) {
3936
+ // Normalize the data object so we can use it for checks
3937
+ var item = self._normalizeItem(data);
3938
+
3939
+ // Check if the data object already exists as a tag
3940
+ // Select it if it doesn't
3941
+ var $existingOptions = self.$element.find('option').filter(function () {
3942
+ return $(this).val() === item.id;
3943
+ });
3944
+
3945
+ // If an existing option wasn't found for it, create the option
3946
+ if (!$existingOptions.length) {
3947
+ var $option = self.option(item);
3948
+ $option.attr('data-select2-tag', true);
3949
+
3950
+ self._removeOldTags();
3951
+ self.addOptions([$option]);
3952
+ }
3953
+
3954
+ // Select the item, now that we know there is an option for it
3955
+ select(item);
3956
+ }
3957
+
3958
+ function select (data) {
3959
+ self.trigger('select', {
3960
+ data: data
3961
+ });
3962
+ }
3963
+
3964
+ params.term = params.term || '';
3965
+
3966
+ var tokenData = this.tokenizer(params, this.options, createAndSelect);
3967
+
3968
+ if (tokenData.term !== params.term) {
3969
+ // Replace the search term if we have the search box
3970
+ if (this.$search.length) {
3971
+ this.$search.val(tokenData.term);
3972
+ this.$search.trigger('focus');
3973
+ }
3974
+
3975
+ params.term = tokenData.term;
3976
+ }
3977
+
3978
+ decorated.call(this, params, callback);
3979
+ };
3980
+
3981
+ Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
3982
+ var separators = options.get('tokenSeparators') || [];
3983
+ var term = params.term;
3984
+ var i = 0;
3985
+
3986
+ var createTag = this.createTag || function (params) {
3987
+ return {
3988
+ id: params.term,
3989
+ text: params.term
3990
+ };
3991
+ };
3992
+
3993
+ while (i < term.length) {
3994
+ var termChar = term[i];
3995
+
3996
+ if (separators.indexOf(termChar) === -1) {
3997
+ i++;
3998
+
3999
+ continue;
4000
+ }
4001
+
4002
+ var part = term.substr(0, i);
4003
+ var partParams = $.extend({}, params, {
4004
+ term: part
4005
+ });
4006
+
4007
+ var data = createTag(partParams);
4008
+
4009
+ if (data == null) {
4010
+ i++;
4011
+ continue;
4012
+ }
4013
+
4014
+ callback(data);
4015
+
4016
+ // Reset the term to not include the tokenized portion
4017
+ term = term.substr(i + 1) || '';
4018
+ i = 0;
4019
+ }
4020
+
4021
+ return {
4022
+ term: term
4023
+ };
4024
+ };
4025
+
4026
+ return Tokenizer;
4027
+ });
4028
+
4029
+ S2.define('select2/data/minimumInputLength',[
4030
+
4031
+ ], function () {
4032
+ function MinimumInputLength (decorated, $e, options) {
4033
+ this.minimumInputLength = options.get('minimumInputLength');
4034
+
4035
+ decorated.call(this, $e, options);
4036
+ }
4037
+
4038
+ MinimumInputLength.prototype.query = function (decorated, params, callback) {
4039
+ params.term = params.term || '';
4040
+
4041
+ if (params.term.length < this.minimumInputLength) {
4042
+ this.trigger('results:message', {
4043
+ message: 'inputTooShort',
4044
+ args: {
4045
+ minimum: this.minimumInputLength,
4046
+ input: params.term,
4047
+ params: params
4048
+ }
4049
+ });
4050
+
4051
+ return;
4052
+ }
4053
+
4054
+ decorated.call(this, params, callback);
4055
+ };
4056
+
4057
+ return MinimumInputLength;
4058
+ });
4059
+
4060
+ S2.define('select2/data/maximumInputLength',[
4061
+
4062
+ ], function () {
4063
+ function MaximumInputLength (decorated, $e, options) {
4064
+ this.maximumInputLength = options.get('maximumInputLength');
4065
+
4066
+ decorated.call(this, $e, options);
4067
+ }
4068
+
4069
+ MaximumInputLength.prototype.query = function (decorated, params, callback) {
4070
+ params.term = params.term || '';
4071
+
4072
+ if (this.maximumInputLength > 0 &&
4073
+ params.term.length > this.maximumInputLength) {
4074
+ this.trigger('results:message', {
4075
+ message: 'inputTooLong',
4076
+ args: {
4077
+ maximum: this.maximumInputLength,
4078
+ input: params.term,
4079
+ params: params
4080
+ }
4081
+ });
4082
+
4083
+ return;
4084
+ }
4085
+
4086
+ decorated.call(this, params, callback);
4087
+ };
4088
+
4089
+ return MaximumInputLength;
4090
+ });
4091
+
4092
+ S2.define('select2/data/maximumSelectionLength',[
4093
+
4094
+ ], function (){
4095
+ function MaximumSelectionLength (decorated, $e, options) {
4096
+ this.maximumSelectionLength = options.get('maximumSelectionLength');
4097
+
4098
+ decorated.call(this, $e, options);
4099
+ }
4100
+
4101
+ MaximumSelectionLength.prototype.bind =
4102
+ function (decorated, container, $container) {
4103
+ var self = this;
4104
+
4105
+ decorated.call(this, container, $container);
4106
+
4107
+ container.on('select', function () {
4108
+ self._checkIfMaximumSelected();
4109
+ });
4110
+ };
4111
+
4112
+ MaximumSelectionLength.prototype.query =
4113
+ function (decorated, params, callback) {
4114
+ var self = this;
4115
+
4116
+ this._checkIfMaximumSelected(function () {
4117
+ decorated.call(self, params, callback);
4118
+ });
4119
+ };
4120
+
4121
+ MaximumSelectionLength.prototype._checkIfMaximumSelected =
4122
+ function (_, successCallback) {
4123
+ var self = this;
4124
+
4125
+ this.current(function (currentData) {
4126
+ var count = currentData != null ? currentData.length : 0;
4127
+ if (self.maximumSelectionLength > 0 &&
4128
+ count >= self.maximumSelectionLength) {
4129
+ self.trigger('results:message', {
4130
+ message: 'maximumSelected',
4131
+ args: {
4132
+ maximum: self.maximumSelectionLength
4133
+ }
4134
+ });
4135
+ return;
4136
+ }
4137
+
4138
+ if (successCallback) {
4139
+ successCallback();
4140
+ }
4141
+ });
4142
+ };
4143
+
4144
+ return MaximumSelectionLength;
4145
+ });
4146
+
4147
+ S2.define('select2/dropdown',[
4148
+ 'jquery',
4149
+ './utils'
4150
+ ], function ($, Utils) {
4151
+ function Dropdown ($element, options) {
4152
+ this.$element = $element;
4153
+ this.options = options;
4154
+
4155
+ Dropdown.__super__.constructor.call(this);
4156
+ }
4157
+
4158
+ Utils.Extend(Dropdown, Utils.Observable);
4159
+
4160
+ Dropdown.prototype.render = function () {
4161
+ var $dropdown = $(
4162
+ '<span class="select2-dropdown">' +
4163
+ '<span class="select2-results"></span>' +
4164
+ '</span>'
4165
+ );
4166
+
4167
+ $dropdown.attr('dir', this.options.get('dir'));
4168
+
4169
+ this.$dropdown = $dropdown;
4170
+
4171
+ return $dropdown;
4172
+ };
4173
+
4174
+ Dropdown.prototype.bind = function () {
4175
+ // Should be implemented in subclasses
4176
+ };
4177
+
4178
+ Dropdown.prototype.position = function ($dropdown, $container) {
4179
+ // Should be implemented in subclasses
4180
+ };
4181
+
4182
+ Dropdown.prototype.destroy = function () {
4183
+ // Remove the dropdown from the DOM
4184
+ this.$dropdown.remove();
4185
+ };
4186
+
4187
+ return Dropdown;
4188
+ });
4189
+
4190
+ S2.define('select2/dropdown/search',[
4191
+ 'jquery'
4192
+ ], function ($) {
4193
+ function Search () { }
4194
+
4195
+ Search.prototype.render = function (decorated) {
4196
+ var $rendered = decorated.call(this);
4197
+ var searchLabel = this.options.get('translations').get('search');
4198
+
4199
+ var $search = $(
4200
+ '<span class="select2-search select2-search--dropdown">' +
4201
+ '<input class="select2-search__field" type="search" tabindex="-1"' +
4202
+ ' autocorrect="off" autocapitalize="none"' +
4203
+ ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' +
4204
+ '</span>'
4205
+ );
4206
+
4207
+ this.$searchContainer = $search;
4208
+ this.$search = $search.find('input');
4209
+
4210
+ this.$search.prop('autocomplete', this.options.get('autocomplete'));
4211
+ this.$search.attr('aria-label', searchLabel());
4212
+
4213
+ $rendered.prepend($search);
4214
+
4215
+ return $rendered;
4216
+ };
4217
+
4218
+ Search.prototype.bind = function (decorated, container, $container) {
4219
+ var self = this;
4220
+
4221
+ var resultsId = container.id + '-results';
4222
+
4223
+ decorated.call(this, container, $container);
4224
+
4225
+ this.$search.on('keydown', function (evt) {
4226
+ self.trigger('keypress', evt);
4227
+
4228
+ self._keyUpPrevented = evt.isDefaultPrevented();
4229
+ });
4230
+
4231
+ // Workaround for browsers which do not support the `input` event
4232
+ // This will prevent double-triggering of events for browsers which support
4233
+ // both the `keyup` and `input` events.
4234
+ this.$search.on('input', function (evt) {
4235
+ // Unbind the duplicated `keyup` event
4236
+ $(this).off('keyup');
4237
+ });
4238
+
4239
+ this.$search.on('keyup input', function (evt) {
4240
+ self.handleSearch(evt);
4241
+ });
4242
+
4243
+ container.on('open', function () {
4244
+ self.$search.attr('tabindex', 0);
4245
+ self.$search.attr('aria-controls', resultsId);
4246
+
4247
+ self.$search.trigger('focus');
4248
+
4249
+ window.setTimeout(function () {
4250
+ self.$search.trigger('focus');
4251
+ }, 0);
4252
+ });
4253
+
4254
+ container.on('close', function () {
4255
+ self.$search.attr('tabindex', -1);
4256
+ self.$search.removeAttr('aria-controls');
4257
+ self.$search.removeAttr('aria-activedescendant');
4258
+
4259
+ self.$search.val('');
4260
+ self.$search.trigger('blur');
4261
+ });
4262
+
4263
+ container.on('focus', function () {
4264
+ if (!container.isOpen()) {
4265
+ self.$search.trigger('focus');
4266
+ }
4267
+ });
4268
+
4269
+ container.on('results:all', function (params) {
4270
+ if (params.query.term == null || params.query.term === '') {
4271
+ var showSearch = self.showSearch(params);
4272
+
4273
+ if (showSearch) {
4274
+ self.$searchContainer[0].classList.remove('select2-search--hide');
4275
+ } else {
4276
+ self.$searchContainer[0].classList.add('select2-search--hide');
4277
+ }
4278
+ }
4279
+ });
4280
+
4281
+ container.on('results:focus', function (params) {
4282
+ if (params.data._resultId) {
4283
+ self.$search.attr('aria-activedescendant', params.data._resultId);
4284
+ } else {
4285
+ self.$search.removeAttr('aria-activedescendant');
4286
+ }
4287
+ });
4288
+ };
4289
+
4290
+ Search.prototype.handleSearch = function (evt) {
4291
+ if (!this._keyUpPrevented) {
4292
+ var input = this.$search.val();
4293
+
4294
+ this.trigger('query', {
4295
+ term: input
4296
+ });
4297
+ }
4298
+
4299
+ this._keyUpPrevented = false;
4300
+ };
4301
+
4302
+ Search.prototype.showSearch = function (_, params) {
4303
+ return true;
4304
+ };
4305
+
4306
+ return Search;
4307
+ });
4308
+
4309
+ S2.define('select2/dropdown/hidePlaceholder',[
4310
+
4311
+ ], function () {
4312
+ function HidePlaceholder (decorated, $element, options, dataAdapter) {
4313
+ this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
4314
+
4315
+ decorated.call(this, $element, options, dataAdapter);
4316
+ }
4317
+
4318
+ HidePlaceholder.prototype.append = function (decorated, data) {
4319
+ data.results = this.removePlaceholder(data.results);
4320
+
4321
+ decorated.call(this, data);
4322
+ };
4323
+
4324
+ HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
4325
+ if (typeof placeholder === 'string') {
4326
+ placeholder = {
4327
+ id: '',
4328
+ text: placeholder
4329
+ };
4330
+ }
4331
+
4332
+ return placeholder;
4333
+ };
4334
+
4335
+ HidePlaceholder.prototype.removePlaceholder = function (_, data) {
4336
+ var modifiedData = data.slice(0);
4337
+
4338
+ for (var d = data.length - 1; d >= 0; d--) {
4339
+ var item = data[d];
4340
+
4341
+ if (this.placeholder.id === item.id) {
4342
+ modifiedData.splice(d, 1);
4343
+ }
4344
+ }
4345
+
4346
+ return modifiedData;
4347
+ };
4348
+
4349
+ return HidePlaceholder;
4350
+ });
4351
+
4352
+ S2.define('select2/dropdown/infiniteScroll',[
4353
+ 'jquery'
4354
+ ], function ($) {
4355
+ function InfiniteScroll (decorated, $element, options, dataAdapter) {
4356
+ this.lastParams = {};
4357
+
4358
+ decorated.call(this, $element, options, dataAdapter);
4359
+
4360
+ this.$loadingMore = this.createLoadingMore();
4361
+ this.loading = false;
4362
+ }
4363
+
4364
+ InfiniteScroll.prototype.append = function (decorated, data) {
4365
+ this.$loadingMore.remove();
4366
+ this.loading = false;
4367
+
4368
+ decorated.call(this, data);
4369
+
4370
+ if (this.showLoadingMore(data)) {
4371
+ this.$results.append(this.$loadingMore);
4372
+ this.loadMoreIfNeeded();
4373
+ }
4374
+ };
4375
+
4376
+ InfiniteScroll.prototype.bind = function (decorated, container, $container) {
4377
+ var self = this;
4378
+
4379
+ decorated.call(this, container, $container);
4380
+
4381
+ container.on('query', function (params) {
4382
+ self.lastParams = params;
4383
+ self.loading = true;
4384
+ });
4385
+
4386
+ container.on('query:append', function (params) {
4387
+ self.lastParams = params;
4388
+ self.loading = true;
4389
+ });
4390
+
4391
+ this.$results.on('scroll', this.loadMoreIfNeeded.bind(this));
4392
+ };
4393
+
4394
+ InfiniteScroll.prototype.loadMoreIfNeeded = function () {
4395
+ var isLoadMoreVisible = $.contains(
4396
+ document.documentElement,
4397
+ this.$loadingMore[0]
4398
+ );
4399
+
4400
+ if (this.loading || !isLoadMoreVisible) {
4401
+ return;
4402
+ }
4403
+
4404
+ var currentOffset = this.$results.offset().top +
4405
+ this.$results.outerHeight(false);
4406
+ var loadingMoreOffset = this.$loadingMore.offset().top +
4407
+ this.$loadingMore.outerHeight(false);
4408
+
4409
+ if (currentOffset + 50 >= loadingMoreOffset) {
4410
+ this.loadMore();
4411
+ }
4412
+ };
4413
+
4414
+ InfiniteScroll.prototype.loadMore = function () {
4415
+ this.loading = true;
4416
+
4417
+ var params = $.extend({}, {page: 1}, this.lastParams);
4418
+
4419
+ params.page++;
4420
+
4421
+ this.trigger('query:append', params);
4422
+ };
4423
+
4424
+ InfiniteScroll.prototype.showLoadingMore = function (_, data) {
4425
+ return data.pagination && data.pagination.more;
4426
+ };
4427
+
4428
+ InfiniteScroll.prototype.createLoadingMore = function () {
4429
+ var $option = $(
4430
+ '<li ' +
4431
+ 'class="select2-results__option select2-results__option--load-more"' +
4432
+ 'role="option" aria-disabled="true"></li>'
4433
+ );
4434
+
4435
+ var message = this.options.get('translations').get('loadingMore');
4436
+
4437
+ $option.html(message(this.lastParams));
4438
+
4439
+ return $option;
4440
+ };
4441
+
4442
+ return InfiniteScroll;
4443
+ });
4444
+
4445
+ S2.define('select2/dropdown/attachBody',[
4446
+ 'jquery',
4447
+ '../utils'
4448
+ ], function ($, Utils) {
4449
+ function AttachBody (decorated, $element, options) {
4450
+ this.$dropdownParent = $(options.get('dropdownParent') || document.body);
4451
+
4452
+ decorated.call(this, $element, options);
4453
+ }
4454
+
4455
+ AttachBody.prototype.bind = function (decorated, container, $container) {
4456
+ var self = this;
4457
+
4458
+ decorated.call(this, container, $container);
4459
+
4460
+ container.on('open', function () {
4461
+ self._showDropdown();
4462
+ self._attachPositioningHandler(container);
4463
+
4464
+ // Must bind after the results handlers to ensure correct sizing
4465
+ self._bindContainerResultHandlers(container);
4466
+ });
4467
+
4468
+ container.on('close', function () {
4469
+ self._hideDropdown();
4470
+ self._detachPositioningHandler(container);
4471
+ });
4472
+
4473
+ this.$dropdownContainer.on('mousedown', function (evt) {
4474
+ evt.stopPropagation();
4475
+ });
4476
+ };
4477
+
4478
+ AttachBody.prototype.destroy = function (decorated) {
4479
+ decorated.call(this);
4480
+
4481
+ this.$dropdownContainer.remove();
4482
+ };
4483
+
4484
+ AttachBody.prototype.position = function (decorated, $dropdown, $container) {
4485
+ // Clone all of the container classes
4486
+ $dropdown.attr('class', $container.attr('class'));
4487
+
4488
+ $dropdown[0].classList.remove('select2');
4489
+ $dropdown[0].classList.add('select2-container--open');
4490
+
4491
+ $dropdown.css({
4492
+ position: 'absolute',
4493
+ top: -999999
4494
+ });
4495
+
4496
+ this.$container = $container;
4497
+ };
4498
+
4499
+ AttachBody.prototype.render = function (decorated) {
4500
+ var $container = $('<span></span>');
4501
+
4502
+ var $dropdown = decorated.call(this);
4503
+ $container.append($dropdown);
4504
+
4505
+ this.$dropdownContainer = $container;
4506
+
4507
+ return $container;
4508
+ };
4509
+
4510
+ AttachBody.prototype._hideDropdown = function (decorated) {
4511
+ this.$dropdownContainer.detach();
4512
+ };
4513
+
4514
+ AttachBody.prototype._bindContainerResultHandlers =
4515
+ function (decorated, container) {
4516
+
4517
+ // These should only be bound once
4518
+ if (this._containerResultsHandlersBound) {
4519
+ return;
4520
+ }
4521
+
4522
+ var self = this;
4523
+
4524
+ container.on('results:all', function () {
4525
+ self._positionDropdown();
4526
+ self._resizeDropdown();
4527
+ });
4528
+
4529
+ container.on('results:append', function () {
4530
+ self._positionDropdown();
4531
+ self._resizeDropdown();
4532
+ });
4533
+
4534
+ container.on('results:message', function () {
4535
+ self._positionDropdown();
4536
+ self._resizeDropdown();
4537
+ });
4538
+
4539
+ container.on('select', function () {
4540
+ self._positionDropdown();
4541
+ self._resizeDropdown();
4542
+ });
4543
+
4544
+ container.on('unselect', function () {
4545
+ self._positionDropdown();
4546
+ self._resizeDropdown();
4547
+ });
4548
+
4549
+ this._containerResultsHandlersBound = true;
4550
+ };
4551
+
4552
+ AttachBody.prototype._attachPositioningHandler =
4553
+ function (decorated, container) {
4554
+ var self = this;
4555
+
4556
+ var scrollEvent = 'scroll.select2.' + container.id;
4557
+ var resizeEvent = 'resize.select2.' + container.id;
4558
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4559
+
4560
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4561
+ $watchers.each(function () {
4562
+ Utils.StoreData(this, 'select2-scroll-position', {
4563
+ x: $(this).scrollLeft(),
4564
+ y: $(this).scrollTop()
4565
+ });
4566
+ });
4567
+
4568
+ $watchers.on(scrollEvent, function (ev) {
4569
+ var position = Utils.GetData(this, 'select2-scroll-position');
4570
+ $(this).scrollTop(position.y);
4571
+ });
4572
+
4573
+ $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
4574
+ function (e) {
4575
+ self._positionDropdown();
4576
+ self._resizeDropdown();
4577
+ });
4578
+ };
4579
+
4580
+ AttachBody.prototype._detachPositioningHandler =
4581
+ function (decorated, container) {
4582
+ var scrollEvent = 'scroll.select2.' + container.id;
4583
+ var resizeEvent = 'resize.select2.' + container.id;
4584
+ var orientationEvent = 'orientationchange.select2.' + container.id;
4585
+
4586
+ var $watchers = this.$container.parents().filter(Utils.hasScroll);
4587
+ $watchers.off(scrollEvent);
4588
+
4589
+ $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
4590
+ };
4591
+
4592
+ AttachBody.prototype._positionDropdown = function () {
4593
+ var $window = $(window);
4594
+
4595
+ var isCurrentlyAbove = this.$dropdown[0].classList
4596
+ .contains('select2-dropdown--above');
4597
+ var isCurrentlyBelow = this.$dropdown[0].classList
4598
+ .contains('select2-dropdown--below');
4599
+
4600
+ var newDirection = null;
4601
+
4602
+ var offset = this.$container.offset();
4603
+
4604
+ offset.bottom = offset.top + this.$container.outerHeight(false);
4605
+
4606
+ var container = {
4607
+ height: this.$container.outerHeight(false)
4608
+ };
4609
+
4610
+ container.top = offset.top;
4611
+ container.bottom = offset.top + container.height;
4612
+
4613
+ var dropdown = {
4614
+ height: this.$dropdown.outerHeight(false)
4615
+ };
4616
+
4617
+ var viewport = {
4618
+ top: $window.scrollTop(),
4619
+ bottom: $window.scrollTop() + $window.height()
4620
+ };
4621
+
4622
+ var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
4623
+ var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
4624
+
4625
+ var css = {
4626
+ left: offset.left,
4627
+ top: container.bottom
4628
+ };
4629
+
4630
+ // Determine what the parent element is to use for calculating the offset
4631
+ var $offsetParent = this.$dropdownParent;
4632
+
4633
+ // For statically positioned elements, we need to get the element
4634
+ // that is determining the offset
4635
+ if ($offsetParent.css('position') === 'static') {
4636
+ $offsetParent = $offsetParent.offsetParent();
4637
+ }
4638
+
4639
+ var parentOffset = {
4640
+ top: 0,
4641
+ left: 0
4642
+ };
4643
+
4644
+ if (
4645
+ $.contains(document.body, $offsetParent[0]) ||
4646
+ $offsetParent[0].isConnected
4647
+ ) {
4648
+ parentOffset = $offsetParent.offset();
4649
+ }
4650
+
4651
+ css.top -= parentOffset.top;
4652
+ css.left -= parentOffset.left;
4653
+
4654
+ if (!isCurrentlyAbove && !isCurrentlyBelow) {
4655
+ newDirection = 'below';
4656
+ }
4657
+
4658
+ if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
4659
+ newDirection = 'above';
4660
+ } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
4661
+ newDirection = 'below';
4662
+ }
4663
+
4664
+ if (newDirection == 'above' ||
4665
+ (isCurrentlyAbove && newDirection !== 'below')) {
4666
+ css.top = container.top - parentOffset.top - dropdown.height;
4667
+ }
4668
+
4669
+ if (newDirection != null) {
4670
+ this.$dropdown[0].classList.remove('select2-dropdown--below');
4671
+ this.$dropdown[0].classList.remove('select2-dropdown--above');
4672
+ this.$dropdown[0].classList.add('select2-dropdown--' + newDirection);
4673
+
4674
+ this.$container[0].classList.remove('select2-container--below');
4675
+ this.$container[0].classList.remove('select2-container--above');
4676
+ this.$container[0].classList.add('select2-container--' + newDirection);
4677
+ }
4678
+
4679
+ this.$dropdownContainer.css(css);
4680
+ };
4681
+
4682
+ AttachBody.prototype._resizeDropdown = function () {
4683
+ var css = {
4684
+ width: this.$container.outerWidth(false) + 'px'
4685
+ };
4686
+
4687
+ if (this.options.get('dropdownAutoWidth')) {
4688
+ css.minWidth = css.width;
4689
+ css.position = 'relative';
4690
+ css.width = 'auto';
4691
+ }
4692
+
4693
+ this.$dropdown.css(css);
4694
+ };
4695
+
4696
+ AttachBody.prototype._showDropdown = function (decorated) {
4697
+ this.$dropdownContainer.appendTo(this.$dropdownParent);
4698
+
4699
+ this._positionDropdown();
4700
+ this._resizeDropdown();
4701
+ };
4702
+
4703
+ return AttachBody;
4704
+ });
4705
+
4706
+ S2.define('select2/dropdown/minimumResultsForSearch',[
4707
+
4708
+ ], function () {
4709
+ function countResults (data) {
4710
+ var count = 0;
4711
+
4712
+ for (var d = 0; d < data.length; d++) {
4713
+ var item = data[d];
4714
+
4715
+ if (item.children) {
4716
+ count += countResults(item.children);
4717
+ } else {
4718
+ count++;
4719
+ }
4720
+ }
4721
+
4722
+ return count;
4723
+ }
4724
+
4725
+ function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
4726
+ this.minimumResultsForSearch = options.get('minimumResultsForSearch');
4727
+
4728
+ if (this.minimumResultsForSearch < 0) {
4729
+ this.minimumResultsForSearch = Infinity;
4730
+ }
4731
+
4732
+ decorated.call(this, $element, options, dataAdapter);
4733
+ }
4734
+
4735
+ MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
4736
+ if (countResults(params.data.results) < this.minimumResultsForSearch) {
4737
+ return false;
4738
+ }
4739
+
4740
+ return decorated.call(this, params);
4741
+ };
4742
+
4743
+ return MinimumResultsForSearch;
4744
+ });
4745
+
4746
+ S2.define('select2/dropdown/selectOnClose',[
4747
+ '../utils'
4748
+ ], function (Utils) {
4749
+ function SelectOnClose () { }
4750
+
4751
+ SelectOnClose.prototype.bind = function (decorated, container, $container) {
4752
+ var self = this;
4753
+
4754
+ decorated.call(this, container, $container);
4755
+
4756
+ container.on('close', function (params) {
4757
+ self._handleSelectOnClose(params);
4758
+ });
4759
+ };
4760
+
4761
+ SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
4762
+ if (params && params.originalSelect2Event != null) {
4763
+ var event = params.originalSelect2Event;
4764
+
4765
+ // Don't select an item if the close event was triggered from a select or
4766
+ // unselect event
4767
+ if (event._type === 'select' || event._type === 'unselect') {
4768
+ return;
4769
+ }
4770
+ }
4771
+
4772
+ var $highlightedResults = this.getHighlightedResults();
4773
+
4774
+ // Only select highlighted results
4775
+ if ($highlightedResults.length < 1) {
4776
+ return;
4777
+ }
4778
+
4779
+ var data = Utils.GetData($highlightedResults[0], 'data');
4780
+
4781
+ // Don't re-select already selected resulte
4782
+ if (
4783
+ (data.element != null && data.element.selected) ||
4784
+ (data.element == null && data.selected)
4785
+ ) {
4786
+ return;
4787
+ }
4788
+
4789
+ this.trigger('select', {
4790
+ data: data
4791
+ });
4792
+ };
4793
+
4794
+ return SelectOnClose;
4795
+ });
4796
+
4797
+ S2.define('select2/dropdown/closeOnSelect',[
4798
+
4799
+ ], function () {
4800
+ function CloseOnSelect () { }
4801
+
4802
+ CloseOnSelect.prototype.bind = function (decorated, container, $container) {
4803
+ var self = this;
4804
+
4805
+ decorated.call(this, container, $container);
4806
+
4807
+ container.on('select', function (evt) {
4808
+ self._selectTriggered(evt);
4809
+ });
4810
+
4811
+ container.on('unselect', function (evt) {
4812
+ self._selectTriggered(evt);
4813
+ });
4814
+ };
4815
+
4816
+ CloseOnSelect.prototype._selectTriggered = function (_, evt) {
4817
+ var originalEvent = evt.originalEvent;
4818
+
4819
+ // Don't close if the control key is being held
4820
+ if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) {
4821
+ return;
4822
+ }
4823
+
4824
+ this.trigger('close', {
4825
+ originalEvent: originalEvent,
4826
+ originalSelect2Event: evt
4827
+ });
4828
+ };
4829
+
4830
+ return CloseOnSelect;
4831
+ });
4832
+
4833
+ S2.define('select2/dropdown/dropdownCss',[
4834
+ '../utils'
4835
+ ], function (Utils) {
4836
+ function DropdownCSS () { }
4837
+
4838
+ DropdownCSS.prototype.render = function (decorated) {
4839
+ var $dropdown = decorated.call(this);
4840
+
4841
+ var dropdownCssClass = this.options.get('dropdownCssClass') || '';
4842
+
4843
+ if (dropdownCssClass.indexOf(':all:') !== -1) {
4844
+ dropdownCssClass = dropdownCssClass.replace(':all:', '');
4845
+
4846
+ Utils.copyNonInternalCssClasses($dropdown[0], this.$element[0]);
4847
+ }
4848
+
4849
+ $dropdown.addClass(dropdownCssClass);
4850
+
4851
+ return $dropdown;
4852
+ };
4853
+
4854
+ return DropdownCSS;
4855
+ });
4856
+
4857
+ S2.define('select2/dropdown/tagsSearchHighlight',[
4858
+ '../utils'
4859
+ ], function (Utils) {
4860
+ function TagsSearchHighlight () { }
4861
+
4862
+ TagsSearchHighlight.prototype.highlightFirstItem = function (decorated) {
4863
+ var $options = this.$results
4864
+ .find(
4865
+ '.select2-results__option--selectable' +
4866
+ ':not(.select2-results__option--selected)'
4867
+ );
4868
+
4869
+ if ($options.length > 0) {
4870
+ var $firstOption = $options.first();
4871
+ var data = Utils.GetData($firstOption[0], 'data');
4872
+ var firstElement = data.element;
4873
+
4874
+ if (firstElement && firstElement.getAttribute) {
4875
+ if (firstElement.getAttribute('data-select2-tag') === 'true') {
4876
+ $firstOption.trigger('mouseenter');
4877
+
4878
+ return;
4879
+ }
4880
+ }
4881
+ }
4882
+
4883
+ decorated.call(this);
4884
+ };
4885
+
4886
+ return TagsSearchHighlight;
4887
+ });
4888
+
4889
+ S2.define('select2/i18n/en',[],function () {
4890
+ // English
4891
+ return {
4892
+ errorLoading: function () {
4893
+ return 'The results could not be loaded.';
4894
+ },
4895
+ inputTooLong: function (args) {
4896
+ var overChars = args.input.length - args.maximum;
4897
+
4898
+ var message = 'Please delete ' + overChars + ' character';
4899
+
4900
+ if (overChars != 1) {
4901
+ message += 's';
4902
+ }
4903
+
4904
+ return message;
4905
+ },
4906
+ inputTooShort: function (args) {
4907
+ var remainingChars = args.minimum - args.input.length;
4908
+
4909
+ var message = 'Please enter ' + remainingChars + ' or more characters';
4910
+
4911
+ return message;
4912
+ },
4913
+ loadingMore: function () {
4914
+ return 'Loading more results…';
4915
+ },
4916
+ maximumSelected: function (args) {
4917
+ var message = 'You can only select ' + args.maximum + ' item';
4918
+
4919
+ if (args.maximum != 1) {
4920
+ message += 's';
4921
+ }
4922
+
4923
+ return message;
4924
+ },
4925
+ noResults: function () {
4926
+ return 'No results found';
4927
+ },
4928
+ searching: function () {
4929
+ return 'Searching…';
4930
+ },
4931
+ removeAllItems: function () {
4932
+ return 'Remove all items';
4933
+ },
4934
+ removeItem: function () {
4935
+ return 'Remove item';
4936
+ },
4937
+ search: function() {
4938
+ return 'Search';
4939
+ }
4940
+ };
4941
+ });
4942
+
4943
+ S2.define('select2/defaults',[
4944
+ 'jquery',
4945
+
4946
+ './results',
4947
+
4948
+ './selection/single',
4949
+ './selection/multiple',
4950
+ './selection/placeholder',
4951
+ './selection/allowClear',
4952
+ './selection/search',
4953
+ './selection/selectionCss',
4954
+ './selection/eventRelay',
4955
+
4956
+ './utils',
4957
+ './translation',
4958
+ './diacritics',
4959
+
4960
+ './data/select',
4961
+ './data/array',
4962
+ './data/ajax',
4963
+ './data/tags',
4964
+ './data/tokenizer',
4965
+ './data/minimumInputLength',
4966
+ './data/maximumInputLength',
4967
+ './data/maximumSelectionLength',
4968
+
4969
+ './dropdown',
4970
+ './dropdown/search',
4971
+ './dropdown/hidePlaceholder',
4972
+ './dropdown/infiniteScroll',
4973
+ './dropdown/attachBody',
4974
+ './dropdown/minimumResultsForSearch',
4975
+ './dropdown/selectOnClose',
4976
+ './dropdown/closeOnSelect',
4977
+ './dropdown/dropdownCss',
4978
+ './dropdown/tagsSearchHighlight',
4979
+
4980
+ './i18n/en'
4981
+ ], function ($,
4982
+
4983
+ ResultsList,
4984
+
4985
+ SingleSelection, MultipleSelection, Placeholder, AllowClear,
4986
+ SelectionSearch, SelectionCSS, EventRelay,
4987
+
4988
+ Utils, Translation, DIACRITICS,
4989
+
4990
+ SelectData, ArrayData, AjaxData, Tags, Tokenizer,
4991
+ MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
4992
+
4993
+ Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
4994
+ AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
4995
+ DropdownCSS, TagsSearchHighlight,
4996
+
4997
+ EnglishTranslation) {
4998
+ function Defaults () {
4999
+ this.reset();
5000
+ }
5001
+
5002
+ Defaults.prototype.apply = function (options) {
5003
+ options = $.extend(true, {}, this.defaults, options);
5004
+
5005
+ if (options.dataAdapter == null) {
5006
+ if (options.ajax != null) {
5007
+ options.dataAdapter = AjaxData;
5008
+ } else if (options.data != null) {
5009
+ options.dataAdapter = ArrayData;
5010
+ } else {
5011
+ options.dataAdapter = SelectData;
5012
+ }
5013
+
5014
+ if (options.minimumInputLength > 0) {
5015
+ options.dataAdapter = Utils.Decorate(
5016
+ options.dataAdapter,
5017
+ MinimumInputLength
5018
+ );
5019
+ }
5020
+
5021
+ if (options.maximumInputLength > 0) {
5022
+ options.dataAdapter = Utils.Decorate(
5023
+ options.dataAdapter,
5024
+ MaximumInputLength
5025
+ );
5026
+ }
5027
+
5028
+ if (options.maximumSelectionLength > 0) {
5029
+ options.dataAdapter = Utils.Decorate(
5030
+ options.dataAdapter,
5031
+ MaximumSelectionLength
5032
+ );
5033
+ }
5034
+
5035
+ if (options.tags) {
5036
+ options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
5037
+ }
5038
+
5039
+ if (options.tokenSeparators != null || options.tokenizer != null) {
5040
+ options.dataAdapter = Utils.Decorate(
5041
+ options.dataAdapter,
5042
+ Tokenizer
5043
+ );
5044
+ }
5045
+ }
5046
+
5047
+ if (options.resultsAdapter == null) {
5048
+ options.resultsAdapter = ResultsList;
5049
+
5050
+ if (options.ajax != null) {
5051
+ options.resultsAdapter = Utils.Decorate(
5052
+ options.resultsAdapter,
5053
+ InfiniteScroll
5054
+ );
5055
+ }
5056
+
5057
+ if (options.placeholder != null) {
5058
+ options.resultsAdapter = Utils.Decorate(
5059
+ options.resultsAdapter,
5060
+ HidePlaceholder
5061
+ );
5062
+ }
5063
+
5064
+ if (options.selectOnClose) {
5065
+ options.resultsAdapter = Utils.Decorate(
5066
+ options.resultsAdapter,
5067
+ SelectOnClose
5068
+ );
5069
+ }
5070
+
5071
+ if (options.tags) {
5072
+ options.resultsAdapter = Utils.Decorate(
5073
+ options.resultsAdapter,
5074
+ TagsSearchHighlight
5075
+ );
5076
+ }
5077
+ }
5078
+
5079
+ if (options.dropdownAdapter == null) {
5080
+ if (options.multiple) {
5081
+ options.dropdownAdapter = Dropdown;
5082
+ } else {
5083
+ var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
5084
+
5085
+ options.dropdownAdapter = SearchableDropdown;
5086
+ }
5087
+
5088
+ if (options.minimumResultsForSearch !== 0) {
5089
+ options.dropdownAdapter = Utils.Decorate(
5090
+ options.dropdownAdapter,
5091
+ MinimumResultsForSearch
5092
+ );
5093
+ }
5094
+
5095
+ if (options.closeOnSelect) {
5096
+ options.dropdownAdapter = Utils.Decorate(
5097
+ options.dropdownAdapter,
5098
+ CloseOnSelect
5099
+ );
5100
+ }
5101
+
5102
+ if (options.dropdownCssClass != null) {
5103
+ options.dropdownAdapter = Utils.Decorate(
5104
+ options.dropdownAdapter,
5105
+ DropdownCSS
5106
+ );
5107
+ }
5108
+
5109
+ options.dropdownAdapter = Utils.Decorate(
5110
+ options.dropdownAdapter,
5111
+ AttachBody
5112
+ );
5113
+ }
5114
+
5115
+ if (options.selectionAdapter == null) {
5116
+ if (options.multiple) {
5117
+ options.selectionAdapter = MultipleSelection;
5118
+ } else {
5119
+ options.selectionAdapter = SingleSelection;
5120
+ }
5121
+
5122
+ // Add the placeholder mixin if a placeholder was specified
5123
+ if (options.placeholder != null) {
5124
+ options.selectionAdapter = Utils.Decorate(
5125
+ options.selectionAdapter,
5126
+ Placeholder
5127
+ );
5128
+ }
5129
+
5130
+ if (options.allowClear) {
5131
+ options.selectionAdapter = Utils.Decorate(
5132
+ options.selectionAdapter,
5133
+ AllowClear
5134
+ );
5135
+ }
5136
+
5137
+ if (options.multiple) {
5138
+ options.selectionAdapter = Utils.Decorate(
5139
+ options.selectionAdapter,
5140
+ SelectionSearch
5141
+ );
5142
+ }
5143
+
5144
+ if (options.selectionCssClass != null) {
5145
+ options.selectionAdapter = Utils.Decorate(
5146
+ options.selectionAdapter,
5147
+ SelectionCSS
5148
+ );
5149
+ }
5150
+
5151
+ options.selectionAdapter = Utils.Decorate(
5152
+ options.selectionAdapter,
5153
+ EventRelay
5154
+ );
5155
+ }
5156
+
5157
+ // If the defaults were not previously applied from an element, it is
5158
+ // possible for the language option to have not been resolved
5159
+ options.language = this._resolveLanguage(options.language);
5160
+
5161
+ // Always fall back to English since it will always be complete
5162
+ options.language.push('en');
5163
+
5164
+ var uniqueLanguages = [];
5165
+
5166
+ for (var l = 0; l < options.language.length; l++) {
5167
+ var language = options.language[l];
5168
+
5169
+ if (uniqueLanguages.indexOf(language) === -1) {
5170
+ uniqueLanguages.push(language);
5171
+ }
5172
+ }
5173
+
5174
+ options.language = uniqueLanguages;
5175
+
5176
+ options.translations = this._processTranslations(
5177
+ options.language,
5178
+ options.debug
5179
+ );
5180
+
5181
+ return options;
5182
+ };
5183
+
5184
+ Defaults.prototype.reset = function () {
5185
+ function stripDiacritics (text) {
5186
+ // Used 'uni range + named function' from http://jsperf.com/diacritics/18
5187
+ function match(a) {
5188
+ return DIACRITICS[a] || a;
5189
+ }
5190
+
5191
+ return text.replace(/[^\u0000-\u007E]/g, match);
5192
+ }
5193
+
5194
+ function matcher (params, data) {
5195
+ // Always return the object if there is nothing to compare
5196
+ if (params.term == null || params.term.trim() === '') {
5197
+ return data;
5198
+ }
5199
+
5200
+ // Do a recursive check for options with children
5201
+ if (data.children && data.children.length > 0) {
5202
+ // Clone the data object if there are children
5203
+ // This is required as we modify the object to remove any non-matches
5204
+ var match = $.extend(true, {}, data);
5205
+
5206
+ // Check each child of the option
5207
+ for (var c = data.children.length - 1; c >= 0; c--) {
5208
+ var child = data.children[c];
5209
+
5210
+ var matches = matcher(params, child);
5211
+
5212
+ // If there wasn't a match, remove the object in the array
5213
+ if (matches == null) {
5214
+ match.children.splice(c, 1);
5215
+ }
5216
+ }
5217
+
5218
+ // If any children matched, return the new object
5219
+ if (match.children.length > 0) {
5220
+ return match;
5221
+ }
5222
+
5223
+ // If there were no matching children, check just the plain object
5224
+ return matcher(params, match);
5225
+ }
5226
+
5227
+ var original = stripDiacritics(data.text).toUpperCase();
5228
+ var term = stripDiacritics(params.term).toUpperCase();
5229
+
5230
+ // Check if the text contains the term
5231
+ if (original.indexOf(term) > -1) {
5232
+ return data;
5233
+ }
5234
+
5235
+ // If it doesn't contain the term, don't return anything
5236
+ return null;
5237
+ }
5238
+
5239
+ this.defaults = {
5240
+ amdLanguageBase: './i18n/',
5241
+ autocomplete: 'off',
5242
+ closeOnSelect: true,
5243
+ debug: false,
5244
+ dropdownAutoWidth: false,
5245
+ escapeMarkup: Utils.escapeMarkup,
5246
+ language: {},
5247
+ matcher: matcher,
5248
+ minimumInputLength: 0,
5249
+ maximumInputLength: 0,
5250
+ maximumSelectionLength: 0,
5251
+ minimumResultsForSearch: 0,
5252
+ selectOnClose: false,
5253
+ scrollAfterSelect: false,
5254
+ sorter: function (data) {
5255
+ return data;
5256
+ },
5257
+ templateResult: function (result) {
5258
+ return result.text;
5259
+ },
5260
+ templateSelection: function (selection) {
5261
+ return selection.text;
5262
+ },
5263
+ theme: 'default',
5264
+ width: 'resolve'
5265
+ };
5266
+ };
5267
+
5268
+ Defaults.prototype.applyFromElement = function (options, $element) {
5269
+ var optionLanguage = options.language;
5270
+ var defaultLanguage = this.defaults.language;
5271
+ var elementLanguage = $element.prop('lang');
5272
+ var parentLanguage = $element.closest('[lang]').prop('lang');
5273
+
5274
+ var languages = Array.prototype.concat.call(
5275
+ this._resolveLanguage(elementLanguage),
5276
+ this._resolveLanguage(optionLanguage),
5277
+ this._resolveLanguage(defaultLanguage),
5278
+ this._resolveLanguage(parentLanguage)
5279
+ );
5280
+
5281
+ options.language = languages;
5282
+
5283
+ return options;
5284
+ };
5285
+
5286
+ Defaults.prototype._resolveLanguage = function (language) {
5287
+ if (!language) {
5288
+ return [];
5289
+ }
5290
+
5291
+ if ($.isEmptyObject(language)) {
5292
+ return [];
5293
+ }
5294
+
5295
+ if ($.isPlainObject(language)) {
5296
+ return [language];
5297
+ }
5298
+
5299
+ var languages;
5300
+
5301
+ if (!Array.isArray(language)) {
5302
+ languages = [language];
5303
+ } else {
5304
+ languages = language;
5305
+ }
5306
+
5307
+ var resolvedLanguages = [];
5308
+
5309
+ for (var l = 0; l < languages.length; l++) {
5310
+ resolvedLanguages.push(languages[l]);
5311
+
5312
+ if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) {
5313
+ // Extract the region information if it is included
5314
+ var languageParts = languages[l].split('-');
5315
+ var baseLanguage = languageParts[0];
5316
+
5317
+ resolvedLanguages.push(baseLanguage);
5318
+ }
5319
+ }
5320
+
5321
+ return resolvedLanguages;
5322
+ };
5323
+
5324
+ Defaults.prototype._processTranslations = function (languages, debug) {
5325
+ var translations = new Translation();
5326
+
5327
+ for (var l = 0; l < languages.length; l++) {
5328
+ var languageData = new Translation();
5329
+
5330
+ var language = languages[l];
5331
+
5332
+ if (typeof language === 'string') {
5333
+ try {
5334
+ // Try to load it with the original name
5335
+ languageData = Translation.loadPath(language);
5336
+ } catch (e) {
5337
+ try {
5338
+ // If we couldn't load it, check if it wasn't the full path
5339
+ language = this.defaults.amdLanguageBase + language;
5340
+ languageData = Translation.loadPath(language);
5341
+ } catch (ex) {
5342
+ // The translation could not be loaded at all. Sometimes this is
5343
+ // because of a configuration problem, other times this can be
5344
+ // because of how Select2 helps load all possible translation files
5345
+ if (debug && window.console && console.warn) {
5346
+ console.warn(
5347
+ 'Select2: The language file for "' + language + '" could ' +
5348
+ 'not be automatically loaded. A fallback will be used instead.'
5349
+ );
5350
+ }
5351
+ }
5352
+ }
5353
+ } else if ($.isPlainObject(language)) {
5354
+ languageData = new Translation(language);
5355
+ } else {
5356
+ languageData = language;
5357
+ }
5358
+
5359
+ translations.extend(languageData);
5360
+ }
5361
+
5362
+ return translations;
5363
+ };
5364
+
5365
+ Defaults.prototype.set = function (key, value) {
5366
+ var camelKey = $.camelCase(key);
5367
+
5368
+ var data = {};
5369
+ data[camelKey] = value;
5370
+
5371
+ var convertedData = Utils._convertData(data);
5372
+
5373
+ $.extend(true, this.defaults, convertedData);
5374
+ };
5375
+
5376
+ var defaults = new Defaults();
5377
+
5378
+ return defaults;
5379
+ });
5380
+
5381
+ S2.define('select2/options',[
5382
+ 'jquery',
5383
+ './defaults',
5384
+ './utils'
5385
+ ], function ($, Defaults, Utils) {
5386
+ function Options (options, $element) {
5387
+ this.options = options;
5388
+
5389
+ if ($element != null) {
5390
+ this.fromElement($element);
5391
+ }
5392
+
5393
+ if ($element != null) {
5394
+ this.options = Defaults.applyFromElement(this.options, $element);
5395
+ }
5396
+
5397
+ this.options = Defaults.apply(this.options);
5398
+ }
5399
+
5400
+ Options.prototype.fromElement = function ($e) {
5401
+ var excludedData = ['select2'];
5402
+
5403
+ if (this.options.multiple == null) {
5404
+ this.options.multiple = $e.prop('multiple');
5405
+ }
5406
+
5407
+ if (this.options.disabled == null) {
5408
+ this.options.disabled = $e.prop('disabled');
5409
+ }
5410
+
5411
+ if (this.options.autocomplete == null && $e.prop('autocomplete')) {
5412
+ this.options.autocomplete = $e.prop('autocomplete');
5413
+ }
5414
+
5415
+ if (this.options.dir == null) {
5416
+ if ($e.prop('dir')) {
5417
+ this.options.dir = $e.prop('dir');
5418
+ } else if ($e.closest('[dir]').prop('dir')) {
5419
+ this.options.dir = $e.closest('[dir]').prop('dir');
5420
+ } else {
5421
+ this.options.dir = 'ltr';
5422
+ }
5423
+ }
5424
+
5425
+ $e.prop('disabled', this.options.disabled);
5426
+ $e.prop('multiple', this.options.multiple);
5427
+
5428
+ if (Utils.GetData($e[0], 'select2Tags')) {
5429
+ if (this.options.debug && window.console && console.warn) {
5430
+ console.warn(
5431
+ 'Select2: The `data-select2-tags` attribute has been changed to ' +
5432
+ 'use the `data-data` and `data-tags="true"` attributes and will be ' +
5433
+ 'removed in future versions of Select2.'
5434
+ );
5435
+ }
5436
+
5437
+ Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags'));
5438
+ Utils.StoreData($e[0], 'tags', true);
5439
+ }
5440
+
5441
+ if (Utils.GetData($e[0], 'ajaxUrl')) {
5442
+ if (this.options.debug && window.console && console.warn) {
5443
+ console.warn(
5444
+ 'Select2: The `data-ajax-url` attribute has been changed to ' +
5445
+ '`data-ajax--url` and support for the old attribute will be removed' +
5446
+ ' in future versions of Select2.'
5447
+ );
5448
+ }
5449
+
5450
+ $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl'));
5451
+ Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl'));
5452
+ }
5453
+
5454
+ var dataset = {};
5455
+
5456
+ function upperCaseLetter(_, letter) {
5457
+ return letter.toUpperCase();
5458
+ }
5459
+
5460
+ // Pre-load all of the attributes which are prefixed with `data-`
5461
+ for (var attr = 0; attr < $e[0].attributes.length; attr++) {
5462
+ var attributeName = $e[0].attributes[attr].name;
5463
+ var prefix = 'data-';
5464
+
5465
+ if (attributeName.substr(0, prefix.length) == prefix) {
5466
+ // Get the contents of the attribute after `data-`
5467
+ var dataName = attributeName.substring(prefix.length);
5468
+
5469
+ // Get the data contents from the consistent source
5470
+ // This is more than likely the jQuery data helper
5471
+ var dataValue = Utils.GetData($e[0], dataName);
5472
+
5473
+ // camelCase the attribute name to match the spec
5474
+ var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter);
5475
+
5476
+ // Store the data attribute contents into the dataset since
5477
+ dataset[camelDataName] = dataValue;
5478
+ }
5479
+ }
5480
+
5481
+ // Prefer the element's `dataset` attribute if it exists
5482
+ // jQuery 1.x does not correctly handle data attributes with multiple dashes
5483
+ if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
5484
+ dataset = $.extend(true, {}, $e[0].dataset, dataset);
5485
+ }
5486
+
5487
+ // Prefer our internal data cache if it exists
5488
+ var data = $.extend(true, {}, Utils.GetData($e[0]), dataset);
5489
+
5490
+ data = Utils._convertData(data);
5491
+
5492
+ for (var key in data) {
5493
+ if (excludedData.indexOf(key) > -1) {
5494
+ continue;
5495
+ }
5496
+
5497
+ if ($.isPlainObject(this.options[key])) {
5498
+ $.extend(this.options[key], data[key]);
5499
+ } else {
5500
+ this.options[key] = data[key];
5501
+ }
5502
+ }
5503
+
5504
+ return this;
5505
+ };
5506
+
5507
+ Options.prototype.get = function (key) {
5508
+ return this.options[key];
5509
+ };
5510
+
5511
+ Options.prototype.set = function (key, val) {
5512
+ this.options[key] = val;
5513
+ };
5514
+
5515
+ return Options;
5516
+ });
5517
+
5518
+ S2.define('select2/core',[
5519
+ 'jquery',
5520
+ './options',
5521
+ './utils',
5522
+ './keys'
5523
+ ], function ($, Options, Utils, KEYS) {
5524
+ var Select2 = function ($element, options) {
5525
+ if (Utils.GetData($element[0], 'select2') != null) {
5526
+ Utils.GetData($element[0], 'select2').destroy();
5527
+ }
5528
+
5529
+ this.$element = $element;
5530
+
5531
+ this.id = this._generateId($element);
5532
+
5533
+ options = options || {};
5534
+
5535
+ this.options = new Options(options, $element);
5536
+
5537
+ Select2.__super__.constructor.call(this);
5538
+
5539
+ // Set up the tabindex
5540
+
5541
+ var tabindex = $element.attr('tabindex') || 0;
5542
+ Utils.StoreData($element[0], 'old-tabindex', tabindex);
5543
+ $element.attr('tabindex', '-1');
5544
+
5545
+ // Set up containers and adapters
5546
+
5547
+ var DataAdapter = this.options.get('dataAdapter');
5548
+ this.dataAdapter = new DataAdapter($element, this.options);
5549
+
5550
+ var $container = this.render();
5551
+
5552
+ this._placeContainer($container);
5553
+
5554
+ var SelectionAdapter = this.options.get('selectionAdapter');
5555
+ this.selection = new SelectionAdapter($element, this.options);
5556
+ this.$selection = this.selection.render();
5557
+
5558
+ this.selection.position(this.$selection, $container);
5559
+
5560
+ var DropdownAdapter = this.options.get('dropdownAdapter');
5561
+ this.dropdown = new DropdownAdapter($element, this.options);
5562
+ this.$dropdown = this.dropdown.render();
5563
+
5564
+ this.dropdown.position(this.$dropdown, $container);
5565
+
5566
+ var ResultsAdapter = this.options.get('resultsAdapter');
5567
+ this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
5568
+ this.$results = this.results.render();
5569
+
5570
+ this.results.position(this.$results, this.$dropdown);
5571
+
5572
+ // Bind events
5573
+
5574
+ var self = this;
5575
+
5576
+ // Bind the container to all of the adapters
5577
+ this._bindAdapters();
5578
+
5579
+ // Register any DOM event handlers
5580
+ this._registerDomEvents();
5581
+
5582
+ // Register any internal event handlers
5583
+ this._registerDataEvents();
5584
+ this._registerSelectionEvents();
5585
+ this._registerDropdownEvents();
5586
+ this._registerResultsEvents();
5587
+ this._registerEvents();
5588
+
5589
+ // Set the initial state
5590
+ this.dataAdapter.current(function (initialData) {
5591
+ self.trigger('selection:update', {
5592
+ data: initialData
5593
+ });
5594
+ });
5595
+
5596
+ // Hide the original select
5597
+ $element[0].classList.add('select2-hidden-accessible');
5598
+ $element.attr('aria-hidden', 'true');
5599
+
5600
+ // Synchronize any monitored attributes
5601
+ this._syncAttributes();
5602
+
5603
+ Utils.StoreData($element[0], 'select2', this);
5604
+
5605
+ // Ensure backwards compatibility with $element.data('select2').
5606
+ $element.data('select2', this);
5607
+ };
5608
+
5609
+ Utils.Extend(Select2, Utils.Observable);
5610
+
5611
+ Select2.prototype._generateId = function ($element) {
5612
+ var id = '';
5613
+
5614
+ if ($element.attr('id') != null) {
5615
+ id = $element.attr('id');
5616
+ } else if ($element.attr('name') != null) {
5617
+ id = $element.attr('name') + '-' + Utils.generateChars(2);
5618
+ } else {
5619
+ id = Utils.generateChars(4);
5620
+ }
5621
+
5622
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
5623
+ id = 'select2-' + id;
5624
+
5625
+ return id;
5626
+ };
5627
+
5628
+ Select2.prototype._placeContainer = function ($container) {
5629
+ $container.insertAfter(this.$element);
5630
+
5631
+ var width = this._resolveWidth(this.$element, this.options.get('width'));
5632
+
5633
+ if (width != null) {
5634
+ $container.css('width', width);
5635
+ }
5636
+ };
5637
+
5638
+ Select2.prototype._resolveWidth = function ($element, method) {
5639
+ var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
5640
+
5641
+ if (method == 'resolve') {
5642
+ var styleWidth = this._resolveWidth($element, 'style');
5643
+
5644
+ if (styleWidth != null) {
5645
+ return styleWidth;
5646
+ }
5647
+
5648
+ return this._resolveWidth($element, 'element');
5649
+ }
5650
+
5651
+ if (method == 'element') {
5652
+ var elementWidth = $element.outerWidth(false);
5653
+
5654
+ if (elementWidth <= 0) {
5655
+ return 'auto';
5656
+ }
5657
+
5658
+ return elementWidth + 'px';
5659
+ }
5660
+
5661
+ if (method == 'style') {
5662
+ var style = $element.attr('style');
5663
+
5664
+ if (typeof(style) !== 'string') {
5665
+ return null;
5666
+ }
5667
+
5668
+ var attrs = style.split(';');
5669
+
5670
+ for (var i = 0, l = attrs.length; i < l; i = i + 1) {
5671
+ var attr = attrs[i].replace(/\s/g, '');
5672
+ var matches = attr.match(WIDTH);
5673
+
5674
+ if (matches !== null && matches.length >= 1) {
5675
+ return matches[1];
5676
+ }
5677
+ }
5678
+
5679
+ return null;
5680
+ }
5681
+
5682
+ if (method == 'computedstyle') {
5683
+ var computedStyle = window.getComputedStyle($element[0]);
5684
+
5685
+ return computedStyle.width;
5686
+ }
5687
+
5688
+ return method;
5689
+ };
5690
+
5691
+ Select2.prototype._bindAdapters = function () {
5692
+ this.dataAdapter.bind(this, this.$container);
5693
+ this.selection.bind(this, this.$container);
5694
+
5695
+ this.dropdown.bind(this, this.$container);
5696
+ this.results.bind(this, this.$container);
5697
+ };
5698
+
5699
+ Select2.prototype._registerDomEvents = function () {
5700
+ var self = this;
5701
+
5702
+ this.$element.on('change.select2', function () {
5703
+ self.dataAdapter.current(function (data) {
5704
+ self.trigger('selection:update', {
5705
+ data: data
5706
+ });
5707
+ });
5708
+ });
5709
+
5710
+ this.$element.on('focus.select2', function (evt) {
5711
+ self.trigger('focus', evt);
5712
+ });
5713
+
5714
+ this._syncA = Utils.bind(this._syncAttributes, this);
5715
+ this._syncS = Utils.bind(this._syncSubtree, this);
5716
+
5717
+ this._observer = new window.MutationObserver(function (mutations) {
5718
+ self._syncA();
5719
+ self._syncS(mutations);
5720
+ });
5721
+ this._observer.observe(this.$element[0], {
5722
+ attributes: true,
5723
+ childList: true,
5724
+ subtree: false
5725
+ });
5726
+ };
5727
+
5728
+ Select2.prototype._registerDataEvents = function () {
5729
+ var self = this;
5730
+
5731
+ this.dataAdapter.on('*', function (name, params) {
5732
+ self.trigger(name, params);
5733
+ });
5734
+ };
5735
+
5736
+ Select2.prototype._registerSelectionEvents = function () {
5737
+ var self = this;
5738
+ var nonRelayEvents = ['toggle', 'focus'];
5739
+
5740
+ this.selection.on('toggle', function () {
5741
+ self.toggleDropdown();
5742
+ });
5743
+
5744
+ this.selection.on('focus', function (params) {
5745
+ self.focus(params);
5746
+ });
5747
+
5748
+ this.selection.on('*', function (name, params) {
5749
+ if (nonRelayEvents.indexOf(name) !== -1) {
5750
+ return;
5751
+ }
5752
+
5753
+ self.trigger(name, params);
5754
+ });
5755
+ };
5756
+
5757
+ Select2.prototype._registerDropdownEvents = function () {
5758
+ var self = this;
5759
+
5760
+ this.dropdown.on('*', function (name, params) {
5761
+ self.trigger(name, params);
5762
+ });
5763
+ };
5764
+
5765
+ Select2.prototype._registerResultsEvents = function () {
5766
+ var self = this;
5767
+
5768
+ this.results.on('*', function (name, params) {
5769
+ self.trigger(name, params);
5770
+ });
5771
+ };
5772
+
5773
+ Select2.prototype._registerEvents = function () {
5774
+ var self = this;
5775
+
5776
+ this.on('open', function () {
5777
+ self.$container[0].classList.add('select2-container--open');
5778
+ });
5779
+
5780
+ this.on('close', function () {
5781
+ self.$container[0].classList.remove('select2-container--open');
5782
+ });
5783
+
5784
+ this.on('enable', function () {
5785
+ self.$container[0].classList.remove('select2-container--disabled');
5786
+ });
5787
+
5788
+ this.on('disable', function () {
5789
+ self.$container[0].classList.add('select2-container--disabled');
5790
+ });
5791
+
5792
+ this.on('blur', function () {
5793
+ self.$container[0].classList.remove('select2-container--focus');
5794
+ });
5795
+
5796
+ this.on('query', function (params) {
5797
+ if (!self.isOpen()) {
5798
+ self.trigger('open', {});
5799
+ }
5800
+
5801
+ this.dataAdapter.query(params, function (data) {
5802
+ self.trigger('results:all', {
5803
+ data: data,
5804
+ query: params
5805
+ });
5806
+ });
5807
+ });
5808
+
5809
+ this.on('query:append', function (params) {
5810
+ this.dataAdapter.query(params, function (data) {
5811
+ self.trigger('results:append', {
5812
+ data: data,
5813
+ query: params
5814
+ });
5815
+ });
5816
+ });
5817
+
5818
+ this.on('keypress', function (evt) {
5819
+ var key = evt.which;
5820
+
5821
+ if (self.isOpen()) {
5822
+ if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {
5823
+ self.close(evt);
5824
+
5825
+ evt.preventDefault();
5826
+ } else if (key === KEYS.ENTER || key === KEYS.TAB) {
5827
+ self.trigger('results:select', {});
5828
+
5829
+ evt.preventDefault();
5830
+ } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
5831
+ self.trigger('results:toggle', {});
5832
+
5833
+ evt.preventDefault();
5834
+ } else if (key === KEYS.UP) {
5835
+ self.trigger('results:previous', {});
5836
+
5837
+ evt.preventDefault();
5838
+ } else if (key === KEYS.DOWN) {
5839
+ self.trigger('results:next', {});
5840
+
5841
+ evt.preventDefault();
5842
+ }
5843
+ } else {
5844
+ if (key === KEYS.ENTER || key === KEYS.SPACE ||
5845
+ (key === KEYS.DOWN && evt.altKey)) {
5846
+ self.open();
5847
+
5848
+ evt.preventDefault();
5849
+ }
5850
+ }
5851
+ });
5852
+ };
5853
+
5854
+ Select2.prototype._syncAttributes = function () {
5855
+ this.options.set('disabled', this.$element.prop('disabled'));
5856
+
5857
+ if (this.isDisabled()) {
5858
+ if (this.isOpen()) {
5859
+ this.close();
5860
+ }
5861
+
5862
+ this.trigger('disable', {});
5863
+ } else {
5864
+ this.trigger('enable', {});
5865
+ }
5866
+ };
5867
+
5868
+ Select2.prototype._isChangeMutation = function (mutations) {
5869
+ var self = this;
5870
+
5871
+ if (mutations.addedNodes && mutations.addedNodes.length > 0) {
5872
+ for (var n = 0; n < mutations.addedNodes.length; n++) {
5873
+ var node = mutations.addedNodes[n];
5874
+
5875
+ if (node.selected) {
5876
+ return true;
5877
+ }
5878
+ }
5879
+ } else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
5880
+ return true;
5881
+ } else if (Array.isArray(mutations)) {
5882
+ return mutations.some(function (mutation) {
5883
+ return self._isChangeMutation(mutation);
5884
+ });
5885
+ }
5886
+
5887
+ return false;
5888
+ };
5889
+
5890
+ Select2.prototype._syncSubtree = function (mutations) {
5891
+ var changed = this._isChangeMutation(mutations);
5892
+ var self = this;
5893
+
5894
+ // Only re-pull the data if we think there is a change
5895
+ if (changed) {
5896
+ this.dataAdapter.current(function (currentData) {
5897
+ self.trigger('selection:update', {
5898
+ data: currentData
5899
+ });
5900
+ });
5901
+ }
5902
+ };
5903
+
5904
+ /**
5905
+ * Override the trigger method to automatically trigger pre-events when
5906
+ * there are events that can be prevented.
5907
+ */
5908
+ Select2.prototype.trigger = function (name, args) {
5909
+ var actualTrigger = Select2.__super__.trigger;
5910
+ var preTriggerMap = {
5911
+ 'open': 'opening',
5912
+ 'close': 'closing',
5913
+ 'select': 'selecting',
5914
+ 'unselect': 'unselecting',
5915
+ 'clear': 'clearing'
5916
+ };
5917
+
5918
+ if (args === undefined) {
5919
+ args = {};
5920
+ }
5921
+
5922
+ if (name in preTriggerMap) {
5923
+ var preTriggerName = preTriggerMap[name];
5924
+ var preTriggerArgs = {
5925
+ prevented: false,
5926
+ name: name,
5927
+ args: args
5928
+ };
5929
+
5930
+ actualTrigger.call(this, preTriggerName, preTriggerArgs);
5931
+
5932
+ if (preTriggerArgs.prevented) {
5933
+ args.prevented = true;
5934
+
5935
+ return;
5936
+ }
5937
+ }
5938
+
5939
+ actualTrigger.call(this, name, args);
5940
+ };
5941
+
5942
+ Select2.prototype.toggleDropdown = function () {
5943
+ if (this.isDisabled()) {
5944
+ return;
5945
+ }
5946
+
5947
+ if (this.isOpen()) {
5948
+ this.close();
5949
+ } else {
5950
+ this.open();
5951
+ }
5952
+ };
5953
+
5954
+ Select2.prototype.open = function () {
5955
+ if (this.isOpen()) {
5956
+ return;
5957
+ }
5958
+
5959
+ if (this.isDisabled()) {
5960
+ return;
5961
+ }
5962
+
5963
+ this.trigger('query', {});
5964
+ };
5965
+
5966
+ Select2.prototype.close = function (evt) {
5967
+ if (!this.isOpen()) {
5968
+ return;
5969
+ }
5970
+
5971
+ this.trigger('close', { originalEvent : evt });
5972
+ };
5973
+
5974
+ /**
5975
+ * Helper method to abstract the "enabled" (not "disabled") state of this
5976
+ * object.
5977
+ *
5978
+ * @return {true} if the instance is not disabled.
5979
+ * @return {false} if the instance is disabled.
5980
+ */
5981
+ Select2.prototype.isEnabled = function () {
5982
+ return !this.isDisabled();
5983
+ };
5984
+
5985
+ /**
5986
+ * Helper method to abstract the "disabled" state of this object.
5987
+ *
5988
+ * @return {true} if the disabled option is true.
5989
+ * @return {false} if the disabled option is false.
5990
+ */
5991
+ Select2.prototype.isDisabled = function () {
5992
+ return this.options.get('disabled');
5993
+ };
5994
+
5995
+ Select2.prototype.isOpen = function () {
5996
+ return this.$container[0].classList.contains('select2-container--open');
5997
+ };
5998
+
5999
+ Select2.prototype.hasFocus = function () {
6000
+ return this.$container[0].classList.contains('select2-container--focus');
6001
+ };
6002
+
6003
+ Select2.prototype.focus = function (data) {
6004
+ // No need to re-trigger focus events if we are already focused
6005
+ if (this.hasFocus()) {
6006
+ return;
6007
+ }
6008
+
6009
+ this.$container[0].classList.add('select2-container--focus');
6010
+ this.trigger('focus', {});
6011
+ };
6012
+
6013
+ Select2.prototype.enable = function (args) {
6014
+ if (this.options.get('debug') && window.console && console.warn) {
6015
+ console.warn(
6016
+ 'Select2: The `select2("enable")` method has been deprecated and will' +
6017
+ ' be removed in later Select2 versions. Use $element.prop("disabled")' +
6018
+ ' instead.'
6019
+ );
6020
+ }
6021
+
6022
+ if (args == null || args.length === 0) {
6023
+ args = [true];
6024
+ }
6025
+
6026
+ var disabled = !args[0];
6027
+
6028
+ this.$element.prop('disabled', disabled);
6029
+ };
6030
+
6031
+ Select2.prototype.data = function () {
6032
+ if (this.options.get('debug') &&
6033
+ arguments.length > 0 && window.console && console.warn) {
6034
+ console.warn(
6035
+ 'Select2: Data can no longer be set using `select2("data")`. You ' +
6036
+ 'should consider setting the value instead using `$element.val()`.'
6037
+ );
6038
+ }
6039
+
6040
+ var data = [];
6041
+
6042
+ this.dataAdapter.current(function (currentData) {
6043
+ data = currentData;
6044
+ });
6045
+
6046
+ return data;
6047
+ };
6048
+
6049
+ Select2.prototype.val = function (args) {
6050
+ if (this.options.get('debug') && window.console && console.warn) {
6051
+ console.warn(
6052
+ 'Select2: The `select2("val")` method has been deprecated and will be' +
6053
+ ' removed in later Select2 versions. Use $element.val() instead.'
6054
+ );
6055
+ }
6056
+
6057
+ if (args == null || args.length === 0) {
6058
+ return this.$element.val();
6059
+ }
6060
+
6061
+ var newVal = args[0];
6062
+
6063
+ if (Array.isArray(newVal)) {
6064
+ newVal = newVal.map(function (obj) {
6065
+ return obj.toString();
6066
+ });
6067
+ }
6068
+
6069
+ this.$element.val(newVal).trigger('input').trigger('change');
6070
+ };
6071
+
6072
+ Select2.prototype.destroy = function () {
6073
+ Utils.RemoveData(this.$container[0]);
6074
+ this.$container.remove();
6075
+
6076
+ this._observer.disconnect();
6077
+ this._observer = null;
6078
+
6079
+ this._syncA = null;
6080
+ this._syncS = null;
6081
+
6082
+ this.$element.off('.select2');
6083
+ this.$element.attr('tabindex',
6084
+ Utils.GetData(this.$element[0], 'old-tabindex'));
6085
+
6086
+ this.$element[0].classList.remove('select2-hidden-accessible');
6087
+ this.$element.attr('aria-hidden', 'false');
6088
+ Utils.RemoveData(this.$element[0]);
6089
+ this.$element.removeData('select2');
6090
+
6091
+ this.dataAdapter.destroy();
6092
+ this.selection.destroy();
6093
+ this.dropdown.destroy();
6094
+ this.results.destroy();
6095
+
6096
+ this.dataAdapter = null;
6097
+ this.selection = null;
6098
+ this.dropdown = null;
6099
+ this.results = null;
6100
+ };
6101
+
6102
+ Select2.prototype.render = function () {
6103
+ var $container = $(
6104
+ '<span class="select2 select2-container">' +
6105
+ '<span class="selection"></span>' +
6106
+ '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
6107
+ '</span>'
6108
+ );
6109
+
6110
+ $container.attr('dir', this.options.get('dir'));
6111
+
6112
+ this.$container = $container;
6113
+
6114
+ this.$container[0].classList
6115
+ .add('select2-container--' + this.options.get('theme'));
6116
+
6117
+ Utils.StoreData($container[0], 'element', this.$element);
6118
+
6119
+ return $container;
6120
+ };
6121
+
6122
+ return Select2;
6123
+ });
6124
+
6125
+ S2.define('jquery-mousewheel',[
6126
+ 'jquery'
6127
+ ], function ($) {
6128
+ // Used to shim jQuery.mousewheel for non-full builds.
6129
+ return $;
6130
+ });
6131
+
6132
+ S2.define('jquery.select2',[
6133
+ 'jquery',
6134
+ 'jquery-mousewheel',
6135
+
6136
+ './select2/core',
6137
+ './select2/defaults',
6138
+ './select2/utils'
6139
+ ], function ($, _, Select2, Defaults, Utils) {
6140
+ if ($.fn.select2 == null) {
6141
+ // All methods that should return the element
6142
+ var thisMethods = ['open', 'close', 'destroy'];
6143
+
6144
+ $.fn.select2 = function (options) {
6145
+ options = options || {};
6146
+
6147
+ if (typeof options === 'object') {
6148
+ this.each(function () {
6149
+ var instanceOptions = $.extend(true, {}, options);
6150
+
6151
+ var instance = new Select2($(this), instanceOptions);
6152
+ });
6153
+
6154
+ return this;
6155
+ } else if (typeof options === 'string') {
6156
+ var ret;
6157
+ var args = Array.prototype.slice.call(arguments, 1);
6158
+
6159
+ this.each(function () {
6160
+ var instance = Utils.GetData(this, 'select2');
6161
+
6162
+ if (instance == null && window.console && console.error) {
6163
+ console.error(
6164
+ 'The select2(\'' + options + '\') method was called on an ' +
6165
+ 'element that is not using Select2.'
6166
+ );
6167
+ }
6168
+
6169
+ ret = instance[options].apply(instance, args);
6170
+ });
6171
+
6172
+ // Check if we should be returning `this`
6173
+ if (thisMethods.indexOf(options) > -1) {
6174
+ return this;
6175
+ }
6176
+
6177
+ return ret;
6178
+ } else {
6179
+ throw new Error('Invalid arguments for Select2: ' + options);
6180
+ }
6181
+ };
6182
+ }
6183
+
6184
+ if ($.fn.select2.defaults == null) {
6185
+ $.fn.select2.defaults = Defaults;
6186
+ }
6187
+
6188
+ return Select2;
6189
+ });
6190
+
6191
+ // Return the AMD loader configuration so it can be used outside of this file
6192
+ return {
6193
+ define: S2.define,
6194
+ require: S2.require
6195
+ };
6196
+ }());
6197
+
6198
+ // Autoload the jQuery bindings
6199
+ // We know that all of the modules exist above this, so we're safe
6200
+ var select2 = S2.require('jquery.select2');
6201
+
6202
+ // Hold the AMD module references on the jQuery function that was just loaded
6203
+ // This allows Select2 to use the internal loader outside of this file, such
6204
+ // as in the language files.
6205
+ jQuery.fn.select2.amd = S2;
6206
+
6207
+ // Return the Select2 instance for anyone who is importing it.
6208
+ return select2;
6209
+ }));
includes/vendor/select2/js/select2.min.js CHANGED
@@ -1 +1,2 @@
1
- /*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k<a.length;k++)if("."===(m=a[k]))a.splice(k,1),k-=1;else if(".."===m){if(0===k||1===k&&".."===a[2]||".."===a[k-1])continue;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=p(c[o],t),"require"===(k=n.f))w[o]=q.require(a);else if("exports"===k)w[o]=q.exports(a),v=!0;else if("module"===k)h=w[o]=q.module(a);else if(e(r,k)||e(s,k)||e(u,k))w[o]=j(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,g(f,!0),i(k),{}),w[o]=r[k]}m=d?d.apply(r[a],w):void 0,a&&(h&&h.exports!==b&&h.exports!==r[a]?r[a]=h.exports:m===b&&v||(r[a]=m))}else a&&(r[a]=d)},a=c=o=function(a,c,d,e,f){if("string"==typeof a)return q[a]?q[a](c):j(p(a,l(c)).f);if(!a.splice){if(t=a,t.deps&&o(t.deps,t.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?n(b,a,c,d):setTimeout(function(){n(b,a,c,d)},4),o},o.config=function(a){return o(a)},a._defined=r,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(r,a)||e(s,a)||(s[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){"function"==typeof b[d]&&("constructor"!==d&&c.push(d))}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){return Array.prototype.unshift.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;c<a;c++){b+=Math.floor(36*Math.random()).toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){b.find(".select2-results").append(a)},c.prototype.sort=function(a){return this.options.get("sorter")(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[aria-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("aria-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.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}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&b.data("element").select2("close")})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">&times;</span></li>')},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id;if(b.length>1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">&times;</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var b=e.$searchContainer.prev(".select2-selection__choice");if(b.length>0){var d=b.data("data");e.searchRemoveChoice(d),a.preventDefault()}}});var f=document.documentMode,g=f&&f<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(g)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.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","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple")){if(a.selected=!1,c(a.element).is("option"))return a.element.selected=!1,void this.$element.trigger("change");this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})}},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this;this.$element.children().each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),void 0!==a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(null!=(b=c.data(a[0],"data")))return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){return this.options.get("matcher")(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0);if((i.text||"").toUpperCase()===(b.term||"").toUpperCase()||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var k=e.createTag(b);if(null!=k){var l=e.option(k);l.attr("data-select2-tag",!0),e.addOptions([l]),e.insertTag(g,k)}a.results=g,c(a)}var e=this;if(this._removeOldTags(),null==b.term||null!=b.page)return void a.call(this,b,c);a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){this._lastTag;this.$element.find("option[data-select2-tag]").each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b);if(!g.$element.find("option").filter(function(){return a(this).val()===c.id}).length){var d=g.option(c);d.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([d])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",b.term.length<this.minimumInputLength)return void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){return"Please enter "+(a.minimum-a.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}return D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.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)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var a=this;this.on("open",function(){a.$container.addClass("select2-container--open")}),this.on("close",function(){a.$container.removeClass("select2-container--open")}),this.on("enable",function(){a.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){a.$container.addClass("select2-container--disabled")}),this.on("blur",function(){a.$container.removeClass("select2-container--focus")}),this.on("query",function(b){a.isOpen()||a.trigger("open",{}),this.dataAdapter.query(b,function(c){a.trigger("results:all",{data:c,query:b})})}),this.on("query:append",function(b){this.dataAdapter.query(b,function(c){a.trigger("results:append",{data:c,query:b})})}),this.on("keypress",function(b){var c=b.which;a.isOpen()?c===d.ESC||c===d.TAB||c===d.UP&&b.altKey?(a.close(),b.preventDefault()):c===d.ENTER?(a.trigger("results:select",{}),b.preventDefault()):c===d.SPACE&&b.ctrlKey?(a.trigger("results:toggle",{}),b.preventDefault()):c===d.UP?(a.trigger("results:previous",{}),b.preventDefault()):c===d.DOWN&&(a.trigger("results:next",{}),b.preventDefault()):(c===d.ENTER||c===d.SPACE||c===d.DOWN&&b.altKey)&&(a.open(),b.preventDefault())})},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("jquery-mousewheel",["jquery"],function(a){return a}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.select2){var e=["open","close","destroy"];a.fn.select2=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null==a.fn.select2.defaults&&(a.fn.select2.defaults=d),c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,c});
 
1
+ /*! Select2 4.1.0-rc.0 | 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(t){var e,n,s,p,r,o,h,f,g,m,y,v,i,a,_,s=(t&&t.fn&&t.fn.select2&&t.fn.select2.amd&&(u=t.fn.select2.amd),u&&u.requirejs||(u?n=u:u={},g={},m={},y={},v={},i=Object.prototype.hasOwnProperty,a=[].slice,_=/\.js$/,h=function(e,t){var n,s,i=c(e),r=i[0],t=t[1];return e=i[1],r&&(n=x(r=l(r,t))),r?e=n&&n.normalize?n.normalize(e,(s=t,function(e){return l(e,s)})):l(e,t):(r=(i=c(e=l(e,t)))[0],e=i[1],r&&(n=x(r))),{f:r?r+"!"+e:e,n:e,pr:r,p:n}},f={require:function(e){return w(e)},exports:function(e){var t=g[e];return void 0!==t?t:g[e]={}},module:function(e){return{id:e,uri:"",exports:g[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},r=function(e,t,n,s){var i,r,o,a,l,c=[],u=typeof n,d=A(s=s||e);if("undefined"==u||"function"==u){for(t=!t.length&&n.length?["require","exports","module"]:t,a=0;a<t.length;a+=1)if("require"===(r=(o=h(t[a],d)).f))c[a]=f.require(e);else if("exports"===r)c[a]=f.exports(e),l=!0;else if("module"===r)i=c[a]=f.module(e);else if(b(g,r)||b(m,r)||b(v,r))c[a]=x(r);else{if(!o.p)throw new Error(e+" missing "+r);o.p.load(o.n,w(s,!0),function(t){return function(e){g[t]=e}}(r),{}),c[a]=g[r]}u=n?n.apply(g[e],c):void 0,e&&(i&&i.exports!==p&&i.exports!==g[e]?g[e]=i.exports:u===p&&l||(g[e]=u))}else e&&(g[e]=n)},e=n=o=function(e,t,n,s,i){if("string"==typeof e)return f[e]?f[e](t):x(h(e,A(t)).f);if(!e.splice){if((y=e).deps&&o(y.deps,y.callback),!t)return;t.splice?(e=t,t=n,n=null):e=p}return t=t||function(){},"function"==typeof n&&(n=s,s=i),s?r(p,e,t,n):setTimeout(function(){r(p,e,t,n)},4),o},o.config=function(e){return o(e)},e._defined=g,(s=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(g,e)||b(m,e)||(m[e]=[e,t,n])}).amd={jQuery:!0},u.requirejs=e,u.require=n,u.define=s),u.define("almond",function(){}),u.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}),u.define("select2/utils",["jquery"],function(r){var s={};function c(e){var t,n=e.prototype,s=[];for(t in n)"function"==typeof n[t]&&"constructor"!==t&&s.push(t);return s}s.Extend=function(e,t){var n,s={}.hasOwnProperty;function i(){this.constructor=e}for(n in t)s.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},s.Decorate=function(s,i){var e=c(i),t=c(s);function r(){var e=Array.prototype.unshift,t=i.prototype.constructor.length,n=s.prototype.constructor;0<t&&(e.call(arguments,s.prototype.constructor),n=i.prototype.constructor),n.apply(this,arguments)}i.displayName=s.displayName,r.prototype=new function(){this.constructor=r};for(var n=0;n<t.length;n++){var o=t[n];r.prototype[o]=s.prototype[o]}for(var a=0;a<e.length;a++){var l=e[a];r.prototype[l]=function(e){var t=function(){};e in r.prototype&&(t=r.prototype[e]);var n=i.prototype[e];return function(){return Array.prototype.unshift.call(arguments,t),n.apply(this,arguments)}}(l)}return r};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,s=e.length;n<s;n++)e[n].apply(this,t)},s.Observable=e,s.generateChars=function(e){for(var t="",n=0;n<e;n++)t+=Math.floor(36*Math.random()).toString(36);return t},s.bind=function(e,t){return function(){e.apply(t,arguments)}},s._convertData=function(e){for(var t in e){var n=t.split("-"),s=e;if(1!==n.length){for(var i=0;i<n.length;i++){var r=n[i];(r=r.substring(0,1).toLowerCase()+r.substring(1))in s||(s[r]={}),i==n.length-1&&(s[r]=e[t]),s=s[r]}delete e[t]}}return e},s.hasScroll=function(e,t){var n=r(t),s=t.style.overflowX,i=t.style.overflowY;return(s!==i||"hidden"!==i&&"visible"!==i)&&("scroll"===s||"scroll"===i||(n.innerHeight()<t.scrollHeight||n.innerWidth()<t.scrollWidth))},s.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]})},s.__cache={};var n=0;return s.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null!=t||(t=e.id?"select2-data-"+e.id:"select2-data-"+(++n).toString()+"-"+s.generateChars(4),e.setAttribute("data-select2-id",t)),t},s.StoreData=function(e,t,n){e=s.GetUniqueElementId(e);s.__cache[e]||(s.__cache[e]={}),s.__cache[e][t]=n},s.GetData=function(e,t){var n=s.GetUniqueElementId(e);return t?s.__cache[n]&&null!=s.__cache[n][t]?s.__cache[n][t]:r(e).data(t):s.__cache[n]},s.RemoveData=function(e){var t=s.GetUniqueElementId(e);null!=s.__cache[t]&&delete s.__cache[t],e.removeAttribute("data-select2-id")},s.copyNonInternalCssClasses=function(e,t){var n=(n=e.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0===e.indexOf("select2-")}),t=(t=t.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0!==e.indexOf("select2-")}),t=n.concat(t);e.setAttribute("class",t.join(" "))},s}),u.define("select2/results",["jquery","./utils"],function(d,p){function s(e,t,n){this.$element=e,this.data=n,this.options=t,s.__super__.constructor.call(this)}return p.Extend(s,p.Observable),s.prototype.render=function(){var e=d('<ul class="select2-results__options" role="listbox"></ul>');return this.options.get("multiple")&&e.attr("aria-multiselectable","true"),this.$results=e},s.prototype.clear=function(){this.$results.empty()},s.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var n=d('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),s=this.options.get("translations").get(e.message);n.append(t(s(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},s.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},s.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 s=e.results[n],s=this.option(s);t.push(s)}this.$results.append(t)}else 0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"})},s.prototype.position=function(e,t){t.find(".select2-results").append(e)},s.prototype.sort=function(e){return this.options.get("sorter")(e)},s.prototype.highlightFirstItem=function(){var e=this.$results.find(".select2-results__option--selectable"),t=e.filter(".select2-results__option--selected");(0<t.length?t:e).first().trigger("mouseenter"),this.ensureHighlightVisible()},s.prototype.setClasses=function(){var t=this;this.data.current(function(e){var s=e.map(function(e){return e.id.toString()});t.$results.find(".select2-results__option--selectable").each(function(){var e=d(this),t=p.GetData(this,"data"),n=""+t.id;null!=t.element&&t.element.selected||null==t.element&&-1<s.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"))})})},s.prototype.showLoading=function(e){this.hideLoading();e={disabled:!0,loading:!0,text:this.options.get("translations").get("searching")(e)},e=this.option(e);e.className+=" loading-results",this.$results.prepend(e)},s.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},s.prototype.option=function(e){var t=document.createElement("li");t.classList.add("select2-results__option"),t.classList.add("select2-results__option--selectable");var n,s={role:"option"},i=window.Element.prototype.matches||window.Element.prototype.msMatchesSelector||window.Element.prototype.webkitMatchesSelector;for(n in(null!=e.element&&i.call(e.element,":disabled")||null==e.element&&e.disabled)&&(s["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&&(s.role="group",s["aria-label"]=e.text,t.classList.remove("select2-results__option--selectable"),t.classList.add("select2-results__option--group")),s){var r=s[n];t.setAttribute(n,r)}if(e.children){var o=d(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],u=this.option(u);l.push(u)}i=d("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"none"});i.append(l),o.append(a),o.append(i)}else this.template(e,t);return p.StoreData(t,"data",e),t},s.prototype.bind=function(t,e){var i=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){i.clear(),i.append(e.data),t.isOpen()&&(i.setClasses(),i.highlightFirstItem())}),t.on("results:append",function(e){i.append(e.data),t.isOpen()&&i.setClasses()}),t.on("query",function(e){i.hideMessages(),i.showLoading(e)}),t.on("select",function(){t.isOpen()&&(i.setClasses(),i.options.get("scrollAfterSelect")&&i.highlightFirstItem())}),t.on("unselect",function(){t.isOpen()&&(i.setClasses(),i.options.get("scrollAfterSelect")&&i.highlightFirstItem())}),t.on("open",function(){i.$results.attr("aria-expanded","true"),i.$results.attr("aria-hidden","false"),i.setClasses(),i.ensureHighlightVisible()}),t.on("close",function(){i.$results.attr("aria-expanded","false"),i.$results.attr("aria-hidden","true"),i.$results.removeAttr("aria-activedescendant")}),t.on("results:toggle",function(){var e=i.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e,t=i.getHighlightedResults();0!==t.length&&(e=p.GetData(t[0],"data"),t.hasClass("select2-results__option--selected")?i.trigger("close",{}):i.trigger("select",{data:e}))}),t.on("results:previous",function(){var e,t=i.getHighlightedResults(),n=i.$results.find(".select2-results__option--selectable"),s=n.index(t);s<=0||(e=s-1,0===t.length&&(e=0),(s=n.eq(e)).trigger("mouseenter"),t=i.$results.offset().top,n=s.offset().top,s=i.$results.scrollTop()+(n-t),0===e?i.$results.scrollTop(0):n-t<0&&i.$results.scrollTop(s))}),t.on("results:next",function(){var e,t=i.getHighlightedResults(),n=i.$results.find(".select2-results__option--selectable"),s=n.index(t)+1;s>=n.length||((e=n.eq(s)).trigger("mouseenter"),t=i.$results.offset().top+i.$results.outerHeight(!1),n=e.offset().top+e.outerHeight(!1),e=i.$results.scrollTop()+n-t,0===s?i.$results.scrollTop(0):t<n&&i.$results.scrollTop(e))}),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){i.displayMessage(e)}),d.fn.mousewheel&&this.$results.on("mousewheel",function(e){var t=i.$results.scrollTop(),n=i.$results.get(0).scrollHeight-t+e.deltaY,t=0<e.deltaY&&t-e.deltaY<=0,n=e.deltaY<0&&n<=i.$results.height();t?(i.$results.scrollTop(0),e.preventDefault(),e.stopPropagation()):n&&(i.$results.scrollTop(i.$results.get(0).scrollHeight-i.$results.height()),e.preventDefault(),e.stopPropagation())}),this.$results.on("mouseup",".select2-results__option--selectable",function(e){var t=d(this),n=p.GetData(this,"data");t.hasClass("select2-results__option--selected")?i.options.get("multiple")?i.trigger("unselect",{originalEvent:e,data:n}):i.trigger("close",{}):i.trigger("select",{originalEvent:e,data:n})}),this.$results.on("mouseenter",".select2-results__option--selectable",function(e){var t=p.GetData(this,"data");i.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),i.trigger("results:focus",{data:t,element:d(this)})})},s.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},s.prototype.destroy=function(){this.$results.remove()},s.prototype.ensureHighlightVisible=function(){var e,t,n,s,i=this.getHighlightedResults();0!==i.length&&(e=this.$results.find(".select2-results__option--selectable").index(i),s=this.$results.offset().top,t=i.offset().top,n=this.$results.scrollTop()+(t-s),s=t-s,n-=2*i.outerHeight(!1),e<=2?this.$results.scrollTop(0):(s>this.$results.outerHeight()||s<0)&&this.$results.scrollTop(n))},s.prototype.template=function(e,t){var n=this.options.get("templateResult"),s=this.options.get("escapeMarkup"),e=n(e,t);null==e?t.style.display="none":"string"==typeof e?t.innerHTML=s(e):d(t).append(e)},s}),u.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}}),u.define("select2/selection/base",["jquery","../utils","../keys"],function(n,s,i){function r(e,t){this.$element=e,this.options=t,r.__super__.constructor.call(this)}return s.Extend(r,s.Observable),r.prototype.render=function(){var e=n('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=s.GetData(this.$element[0],"old-tabindex")?this._tabindex=s.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},r.prototype.bind=function(e,t){var n=this,s=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===i.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",s),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")})},r.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)},r.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]&&s.GetData(this,"element").select2("close")})})},r.prototype._detachCloseHandler=function(e){n(document.body).off("mousedown.select2."+e.id)},r.prototype.position=function(e,t){t.find(".selection").append(e)},r.prototype.destroy=function(){this._detachCloseHandler(this.container)},r.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},r.prototype.isEnabled=function(){return!this.isDisabled()},r.prototype.isDisabled=function(){return this.options.get("disabled")},r}),u.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(e,t,n,s){function i(){i.__super__.constructor.apply(this,arguments)}return n.Extend(i,t),i.prototype.render=function(){var e=i.__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},i.prototype.bind=function(t,e){var n=this;i.__super__.bind.apply(this,arguments);var s=t.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",s).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",s),this.$selection.attr("aria-controls",s),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")})},i.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},i.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},i.prototype.selectionContainer=function(){return e("<span></span>")},i.prototype.update=function(e){var t,n;0!==e.length?(n=e[0],t=this.$selection.find(".select2-selection__rendered"),e=this.display(n,t),t.empty().append(e),(n=n.title||n.text)?t.attr("title",n):t.removeAttr("title")):this.clear()},i}),u.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,c){function r(e,t){r.__super__.constructor.apply(this,arguments)}return c.Extend(r,e),r.prototype.render=function(){var e=r.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('<ul class="select2-selection__rendered"></ul>'),e},r.prototype.bind=function(e,t){var n=this;r.__super__.bind.apply(this,arguments);var s=e.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",s),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){var t;n.isDisabled()||(t=i(this).parent(),t=c.GetData(t[0],"data"),n.trigger("unselect",{originalEvent:e,data:t}))}),this.$selection.on("keydown",".select2-selection__choice__remove",function(e){n.isDisabled()||e.stopPropagation()})},r.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},r.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},r.prototype.selectionContainer=function(){return i('<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>')},r.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",s=0;s<e.length;s++){var i=e[s],r=this.selectionContainer(),o=this.display(i,r),a=n+c.generateChars(4)+"-";i.id?a+=i.id:a+=c.generateChars(4),r.find(".select2-selection__choice__display").append(o).attr("id",a);var l=i.title||i.text;l&&r.attr("title",l);o=this.options.get("translations").get("removeItem"),l=r.find(".select2-selection__choice__remove");l.attr("title",o()),l.attr("aria-label",o()),l.attr("aria-describedby",a),c.StoreData(r[0],"data",i),t.push(r)}this.$selection.find(".select2-selection__rendered").append(t)}},r}),u.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();n.html(this.display(t)),n[0].classList.add("select2-selection__placeholder"),n[0].classList.remove("select2-selection__choice");t=t.title||t.text||n.text();return this.$selection.find(".select2-selection__rendered").attr("title",t),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();t=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(t)},e}),u.define("select2/selection/allowClear",["jquery","../keys","../utils"],function(i,s,a){function e(){}return e.prototype.bind=function(e,t,n){var s=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){s._handleClear(e)}),t.on("keypress",function(e){s._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 s=a.GetData(n[0],"data"),i=this.$element.val();this.$element.val(this.placeholder.id);var r={data:s};if(this.trigger("clear",r),r.prevented)this.$element.val(i);else{for(var o=0;o<s.length;o++)if(r={data:s[o]},this.trigger("unselect",r),r.prevented)return void this.$element.val(i);this.$element.trigger("input").trigger("change"),this.trigger("toggle",{})}}}},e.prototype._handleKeyboardClear=function(e,t,n){n.isOpen()||t.which!=s.DELETE&&t.which!=s.BACKSPACE||this._handleClear(t)},e.prototype.update=function(e,t){var n,s;e.call(this,t),this.$selection.find(".select2-selection__clear").remove(),this.$selection[0].classList.remove("select2-selection--clearable"),0<this.$selection.find(".select2-selection__placeholder").length||0===t.length||(n=this.$selection.find(".select2-selection__rendered").attr("id"),s=this.options.get("translations").get("removeAllItems"),(e=i('<button type="button" class="select2-selection__clear" tabindex="-1"><span aria-hidden="true">&times;</span></button>')).attr("title",s()),e.attr("aria-label",s()),e.attr("aria-describedby",n),a.StoreData(e[0],"data",t),this.$selection.prepend(e),this.$selection[0].classList.add("select2-selection--clearable"))},e}),u.define("select2/selection/search",["jquery","../utils","../keys"],function(s,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=this.options.get("translations").get("search"),n=s('<span class="select2-search select2-search--inline"><textarea class="select2-search__field" type="search" tabindex="-1" autocorrect="off" autocapitalize="none" spellcheck="false" role="searchbox" aria-autocomplete="list" ></textarea></span>');this.$searchContainer=n,this.$search=n.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",t());e=e.call(this);return this._transferTabIndex(),e.append(this.$searchContainer),e},e.prototype.bind=function(e,t,n){var s=this,i=t.id+"-results",r=t.id+"-container";e.call(this,t,n),s.$search.attr("aria-describedby",r),t.on("open",function(){s.$search.attr("aria-controls",i),s.$search.trigger("focus")}),t.on("close",function(){s.$search.val(""),s.resizeSearch(),s.$search.removeAttr("aria-controls"),s.$search.removeAttr("aria-activedescendant"),s.$search.trigger("focus")}),t.on("enable",function(){s.$search.prop("disabled",!1),s._transferTabIndex()}),t.on("disable",function(){s.$search.prop("disabled",!0)}),t.on("focus",function(e){s.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$search.removeAttr("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){s.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){s._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){var t;e.stopPropagation(),s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented(),e.which!==l.BACKSPACE||""!==s.$search.val()||0<(t=s.$selection.find(".select2-selection__choice").last()).length&&(t=a.GetData(t[0],"data"),s.searchRemoveChoice(t),e.preventDefault())}),this.$selection.on("click",".select2-search--inline",function(e){s.$search.val()&&e.stopPropagation()});var t=document.documentMode,o=t&&t<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){o?s.$selection.off("input.search input.searchcheck"):s.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){var t;o&&"input"===e.type?s.$selection.off("input.search input.searchcheck"):(t=e.which)!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&s.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}),u.define("select2/selection/selectionCss",["../utils"],function(n){function e(){}return e.prototype.render=function(e){var t=e.call(this),e=this.options.get("selectionCssClass")||"";return-1!==e.indexOf(":all:")&&(e=e.replace(":all:",""),n.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(e),t},e}),u.define("select2/selection/eventRelay",["jquery"],function(o){function e(){}return e.prototype.bind=function(e,t,n){var s=this,i=["open","opening","close","closing","select","selecting","unselect","unselecting","clear","clearing"],r=["opening","closing","selecting","unselecting","clearing"];e.call(this,t,n),t.on("*",function(e,t){var n;-1!==i.indexOf(e)&&(t=t||{},n=o.Event("select2:"+e,{params:t}),s.$element.trigger(n),-1!==r.indexOf(e)&&(t.prevented=n.isDefaultPrevented()))})},e}),u.define("select2/translation",["jquery","require"],function(t,n){function s(e){this.dict=e||{}}return s.prototype.all=function(){return this.dict},s.prototype.get=function(e){return this.dict[e]},s.prototype.extend=function(e){this.dict=t.extend({},e.all(),this.dict)},s._cache={},s.loadPath=function(e){var t;return e in s._cache||(t=n(e),s._cache[e]=t),new s(s._cache[e])},s}),u.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","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ώ":"ω","ς":"σ","’":"'"}}),u.define("select2/data/base",["../utils"],function(n){function s(e,t){s.__super__.constructor.call(this)}return n.Extend(s,n.Observable),s.prototype.current=function(e){throw new Error("The `current` method must be defined in child classes.")},s.prototype.query=function(e,t){throw new Error("The `query` method must be defined in child classes.")},s.prototype.bind=function(e,t){},s.prototype.destroy=function(){},s.prototype.generateResultId=function(e,t){e=e.id+"-result-";return e+=n.generateChars(4),null!=t.id?e+="-"+t.id.toString():e+="-"+n.generateChars(4),e},s}),u.define("select2/data/select",["./base","../utils","jquery"],function(e,a,l){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return a.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(l(e))}))},n.prototype.select=function(i){var e,r=this;if(i.selected=!0,null!=i.element&&"option"===i.element.tagName.toLowerCase())return i.element.selected=!0,void this.$element.trigger("input").trigger("change");this.$element.prop("multiple")?this.current(function(e){var t=[];(i=[i]).push.apply(i,e);for(var n=0;n<i.length;n++){var s=i[n].id;-1===t.indexOf(s)&&t.push(s)}r.$element.val(t),r.$element.trigger("input").trigger("change")}):(e=i.id,this.$element.val(e),this.$element.trigger("input").trigger("change"))},n.prototype.unselect=function(i){var r=this;if(this.$element.prop("multiple")){if(i.selected=!1,null!=i.element&&"option"===i.element.tagName.toLowerCase())return i.element.selected=!1,void this.$element.trigger("input").trigger("change");this.current(function(e){for(var t=[],n=0;n<e.length;n++){var s=e[n].id;s!==i.id&&-1===t.indexOf(s)&&t.push(s)}r.$element.val(t),r.$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(){a.RemoveData(this)})},n.prototype.query=function(t,e){var n=[],s=this;this.$element.children().each(function(){var e;"option"!==this.tagName.toLowerCase()&&"optgroup"!==this.tagName.toLowerCase()||(e=l(this),e=s.item(e),null!==(e=s.matches(t,e))&&n.push(e))}),e({results:n})},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);e=this._normalizeItem(e);return e.element=t,a.StoreData(t,"data",e),l(t)},n.prototype.item=function(e){var t={};if(null!=(t=a.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 s=e.children("option"),i=[],r=0;r<s.length;r++){var o=l(s[r]),o=this.item(o);i.push(o)}t.children=i}return(t=this._normalizeItem(t)).element=e[0],a.StoreData(e[0],"data",t),t},n.prototype._normalizeItem=function(e){e!==Object(e)&&(e={id:e,text:e});return null!=(e=l.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)),l.extend({},{selected:!1,disabled:!1},e)},n.prototype.matches=function(e,t){return this.options.get("matcher")(e,t)},n}),u.define("select2/data/array",["./select","../utils","jquery"],function(e,t,c){function s(e,t){this._dataToConvert=t.get("data")||[],s.__super__.constructor.call(this,e,t)}return t.Extend(s,e),s.prototype.bind=function(e,t){s.__super__.bind.call(this,e,t),this.addOptions(this.convertToOptions(this._dataToConvert))},s.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)),s.__super__.select.call(this,n)},s.prototype.convertToOptions=function(e){var t=this,n=this.$element.find("option"),s=n.map(function(){return t.item(c(this)).id}).get(),i=[];for(var r=0;r<e.length;r++){var o,a,l=this._normalizeItem(e[r]);0<=s.indexOf(l.id)?(o=n.filter(function(e){return function(){return c(this).val()==e.id}}(l)),a=this.item(o),a=c.extend(!0,{},l,a),a=this.option(a),o.replaceWith(a)):(a=this.option(l),l.children&&(l=this.convertToOptions(l.children),a.append(l)),i.push(a))}return i},s}),u.define("select2/data/ajax",["./array","../utils","jquery"],function(e,t,r){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 r.extend({},e,{q:e.term})},transport:function(e,t,n){e=r.ajax(e);return e.then(t),e.fail(n),e}};return r.extend({},t,e,!0)},n.prototype.processResults=function(e){return e},n.prototype.query=function(t,n){var s=this;null!=this._request&&("function"==typeof this._request.abort&&this._request.abort(),this._request=null);var i=r.extend({type:"GET"},this.ajaxOptions);function e(){var e=i.transport(i,function(e){e=s.processResults(e,t);s.options.get("debug")&&window.console&&console.error&&(e&&e.results&&Array.isArray(e.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),n(e)},function(){"status"in e&&(0===e.status||"0"===e.status)||s.trigger("results:message",{message:"errorLoading"})});s._request=e}"function"==typeof i.url&&(i.url=i.url.call(this.$element,t)),"function"==typeof i.data&&(i.data=i.data.call(this.$element,t)),this.ajaxOptions.delay&&null!=t.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(e,this.ajaxOptions.delay)):e()},n}),u.define("select2/data/tags",["jquery"],function(t){function e(e,t,n){var s=n.get("tags"),i=n.get("createTag");void 0!==i&&(this.createTag=i);i=n.get("insertTag");if(void 0!==i&&(this.insertTag=i),e.call(this,t,n),Array.isArray(s))for(var r=0;r<s.length;r++){var o=s[r],o=this._normalizeItem(o),o=this.option(o);this.$element.append(o)}}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 s=t.results,i=0;i<s.length;i++){var r=s[i],o=null!=r.children&&!e({results:r.children},!0);if((r.text||"").toUpperCase()===(c.term||"").toUpperCase()||o)return!n&&(t.data=s,void u(t))}if(n)return!0;var a,l=d.createTag(c);null!=l&&((a=d.option(l)).attr("data-select2-tag","true"),d.addOptions([a]),d.insertTag(s,l)),t.results=s,u(t)}):e.call(this,c,u)},e.prototype.createTag=function(e,t){if(null==t.term)return null;t=t.term.trim();return""===t?null:{id:t,text:t}},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}),u.define("select2/data/tokenizer",["jquery"],function(c){function e(e,t,n){var s=n.get("tokenizer");void 0!==s&&(this.tokenizer=s),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 s=this;t.term=t.term||"";var i=this.tokenizer(t,this.options,function(e){var t,n=s._normalizeItem(e);s.$element.find("option").filter(function(){return c(this).val()===n.id}).length||((t=s.option(n)).attr("data-select2-tag",!0),s._removeOldTags(),s.addOptions([t])),t=n,s.trigger("select",{data:t})});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,s){for(var i=n.get("tokenSeparators")||[],r=t.term,o=0,a=this.createTag||function(e){return{id:e.term,text:e.term}};o<r.length;){var l=r[o];-1!==i.indexOf(l)?(l=r.substr(0,o),null!=(l=a(c.extend({},t,{term:l})))?(s(l),r=r.substr(o+1)||"",o=0):o++):o++}return{term:r}},e}),u.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}),u.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}),u.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 s=this;e.call(this,t,n),t.on("select",function(){s._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var s=this;this._checkIfMaximumSelected(function(){e.call(s,t,n)})},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current(function(e){e=null!=e?e.length:0;0<n.maximumSelectionLength&&e>=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):t&&t()})},e}),u.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}),u.define("select2/dropdown/search",["jquery"],function(r){function e(){}return e.prototype.render=function(e){var t=e.call(this),n=this.options.get("translations").get("search"),e=r('<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=e,this.$search=e.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",n()),t.prepend(e),t},e.prototype.bind=function(e,t,n){var s=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){r(this).off("keyup")}),this.$search.on("keyup input",function(e){s.handleSearch(e)}),t.on("open",function(){s.$search.attr("tabindex",0),s.$search.attr("aria-controls",i),s.$search.trigger("focus"),window.setTimeout(function(){s.$search.trigger("focus")},0)}),t.on("close",function(){s.$search.attr("tabindex",-1),s.$search.removeAttr("aria-controls"),s.$search.removeAttr("aria-activedescendant"),s.$search.val(""),s.$search.trigger("blur")}),t.on("focus",function(){t.isOpen()||s.$search.trigger("focus")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(s.showSearch(e)?s.$searchContainer[0].classList.remove("select2-search--hide"):s.$searchContainer[0].classList.add("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$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}),u.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,s){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,s)}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),s=t.length-1;0<=s;s--){var i=t[s];this.placeholder.id===i.id&&n.splice(s,1)}return n},e}),u.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,s){this.lastParams={},e.call(this,t,n,s),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 s=this;e.call(this,t,n),t.on("query",function(e){s.lastParams=e,s.loading=!0}),t.on("query:append",function(e){s.lastParams=e,s.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&e&&(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}),u.define("select2/dropdown/attachBody",["jquery","../utils"],function(u,o){function e(e,t,n){this.$dropdownParent=u(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("open",function(){s._showDropdown(),s._attachPositioningHandler(t),s._bindContainerResultHandlers(t)}),t.on("close",function(){s._hideDropdown(),s._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=u("<span></span>"),e=e.call(this);return t.append(e),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,s="scroll.select2."+t.id,i="resize.select2."+t.id,r="orientationchange.select2."+t.id,t=this.$container.parents().filter(o.hasScroll);t.each(function(){o.StoreData(this,"select2-scroll-position",{x:u(this).scrollLeft(),y:u(this).scrollTop()})}),t.on(s,function(e){var t=o.GetData(this,"select2-scroll-position");u(this).scrollTop(t.y)}),u(window).on(s+" "+i+" "+r,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,s="resize.select2."+t.id,t="orientationchange.select2."+t.id;this.$container.parents().filter(o.hasScroll).off(n),u(window).off(n+" "+s+" "+t)},e.prototype._positionDropdown=function(){var e=u(window),t=this.$dropdown[0].classList.contains("select2-dropdown--above"),n=this.$dropdown[0].classList.contains("select2-dropdown--below"),s=null,i=this.$container.offset();i.bottom=i.top+this.$container.outerHeight(!1);var r={height:this.$container.outerHeight(!1)};r.top=i.top,r.bottom=i.top+r.height;var o=this.$dropdown.outerHeight(!1),a=e.scrollTop(),l=e.scrollTop()+e.height(),c=a<i.top-o,e=l>i.bottom+o,a={left:i.left,top:r.bottom},l=this.$dropdownParent;"static"===l.css("position")&&(l=l.offsetParent());i={top:0,left:0};(u.contains(document.body,l[0])||l[0].isConnected)&&(i=l.offset()),a.top-=i.top,a.left-=i.left,t||n||(s="below"),e||!c||t?!c&&e&&t&&(s="below"):s="above",("above"==s||t&&"below"!==s)&&(a.top=r.top-i.top-o),null!=s&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+s),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+s)),this.$dropdownContainer.css(a)},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}),u.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,s){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,s)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,s=0;s<t.length;s++){var i=t[s];i.children?n+=e(i.children):n++}return n}(t.data.results)<this.minimumResultsForSearch)&&e.call(this,t)},e}),u.define("select2/dropdown/selectOnClose",["../utils"],function(s){function e(){}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("close",function(e){s._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}n=this.getHighlightedResults();n.length<1||(null!=(n=s.GetData(n[0],"data")).element&&n.element.selected||null==n.element&&n.selected||this.trigger("select",{data:n}))},e}),u.define("select2/dropdown/closeOnSelect",[],function(){function e(){}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("select",function(e){s._selectTriggered(e)}),t.on("unselect",function(e){s._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}),u.define("select2/dropdown/dropdownCss",["../utils"],function(n){function e(){}return e.prototype.render=function(e){var t=e.call(this),e=this.options.get("dropdownCssClass")||"";return-1!==e.indexOf(":all:")&&(e=e.replace(":all:",""),n.copyNonInternalCssClasses(t[0],this.$element[0])),t.addClass(e),t},e}),u.define("select2/dropdown/tagsSearchHighlight",["../utils"],function(s){function e(){}return e.prototype.highlightFirstItem=function(e){var t=this.$results.find(".select2-results__option--selectable:not(.select2-results__option--selected)");if(0<t.length){var n=t.first(),t=s.GetData(n[0],"data").element;if(t&&t.getAttribute&&"true"===t.getAttribute("data-select2-tag"))return void n.trigger("mouseenter")}e.call(this)},e}),u.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,e="Please delete "+t+" character";return 1!=t&&(e+="s"),e},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"},search:function(){return"Search"}}}),u.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","./dropdown/tagsSearchHighlight","./i18n/en"],function(l,r,o,a,c,u,d,p,h,f,g,t,m,y,v,_,b,$,w,x,A,D,S,E,O,C,L,T,q,I,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=v:null!=e.data?e.dataAdapter=y:e.dataAdapter=m,0<e.minimumInputLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,$)),0<e.maximumInputLength&&(e.dataAdapter=f.Decorate(e.dataAdapter,w)),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,b))),null==e.resultsAdapter&&(e.resultsAdapter=r,null!=e.ajax&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,E)),null!=e.placeholder&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,S)),e.selectOnClose&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,L)),e.tags&&(e.resultsAdapter=f.Decorate(e.resultsAdapter,I))),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,C)),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,O)),null==e.selectionAdapter&&(e.multiple?e.selectionAdapter=a:e.selectionAdapter=o,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=[],s=0;s<e.language.length;s++){var i=e.language[s];-1===n.indexOf(i)&&n.push(i)}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 s=l.extend(!0,{},n),i=n.children.length-1;0<=i;i--)null==e(t,n.children[i])&&s.children.splice(i,1);return 0<s.children.length?s:e(t,s)}var r=a(n.text).toUpperCase(),o=a(t.term).toUpperCase();return-1<r.indexOf(o)?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,s=this.defaults.language,i=t.prop("lang"),t=t.closest("[lang]").prop("lang"),t=Array.prototype.concat.call(this._resolveLanguage(i),this._resolveLanguage(n),this._resolveLanguage(s),this._resolveLanguage(t));return e.language=t,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],s=[],i=0;i<n.length;i++)s.push(n[i]),"string"==typeof n[i]&&0<n[i].indexOf("-")&&(t=n[i].split("-")[0],s.push(t));return s},n.prototype._processTranslations=function(e,t){for(var n=new g,s=0;s<e.length;s++){var i=new g,r=e[s];if("string"==typeof r)try{i=g.loadPath(r)}catch(e){try{r=this.defaults.amdLanguageBase+r,i=g.loadPath(r)}catch(e){t&&window.console&&console.warn&&console.warn('Select2: The language file for "'+r+'" could not be automatically loaded. A fallback will be used instead.')}}else i=l.isPlainObject(r)?new g(r):r;n.extend(i)}return n},n.prototype.set=function(e,t){var n={};n[l.camelCase(e)]=t;n=f._convertData(n);l.extend(!0,this.defaults,n)},new n}),u.define("select2/options",["jquery","./defaults","./utils"],function(c,n,u){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),u.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.'),u.StoreData(e[0],"data",u.GetData(e[0],"select2Tags")),u.StoreData(e[0],"tags",!0)),u.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",u.GetData(e[0],"ajaxUrl")),u.StoreData(e[0],"ajax-Url",u.GetData(e[0],"ajaxUrl")));var n={};function s(e,t){return t.toUpperCase()}for(var i=0;i<e[0].attributes.length;i++){var r=e[0].attributes[i].name,o="data-";r.substr(0,o.length)==o&&(r=r.substring(o.length),o=u.GetData(e[0],r),n[r.replace(/-([a-z])/g,s)]=o)}c.fn.jquery&&"1."==c.fn.jquery.substr(0,2)&&e[0].dataset&&(n=c.extend(!0,{},e[0].dataset,n));var a,l=c.extend(!0,{},u.GetData(e[0]),n);for(a in l=u._convertData(l))-1<t.indexOf(a)||(c.isPlainObject(this.options[a])?c.extend(this.options[a],l[a]):this.options[a]=l[a]);return this},e.prototype.get=function(e){return this.options[e]},e.prototype.set=function(e,t){this.options[e]=t},e}),u.define("select2/core",["jquery","./options","./utils","./keys"],function(t,i,r,s){var o=function(e,t){null!=r.GetData(e[0],"select2")&&r.GetData(e[0],"select2").destroy(),this.$element=e,this.id=this._generateId(e),t=t||{},this.options=new i(t,e),o.__super__.constructor.call(this);var n=e.attr("tabindex")||0;r.StoreData(e[0],"old-tabindex",n),e.attr("tabindex","-1");t=this.options.get("dataAdapter");this.dataAdapter=new t(e,this.options);n=this.render();this._placeContainer(n);t=this.options.get("selectionAdapter");this.selection=new t(e,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,n);t=this.options.get("dropdownAdapter");this.dropdown=new t(e,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,n);n=this.options.get("resultsAdapter");this.results=new n(e,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var s=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(e){s.trigger("selection:update",{data:e})}),e[0].classList.add("select2-hidden-accessible"),e.attr("aria-hidden","true"),this._syncAttributes(),r.StoreData(e[0],"select2",this),e.data("select2",this)};return r.Extend(o,r.Observable),o.prototype._generateId=function(e){return"select2-"+(null!=e.attr("id")?e.attr("id"):null!=e.attr("name")?e.attr("name")+"-"+r.generateChars(2):r.generateChars(4)).replace(/(:|\.|\[|\]|,)/g,"")},o.prototype._placeContainer=function(e){e.insertAfter(this.$element);var t=this._resolveWidth(this.$element,this.options.get("width"));null!=t&&e.css("width",t)},o.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 s=this._resolveWidth(e,"style");return null!=s?s:this._resolveWidth(e,"element")}if("element"==t){s=e.outerWidth(!1);return s<=0?"auto":s+"px"}if("style"!=t)return"computedstyle"!=t?t:window.getComputedStyle(e[0]).width;e=e.attr("style");if("string"!=typeof e)return null;for(var i=e.split(";"),r=0,o=i.length;r<o;r+=1){var a=i[r].replace(/\s/g,"").match(n);if(null!==a&&1<=a.length)return a[1]}return null},o.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)},o.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=r.bind(this._syncAttributes,this),this._syncS=r.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})},o.prototype._registerDataEvents=function(){var n=this;this.dataAdapter.on("*",function(e,t){n.trigger(e,t)})},o.prototype._registerSelectionEvents=function(){var n=this,s=["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===s.indexOf(e)&&n.trigger(e,t)})},o.prototype._registerDropdownEvents=function(){var n=this;this.dropdown.on("*",function(e,t){n.trigger(e,t)})},o.prototype._registerResultsEvents=function(){var n=this;this.results.on("*",function(e,t){n.trigger(e,t)})},o.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===s.ESC||t===s.UP&&e.altKey?(n.close(e),e.preventDefault()):t===s.ENTER||t===s.TAB?(n.trigger("results:select",{}),e.preventDefault()):t===s.SPACE&&e.ctrlKey?(n.trigger("results:toggle",{}),e.preventDefault()):t===s.UP?(n.trigger("results:previous",{}),e.preventDefault()):t===s.DOWN&&(n.trigger("results:next",{}),e.preventDefault()):(t===s.ENTER||t===s.SPACE||t===s.DOWN&&e.altKey)&&(n.open(),e.preventDefault())})},o.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.isDisabled()?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},o.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},o.prototype._syncSubtree=function(e){var e=this._isChangeMutation(e),t=this;e&&this.dataAdapter.current(function(e){t.trigger("selection:update",{data:e})})},o.prototype.trigger=function(e,t){var n=o.__super__.trigger,s={open:"opening",close:"closing",select:"selecting",unselect:"unselecting",clear:"clearing"};if(void 0===t&&(t={}),e in s){var i=s[e],s={prevented:!1,name:e,args:t};if(n.call(this,i,s),s.prevented)return void(t.prevented=!0)}n.call(this,e,t)},o.prototype.toggleDropdown=function(){this.isDisabled()||(this.isOpen()?this.close():this.open())},o.prototype.open=function(){this.isOpen()||this.isDisabled()||this.trigger("query",{})},o.prototype.close=function(e){this.isOpen()&&this.trigger("close",{originalEvent:e})},o.prototype.isEnabled=function(){return!this.isDisabled()},o.prototype.isDisabled=function(){return this.options.get("disabled")},o.prototype.isOpen=function(){return this.$container[0].classList.contains("select2-container--open")},o.prototype.hasFocus=function(){return this.$container[0].classList.contains("select2-container--focus")},o.prototype.focus=function(e){this.hasFocus()||(this.$container[0].classList.add("select2-container--focus"),this.trigger("focus",{}))},o.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]);e=!e[0];this.$element.prop("disabled",e)},o.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},o.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();e=e[0];Array.isArray(e)&&(e=e.map(function(e){return e.toString()})),this.$element.val(e).trigger("input").trigger("change")},o.prototype.destroy=function(){r.RemoveData(this.$container[0]),this.$container.remove(),this._observer.disconnect(),this._observer=null,this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",r.GetData(this.$element[0],"old-tabindex")),this.$element[0].classList.remove("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),r.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},o.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")),r.StoreData(e[0],"element",this.$element),e},o}),u.define("jquery-mousewheel",["jquery"],function(e){return e}),u.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults","./select2/utils"],function(i,e,r,t,o){var a;return null==i.fn.select2&&(a=["open","close","destroy"],i.fn.select2=function(t){if("object"==typeof(t=t||{}))return this.each(function(){var e=i.extend(!0,{},t);new r(i(this),e)}),this;if("string"!=typeof t)throw new Error("Invalid arguments for Select2: "+t);var n,s=Array.prototype.slice.call(arguments,1);return this.each(function(){var e=o.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,s)}),-1<a.indexOf(t)?this:n}),null==i.fn.select2.defaults&&(i.fn.select2.defaults=t),r}),{define:u.define,require:u.require});function b(e,t){return i.call(e,t)}function l(e,t){var n,s,i,r,o,a,l,c,u,d,p=t&&t.split("/"),h=y.map,f=h&&h["*"]||{};if(e){for(t=(e=e.split("/")).length-1,y.nodeIdCompat&&_.test(e[t])&&(e[t]=e[t].replace(_,"")),"."===e[0].charAt(0)&&p&&(e=p.slice(0,p.length-1).concat(e)),c=0;c<e.length;c++)"."===(d=e[c])?(e.splice(c,1),--c):".."===d&&(0===c||1===c&&".."===e[2]||".."===e[c-1]||0<c&&(e.splice(c-1,2),c-=2));e=e.join("/")}if((p||f)&&h){for(c=(n=e.split("/")).length;0<c;--c){if(s=n.slice(0,c).join("/"),p)for(u=p.length;0<u;--u)if(i=h[p.slice(0,u).join("/")],i=i&&i[s]){r=i,o=c;break}if(r)break;!a&&f&&f[s]&&(a=f[s],l=c)}!r&&a&&(r=a,o=l),r&&(n.splice(0,o,r),e=n.join("/"))}return e}function w(t,n){return function(){var e=a.call(arguments,0);return"string"!=typeof e[0]&&1===e.length&&e.push(null),o.apply(p,e.concat([t,n]))}}function x(e){var t;if(b(m,e)&&(t=m[e],delete m[e],v[e]=!0,r.apply(p,t)),!b(g,e)&&!b(v,e))throw new Error("No "+e);return g[e]}function c(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 A(e){return e?c(e):[]}var u=s.require("jquery.select2");return t.fn.select2.amd=s,u});
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: cbutlerjr
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 4.0
5
  Tested up to: 6.0
6
- Stable tag: 3.4.4
7
 
8
  License: GPLv3
9
 
@@ -108,7 +108,7 @@ The FAQs are maintained at https://rocketgeek.com/plugins/wp-members/docs/faqs/
108
 
109
  == Upgrade Notice ==
110
 
111
- WP-Members 3.4.4 is a minor update. Backup prior to upgrading is recommended, but rollback is possible. See changelog for a list of updates. Minimum WP version is 4.0.
112
 
113
 
114
  == Screenshots ==
@@ -136,6 +136,20 @@ WP-Members 3.4.4 is a minor update. Backup prior to upgrading is recommended, bu
136
 
137
  * @todo WP-Members pluggable deprecated for use in theme functions.php (wpmem will be initialized when plugins are loaded). If you have any WP-Members pluggable functions that load in the theme functions.php, you'll need to move these to another location, such as a custom plugin file. Keep in mind, pluggable functions are no longer the preferred way of customizing (and have not been for many years) as most customizations, if not all, can be handled by using the plugin's filter and action hooks.
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  = 3.4.4 =
140
 
141
  * Adds excerpt to membership restricted content when excerpts are used and the user is logged in (should work the same as blocked content for a non-logged in user).
3
  Tags: access, authentication, content, login, member, membership, password, protect, register, registration, restriction, subscriber
4
  Requires at least: 4.0
5
  Tested up to: 6.0
6
+ Stable tag: 3.4.5
7
 
8
  License: GPLv3
9
 
108
 
109
  == Upgrade Notice ==
110
 
111
+ WP-Members 3.4.4 is a minor update. 3.4.4.2 is a compatibility release for users of WP-Members Advanced Options. Backup prior to upgrading is recommended, but rollback is possible. See changelog for a list of updates. Minimum WP version is 4.0.
112
 
113
 
114
  == Screenshots ==
136
 
137
  * @todo WP-Members pluggable deprecated for use in theme functions.php (wpmem will be initialized when plugins are loaded). If you have any WP-Members pluggable functions that load in the theme functions.php, you'll need to move these to another location, such as a custom plugin file. Keep in mind, pluggable functions are no longer the preferred way of customizing (and have not been for many years) as most customizations, if not all, can be handled by using the plugin's filter and action hooks.
138
 
139
+ = 3.4.5 =
140
+
141
+ * 3.4.4 is not compatible with [WP-Members Advanced Options](https://rocketgeek.com/plugins/wp-members-advanced-options/) when redirect to login is used. This version corrects that issue by rolling back the change to only load membership restriction functions when the membership products setting is enabled.
142
+ * Adds wpmem_login_form_button_rows filter hook.
143
+ * Adds wpmem_pwd_reset_email_link filter hook
144
+ * Adds API functions wpmem_profile_url(), wpmem_pwd_reset_url(), wpmem_register_url(), wpmem_forgot_username_url().
145
+ * Adds API functions wpmem_get_membership_name(), wpmem_get_membership_meta(), wpmem_get_membership_post_list(), wpmem_get_post_memberships(), wpmem_get_memberships().
146
+ * Adds API functions wpmem_add_query_where(), wpmem_get_query_where(), wpmem_add_user_view_link(), wpmem_get_user_view_link(), wpmem_get_user_view_count().
147
+ * Updates user views to use new API functions and adds capability to more easily customize user views.
148
+ * Code improvement: update instances of deprecated function wpmem_gettext() to use wpmem_get_text().
149
+ * Code improvement: update wpmem_user_has_role(), $current_user global no longer necessary.
150
+ * Code improvement: update select2 library to version 4.1.0.
151
+ * CSS update: defines columns widths for Settings > WP-Members > Fields table.
152
+
153
  = 3.4.4 =
154
 
155
  * Adds excerpt to membership restricted content when excerpts are used and the user is logged in (should work the same as blocked content for a non-logged in user).
wp-members.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP-Members
4
  Plugin URI: https://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/docs/">the online Users Guide</a>. A <a href="https://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
- Version: 3.4.4
7
  Author: Chad Butler
8
  Author URI: https://butlerblog.com/
9
  Text Domain: wp-members
@@ -58,7 +58,7 @@ if ( ! defined( 'ABSPATH' ) ) {
58
  }
59
 
60
  // Initialize constants.
61
- define( 'WPMEM_VERSION', '3.4.4' );
62
  define( 'WPMEM_DB_VERSION', '2.3.0' );
63
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
64
 
3
  Plugin Name: WP-Members
4
  Plugin URI: https://rocketgeek.com
5
  Description: WP access restriction and user registration. For more information on plugin features, refer to <a href="https://rocketgeek.com/plugins/wp-members/docs/">the online Users Guide</a>. A <a href="https://rocketgeek.com/plugins/wp-members/quick-start-guide/">Quick Start Guide</a> is also available. WP-Members(tm) is a trademark of butlerblog.com.
6
+ Version: 3.4.5
7
  Author: Chad Butler
8
  Author URI: https://butlerblog.com/
9
  Text Domain: wp-members
58
  }
59
 
60
  // Initialize constants.
61
+ define( 'WPMEM_VERSION', '3.4.5' );
62
  define( 'WPMEM_DB_VERSION', '2.3.0' );
63
  define( 'WPMEM_PATH', plugin_dir_path( __FILE__ ) );
64